Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Npoi
提交
8c44b083
N
Npoi
项目概览
int
/
Npoi
9 个月 前同步成功
通知
2
Star
1
Fork
1
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
N
Npoi
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
8c44b083
编写于
8月 12, 2023
作者:
G
Gan Keyu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
remove reflection in HSSFColor
上级
fd8103d1
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
15 addition
and
24 deletion
+15
-24
main/HSSF/Util/HSSFColor.cs
main/HSSF/Util/HSSFColor.cs
+15
-24
未找到文件。
main/HSSF/Util/HSSFColor.cs
浏览文件 @
8c44b083
...
...
@@ -15,6 +15,8 @@
limitations Under the License.
==================================================================== */
// REMOVE-REFLECITON: Reflection is used to retrieve the 2nd index of a color. Refactored using virtual getter.
namespace
NPOI.HSSF.Util
{
using
NPOI.SS.UserModel
;
...
...
@@ -22,7 +24,6 @@ namespace NPOI.HSSF.Util
using
System.Collections
;
using
System.Collections.Generic
;
using
System.IO
;
using
System.Reflection
;
/**
* Intends to provide support for the very evil index to triplet Issue and
* will likely replace the color constants interface for HSSF 2.0.
...
...
@@ -99,7 +100,7 @@ public HSSFColor()
for
(
int
i
=
0
;
i
<
colors
.
Length
;
i
++)
{
HSSFColor
color
=
colors
[
i
];
int
index2
=
GetIndex2
(
color
)
;
int
index2
=
color
.
Indexed2
;
if
(
index2
==
-
1
)
{
// most colors don't have a second index
...
...
@@ -120,18 +121,6 @@ public HSSFColor()
return
result
;
}
private
static
int
GetIndex2
(
HSSFColor
color
)
{
FieldInfo
f
=
color
.
GetType
().
GetField
(
"Index2"
,
BindingFlags
.
Static
|
BindingFlags
.
Public
);
if
(
f
==
null
)
{
return
-
1
;
}
short
s
=
(
short
)
f
.
GetValue
(
color
);
return
Convert
.
ToInt32
(
s
);
}
internal
static
HSSFColor
[]
GetAllColors
()
{
return
new
HSSFColor
[]
{
...
...
@@ -194,6 +183,7 @@ public virtual short Indexed
}
}
public
virtual
short
Indexed2
=>
-
1
;
public
byte
[]
RGB
{
get
{
return
this
.
GetTriplet
();
}
...
...
@@ -371,6 +361,7 @@ public class DarkBlue: HSSFColor
public
static
readonly
byte
[]
Triplet
=
{
0
,
0
,
128
};
public
const
string
HexString
=
"0:0:8080"
;
public
override
short
Indexed2
=>
Index2
;
public
override
short
Indexed
{
get
{
return
Index
;}
...
...
@@ -452,7 +443,7 @@ public class DarkRed: HSSFColor
public
const
short
Index2
=
0x25
;
public
static
readonly
byte
[]
Triplet
=
{
128
,
0
,
0
};
public
const
string
HexString
=
"8080:0:0"
;
public
override
short
Indexed2
=>
Index2
;
public
override
short
Indexed
{
get
{
return
Index
;}
...
...
@@ -561,7 +552,7 @@ public class Teal: HSSFColor
public
const
short
Index2
=
0x26
;
public
static
readonly
byte
[]
Triplet
=
{
0
,
128
,
128
};
public
const
string
HexString
=
"0:8080:8080"
;
public
override
short
Indexed2
=>
Index2
;
public
override
short
Indexed
{
get
{
return
Index
;}
...
...
@@ -589,7 +580,7 @@ public class Blue: HSSFColor
public
const
short
Index2
=
0x27
;
public
static
readonly
byte
[]
Triplet
=
{
0
,
0
,
255
};
public
const
string
HexString
=
"0:0:FFFF"
;
public
override
short
Indexed2
=>
Index2
;
public
override
short
Indexed
{
get
{
return
Index
;}
...
...
@@ -822,7 +813,7 @@ public class Violet: HSSFColor
public
const
short
Index2
=
0x24
;
public
static
readonly
byte
[]
Triplet
=
{
128
,
0
,
128
};
public
const
string
HexString
=
"8080:0:8080"
;
public
override
short
Indexed2
=>
Index2
;
public
override
short
Indexed
{
get
{
return
Index
;}
...
...
@@ -872,7 +863,7 @@ public class Pink: HSSFColor
public
const
short
Index2
=
0x21
;
public
static
readonly
byte
[]
Triplet
=
{
255
,
0
,
255
};
public
const
string
HexString
=
"FFFF:0:FFFF"
;
public
override
short
Indexed2
=>
Index2
;
public
override
short
Indexed
{
get
{
return
Index
;}
...
...
@@ -918,7 +909,7 @@ public class Yellow: HSSFColor
public
const
short
Index2
=
0x22
;
public
static
readonly
byte
[]
Triplet
=
{
255
,
255
,
0
};
public
const
string
HexString
=
"FFFF:FFFF:0"
;
public
override
short
Indexed2
=>
Index2
;
public
override
short
Indexed
{
get
{
return
Index
;}
...
...
@@ -941,7 +932,7 @@ public class BrightGreen: HSSFColor
public
const
short
Index2
=
0x23
;
public
static
readonly
byte
[]
Triplet
=
{
0
,
255
,
0
};
public
const
string
HexString
=
"0:FFFF:0"
;
public
override
short
Indexed2
=>
Index2
;
public
override
String
GetHexString
()
{
return
HexString
;
...
...
@@ -969,7 +960,7 @@ public class Turquoise: HSSFColor
public
const
short
Index2
=
0x23
;
public
static
readonly
byte
[]
Triplet
=
{
0
,
255
,
255
};
public
const
string
HexString
=
"0:FFFF:FFFF"
;
public
override
short
Indexed2
=>
Index2
;
public
override
short
Indexed
{
get
{
return
Index
;}
...
...
@@ -1024,7 +1015,7 @@ public class Plum: HSSFColor
public
const
short
Index2
=
0x19
;
public
static
readonly
byte
[]
Triplet
=
{
153
,
51
,
102
};
public
const
string
HexString
=
"9999:3333:6666"
;
public
override
short
Indexed2
=>
Index2
;
public
override
short
Indexed
{
get
{
return
Index
;}
...
...
@@ -1187,7 +1178,7 @@ public class LightTurquoise: HSSFColor
public
const
short
Index2
=
0x1b
;
public
static
readonly
byte
[]
Triplet
=
{
204
,
255
,
255
};
public
const
string
HexString
=
"CCCC:FFFF:FFFF"
;
public
override
short
Indexed2
=>
Index2
;
public
override
short
Indexed
{
get
{
return
Index
;}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录