SinGooCMS.Utility: 包

SinGooCMS.Utility 1.6.2
  • 首页
  • 包
  • 类
  • 文件
  • 包
  • 包函数
包
这里列出所有的包，附带简要说明(如果有的话):
[详情级别 123]
▼N SinGooCMS
▼N Utility
N Extension
制作者 doxygen 1.8.10


SinGooCMS.Utility: SinGooCMS 命名空间参考

  • 类
  • 文件
  • 包
  • 包函数
命名空间
SinGooCMS 命名空间参考

命名空间

namespace Utility


SinGooCMS.Utility: SinGooCMS.Utility 命名空间参考

  • 包
  • 包函数
  • SinGooCMS
  • Utility
命名空间 | 类 | 枚举
SinGooCMS.Utility 命名空间参考

命名空间

namespace Extension

类

class | Accessor
用于构建ObjectAccessor和 GenericAccessor<TInstance>实例。 更多...
class | AccessorBuilder
提供一系列快速构建

参见
Accessor

实例的方法 更多...

class | AdoUtils
这里只提供SqlServer的简单操作，具体可参考SinGooCMS.Ado 更多...
class | Base64FileUtils
base64字符串和文件互转 更多...
class | CacheUtils
缓存管理 更多...
class | CaptchaUtils
图形验证码工具 更多...
class | CellPhonePrefix
手机号码前缀 更多...
class | ChinaDate
公历转农历 更多...
class | ChineseCalendar
中国日历 更多...
class | CNDate
农历属性 更多...
class | ConfigUtils
配置管理 更多...
class | CookieUtils
cookie工具 更多...
class | CsvUtils
csv工具 更多...
class | DatetimeUtils
日期工具 更多...
class | DEncryptUtils
加密解密工具 更多...
class | EntityAttrUtils
实体类 特性工具 更多...
class | EnumUtils
枚举帮助类 更多...
class | ExceptionUtils
异常信息格式化 更多...
class | FileUtils
文件管理工具 更多...
class | FtpClient
FTP客户端操作类 更多...
class | GenericAccessor
快速访问给定类型的对象的属性值, 参照:

参见
Accessor
更多...
class | HexUtils
16进制字符串之间的转换帮助类. 更多...
class | IdCardUtils
身份证工具 更多...
class | IISUtils
IIS操作 更多...
class | ImageUtils
图片处理 更多...
class | IPAreaInfo
IP地理位置信息 更多...
class | IPScanner
读取纯真IP数据库，定位IP地址 更多...
class | IPUtils
IP工具 更多...
class | JsonFileUtils
JSON文件工具 更多...
class | LibInvoker
非托管方法调用 更多...
class | MailConfig
邮件服务配置 更多...
class | MailUtils
class | MimeMapping
class | NetWorkUtils
模拟 httpget 和 httppost 更多...
class | NPOIUtils
NPOI工具类
来自: 更多...
class | ObjectAccessor
快速访问给定类型的对象的属性值, 参照:

参见
Accessor
更多...
class | OperationResult
操作返回结果
<exsample> "ReturnStatusType": 1, —返回状态类型
"StatusCode": "200", —错误信息代码
"ErrorMessage": "操作成功", —错误信息
"ErrorENMessage": "ok", —英文错误信息
"TimeStamp": "2020-01-06 12:13:14", —当前时间 </exsample> 更多...
class | PagerModel
分页模型 更多...
class | PagerUtils
分页栏工具 更多...
class | ParameterRebinder
class | PredicateBuilder
对 Lambda 表达式进行动态拼接的逻辑 更多...
class | ProcessUtils
执行系统进程 更多...
class | QueryExtension
查询并分页 更多...
class | ReflectionUtils
反射操作 更多...
class | RegistryUtils
注册表操作，Win平台专有(需要有管理员权限) 更多...
class | RSACryption
class | SessionUtils
session会话工具 更多...
class | ShareFileUtils
局域网共享文件工具 更多...
class | SinGooArray
ArrayList扩展，实现取范围数据 更多...
class | SinGooDictionary
Dictionary扩展，实现从下标取值 更多...
class | SinGooList
List扩展，实现取范围数据 更多...
class | SocketClient
Socket客户端操作类 更多...
class | StopwatchUtils
计数器帮助类 更多...
class | StringUtils
字符串处理 更多...
class | TimeUtils
时间工具 更多...
class | UnicodeUtils
unicode 编解码
"空\u0020格" => "空 格"
"空 格" => "\u7a7a\u20\u683c" 更多...
class | UtilsBase
工具底层，主要获取 http上下文 HttpContext。netfx从system.web中读取，core需要注入 更多...
class | VideoUtils
视频剪切工具.上传视频后可截取视频存储为图片,注意要调用文件：ffmpeg.exe 更多...
class | WebUtils
web工具 更多...
class | XmlUtils
xml工具 更多...
class | ZipUtils
压缩和解压 更多...

枚举

enum | FileSizeUnit { FileSizeUnit.KB, FileSizeUnit.MB, FileSizeUnit.GB, FileSizeUnit.TB }
文件尺寸大小单位 更多...
enum | ThumbnailCutMode { ThumbnailCutMode.LockHeight, ThumbnailCutMode.LockWidth, ThumbnailCutMode.Fixed, ThumbnailCutMode.Cut }
缩略图图像裁剪模式 更多...
enum WatermarkPosition {
WatermarkPosition.None, WatermarkPosition.TopLeft, WatermarkPosition.TopCenter, WatermarkPosition.TopRight,
WatermarkPosition.MiddleLeft, WatermarkPosition.MiddleCenter, WatermarkPosition.MiddleRight, WatermarkPosition.BottomLeft,
WatermarkPosition.BottomCenter, WatermarkPosition.BottomRight
}
水印位置 更多...

枚举类型说明

enum SinGooCMS.Utility.FileSizeUnit
strong

文件尺寸大小单位

枚举值
KB
MB
GB
TB

在文件 FileUtils.cs 第 13 行定义.

enum SinGooCMS.Utility.ThumbnailCutMode
strong

缩略图图像裁剪模式

枚举值
LockHeight | 锁定高度
LockWidth | 锁定宽度
Fixed | 固定宽高
Cut | 裁剪

在文件 ThumbnailCutMode.cs 第 6 行定义.

enum SinGooCMS.Utility.WatermarkPosition
strong

水印位置

枚举值
None | 无水印
TopLeft | 左上位置
TopCenter | 上中位置
TopRight | 右上位置
MiddleLeft | 中左位置
MiddleCenter | 正中位置
MiddleRight | 中右位置
BottomLeft | 左下位置
BottomCenter | 下中位置
BottomRight | 右下位置

在文件 WatermarkPosition.cs 第 6 行定义.


SinGooCMS.Utility: SinGooCMS.Utility.Extension 命名空间参考

  • 包
  • 包函数
  • SinGooCMS
  • Utility
  • Extension
类 | 枚举
SinGooCMS.Utility.Extension 命名空间参考

类

class | AssemblyExtension
Assembly扩展类 更多...
class | DataTableExtension
数据集扩展 更多...
class | DataTypeChangeExtension
数据类型转换,利用TryParse判断是否可转换，如果能则返回转换后的值，否则返回默认值 更多...
class | DateTimeExtension
日期扩展 更多...
class | DictionaryExtension
字典扩展类 更多...
class | DisplayExtAttribute
特性扩展类
属性的显示扩展,优先使用资源Name,默认使用自带的Name,注意：仅适用于MVC 更多...
class | EnumExtension
枚举扩展 更多...
class | IConvertibleExtension
可转换扩展 更多...
class | IEnumerableExtension
遍历扩展 更多...
class | ImageExtension
image图像扩展 更多...
class | IOExtension
IO扩展 更多...
class | JsonserializeExtension
json扩展 更多...
class | LinqExtension
linq扩展方法 更多...
class | ObjectExtension
对象扩展 更多...
class | ReflectExtension
反射扩展 更多...
class | StreamExtension
流扩展 更多...
class | StringExtension
字符串扩展 更多...
class | StringUTF8Writer
转xml时编码为UTF8
class | TaskExtensions
System.Threading.Tasks扩展类 更多...
class | TypeExtensions
Type扩展类 更多...
class | UriExtension
提供一组使用Uri的辅助方法。 更多...
class | ValidateExtension
验证扩展 更多...
class | XmlserializeExtension
xml序列化扩展 更多...

枚举

enum SequenceType {
SequenceType.Invalid = 0, SequenceType.String, SequenceType.Array, SequenceType.BitArray,
SequenceType.ArrayList, SequenceType.Queue, SequenceType.Stack, SequenceType.Hashtable,
SequenceType.SortedList, SequenceType.Dictionary, SequenceType.ListDictionary, SequenceType.IList,
SequenceType.ICollection, SequenceType.IDictionary, SequenceType.IEnumerable, SequenceType.Custom,
SequenceType.GenericList, SequenceType.GenericLinkedList, SequenceType.GenericCollection, SequenceType.GenericQueue,
SequenceType.GenericStack, SequenceType.GenericHashSet, SequenceType.GenericSortedList, SequenceType.GenericDictionary,
SequenceType.GenericSortedDictionary, SequenceType.GenericBlockingCollection, SequenceType.GenericConcurrentDictionary, SequenceType.GenericConcurrentBag,
SequenceType.GenericIList, SequenceType.GenericICollection, SequenceType.GenericIEnumerable, SequenceType.GenericIDictionary,
SequenceType.GenericICollectionKeyValue, SequenceType.GenericIEnumerableKeyValue, SequenceType.GenericCustom
}
表示可能的序列类型(集合) 更多...

枚举类型说明

enum SinGooCMS.Utility.Extension.SequenceType
strong

表示可能的序列类型(集合)

枚举值
Invalid | 不是一个序列类型
String | 代表 System.String.
Array | 代表 Array.
BitArray | 代表 System.Collections.BitArray. 非泛型
ArrayList | 代表 System.Collections.ArrayList. 非泛型
Queue | 代表 System.Collections.Queue. 非泛型
Stack | 代表 System.Collections.Stack. 非泛型
Hashtable | 代表 System.Collections.Hashtable. 非泛型
SortedList | 代表 System.Collections.SortedList. 非泛型
Dictionary | 代表 Dictionary. 非泛型
ListDictionary | 代表 ListDictionary. 非泛型
IList | 代表 System.Collections.IList. 非泛型
ICollection | 代表 System.Collections.ICollection. 非泛型
IDictionary | 代表 System.Collections.IDictionary. 非泛型
IEnumerable | 代表n System.Collections.IEnumerable. 非泛型
Custom | 代表 自己实现的 System.Collections.IEnumerable.
GenericList | 代表 System.Collections.Generic.List<T>.
GenericLinkedList | 代表 System.Collections.Generic.LinkedList<T>.
GenericCollection | 代表 Collection<T>.
GenericQueue | 代表 System.Collections.Generic.Queue<T>.
GenericStack | 代表 System.Collections.Generic.Stack<T>.
GenericHashSet | 代表 System.Collections.Generic.HashSet<T>.
GenericSortedList | 代表 System.Collections.Generic.SortedList<TKey,TValue>.
GenericDictionary | 代表 System.Collections.Generic.Dictionary<TKey,TValue>.
GenericSortedDictionary | 代表 System.Collections.Generic.SortedDictionary<TKey, TValue>.
GenericBlockingCollection | 代表 System.Collections.Concurrent.BlockingCollection<T>.
GenericConcurrentDictionary | 代表 System.Collections.Concurrent.ConcurrentDictionary<TKey, TValue>.
GenericConcurrentBag | 代表 System.Collections.Concurrent.ConcurrentBag<T>.
GenericIList | 代表 IList<T>.
GenericICollection | 代表 ICollection<T>.
GenericIEnumerable | 代表 IEnumerable<T>.
GenericIDictionary | 代表 IDictionary<TKey, TValue>.
GenericICollectionKeyValue | 代表 <cref>ICollection{KeyValuePair{TKey, TValue}}</cref> .
GenericIEnumerableKeyValue | 代表 <cref>IEnumerable{KeyValuePair{TKey, TValue}}</cref> .
GenericCustom | 代表 自定义实现的 IEnumerable<T>.

在文件 TypeExtensions.cs 第 576 行定义.


SinGooCMS.Utility: 包函数

  • 包
  • 包函数
  • 全部
  • 枚举
这里列出了所有命名空间成员，并附带其说明文档:
  • FileSizeUnit : SinGooCMS.Utility
  • SequenceType : SinGooCMS.Utility.Extension
  • ThumbnailCutMode : SinGooCMS.Utility
  • WatermarkPosition : SinGooCMS.Utility


SinGooCMS.Utility: 包函数

  • 包
  • 包函数
  • 全部
  • 枚举
  • FileSizeUnit : SinGooCMS.Utility
  • SequenceType : SinGooCMS.Utility.Extension
  • ThumbnailCutMode : SinGooCMS.Utility
  • WatermarkPosition : SinGooCMS.Utility


SinGooCMS.Utility: 类列表

  • 类列表
  • 类索引
  • 类继承关系
  • 类成员
类列表
这里列出了所有类、结构、联合以及接口定义等，并附带简要说明:
[详情级别 1234]
▼N SinGooCMS
▼N Utility
▼N Extension
C AssemblyExtension | Assembly扩展类
C DataTableExtension | 数据集扩展
C DataTypeChangeExtension | 数据类型转换,利用TryParse判断是否可转换，如果能则返回转换后的值，否则返回默认值
C DateTimeExtension | 日期扩展
C DictionaryExtension | 字典扩展类
C DisplayExtAttribute 特性扩展类
属性的显示扩展,优先使用资源Name,默认使用自带的Name,注意：仅适用于MVC
C EnumExtension | 枚举扩展
C IConvertibleExtension | 可转换扩展
C IEnumerableExtension | 遍历扩展
C ImageExtension | image图像扩展
C IOExtension | IO扩展
C JsonserializeExtension | json扩展
C LinqExtension | linq扩展方法
C ObjectExtension | 对象扩展
C ReflectExtension | 反射扩展
C StreamExtension | 流扩展
C StringExtension | 字符串扩展
C TaskExtensions | System.Threading.Tasks扩展类
C TypeExtensions | Type扩展类
C UriExtension | 提供一组使用Uri的辅助方法。
C ValidateExtension | 验证扩展
C XmlserializeExtension | xml序列化扩展
C Accessor | 用于构建ObjectAccessor和 GenericAccessor<TInstance>实例。
C AccessorBuilder 提供一系列快速构建

参见
Accessor

实例的方法

C AdoUtils | 这里只提供SqlServer的简单操作，具体可参考SinGooCMS.Ado
C Base64FileUtils | base64字符串和文件互转
C CacheUtils | 缓存管理
C CaptchaUtils | 图形验证码工具
C CellPhonePrefix | 手机号码前缀
C ChinaDate | 公历转农历
▼C ChineseCalendar | 中国日历
C LunarHolidayStruct | 农历
C SolarHolidayStruct | 阳历
C WeekHolidayStruct
C CNDate | 农历属性
C ConfigUtils | 配置管理
C CookieUtils | cookie工具
C CsvUtils | csv工具
C DatetimeUtils | 日期工具
C DEncryptUtils | 加密解密工具
C EntityAttrUtils | 实体类 特性工具
C EnumUtils | 枚举帮助类
C ExceptionUtils | 异常信息格式化
C FileUtils | 文件管理工具
C FtpClient | FTP客户端操作类
C GenericAccessor 快速访问给定类型的对象的属性值, 参照:

参见
Accessor
C HexUtils | 16进制字符串之间的转换帮助类.
C IdCardUtils | 身份证工具
C IISUtils | IIS操作
C ImageUtils | 图片处理
C IPAreaInfo | IP地理位置信息
C IPScanner | 读取纯真IP数据库，定位IP地址
C IPUtils | IP工具
C JsonFileUtils | JSON文件工具
C LibInvoker | 非托管方法调用
C MailConfig | 邮件服务配置
C MailUtils
C NetWorkUtils | 模拟 httpget 和 httppost
C NPOIUtils NPOI工具类
来自:
C ObjectAccessor 快速访问给定类型的对象的属性值, 参照:

参见
Accessor
C OperationResult 操作返回结果
<exsample> "ReturnStatusType": 1, —返回状态类型
"StatusCode": "200", —错误信息代码
"ErrorMessage": "操作成功", —错误信息
"ErrorENMessage": "ok", —英文错误信息
"TimeStamp": "2020-01-06 12:13:14", —当前时间 </exsample>
C PagerModel | 分页模型
C PagerUtils | 分页栏工具
C PredicateBuilder | 对 Lambda 表达式进行动态拼接的逻辑
C ProcessUtils | 执行系统进程
C QueryExtension | 查询并分页
C ReflectionUtils | 反射操作
C RegistryUtils | 注册表操作，Win平台专有(需要有管理员权限)
C RSACryption
C SessionUtils | session会话工具
C ShareFileUtils | 局域网共享文件工具
C SinGooArray | ArrayList扩展，实现取范围数据
C SinGooDictionary | Dictionary扩展，实现从下标取值
C SinGooList | List扩展，实现取范围数据
C SocketClient | Socket客户端操作类
C StopwatchUtils | 计数器帮助类
C StringUtils | 字符串处理
C TimeUtils | 时间工具
C UnicodeUtils unicode 编解码
"空\u0020格" => "空 格"
"空 格" => "\u7a7a\u20\u683c"
C UtilsBase | 工具底层，主要获取 http上下文 HttpContext。netfx从system.web中读取，core需要注入
C VideoUtils | 视频剪切工具.上传视频后可截取视频存储为图片,注意要调用文件：ffmpeg.exe
C WebUtils | web工具
C XmlUtils | xml工具
C ZipUtils | 压缩和解压


SinGooCMS.Utility: SinGooCMS.Utility.Extension.AssemblyExtension类 参考

  • SinGooCMS
  • Utility
  • Extension
  • AssemblyExtension
静态 Public 成员函数 | 所有成员列表
SinGooCMS.Utility.Extension.AssemblyExtension类 参考

Assembly扩展类 更多...

静态 Public 成员函数

static string | GetFrameworkVersion (this Assembly assembly)
获取程序集标记的 .net 版本 更多...
static DirectoryInfo | GetAssemblyLocation (this Assembly assembly)
获取程序集文件所在的目录 从

参见
Assembly.Location

处获取 更多...

static DirectoryInfo | GetAssemblyCodeBase (this Assembly assembly)
获取程序集文件所在的目录 从

参见
Assembly.CodeBase

处实现 更多...

static bool | IsOptimized (this Assembly assembly)
当前程序集是否以Release模式编译 参照 更多...
static bool | Is32Bit (this Assembly assembly)
当前程序集是否是32位 更多...

详细描述

Assembly扩展类

在文件 AssemblyExtensions.cs 第 13 行定义.

成员函数说明

static DirectoryInfo SinGooCMS.Utility.Extension.AssemblyExtension.GetAssemblyCodeBase ( this Assembly assembly )
static

获取程序集文件所在的目录 从

参见
Assembly.CodeBase

处实现

在文件 AssemblyExtensions.cs 第 40 行定义.

static DirectoryInfo SinGooCMS.Utility.Extension.AssemblyExtension.GetAssemblyLocation ( this Assembly assembly )
static

获取程序集文件所在的目录 从

参见
Assembly.Location

处获取

在文件 AssemblyExtensions.cs 第 32 行定义.

static string SinGooCMS.Utility.Extension.AssemblyExtension.GetFrameworkVersion ( this Assembly assembly )
static

获取程序集标记的 .net 版本

参数
assembly The assembly

在文件 AssemblyExtensions.cs 第 19 行定义.

static bool SinGooCMS.Utility.Extension.AssemblyExtension.Is32Bit ( this Assembly assembly )
static

当前程序集是否是32位

在文件 AssemblyExtensions.cs 第 71 行定义.

static bool SinGooCMS.Utility.Extension.AssemblyExtension.IsOptimized ( this Assembly assembly )
static

当前程序集是否以Release模式编译 参照

在文件 AssemblyExtensions.cs 第 49 行定义.

该类的文档由以下文件生成:
  • SinGooCMS.Utility/Extension/AssemblyExtensions.cs


SinGooCMS.Utility: SinGooCMS.Utility.Extension.DataTableExtension类 参考

  • SinGooCMS
  • Utility
  • Extension
  • DataTableExtension
静态 Public 成员函数 | 所有成员列表
SinGooCMS.Utility.Extension.DataTableExtension类 参考

数据集扩展 更多...

静态 Public 成员函数

static DataTable | ToDistinctTable (this DataTable table, string[] arrFilter)
获得一个去重的新表 更多...
static T | ToEntity< T > (this DataTable table)
DataTable转实体 更多...
static IEnumerable< T > | ToEnumerable< T > (this DataTable table)
DataTable转实体集合 更多...
static ArrayList | ToArrayList (this DataTable table)
dt转arraylist 更多...
static DataRow | FindRow (this DataTable dt, string colKey, string colValue)
查找数据表的行 更多...
static bool | ExistsRow (this DataTable dt, string colKey, string colValue)
是否存在行值 更多...
static DataTable | RemoveEmptyRow (this DataTable dt)
删除空白行 更多...
static DataTable | ChangeColNames (this DataTable table, Dictionary< string, string > newColNames)
更换列名 更多...
static void | SaveToExcel (this DataTable table, string excelFileFullPath, string sheetName="sheet1")
Datatable写入excel 更多...
static void | SaveToExcel (this Dictionary< string, DataTable > tables, string excelFileFullPath)
Datatable写入excel 更多...
static void | SaveToCsv (this DataTable table, string csvFileFullPath, string encoding="utf-8")
datatable写入csv 更多...
static async Task | SaveToCsvAsync (this DataTable table, string csvFileFullPath, string encoding="utf-8")
datatable写入csv 更多...
static void | SaveToCsv< T > (this DataTable table, string csvFileFullPath, string encoding="utf-8")
datatable写入csv 更多...
static async Task | SaveToCsvAsync< T > (this DataTable table, string csvFileFullPath, string encoding="utf-8")
datatable写入csv 更多...

详细描述

数据集扩展

在文件 DataTableExtension.cs 第 14 行定义.

成员函数说明

static DataTable SinGooCMS.Utility.Extension.DataTableExtension.ChangeColNames | ( | this DataTable | table,
 |  | Dictionary< string, string > | newColNames
 | ) |  |
static

更换列名

参数
table
newColNames
返回

在文件 DataTableExtension.cs 第 201 行定义.

static bool SinGooCMS.Utility.Extension.DataTableExtension.ExistsRow | ( | this DataTable | dt,
 |  | string | colKey,
 |  | string | colValue
 | ) |  |
static

是否存在行值

参数
dt
colKey
colValue
返回

在文件 DataTableExtension.cs 第 154 行定义.

static DataRow SinGooCMS.Utility.Extension.DataTableExtension.FindRow | ( | this DataTable | dt,
 |  | string | colKey,
 |  | string | colValue
 | ) |  |
static

查找数据表的行

参数
dt | 数据表
colKey | 单元列名
colValue | 单元列值
返回

在文件 DataTableExtension.cs 第 140 行定义.

static DataTable SinGooCMS.Utility.Extension.DataTableExtension.RemoveEmptyRow ( this DataTable dt )
static

删除空白行

参数
dt
返回

在文件 DataTableExtension.cs 第 164 行定义.

static void SinGooCMS.Utility.Extension.DataTableExtension.SaveToCsv | ( | this DataTable | table,
 |  | string | csvFileFullPath,
 |  | string | encoding = "utf-8"
 | ) |  |
static

datatable写入csv

参数
table
csvFileFullPath
encoding
static void SinGooCMS.Utility.Extension.DataTableExtension.SaveToCsv< T > | ( | this DataTable | table,
 |  | string | csvFileFullPath,
 |  | string | encoding = "utf-8"
 | ) |  |
static

datatable写入csv

参数
table
csvFileFullPath
encoding
类型限制
T : class
T : new()

在文件 DataTableExtension.cs 第 263 行定义.

函数调用图:

static async Task SinGooCMS.Utility.Extension.DataTableExtension.SaveToCsvAsync | ( | this DataTable | table,
 |  | string | csvFileFullPath,
 |  | string | encoding = "utf-8"
 | ) |  |
static

datatable写入csv

参数
table
csvFileFullPath
encoding
static async Task SinGooCMS.Utility.Extension.DataTableExtension.SaveToCsvAsync< T > | ( | this DataTable | table,
 |  | string | csvFileFullPath,
 |  | string | encoding = "utf-8"
 | ) |  |
static

datatable写入csv

模板参数
T
参数
table
csvFileFullPath
encoding
返回
类型限制
T : class
T : new()

在文件 DataTableExtension.cs 第 276 行定义.

函数调用图:

static void SinGooCMS.Utility.Extension.DataTableExtension.SaveToExcel | ( | this DataTable | table,
 |  | string | excelFileFullPath,
 |  | string | sheetName = "sheet1"
 | ) |  |
static

Datatable写入excel

参数
table
excelFileFullPath
sheetName
static void SinGooCMS.Utility.Extension.DataTableExtension.SaveToExcel | ( | this Dictionary< string, DataTable > | tables,
 |  | string | excelFileFullPath
 | ) |  |
static

Datatable写入excel

参数
tables
excelFileFullPath
static ArrayList SinGooCMS.Utility.Extension.DataTableExtension.ToArrayList ( this DataTable table )
static

dt转arraylist

参数
table
返回

在文件 DataTableExtension.cs 第 104 行定义.

static DataTable SinGooCMS.Utility.Extension.DataTableExtension.ToDistinctTable | ( | this DataTable | table,
 |  | string[] | arrFilter
 | ) |  |
static

获得一个去重的新表

参数
table | 源表
arrFilter | 新表字段
返回

在文件 DataTableExtension.cs 第 22 行定义.

static T SinGooCMS.Utility.Extension.DataTableExtension.ToEntity< T > ( this DataTable table )
static

DataTable转实体

模板参数
T 实体
参数
table DataTable实例
返回
类型限制
T : new()

在文件 DataTableExtension.cs 第 36 行定义.

static IEnumerable<T> SinGooCMS.Utility.Extension.DataTableExtension.ToEnumerable< T > ( this DataTable table )
static

DataTable转实体集合

模板参数
T 实体
参数
table DataTable实例
返回
类型限制
T : class
T : new()

在文件 DataTableExtension.cs 第 67 行定义.

该类的文档由以下文件生成:
  • SinGooCMS.Utility/Extension/DataTableExtension.cs


SinGooCMS.Utility: SinGooCMS.Utility.Extension.DataTypeChangeExtension类 参考

  • SinGooCMS
  • Utility
  • Extension
  • DataTypeChangeExtension
静态 Public 成员函数 | 所有成员列表
SinGooCMS.Utility.Extension.DataTypeChangeExtension类 参考

数据类型转换,利用TryParse判断是否可转换，如果能则返回转换后的值，否则返回默认值 更多...

静态 Public 成员函数

static byte | ToByte (this object thisValue, byte defValue=0)
转化为 byte 整形(0 到 255) 更多...
static short | ToShort (this object thisValue, short defValue=0)
转化为短整型 更多...
static int | ToInt (this object thisValue, int defValue=0)
转化为整型，如果是小数，将截断小数部分 更多...
static long | ToLong (this object thisValue, long defValue=0)
转化为长整型 更多...
static bool | ToBool (this object thisValue, bool defValue=false)
转化为布尔型 更多...
static float | ToFloat (this object thisValue, float defValue=0.0f)
转化为浮点型 更多...
static double | ToDouble (this object thisValue, double defValue=0.0d)
转化为双精度数据类型 更多...
static decimal | ToDecimal (this object thisValue, decimal defValue=0.0m)
转化为小数类型 更多...
static DateTime | ToDateTime (this object thisValue)
转化为日期类型 更多...
static DateTime | ToDateTime (this object thisValue, DateTime defValue)
转化为日期类型 更多...
static T[] | ToSpliterArray< T > (this string ids, char splitter= ',')
ids字符串转数组，默认分割符是',',如 "1,2,3" 转 int[]{1,2,3} 更多...
static List< T > | ToSpliterList< T > (this string ids, char splitter= ',')
ids字符串转数组，默认分割符是',',如 "1,2,3" 转 int[]{1,2,3} 更多...
static int[] | ToIntArray (this string ids, char splitter= ',')
ids字符串转整型数组,如 "1,2,3" 转 int[]{1,2,3} 更多...
static Tvalue | GetSafeValue< Tkey, Tvalue > (this Dictionary< Tkey, Tvalue > dict, Tkey key)
Dictionary安全取值 更多...
static Type | ToCsharpType (this SqlDbType sqlType)
数据库数据类型转c::数据类型 更多...

详细描述

数据类型转换,利用TryParse判断是否可转换，如果能则返回转换后的值，否则返回默认值

在文件 DataTypeChangeExtension.cs 第 10 行定义.

成员函数说明

static Tvalue SinGooCMS.Utility.Extension.DataTypeChangeExtension.GetSafeValue< Tkey, Tvalue > | ( | this Dictionary< Tkey, Tvalue > | dict,
 |  | Tkey | key
 | ) |  |
static

Dictionary安全取值

模板参数
Tkey
Tvalue
参数
dict
key
返回

在文件 DataTypeChangeExtension.cs 第 254 行定义.

static bool SinGooCMS.Utility.Extension.DataTypeChangeExtension.ToBool | ( | this object | thisValue,
 |  | bool | defValue = false
 | ) |  |
static

转化为布尔型

参数
thisValue
defValue
返回

在文件 DataTypeChangeExtension.cs 第 105 行定义.

static byte SinGooCMS.Utility.Extension.DataTypeChangeExtension.ToByte | ( | this object | thisValue,
 |  | byte | defValue = 0
 | ) |  |
static

转化为 byte 整形(0 到 255)

参数
thisValue
defValue
返回

在文件 DataTypeChangeExtension.cs 第 20 行定义.

static Type SinGooCMS.Utility.Extension.DataTypeChangeExtension.ToCsharpType ( this SqlDbType sqlType )
static

数据库数据类型转c::数据类型

参数
sqlType
返回

在文件 DataTypeChangeExtension.cs 第 271 行定义.

static DateTime SinGooCMS.Utility.Extension.DataTypeChangeExtension.ToDateTime ( this object thisValue )
static

转化为日期类型

参数
thisValue
返回
static DateTime SinGooCMS.Utility.Extension.DataTypeChangeExtension.ToDateTime | ( | this object | thisValue,
 |  | DateTime | defValue
 | ) |  |
static

转化为日期类型

参数
thisValue
defValue
返回

在文件 DataTypeChangeExtension.cs 第 187 行定义.

static decimal SinGooCMS.Utility.Extension.DataTypeChangeExtension.ToDecimal | ( | this object | thisValue,
 |  | decimal | defValue = 0.0m
 | ) |  |
static

转化为小数类型

参数
thisValue
defValue
返回

在文件 DataTypeChangeExtension.cs 第 162 行定义.

static double SinGooCMS.Utility.Extension.DataTypeChangeExtension.ToDouble | ( | this object | thisValue,
 |  | double | defValue = 0.0d
 | ) |  |
static

转化为双精度数据类型

参数
thisValue
defValue
返回

在文件 DataTypeChangeExtension.cs 第 145 行定义.

static float SinGooCMS.Utility.Extension.DataTypeChangeExtension.ToFloat | ( | this object | thisValue,
 |  | float | defValue = 0.0f
 | ) |  |
static

转化为浮点型

参数
thisValue
defValue
返回

在文件 DataTypeChangeExtension.cs 第 128 行定义.

static int SinGooCMS.Utility.Extension.DataTypeChangeExtension.ToInt | ( | this object | thisValue,
 |  | int | defValue = 0
 | ) |  |
static

转化为整型，如果是小数，将截断小数部分

参数
thisValue
defValue
返回

在文件 DataTypeChangeExtension.cs 第 62 行定义.

static int [] SinGooCMS.Utility.Extension.DataTypeChangeExtension.ToIntArray | ( | this string | ids,
 |  | char | splitter = ','
 | ) |  |
static

ids字符串转整型数组,如 "1,2,3" 转 int[]{1,2,3}

参数
ids | 带分隔符的字符串
splitter | 分隔符
返回

在文件 DataTypeChangeExtension.cs 第 237 行定义.

static long SinGooCMS.Utility.Extension.DataTypeChangeExtension.ToLong | ( | this object | thisValue,
 |  | long | defValue = 0
 | ) |  |
static

转化为长整型

参数
thisValue
defValue
返回

在文件 DataTypeChangeExtension.cs 第 84 行定义.

static short SinGooCMS.Utility.Extension.DataTypeChangeExtension.ToShort | ( | this object | thisValue,
 |  | short | defValue = 0
 | ) |  |
static

转化为短整型

参数
thisValue
defValue
返回

在文件 DataTypeChangeExtension.cs 第 41 行定义.

static T [] SinGooCMS.Utility.Extension.DataTypeChangeExtension.ToSpliterArray< T > | ( | this string | ids,
 |  | char | splitter = ','
 | ) |  |
static

ids字符串转数组，默认分割符是',',如 "1,2,3" 转 int[]{1,2,3}

模板参数
T
参数
ids
splitter
返回
static List<T> SinGooCMS.Utility.Extension.DataTypeChangeExtension.ToSpliterList< T > | ( | this string | ids,
 |  | char | splitter = ','
 | ) |  |
static

ids字符串转数组，默认分割符是',',如 "1,2,3" 转 int[]{1,2,3}

模板参数
T
参数
ids
splitter
返回

在文件 DataTypeChangeExtension.cs 第 215 行定义.

该类的文档由以下文件生成:
  • SinGooCMS.Utility/Extension/DataTypeChangeExtension.cs


SinGooCMS.Utility: SinGooCMS.Utility.Extension.DateTimeExtension类 参考

  • SinGooCMS
  • Utility
  • Extension
  • DateTimeExtension
静态 Public 成员函数 | 静态 Public 属性 | 静态 Private 成员函数 | 所有成员列表
SinGooCMS.Utility.Extension.DateTimeExtension类 参考

日期扩展 更多...

静态 Public 成员函数

static DateTime | GetMonday (this DateTime someDate)
计算周一的日期 更多...
static DateTime | GetSunday (this DateTime someDate)
计算周日的日期 更多...
static DateTime | GetWeekFirstDay (this DateTime someDate, bool isCNRule=true)
获取周第一天（星期一） 更多...
static DateTime | GetWeekLastDay (this DateTime someDate, bool isCNRule=true)
获取周最后一天（星期日） 更多...
static DateTime | GetMonthFirstDay (this DateTime someDate)
计算月初的日期 更多...
static DateTime | GetMonthLastDay (this DateTime someDate)
计算月尾的日期 更多...
static DateTime | GetQuarterFirstDay (this DateTime someDate)
计算月初的日期 更多...
static DateTime | GetQuarterLastDay (this DateTime someDate)
计算月尾的日期 更多...
static DateTime | GetYearFirstDay (this DateTime someDate)
计算年初的日期 更多...
static DateTime | GetYearLastDay (this DateTime someDate)
计算年尾的日期 更多...
static int | WeekOfYear (this DateTime someDate, bool isOnlyValue=false)
本年第几周，当跨年时有2个值，isOnlyValue=true取新年值 更多...
static string | ToFormatStringFull (this DateTime dtime, string format="yyyy-MM-dd HH:mm:ss.fff")
日期格式化，最后到三位毫秒 更多...
static string | ToFormatString (this DateTime dtime, string format="yyyy-MM-dd HH:mm:ss")
日期格式化，最后到秒 更多...
static string | ToFormatDate (this DateTime dtime, string format="yyyy-MM-dd")
格式为化日期格式字符串 更多...
static string | ToFormatTime (this DateTime dtime, string format="HH:mm:ss")
格式化为时间字符串 更多...
static string | ToFormatDateString (this string strInput, string format="yyyy-MM-dd")
格式化为日期格式字符串 更多...
static double | GetUnixTimeSeconds (this in DateTime dt)
获取该时间相对于1970-01-01 00:00:00的秒数 更多...
static double | GetUnixTimeMilliseconds (this in DateTime dt)
获取该时间相对于1970-01-01 00:00:00的毫秒数 更多...
static long | GetTotalMicroseconds (this in DateTime dt)
获取该时间相对于1970-01-01 00:00:00的微秒时间戳 更多...
static long | GetTotalNanoseconds (this in DateTime dt)
获取该时间相对于1970-01-01 00:00:00的纳秒时间戳 更多...
static double | GetTotalMinutes (this in DateTime dt)
获取该时间相对于1970-01-01 00:00:00的分钟数 更多...
static double | GetTotalHours (this in DateTime dt)
获取该时间相对于1970-01-01 00:00:00的小时数 更多...
static double | GetTotalDays (this in DateTime dt)
获取该时间相对于1970-01-01 00:00:00的天数 更多...
static string | DateDiff (this in DateTime dateTime1, in DateTime dateTime2)
返回时间差 更多...
static string | FriendlyDate (this DateTime dt)
将时间的天转换为友好的标记 更多...

静态 Public 属性

static string DIZHI
读取中国时辰，一天12个时辰，一个时辰2个小时 更多...

静态 Private 成员函数

static string string CNHOUR | GetCNHour (this DateTime time)
static DateTime | GetShortDate (DateTime date)

详细描述

日期扩展

在文件 DateExtension.cs 第 10 行定义.

成员函数说明

static string SinGooCMS.Utility.Extension.DateTimeExtension.DateDiff | ( | this in DateTime | dateTime1,
 |  | in DateTime | dateTime2
 | ) |  |
static

返回时间差

参数
dateTime1 | 时间1
dateTime2 | 时间2
返回
时间差

在文件 DateExtension.cs 第 352 行定义.

static string SinGooCMS.Utility.Extension.DateTimeExtension.FriendlyDate ( this DateTime dt )
static

将时间的天转换为友好的标记

参数
dt
返回

在文件 DateExtension.cs 第 373 行定义.

static string string CNHOUR SinGooCMS.Utility.Extension.DateTimeExtension.GetCNHour ( this DateTime time )
staticprivate

在文件 DateExtension.cs 第 221 行定义.

static DateTime SinGooCMS.Utility.Extension.DateTimeExtension.GetMonday ( this DateTime someDate )
static

计算周一的日期

参数
someDate
返回

在文件 DateExtension.cs 第 19 行定义.

static DateTime SinGooCMS.Utility.Extension.DateTimeExtension.GetMonthFirstDay ( this DateTime someDate )
static

计算月初的日期

参数
someDate
返回

在文件 DateExtension.cs 第 71 行定义.

static DateTime SinGooCMS.Utility.Extension.DateTimeExtension.GetMonthLastDay ( this DateTime someDate )
static

计算月尾的日期

参数
someDate
返回

在文件 DateExtension.cs 第 82 行定义.

static DateTime SinGooCMS.Utility.Extension.DateTimeExtension.GetQuarterFirstDay ( this DateTime someDate )
static

计算月初的日期

参数
someDate
返回

在文件 DateExtension.cs 第 96 行定义.

static DateTime SinGooCMS.Utility.Extension.DateTimeExtension.GetQuarterLastDay ( this DateTime someDate )
static

计算月尾的日期

参数
someDate
返回

在文件 DateExtension.cs 第 107 行定义.

static DateTime SinGooCMS.Utility.Extension.DateTimeExtension.GetShortDate ( DateTime date )
staticprivate

在文件 DateExtension.cs 第 396 行定义.

static DateTime SinGooCMS.Utility.Extension.DateTimeExtension.GetSunday ( this DateTime someDate )
static

计算周日的日期

参数
someDate
返回

在文件 DateExtension.cs 第 32 行定义.

static double SinGooCMS.Utility.Extension.DateTimeExtension.GetTotalDays ( this in DateTime dt )
static

获取该时间相对于1970-01-01 00:00:00的天数

参数
dt
返回
static double SinGooCMS.Utility.Extension.DateTimeExtension.GetTotalHours ( this in DateTime dt )
static

获取该时间相对于1970-01-01 00:00:00的小时数

参数
dt
返回
static long SinGooCMS.Utility.Extension.DateTimeExtension.GetTotalMicroseconds ( this in DateTime dt )
static

获取该时间相对于1970-01-01 00:00:00的微秒时间戳

参数
dt
返回
static double SinGooCMS.Utility.Extension.DateTimeExtension.GetTotalMinutes ( this in DateTime dt )
static

获取该时间相对于1970-01-01 00:00:00的分钟数

参数
dt
返回
static long SinGooCMS.Utility.Extension.DateTimeExtension.GetTotalNanoseconds ( this in DateTime dt )
static

获取该时间相对于1970-01-01 00:00:00的纳秒时间戳

参数
dt
返回
static double SinGooCMS.Utility.Extension.DateTimeExtension.GetUnixTimeMilliseconds ( this in DateTime dt )
static

获取该时间相对于1970-01-01 00:00:00的毫秒数

参数
dt
返回
static double SinGooCMS.Utility.Extension.DateTimeExtension.GetUnixTimeSeconds ( this in DateTime dt )
static

获取该时间相对于1970-01-01 00:00:00的秒数

参数
dt
返回
static DateTime SinGooCMS.Utility.Extension.DateTimeExtension.GetWeekFirstDay | ( | this DateTime | someDate,
 |  | bool | isCNRule = true
 | ) |  |
static

获取周第一天（星期一）

参数
someDate
isCNRule 是否中国规则
返回

在文件 DateExtension.cs 第 43 行定义.

static DateTime SinGooCMS.Utility.Extension.DateTimeExtension.GetWeekLastDay | ( | this DateTime | someDate,
 |  | bool | isCNRule = true
 | ) |  |
static

获取周最后一天（星期日）

参数
someDate
isCNRule 是否中国规则
返回

在文件 DateExtension.cs 第 57 行定义.

static DateTime SinGooCMS.Utility.Extension.DateTimeExtension.GetYearFirstDay ( this DateTime someDate )
static

计算年初的日期

参数
someDate
返回

在文件 DateExtension.cs 第 121 行定义.

static DateTime SinGooCMS.Utility.Extension.DateTimeExtension.GetYearLastDay ( this DateTime someDate )
static

计算年尾的日期

参数
someDate
返回

在文件 DateExtension.cs 第 132 行定义.

static string SinGooCMS.Utility.Extension.DateTimeExtension.ToFormatDate | ( | this DateTime | dtime,
 |  | string | format = "yyyy-MM-dd"
 | ) |  |
static

格式为化日期格式字符串

参数
dtime
format
返回
static string SinGooCMS.Utility.Extension.DateTimeExtension.ToFormatDateString | ( | this string | strInput,
 |  | string | format = "yyyy-MM-dd"
 | ) |  |
static

格式化为日期格式字符串

参数
strInput
format
返回

在文件 DateExtension.cs 第 203 行定义.

static string SinGooCMS.Utility.Extension.DateTimeExtension.ToFormatString | ( | this DateTime | dtime,
 |  | string | format = "yyyy-MM-dd HH:mm:ss"
 | ) |  |
static

日期格式化，最后到秒

参数
dtime
format
返回
static string SinGooCMS.Utility.Extension.DateTimeExtension.ToFormatStringFull | ( | this DateTime | dtime,
 |  | string | format = "yyyy-MM-dd HH:mm:ss.fff"
 | ) |  |
static

日期格式化，最后到三位毫秒

参数
dtime
format
返回
static string SinGooCMS.Utility.Extension.DateTimeExtension.ToFormatTime | ( | this DateTime | dtime,
 |  | string | format = "HH:mm:ss"
 | ) |  |
static

格式化为时间字符串

参数
dtime
format
返回
static int SinGooCMS.Utility.Extension.DateTimeExtension.WeekOfYear | ( | this DateTime | someDate,
 |  | bool | isOnlyValue = false
 | ) |  |
static

本年第几周，当跨年时有2个值，isOnlyValue=true取新年值

参数
someDate | 日期
isOnlyValue | 是否唯一值
返回

在文件 DateExtension.cs 第 147 行定义.

类成员变量说明

string SinGooCMS.Utility.Extension.DateTimeExtension.DIZHI
static

读取中国时辰，一天12个时辰，一个时辰2个小时

参数
time
返回
返回元组，.DIZHI表示地支时辰，.CNHOUR表示时辰范围

在文件 DateExtension.cs 第 221 行定义.

该类的文档由以下文件生成:
  • SinGooCMS.Utility/Extension/DateExtension.cs


SinGooCMS.Utility: SinGooCMS.Utility.Extension.DictionaryExtension类 参考

  • SinGooCMS
  • Utility
  • Extension
  • DictionaryExtension
静态 Public 成员函数 | 所有成员列表
SinGooCMS.Utility.Extension.DictionaryExtension类 参考

字典扩展类 更多...

静态 Public 成员函数

static IDictionary< TKey, TValue > | SortByKey< TKey, TValue > (this IDictionary< TKey, TValue > dict)
按key排序 更多...
static TKey | GetKey< TKey, TValue > (this IDictionary< TKey, TValue > dict, int @index)
按下标读取元素Key 更多...
static TValue | GetValue< TKey, TValue > (this IDictionary< TKey, TValue > dict, int @index)
按下标读取元素Value 更多...

详细描述

字典扩展类

在文件 DictionaryExtension.cs 第 11 行定义.

成员函数说明

static TKey SinGooCMS.Utility.Extension.DictionaryExtension.GetKey< TKey, TValue > | ( | this IDictionary< TKey, TValue > | dict,
 |  | int @ | index
 | ) |  |
static

按下标读取元素Key

模板参数
TKey
TValue
参数
dict
index
返回

在文件 DictionaryExtension.cs 第 33 行定义.

static TValue SinGooCMS.Utility.Extension.DictionaryExtension.GetValue< TKey, TValue > | ( | this IDictionary< TKey, TValue > | dict,
 |  | int @ | index
 | ) |  |
static

按下标读取元素Value

模板参数
TKey
TValue
参数
dict
index
返回

在文件 DictionaryExtension.cs 第 46 行定义.

static IDictionary<TKey, TValue> SinGooCMS.Utility.Extension.DictionaryExtension.SortByKey< TKey, TValue > ( this IDictionary< TKey, TValue > dict )
static

按key排序

模板参数
TKey
TValue
参数
dict
返回

在文件 DictionaryExtension.cs 第 20 行定义.

该类的文档由以下文件生成:
  • SinGooCMS.Utility/Extension/DictionaryExtension.cs


SinGooCMS.Utility: SinGooCMS.Utility.Extension.DisplayExtAttribute类 参考

  • SinGooCMS
  • Utility
  • Extension
  • DisplayExtAttribute
Public 成员函数 | 属性 | 所有成员列表
SinGooCMS.Utility.Extension.DisplayExtAttribute类 参考

特性扩展类
属性的显示扩展,优先使用资源Name,默认使用自带的Name,注意：仅适用于MVC 更多...

类 SinGooCMS.Utility.Extension.DisplayExtAttribute 继承关系图:
[图例]
SinGooCMS.Utility.Extension.DisplayExtAttribute 的协作图:
[图例]

Public 成员函数

DisplayExtAttribute ()
默认警告方法 更多...
DisplayExtAttribute (string _name, string _resName, Type _resType, bool _isReadRes=true)
快速构建 更多...

属性

string | Name [get, set]
默认的名字 更多...
string | ResName [get, set]
资源的Key，如果语言包有这个Key,优先使用 更多...
Type | ResourceType [get, set]
资源类型 更多...
bool | IsReadRes [get, set]
是否读取资源，默认True 更多...
override string | DisplayName [get]
重写显示名称 更多...

详细描述

特性扩展类
属性的显示扩展,优先使用资源Name,默认使用自带的Name,注意：仅适用于MVC

[DisplayExt(Name = "辅料料号",ResName = "pt_no",ResourceType =typeof(SResource))]

在文件 AttributeExtension.cs 第 22 行定义.

构造及析构函数说明

SinGooCMS.Utility.Extension.DisplayExtAttribute.DisplayExtAttribute ( )

默认警告方法

在文件 AttributeExtension.cs 第 44 行定义.

SinGooCMS.Utility.Extension.DisplayExtAttribute.DisplayExtAttribute | ( | string | _name,
 |  | string | _resName,
 |  | Type | _resType,
 |  | bool | _isReadRes = true
 | ) |  |

快速构建

参数
_name
_resName
_resType
_isReadRes

在文件 AttributeExtension.cs 第 53 行定义.

属性说明

override string SinGooCMS.Utility.Extension.DisplayExtAttribute.DisplayName
get

重写显示名称

在文件 AttributeExtension.cs 第 65 行定义.

bool SinGooCMS.Utility.Extension.DisplayExtAttribute.IsReadRes
getset

是否读取资源，默认True

在文件 AttributeExtension.cs 第 39 行定义.

string SinGooCMS.Utility.Extension.DisplayExtAttribute.Name
getset

默认的名字

在文件 AttributeExtension.cs 第 27 行定义.

string SinGooCMS.Utility.Extension.DisplayExtAttribute.ResName
getset

资源的Key，如果语言包有这个Key,优先使用

在文件 AttributeExtension.cs 第 31 行定义.

Type SinGooCMS.Utility.Extension.DisplayExtAttribute.ResourceType
getset

资源类型

在文件 AttributeExtension.cs 第 35 行定义.

该类的文档由以下文件生成:
  • SinGooCMS.Utility/Extension/AttributeExtension.cs


SinGooCMS.Utility: SinGooCMS.Utility.Extension.EnumExtension类 参考

  • SinGooCMS
  • Utility
  • Extension
  • EnumExtension
静态 Public 成员函数 | 所有成员列表
SinGooCMS.Utility.Extension.EnumExtension类 参考

枚举扩展 更多...

静态 Public 成员函数

static string | GetDescription (this System.Enum @enum)
读枚举的说明 更多...
static T | ToEnum< T > (this string enumName)
文本转枚举 更多...

详细描述

枚举扩展

在文件 EnumExtension.cs 第 10 行定义.

成员函数说明

static string SinGooCMS.Utility.Extension.EnumExtension.GetDescription ( this System.Enum @ enum )
static

读枚举的说明

参数
enum
返回
static T SinGooCMS.Utility.Extension.EnumExtension.ToEnum< T > ( this string enumName )
static

文本转枚举

模板参数
T
参数
enumName
返回
类型限制
T : struct
T : EnumUtils.StringToEnum<T>
T : enumName
该类的文档由以下文件生成:
  • SinGooCMS.Utility/Extension/EnumExtension.cs


SinGooCMS.Utility: SinGooCMS.Utility.Extension.IConvertibleExtension类 参考

  • SinGooCMS
  • Utility
  • Extension
  • IConvertibleExtension
静态 Public 成员函数 | 所有成员列表
SinGooCMS.Utility.Extension.IConvertibleExtension类 参考

可转换扩展 更多...

静态 Public 成员函数

static T To< T > (this IConvertible value)
类型直转 更多...

详细描述

可转换扩展

在文件 IConvertibleExtension.cs 第 8 行定义.

成员函数说明

static T SinGooCMS.Utility.Extension.IConvertibleExtension.To< T > ( this IConvertible value )
static

类型直转

模板参数
T
参数
value
返回

在文件 IConvertibleExtension.cs 第 16 行定义.

该类的文档由以下文件生成:
  • SinGooCMS.Utility/Extension/IConvertibleExtension.cs


SinGooCMS.Utility: SinGooCMS.Utility.Extension.IEnumerableExtension类 参考

  • SinGooCMS
  • Utility
  • Extension
  • IEnumerableExtension
静态 Public 成员函数 | 所有成员列表
SinGooCMS.Utility.Extension.IEnumerableExtension类 参考

遍历扩展 更多...

静态 Public 成员函数

static void | ForEach< T > (this IEnumerable< T > objs, Action< T > action)
遍历IEnumerable(这个挺好的，类似于jquery的foreach) 更多...
static async void | ForEachAsync< T > (this IEnumerable< T > objs, Action< T > action)
遍历IEnumerable 更多...
static DataTable | ToDataTable< T > (this IEnumerable< T > list, IDictionary< string, string > custColHeader=null)
指定实体集合转DataTable 更多...
static string | ToSplitterString (this object[] array, string separator=",")
一维数组转字符串 更多...
static string | ToSplitterString< T > (this IEnumerable< T > sequence, string separator)
将当前集合中的元素根据指定的分隔符(separator )拼接成字符串 更多...
static IEnumerable< T > | RandomArray< T > (this IEnumerable< T > arr, int multiple=1)
打乱集合元素顺序 更多...
static T | RandomTake< T > (this List< T > list, Random random=null)
从一个列表中随机选择对象 更多...
static IEnumerable< TSource > | DistinctBy< TSource, TKey > (this IEnumerable< TSource > source, Func< TSource, TKey > keySelector)
按字段去重 更多...
static void | AddRange< T > (this ICollection< T > @this, params T[] values)
添加多个元素 更多...
static void | AddRangeIf< T > (this ICollection< T > @this, Func< T, bool > predicate, params T[] values)
添加符合条件的多个元素 更多...
static void | AddRangeIfNotContains< T > (this ICollection< T > @this, params T[] values)
添加不重复的元素 更多...
static void | RemoveWhere< T > (this ICollection< T > @this, Func< T, bool > @where)
移除符合条件的元素 更多...
static void | InsertAfter< T > (this IList< T > list, Func< T, bool > condition, T value)
在元素之后添加元素 更多...
static void | InsertAfter< T > (this IList< T > list, int index, T value)
在元素之后添加元素 更多...
static HashSet< TResult > | ToHashSet< T, TResult > (this IEnumerable< T > source, Func< T, TResult > selector)
转HashSet,不重复的集合 更多...

详细描述

遍历扩展

在文件 IEnumerableExtension.cs 第 13 行定义.

成员函数说明

static void SinGooCMS.Utility.Extension.IEnumerableExtension.AddRange< T > | ( | this ICollection< T > @ | this,
 |  | params T[] | values
 | ) |  |
static

添加多个元素

模板参数
T
参数
this
values

在文件 IEnumerableExtension.cs 第 182 行定义.

static void SinGooCMS.Utility.Extension.IEnumerableExtension.AddRangeIf< T > | ( | this ICollection< T > @ | this,
 |  | Func< T, bool > | predicate,
 |  | params T[] | values
 | ) |  |
static

添加符合条件的多个元素

模板参数
T
参数
this
predicate
values

在文件 IEnumerableExtension.cs 第 197 行定义.

static void SinGooCMS.Utility.Extension.IEnumerableExtension.AddRangeIfNotContains< T > | ( | this ICollection< T > @ | this,
 |  | params T[] | values
 | ) |  |
static

添加不重复的元素

模板参数
T
参数
this
values

在文件 IEnumerableExtension.cs 第 214 行定义.

static IEnumerable<TSource> SinGooCMS.Utility.Extension.IEnumerableExtension.DistinctBy< TSource, TKey > | ( | this IEnumerable< TSource > | source,
 |  | Func< TSource, TKey > | keySelector
 | ) |  |
static

按字段去重

模板参数
TSource
TKey
参数
source
keySelector
返回

在文件 IEnumerableExtension.cs 第 170 行定义.

static void SinGooCMS.Utility.Extension.IEnumerableExtension.ForEach< T > | ( | this IEnumerable< T > | objs,
 |  | Action< T > | action
 | ) |  |
static

遍历IEnumerable(这个挺好的，类似于jquery的foreach)

参数
objs
action 回调方法
模板参数
T

在文件 IEnumerableExtension.cs 第 23 行定义.

static async void SinGooCMS.Utility.Extension.IEnumerableExtension.ForEachAsync< T > | ( | this IEnumerable< T > | objs,
 |  | Action< T > | action
 | ) |  |
static

遍历IEnumerable

参数
objs
action 回调方法
模板参数
T

在文件 IEnumerableExtension.cs 第 41 行定义.

static void SinGooCMS.Utility.Extension.IEnumerableExtension.InsertAfter< T > | ( | this IList< T > | list,
 |  | Func< T, bool > | condition,
 |  | T | value
 | ) |  |
static

在元素之后添加元素

模板参数
T
参数
list
condition | 条件
value | 值

在文件 IEnumerableExtension.cs 第 246 行定义.

static void SinGooCMS.Utility.Extension.IEnumerableExtension.InsertAfter< T > | ( | this IList< T > | list,
 |  | int | index,
 |  | T | value
 | ) |  |
static

在元素之后添加元素

模板参数
T
参数
list
index | 索引位置
value | 值

在文件 IEnumerableExtension.cs 第 268 行定义.

static IEnumerable<T> SinGooCMS.Utility.Extension.IEnumerableExtension.RandomArray< T > | ( | this IEnumerable< T > | arr,
 |  | int | multiple = 1
 | ) |  |
static

打乱集合元素顺序

模板参数
T
参数
arr
multiple 对于元素很少的集合，可以通过升级倍数来提升随机率，默认1倍
返回

在文件 IEnumerableExtension.cs 第 134 行定义.

static T SinGooCMS.Utility.Extension.IEnumerableExtension.RandomTake< T > | ( | this List< T > | list,
 |  | Random | random = null
 | ) |  |
static

从一个列表中随机选择对象

模板参数
T 队列数据类型
参数
list | 列表
random | 使用的随机种子。如果使用null，则会新建一个
返回
获得的结果

在文件 IEnumerableExtension.cs 第 154 行定义.

static void SinGooCMS.Utility.Extension.IEnumerableExtension.RemoveWhere< T > | ( | this ICollection< T > @ | this,
 |  | Func< T, bool > @ | where
 | ) |  |
static

移除符合条件的元素

模板参数
T
参数
this
where

在文件 IEnumerableExtension.cs 第 231 行定义.

static DataTable SinGooCMS.Utility.Extension.IEnumerableExtension.ToDataTable< T > | ( | this IEnumerable< T > | list,
 |  | IDictionary< string, string > | custColHeader = null
 | ) |  |
static

指定实体集合转DataTable

custColHeader 第一参数是key，第二个参数是要显示的名称

模板参数
T 实体
参数
list | 实体集合
custColHeader | 自定义表头
返回

在文件 IEnumerableExtension.cs 第 56 行定义.

static HashSet<TResult> SinGooCMS.Utility.Extension.IEnumerableExtension.ToHashSet< T, TResult > | ( | this IEnumerable< T > | source,
 |  | Func< T, TResult > | selector
 | ) |  |
static

转HashSet,不重复的集合

模板参数
T
TResult
参数
source
selector
返回

在文件 IEnumerableExtension.cs 第 291 行定义.

static string SinGooCMS.Utility.Extension.IEnumerableExtension.ToSplitterString | ( | this object[] | array,
 |  | string | separator = ","
 | ) |  |
static

一维数组转字符串

参数
array | 数组
separator | 分割符
返回

在文件 IEnumerableExtension.cs 第 109 行定义.

static string SinGooCMS.Utility.Extension.IEnumerableExtension.ToSplitterString< T > | ( | this IEnumerable< T > | sequence,
 |  | string | separator
 | ) |  |
static

将当前集合中的元素根据指定的分隔符(separator )拼接成字符串

模板参数
T
参数
sequence
separator
返回

在文件 IEnumerableExtension.cs 第 121 行定义.

该类的文档由以下文件生成:
  • SinGooCMS.Utility/Extension/IEnumerableExtension.cs


SinGooCMS.Utility: SinGooCMS.Utility.Extension.ImageExtension类 参考

  • SinGooCMS
  • Utility
  • Extension
  • ImageExtension
静态 Public 成员函数 | 所有成员列表
SinGooCMS.Utility.Extension.ImageExtension类 参考

image图像扩展 更多...

静态 Public 成员函数

static string | ToBase64 (this Image image)
Image转成base64字符串 更多...
static Image | LDPic (this Image mybm, int val)
调整光暗 更多...
static Image | RePic (this Image mybm)
反色处理 更多...
static Image | Relief (this Image oldBitmap)
浮雕处理 更多...
static Image | ResizeImage (this Image bmp, int newW, int newH)
拉伸图片 更多...
static Image | ColorFilter (this Image mybm)
滤色处理 更多...
static Image | ToBWPic (this Image mybm)
转换为黑白图片 更多...
static Image | Mosaic (this Image mybm, int effectWidth=10)
图片马赛克 更多...
static Image | LeftRightRev (this Image mybm)
左右翻转 更多...
static Image | UpDownRev (this Image mybm)
上下翻转 更多...
static Image | CutImage (this Image b, Rectangle rec)
裁剪图片 – 用GDI+ 更多...
static Image | CutAndResize (this Image bmp, Rectangle rec, int newWidth, int newHeight)
裁剪并缩放 更多...
static Image | CompressRate (this Image bmp, float rate=0.6f)
等比压缩 更多...
static Image | CompressWidth (this Image bmp, int newWidth)
等宽压缩 更多...
static Image | CompressHeight (this Image bmp, int newHeight)
等高压缩 更多...
static Image | Compress (this Image bmp, int newWidth, int newHeight)
指定宽高压缩图片 更多...
static Image | ThumbnailImage (this Image originalImage, int width, int height, ThumbnailCutMode mode=ThumbnailCutMode.Cut)
生成缩略图 更多...
static void | GetFrames (this Image gif, string pSavedPath)
获取图片中的各帧 更多...

详细描述

image图像扩展

在文件 ImageExtension.cs 第 14 行定义.

成员函数说明

static Image SinGooCMS.Utility.Extension.ImageExtension.ColorFilter ( this Image mybm )
static

滤色处理

参数
mybm 原始图片

在文件 ImageExtension.cs 第 158 行定义.

static Image SinGooCMS.Utility.Extension.ImageExtension.Compress | ( | this Image | bmp,
 |  | int | newWidth,
 |  | int | newHeight
 | ) |  |
static

指定宽高压缩图片

参数
bmp | 原始Bitmap
newWidth | 新的宽度
newHeight | 新的高度
返回
处理以后的图片

在文件 ImageExtension.cs 第 426 行定义.

static Image SinGooCMS.Utility.Extension.ImageExtension.CompressHeight | ( | this Image | bmp,
 |  | int | newHeight
 | ) |  |
static

等高压缩

参数
bmp
newHeight
返回

在文件 ImageExtension.cs 第 413 行定义.

static Image SinGooCMS.Utility.Extension.ImageExtension.CompressRate | ( | this Image | bmp,
 |  | float | rate = 0.6f
 | ) |  |
static

等比压缩

参数
bmp
rate
返回

在文件 ImageExtension.cs 第 387 行定义.

static Image SinGooCMS.Utility.Extension.ImageExtension.CompressWidth | ( | this Image | bmp,
 |  | int | newWidth
 | ) |  |
static

等宽压缩

参数
bmp
newWidth
返回

在文件 ImageExtension.cs 第 401 行定义.

static Image SinGooCMS.Utility.Extension.ImageExtension.CutAndResize | ( | this Image | bmp,
 |  | Rectangle | rec,
 |  | int | newWidth,
 |  | int | newHeight
 | ) |  |
static

裁剪并缩放

参数
bmp | 原始图片
rec | 裁剪的矩形区域
newWidth | 新的宽度
newHeight | 新的高度
返回
处理以后的图片
static Image SinGooCMS.Utility.Extension.ImageExtension.CutImage | ( | this Image | b,
 |  | Rectangle | rec
 | ) |  |
static

裁剪图片 – 用GDI+

参数
b | 原始Bitmap
rec | 裁剪区域
返回
剪裁后的Bitmap

在文件 ImageExtension.cs 第 329 行定义.

static void SinGooCMS.Utility.Extension.ImageExtension.GetFrames | ( | this Image | gif,
 |  | string | pSavedPath
 | ) |  |
static

获取图片中的各帧

参数
gif | 源gif
pSavedPath | 保存路径

在文件 ImageExtension.cs 第 536 行定义.

static Image SinGooCMS.Utility.Extension.ImageExtension.LDPic | ( | this Image | mybm,
 |  | int | val
 | ) |  |
static

调整光暗

参数
mybm | 原始图片
val | 增加或减少的光暗值

在文件 ImageExtension.cs 第 43 行定义.

static Image SinGooCMS.Utility.Extension.ImageExtension.LeftRightRev ( this Image mybm )
static

左右翻转

参数
mybm 原始图片

在文件 ImageExtension.cs 第 270 行定义.

static Image SinGooCMS.Utility.Extension.ImageExtension.Mosaic | ( | this Image | mybm,
 |  | int | effectWidth = 10
 | ) |  |
static

图片马赛克

参数
mybm
effectWidth 影响范围
返回

在文件 ImageExtension.cs 第 213 行定义.

static Image SinGooCMS.Utility.Extension.ImageExtension.Relief ( this Image oldBitmap )
static

浮雕处理

参数
oldBitmap 原始图片

在文件 ImageExtension.cs 第 101 行定义.

static Image SinGooCMS.Utility.Extension.ImageExtension.RePic ( this Image mybm )
static

反色处理

参数
mybm 原始图片

在文件 ImageExtension.cs 第 72 行定义.

static Image SinGooCMS.Utility.Extension.ImageExtension.ResizeImage | ( | this Image | bmp,
 |  | int | newW,
 |  | int | newH
 | ) |  |
static

拉伸图片

参数
bmp | 原始图片
newW | 新的宽度
newH | 新的高度

在文件 ImageExtension.cs 第 139 行定义.

static Image SinGooCMS.Utility.Extension.ImageExtension.ThumbnailImage | ( | this Image | originalImage,
 |  | int | width,
 |  | int | height,
 |  | ThumbnailCutMode | mode = ThumbnailCutMode.Cut
 | ) |  |
static

生成缩略图

参数
originalImage | 原图
width | 缩略图宽度
height | 缩略图高度
mode | 生成缩略图的方式

在文件 ImageExtension.cs 第 456 行定义.

static string SinGooCMS.Utility.Extension.ImageExtension.ToBase64 ( this Image image )
static

Image转成base64字符串

参数
image

在文件 ImageExtension.cs 第 22 行定义.

static Image SinGooCMS.Utility.Extension.ImageExtension.ToBWPic ( this Image mybm )
static

转换为黑白图片

参数
mybm 要进行处理的图片

在文件 ImageExtension.cs 第 185 行定义.

static Image SinGooCMS.Utility.Extension.ImageExtension.UpDownRev ( this Image mybm )
static

上下翻转

参数
mybm 原始图片

在文件 ImageExtension.cs 第 299 行定义.

该类的文档由以下文件生成:
  • SinGooCMS.Utility/Extension/ImageExtension.cs


SinGooCMS.Utility: SinGooCMS.Utility.Extension.IOExtension类 参考

  • SinGooCMS
  • Utility
  • Extension
  • IOExtension
静态 Public 成员函数 | 静态 Private 成员函数 | 所有成员列表
SinGooCMS.Utility.Extension.IOExtension类 参考

IO扩展 更多...

静态 Public 成员函数

static string | ToBase64String (this FileStream fileStream)
转为base64字符串 更多...
static Stream | ToStream (this byte[] bytes)
byte[] 转为stream 更多...
static byte[] | ToBytes (this Stream stream)
stream转为byte[] 更多...
static async Task | WriteToFileAsync (this byte[] bytes, string fileName)
异步写byte[]到fileName 更多...
static async Task | SaveFileAsync (this Stream ms, string filename)
异步将内存流转储成文件 更多...
static string | GetFileMD5 (this Stream fs)
计算文件的 MD5 值 更多...
static string | GetFileSha1 (this Stream fs)
计算文件的 sha1 值 更多...

静态 Private 成员函数

static string HashFile (Stream fs, string algo)
计算文件的哈希值 更多...

详细描述

IO扩展

在文件 IOExtension.cs 第 13 行定义.

成员函数说明

static string SinGooCMS.Utility.Extension.IOExtension.GetFileMD5 ( this Stream fs )
static

计算文件的 MD5 值

参数
fs 源文件流
返回
MD5 值16进制字符串
static string SinGooCMS.Utility.Extension.IOExtension.GetFileSha1 ( this Stream fs )
static

计算文件的 sha1 值

参数
fs 源文件流
返回
sha1 值16进制字符串
static string SinGooCMS.Utility.Extension.IOExtension.HashFile | ( | Stream | fs,
 |  | string | algo
 | ) |  |
staticprivate

计算文件的哈希值

参数
fs | 被操作的源数据流
algo | 加密算法
返回
哈希值16进制字符串

在文件 IOExtension.cs 第 102 行定义.

static async Task SinGooCMS.Utility.Extension.IOExtension.SaveFileAsync | ( | this Stream | ms,
 |  | string | filename
 | ) |  |
static

异步将内存流转储成文件

参数
ms
filename

在文件 IOExtension.cs 第 68 行定义.

static string SinGooCMS.Utility.Extension.IOExtension.ToBase64String ( this FileStream fileStream )
static

转为base64字符串

参数
fileStream
返回
static byte [] SinGooCMS.Utility.Extension.IOExtension.ToBytes ( this Stream stream )
static

stream转为byte[]

参数
stream 参数
返回

在文件 IOExtension.cs 第 42 行定义.

static Stream SinGooCMS.Utility.Extension.IOExtension.ToStream ( this byte[] bytes )
static

byte[] 转为stream

参数
bytes 参数
返回

在文件 IOExtension.cs 第 30 行定义.

static async Task SinGooCMS.Utility.Extension.IOExtension.WriteToFileAsync | ( | this byte[] | bytes,
 |  | string | fileName
 | ) |  |
static

异步写byte[]到fileName

参数
bytes
fileName 保存至硬盘路径

在文件 IOExtension.cs 第 54 行定义.

该类的文档由以下文件生成:
  • SinGooCMS.Utility/Extension/IOExtension.cs


SinGooCMS.Utility: SinGooCMS.Utility.Extension.JsonserializeExtension类 参考

  • SinGooCMS
  • Utility
  • Extension
  • JsonserializeExtension
静态 Public 成员函数 | 所有成员列表
SinGooCMS.Utility.Extension.JsonserializeExtension类 参考

json扩展 更多...

静态 Public 成员函数

static string | ToJson< T > (this T t)
序列化 更多...
static string | ToJson (this DataSet ds)
序列化 更多...
static string | ToJson (this DataTable dt)
序列化 更多...
static T | JsonToObject< T > (this string strJson)
反序列化 更多...
static T | JsonToAnonymousObject< T > (this string strJson, T obj)
反序列化(匿名类型),这个挺好的，懒人大法 更多...

详细描述

json扩展

在文件 JsonserializeExtension.cs 第 10 行定义.

成员函数说明

static T SinGooCMS.Utility.Extension.JsonserializeExtension.JsonToAnonymousObject< T > | ( | this string | strJson,
 |  | T | obj
 | ) |  |
static

反序列化(匿名类型),这个挺好的，懒人大法

var json = "{\"UserName":"jsonlee","Age":18}"; var model = new { UserName = "", Age = 0 }; var obj = json.JsonToAnonymousObject(model);

模板参数
T
参数
strJson
obj
返回
static T SinGooCMS.Utility.Extension.JsonserializeExtension.JsonToObject< T > ( this string strJson )
static

反序列化

模板参数
T
参数
strJson
返回
static string SinGooCMS.Utility.Extension.JsonserializeExtension.ToJson ( this DataSet ds )
static

序列化

参数
ds
返回

在文件 JsonserializeExtension.cs 第 35 行定义.

static string SinGooCMS.Utility.Extension.JsonserializeExtension.ToJson ( this DataTable dt )
static

序列化

参数
dt
返回

在文件 JsonserializeExtension.cs 第 50 行定义.

static string SinGooCMS.Utility.Extension.JsonserializeExtension.ToJson< T > ( this T t )
static

序列化

模板参数
T
参数
t
返回

在文件 JsonserializeExtension.cs 第 20 行定义.

该类的文档由以下文件生成:
  • SinGooCMS.Utility/Extension/JsonserializeExtension.cs


SinGooCMS.Utility: SinGooCMS.Utility.Extension.LinqExtension类 参考

  • SinGooCMS
  • Utility
  • Extension
  • LinqExtension
静态 Public 成员函数 | 静态 Private 成员函数 | 所有成员列表
SinGooCMS.Utility.Extension.LinqExtension类 参考

linq扩展方法 更多...

静态 Public 成员函数

static IEnumerable< T > | OrderByBatch< T > (this IEnumerable< T > query, string orderBy)
多个OrderBy用逗号隔开，exp:"Sort asc,AutoID desc" 更多...
static IQueryable< T > | OrderByBatch< T > (this IQueryable< T > query, string orderBy)
多个OrderBy用逗号隔开，exp:"Sort asc,AutoID desc" 更多...

静态 Private 成员函数

static PropertyInfo | GetPropertyInfo (Type objType, string name)
static LambdaExpression | GetOrderExpression (Type objType, PropertyInfo pi)

详细描述

linq扩展方法

在文件 LinqExtension.cs 第 12 行定义.

成员函数说明

static LambdaExpression SinGooCMS.Utility.Extension.LinqExtension.GetOrderExpression | ( | Type | objType,
 |  | PropertyInfo | pi
 | ) |  |
staticprivate

在文件 LinqExtension.cs 第 95 行定义.

static PropertyInfo SinGooCMS.Utility.Extension.LinqExtension.GetPropertyInfo | ( | Type | objType,
 |  | string | name
 | ) |  |
staticprivate

在文件 LinqExtension.cs 第 84 行定义.

static IEnumerable<T> SinGooCMS.Utility.Extension.LinqExtension.OrderByBatch< T > | ( | this IEnumerable< T > | query,
 |  | string | orderBy
 | ) |  |
static

多个OrderBy用逗号隔开，exp:"Sort asc,AutoID desc"

模板参数
T
参数
query
orderBy
返回

在文件 LinqExtension.cs 第 23 行定义.

static IQueryable<T> SinGooCMS.Utility.Extension.LinqExtension.OrderByBatch< T > | ( | this IQueryable< T > | query,
 |  | string | orderBy
 | ) |  |
static

多个OrderBy用逗号隔开，exp:"Sort asc,AutoID desc"

模板参数
T
参数
query
orderBy
返回

在文件 LinqExtension.cs 第 57 行定义.

该类的文档由以下文件生成:
  • SinGooCMS.Utility/Extension/LinqExtension.cs


SinGooCMS.Utility: SinGooCMS.Utility.Extension.ObjectExtension类 参考

  • SinGooCMS
  • Utility
  • Extension
  • ObjectExtension
静态 Public 成员函数 | 所有成员列表
SinGooCMS.Utility.Extension.ObjectExtension类 参考

对象扩展 更多...

静态 Public 成员函数

static TDestination | MapTo< TSource, TDestination > (this TSource source, Func< TDestination, TDestination > thenDeal=null)
单个对象映射 更多...
static IEnumerable< TDestination > | MapToList< TSource, TDestination > (this IEnumerable< TSource > source, Func< IEnumerable< TDestination >, IEnumerable< TDestination >> thenDeal=null)
集合列表类型映射 更多...
static T | DeepClone< T > (this T obj)
深度克隆，注意T必须是 Serializable 更多...
static new bool | ReferenceEquals (this object obj, object o)
严格比较两个对象是否是同一对象(判断引用) 更多...

详细描述

对象扩展

在文件 ObjectExtension.cs 第 12 行定义.

成员函数说明

static T SinGooCMS.Utility.Extension.ObjectExtension.DeepClone< T > ( this T obj )
static

深度克隆，注意T必须是 Serializable

模板参数
T 泛型
参数
obj 原对象
返回

在文件 ObjectExtension.cs 第 73 行定义.

static TDestination SinGooCMS.Utility.Extension.ObjectExtension.MapTo< TSource, TDestination > | ( | this TSource | source,
 |  | Func< TDestination, TDestination > | thenDeal = null
 | ) |  |
static

单个对象映射

模板参数
TSource | 源对象
TDestination | 目标对象
参数
source
thenDeal 自动匹配后的处理
返回
类型限制
TDestination : class
TSource : class

在文件 ObjectExtension.cs 第 24 行定义.

static IEnumerable<TDestination> SinGooCMS.Utility.Extension.ObjectExtension.MapToList< TSource, TDestination > | ( | this IEnumerable< TSource > | source,
 |  | Func< IEnumerable< TDestination >, IEnumerable< TDestination >> | thenDeal = null
 | ) |  |
static

集合列表类型映射

模板参数
TSource | 源对象
TDestination | 目标对象
参数
source
thenDeal 自动匹配后的处理
返回
类型限制
TDestination : class
TSource : class

在文件 ObjectExtension.cs 第 48 行定义.

static new bool SinGooCMS.Utility.Extension.ObjectExtension.ReferenceEquals | ( | this object | obj,
 |  | object | o
 | ) |  |
static

严格比较两个对象是否是同一对象(判断引用)

参数
obj | 自己
o | 需要比较的对象
返回
是否同一对象

在文件 ObjectExtension.cs 第 90 行定义.

该类的文档由以下文件生成:
  • SinGooCMS.Utility/Extension/ObjectExtension.cs


SinGooCMS.Utility: SinGooCMS.Utility.Extension.ReflectExtension类 参考

  • SinGooCMS
  • Utility
  • Extension
  • ReflectExtension
静态 Public 成员函数 | 静态 Private 属性 | 所有成员列表
SinGooCMS.Utility.Extension.ReflectExtension类 参考

反射扩展 更多...

静态 Public 成员函数

static object | InvokeMethod (this object obj, string methodName, Type[] typeParameters, object[] args)
执行方法 更多...
static PropertyInfo | GetProperty (this object obj, string name)
读取属性 更多...
static T | GetPropertyVal< T > (this object obj, string name)
获取属性值 更多...
static void | SetPropertyVal (this object obj, string name, object value)
设置属性值 更多...
static FieldInfo | GetField (this object obj, string name)
读取字段信息 更多...
static FieldInfo[] | GetFields (this object obj)
获取所有的字段信息 更多...
static T | GetFieldVal< T > (this object obj, string name)
获取字段 更多...
static void | SetFieldVal (this object obj, string name, object value)
设置字段 更多...
static Stream | GetImageResource (this Type assemblyType, string resourceName)
根据资源名称获取图片资源流 更多...
static Bitmap | LoadBitmap (this Type assemblyType, string resourceHolder, string imageName)
获取程序集资源的位图资源 更多...
static string | GetResString (this Type assemblyType, string resName, string resourceHolder)
获取程序集资源的文本资源 更多...
static string | GetResString (this Type assemblyType, string resName, CultureInfo cultureInfo=null)
读取资源多语言文本 更多...
static string | GetManifestString (this Type assemblyType, string charset, string resName)
获取程序集嵌入资源的文本形式 更多...

静态 Private 属性

static readonly BindingFlags bindingFlags

详细描述

反射扩展

在文件 ReflectExtension.cs 第 15 行定义.

成员函数说明

static FieldInfo SinGooCMS.Utility.Extension.ReflectExtension.GetField | ( | this object | obj,
 |  | string | name
 | ) |  |
static

读取字段信息

参数
obj
name
返回
static FieldInfo [] SinGooCMS.Utility.Extension.ReflectExtension.GetFields ( this object obj )
static

获取所有的字段信息

参数
obj 反射对象
返回
字段信息
static T SinGooCMS.Utility.Extension.ReflectExtension.GetFieldVal< T > | ( | this object | obj,
 |  | string | name
 | ) |  |
static

获取字段

参数
obj | 反射对象
name | 字段名
模板参数
T 约束返回的T必须是引用类型
返回
T类型
static Stream SinGooCMS.Utility.Extension.ReflectExtension.GetImageResource | ( | this Type | assemblyType,
 |  | string | resourceName
 | ) |  |
static

根据资源名称获取图片资源流

参数
assemblyType
resourceName
返回

在文件 ReflectExtension.cs 第 151 行定义.

static string SinGooCMS.Utility.Extension.ReflectExtension.GetManifestString | ( | this Type | assemblyType,
 |  | string | charset,
 |  | string | resName
 | ) |  |
static

获取程序集嵌入资源的文本形式

参数
assemblyType | 程序集中的某一对象类型
charset | 字符集编码
resName | 嵌入资源相对路径
返回
如没找到该资源则返回空字符

在文件 ReflectExtension.cs 第 205 行定义.

static PropertyInfo SinGooCMS.Utility.Extension.ReflectExtension.GetProperty | ( | this object | obj,
 |  | string | name
 | ) |  |
static

读取属性

参数
obj
name
返回
static T SinGooCMS.Utility.Extension.ReflectExtension.GetPropertyVal< T > | ( | this object | obj,
 |  | string | name
 | ) |  |
static

获取属性值

参数
obj | 反射对象
name | 属性名
模板参数
T 约束返回的T必须是引用类型
返回
T类型
static string SinGooCMS.Utility.Extension.ReflectExtension.GetResString | ( | this Type | assemblyType,
 |  | string | resName,
 |  | string | resourceHolder
 | ) |  |
static

获取程序集资源的文本资源

参数
assemblyType | 程序集中的某一对象类型
resName | 资源项名称
resourceHolder | 资源的根名称。例如，名为“MyResource.en-US.resources”的资源文件的根名称为“MyResource”。

在文件 ReflectExtension.cs 第 176 行定义.

static string SinGooCMS.Utility.Extension.ReflectExtension.GetResString | ( | this Type | assemblyType,
 |  | string | resName,
 |  | CultureInfo | cultureInfo = null
 | ) |  |
static

读取资源多语言文本

参数
assemblyType
resName
cultureInfo
返回

在文件 ReflectExtension.cs 第 190 行定义.

static object SinGooCMS.Utility.Extension.ReflectExtension.InvokeMethod | ( | this object | obj,
 |  | string | methodName,
 |  | Type[] | typeParameters,
 |  | object[] | args
 | ) |  |
static

执行方法

调用普通方法：InvokeMethod("GetCount", null, new object[] { "Entity","" })

调用泛型方法：InvokeMethod("Find", new Type[] { typeof(EntityInfo) }, new object[] { 1 })

参数
obj | 实例对象
methodName | 方法名称，区分大小写
typeParameters | 类型集合（泛型的类型集合）
args | 参数集合
返回

在文件 ReflectExtension.cs 第 32 行定义.

static Bitmap SinGooCMS.Utility.Extension.ReflectExtension.LoadBitmap | ( | this Type | assemblyType,
 |  | string | resourceHolder,
 |  | string | imageName
 | ) |  |
static

获取程序集资源的位图资源

参数
assemblyType | 程序集中的某一对象类型
resourceHolder | 资源的根名称。例如，名为“MyResource.en-US.resources”的资源文件的根名称为“MyResource”。
imageName | 资源项名称

在文件 ReflectExtension.cs 第 163 行定义.

static void SinGooCMS.Utility.Extension.ReflectExtension.SetFieldVal | ( | this object | obj,
 |  | string | name,
 |  | object | value
 | ) |  |
static

设置字段

参数
obj | 反射对象
name | 字段名
value | 值
static void SinGooCMS.Utility.Extension.ReflectExtension.SetPropertyVal | ( | this object | obj,
 |  | string | name,
 |  | object | value
 | ) |  |
static

设置属性值

参数
obj | 反射对象
name | 属性名
value | 值

在文件 ReflectExtension.cs 第 92 行定义.

类成员变量说明

readonly BindingFlags SinGooCMS.Utility.Extension.ReflectExtension.bindingFlags
staticprivate
初始值:
= BindingFlags.DeclaredOnly | BindingFlags.Public |
BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Static

在文件 ReflectExtension.cs 第 17 行定义.

该类的文档由以下文件生成:
  • SinGooCMS.Utility/Extension/ReflectExtension.cs


SinGooCMS.Utility: SinGooCMS.Utility.Extension.StreamExtension类 参考

  • SinGooCMS
  • Utility
  • Extension
  • StreamExtension
静态 Public 成员函数 | 所有成员列表
SinGooCMS.Utility.Extension.StreamExtension类 参考

流扩展 更多...

静态 Public 成员函数

static MemoryStream | SaveAsMemoryStream (this Stream stream)
将流转换为内存流 更多...
static byte[] | ToArray (this Stream stream)
将流转换为数组 更多...
static async Task | CopyToFileAsync (this Stream fs, string dest, int bufferSize=1024 *1024 *8)
以文件流的形式复制大文件(异步方式) 更多...
static async Task | SaveFile (this MemoryStream ms, string filename)
将内存流转储成文件 更多...

详细描述

流扩展

在文件 StreamExtension.cs 第 11 行定义.

成员函数说明

static async Task SinGooCMS.Utility.Extension.StreamExtension.CopyToFileAsync | ( | this Stream | fs,
 |  | string | dest,
 |  | int | bufferSize = 1024 * 1024 * 8
 | ) |  |
static

以文件流的形式复制大文件(异步方式)

参数
fs | 源
dest | 目标地址
bufferSize | 缓冲区大小，默认8MB

在文件 StreamExtension.cs 第 46 行定义.

static MemoryStream SinGooCMS.Utility.Extension.StreamExtension.SaveAsMemoryStream ( this Stream stream )
static

将流转换为内存流

参数
stream
返回

在文件 StreamExtension.cs 第 18 行定义.

static async Task SinGooCMS.Utility.Extension.StreamExtension.SaveFile | ( | this MemoryStream | ms,
 |  | string | filename
 | ) |  |
static

将内存流转储成文件

参数
ms
filename

在文件 StreamExtension.cs 第 64 行定义.

static byte [] SinGooCMS.Utility.Extension.StreamExtension.ToArray ( this Stream stream )
static

将流转换为数组

参数
stream
返回

在文件 StreamExtension.cs 第 29 行定义.

该类的文档由以下文件生成:
  • SinGooCMS.Utility/Extension/StreamExtension.cs


SinGooCMS.Utility: SinGooCMS.Utility.Extension.StringExtension类 参考

  • SinGooCMS
  • Utility
  • Extension
  • StringExtension
静态 Public 成员函数 | 所有成员列表
SinGooCMS.Utility.Extension.StringExtension类 参考

字符串扩展 更多...

静态 Public 成员函数

static string | ToRMB (this decimal decMoney)
转化为大写的人民币 更多...
static string | RemoveWhiteSpace (this string strInput)
去除空格 更多...
static string | RemoveHtml (this string htmlstring)
清除html脚本 更多...
static string | ToTxt (this string htmlBlock)
把HTML代码转换成TXT格式 更多...
static string | ToHtml (this string strTxt)
把TXT代码转换成HTML格式 更多...
static string | AsEncodeUrl (this string urlString)
url编码 更多...
static string | AsDecodeUrl (this string urlString)
url解码 更多...
static string | ToUrlSearch (this IDictionary< string, string > data)
字典转url查询部分 更多...
static IDictionary< string, string > | ToUrlDictionary (this string url)
url查询转字典 更多...
static string | Mask (this string str, char mask= '*')
字符串掩码 更多...
static string | JoinSplitter (this string str, string splitter=",")
加入分割符 更多...
static bool | ContainsWithSplitter (this string source, string target, string splitter=",")
是否包含,如"1,2,34,5".ContainsWithSplitter("3")=false 更多...

详细描述

字符串扩展

在文件 StringExtension.cs 第 11 行定义.

成员函数说明

static string SinGooCMS.Utility.Extension.StringExtension.AsDecodeUrl ( this string urlString )
static

url解码

参数
urlString
返回
static string SinGooCMS.Utility.Extension.StringExtension.AsEncodeUrl ( this string urlString )
static

url编码

参数
urlString
返回
static bool SinGooCMS.Utility.Extension.StringExtension.ContainsWithSplitter | ( | this string | source,
 |  | string | target,
 |  | string | splitter = ","
 | ) |  |
static

是否包含,如"1,2,34,5".ContainsWithSplitter("3")=false

如 "1,2,34,5".Contains("3")=true，实际需求是",1,2,34,5,".Contains(",3,")=false

参数
source | 源字符串
target | 需要判断是否存在于源的字符串
splitter | 分割符，默认是,
返回

在文件 StringExtension.cs 第 311 行定义.

static string SinGooCMS.Utility.Extension.StringExtension.JoinSplitter | ( | this string | str,
 |  | string | splitter = ","
 | ) |  |
static

加入分割符

参数
str | 字符串
splitter | 分割符，默认是,
返回

在文件 StringExtension.cs 第 293 行定义.

static string SinGooCMS.Utility.Extension.StringExtension.Mask | ( | this string | str,
 |  | char | mask = '*'
 | ) |  |
static

字符串掩码

参数
str | 字符串
mask | 掩码符
返回

在文件 StringExtension.cs 第 263 行定义.

static string SinGooCMS.Utility.Extension.StringExtension.RemoveHtml ( this string htmlstring )
static

清除html脚本

参数
htmlstring
返回

在文件 StringExtension.cs 第 137 行定义.

static string SinGooCMS.Utility.Extension.StringExtension.RemoveWhiteSpace ( this string strInput )
static

去除空格

参数
strInput
返回

在文件 StringExtension.cs 第 108 行定义.

static string SinGooCMS.Utility.Extension.StringExtension.ToHtml ( this string strTxt )
static

把TXT代码转换成HTML格式

参数
strTxt 等待处理的字符串
返回
处理后的字符串

在文件 StringExtension.cs 第 189 行定义.

static string SinGooCMS.Utility.Extension.StringExtension.ToRMB ( this decimal decMoney )
static

转化为大写的人民币

参数
decMoney
返回

在文件 StringExtension.cs 第 20 行定义.

static string SinGooCMS.Utility.Extension.StringExtension.ToTxt ( this string htmlBlock )
static

把HTML代码转换成TXT格式

参数
htmlBlock 等待处理的字符串
返回
处理后的字符串

在文件 StringExtension.cs 第 170 行定义.

static IDictionary<string, string> SinGooCMS.Utility.Extension.StringExtension.ToUrlDictionary ( this string url )
static

url查询转字典

参数
url
返回

在文件 StringExtension.cs 第 240 行定义.

static string SinGooCMS.Utility.Extension.StringExtension.ToUrlSearch ( this IDictionary< string, string > data )
static

字典转url查询部分

参数
data
返回

在文件 StringExtension.cs 第 226 行定义.

该类的文档由以下文件生成:
  • SinGooCMS.Utility/Extension/StringExtension.cs


SinGooCMS.Utility: SinGooCMS.Utility.Extension.TaskExtensions类 参考

  • SinGooCMS
  • Utility
  • Extension
  • TaskExtensions
静态 Public 成员函数 | 静态 Private 成员函数 | 所有成员列表
SinGooCMS.Utility.Extension.TaskExtensions类 参考

System.Threading.Tasks扩展类 更多...

静态 Public 成员函数

static async Task< T > | TimeoutAfter< T > (this Task< T > task, TimeSpan timeout)
设置当前任务的最长等待时间timeout ，如果在指定的时间内还未执行完毕就报异常 更多...
static async Task< IEnumerable< Task< T > > > | TimeoutAfter< T > (this IEnumerable< Task< T >> tasks, TimeSpan timeout)
设置当前任务集合全部执行完毕的最长等待时间timeout ，如果在指定的时间内还未执行完毕就报异常 更多...
static async Task | TimeoutAfter (this Task task, TimeSpan timeout)
设置当前任务的最长等待时间timeout ，如果在指定的时间内还未执行完毕就报异常 更多...
static async Task | TimeoutAfter (this IEnumerable< Task > tasks, TimeSpan timeout)
设置当前任务集合全部执行完毕的最长等待时间timeout ，如果在指定的时间内还未执行完毕就报异常 更多...
static async Task | ForEachInOrder< T > (this IEnumerable< Task< T >> tasks, Action< T > action)
使用指定的逻辑顺序处理任务集合的返回结果 更多...
static async Task | ForEachInOrder (this IEnumerable< Task > tasks, Action< Task > action)
使用指定的逻辑顺序处理任务集合的返回结果 更多...
static TaskAwaiter< T[]> | GetAwaiter< T > (this IEnumerable< Task< T >> tasks)
等待当前集合中所有任务的返回，代码示例： 更多...
static TaskAwaiter | GetAwaiter (this IEnumerable< Task > tasks)
等待当前集合中所有任务的返回 更多...
static Task | HandleExceptions (this Task task, Action< Exception > exceptionsHandler)
处理当前任务中出现的异常 更多...
static Task | HandleExceptions (this Task task, Func< Exception, bool > exceptionPredicate, Action< Exception > exceptionHandler)
使用exceptionHandler 处理当前任务预测 (exceptionPredicate ) 的异常, 如果exceptionPredicate 返回false, 则抛出异常 更多...
static Task | HandleException< T > (this Task task, Action< T > exceptionHandler)
预测当前任务抛出的异常是否是T 类型, 如果是,则调用exceptionHandler 处理异常, 否则抛出异常 更多...

静态 Private 成员函数

static async Task | TimeoutAfterImpl (this Task task, TimeSpan timeoutPeriod)
static async Task | TimeoutAfterImpl (this IEnumerable< Task > tasks, TimeSpan timeoutPeriod)

详细描述

System.Threading.Tasks扩展类

在文件 TaskExtensions.cs 第 13 行定义.

成员函数说明

static async Task SinGooCMS.Utility.Extension.TaskExtensions.ForEachInOrder | ( | this IEnumerable< Task > | tasks,
 |  | Action< Task > | action
 | ) |  |
static

使用指定的逻辑顺序处理任务集合的返回结果

在文件 TaskExtensions.cs 第 63 行定义.

static async Task SinGooCMS.Utility.Extension.TaskExtensions.ForEachInOrder< T > | ( | this IEnumerable< Task< T >> | tasks,
 |  | Action< T > | action
 | ) |  |
static

使用指定的逻辑顺序处理任务集合的返回结果

在文件 TaskExtensions.cs 第 49 行定义.

static TaskAwaiter SinGooCMS.Utility.Extension.TaskExtensions.GetAwaiter ( this IEnumerable< Task > tasks )
static

等待当前集合中所有任务的返回

var res3 = await new List<Task>() {
Task.Run(()=>{}),
Task.Run(()=>{}),
Task.Run(()=>{})
};
static TaskAwaiter<T[]> SinGooCMS.Utility.Extension.TaskExtensions.GetAwaiter< T > ( this IEnumerable< Task< T >> tasks )
static

等待当前集合中所有任务的返回，代码示例：

var res3 = await new List<Task<int>>() {
Task.Run<int>(()=>1),
Task.Run<int>(()=>2),
Task.Run<int>(()=>3)
};
//输出: 1,2,3
Console.WriteLine(string.Join(",", res3));
static Task SinGooCMS.Utility.Extension.TaskExtensions.HandleException< T > | ( | this Task | task,
 |  | Action< T > | exceptionHandler
 | ) |  |
static

预测当前任务抛出的异常是否是T 类型, 如果是,则调用exceptionHandler 处理异常, 否则抛出异常

参考：

参见
TaskExtensions.HandleException<T>(Task, Action<T>)
类型限制
T : Exception

在文件 TaskExtensions.cs 第 184 行定义.

static Task SinGooCMS.Utility.Extension.TaskExtensions.HandleExceptions | ( | this Task | task,
 |  | Action< Exception > | exceptionsHandler
 | ) |  |
static

处理当前任务中出现的异常

Task.Run(() =>
{
int i = 0;
i = 1 / i;
}).HandleExceptions((ex) =>
{
//输出: 尝试除以0
Console.WriteLine(ex.Message);
}).Wait();
参数
task | The task which might throw exceptions
exceptionsHandler | The handler to which every exception is passed
返回
当前任务的延续任务

在文件 TaskExtensions.cs 第 126 行定义.

static Task SinGooCMS.Utility.Extension.TaskExtensions.HandleExceptions | ( | this Task | task,
 |  | Func< Exception, bool > | exceptionPredicate,
 |  | Action< Exception > | exceptionHandler
 | ) |  |
static

使用exceptionHandler 处理当前任务预测 (exceptionPredicate ) 的异常, 如果exceptionPredicate 返回false, 则抛出异常

参考：

参见
TaskExtensions.HandleException<T>(Task, Action<T>)

在文件 TaskExtensions.cs 第 152 行定义.

static async Task SinGooCMS.Utility.Extension.TaskExtensions.TimeoutAfter | ( | this Task | task,
 |  | TimeSpan | timeout
 | ) |  |
static

设置当前任务的最长等待时间timeout ，如果在指定的时间内还未执行完毕就报异常

static async Task SinGooCMS.Utility.Extension.TaskExtensions.TimeoutAfter | ( | this IEnumerable< Task > | tasks,
 |  | TimeSpan | timeout
 | ) |  |
static

设置当前任务集合全部执行完毕的最长等待时间timeout ，如果在指定的时间内还未执行完毕就报异常

static async Task<T> SinGooCMS.Utility.Extension.TaskExtensions.TimeoutAfter< T > | ( | this Task< T > | task,
 |  | TimeSpan | timeout
 | ) |  |
static

设置当前任务的最长等待时间timeout ，如果在指定的时间内还未执行完毕就报异常

在文件 TaskExtensions.cs 第 18 行定义.

static async Task<IEnumerable<Task<T> > > SinGooCMS.Utility.Extension.TaskExtensions.TimeoutAfter< T > | ( | this IEnumerable< Task< T >> | tasks,
 |  | TimeSpan | timeout
 | ) |  |
static

设置当前任务集合全部执行完毕的最长等待时间timeout ，如果在指定的时间内还未执行完毕就报异常

在文件 TaskExtensions.cs 第 27 行定义.

static async Task SinGooCMS.Utility.Extension.TaskExtensions.TimeoutAfterImpl | ( | this Task | task,
 |  | TimeSpan | timeoutPeriod
 | ) |  |
staticprivate

在文件 TaskExtensions.cs 第 210 行定义.

static async Task SinGooCMS.Utility.Extension.TaskExtensions.TimeoutAfterImpl | ( | this IEnumerable< Task > | tasks,
 |  | TimeSpan | timeoutPeriod
 | ) |  |
staticprivate

在文件 TaskExtensions.cs 第 228 行定义.

该类的文档由以下文件生成:
  • SinGooCMS.Utility/Extension/TaskExtensions.cs


SinGooCMS.Utility: SinGooCMS.Utility.Extension.TypeExtensions类 参考

  • SinGooCMS
  • Utility
  • Extension
  • TypeExtensions
静态 Public 成员函数 | 静态 Private 成员函数 | 静态 Private 属性 | 所有成员列表
SinGooCMS.Utility.Extension.TypeExtensions类 参考

Type扩展类 更多...

静态 Public 成员函数

static bool | TryGetInstanceProperty (this Type type, string propertyName, out PropertyInfo property, bool inherit=true)
尝试反射返回给定type 的<c>实例属性 更多...
static PropertyInfo[] | GetInstanceProperties (this Type type, bool inherit=true, bool includePrivate=true)
尝试反射返回给定type 的<c>实例属性 更多...
static PropertyInfo[] | GetInstanceProperties (this TypeInfo typeInfo, bool inherit, bool includePrivate)
根据条件返回所有能获取到的属性描述 更多...
static IEnumerable< PropertyInfo > | GetPropertiesWithAttribute< T > (this Type type, bool inherit=true)
根据条件返回具有 T 特性的属性 更多...
static Dictionary< T, PropertyInfo > | GetAttributeToPropertyMapping< T > (this Type type, bool inherit=true)
返回具有 T 特性的属性, 并将 T 实例和对应的属性描述转为字典 更多...
static bool | TryGetAttributes< T > (this Type type, out T[] attributes, bool inherit=true)
尝试获取当前

参见
Type

上定义的所有 T 类型的特性数组 更多...

static bool | TryGetGenericArguments (this Type type, out Type[] genericArguments)
如果当前类型具有泛型参数的话,就返回所有的泛型类型，代码示例： 更多...
static bool | IsSequence (this Type type, out SequenceType sequenceType)
判断当前类型是否是序列(数组、集合) 注意：包括字符串 更多...
static bool | IsImplements< T > (this Type type)
判断当前类型是否继承自T 注意：T 可以是接口或类 更多...
static bool | HasDefaultConstructor (this Type type)
判断当前类型是否具有空参数构造函数 更多...
static bool | IsSimpleType (this Type type)
判断当前类型是否是简单类型 更多...
static bool | IsArrayOf< T > (this Type type)
判断当前类型是否是数组 T[] 更多...
static bool | IsGenericList (this Type type)
判断当前类型是否是 List<> 或 IList<> 更多...
static bool | IsNumeric (this Type type)
判断当前类型是否是数字类型(如: "int","int?" 均是数字类型 ) 更多...
static TypeCode | GetTypeCode (this Type type)
获取当前类型的

参见
TypeCode
更多...
static string | GetClassFullName (this Type type)
获取当前类型的名称,如:

  1. typeof(List<>) => System.Collections.Generic.List<T>
  2. typeof(List<Person>) => System.Collections.Generic.List<DotNetCommonTestNamespace.Person>
  3. typeof(DemoFu<int?>.DemoZi<long[], double?[]>.DemoSunlt;string>) => DotNetCommonTestNamespace.DemoFu<int?>.DemoZi<long[],double?[]>.DemoSun<string>
更多...
static bool | IsNullable (this Type type)
是否是Nullable类型的 更多...
static object | GetDefault (this Type type)
获取默认值 更多...

静态 Private 成员函数

static void GetParents (List< Type > parents, Type type)

静态 Private 属性

static readonly Type[] | SimpleTypes
static readonly Dictionary< string, SequenceType > | NonGenericCollectionsToSequenceTypeMapping
static Dictionary< Type, string > | shortNames
static ConcurrentDictionary< Type, string > | classNamesCache = new ConcurrentDictionary<Type, string>()

详细描述

Type扩展类

在文件 TypeExtensions.cs 第 13 行定义.

成员函数说明

static Dictionary<T, PropertyInfo> SinGooCMS.Utility.Extension.TypeExtensions.GetAttributeToPropertyMapping< T > | ( | this Type | type,
 |  | bool | inherit = true
 | ) |  |
static

返回具有 T 特性的属性, 并将 T 实例和对应的属性描述转为字典

参数
type
inherit 是否包含继承的属性
类型限制
T : Attribute

在文件 TypeExtensions.cs 第 118 行定义.

static string SinGooCMS.Utility.Extension.TypeExtensions.GetClassFullName ( this Type type )
static

获取当前类型的名称,如:

  1. typeof(List<>) => System.Collections.Generic.List<T>
  2. typeof(List<Person>) => System.Collections.Generic.List<DotNetCommonTestNamespace.Person>
  3. typeof(DemoFu<int?>.DemoZi<long[], double?[]>.DemoSunlt;string>) => DotNetCommonTestNamespace.DemoFu<int?>.DemoZi<long[],double?[]>.DemoSun<string>

参数
type
返回

在文件 TypeExtensions.cs 第 470 行定义.

static object SinGooCMS.Utility.Extension.TypeExtensions.GetDefault ( this Type type )
static

获取默认值

返回
static PropertyInfo [] SinGooCMS.Utility.Extension.TypeExtensions.GetInstanceProperties | ( | this Type | type,
 |  | bool | inherit = true,
 |  | bool | includePrivate = true
 | ) |  |
static

尝试反射返回给定type 的<c>实例属性

此方法可用于返回<c>public或<c>non-public 属性。

参数
type
inherit | 是否返回继承属性
includePrivate | 是否包含私有属性
返回

在文件 TypeExtensions.cs 第 81 行定义.

static PropertyInfo [] SinGooCMS.Utility.Extension.TypeExtensions.GetInstanceProperties | ( | this TypeInfo | typeInfo,
 |  | bool | inherit,
 |  | bool | includePrivate
 | ) |  |
static

根据条件返回所有能获取到的属性描述

此方法可用于返回<c>public或<c>non-public 属性。

参数
typeInfo
inherit | 是否返回继承属性
includePrivate | 是否包含私有属性

在文件 TypeExtensions.cs 第 93 行定义.

static void SinGooCMS.Utility.Extension.TypeExtensions.GetParents | ( | List< Type > | parents,
 |  | Type | type
 | ) |  |
staticprivate

在文件 TypeExtensions.cs 第 524 行定义.

static IEnumerable<PropertyInfo> SinGooCMS.Utility.Extension.TypeExtensions.GetPropertiesWithAttribute< T > | ( | this Type | type,
 |  | bool | inherit = true
 | ) |  |
static

根据条件返回具有 T 特性的属性

参数
type
inherit 是否返回继承的属性
类型限制
T : Attribute

在文件 TypeExtensions.cs 第 107 行定义.

static TypeCode SinGooCMS.Utility.Extension.TypeExtensions.GetTypeCode ( this Type type )
static

获取当前类型的

参见
TypeCode

在文件 TypeExtensions.cs 第 436 行定义.

static bool SinGooCMS.Utility.Extension.TypeExtensions.HasDefaultConstructor ( this Type type )
static

判断当前类型是否具有空参数构造函数

在文件 TypeExtensions.cs 第 342 行定义.

static bool SinGooCMS.Utility.Extension.TypeExtensions.IsArrayOf< T > ( this Type type )
static

判断当前类型是否是数组 T[]

static bool SinGooCMS.Utility.Extension.TypeExtensions.IsGenericList ( this Type type )
static

判断当前类型是否是 List<> 或 IList<>

在文件 TypeExtensions.cs 第 392 行定义.

static bool SinGooCMS.Utility.Extension.TypeExtensions.IsImplements< T > ( this Type type )
static

判断当前类型是否继承自T 注意：T 可以是接口或类

在文件 TypeExtensions.cs 第 334 行定义.

static bool SinGooCMS.Utility.Extension.TypeExtensions.IsNullable ( this Type type )
static

是否是Nullable类型的

参数
type

在文件 TypeExtensions.cs 第 560 行定义.

static bool SinGooCMS.Utility.Extension.TypeExtensions.IsNumeric ( this Type type )
static

判断当前类型是否是数字类型(如: "int","int?" 均是数字类型 )

在文件 TypeExtensions.cs 第 406 行定义.

static bool SinGooCMS.Utility.Extension.TypeExtensions.IsSequence | ( | this Type | type,
 |  | out SequenceType | sequenceType
 | ) |  |
static

判断当前类型是否是序列(数组、集合) 注意：包括字符串

在文件 TypeExtensions.cs 第 186 行定义.

static bool SinGooCMS.Utility.Extension.TypeExtensions.IsSimpleType ( this Type type )
static

判断当前类型是否是简单类型

简单类型如下（包含简单类型的可空类型）

typeof(byte),
typeof(sbyte),
typeof(short),
typeof(ushort),
typeof(int),
typeof(uint),
typeof(long),
typeof(ulong),
typeof(float),
typeof(double),
typeof(decimal),
typeof(bool),
typeof(string),
typeof(char),
typeof(Guid),
typeof(DateTime),
typeof(DateTimeOffset),
typeof(TimeSpan),
typeof(byte[])

在文件 TypeExtensions.cs 第 376 行定义.

static bool SinGooCMS.Utility.Extension.TypeExtensions.TryGetAttributes< T > | ( | this Type | type,
 |  | out T[] | attributes,
 |  | bool | inherit = true
 | ) |  |
static

尝试获取当前

参见
Type

上定义的所有 T 类型的特性数组

参数
type
attributes
inherit 是否包含继承的特性
类型限制
T : Attribute

在文件 TypeExtensions.cs 第 139 行定义.

static bool SinGooCMS.Utility.Extension.TypeExtensions.TryGetGenericArguments | ( | this Type | type,
 |  | out Type[] | genericArguments
 | ) |  |
static

如果当前类型具有泛型参数的话,就返回所有的泛型类型，代码示例：

if (typeof(Dictionary<string, object>).TryGetGenericArguments(out Type[] res))
{
//输出: System.String,System.Object
Console.WriteLine(string.Join(",", res.ToList()));
}

在文件 TypeExtensions.cs 第 165 行定义.

static bool SinGooCMS.Utility.Extension.TypeExtensions.TryGetInstanceProperty | ( | this Type | type,
 |  | string | propertyName,
 |  | out PropertyInfo | property,
 |  | bool | inherit = true
 | ) |  |
static

尝试反射返回给定type 的<c>实例属性

参数
type
propertyName | 属性名称
property | 返回的属性
inherit | 是否返回继承属性
返回

在文件 TypeExtensions.cs 第 62 行定义.

类成员变量说明

ConcurrentDictionary<Type, string> SinGooCMS.Utility.Extension.TypeExtensions.classNamesCache = new ConcurrentDictionary<Type, string>()
staticprivate

在文件 TypeExtensions.cs 第 554 行定义.

readonly Dictionary<string, SequenceType> SinGooCMS.Utility.Extension.TypeExtensions.NonGenericCollectionsToSequenceTypeMapping
staticprivate
初始值:
= new Dictionary<string, SequenceType>(StringComparer.Ordinal)
{
{ "System.String", SequenceType.String },
{ "System.Collections.ArrayList", SequenceType.ArrayList },
{ "System.Collections.Queue", SequenceType.Queue },
{ "System.Collections.Stack", SequenceType.Stack },
{ "System.Collections.BitArray", SequenceType.BitArray },
{ "System.Collections.SortedList", SequenceType.SortedList },
{ "System.Collections.Hashtable", SequenceType.Hashtable },
{ "System.Collections.Specialized.ListDictionary", SequenceType.ListDictionary },
{ "System.Collections.IList", SequenceType.IList },
{ "System.Collections.ICollection", SequenceType.ICollection },
{ "System.Collections.IDictionary", SequenceType.IDictionary },
{ "System.Collections.IEnumerable", SequenceType.IEnumerable }
}

在文件 TypeExtensions.cs 第 38 行定义.

Dictionary<Type, string> SinGooCMS.Utility.Extension.TypeExtensions.shortNames
staticprivate
初始值:
= new Dictionary<Type, string>()
{
{ typeof(byte),"byte"},{ typeof(byte?),"byte?"},{ typeof(byte[]),"byte[]"},{ typeof(byte?[]),"byte?[]"},
{ typeof(sbyte),"sbyte"},{ typeof(sbyte?),"sbyte?"},{ typeof(sbyte[]),"sbyte[]"},{ typeof(sbyte?[]),"sbyte?[]"},
{ typeof(short),"short"},{ typeof(short?),"short?"},{ typeof(short[]),"short[]"},{ typeof(short?[]),"short?[]"},
{ typeof(ushort),"ushort"},{ typeof(ushort?),"ushort?"},{ typeof(ushort[]),"ushort[]"},{ typeof(ushort?[]),"ushort?[]"},
{ typeof(int),"int"},{ typeof(int?),"int?"},{ typeof(int[]),"int[]"},{ typeof(int?[]),"int?[]"},
{ typeof(uint),"uint"},{ typeof(uint?),"uint?"},{ typeof(uint[]),"uint[]"},{ typeof(uint?[]),"uint?[]"},
{ typeof(long),"long"},{ typeof(long?),"long?"},{ typeof(long[]),"long[]"},{ typeof(long?[]),"long?[]"},
{ typeof(ulong),"ulong"},{ typeof(ulong?),"ulong?"},{ typeof(ulong[]),"ulong[]"},{ typeof(ulong?[]),"ulong?[]"},
{ typeof(float),"float"},{ typeof(float?),"float?"},{ typeof(float[]),"float[]"},{ typeof(float?[]),"float?[]"},
{ typeof(double),"double"},{ typeof(double?),"double?"},{ typeof(double[]),"double[]"},{ typeof(double?[]),"double?[]"},
{ typeof(decimal),"decimal"},{ typeof(decimal?),"decimal?"},{ typeof(decimal[]),"decimal[]"},{ typeof(decimal?[]),"decimal?[]"},
{ typeof(char),"char"},{ typeof(char?),"char?"},{ typeof(char[]),"char[]"},{ typeof(char?[]),"char?[]"},
{ typeof(string),"string"},{ typeof(string[]),"string[]"},
{ typeof(bool),"bool"},{ typeof(bool?),"bool?"},{ typeof(bool[]),"bool[]"},{ typeof(bool?[]),"bool?[]"},
}

在文件 TypeExtensions.cs 第 537 行定义.

readonly Type [] SinGooCMS.Utility.Extension.TypeExtensions.SimpleTypes
staticprivate
初始值:
=
{
typeof(byte),
typeof(sbyte),
typeof(short),
typeof(ushort),
typeof(int),
typeof(uint),
typeof(long),
typeof(ulong),
typeof(float),
typeof(double),
typeof(decimal),
typeof(bool),
typeof(string),
typeof(char),
typeof(Guid),
typeof(DateTime),
typeof(DateTimeOffset),
typeof(TimeSpan),
typeof(byte[])
}

在文件 TypeExtensions.cs 第 15 行定义.

该类的文档由以下文件生成:
  • SinGooCMS.Utility/Extension/TypeExtensions.cs


SinGooCMS.Utility: SinGooCMS.Utility.Extension.UriExtension类 参考

  • SinGooCMS
  • Utility
  • Extension
  • UriExtension
静态 Public 成员函数 | 静态 Private 成员函数 | 静态 Private 属性 | 所有成员列表
SinGooCMS.Utility.Extension.UriExtension类 参考

提供一组使用Uri的辅助方法。 更多...

静态 Public 成员函数

static IEnumerable< KeyValuePair< string, string > > | ParseQueryString (this Uri uri)
从查询字符串中提取参数和值。 更多...
static Uri | AddParametersToQueryString (this Uri uri, string parameter, string value)
添加或附加给定的parameter 和value 到uri 的查询字符串。 更多...
static Uri | AddParametersToQueryString (this Uri uri, IDictionary< string, string > pairs)
将键和值的给定pairs 添加或附加到uri 的查询字符串中。 更多...

静态 Private 成员函数

static Uri AddOrAppendToQueryString (Uri uri, string query)

静态 Private 属性

static readonly Regex QueryStringRegex = new Regex(@"[?|&]([%23\w\.-]+)=([^?|^&]+)", RegexOptions.Compiled)

详细描述

提供一组使用Uri的辅助方法。

在文件 UriExtensions.cs 第 12 行定义.

成员函数说明

static Uri SinGooCMS.Utility.Extension.UriExtension.AddOrAppendToQueryString | ( | Uri | uri,
 |  | string | query
 | ) |  |
staticprivate

在文件 UriExtensions.cs 第 64 行定义.

static Uri SinGooCMS.Utility.Extension.UriExtension.AddParametersToQueryString | ( | this Uri | uri,
 |  | string | parameter,
 |  | string | value
 | ) |  |
static

添加或附加给定的parameter 和value 到uri 的查询字符串。

此方法可以正确地<c>URL-encode为给定的parameter 和value 。

在文件 UriExtensions.cs 第 43 行定义.

static Uri SinGooCMS.Utility.Extension.UriExtension.AddParametersToQueryString | ( | this Uri | uri,
 |  | IDictionary< string, string > | pairs
 | ) |  |
static

将键和值的给定pairs 添加或附加到uri 的查询字符串中。

该方法也正确地<c>URL-encode的键和值。

在文件 UriExtensions.cs 第 55 行定义.

static IEnumerable<KeyValuePair<string, string> > SinGooCMS.Utility.Extension.UriExtension.ParseQueryString ( this Uri uri )
static

从查询字符串中提取参数和值。

此方法还可以正确<c>URL解码解析的键和值。

在文件 UriExtensions.cs 第 22 行定义.

类成员变量说明

readonly Regex SinGooCMS.Utility.Extension.UriExtension.QueryStringRegex = new Regex(@"[?|&]([%23\w\.-]+)=([^?|^&]+)", RegexOptions.Compiled)
staticprivate

在文件 UriExtensions.cs 第 14 行定义.

该类的文档由以下文件生成:
  • SinGooCMS.Utility/Extension/UriExtensions.cs


SinGooCMS.Utility: SinGooCMS.Utility.Extension.ValidateExtension类 参考

  • SinGooCMS
  • Utility
  • Extension
  • ValidateExtension
静态 Public 成员函数 | 所有成员列表
SinGooCMS.Utility.Extension.ValidateExtension类 参考

验证扩展 更多...

静态 Public 成员函数

static bool | IsNullOrEmpty (this object thisValue)
是否null或者空字符串 更多...
static bool | IsNullOrWhiteSpace (this object thisValue)
是否null或者空格 更多...
static bool | IsNotNullOrEmpty (this object thisValue)
非null而且有值（非空格） 更多...
static bool | IsJson (this string txtJson)
判断是否json格式字符串 更多...
static bool | IsBetween (this int thisValue, int begin, int end)
是否在两者之间（包含） 更多...
static bool | IsBetween (this decimal thisValue, decimal begin, decimal end)
是否在两者之间（包含） 更多...
static bool | IsBetween (this DateTime thisValue, DateTime begin, DateTime end)
是否在两者之间（包含） 更多...
static bool | IsInt (this string thisValue)
是否整数 更多...
static bool | IsNoInt (this string thisValue)
不是整数 更多...
static bool | IsGuid (this string thisValue)
是否GUID 更多...
static bool | IsDate (this string thisValue)
是否日期 更多...
static bool | IsEmail (this string thisValue)
是否邮件地址 更多...
static bool | IsMobile (this string thisValue)
是否手机号 更多...
static bool | IsTelephone (this string thisValue)
是否电话 更多...
static bool | IsIDCard (this string thisValue)
是否身份证号 更多...
static bool | IsFax (this string thisValue)
是否传真 更多...
static bool | IsMatch (this string thisValue, string pattern)
是否匹配 更多...
static bool | IsEn (this string thisValue)
是否英文 更多...
static bool | IsZHCN (this string thisValue)
是否中文 更多...
static bool | IsUrl (this string thisValue)
是否URL 更多...
static bool | IsIP (this string thisValue)
是否IP 更多...
static bool | IsDecimal (this string thisValue)
是否小数 更多...
static bool | IsImage (this string fileName)
根据文件后缀名来判断是否图片文件 更多...

详细描述

验证扩展

在文件 ValidateExtension.cs 第 11 行定义.

成员函数说明

static bool SinGooCMS.Utility.Extension.ValidateExtension.IsBetween | ( | this int | thisValue,
 |  | int | begin,
 |  | int | end
 | ) |  |
static

是否在两者之间（包含）

参数
thisValue
begin
end
返回

在文件 ValidateExtension.cs 第 68 行定义.

static bool SinGooCMS.Utility.Extension.ValidateExtension.IsBetween | ( | this decimal | thisValue,
 |  | decimal | begin,
 |  | decimal | end
 | ) |  |
static

是否在两者之间（包含）

参数
thisValue
begin
end
返回

在文件 ValidateExtension.cs 第 79 行定义.

static bool SinGooCMS.Utility.Extension.ValidateExtension.IsBetween | ( | this DateTime | thisValue,
 |  | DateTime | begin,
 |  | DateTime | end
 | ) |  |
static

是否在两者之间（包含）

参数
thisValue
begin
end
返回

在文件 ValidateExtension.cs 第 90 行定义.

static bool SinGooCMS.Utility.Extension.ValidateExtension.IsDate ( this string thisValue )
static

是否日期

参数
thisValue
返回

在文件 ValidateExtension.cs 第 133 行定义.

static bool SinGooCMS.Utility.Extension.ValidateExtension.IsDecimal ( this string thisValue )
static

是否小数

参数
thisValue
返回

在文件 ValidateExtension.cs 第 266 行定义.

static bool SinGooCMS.Utility.Extension.ValidateExtension.IsEmail ( this string thisValue )
static

是否邮件地址

参数
thisValue
返回

在文件 ValidateExtension.cs 第 145 行定义.

static bool SinGooCMS.Utility.Extension.ValidateExtension.IsEn ( this string thisValue )
static

是否英文

参数
thisValue
返回

在文件 ValidateExtension.cs 第 218 行定义.

static bool SinGooCMS.Utility.Extension.ValidateExtension.IsFax ( this string thisValue )
static

是否传真

参数
thisValue
返回

在文件 ValidateExtension.cs 第 193 行定义.

static bool SinGooCMS.Utility.Extension.ValidateExtension.IsGuid ( this string thisValue )
static

是否GUID

参数
thisValue
返回

在文件 ValidateExtension.cs 第 121 行定义.

static bool SinGooCMS.Utility.Extension.ValidateExtension.IsIDCard ( this string thisValue )
static

是否身份证号

参数
thisValue
返回

在文件 ValidateExtension.cs 第 181 行定义.

static bool SinGooCMS.Utility.Extension.ValidateExtension.IsImage ( this string fileName )
static

根据文件后缀名来判断是否图片文件

参数
fileName
返回

在文件 ValidateExtension.cs 第 278 行定义.

static bool SinGooCMS.Utility.Extension.ValidateExtension.IsInt ( this string thisValue )
static

是否整数

参数
thisValue
返回

在文件 ValidateExtension.cs 第 100 行定义.

static bool SinGooCMS.Utility.Extension.ValidateExtension.IsIP ( this string thisValue )
static

是否IP

参数
thisValue
返回

在文件 ValidateExtension.cs 第 254 行定义.

static bool SinGooCMS.Utility.Extension.ValidateExtension.IsJson ( this string txtJson )
static

判断是否json格式字符串

参数
txtJson
返回

在文件 ValidateExtension.cs 第 56 行定义.

static bool SinGooCMS.Utility.Extension.ValidateExtension.IsMatch | ( | this string | thisValue,
 |  | string | pattern
 | ) |  |
static

是否匹配

参数
thisValue
pattern
返回

在文件 ValidateExtension.cs 第 206 行定义.

static bool SinGooCMS.Utility.Extension.ValidateExtension.IsMobile ( this string thisValue )
static

是否手机号

参数
thisValue
返回

在文件 ValidateExtension.cs 第 157 行定义.

static bool SinGooCMS.Utility.Extension.ValidateExtension.IsNoInt ( this string thisValue )
static

不是整数

参数
thisValue
返回

在文件 ValidateExtension.cs 第 111 行定义.

static bool SinGooCMS.Utility.Extension.ValidateExtension.IsNotNullOrEmpty ( this object thisValue )
static

非null而且有值（非空格）

参数
thisValue
返回

在文件 ValidateExtension.cs 第 44 行定义.

static bool SinGooCMS.Utility.Extension.ValidateExtension.IsNullOrEmpty ( this object thisValue )
static

是否null或者空字符串

参数
thisValue
返回

在文件 ValidateExtension.cs 第 20 行定义.

static bool SinGooCMS.Utility.Extension.ValidateExtension.IsNullOrWhiteSpace ( this object thisValue )
static

是否null或者空格

参数
thisValue
返回

在文件 ValidateExtension.cs 第 32 行定义.

static bool SinGooCMS.Utility.Extension.ValidateExtension.IsTelephone ( this string thisValue )
static

是否电话

参数
thisValue
返回

在文件 ValidateExtension.cs 第 169 行定义.

static bool SinGooCMS.Utility.Extension.ValidateExtension.IsUrl ( this string thisValue )
static

是否URL

参数
thisValue
返回

在文件 ValidateExtension.cs 第 242 行定义.

static bool SinGooCMS.Utility.Extension.ValidateExtension.IsZHCN ( this string thisValue )
static

是否中文

参数
thisValue
返回

在文件 ValidateExtension.cs 第 230 行定义.

该类的文档由以下文件生成:
  • SinGooCMS.Utility/Extension/ValidateExtension.cs


SinGooCMS.Utility: SinGooCMS.Utility.Extension.XmlserializeExtension类 参考

  • SinGooCMS
  • Utility
  • Extension
  • XmlserializeExtension
静态 Public 成员函数 | 所有成员列表
SinGooCMS.Utility.Extension.XmlserializeExtension类 参考

xml序列化扩展 更多...

静态 Public 成员函数

static string | ToXml< T > (this T t)
序列化 更多...
static T | XmlToObject< T > (this string strXml)
反序列化 更多...

详细描述

xml序列化扩展

在文件 XmlserializeExtension.cs 第 11 行定义.

成员函数说明

static string SinGooCMS.Utility.Extension.XmlserializeExtension.ToXml< T > ( this T t )
static

序列化

模板参数
T
参数
t
返回

在文件 XmlserializeExtension.cs 第 21 行定义.

static T SinGooCMS.Utility.Extension.XmlserializeExtension.XmlToObject< T > ( this string strXml )
static

反序列化

模板参数
T
参数
strXml
返回

在文件 XmlserializeExtension.cs 第 43 行定义.

该类的文档由以下文件生成:
  • SinGooCMS.Utility/Extension/XmlserializeExtension.cs


SinGooCMS.Utility: SinGooCMS.Utility.Accessor类 参考

  • SinGooCMS
  • Utility
  • Accessor
静态 Public 成员函数 | Protected 成员函数 | 属性 | 所有成员列表
SinGooCMS.Utility.Accessor类 参考

用于构建ObjectAccessor和 GenericAccessor<TInstance>实例。 更多...

类 SinGooCMS.Utility.Accessor 继承关系图:
[图例]

静态 Public 成员函数

static ObjectAccessor | Build (object instance, bool ignoreCase=false, bool includeNonPublic=false)
根据给定的对象创建ObjectAccessor实例 更多...
static ObjectAccessor | Build (Type instanceType, bool ignoreCase=false, bool includeNonPublic=false)
根据给定的对象类型创建ObjectAccessor实例 更多...
static GenericAccessor< TInstance > | Build< TInstance > (bool ignoreCase=false, bool includeNonPublic=false)
根据给定的对象类型创建GenericAccessor<TInstance>实例 更多...

Protected 成员函数

Accessor (IReflect type, bool ignoreCase, bool includeNonPublic)
用户创建Accessor类型的实例 更多...

属性

StringComparer | Comparer [get]
获取反射模型属性时用到的名称比较器 StringComparer 更多...
IReflect | Type [get]
当前反射的对象类型 更多...
bool | IgnoreCase [get]
获取的属性是否是忽略大小的 更多...
bool | IncludesNonPublic [get]
获取的属性是否包含非public类型的 更多...
SortedList< string, PropertyInfo > | Properties [get]
所有能获取到的属性信息 更多...

详细描述

用于构建ObjectAccessor和 GenericAccessor<TInstance>实例。

在文件 Accessor.cs 第 12 行定义.

构造及析构函数说明

SinGooCMS.Utility.Accessor.Accessor | ( | IReflect | type,
 |  | bool | ignoreCase,
 |  | bool | includeNonPublic
 | ) |  |
protected

用户创建Accessor类型的实例

参数
type | 要进行反射的模型类型
ignoreCase | 反射模型属性时是否忽略大小写
includeNonPublic | 是否反射模型的非<c>public方法

在文件 Accessor.cs 第 26 行定义.

成员函数说明

static ObjectAccessor SinGooCMS.Utility.Accessor.Build | ( | object | instance,
 |  | bool | ignoreCase = false,
 |  | bool | includeNonPublic = false
 | ) |  |
static

根据给定的对象创建ObjectAccessor实例

参数
instance | 给定的对象
ignoreCase | 是否忽略大小写
includeNonPublic | 是否包含非public属性

在文件 Accessor.cs 第 80 行定义.

static ObjectAccessor SinGooCMS.Utility.Accessor.Build | ( | Type | instanceType,
 |  | bool | ignoreCase = false,
 |  | bool | includeNonPublic = false
 | ) |  |
static

根据给定的对象类型创建ObjectAccessor实例

参数
instanceType | 给定的对象类型
ignoreCase | 是否忽略大小写
includeNonPublic | 是否包含非public属性

在文件 Accessor.cs 第 92 行定义.

static GenericAccessor<TInstance> SinGooCMS.Utility.Accessor.Build< TInstance > | ( | bool | ignoreCase = false,
 |  | bool | includeNonPublic = false
 | ) |  |
static

根据给定的对象类型创建GenericAccessor<TInstance>实例

模板参数
TInstance 对象类型
参数
ignoreCase | 是否忽略大小写
includeNonPublic | 是否包含非public属性
类型限制
TInstance : class
TInstance : new
TInstance : GenericAccessor<TInstance>
TInstance : ignoreCase
TInstance : includeNonPublic

属性说明

StringComparer SinGooCMS.Utility.Accessor.Comparer
getprotected

获取反射模型属性时用到的名称比较器 StringComparer

在文件 Accessor.cs 第 51 行定义.

bool SinGooCMS.Utility.Accessor.IgnoreCase
get

获取的属性是否是忽略大小的

在文件 Accessor.cs 第 61 行定义.

bool SinGooCMS.Utility.Accessor.IncludesNonPublic
get

获取的属性是否包含非public类型的

在文件 Accessor.cs 第 66 行定义.

SortedList<string, PropertyInfo> SinGooCMS.Utility.Accessor.Properties
get

所有能获取到的属性信息

在文件 Accessor.cs 第 71 行定义.

IReflect SinGooCMS.Utility.Accessor.Type
get

当前反射的对象类型

在文件 Accessor.cs 第 56 行定义.

该类的文档由以下文件生成:
  • SinGooCMS.Utility/Accessors/Accessor.cs


SinGooCMS.Utility: SinGooCMS.Utility.AccessorBuilder类 参考

  • SinGooCMS
  • Utility
  • AccessorBuilder
静态 Public 成员函数 | 所有成员列表
SinGooCMS.Utility.AccessorBuilder类 参考

提供一系列快速构建

参见
Accessor

实例的方法 更多...

静态 Public 成员函数

static Action< TInstance, TProperty > | BuildSetter< TInstance, TProperty > (string propertyName, bool includePrivate=false)
根据给定的属性名称采获取属性的写入逻辑 更多...
static Action< TInstance, TProperty > | BuildSetter< TInstance, TProperty > (PropertyInfo propertyInfo, bool includePrivate=false)
根据给定属性信息获取属性的写入逻辑 更多...
static Func< TInstance, TProperty > | BuildGetter< TInstance, TProperty > (string propertyName, bool includePrivate=false)
根据给定属性名称获取属性的读取逻辑 更多...
static Func< TInstance, TProperty > | BuildGetter< TInstance, TProperty > (PropertyInfo propertyInfo, bool includePrivate=false)
根据给定属性信息获取属性的读取逻辑 更多...
static Action< object, object > | BuildSetter (PropertyInfo propertyInfo, bool includePrivate=false)
根据给定属性信息获取属性的写入逻辑 更多...
static Func< object, object > | BuildGetter (PropertyInfo propertyInfo, bool includePrivate=false)
根据给定属性信息获取属性的读取逻辑 更多...
static Action< TInstance, object > | BuildSetter< TInstance > (string propertyName, bool includePrivate=false)
根据给定属性名称获取属性的写入逻辑 更多...
static Action< TInstance, object > | BuildSetter< TInstance > (PropertyInfo propertyInfo, bool includePrivate=false)
根据给定属性信息获取属性的写入逻辑 更多...
static Func< TInstance, object > | BuildGetter< TInstance > (string propertyName, bool includePrivate=false)
根据给定属性名称获取属性的读取逻辑 更多...
static Func< TInstance, object > | BuildGetter< TInstance > (PropertyInfo propertyInfo, bool includePrivate=false)
根据给定属性信息获取属性的写入逻辑 更多...
static Func< TInstance > | BuildInstanceCreator< TInstance > ()
根据给定对象类型获取构造函数 更多...
static Func< object[], TInstance > | BuildInstanceCreator< TInstance > (ConstructorInfo constructor)
根据对象的构造函数信息创建对象构建逻辑

异常
IndexOutOfRangeException | 如果参数数量不正确
InvalidCastException | 如果参数类型不正确
更多...

详细描述

提供一系列快速构建

参见
Accessor

实例的方法

在文件 AccessorBuilder.cs 第 12 行定义.

成员函数说明

static Func<object, object> SinGooCMS.Utility.AccessorBuilder.BuildGetter | ( | PropertyInfo | propertyInfo,
 |  | bool | includePrivate = false
 | ) |  |
static

根据给定属性信息获取属性的读取逻辑

参数
includePrivate | 是否排除private方法
propertyInfo | 属性信息

在文件 AccessorBuilder.cs 第 112 行定义.

这是这个函数的调用关系图:

static Func<TInstance, object> SinGooCMS.Utility.AccessorBuilder.BuildGetter< TInstance > | ( | string | propertyName,
 |  | bool | includePrivate = false
 | ) |  |
static

根据给定属性名称获取属性的读取逻辑

参数
includePrivate | 是否排除private方法
propertyName | 属性名称

在文件 AccessorBuilder.cs 第 178 行定义.

static Func<TInstance, object> SinGooCMS.Utility.AccessorBuilder.BuildGetter< TInstance > | ( | PropertyInfo | propertyInfo,
 |  | bool | includePrivate = false
 | ) |  |
static

根据给定属性信息获取属性的写入逻辑

参数
includePrivate | 是否排除private方法
propertyInfo | 属性信息

在文件 AccessorBuilder.cs 第 193 行定义.

static Func<TInstance, TProperty> SinGooCMS.Utility.AccessorBuilder.BuildGetter< TInstance, TProperty > | ( | string | propertyName,
 |  | bool | includePrivate = false
 | ) |  |
static

根据给定属性名称获取属性的读取逻辑

参数
includePrivate | 是否排除private方法
propertyName | 属性名称
类型限制
TInstance : class

在文件 AccessorBuilder.cs 第 49 行定义.

static Func<TInstance, TProperty> SinGooCMS.Utility.AccessorBuilder.BuildGetter< TInstance, TProperty > | ( | PropertyInfo | propertyInfo,
 |  | bool | includePrivate = false
 | ) |  |
static

根据给定属性信息获取属性的读取逻辑

参数
includePrivate | 是否排除private方法
propertyInfo | 属性信息
类型限制
TInstance : class

在文件 AccessorBuilder.cs 第 63 行定义.

static Func<TInstance> SinGooCMS.Utility.AccessorBuilder.BuildInstanceCreator< TInstance > ( )
static

根据给定对象类型获取构造函数

类型限制
TInstance : new()

在文件 AccessorBuilder.cs 第 210 行定义.

static Func<object[], TInstance> SinGooCMS.Utility.AccessorBuilder.BuildInstanceCreator< TInstance > ( ConstructorInfo constructor )
static

根据对象的构造函数信息创建对象构建逻辑

异常
IndexOutOfRangeException | 如果参数数量不正确
InvalidCastException | 如果参数类型不正确

在文件 AccessorBuilder.cs 第 246 行定义.

static Action<object, object> SinGooCMS.Utility.AccessorBuilder.BuildSetter | ( | PropertyInfo | propertyInfo,
 |  | bool | includePrivate = false
 | ) |  |
static

根据给定属性信息获取属性的写入逻辑

参数
includePrivate | 是否排除private方法
propertyInfo | 属性信息

在文件 AccessorBuilder.cs 第 79 行定义.

这是这个函数的调用关系图:

static Action<TInstance, object> SinGooCMS.Utility.AccessorBuilder.BuildSetter< TInstance > | ( | string | propertyName,
 |  | bool | includePrivate = false
 | ) |  |
static

根据给定属性名称获取属性的写入逻辑

参数
includePrivate | 是否排除private方法
propertyName | 属性名称
类型限制
TInstance : class

在文件 AccessorBuilder.cs 第 138 行定义.

static Action<TInstance, object> SinGooCMS.Utility.AccessorBuilder.BuildSetter< TInstance > | ( | PropertyInfo | propertyInfo,
 |  | bool | includePrivate = false
 | ) |  |
static

根据给定属性信息获取属性的写入逻辑

参数
includePrivate | 是否排除private方法
propertyInfo | 属性信息
类型限制
TInstance : class

在文件 AccessorBuilder.cs 第 153 行定义.

static Action<TInstance, TProperty> SinGooCMS.Utility.AccessorBuilder.BuildSetter< TInstance, TProperty > | ( | string | propertyName,
 |  | bool | includePrivate = false
 | ) |  |
static

根据给定的属性名称采获取属性的写入逻辑

参数
includePrivate | 是否排除private方法
propertyName | 属性名称
类型限制
TInstance : class

在文件 AccessorBuilder.cs 第 19 行定义.

static Action<TInstance, TProperty> SinGooCMS.Utility.AccessorBuilder.BuildSetter< TInstance, TProperty > | ( | PropertyInfo | propertyInfo,
 |  | bool | includePrivate = false
 | ) |  |
static

根据给定属性信息获取属性的写入逻辑

参数
includePrivate | 是否排除private方法
propertyInfo | 属性信息
类型限制
TInstance : class

在文件 AccessorBuilder.cs 第 33 行定义.

该类的文档由以下文件生成:
  • SinGooCMS.Utility/Accessors/AccessorBuilder.cs


SinGooCMS.Utility: SinGooCMS.Utility.AdoUtils类 参考

  • SinGooCMS
  • Utility
  • AdoUtils
静态 Public 成员函数 | 所有成员列表
SinGooCMS.Utility.AdoUtils类 参考

这里只提供SqlServer的简单操作，具体可参考SinGooCMS.Ado 更多...

静态 Public 成员函数

static bool | IsConnected (string connStr)
是否连接 更多...
static SqlParameter[] | ToSqlParams< T > (this T model, Dictionary< string,(string SqlParamName, bool IsOutput)> dictParamKeys)
从模型中快速产生参数 更多...

详细描述

这里只提供SqlServer的简单操作，具体可参考SinGooCMS.Ado

在文件 AdoUtils.cs 第 18 行定义.

成员函数说明

static bool SinGooCMS.Utility.AdoUtils.IsConnected ( string connStr )
static

是否连接

参数
connStr
返回

在文件 AdoUtils.cs 第 25 行定义.

static SqlParameter [] SinGooCMS.Utility.AdoUtils.ToSqlParams< T > | ( | this T | model,
 |  | Dictionary< string,(string SqlParamName, bool IsOutput)> | dictParamKeys
 | ) |  |
static

从模型中快速产生参数

模板参数
T 泛型
参数
model | 实例
dictParamKeys | 键值对，键=model模型的名称,值(值1=存储过程等的参数名称,值2=是否输出参数)
返回
类型限制
T : class
T : new()

在文件 AdoUtils.cs 第 41 行定义.

该类的文档由以下文件生成:
  • SinGooCMS.Utility/Data/AdoUtils.cs


SinGooCMS.Utility: SinGooCMS.Utility.Base64FileUtils类 参考

  • SinGooCMS
  • Utility
  • Base64FileUtils
静态 Public 成员函数 | 所有成员列表
SinGooCMS.Utility.Base64FileUtils类 参考

base64字符串和文件互转 更多...

静态 Public 成员函数

static string | ReadFileToString (string filePath, bool isJsFormat=false)
文件转base64 更多...
static string | ReadFileToString (FileStream fileStream)
文件流转为base64字符串 更多...
static bool | SaveStringToFile (string base64String, string fileFullPath)
Base64字符串转文件并保存 更多...
static async Task< bool > | SaveStringToFileAsync (string base64String, string fileFullPath)
Base64字符串转文件并保存 更多...
static bool | IsBase64Formatted (string input)
是否base64格式 更多...

详细描述

base64字符串和文件互转

在文件 Base64FileUtils.cs 第 12 行定义.

成员函数说明

static bool SinGooCMS.Utility.Base64FileUtils.IsBase64Formatted ( string input )
static

是否base64格式

参数
input
返回

在文件 Base64FileUtils.cs 第 147 行定义.

static string SinGooCMS.Utility.Base64FileUtils.ReadFileToString | ( | string | filePath,
 |  | bool | isJsFormat = false
 | ) |  |
static

文件转base64

参数
filePath | 文件绝对路径
isJsFormat | 是否js格式，js格式有前缀
返回

在文件 Base64FileUtils.cs 第 20 行定义.

static string SinGooCMS.Utility.Base64FileUtils.ReadFileToString ( FileStream fileStream )
static

文件流转为base64字符串

参数
fileStream
返回

在文件 Base64FileUtils.cs 第 42 行定义.

static bool SinGooCMS.Utility.Base64FileUtils.SaveStringToFile | ( | string | base64String,
 |  | string | fileFullPath
 | ) |  |
static

Base64字符串转文件并保存

参数
base64String | base64字符串
fileFullPath | 保存的文件路径（全路径，包括文件名）
返回
是否转换并保存成功

在文件 Base64FileUtils.cs 第 72 行定义.

static async Task<bool> SinGooCMS.Utility.Base64FileUtils.SaveStringToFileAsync | ( | string | base64String,
 |  | string | fileFullPath
 | ) |  |
static

Base64字符串转文件并保存

参数
base64String | base64字符串
fileFullPath | 保存的文件路径（全路径，包括文件名）
返回
是否转换并保存成功

在文件 Base64FileUtils.cs 第 110 行定义.

该类的文档由以下文件生成:
  • SinGooCMS.Utility/IO/Base64FileUtils.cs


SinGooCMS.Utility: SinGooCMS.Utility.CacheUtils类 参考

  • SinGooCMS
  • Utility
  • CacheUtils
Public 成员函数 | 静态 Private 成员函数 | 静态 Private 属性 | 所有成员列表
SinGooCMS.Utility.CacheUtils类 参考

缓存管理 更多...

SinGooCMS.Utility.CacheUtils 的协作图:
[图例]

Public 成员函数

T | Get< T > (string key)
读取缓存对象 更多...
bool | ContainKey (string key)
是否包含key 更多...
IList< string > | GetAllKeys ()
读取所有缓存键 更多...
void | Insert< T > (string key, T t, int expireSeconds, CacheItemPriority priority=CacheItemPriority.Normal, bool isSliding=true)
加入到缓存 更多...
void | Del (string key)
删除缓存 更多...
void | DelByPattern (string pattern)
删除匹配的缓存 更多...
int | ClearAll ()
清除所有缓存 更多...

静态 Private 成员函数

static CacheUtils ()

静态 Private 属性

static System.Web.Caching.Cache cache

详细描述

缓存管理

在文件 CacheUtils.cs 第 20 行定义.

构造及析构函数说明

static SinGooCMS.Utility.CacheUtils.CacheUtils ( )
staticprivate

在文件 CacheUtils.cs 第 30 行定义.

成员函数说明

int SinGooCMS.Utility.CacheUtils.ClearAll ( )

清除所有缓存

返回

在文件 CacheUtils.cs 第 155 行定义.

bool SinGooCMS.Utility.CacheUtils.ContainKey ( string key )

是否包含key

参数
key
返回
void SinGooCMS.Utility.CacheUtils.Del ( string key )

删除缓存

参数
key
void SinGooCMS.Utility.CacheUtils.DelByPattern ( string pattern )

删除匹配的缓存

参数
pattern

在文件 CacheUtils.cs 第 136 行定义.

T SinGooCMS.Utility.CacheUtils.Get< T > ( string key )

读取缓存对象

模板参数
T
参数
key
返回

在文件 CacheUtils.cs 第 44 行定义.

IList<string> SinGooCMS.Utility.CacheUtils.GetAllKeys ( )

读取所有缓存键

返回

在文件 CacheUtils.cs 第 65 行定义.

void SinGooCMS.Utility.CacheUtils.Insert< T > | ( | string | key,
 |  | T | t,
 |  | int | expireSeconds,
 |  | CacheItemPriority | priority = CacheItemPriority.Normal,
 |  | bool | isSliding = true
 | ) |  |

加入到缓存

模板参数
T 泛型
参数
key | 键
t | 对象
expireSeconds | 超时时间（秒）
priority | 优化级
isSliding | 是否相对过期

在文件 CacheUtils.cs 第 101 行定义.

类成员变量说明

System.Web.Caching.Cache SinGooCMS.Utility.CacheUtils.cache
staticprivate

在文件 CacheUtils.cs 第 29 行定义.

该类的文档由以下文件生成:
  • SinGooCMS.Utility/Web/CacheUtils.cs


SinGooCMS.Utility: SinGooCMS.Utility.CaptchaUtils类 参考

  • SinGooCMS
  • Utility
  • CaptchaUtils
静态 Public 成员函数 | 属性 | 静态 Private 成员函数 | 所有成员列表
SinGooCMS.Utility.CaptchaUtils类 参考

图形验证码工具 更多...

静态 Public 成员函数

static CaptchaUtils Create ()
生成验证码 更多...

属性

string | CheckCodeString [get, set]
验证码 更多...
byte[] | CheckCodeImg [get, set]
验证码图片 更多...

静态 Private 成员函数

static string | GenerateCheckCode ()
static byte[] | CreateCheckCodeImage (string codeString)

详细描述

图形验证码工具

在文件 CaptchaUtils.cs 第 11 行定义.

成员函数说明

static CaptchaUtils SinGooCMS.Utility.CaptchaUtils.Create ( )
static

生成验证码

返回

在文件 CaptchaUtils.cs 第 30 行定义.

static byte [] SinGooCMS.Utility.CaptchaUtils.CreateCheckCodeImage ( string codeString )
staticprivate

在文件 CaptchaUtils.cs 第 57 行定义.

static string SinGooCMS.Utility.CaptchaUtils.GenerateCheckCode ( )
staticprivate

在文件 CaptchaUtils.cs 第 42 行定义.

属性说明

byte [] SinGooCMS.Utility.CaptchaUtils.CheckCodeImg
getset

验证码图片

在文件 CaptchaUtils.cs 第 22 行定义.

string SinGooCMS.Utility.CaptchaUtils.CheckCodeString
getset

验证码

在文件 CaptchaUtils.cs 第 18 行定义.

该类的文档由以下文件生成:
  • SinGooCMS.Utility/IO/CaptchaUtils.cs


SinGooCMS.Utility: SinGooCMS.Utility.CellPhonePrefix类 参考

  • SinGooCMS
  • Utility
  • CellPhonePrefix
静态 Public 属性 | 属性 | 静态 Private 属性 | 所有成员列表
SinGooCMS.Utility.CellPhonePrefix类 参考

手机号码前缀 更多...

静态 Public 属性

static List<(string prefix, string area)> Dictionary
区号和地区名称对照表 更多...

属性

static List< string > Prefix [get]
前缀集合 更多...

静态 Private 属性

static List< string > _prefix = null

详细描述

手机号码前缀

在文件 CellPhonePrefix.cs 第 11 行定义.

类成员变量说明

List<string> SinGooCMS.Utility.CellPhonePrefix._prefix = null
staticprivate

在文件 CellPhonePrefix.cs 第 243 行定义.

List<(string prefix, string area)> SinGooCMS.Utility.CellPhonePrefix.Dictionary
static

区号和地区名称对照表

在文件 CellPhonePrefix.cs 第 16 行定义.

属性说明

List<string> SinGooCMS.Utility.CellPhonePrefix.Prefix
staticget

前缀集合

在文件 CellPhonePrefix.cs 第 249 行定义.

该类的文档由以下文件生成:
  • SinGooCMS.Utility/Text/CellPhonePrefix.cs


SinGooCMS.Utility: SinGooCMS.Utility.ChinaDate类 参考

  • SinGooCMS
  • Utility
  • ChinaDate
静态 Public 成员函数 | Private 成员函数 | 静态 Private 成员函数 | 静态 Private 属性 | 所有成员列表
SinGooCMS.Utility.ChinaDate类 参考

公历转农历 更多...

静态 Public 成员函数

static int | GetDaysByMonth (int y, int m)
传回公历y年m月的总天数 更多...
static DateTime | GetMondayDateByDate (DateTime dt)
根据日期值获得周一的日期 更多...
static CNDate | GetChinaDate (DateTime?dtPara=null)
获取农历 更多...

Private 成员函数

long[] Lunar (int y, int m)
传出农历.year0 .month1 .day2 .yearCyl3 .monCyl4 .dayCyl5 .isLeap6 更多...

静态 Private 成员函数

static int | lYearDays (int y)
传回农历y年的总天数 更多...
static int | leapDays (int y)
传回农历y年闰月的天数 更多...
static int | leapMonth (int y)
传回农历y年闰哪个月 1-12 , 没闰传回 0 更多...
static int | monthDays (int y, int m)
传回农历y年m月的总天数 更多...
static String | AnimalsYear (int y)
传回农历y年的生肖 更多...
static String | cyclicalm (int num)
传入月日的offset 传回干支,0=甲子 更多...
static String | cyclical (int y)
传入offset 传回干支, 0=甲子 更多...
static long[] | calElement (int y, int m, int d)
传出y年m月d日对应的农历.year0 .month1 .day2 .yearCyl3 .monCyl4 .dayCyl5 .isLeap6 更多...
static String | getChinaDate (int day)
static DateTime | sTerm (int y, int n)
static string | FormatDate (int m, int d)

静态 Private 属性

static long[] | lunarInfo
static int[] | year20 = new int[] { 1, 4, 1, 2, 1, 2, 1, 1, 2, 1, 2, 1 }
static int[] | year19 = new int[] { 0, 3, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0 }
static int[] | year2000 = new int[] { 0, 3, 1, 2, 1, 2, 1, 1, 2, 1, 2, 1 }
static String[] | nStr1 = new String[] { "", "正", "二", "三", "四", "五", "六", "七", "八", "九", "十", "十一", "十二" }
static String[] | Gan = new String[] { "甲", "乙", "丙", "丁", "戊", "己", "庚", "辛", "壬", "癸" }
static String[] | Zhi = new String[] { "子", "丑", "寅", "卯", "辰", "巳", "午", "未", "申", "酉", "戌", "亥" }
static String[] | Animals = new String[] { "鼠", "牛", "虎", "兔", "龙", "蛇", "马", "羊", "猴", "鸡", "狗", "猪" }
static String[] | solarTerm = new String[] { "小寒", "大寒", "立春", "雨水", "惊蛰", "春分", "清明", "谷雨", "立夏", "小满", "芒种", "夏至", "小暑", "大暑", "立秋", "处暑", "白露", "秋分", "寒露", "霜降", "立冬", "小雪", "大雪", "冬至" }
static int[] | sTermInfo = { 0, 21208, 42467, 63836, 85337, 107014, 128867, 150921, 173149, 195551, 218072, 240693, 263343, 285989, 308563, 331033, 353350, 375494, 397447, 419210, 440795, 462224, 483532, 504758 }
static String[] | lFtv = new String[] { "0101农历春节", "0202 龙抬头节", "0115 元宵节", "0505 端午节", "0707 七夕情人节", "0815 中秋节", "0909 重阳节", "1208 腊八节", "1114 李君先生生日", "1224 小年", "0100除夕" }
static String[] | sFtv

详细描述

公历转农历

在文件 ChineseDateUtils.cs 第 66 行定义.

成员函数说明

static String SinGooCMS.Utility.ChinaDate.AnimalsYear ( int y )
staticprivate

传回农历y年的生肖

在文件 ChineseDateUtils.cs 第 243 行定义.

static long [] SinGooCMS.Utility.ChinaDate.calElement | ( | int | y,
 |  | int | m,
 |  | int | d
 | ) |  |
staticprivate

传出y年m月d日对应的农历.year0 .month1 .day2 .yearCyl3 .monCyl4 .dayCyl5 .isLeap6

在文件 ChineseDateUtils.cs 第 351 行定义.

static String SinGooCMS.Utility.ChinaDate.cyclical ( int y )
staticprivate

传入offset 传回干支, 0=甲子

在文件 ChineseDateUtils.cs 第 259 行定义.

static String SinGooCMS.Utility.ChinaDate.cyclicalm ( int num )
staticprivate

传入月日的offset 传回干支,0=甲子

在文件 ChineseDateUtils.cs 第 251 行定义.

static string SinGooCMS.Utility.ChinaDate.FormatDate | ( | int | m,
 |  | int | d
 | ) |  |
staticprivate

在文件 ChineseDateUtils.cs 第 491 行定义.

static String SinGooCMS.Utility.ChinaDate.getChinaDate ( int day )
staticprivate

在文件 ChineseDateUtils.cs 第 429 行定义.

static CNDate SinGooCMS.Utility.ChinaDate.GetChinaDate ( DateTime? dtPara = null )
static

获取农历

在文件 ChineseDateUtils.cs 第 531 行定义.

static int SinGooCMS.Utility.ChinaDate.GetDaysByMonth | ( | int | y,
 |  | int | m
 | ) |  |
static

传回公历y年m月的总天数

在文件 ChineseDateUtils.cs 第 501 行定义.

static DateTime SinGooCMS.Utility.ChinaDate.GetMondayDateByDate ( DateTime dt )
static

根据日期值获得周一的日期

参数
dt 输入日期
返回
周一的日期

在文件 ChineseDateUtils.cs 第 512 行定义.

static int SinGooCMS.Utility.ChinaDate.leapDays ( int y )
staticprivate

传回农历y年闰月的天数

在文件 ChineseDateUtils.cs 第 208 行定义.

static int SinGooCMS.Utility.ChinaDate.leapMonth ( int y )
staticprivate

传回农历y年闰哪个月 1-12 , 没闰传回 0

在文件 ChineseDateUtils.cs 第 224 行定义.

long [] SinGooCMS.Utility.ChinaDate.Lunar | ( | int | y,
 |  | int | m
 | ) |  |
private

传出农历.year0 .month1 .day2 .yearCyl3 .monCyl4 .dayCyl5 .isLeap6

在文件 ChineseDateUtils.cs 第 268 行定义.

static int SinGooCMS.Utility.ChinaDate.lYearDays ( int y )
staticprivate

传回农历y年的总天数

在文件 ChineseDateUtils.cs 第 194 行定义.

static int SinGooCMS.Utility.ChinaDate.monthDays | ( | int | y,
 |  | int | m
 | ) |  |
staticprivate

传回农历y年m月的总天数

在文件 ChineseDateUtils.cs 第 232 行定义.

static DateTime SinGooCMS.Utility.ChinaDate.sTerm | ( | int | y,
 |  | int | n
 | ) |  |
staticprivate

在文件 ChineseDateUtils.cs 第 481 行定义.

类成员变量说明

String [] SinGooCMS.Utility.ChinaDate.Animals = new String[] { "鼠", "牛", "虎", "兔", "龙", "蛇", "马", "羊", "猴", "鸡", "狗", "猪" }
staticprivate

在文件 ChineseDateUtils.cs 第 89 行定义.

String [] SinGooCMS.Utility.ChinaDate.Gan = new String[] { "甲", "乙", "丙", "丁", "戊", "己", "庚", "辛", "壬", "癸" }
staticprivate

在文件 ChineseDateUtils.cs 第 87 行定义.

String [] SinGooCMS.Utility.ChinaDate.lFtv = new String[] { "0101农历春节", "0202 龙抬头节", "0115 元宵节", "0505 端午节", "0707 七夕情人节", "0815 中秋节", "0909 重阳节", "1208 腊八节", "1114 李君先生生日", "1224 小年", "0100除夕" }
staticprivate

在文件 ChineseDateUtils.cs 第 92 行定义.

long [] SinGooCMS.Utility.ChinaDate.lunarInfo
staticprivate
初始值:
= new long[] { 0x04bd8, 0x04ae0, 0x0a570, 0x054d5, 0x0d260, 0x0d950, 0x16554,
0x056a0, 0x09ad0, 0x055d2, 0x04ae0, 0x0a5b6, 0x0a4d0, 0x0d250, 0x1d255, 0x0b540, 0x0d6a0, 0x0ada2, 0x095b0,
0x14977, 0x04970, 0x0a4b0, 0x0b4b5, 0x06a50, 0x06d40, 0x1ab54, 0x02b60, 0x09570, 0x052f2, 0x04970, 0x06566,
0x0d4a0, 0x0ea50, 0x06e95, 0x05ad0, 0x02b60, 0x186e3, 0x092e0, 0x1c8d7, 0x0c950, 0x0d4a0, 0x1d8a6, 0x0b550,
0x056a0, 0x1a5b4, 0x025d0, 0x092d0, 0x0d2b2, 0x0a950, 0x0b557, 0x06ca0, 0x0b550, 0x15355, 0x04da0, 0x0a5d0,
0x14573, 0x052d0, 0x0a9a8, 0x0e950, 0x06aa0, 0x0aea6, 0x0ab50, 0x04b60, 0x0aae4, 0x0a570, 0x05260, 0x0f263,
0x0d950, 0x05b57, 0x056a0, 0x096d0, 0x04dd5, 0x04ad0, 0x0a4d0, 0x0d4d4, 0x0d250, 0x0d558, 0x0b540, 0x0b5a0,
0x195a6, 0x095b0, 0x049b0, 0x0a974, 0x0a4b0, 0x0b27a, 0x06a50, 0x06d40, 0x0af46, 0x0ab60, 0x09570, 0x04af5,
0x04970, 0x064b0, 0x074a3, 0x0ea50, 0x06b58, 0x055c0, 0x0ab60, 0x096d5, 0x092e0, 0x0c960, 0x0d954, 0x0d4a0,
0x0da50, 0x07552, 0x056a0, 0x0abb7, 0x025d0, 0x092d0, 0x0cab5, 0x0a950, 0x0b4a0, 0x0baa4, 0x0ad50, 0x055d9,
0x04ba0, 0x0a5b0, 0x15176, 0x052b0, 0x0a930, 0x07954, 0x06aa0, 0x0ad50, 0x05b52, 0x04b60, 0x0a6e6, 0x0a4e0,
0x0d260, 0x0ea65, 0x0d530, 0x05aa0, 0x076a3, 0x096d0, 0x04bd7, 0x04ad0, 0x0a4d0, 0x1d0b6, 0x0d250, 0x0d520,
0x0dd45, 0x0b5a0, 0x056d0, 0x055b2, 0x049b0, 0x0a577, 0x0a4b0, 0x0aa50, 0x1b255, 0x06d20, 0x0ada0 }

在文件 ChineseDateUtils.cs 第 69 行定义.

String [] SinGooCMS.Utility.ChinaDate.nStr1 = new String[] { "", "正", "二", "三", "四", "五", "六", "七", "八", "九", "十", "十一", "十二" }
staticprivate

在文件 ChineseDateUtils.cs 第 86 行定义.

String [] SinGooCMS.Utility.ChinaDate.sFtv
staticprivate

在文件 ChineseDateUtils.cs 第 93 行定义.

String [] SinGooCMS.Utility.ChinaDate.solarTerm = new String[] { "小寒", "大寒", "立春", "雨水", "惊蛰", "春分", "清明", "谷雨", "立夏", "小满", "芒种", "夏至", "小暑", "大暑", "立秋", "处暑", "白露", "秋分", "寒露", "霜降", "立冬", "小雪", "大雪", "冬至" }
staticprivate

在文件 ChineseDateUtils.cs 第 90 行定义.

int [] SinGooCMS.Utility.ChinaDate.sTermInfo = { 0, 21208, 42467, 63836, 85337, 107014, 128867, 150921, 173149, 195551, 218072, 240693, 263343, 285989, 308563, 331033, 353350, 375494, 397447, 419210, 440795, 462224, 483532, 504758 }
staticprivate

在文件 ChineseDateUtils.cs 第 91 行定义.

int [] SinGooCMS.Utility.ChinaDate.year19 = new int[] { 0, 3, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0 }
staticprivate

在文件 ChineseDateUtils.cs 第 84 行定义.

int [] SinGooCMS.Utility.ChinaDate.year20 = new int[] { 1, 4, 1, 2, 1, 2, 1, 1, 2, 1, 2, 1 }
staticprivate

在文件 ChineseDateUtils.cs 第 83 行定义.

int [] SinGooCMS.Utility.ChinaDate.year2000 = new int[] { 0, 3, 1, 2, 1, 2, 1, 1, 2, 1, 2, 1 }
staticprivate

在文件 ChineseDateUtils.cs 第 85 行定义.

String [] SinGooCMS.Utility.ChinaDate.Zhi = new String[] { "子", "丑", "寅", "卯", "辰", "巳", "午", "未", "申", "酉", "戌", "亥" }
staticprivate

在文件 ChineseDateUtils.cs 第 88 行定义.

该类的文档由以下文件生成:
  • SinGooCMS.Utility/Date/ChineseDateUtils.cs


SinGooCMS.Utility: SinGooCMS.Utility.ChineseCalendar类 参考

  • SinGooCMS
  • Utility
  • ChineseCalendar
类 | Public 成员函数 | 属性 | Private 成员函数 | Private 属性 | 静态 Private 属性 | 所有成员列表
SinGooCMS.Utility.ChineseCalendar类 参考

中国日历 更多...

SinGooCMS.Utility.ChineseCalendar 的协作图:
[图例]

类

struct | LunarHolidayStruct
农历 更多...
struct | SolarHolidayStruct
阳历 更多...
struct | WeekHolidayStruct

Public 成员函数

ChineseCalendar (DateTime?dtParam=null)
用一个标准的公历日期来初使化 更多...
ChineseCalendar (int cy, int cm, int cd, bool leapMonthFlag)
用农历的日期来初使化 更多...

属性

string | newCalendarHoliday [get]
计算中国农历节日 更多...
string | WeekDayHoliday [get]
按某月第几周第几日计算的节日 更多...
string | DateHoliday [get]
按公历日计算的节日 更多...
DateTime | Date [get, set]
取对应的公历日期 更多...
DayOfWeek | WeekDay [get]
取星期几 更多...
string | WeekDayStr [get]
周几的字符 更多...
string | DateString [get]
公历日期中文表示法 如一九九七年七月一日 更多...
bool | IsLeapYear [get]
当前是否公历闰年 更多...
string | ChineseConstellation [get]
28星宿计算 更多...
string | ChineseHour [get]
时辰 更多...
bool | IsChineseLeapMonth [get]
是否闰月 更多...
bool | IsChineseLeapYear [get]
当年是否有闰月 更多...
int | ChineseDay [get]
农历日 更多...
string | ChineseDayString [get]
农历日中文表示 更多...
int | ChineseMonth [get]
农历的月份 更多...
string | ChineseMonthString [get]
农历月份字符串 更多...
int | ChineseYear [get]
取农历年份 更多...
string | ChineseYearString [get]
取农历年字符串如，一九九七年 更多...
string | ChineseDateString [get]
取农历日期表示法：农历一九九七年正月初五 更多...
string | ChineseTwentyFourDay [get]
定气法计算二十四节气,二十四节气是按地球公转来计算的，并非是阴历计算的 更多...
string | ChineseTwentyFourPrevDay [get]
当前日期前一个最近节气 更多...
string | ChineseTwentyFourNextDay [get]
当前日期后一个最近节气 更多...
string | Constellation [get]
计算指定日期的星座序号 更多...
int | Animal [get]
计算属相的索引，注意虽然属相是以农历年来区别的，但是目前在实际使用中是按公历来计算的 鼠年为1,其它类推 更多...
string | AnimalString [get]
取属相字符串 更多...
string | GanZhiYearString [get]
取农历年的干支表示法如 乙丑年 更多...
string | GanZhiMonthString [get]
取干支的月表示字符串，注意农历的闰月不记干支 更多...
string | GanZhiDayString [get]
取干支日表示法 更多...
string | GanZhiDateString [get]
取当前日期的干支表示法如 甲子年乙丑月丙庚日 更多...

Private 成员函数

int | GetChineseMonthDays (int year, int month)
//传回农历y年m月的总天数 更多...
int | GetChineseLeapMonth (int year)
传回农历 y年闰哪个月 1-12 , 没闰传回 0 更多...
int | GetChineseLeapMonthDays (int year)
传回农历y年闰月的天数 更多...
int | GetChineseYearDays (int year)
取农历年一年的天数 更多...
string | GetChineseHour (DateTime dt)
获得当前时间的时辰 更多...
void | CheckDateLimit (DateTime dt)
检查公历日期是否符合要求 更多...
void | CheckChineseDateLimit (int year, int month, int day, bool leapMonth)
检查农历日期是否合理 更多...
string | ConvertNumToChineseNum (char n)
将0-9转成汉字形式 更多...
bool | BitTest32 (int num, int bitpostion)
测试某位是否为真 更多...
int | ConvertDayOfWeek (DayOfWeek dayOfWeek)
将星期几转成数字表示 更多...
bool | CompareWeekDayHoliday (DateTime date, int month, int week, int day)
比较当天是不是指定的第周几 更多...

Private 属性

DateTime | _date
DateTime | _datetime
int | _cYear
int | _cMonth
int | _cDay
bool | _cIsLeapMonth
bool | _cIsLeapYear
const int | MinYear = 1900
const int | MaxYear = 2050
const int | GanZhiStartYear = 1864
const string | HZNum = "零一二三四五六七八九"
const int | AnimalStartYear = 1900

静态 Private 属性

static DateTime | MinDay = new DateTime(1900, 1, 30)
static DateTime | MaxDay = new DateTime(2049, 12, 31)
static DateTime | GanZhiStartDay = new DateTime(1899, 12, 22)
static DateTime | ChineseConstellationReferDay = new DateTime(2007, 9, 13)
static int[] | LunarDateArray
来源于网上的农历数据 更多...
static string[] | _constellationName
static string[] | _lunarHolidayName
static string[] | _chineseConstellationName
static string[] | SolarTerm = new string[] { "小寒", "大寒", "立春", "雨水", "惊蛰", "春分", "清明", "谷雨", "立夏", "小满", "芒种", "夏至", "小暑", "大暑", "立秋", "处暑", "白露", "秋分", "寒露", "霜降", "立冬", "小雪", "大雪", "冬至" }
static int[] | sTermInfo = new int[] { 0, 21208, 42467, 63836, 85337, 107014, 128867, 150921, 173149, 195551, 218072, 240693, 263343, 285989, 308563, 331033, 353350, 375494, 397447, 419210, 440795, 462224, 483532, 504758 }
static string | ganStr = "甲乙丙丁戊己庚辛壬癸"
static string | zhiStr = "子丑寅卯辰巳午未申酉戌亥"
static string | animalStr = "鼠牛虎兔龙蛇马羊猴鸡狗猪"
static string | nStr1 = "日一二三四五六七八九"
static string | nStr2 = "初十廿卅"
static string[] | _monthString
static SolarHolidayStruct[] | sHolidayInfo
static LunarHolidayStruct[] | lHolidayInfo
static WeekHolidayStruct[] | wHolidayInfo

详细描述

中国日历

在文件 ChineseDateUtils.cs 第 609 行定义.

构造及析构函数说明

SinGooCMS.Utility.ChineseCalendar.ChineseCalendar ( DateTime? dtParam = null )

用一个标准的公历日期来初使化

在文件 ChineseDateUtils.cs 第 861 行定义.

SinGooCMS.Utility.ChineseCalendar.ChineseCalendar | ( | int | cy,
 |  | int | cm,
 |  | int | cd,
 |  | bool | leapMonthFlag
 | ) |  |

用农历的日期来初使化

参数
cy | 农历年
cm | 农历月
cd | 农历日
leapMonthFlag | 闰月标志

在文件 ChineseDateUtils.cs 第 943 行定义.

成员函数说明

bool SinGooCMS.Utility.ChineseCalendar.BitTest32 | ( | int | num,
 |  | int | bitpostion
 | ) |  |
private

测试某位是否为真

在文件 ChineseDateUtils.cs 第 1237 行定义.

void SinGooCMS.Utility.ChineseCalendar.CheckChineseDateLimit | ( | int | year,
 |  | int | month,
 |  | int | day,
 |  | bool | leapMonth
 | ) |  |
private

检查农历日期是否合理

在文件 ChineseDateUtils.cs 第 1176 行定义.

void SinGooCMS.Utility.ChineseCalendar.CheckDateLimit ( DateTime dt )
private

检查公历日期是否符合要求

在文件 ChineseDateUtils.cs 第 1163 行定义.

bool SinGooCMS.Utility.ChineseCalendar.CompareWeekDayHoliday | ( | DateTime | date,
 |  | int | month,
 |  | int | week,
 |  | int | day
 | ) |  |
private

比较当天是不是指定的第周几

在文件 ChineseDateUtils.cs 第 1287 行定义.

int SinGooCMS.Utility.ChineseCalendar.ConvertDayOfWeek ( DayOfWeek dayOfWeek )
private

将星期几转成数字表示

在文件 ChineseDateUtils.cs 第 1259 行定义.

string SinGooCMS.Utility.ChineseCalendar.ConvertNumToChineseNum ( char n )
private

将0-9转成汉字形式

在文件 ChineseDateUtils.cs 第 1202 行定义.

string SinGooCMS.Utility.ChineseCalendar.GetChineseHour ( DateTime dt )
private

获得当前时间的时辰

在文件 ChineseDateUtils.cs 第 1129 行定义.

int SinGooCMS.Utility.ChineseCalendar.GetChineseLeapMonth ( int year )
private

传回农历 y年闰哪个月 1-12 , 没闰传回 0

在文件 ChineseDateUtils.cs 第 1069 行定义.

int SinGooCMS.Utility.ChineseCalendar.GetChineseLeapMonthDays ( int year )
private

传回农历y年闰月的天数

在文件 ChineseDateUtils.cs 第 1079 行定义.

int SinGooCMS.Utility.ChineseCalendar.GetChineseMonthDays | ( | int | year,
 |  | int | month
 | ) |  |
private

//传回农历y年m月的总天数

在文件 ChineseDateUtils.cs 第 1052 行定义.

int SinGooCMS.Utility.ChineseCalendar.GetChineseYearDays ( int year )
private

取农历年一年的天数

在文件 ChineseDateUtils.cs 第 1103 行定义.

类成员变量说明

int SinGooCMS.Utility.ChineseCalendar._cDay
private

在文件 ChineseDateUtils.cs 第 671 行定义.

string [] SinGooCMS.Utility.ChineseCalendar._chineseConstellationName
staticprivate
初始值:
=
{
"角木蛟","亢金龙","女土蝠","房日兔","心月狐","尾火虎","箕水豹",
"斗木獬","牛金牛","氐土貉","虚日鼠","危月燕","室火猪","壁水獝",
"奎木狼","娄金狗","胃土彘","昴日鸡","毕月乌","觜火猴","参水猿",
"井木犴","鬼金羊","柳土獐","星日马","张月鹿","翼火蛇","轸水蚓"
}

在文件 ChineseDateUtils.cs 第 743 行定义.

bool SinGooCMS.Utility.ChineseCalendar._cIsLeapMonth
private

在文件 ChineseDateUtils.cs 第 672 行定义.

bool SinGooCMS.Utility.ChineseCalendar._cIsLeapYear
private

在文件 ChineseDateUtils.cs 第 673 行定义.

int SinGooCMS.Utility.ChineseCalendar._cMonth
private

在文件 ChineseDateUtils.cs 第 670 行定义.

string [] SinGooCMS.Utility.ChineseCalendar._constellationName
staticprivate
初始值:
=
{
"白羊座", "金牛座", "双子座",
"巨蟹座", "狮子座", "处女座",
"天秤座", "天蝎座", "射手座",
"摩羯座", "水瓶座", "双鱼座"
}

在文件 ChineseDateUtils.cs 第 721 行定义.

int SinGooCMS.Utility.ChineseCalendar._cYear
private

在文件 ChineseDateUtils.cs 第 669 行定义.

DateTime SinGooCMS.Utility.ChineseCalendar._date
private

在文件 ChineseDateUtils.cs 第 667 行定义.

DateTime SinGooCMS.Utility.ChineseCalendar._datetime
private

在文件 ChineseDateUtils.cs 第 668 行定义.

string [] SinGooCMS.Utility.ChineseCalendar._lunarHolidayName
staticprivate
初始值:
=
{
"小寒", "大寒", "立春", "雨水",
"惊蛰", "春分", "清明", "谷雨",
"立夏", "小满", "芒种", "夏至",
"小暑", "大暑", "立秋", "处暑",
"白露", "秋分", "寒露", "霜降",
"立冬", "小雪", "大雪", "冬至"
}

在文件 ChineseDateUtils.cs 第 731 行定义.

string [] SinGooCMS.Utility.ChineseCalendar._monthString
staticprivate
初始值:
=
{
"出错","正月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","腊月"
}

在文件 ChineseDateUtils.cs 第 764 行定义.

const int SinGooCMS.Utility.ChineseCalendar.AnimalStartYear = 1900
private

在文件 ChineseDateUtils.cs 第 685 行定义.

string SinGooCMS.Utility.ChineseCalendar.animalStr = "鼠牛虎兔龙蛇马羊猴鸡狗猪"
staticprivate

在文件 ChineseDateUtils.cs 第 761 行定义.

DateTime SinGooCMS.Utility.ChineseCalendar.ChineseConstellationReferDay = new DateTime(2007, 9, 13)
staticprivate

在文件 ChineseDateUtils.cs 第 686 行定义.

string SinGooCMS.Utility.ChineseCalendar.ganStr = "甲乙丙丁戊己庚辛壬癸"
staticprivate

在文件 ChineseDateUtils.cs 第 759 行定义.

DateTime SinGooCMS.Utility.ChineseCalendar.GanZhiStartDay = new DateTime(1899, 12, 22)
staticprivate

在文件 ChineseDateUtils.cs 第 683 行定义.

const int SinGooCMS.Utility.ChineseCalendar.GanZhiStartYear = 1864
private

在文件 ChineseDateUtils.cs 第 682 行定义.

const string SinGooCMS.Utility.ChineseCalendar.HZNum = "零一二三四五六七八九"
private

在文件 ChineseDateUtils.cs 第 684 行定义.

LunarHolidayStruct [] SinGooCMS.Utility.ChineseCalendar.lHolidayInfo
staticprivate
初始值:
= new LunarHolidayStruct[]{
new LunarHolidayStruct(1, 1, 1, "春节"),
new LunarHolidayStruct(1, 15, 0, "元宵节"),
new LunarHolidayStruct(5, 5, 0, "端午节"),
new LunarHolidayStruct(7, 7, 0, "七夕情人节"),
new LunarHolidayStruct(7, 15, 0, "中元节 盂兰盆节"),
new LunarHolidayStruct(8, 15, 0, "中秋节"),
new LunarHolidayStruct(9, 9, 0, "重阳节"),
new LunarHolidayStruct(12, 8, 0, "腊八节"),
new LunarHolidayStruct(12, 23, 0, "北方小年(扫房)"),
new LunarHolidayStruct(12, 24, 0, "南方小年(掸尘)"),
}

在文件 ChineseDateUtils.cs 第 827 行定义.

int [] SinGooCMS.Utility.ChineseCalendar.LunarDateArray
staticprivate
初始值:
= new int[]{
0x04BD8,0x04AE0,0x0A570,0x054D5,0x0D260,0x0D950,0x16554,0x056A0,0x09AD0,0x055D2,
0x04AE0,0x0A5B6,0x0A4D0,0x0D250,0x1D255,0x0B540,0x0D6A0,0x0ADA2,0x095B0,0x14977,
0x04970,0x0A4B0,0x0B4B5,0x06A50,0x06D40,0x1AB54,0x02B60,0x09570,0x052F2,0x04970,
0x06566,0x0D4A0,0x0EA50,0x06E95,0x05AD0,0x02B60,0x186E3,0x092E0,0x1C8D7,0x0C950,
0x0D4A0,0x1D8A6,0x0B550,0x056A0,0x1A5B4,0x025D0,0x092D0,0x0D2B2,0x0A950,0x0B557,
0x06CA0,0x0B550,0x15355,0x04DA0,0x0A5B0,0x14573,0x052B0,0x0A9A8,0x0E950,0x06AA0,
0x0AEA6,0x0AB50,0x04B60,0x0AAE4,0x0A570,0x05260,0x0F263,0x0D950,0x05B57,0x056A0,
0x096D0,0x04DD5,0x04AD0,0x0A4D0,0x0D4D4,0x0D250,0x0D558,0x0B540,0x0B6A0,0x195A6,
0x095B0,0x049B0,0x0A974,0x0A4B0,0x0B27A,0x06A50,0x06D40,0x0AF46,0x0AB60,0x09570,
0x04AF5,0x04970,0x064B0,0x074A3,0x0EA50,0x06B58,0x055C0,0x0AB60,0x096D5,0x092E0,
0x0C960,0x0D954,0x0D4A0,0x0DA50,0x07552,0x056A0,0x0ABB7,0x025D0,0x092D0,0x0CAB5,
0x0A950,0x0B4A0,0x0BAA4,0x0AD50,0x055D9,0x04BA0,0x0A5B0,0x15176,0x052B0,0x0A930,
0x07954,0x06AA0,0x0AD50,0x05B52,0x04B60,0x0A6E6,0x0A4E0,0x0D260,0x0EA65,0x0D530,
0x05AA0,0x076A3,0x096D0,0x04BD7,0x04AD0,0x0A4D0,0x1D0B6,0x0D250,0x0D520,0x0DD45,
0x0B5A0,0x056D0,0x055B2,0x049B0,0x0A577,0x0A4B0,0x0AA50,0x1B255,0x06D20,0x0ADA0,
0x14B63
}

来源于网上的农历数据

数据结构如下，共使用17位数据 第17位：表示闰月天数，0表示29天 1表示30天 第16位-第5位（共12位）表示12个月，其中第16位表示第一月，如果该月为30天则为1，29天为0 第4位-第1位（共4位）表示闰月是哪个月，如果当年没有闰月，则置0 /remarks>

在文件 ChineseDateUtils.cs 第 699 行定义.

DateTime SinGooCMS.Utility.ChineseCalendar.MaxDay = new DateTime(2049, 12, 31)
staticprivate

在文件 ChineseDateUtils.cs 第 681 行定义.

const int SinGooCMS.Utility.ChineseCalendar.MaxYear = 2050
private

在文件 ChineseDateUtils.cs 第 679 行定义.

DateTime SinGooCMS.Utility.ChineseCalendar.MinDay = new DateTime(1900, 1, 30)
staticprivate

在文件 ChineseDateUtils.cs 第 680 行定义.

const int SinGooCMS.Utility.ChineseCalendar.MinYear = 1900
private

在文件 ChineseDateUtils.cs 第 678 行定义.

string SinGooCMS.Utility.ChineseCalendar.nStr1 = "日一二三四五六七八九"
staticprivate

在文件 ChineseDateUtils.cs 第 762 行定义.

string SinGooCMS.Utility.ChineseCalendar.nStr2 = "初十廿卅"
staticprivate

在文件 ChineseDateUtils.cs 第 763 行定义.

SolarHolidayStruct [] SinGooCMS.Utility.ChineseCalendar.sHolidayInfo
staticprivate

在文件 ChineseDateUtils.cs 第 771 行定义.

string [] SinGooCMS.Utility.ChineseCalendar.SolarTerm = new string[] { "小寒", "大寒", "立春", "雨水", "惊蛰", "春分", "清明", "谷雨", "立夏", "小满", "芒种", "夏至", "小暑", "大暑", "立秋", "处暑", "白露", "秋分", "寒露", "霜降", "立冬", "小雪", "大雪", "冬至" }
staticprivate

在文件 ChineseDateUtils.cs 第 754 行定义.

int [] SinGooCMS.Utility.ChineseCalendar.sTermInfo = new int[] { 0, 21208, 42467, 63836, 85337, 107014, 128867, 150921, 173149, 195551, 218072, 240693, 263343, 285989, 308563, 331033, 353350, 375494, 397447, 419210, 440795, 462224, 483532, 504758 }
staticprivate

在文件 ChineseDateUtils.cs 第 755 行定义.

WeekHolidayStruct [] SinGooCMS.Utility.ChineseCalendar.wHolidayInfo
staticprivate
初始值:
= new WeekHolidayStruct[]{
new WeekHolidayStruct(5, 2, 1, "母亲节"),
new WeekHolidayStruct(5, 3, 1, "全国助残日"),
new WeekHolidayStruct(6, 3, 1, "父亲节"),
new WeekHolidayStruct(9, 3, 3, "国际和平日"),
new WeekHolidayStruct(9, 4, 1, "国际聋人节"),
new WeekHolidayStruct(10, 1, 2, "国际住房日"),
new WeekHolidayStruct(10, 1, 4, "国际减轻自然灾害日"),
new WeekHolidayStruct(11, 4, 5, "感恩节")
}

在文件 ChineseDateUtils.cs 第 843 行定义.

string SinGooCMS.Utility.ChineseCalendar.zhiStr = "子丑寅卯辰巳午未申酉戌亥"
staticprivate

在文件 ChineseDateUtils.cs 第 760 行定义.

属性说明

int SinGooCMS.Utility.ChineseCalendar.Animal
get

计算属相的索引，注意虽然属相是以农历年来区别的，但是目前在实际使用中是按公历来计算的 鼠年为1,其它类推

在文件 ChineseDateUtils.cs 第 1796 行定义.

string SinGooCMS.Utility.ChineseCalendar.AnimalString
get

取属相字符串

在文件 ChineseDateUtils.cs 第 1810 行定义.

string SinGooCMS.Utility.ChineseCalendar.ChineseConstellation
get

28星宿计算

在文件 ChineseDateUtils.cs 第 1488 行定义.

string SinGooCMS.Utility.ChineseCalendar.ChineseDateString
get

取农历日期表示法：农历一九九七年正月初五

在文件 ChineseDateUtils.cs 第 1634 行定义.

int SinGooCMS.Utility.ChineseCalendar.ChineseDay
get

农历日

在文件 ChineseDateUtils.cs 第 1546 行定义.

string SinGooCMS.Utility.ChineseCalendar.ChineseDayString
get

农历日中文表示

在文件 ChineseDateUtils.cs 第 1556 行定义.

string SinGooCMS.Utility.ChineseCalendar.ChineseHour
get

时辰

在文件 ChineseDateUtils.cs 第 1507 行定义.

int SinGooCMS.Utility.ChineseCalendar.ChineseMonth
get

农历的月份

在文件 ChineseDateUtils.cs 第 1582 行定义.

string SinGooCMS.Utility.ChineseCalendar.ChineseMonthString
get

农历月份字符串

在文件 ChineseDateUtils.cs 第 1592 行定义.

string SinGooCMS.Utility.ChineseCalendar.ChineseTwentyFourDay
get

定气法计算二十四节气,二十四节气是按地球公转来计算的，并非是阴历计算的

节气的定法有两种。古代历法采用的称为"恒气"，即按时间把一年等分为24份， 每一节气平均得15天有余，所以又称"平气"。现代农历采用的称为"定气"，即 按地球在轨道上的位置为标准，一周360°，两节气之间相隔15°。由于冬至时地 球位于近日点附近，运动速度较快，因而太阳在黄道上移动15°的时间不到15天。 夏至前后的情况正好相反，太阳在黄道上移动较慢，一个节气达16天之多。采用 定气时可以保证春、秋两分必然在昼夜平分的那两天。

在文件 ChineseDateUtils.cs 第 1662 行定义.

string SinGooCMS.Utility.ChineseCalendar.ChineseTwentyFourNextDay
get

当前日期后一个最近节气

在文件 ChineseDateUtils.cs 第 1725 行定义.

string SinGooCMS.Utility.ChineseCalendar.ChineseTwentyFourPrevDay
get

当前日期前一个最近节气

在文件 ChineseDateUtils.cs 第 1692 行定义.

int SinGooCMS.Utility.ChineseCalendar.ChineseYear
get

取农历年份

在文件 ChineseDateUtils.cs 第 1605 行定义.

string SinGooCMS.Utility.ChineseCalendar.ChineseYearString
get

取农历年字符串如，一九九七年

在文件 ChineseDateUtils.cs 第 1615 行定义.

string SinGooCMS.Utility.ChineseCalendar.Constellation
get

计算指定日期的星座序号

在文件 ChineseDateUtils.cs 第 1760 行定义.

DateTime SinGooCMS.Utility.ChineseCalendar.Date
getset

取对应的公历日期

在文件 ChineseDateUtils.cs 第 1412 行定义.

string SinGooCMS.Utility.ChineseCalendar.DateHoliday
get

按公历日计算的节日

在文件 ChineseDateUtils.cs 第 1387 行定义.

string SinGooCMS.Utility.ChineseCalendar.DateString
get

公历日期中文表示法 如一九九七年七月一日

在文件 ChineseDateUtils.cs 第 1462 行定义.

string SinGooCMS.Utility.ChineseCalendar.GanZhiDateString
get

取当前日期的干支表示法如 甲子年乙丑月丙庚日

在文件 ChineseDateUtils.cs 第 1927 行定义.

string SinGooCMS.Utility.ChineseCalendar.GanZhiDayString
get

取干支日表示法

在文件 ChineseDateUtils.cs 第 1910 行定义.

string SinGooCMS.Utility.ChineseCalendar.GanZhiMonthString
get

取干支的月表示字符串，注意农历的闰月不记干支

在文件 ChineseDateUtils.cs 第 1843 行定义.

string SinGooCMS.Utility.ChineseCalendar.GanZhiYearString
get

取农历年的干支表示法如 乙丑年

在文件 ChineseDateUtils.cs 第 1827 行定义.

bool SinGooCMS.Utility.ChineseCalendar.IsChineseLeapMonth
get

是否闰月

在文件 ChineseDateUtils.cs 第 1523 行定义.

bool SinGooCMS.Utility.ChineseCalendar.IsChineseLeapYear
get

当年是否有闰月

在文件 ChineseDateUtils.cs 第 1533 行定义.

bool SinGooCMS.Utility.ChineseCalendar.IsLeapYear
get

当前是否公历闰年

在文件 ChineseDateUtils.cs 第 1475 行定义.

string SinGooCMS.Utility.ChineseCalendar.newCalendarHoliday
get

计算中国农历节日

在文件 ChineseDateUtils.cs 第 1328 行定义.

DayOfWeek SinGooCMS.Utility.ChineseCalendar.WeekDay
get

取星期几

在文件 ChineseDateUtils.cs 第 1423 行定义.

string SinGooCMS.Utility.ChineseCalendar.WeekDayHoliday
get

按某月第几周第几日计算的节日

在文件 ChineseDateUtils.cs 第 1365 行定义.

string SinGooCMS.Utility.ChineseCalendar.WeekDayStr
get

周几的字符

在文件 ChineseDateUtils.cs 第 1433 行定义.

该类的文档由以下文件生成:
  • SinGooCMS.Utility/Date/ChineseDateUtils.cs


SinGooCMS.Utility: SinGooCMS.Utility.ChineseCalendar.LunarHolidayStruct结构体 参考

  • SinGooCMS
  • Utility
  • ChineseCalendar
  • LunarHolidayStruct
Public 成员函数 | Public 属性 | 所有成员列表
SinGooCMS.Utility.ChineseCalendar.LunarHolidayStruct结构体 参考

农历 更多...

Public 成员函数

LunarHolidayStruct (int month, int day, int recess, string name)

Public 属性

int | Month
int | Day
int | Recess
string | HolidayName

详细描述

农历

在文件 ChineseDateUtils.cs 第 633 行定义.

构造及析构函数说明

SinGooCMS.Utility.ChineseCalendar.LunarHolidayStruct.LunarHolidayStruct | ( | int | month,
 |  | int | day,
 |  | int | recess,
 |  | string | name
 | ) |  |

在文件 ChineseDateUtils.cs 第 640 行定义.

类成员变量说明

int SinGooCMS.Utility.ChineseCalendar.LunarHolidayStruct.Day

在文件 ChineseDateUtils.cs 第 636 行定义.

string SinGooCMS.Utility.ChineseCalendar.LunarHolidayStruct.HolidayName

在文件 ChineseDateUtils.cs 第 638 行定义.

int SinGooCMS.Utility.ChineseCalendar.LunarHolidayStruct.Month

在文件 ChineseDateUtils.cs 第 635 行定义.

int SinGooCMS.Utility.ChineseCalendar.LunarHolidayStruct.Recess

在文件 ChineseDateUtils.cs 第 637 行定义.

该结构体的文档由以下文件生成:
  • SinGooCMS.Utility/Date/ChineseDateUtils.cs


SinGooCMS.Utility: SinGooCMS.Utility.ChineseCalendar.SolarHolidayStruct结构体 参考

  • SinGooCMS
  • Utility
  • ChineseCalendar
  • SolarHolidayStruct
Public 成员函数 | Public 属性 | 所有成员列表
SinGooCMS.Utility.ChineseCalendar.SolarHolidayStruct结构体 参考

阳历 更多...

Public 成员函数

SolarHolidayStruct (int month, int day, int recess, string name)

Public 属性

int | Month
int | Day
int | Recess
string | HolidayName

详细描述

阳历

在文件 ChineseDateUtils.cs 第 615 行定义.

构造及析构函数说明

SinGooCMS.Utility.ChineseCalendar.SolarHolidayStruct.SolarHolidayStruct | ( | int | month,
 |  | int | day,
 |  | int | recess,
 |  | string | name
 | ) |  |

在文件 ChineseDateUtils.cs 第 621 行定义.

类成员变量说明

int SinGooCMS.Utility.ChineseCalendar.SolarHolidayStruct.Day

在文件 ChineseDateUtils.cs 第 618 行定义.

string SinGooCMS.Utility.ChineseCalendar.SolarHolidayStruct.HolidayName

在文件 ChineseDateUtils.cs 第 620 行定义.

int SinGooCMS.Utility.ChineseCalendar.SolarHolidayStruct.Month

在文件 ChineseDateUtils.cs 第 617 行定义.

int SinGooCMS.Utility.ChineseCalendar.SolarHolidayStruct.Recess

在文件 ChineseDateUtils.cs 第 619 行定义.

该结构体的文档由以下文件生成:
  • SinGooCMS.Utility/Date/ChineseDateUtils.cs


SinGooCMS.Utility: SinGooCMS.Utility.ChineseCalendar.WeekHolidayStruct结构体 参考

  • SinGooCMS
  • Utility
  • ChineseCalendar
  • WeekHolidayStruct
Public 成员函数 | Public 属性 | 所有成员列表
SinGooCMS.Utility.ChineseCalendar.WeekHolidayStruct结构体 参考

Public 成员函数

WeekHolidayStruct (int month, int weekAtMonth, int weekDay, string name)

Public 属性

int | Month
int | WeekAtMonth
int | WeekDay
string | HolidayName

详细描述

在文件 ChineseDateUtils.cs 第 649 行定义.

构造及析构函数说明

SinGooCMS.Utility.ChineseCalendar.WeekHolidayStruct.WeekHolidayStruct | ( | int | month,
 |  | int | weekAtMonth,
 |  | int | weekDay,
 |  | string | name
 | ) |  |

在文件 ChineseDateUtils.cs 第 656 行定义.

类成员变量说明

string SinGooCMS.Utility.ChineseCalendar.WeekHolidayStruct.HolidayName

在文件 ChineseDateUtils.cs 第 654 行定义.

int SinGooCMS.Utility.ChineseCalendar.WeekHolidayStruct.Month

在文件 ChineseDateUtils.cs 第 651 行定义.

int SinGooCMS.Utility.ChineseCalendar.WeekHolidayStruct.WeekAtMonth

在文件 ChineseDateUtils.cs 第 652 行定义.

int SinGooCMS.Utility.ChineseCalendar.WeekHolidayStruct.WeekDay

在文件 ChineseDateUtils.cs 第 653 行定义.

该结构体的文档由以下文件生成:
  • SinGooCMS.Utility/Date/ChineseDateUtils.cs


SinGooCMS.Utility: SinGooCMS.Utility.CNDate类 参考

  • SinGooCMS
  • Utility
  • CNDate
Public 成员函数 | Public 属性 | 所有成员列表
SinGooCMS.Utility.CNDate类 参考

农历属性 更多...

Public 成员函数

override string ToString ()
重写ToString 更多...

Public 属性

int | cnIntYear = 0
农历年(整型) 更多...
int | cnIntMonth = 0
农历月份(整型) 更多...
int | cnIntDay = 0
农历天(整型) 更多...
string | cnStrYear = ""
农历年(支干) 更多...
string | cnStrMonth = ""
农历月份(字符) 更多...
string | cnStrDay = ""
农历天(字符) 更多...
string | cnAnm = ""
农历属象 更多...
string | cnSolarTerm = ""
二十四节气 更多...
string | cnFtvl = ""
阴历节日 更多...
string | cnFtvs = ""
阳历节日 更多...

详细描述

农历属性

在文件 ChineseDateUtils.cs 第 10 行定义.

成员函数说明

override string SinGooCMS.Utility.CNDate.ToString ( )

重写ToString

返回

在文件 ChineseDateUtils.cs 第 57 行定义.

类成员变量说明

string SinGooCMS.Utility.CNDate.cnAnm = ""

农历属象

在文件 ChineseDateUtils.cs 第 39 行定义.

string SinGooCMS.Utility.CNDate.cnFtvl = ""

阴历节日

在文件 ChineseDateUtils.cs 第 47 行定义.

string SinGooCMS.Utility.CNDate.cnFtvs = ""

阳历节日

在文件 ChineseDateUtils.cs 第 51 行定义.

int SinGooCMS.Utility.CNDate.cnIntDay = 0

农历天(整型)

在文件 ChineseDateUtils.cs 第 23 行定义.

int SinGooCMS.Utility.CNDate.cnIntMonth = 0

农历月份(整型)

在文件 ChineseDateUtils.cs 第 19 行定义.

int SinGooCMS.Utility.CNDate.cnIntYear = 0

农历年(整型)

在文件 ChineseDateUtils.cs 第 15 行定义.

string SinGooCMS.Utility.CNDate.cnSolarTerm = ""

二十四节气

在文件 ChineseDateUtils.cs 第 43 行定义.

string SinGooCMS.Utility.CNDate.cnStrDay = ""

农历天(字符)

在文件 ChineseDateUtils.cs 第 35 行定义.

string SinGooCMS.Utility.CNDate.cnStrMonth = ""

农历月份(字符)

在文件 ChineseDateUtils.cs 第 31 行定义.

string SinGooCMS.Utility.CNDate.cnStrYear = ""

农历年(支干)

在文件 ChineseDateUtils.cs 第 27 行定义.

该类的文档由以下文件生成:
  • SinGooCMS.Utility/Date/ChineseDateUtils.cs


SinGooCMS.Utility: SinGooCMS.Utility.ConfigUtils类 参考

  • SinGooCMS
  • Utility
  • ConfigUtils
静态 Public 成员函数 | 静态 Public 属性 | 静态 Private 成员函数 | 所有成员列表
SinGooCMS.Utility.ConfigUtils类 参考

配置管理 更多...

静态 Public 成员函数

static T | GetAppSetting< T > (string appSettingName)
读取配置 更多...
static T | GetAppSetting< T > (string appSettingName, T defaultValue)
读取配置 更多...
static void | AddConfigurationProperties (ConfigurationPropertyCollection collection, IEnumerable< ConfigurationProperty > properties)
添加配置属性 更多...
static ConnectionStringSettings | GetConnectionString (string connectionStringName="SQLConnSTR")
获取连接字符串 配置如 <add name="SQLConnSTR" providername="SqlServer" connectionstring="server=(local);database=SinGooCMS-v1.6;uid=sa;pwd=123"> 更多...

静态 Public 属性

static string | ProviderName => GetConnectionString().ProviderName
数据库类型 更多...
static string | DefConnStr => GetConnectionString().ConnectionString
数据库库连接字符串 更多...

静态 Private 成员函数

static T GetAppSettingInternal< T > (string appSettingName, bool useDefaultOnUndefined, T defaultValue)
读取配置 更多...

详细描述

配置管理

1、.net core读取appsettings.json文件

2、.net framework web读取web.config文件

3、.net framework cs读取app.config

在文件 ConfigUtils.cs 第 20 行定义.

成员函数说明

static void SinGooCMS.Utility.ConfigUtils.AddConfigurationProperties | ( | ConfigurationPropertyCollection | collection,
 |  | IEnumerable< ConfigurationProperty > | properties
 | ) |  |
static

添加配置属性

参数
collection
properties

在文件 ConfigUtils.cs 第 177 行定义.

static T SinGooCMS.Utility.ConfigUtils.GetAppSetting< T > ( string appSettingName )
static

读取配置

模板参数
T
参数
appSettingName
返回
类型限制
T : IConvertible

在文件 ConfigUtils.cs 第 136 行定义.

static T SinGooCMS.Utility.ConfigUtils.GetAppSetting< T > | ( | string | appSettingName,
 |  | T | defaultValue
 | ) |  |
static

读取配置

模板参数
T
参数
appSettingName
defaultValue
返回
类型限制
T : IConvertible

在文件 ConfigUtils.cs 第 147 行定义.

static T SinGooCMS.Utility.ConfigUtils.GetAppSettingInternal< T > | ( | string | appSettingName,
 |  | bool | useDefaultOnUndefined,
 |  | T | defaultValue
 | ) |  |
staticprivate

读取配置

模板参数
T
参数
appSettingName
useDefaultOnUndefined
defaultValue
返回
类型限制
T : IConvertible

在文件 ConfigUtils.cs 第 159 行定义.

static ConnectionStringSettings SinGooCMS.Utility.ConfigUtils.GetConnectionString ( string connectionStringName = "SQLConnSTR" )
static

获取连接字符串 配置如 <add name="SQLConnSTR" providername="SqlServer" connectionstring="server=(local);database=SinGooCMS-v1.6;uid=sa;pwd=123">

参数
connectionStringName
返回

在文件 ConfigUtils.cs 第 203 行定义.

类成员变量说明

string SinGooCMS.Utility.ConfigUtils.DefConnStr => GetConnectionString().ConnectionString
static

数据库库连接字符串

在文件 ConfigUtils.cs 第 196 行定义.

string SinGooCMS.Utility.ConfigUtils.ProviderName => GetConnectionString().ProviderName
static

数据库类型

在文件 ConfigUtils.cs 第 191 行定义.

该类的文档由以下文件生成:
  • SinGooCMS.Utility/Config/ConfigUtils.cs


SinGooCMS.Utility: SinGooCMS.Utility.CookieUtils类 参考

  • SinGooCMS
  • Utility
  • CookieUtils
静态 Public 成员函数 | 所有成员列表
SinGooCMS.Utility.CookieUtils类 参考

cookie工具 更多...

静态 Public 成员函数

static bool | ContainKey (string key)
是否包含key 更多...
static void | SetCookie (string key, string value)
写入cookie(有效期一年) 更多...
static void | SetCookie (string key, string value, int expires=30 *60, bool isHttpOnly=true)
写入cookie 更多...
static string | GetCookie (string key)
读cookie值 更多...
static void | RemoveCookie (string key)
清除cookie 更多...

详细描述

cookie工具

在文件 CookieUtils.cs 第 15 行定义.

成员函数说明

static bool SinGooCMS.Utility.CookieUtils.ContainKey ( string key )
static

是否包含key

参数
key
返回

在文件 CookieUtils.cs 第 22 行定义.

static string SinGooCMS.Utility.CookieUtils.GetCookie ( string key )
static

读cookie值

参数
key 名称
返回
cookie值

在文件 CookieUtils.cs 第 86 行定义.

static void SinGooCMS.Utility.CookieUtils.RemoveCookie ( string key )
static

清除cookie

参数
key key of cookie

在文件 CookieUtils.cs 第 107 行定义.

static void SinGooCMS.Utility.CookieUtils.SetCookie | ( | string | key,
 |  | string | value
 | ) |  |
static

写入cookie(有效期一年)

参数
key
value

在文件 CookieUtils.cs 第 36 行定义.

static void SinGooCMS.Utility.CookieUtils.SetCookie | ( | string | key,
 |  | string | value,
 |  | int | expires = 30 * 60,
 |  | bool | isHttpOnly = true
 | ) |  |
static

写入cookie

参数
key | cookie键
value | cookie值
expires | 过期时长（秒），默认30分钟
isHttpOnly

在文件 CookieUtils.cs 第 48 行定义.

该类的文档由以下文件生成:
  • SinGooCMS.Utility/Web/CookieUtils.cs


SinGooCMS.Utility: SinGooCMS.Utility.CsvUtils类 参考

  • SinGooCMS
  • Utility
  • CsvUtils
静态 Public 成员函数 | 所有成员列表
SinGooCMS.Utility.CsvUtils类 参考

csv工具 更多...

静态 Public 成员函数

static IList< T > | Read< T > (string csvFilePath, string encoding="utf-8")
读csv到对象 更多...
static DataTable | Read (string csvFilePath, string encoding="utf-8")
读csv到datatable 更多...
static void | Write (DataTable dt, string csvFilePath, string encoding="utf-8")
写csv文件 更多...
static async Task | WriteAsync (DataTable dt, string csvFilePath, string encoding="utf-8")
写csv文件 更多...
static void | Write< T > (IEnumerable< T > csvLst, string csvFilePath, string encoding="utf-8")
写csv文件 更多...
static async Task | WriteAsync< T > (IEnumerable< T > csvLst, string csvFilePath, string encoding="utf-8")
异步写csv文件 更多...

详细描述

csv工具

在文件 CsvUtils.cs 第 18 行定义.

成员函数说明

static DataTable SinGooCMS.Utility.CsvUtils.Read | ( | string | csvFilePath,
 |  | string | encoding = "utf-8"
 | ) |  |
static

读csv到datatable

参数
csvFilePath | csv文件路径，包括文件名
encoding | 编码，默认utf-8
返回

在文件 CsvUtils.cs 第 54 行定义.

static IList<T> SinGooCMS.Utility.CsvUtils.Read< T > | ( | string | csvFilePath,
 |  | string | encoding = "utf-8"
 | ) |  |
static

读csv到对象

模板参数
T
参数
csvFilePath
encoding
返回

在文件 CsvUtils.cs 第 29 行定义.

static void SinGooCMS.Utility.CsvUtils.Write | ( | DataTable | dt,
 |  | string | csvFilePath,
 |  | string | encoding = "utf-8"
 | ) |  |
static

写csv文件

参数
dt | DataTable
csvFilePath | 物理路径
encoding | 编码

在文件 CsvUtils.cs 第 91 行定义.

这是这个函数的调用关系图:

static void SinGooCMS.Utility.CsvUtils.Write< T > | ( | IEnumerable< T > | csvLst,
 |  | string | csvFilePath,
 |  | string | encoding = "utf-8"
 | ) |  |
static

写csv文件

模板参数
T
参数
csvLst
csvFilePath
encoding

在文件 CsvUtils.cs 第 170 行定义.

static async Task SinGooCMS.Utility.CsvUtils.WriteAsync | ( | DataTable | dt,
 |  | string | csvFilePath,
 |  | string | encoding = "utf-8"
 | ) |  |
static

写csv文件

参数
dt | DataTable
csvFilePath | 物理路径
encoding | 编码

在文件 CsvUtils.cs 第 130 行定义.

这是这个函数的调用关系图:

static async Task SinGooCMS.Utility.CsvUtils.WriteAsync< T > | ( | IEnumerable< T > | csvLst,
 |  | string | csvFilePath,
 |  | string | encoding = "utf-8"
 | ) |  |
static

异步写csv文件

模板参数
T
参数
csvLst
csvFilePath
encoding

在文件 CsvUtils.cs 第 193 行定义.

该类的文档由以下文件生成:
  • SinGooCMS.Utility/Data/CsvUtils.cs


SinGooCMS.Utility: SinGooCMS.Utility.DatetimeUtils类 参考

  • SinGooCMS
  • Utility
  • DatetimeUtils
静态 Public 成员函数 | 所有成员列表
SinGooCMS.Utility.DatetimeUtils类 参考

日期工具 更多...

静态 Public 成员函数

static double | GetUnixTime (DateTime time)
转unix时间 更多...
static DateTime | GetDTFromUnixTime (double unixSeconds)
unix时间戳转c::日期 更多...

详细描述

日期工具

在文件 DatetimeUtils.cs 第 11 行定义.

成员函数说明

static DateTime SinGooCMS.Utility.DatetimeUtils.GetDTFromUnixTime ( double unixSeconds )
static

unix时间戳转c::日期

参数
unixSeconds
返回

在文件 DatetimeUtils.cs 第 28 行定义.

static double SinGooCMS.Utility.DatetimeUtils.GetUnixTime ( DateTime time )
static

转unix时间

参数
time
返回

在文件 DatetimeUtils.cs 第 18 行定义.

该类的文档由以下文件生成:
  • SinGooCMS.Utility/Date/DatetimeUtils.cs


SinGooCMS.Utility: SinGooCMS.Utility.DEncryptUtils类 参考

  • SinGooCMS
  • Utility
  • DEncryptUtils
静态 Public 成员函数 | 静态 Private 成员函数 | Private 属性 | 所有成员列表
SinGooCMS.Utility.DEncryptUtils类 参考

加密解密工具 更多...

静态 Public 成员函数

static string | DESEncrypt (string strTxt, string strKey)
DES加密 更多...
static string | DESDecrypt (string strTxt, string strKey)
Des 解密 更多...
static string | AESEncrypt (string text, string key)
AES加密 更多...
static string | AESDecrypt (string text, string key)
AES解密 更多...
static string | Base64Encrypt (string strTxt)
Base64加密 更多...
static string | Base64Decrypt (string strTxt)
Base64解密 更多...
static string | GetXORCode (string strTxt, string strKey)
异或加密,对原文加密成密文,对密文加密成原文 更多...
static string | Base36Encode (long input)
将给定的数字编码为字符串。 更多...
static long | Base36Decode (string input)
将编码的字符串解码为长整数。 更多...
static string | MD5Encrypt (string password)
md5加密 更多...
static string | SHA512Encrypt (string strTxt)
SHA512 加密 更多...

静态 Private 成员函数

static byte[] GetAesKey (string key)
获取Aes32位密钥 更多...

Private 属性

const string Base36Characters = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"

详细描述

加密解密工具

在文件 DEncryptUtils.cs 第 13 行定义.

成员函数说明

static string SinGooCMS.Utility.DEncryptUtils.AESDecrypt | ( | string | text,
 |  | string | key
 | ) |  |
static

AES解密

参数
text | 要解密的文本
key | key
返回

在文件 DEncryptUtils.cs 第 126 行定义.

static string SinGooCMS.Utility.DEncryptUtils.AESEncrypt | ( | string | text,
 |  | string | key
 | ) |  |
static

AES加密

参数
text | 要加密的文本
key | key
返回

在文件 DEncryptUtils.cs 第 102 行定义.

static long SinGooCMS.Utility.DEncryptUtils.Base36Decode ( string input )
static

将编码的字符串解码为长整数。

参数
input 要解码的数字。
返回
解码 input 为长整数。

在文件 DEncryptUtils.cs 第 223 行定义.

static string SinGooCMS.Utility.DEncryptUtils.Base36Encode ( long input )
static

将给定的数字编码为字符串。

参数
input 要编码的数字。
返回
编码 input 为字符串。

在文件 DEncryptUtils.cs 第 206 行定义.

static string SinGooCMS.Utility.DEncryptUtils.Base64Decrypt ( string strTxt )
static

Base64解密

参数
strTxt
返回

在文件 DEncryptUtils.cs 第 163 行定义.

static string SinGooCMS.Utility.DEncryptUtils.Base64Encrypt ( string strTxt )
static

Base64加密

参数
strTxt
返回

在文件 DEncryptUtils.cs 第 152 行定义.

static string SinGooCMS.Utility.DEncryptUtils.DESDecrypt | ( | string | strTxt,
 |  | string | strKey
 | ) |  |
static

Des 解密

参数
strTxt
strKey
返回

在文件 DEncryptUtils.cs 第 50 行定义.

static string SinGooCMS.Utility.DEncryptUtils.DESEncrypt | ( | string | strTxt,
 |  | string | strKey
 | ) |  |
static

DES加密

参数
strTxt
strKey
返回

在文件 DEncryptUtils.cs 第 25 行定义.

static byte [] SinGooCMS.Utility.DEncryptUtils.GetAesKey ( string key )
staticprivate

获取Aes32位密钥

参数
key Aes密钥字符串
返回
Aes32位密钥

在文件 DEncryptUtils.cs 第 78 行定义.

static string SinGooCMS.Utility.DEncryptUtils.GetXORCode | ( | string | strTxt,
 |  | string | strKey
 | ) |  |
static

异或加密,对原文加密成密文,对密文加密成原文

参数
strTxt
strKey
返回

在文件 DEncryptUtils.cs 第 179 行定义.

static string SinGooCMS.Utility.DEncryptUtils.MD5Encrypt ( string password )
static

md5加密

参数
password 密码明文
返回

在文件 DEncryptUtils.cs 第 248 行定义.

static string SinGooCMS.Utility.DEncryptUtils.SHA512Encrypt ( string strTxt )
static

SHA512 加密

参数
strTxt
返回

在文件 DEncryptUtils.cs 第 262 行定义.

类成员变量说明

const string SinGooCMS.Utility.DEncryptUtils.Base36Characters = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"
private

在文件 DEncryptUtils.cs 第 199 行定义.

该类的文档由以下文件生成:
  • SinGooCMS.Utility/Security/DEncryptUtils.cs


SinGooCMS.Utility: SinGooCMS.Utility.EntityAttrUtils类 参考

  • SinGooCMS
  • Utility
  • EntityAttrUtils
静态 Public 成员函数 | 所有成员列表
SinGooCMS.Utility.EntityAttrUtils类 参考

实体类 特性工具 更多...

静态 Public 成员函数

static string | GetTableName (Type type)
表名 更多...
static string | GetKey (Type type)
读取主键名称 - 只支持单主键 更多...
static object | GetKeyValue< TEntity > (TEntity entity)
读取主键值 - 只支持单主键 更多...
static bool | IsKey (PropertyInfo pi)
是否主键 - 只支持单主键（主键ID是自增的） 更多...
static bool | IsNotMapped (PropertyInfo pi)
是否映射 更多...
static PropertyInfo | GetProperty< TEntity > (string PropertyName)
读取实体的属性 更多...
static int | GetMaxLength (PropertyInfo pi)
最大值特性 更多...
static int | GetMinLength (PropertyInfo pi)
最小值特性 更多...

详细描述

实体类 特性工具

在文件 EntityAttrUtils.cs 第 13 行定义.

成员函数说明

static string SinGooCMS.Utility.EntityAttrUtils.GetKey ( Type type )
static

读取主键名称 - 只支持单主键

参数
type
返回

在文件 EntityAttrUtils.cs 第 31 行定义.

static object SinGooCMS.Utility.EntityAttrUtils.GetKeyValue< TEntity > ( TEntity entity )
static

读取主键值 - 只支持单主键

模板参数
TEntity
参数
entity
返回
类型限制
TEntity : class

在文件 EntityAttrUtils.cs 第 43 行定义.

static int SinGooCMS.Utility.EntityAttrUtils.GetMaxLength ( PropertyInfo pi )
static

最大值特性

参数
pi
返回

在文件 EntityAttrUtils.cs 第 90 行定义.

static int SinGooCMS.Utility.EntityAttrUtils.GetMinLength ( PropertyInfo pi )
static

最小值特性

参数
pi
返回

在文件 EntityAttrUtils.cs 第 102 行定义.

static PropertyInfo SinGooCMS.Utility.EntityAttrUtils.GetProperty< TEntity > ( string PropertyName )
static

读取实体的属性

模板参数
TEntity
参数
PropertyName
返回

在文件 EntityAttrUtils.cs 第 79 行定义.

static string SinGooCMS.Utility.EntityAttrUtils.GetTableName ( Type type )
static

表名

参数
type
返回

在文件 EntityAttrUtils.cs 第 20 行定义.

static bool SinGooCMS.Utility.EntityAttrUtils.IsKey ( PropertyInfo pi )
static

是否主键 - 只支持单主键（主键ID是自增的）

参数
pi
返回

在文件 EntityAttrUtils.cs 第 58 行定义.

static bool SinGooCMS.Utility.EntityAttrUtils.IsNotMapped ( PropertyInfo pi )
static

是否映射

参数
pi
返回

在文件 EntityAttrUtils.cs 第 68 行定义.

该类的文档由以下文件生成:
  • SinGooCMS.Utility/Data/EntityAttrUtils.cs


SinGooCMS.Utility: SinGooCMS.Utility.EnumUtils类 参考

  • SinGooCMS
  • Utility
  • EnumUtils
静态 Public 成员函数 | 静态 Private 成员函数 | 所有成员列表
SinGooCMS.Utility.EnumUtils类 参考

枚举帮助类 更多...

静态 Public 成员函数

static Dictionary< int, string > | TransIntDict (Type enumType)
枚举转字典 枚举int-枚举说明 更多...
static Dictionary< string, string > | TransStrDict (Type enumType)
枚举转字典 枚举int-枚举说明 更多...
static List< T > | EnumToList< T > ()
枚举转链表 更多...
static string | GetEnumCollectionDescription< T > (Collection< T > enums)
读取枚举说明 更多...
static string | GetEnumDescription< T > (T enumeratedType)
读取枚举说明 更多...
static string | GetEnumDescription (Enum value)
读取枚举说明 更多...
static List< string > | GetEnumDescriptions< T > ()
读取枚举说明 更多...
static T | StringToEnum< T > (string name)
字符串转枚举类型 更多...
static object | StringToEnum (Type enumType, string value)
字符串转枚举类型 更多...
static object | StringToEnum (Type enumType, string value, bool ignoreCase)
字符串转枚举类型 更多...
static T | StringToEnumOrNull< T > (string name)
字符串转枚举类型 更多...

静态 Private 成员函数

static string GetDescription (Enum value)
读取枚举说明 更多...

详细描述

枚举帮助类

在文件 EnumUtils.cs 第 13 行定义.

成员函数说明

static List<T> SinGooCMS.Utility.EnumUtils.EnumToList< T > ( )
static

枚举转链表

模板参数
T
返回

在文件 EnumUtils.cs 第 50 行定义.

static string SinGooCMS.Utility.EnumUtils.GetDescription ( Enum value )
staticprivate

读取枚举说明

参数
value
返回

在文件 EnumUtils.cs 第 71 行定义.

static string SinGooCMS.Utility.EnumUtils.GetEnumCollectionDescription< T > ( Collection< T > enums )
static

读取枚举说明

模板参数
T
参数
enums
返回

在文件 EnumUtils.cs 第 87 行定义.

static string SinGooCMS.Utility.EnumUtils.GetEnumDescription ( Enum value )
static

读取枚举说明

参数
value
返回

在文件 EnumUtils.cs 第 133 行定义.

static string SinGooCMS.Utility.EnumUtils.GetEnumDescription< T > ( T enumeratedType )
static

读取枚举说明

模板参数
T
参数
enumeratedType
返回

在文件 EnumUtils.cs 第 108 行定义.

static List<string> SinGooCMS.Utility.EnumUtils.GetEnumDescriptions< T > ( )
static

读取枚举说明

模板参数
T
返回
类型限制
T : struct

在文件 EnumUtils.cs 第 148 行定义.

static object SinGooCMS.Utility.EnumUtils.StringToEnum | ( | Type | enumType,
 |  | string | value
 | ) |  |
static

字符串转枚举类型

参数
enumType
value
返回

在文件 EnumUtils.cs 第 181 行定义.

static object SinGooCMS.Utility.EnumUtils.StringToEnum | ( | Type | enumType,
 |  | string | value,
 |  | bool | ignoreCase
 | ) |  |
static

字符串转枚举类型

参数
enumType
value
ignoreCase
返回

在文件 EnumUtils.cs 第 197 行定义.

static T SinGooCMS.Utility.EnumUtils.StringToEnum< T > ( string name )
static

字符串转枚举类型

模板参数
T
参数
name
返回
类型限制
T : struct

在文件 EnumUtils.cs 第 165 行定义.

static T SinGooCMS.Utility.EnumUtils.StringToEnumOrNull< T > ( string name )
static

字符串转枚举类型

模板参数
T
参数
name
返回
类型限制
T : struct

在文件 EnumUtils.cs 第 223 行定义.

static Dictionary<int, string> SinGooCMS.Utility.EnumUtils.TransIntDict ( Type enumType )
static

枚举转字典 枚举int-枚举说明

参数
enumType
返回

在文件 EnumUtils.cs 第 20 行定义.

static Dictionary<string, string> SinGooCMS.Utility.EnumUtils.TransStrDict ( Type enumType )
static

枚举转字典 枚举int-枚举说明

参数
enumType
返回

在文件 EnumUtils.cs 第 35 行定义.

该类的文档由以下文件生成:
  • SinGooCMS.Utility/System/EnumUtils.cs


SinGooCMS.Utility: SinGooCMS.Utility.ExceptionUtils类 参考

  • SinGooCMS
  • Utility
  • ExceptionUtils
静态 Public 成员函数 | 所有成员列表
SinGooCMS.Utility.ExceptionUtils类 参考

异常信息格式化 更多...

静态 Public 成员函数

static string FormatMessage (Exception e)

详细描述

异常信息格式化

在文件 ExceptionUtils.cs 第 11 行定义.

成员函数说明

static string SinGooCMS.Utility.ExceptionUtils.FormatMessage ( Exception e )
static

在文件 ExceptionUtils.cs 第 13 行定义.

该类的文档由以下文件生成:
  • SinGooCMS.Utility/Web/ExceptionUtils.cs


SinGooCMS.Utility: SinGooCMS.Utility.FileUtils类 参考

  • SinGooCMS
  • Utility
  • FileUtils
静态 Public 成员函数 | 静态 Private 成员函数 | 所有成员列表
SinGooCMS.Utility.FileUtils类 参考

文件管理工具 更多...

静态 Public 成员函数

static async Task | CreateFileAsync (string absolutePath, string fileContent, Encoding encoding=null)
异步创建文件并写入文本内容 更多...
static async Task< string > | ReadFileContentAsync (string absolutePath, Encoding encoding=null)
异步读取文件内容 更多...
static async Task | WriteFileContentAsync (string absolutePath, string fileContent, bool isAppend=false, Encoding encoding=null)
异步写文件 更多...
static void | ReNameFile (string absolutePath, string oldName, string newName, bool isFile=true)
重命名目录或者文件 更多...
static string | GetFileSize (decimal length, FileSizeUnit unit=FileSizeUnit.KB)
获取文件大小 更多...
static void | CreateDirectory (string absoluteDir)
创建文件夹 更多...
static void | DeleteDirectory (string absoluteDir)
删除文件夹 更多...
static long | GetDirectoryLength (string absoluteDir)
获取目录容量 更多...
static void | CopyDirectory (string SourcePath, string DestinationPath)
复制目录及目录下所有文件 更多...
static IEnumerable< FileInfo > | GetAllFiles (string absoluteDir)
递归获取目录下的所有文件信息 更多...
static string | Combine (string dir, string fileName)
合并目录和文件名成为新的文件路径 更多...
static bool | BackupFile (string sourceFileName, string destFileName, bool overwrite)
备份文件 更多...
static bool | BackupFile (string sourceFileName, string destFileName)
备份文件,当目标文件存在时覆盖 更多...
static bool | RestoreFile (string backupFileName, string targetFileName, string backupTargetFileName)
恢复文件 更多...
static bool | RestoreFile (string backupFileName, string targetFileName)
恢复文件 更多...
static Stream | ReadFileToStream (string fileName)
读文件到Stream 更多...
static byte[] | ReadFileToBytes (string fileName)
读文件到byte[] 更多...
static string | GetContentType (string filePath)
读取文件类型Content_Type 更多...

静态 Private 成员函数

static void CopyFolder (string sourcesAbsoluteDir, string destAbsoluteDir)
复制文件夹 更多...

详细描述

文件管理工具

在文件 FileUtils.cs 第 24 行定义.

成员函数说明

static bool SinGooCMS.Utility.FileUtils.BackupFile | ( | string | sourceFileName,
 |  | string | destFileName,
 |  | bool | overwrite
 | ) |  |
static

备份文件

参数
sourceFileName | 源文件名
destFileName | 目标文件名
overwrite | 当目标文件存在时是否覆盖
返回
操作是否成功

在文件 FileUtils.cs 第 297 行定义.

static bool SinGooCMS.Utility.FileUtils.BackupFile | ( | string | sourceFileName,
 |  | string | destFileName
 | ) |  |
static

备份文件,当目标文件存在时覆盖

参数
sourceFileName | 源文件名
destFileName | 目标文件名
返回
操作是否成功

在文件 FileUtils.cs 第 323 行定义.

static string SinGooCMS.Utility.FileUtils.Combine | ( | string | dir,
 |  | string | fileName
 | ) |  |
static

合并目录和文件名成为新的文件路径

参数
dir | 绝对路径或者相对路径的目录路径
fileName | 文件名
返回

在文件 FileUtils.cs 第 271 行定义.

这是这个函数的调用关系图:

static void SinGooCMS.Utility.FileUtils.CopyDirectory | ( | string | SourcePath,
 |  | string | DestinationPath
 | ) |  |
static

复制目录及目录下所有文件

参数
SourcePath
DestinationPath

在文件 FileUtils.cs 第 233 行定义.

static void SinGooCMS.Utility.FileUtils.CopyFolder | ( | string | sourcesAbsoluteDir,
 |  | string | destAbsoluteDir
 | ) |  |
staticprivate

复制文件夹

参数
sourcesAbsoluteDir | 源路径
destAbsoluteDir | 新路径

在文件 FileUtils.cs 第 205 行定义.

static void SinGooCMS.Utility.FileUtils.CreateDirectory ( string absoluteDir )
static

创建文件夹

参数
absoluteDir
返回

在文件 FileUtils.cs 第 150 行定义.

static async Task SinGooCMS.Utility.FileUtils.CreateFileAsync | ( | string | absolutePath,
 |  | string | fileContent,
 |  | Encoding | encoding = null
 | ) |  |
static

异步创建文件并写入文本内容

参数
absolutePath
fileContent
encoding

在文件 FileUtils.cs 第 34 行定义.

static void SinGooCMS.Utility.FileUtils.DeleteDirectory ( string absoluteDir )
static

删除文件夹

参数
absoluteDir
返回

在文件 FileUtils.cs 第 161 行定义.

static IEnumerable<FileInfo> SinGooCMS.Utility.FileUtils.GetAllFiles ( string absoluteDir )
static

递归获取目录下的所有文件信息

参数
absoluteDir
返回

在文件 FileUtils.cs 第 253 行定义.

static string SinGooCMS.Utility.FileUtils.GetContentType ( string filePath )
static

读取文件类型Content_Type

参数
filePath
返回

在文件 FileUtils.cs 第 422 行定义.

static long SinGooCMS.Utility.FileUtils.GetDirectoryLength ( string absoluteDir )
static

获取目录容量

参数
absoluteDir
返回

在文件 FileUtils.cs 第 172 行定义.

static string SinGooCMS.Utility.FileUtils.GetFileSize | ( | decimal | length,
 |  | FileSizeUnit | unit = FileSizeUnit.KB
 | ) |  |
static

获取文件大小

参数
length | 长度：字节
unit | 单位，枚举：FileSizeUnit
返回

在文件 FileUtils.cs 第 118 行定义.

static async Task<string> SinGooCMS.Utility.FileUtils.ReadFileContentAsync | ( | string | absolutePath,
 |  | Encoding | encoding = null
 | ) |  |
static

异步读取文件内容

参数
absolutePath
encoding
返回

在文件 FileUtils.cs 第 53 行定义.

static byte [] SinGooCMS.Utility.FileUtils.ReadFileToBytes ( string fileName )
static

读文件到byte[]

参数
fileName 硬盘文件路径
返回

在文件 FileUtils.cs 第 390 行定义.

static Stream SinGooCMS.Utility.FileUtils.ReadFileToStream ( string fileName )
static

读文件到Stream

参数
fileName 硬盘文件路径
返回

在文件 FileUtils.cs 第 380 行定义.

static void SinGooCMS.Utility.FileUtils.ReNameFile | ( | string | absolutePath,
 |  | string | oldName,
 |  | string | newName,
 |  | bool | isFile = true
 | ) |  |
static

重命名目录或者文件

参数
absolutePath | 文件所在的目录
oldName | 原名称
newName | 修改的名称
isFile | true=文件 false=文件夹
返回

在文件 FileUtils.cs 第 98 行定义.

static bool SinGooCMS.Utility.FileUtils.RestoreFile | ( | string | backupFileName,
 |  | string | targetFileName,
 |  | string | backupTargetFileName
 | ) |  |
static

恢复文件

参数
backupFileName | 备份文件名
targetFileName | 要恢复的文件名
backupTargetFileName | 要恢复文件再次备份的名称,如果为null,则不再备份恢复文件
返回
操作是否成功

在文件 FileUtils.cs 第 336 行定义.

static bool SinGooCMS.Utility.FileUtils.RestoreFile | ( | string | backupFileName,
 |  | string | targetFileName
 | ) |  |
static

恢复文件

参数
backupFileName
targetFileName
返回

在文件 FileUtils.cs 第 366 行定义.

static async Task SinGooCMS.Utility.FileUtils.WriteFileContentAsync | ( | string | absolutePath,
 |  | string | fileContent,
 |  | bool | isAppend = false,
 |  | Encoding | encoding = null
 | ) |  |
static

异步写文件

参数
absolutePath
fileContent
isAppend
encoding

在文件 FileUtils.cs 第 74 行定义.

该类的文档由以下文件生成:
  • SinGooCMS.Utility/IO/FileUtils.cs


SinGooCMS.Utility: SinGooCMS.Utility.FtpClient类 参考

  • SinGooCMS
  • Utility
  • FtpClient
Public 成员函数 | 静态 Public 成员函数 | 属性 | Private 成员函数 | 所有成员列表
SinGooCMS.Utility.FtpClient类 参考

FTP客户端操作类 更多...

Public 成员函数

void | Download (string remoteFileName, string localFileName, Action< int, int > updateProgress=null)
从FTP服务器下载文件，指定本地路径和本地文件名 更多...
void | BrokenDownload (string remoteFileName, string localFileName, long size, Action< int, int > updateProgress=null)
从FTP服务器下载文件，指定本地路径和本地文件名（支持断点下载） 更多...
void | Download (string remoteFileName, string localFileName, bool brokenOpen, Action< int, int > updateProgress=null)
从FTP服务器下载文件，指定本地路径和本地文件名 更多...
void | UploadFile (string relativePath, string localFullPathName, Action< int, int > updateProgress=null)
上传文件到FTP服务器 更多...
bool | UploadBroken (string localFullPath, string remoteFilepath, Action< int, int > updateProgress=null)
上传文件到FTP服务器(断点续传) 更多...
long | GetFileSize (string filePath, string remoteFilepath)
获取已上传文件大小 更多...
List< string > | GetFilesDetails (string relativePath="")
获取当前目录下明细(包含文件和文件夹) 更多...
List< string > | GetFiles (string relativePath="", string mask="*.*")
获取当前目录下文件列表(仅文件) 更多...
string[] | GetDirectories (string relativePath)
获取当前目录下所有的文件夹列表(仅文件夹) 更多...
void | Delete (string filePath)
删除文件 更多...
void | RemoveDirectory (string dirPath)
删除文件夹 更多...
long | GetFileSize (string filePath)
获取指定文件大小 更多...
bool | DirectoryExist (string remoteDirPath)
判断当前目录下指定的子目录是否存在 更多...
bool | FileExist (string remoteFileName)
判断当前目录下指定的文件是否存在 更多...
void | MakeDir (string relativePath, string newDir)
创建文件夹 更多...
void | Rename (string relativePath, string currentFilename, string newFilename)
改名 更多...
void | MoveFile (string relativePath, string currentFilename, string newDirectory)
移动文件 更多...

静态 Public 成员函数

static FtpClient | GetAnonymousClient (string serverIp, bool passiveModel=false)
获取一个匿名登录的ftp客户端 更多...
static FtpClient | GetClient (string serverIp, string username, string password, bool passiveModel=false)
获取一个匿名登录的ftp客户端 更多...

属性

string | FtpServer [get, set]
Ftp服务器ip 更多...
string | Username [get, set]
Ftp 指定用户名 更多...
string | Password [get, set]
Ftp 指定用户密码 更多...
bool | IsCredential [get, set]
是否要验证用户 更多...
bool | PassiveMode [get, set]
是否被动模式,一般采用主动模式false 更多...

Private 成员函数

string | RemoveSpaces (string str)
去除空格 更多...
FtpWebRequest | GenerateFtpReq (Uri uri, string method)
创建ftp请求 更多...

详细描述

FTP客户端操作类

在文件 FtpClient.cs 第 14 行定义.

成员函数说明

void SinGooCMS.Utility.FtpClient.BrokenDownload | ( | string | remoteFileName,
 |  | string | localFileName,
 |  | long | size,
 |  | Action< int, int > | updateProgress = null
 | ) |  |

从FTP服务器下载文件，指定本地路径和本地文件名（支持断点下载）

参数
remoteFileName | 远程文件名
localFileName | 保存本地的文件名（包含路径）
size | 已下载文件流大小
updateProgress | 报告进度的处理(第一个参数：总大小，第二个参数：当前进度)

在文件 FtpClient.cs 第 164 行定义.

void SinGooCMS.Utility.FtpClient.Delete ( string filePath )

删除文件

参数
filePath

在文件 FtpClient.cs 第 531 行定义.

函数调用图:

bool SinGooCMS.Utility.FtpClient.DirectoryExist ( string remoteDirPath )

判断当前目录下指定的子目录是否存在

参数
remoteDirPath 指定的目录名

在文件 FtpClient.cs 第 589 行定义.

void SinGooCMS.Utility.FtpClient.Download | ( | string | remoteFileName,
 |  | string | localFileName,
 |  | Action< int, int > | updateProgress = null
 | ) |  |

从FTP服务器下载文件，指定本地路径和本地文件名

参数
remoteFileName | 远程文件名
localFileName | 保存本地的文件名（包含路径）
updateProgress | 报告进度的处理(第一个参数：总大小，第二个参数：当前进度)

在文件 FtpClient.cs 第 103 行定义.

void SinGooCMS.Utility.FtpClient.Download | ( | string | remoteFileName,
 |  | string | localFileName,
 |  | bool | brokenOpen,
 |  | Action< int, int > | updateProgress = null
 | ) |  |

从FTP服务器下载文件，指定本地路径和本地文件名

参数
remoteFileName | 远程文件名
localFileName | 保存本地的文件名（包含路径）
updateProgress | 报告进度的处理(第一个参数：总大小，第二个参数：当前进度)
brokenOpen | 是否断点下载：true 会在localFileName 找是否存在已经下载的文件，并计算文件流大小

在文件 FtpClient.cs 第 226 行定义.

bool SinGooCMS.Utility.FtpClient.FileExist ( string remoteFileName )

判断当前目录下指定的文件是否存在

参数
remoteFileName 远程文件名

在文件 FtpClient.cs 第 606 行定义.

FtpWebRequest SinGooCMS.Utility.FtpClient.GenerateFtpReq | ( | Uri | uri,
 |  | string | method
 | ) |  |
private

创建ftp请求

参数
uri
method
返回

在文件 FtpClient.cs 第 670 行定义.

static FtpClient SinGooCMS.Utility.FtpClient.GetAnonymousClient | ( | string | serverIp,
 |  | bool | passiveModel = false
 | ) |  |
static

获取一个匿名登录的ftp客户端

参数
serverIp | 服务器IP地址
passiveModel | usePassive=true 被动模式/usePassive=false 主动模式
返回

在文件 FtpClient.cs 第 53 行定义.

static FtpClient SinGooCMS.Utility.FtpClient.GetClient | ( | string | serverIp,
 |  | string | username,
 |  | string | password,
 |  | bool | passiveModel = false
 | ) |  |
static

获取一个匿名登录的ftp客户端

参数
serverIp | 服务器ip
username | 用户名
password | 密码
passiveModel | usePassive=true 被动模式/usePassive=false 主动模式
返回

在文件 FtpClient.cs 第 76 行定义.

string [] SinGooCMS.Utility.FtpClient.GetDirectories ( string relativePath )

获取当前目录下所有的文件夹列表(仅文件夹)

返回

在文件 FtpClient.cs 第 493 行定义.

List<string> SinGooCMS.Utility.FtpClient.GetFiles | ( | string | relativePath = "",
 |  | string | mask = "*.*"
 | ) |  |

获取当前目录下文件列表(仅文件)

返回

在文件 FtpClient.cs 第 456 行定义.

函数调用图:

List<string> SinGooCMS.Utility.FtpClient.GetFilesDetails ( string relativePath = "" )

获取当前目录下明细(包含文件和文件夹)

返回

在文件 FtpClient.cs 第 431 行定义.

函数调用图:

long SinGooCMS.Utility.FtpClient.GetFileSize | ( | string | filePath,
 |  | string | remoteFilepath
 | ) |  |

获取已上传文件大小

参数
filePath | 文件名称
remoteFilepath | 服务器文件路径
返回

在文件 FtpClient.cs 第 392 行定义.

long SinGooCMS.Utility.FtpClient.GetFileSize ( string filePath )

获取指定文件大小

参数
filePath
返回

在文件 FtpClient.cs 第 574 行定义.

函数调用图:

void SinGooCMS.Utility.FtpClient.MakeDir | ( | string | relativePath,
 |  | string | newDir
 | ) |  |

创建文件夹

参数
relativePath | 路径
newDir | 新建文件夹

在文件 FtpClient.cs 第 616 行定义.

函数调用图:

void SinGooCMS.Utility.FtpClient.MoveFile | ( | string | relativePath,
 |  | string | currentFilename,
 |  | string | newDirectory
 | ) |  |

移动文件

参数
relativePath 相对路径
currentFilename
newDirectory

在文件 FtpClient.cs 第 656 行定义.

void SinGooCMS.Utility.FtpClient.RemoveDirectory ( string dirPath )

删除文件夹

参数
dirPath

在文件 FtpClient.cs 第 550 行定义.

函数调用图:

string SinGooCMS.Utility.FtpClient.RemoveSpaces ( string str )
private

去除空格

参数
str
返回

在文件 FtpClient.cs 第 380 行定义.

void SinGooCMS.Utility.FtpClient.Rename | ( | string | relativePath,
 |  | string | currentFilename,
 |  | string | newFilename
 | ) |  |

改名

参数
relativePath 相对路径
currentFilename
newFilename

在文件 FtpClient.cs 第 635 行定义.

函数调用图:

bool SinGooCMS.Utility.FtpClient.UploadBroken | ( | string | localFullPath,
 |  | string | remoteFilepath,
 |  | Action< int, int > | updateProgress = null
 | ) |  |

上传文件到FTP服务器(断点续传)

参数
localFullPath | 本地文件全路径名称：C:脚本测试工具
remoteFilepath | 远程文件所在文件夹路径
updateProgress | 报告进度的处理(第一个参数：总大小，第二个参数：当前进度)
返回

在文件 FtpClient.cs 第 296 行定义.

void SinGooCMS.Utility.FtpClient.UploadFile | ( | string | relativePath,
 |  | string | localFullPathName,
 |  | Action< int, int > | updateProgress = null
 | ) |  |

上传文件到FTP服务器

参数
relativePath | 相对目录
localFullPathName | 本地带有完整路径的文件名
updateProgress | 报告进度的处理(第一个参数：总大小，第二个参数：当前进度)

在文件 FtpClient.cs 第 255 行定义.

函数调用图:

属性说明

string SinGooCMS.Utility.FtpClient.FtpServer
getsetprivate

Ftp服务器ip

在文件 FtpClient.cs 第 21 行定义.

bool SinGooCMS.Utility.FtpClient.IsCredential
getsetprivate

是否要验证用户

在文件 FtpClient.cs 第 36 行定义.

bool SinGooCMS.Utility.FtpClient.PassiveMode
getsetprivate

是否被动模式,一般采用主动模式false

在文件 FtpClient.cs 第 41 行定义.

string SinGooCMS.Utility.FtpClient.Password
getsetprivate

Ftp 指定用户密码

在文件 FtpClient.cs 第 31 行定义.

string SinGooCMS.Utility.FtpClient.Username
getsetprivate

Ftp 指定用户名

在文件 FtpClient.cs 第 26 行定义.

该类的文档由以下文件生成:
  • SinGooCMS.Utility/Net/FtpClient.cs


SinGooCMS.Utility: SinGooCMS.Utility.GenericAccessor< TInstance > 模板类 参考

  • SinGooCMS
  • Utility
  • GenericAccessor
Public 成员函数 | 属性 | Private 属性 | 所有成员列表
SinGooCMS.Utility.GenericAccessor< TInstance > 模板类 参考

快速访问给定类型的对象的属性值, 参照:

参见
Accessor
更多...

类 SinGooCMS.Utility.GenericAccessor< TInstance > 继承关系图:
[图例]
SinGooCMS.Utility.GenericAccessor< TInstance > 的协作图:
[图例]

Public 成员函数

bool | TryGet< TProperty > (TInstance instance, string propertyName, out TProperty value)
尝试获取指定对象的指定属性值 更多...
bool | TrySet< TProperty > (TInstance instance, string propertyName, TProperty value)
尝试设置指定对象的指定属性值 更多...

属性

object | this[TInstance instance, string propertyName] [get, set]
根据给定的对象和属性名称对属性进行读写操作 更多...
- 属性 继承自 SinGooCMS.Utility.ObjectAccessor
object | this[object instance, string propertyName] [get, set]
根据给定的对象和属性名称对属性进行读写操作 更多...
- 属性 继承自 SinGooCMS.Utility.Accessor
StringComparer | Comparer [get]
获取反射模型属性时用到的名称比较器 StringComparer 更多...
IReflect | Type [get]
当前反射的对象类型 更多...
bool | IgnoreCase [get]
获取的属性是否是忽略大小的 更多...
bool | IncludesNonPublic [get]
获取的属性是否包含非public类型的 更多...
SortedList< string, PropertyInfo > | Properties [get]
所有能获取到的属性信息 更多...

Private 属性

readonly Hashtable | _genericInstanceGettersCache
readonly Hashtable | _genericInstanceSettersCache
readonly Hashtable | _genericPropertiesGettersCache
readonly Hashtable | _genericPropertiesSettersCache

额外继承的成员函数

- 静态 Public 成员函数 继承自 SinGooCMS.Utility.Accessor
static ObjectAccessor | Build (object instance, bool ignoreCase=false, bool includeNonPublic=false)
根据给定的对象创建ObjectAccessor实例 更多...
static ObjectAccessor | Build (Type instanceType, bool ignoreCase=false, bool includeNonPublic=false)
根据给定的对象类型创建ObjectAccessor实例 更多...
static GenericAccessor< TInstance > | Build< TInstance > (bool ignoreCase=false, bool includeNonPublic=false)
根据给定的对象类型创建GenericAccessor<TInstance>实例 更多...
- Protected 成员函数 继承自 SinGooCMS.Utility.Accessor
Accessor (IReflect type, bool ignoreCase, bool includeNonPublic)
用户创建Accessor类型的实例 更多...

详细描述

快速访问给定类型的对象的属性值, 参照:

参见
Accessor
模板参数
TInstance
类型限制
TInstance : class

在文件 GenericAccessor.cs 第 13 行定义.

成员函数说明

bool SinGooCMS.Utility.GenericAccessor< TInstance >.TryGet< TProperty > | ( | TInstance | instance,
 |  | string | propertyName,
 |  | out TProperty | value
 | ) |  |

尝试获取指定对象的指定属性值

在文件 GenericAccessor.cs 第 78 行定义.

函数调用图:

bool SinGooCMS.Utility.GenericAccessor< TInstance >.TrySet< TProperty > | ( | TInstance | instance,
 |  | string | propertyName,
 |  | TProperty | value
 | ) |  |

尝试设置指定对象的指定属性值

在文件 GenericAccessor.cs 第 119 行定义.

函数调用图:

类成员变量说明

readonly Hashtable SinGooCMS.Utility.GenericAccessor< TInstance >._genericInstanceGettersCache
private

在文件 GenericAccessor.cs 第 16 行定义.

readonly Hashtable SinGooCMS.Utility.GenericAccessor< TInstance >._genericInstanceSettersCache
private

在文件 GenericAccessor.cs 第 16 行定义.

readonly Hashtable SinGooCMS.Utility.GenericAccessor< TInstance >._genericPropertiesGettersCache
private

在文件 GenericAccessor.cs 第 16 行定义.

readonly Hashtable SinGooCMS.Utility.GenericAccessor< TInstance >._genericPropertiesSettersCache
private

在文件 GenericAccessor.cs 第 16 行定义.

属性说明

object SinGooCMS.Utility.GenericAccessor< TInstance >.this[TInstance instance, string propertyName]
getset

根据给定的对象和属性名称对属性进行读写操作

在文件 GenericAccessor.cs 第 51 行定义.

该类的文档由以下文件生成:
  • SinGooCMS.Utility/Accessors/GenericAccessor.cs


SinGooCMS.Utility: SinGooCMS.Utility.HexUtils类 参考

  • SinGooCMS
  • Utility
  • HexUtils
静态 Public 成员函数 | Private 属性 | 静态 Private 属性 | 所有成员列表
SinGooCMS.Utility.HexUtils类 参考

16进制字符串之间的转换帮助类. 更多...

静态 Public 成员函数

static unsafe string | ToHex (string txt)
转换成16进制字符串 更多...
static unsafe string | ToHex (byte[] bytes)
将给定的

参见
T:byte[]

转换成16进制字符串 更多...

static unsafe string | GetStrFromHex (string hexadecimalInput)
16进制转普通文本 更多...
static unsafe byte[] | FromHex (string hexadecimalInput)
将给定的16进制字符串转为 T:byte[]. 更多...

Private 属性

const char SpaceCharacter = ' '

静态 Private 属性

static readonly int[] | ToHexTable
static readonly byte[] | FromHexTable
static readonly byte[] | FromHexTable16

详细描述

16进制字符串之间的转换帮助类.

在文件 HexUtils.cs 第 10 行定义.

成员函数说明

static unsafe byte [] SinGooCMS.Utility.HexUtils.FromHex ( string hexadecimalInput )
static

将给定的16进制字符串转为 T:byte[].

在文件 HexUtils.cs 第 68 行定义.

static unsafe string SinGooCMS.Utility.HexUtils.GetStrFromHex ( string hexadecimalInput )
static

16进制转普通文本

参数
hexadecimalInput
返回
static unsafe string SinGooCMS.Utility.HexUtils.ToHex ( string txt )
static

转换成16进制字符串

参数
txt
返回
static unsafe string SinGooCMS.Utility.HexUtils.ToHex ( byte[] bytes )
static

将给定的

参见
T:byte[]

转换成16进制字符串

在文件 HexUtils.cs 第 25 行定义.

类成员变量说明

readonly byte [] SinGooCMS.Utility.HexUtils.FromHexTable
staticprivate
初始值:
=
{
255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 0, 1,
2, 3, 4, 5, 6, 7, 8, 9, 255, 255,
255, 255, 255, 255, 255, 10, 11, 12, 13, 14,
15, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 10, 11, 12,
13, 14, 15
}

在文件 HexUtils.cs 第 174 行定义.

readonly byte [] SinGooCMS.Utility.HexUtils.FromHexTable16
staticprivate
初始值:
=
{
255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 0, 16,
32, 48, 64, 80, 96, 112, 128, 144, 255, 255,
255, 255, 255, 255, 255, 160, 176, 192, 208, 224,
240, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 160, 176, 192,
208, 224, 240
}

在文件 HexUtils.cs 第 190 行定义.

const char SinGooCMS.Utility.HexUtils.SpaceCharacter = ' '
private

在文件 HexUtils.cs 第 12 行定义.

readonly int [] SinGooCMS.Utility.HexUtils.ToHexTable
staticprivate
初始值:
=
{
3145776, 3211312, 3276848, 3342384, 3407920, 3473456, 3538992, 3604528, 3670064, 3735600,
4259888, 4325424, 4390960, 4456496, 4522032, 4587568, 3145777, 3211313, 3276849, 3342385,
3407921, 3473457, 3538993, 3604529, 3670065, 3735601, 4259889, 4325425, 4390961, 4456497,
4522033, 4587569, 3145778, 3211314, 3276850, 3342386, 3407922, 3473458, 3538994, 3604530,
3670066, 3735602, 4259890, 4325426, 4390962, 4456498, 4522034, 4587570, 3145779, 3211315,
3276851, 3342387, 3407923, 3473459, 3538995, 3604531, 3670067, 3735603, 4259891, 4325427,
4390963, 4456499, 4522035, 4587571, 3145780, 3211316, 3276852, 3342388, 3407924, 3473460,
3538996, 3604532, 3670068, 3735604, 4259892, 4325428, 4390964, 4456500, 4522036, 4587572,
3145781, 3211317, 3276853, 3342389, 3407925, 3473461, 3538997, 3604533, 3670069, 3735605,
4259893, 4325429, 4390965, 4456501, 4522037, 4587573, 3145782, 3211318, 3276854, 3342390,
3407926, 3473462, 3538998, 3604534, 3670070, 3735606, 4259894, 4325430, 4390966, 4456502,
4522038, 4587574, 3145783, 3211319, 3276855, 3342391, 3407927, 3473463, 3538999, 3604535,
3670071, 3735607, 4259895, 4325431, 4390967, 4456503, 4522039, 4587575, 3145784, 3211320,
3276856, 3342392, 3407928, 3473464, 3539000, 3604536, 3670072, 3735608, 4259896, 4325432,
4390968, 4456504, 4522040, 4587576, 3145785, 3211321, 3276857, 3342393, 3407929, 3473465,
3539001, 3604537, 3670073, 3735609, 4259897, 4325433, 4390969, 4456505, 4522041, 4587577,
3145793, 3211329, 3276865, 3342401, 3407937, 3473473, 3539009, 3604545, 3670081, 3735617,
4259905, 4325441, 4390977, 4456513, 4522049, 4587585, 3145794, 3211330, 3276866, 3342402,
3407938, 3473474, 3539010, 3604546, 3670082, 3735618, 4259906, 4325442, 4390978, 4456514,
4522050, 4587586, 3145795, 3211331, 3276867, 3342403, 3407939, 3473475, 3539011, 3604547,
3670083, 3735619, 4259907, 4325443, 4390979, 4456515, 4522051, 4587587, 3145796, 3211332,
3276868, 3342404, 3407940, 3473476, 3539012, 3604548, 3670084, 3735620, 4259908, 4325444,
4390980, 4456516, 4522052, 4587588, 3145797, 3211333, 3276869, 3342405, 3407941, 3473477,
3539013, 3604549, 3670085, 3735621, 4259909, 4325445, 4390981, 4456517, 4522053, 4587589,
3145798, 3211334, 3276870, 3342406, 3407942, 3473478, 3539014, 3604550, 3670086, 3735622,
4259910, 4325446, 4390982, 4456518, 4522054, 4587590
}

在文件 HexUtils.cs 第 141 行定义.

该类的文档由以下文件生成:
  • SinGooCMS.Utility/Text/HexUtils.cs


SinGooCMS.Utility: SinGooCMS.Utility.IdCardUtils类 参考

  • SinGooCMS
  • Utility
  • IdCardUtils
静态 Public 成员函数 | Public 属性 | 属性 | Private 成员函数 | 所有成员列表
SinGooCMS.Utility.IdCardUtils类 参考

身份证工具 更多...

静态 Public 成员函数

static IdCardUtils Parse (string cardno)
解析身份证号 更多...

Public 属性

string RegionCode => CardNo.Substring(0, 6)
行政区划(标准县级: 6位) 更多...

属性

string | CardNo [get, set]
身份证号 更多...
string | Sex [get, set]
性别 更多...
int | Age [get, set]
年龄 更多...
DateTime | BirthDay [get, set]
生日 更多...

Private 成员函数

IdCardUtils ()
void | parseSex ()
获取性别 更多...
void | parseAge ()
获取年龄 更多...
void | parseBrithday ()
解析生日 更多...

详细描述

身份证工具

使得方法

IdCardUtils.Parse('xxxx').Sex

在文件 IdCard.cs 第 15 行定义.

构造及析构函数说明

SinGooCMS.Utility.IdCardUtils.IdCardUtils ( )
private

在文件 IdCard.cs 第 46 行定义.

成员函数说明

static IdCardUtils SinGooCMS.Utility.IdCardUtils.Parse ( string cardno )
static

解析身份证号

参数
cardno
返回

在文件 IdCard.cs 第 53 行定义.

void SinGooCMS.Utility.IdCardUtils.parseAge ( )
private

获取年龄

返回
年龄

在文件 IdCard.cs 第 85 行定义.

void SinGooCMS.Utility.IdCardUtils.parseBrithday ( )
private

解析生日

返回

在文件 IdCard.cs 第 102 行定义.

void SinGooCMS.Utility.IdCardUtils.parseSex ( )
private

获取性别

返回
1:男 2:女

在文件 IdCard.cs 第 71 行定义.

类成员变量说明

string SinGooCMS.Utility.IdCardUtils.RegionCode => CardNo.Substring(0, 6)

行政区划(标准县级: 6位)

在文件 IdCard.cs 第 27 行定义.

属性说明

int SinGooCMS.Utility.IdCardUtils.Age
getset

年龄

在文件 IdCard.cs 第 37 行定义.

DateTime SinGooCMS.Utility.IdCardUtils.BirthDay
getset

生日

在文件 IdCard.cs 第 42 行定义.

string SinGooCMS.Utility.IdCardUtils.CardNo
getset

身份证号

在文件 IdCard.cs 第 22 行定义.

string SinGooCMS.Utility.IdCardUtils.Sex
getset

性别

在文件 IdCard.cs 第 32 行定义.

该类的文档由以下文件生成:
  • SinGooCMS.Utility/Data/IdCard.cs


SinGooCMS.Utility: SinGooCMS.Utility.IISUtils类 参考

  • SinGooCMS
  • Utility
  • IISUtils
静态 Public 成员函数 | 所有成员列表
SinGooCMS.Utility.IISUtils类 参考

IIS操作 更多...

静态 Public 成员函数

static bool | CreateSite (string siteName, string bindingInfo, string physicalPath)
在本机的IIS创建Web网站 更多...
static bool | CreateSite (string siteName, string protocol, string bindingInformation, string physicalPath, bool createAppPool, string appPoolName, ProcessModelIdentityType identityType, string appPoolUserName, string appPoolPassword, ManagedPipelineMode appPoolPipelineMode, string managedRuntimeVersion)
在本机的IIS创建Web网站 更多...
static bool | DeleteSite (string siteName, Boolean isAppPool=true)
删除网站包括应用程序池 更多...
static bool | DeletePool (string appPoolName)
删除应用程序池 更多...
static bool | AddDefaultDocument (string siteName, string defaultDocName)
添加默认文档 更多...
static bool | DeleteDefaultDocument (string siteName, string defaultDocName)
删除默认文档 更多...
static bool | CreateVDir (string siteName, string vDirName, string physicalPath)
添加虚拟目录 更多...
static bool | DeleteVDir (string siteName, string vDirName)
删除虚拟目录 更多...
static bool | PoolsStart (string poolName)
启动应用程序池 更多...
static bool | PoolsStop (string poolName)
暂停应用程序池 更多...
static bool | Start (string siteName)
启动网站 更多...
static bool | Stop (string siteName)
暂停网站 更多...
static Site | GetSiteInfo (string siteName)
根据网站名获取网站信息 更多...
static SiteCollection | GetSiteList ()
获取所有的网站数据 更多...
static bool | AddHostBinding (string siteName, string ip, string port, string domain, string bindingProtocol="http")
添加绑定信息 更多...
static bool | DeleteHostBinding (string siteName, string ip, string port, string domain)
删除绑定信息 更多...

详细描述

IIS操作

在文件 IISUtils.cs 第 11 行定义.

成员函数说明

static bool SinGooCMS.Utility.IISUtils.AddDefaultDocument | ( | string | siteName,
 |  | string | defaultDocName
 | ) |  |
static

添加默认文档

参数
siteName | 网站
defaultDocName | 默认文档名
返回
成功返回True，失败返回false

在文件 IISUtils.cs 第 142 行定义.

static bool SinGooCMS.Utility.IISUtils.AddHostBinding | ( | string | siteName,
 |  | string | ip,
 |  | string | port,
 |  | string | domain,
 |  | string | bindingProtocol = "http"
 | ) |  |
static

添加绑定信息

参数
siteName | 网站名
ip | ip
port | port
domain | domain
bindingProtocol | 协议头如 http/https默认为http
返回
成功返回True，失败返回false

在文件 IISUtils.cs 第 404 行定义.

static bool SinGooCMS.Utility.IISUtils.CreateSite | ( | string | siteName,
 |  | string | bindingInfo,
 |  | string | physicalPath
 | ) |  |
static

在本机的IIS创建Web网站

参数
siteName | 网站名
bindingInfo | host

"*:80:myhost.com"

参数
physicalPath 网站路径
返回
成功返回True，失败返回false

在文件 IISUtils.cs 第 21 行定义.

static bool SinGooCMS.Utility.IISUtils.CreateSite | ( | string | siteName,
 |  | string | protocol,
 |  | string | bindingInformation,
 |  | string | physicalPath,
 |  | bool | createAppPool,
 |  | string | appPoolName,
 |  | ProcessModelIdentityType | identityType,
 |  | string | appPoolUserName,
 |  | string | appPoolPassword,
 |  | ManagedPipelineMode | appPoolPipelineMode,
 |  | string | managedRuntimeVersion
 | ) |  |
static

在本机的IIS创建Web网站

参数
siteName | 网站名
protocol | http头
bindingInformation | 网站例如<example>"*:80:www.sufeinet.com"
physicalPath | 网站的路径
createAppPool | 是否创建应用程序程序池
appPoolName | 应用程序名
identityType | 标识
appPoolUserName | 用户名没有时用户名为Null即可
appPoolPassword | 密码
appPoolPipelineMode | 模式，经典还是集成
managedRuntimeVersion | .net版本
返回
成功返回True，失败返回false

在文件 IISUtils.cs 第 40 行定义.

static bool SinGooCMS.Utility.IISUtils.CreateVDir | ( | string | siteName,
 |  | string | vDirName,
 |  | string | physicalPath
 | ) |  |
static

添加虚拟目录

参数
siteName | 网站名
vDirName | 目录名
physicalPath | 对应的文件夹路径
返回
成功返回True，失败返回false

在文件 IISUtils.cs 第 230 行定义.

static bool SinGooCMS.Utility.IISUtils.DeleteDefaultDocument | ( | string | siteName,
 |  | string | defaultDocName
 | ) |  |
static

删除默认文档

参数
siteName | 网站
defaultDocName | 默认文档名
返回
成功返回True，失败返回false

在文件 IISUtils.cs 第 180 行定义.

static bool SinGooCMS.Utility.IISUtils.DeleteHostBinding | ( | string | siteName,
 |  | string | ip,
 |  | string | port,
 |  | string | domain
 | ) |  |
static

删除绑定信息

参数
siteName | 网站名
ip | ip
port | port
domain | domain
返回
成功返回True，失败返回false

在文件 IISUtils.cs 第 430 行定义.

static bool SinGooCMS.Utility.IISUtils.DeletePool ( string appPoolName )
static

删除应用程序池

参数
appPoolName 应用程序池名
返回
成功返回True，失败返回false

在文件 IISUtils.cs 第 116 行定义.

static bool SinGooCMS.Utility.IISUtils.DeleteSite | ( | string | siteName,
 |  | Boolean | isAppPool = true
 | ) |  |
static

删除网站包括应用程序池

参数
siteName | 网站名
isAppPool | 是否删除应用程序池默认为删除
返回
成功返回True，失败返回false

在文件 IISUtils.cs 第 86 行定义.

static bool SinGooCMS.Utility.IISUtils.DeleteVDir | ( | string | siteName,
 |  | string | vDirName
 | ) |  |
static

删除虚拟目录

参数
siteName | 网站名
vDirName | 目录名
返回
成功返回True，失败返回false

在文件 IISUtils.cs 第 250 行定义.

static Site SinGooCMS.Utility.IISUtils.GetSiteInfo ( string siteName )
static

根据网站名获取网站信息

参数
siteName
返回

在文件 IISUtils.cs 第 374 行定义.

static SiteCollection SinGooCMS.Utility.IISUtils.GetSiteList ( )
static

获取所有的网站数据

返回
SiteCollection

在文件 IISUtils.cs 第 385 行定义.

static bool SinGooCMS.Utility.IISUtils.PoolsStart ( string poolName )
static

启动应用程序池

参数
poolName 应用程序池名
返回
成功返回True，失败返回false

在文件 IISUtils.cs 第 272 行定义.

static bool SinGooCMS.Utility.IISUtils.PoolsStop ( string poolName )
static

暂停应用程序池

参数
poolName 应用程序池名
返回
成功返回True，失败返回false

在文件 IISUtils.cs 第 296 行定义.

static bool SinGooCMS.Utility.IISUtils.Start ( string siteName )
static

启动网站

参数
siteName 网站名
返回
成功返回True，失败返回false

在文件 IISUtils.cs 第 323 行定义.

static bool SinGooCMS.Utility.IISUtils.Stop ( string siteName )
static

暂停网站

参数
siteName 网站名
返回
成功返回True，失败返回false

在文件 IISUtils.cs 第 347 行定义.

该类的文档由以下文件生成:
  • SinGooCMS.Utility/System/IISUtils.cs


SinGooCMS.Utility: SinGooCMS.Utility.ImageUtils类 参考

  • SinGooCMS
  • Utility
  • ImageUtils
静态 Public 成员函数 | 所有成员列表
SinGooCMS.Utility.ImageUtils类 参考

图片处理 更多...

静态 Public 成员函数

static Image | ReadFileToImage (string filePath)
文件转Image 更多...
static Bitmap | ReadFileBitmap (string filePath)
文件转Bitmap对象 更多...
static Image | Base64StrToImage (string base64String)
将Base64字符串转换为图片 更多...
static string | ImageToBase64 (string fileFullName)
Image转成base64字符串 更多...
static void | MakeThumbnail (string originalFileName, int width, int height, string thumbnailFileName="", ThumbnailCutMode mode=ThumbnailCutMode.Cut)
生成缩略图 更多...
static string | AddImageWatermark (string originalImagePath, string watermarkImage, WatermarkPosition watermarkPosition=WatermarkPosition.MiddleCenter, float alpha=0.5f, string watermarkFilePath="")
生成图片水印 更多...
static string | AddTextWatermark (string originalImagePath, string watermarkText, string fontColor="#ff0000", string fontFamily="黑体", WatermarkPosition watermarkPosition=WatermarkPosition.MiddleCenter, float alpha=0.2f, string watermarkFilePath="")
生成文字水印 更多...
static string | AddTextWatermark (string originalImagePath, string watermarkText, int fontSize, string fontColor, string fontFamily, WatermarkPosition watermarkPosition=WatermarkPosition.MiddleCenter, float alpha=0.5f, string watermarkFilePath="")
生成文字水印 更多...
static string | AddWatermark (string originalImagePath, string watermarkType, string watermarkImage, string watermarkText, int fontSize, string fontColor, string fontFamily, WatermarkPosition watermarkPosition, float alpha, string watermarkFilePath="")
生成水印图 更多...

详细描述

图片处理

在文件 ImageUtils.cs 第 14 行定义.

成员函数说明

static string SinGooCMS.Utility.ImageUtils.AddImageWatermark | ( | string | originalImagePath,
 |  | string | watermarkImage,
 |  | WatermarkPosition | watermarkPosition = WatermarkPosition.MiddleCenter,
 |  | float | alpha = 0.5f,
 |  | string | watermarkFilePath = ""
 | ) |  |
static

生成图片水印

参数
originalImagePath | 原图文件路径
watermarkImage | 水印图文件路径
watermarkPosition | 水印位置，默认正中间
alpha | 透明度，默认0.5
watermarkFilePath | 水印图片保存路径，不填写则自动创建
返回
static string SinGooCMS.Utility.ImageUtils.AddTextWatermark | ( | string | originalImagePath,
 |  | string | watermarkText,
 |  | string | fontColor = "#ff0000",
 |  | string | fontFamily = "黑体",
 |  | WatermarkPosition | watermarkPosition = WatermarkPosition.MiddleCenter,
 |  | float | alpha = 0.2f,
 |  | string | watermarkFilePath = ""
 | ) |  |
static

生成文字水印

参数
originalImagePath | 原图文件路径
watermarkText | 水印文本
fontColor | 文字颜色
fontFamily | 文本字体
watermarkPosition | 水印位置
alpha | 透明度
watermarkFilePath | 水印图片保存路径，不填写则自动创建
返回

在文件 ImageUtils.cs 第 112 行定义.

static string SinGooCMS.Utility.ImageUtils.AddTextWatermark | ( | string | originalImagePath,
 |  | string | watermarkText,
 |  | int | fontSize,
 |  | string | fontColor,
 |  | string | fontFamily,
 |  | WatermarkPosition | watermarkPosition = WatermarkPosition.MiddleCenter,
 |  | float | alpha = 0.5f,
 |  | string | watermarkFilePath = ""
 | ) |  |
static

生成文字水印

参数
originalImagePath | 原图文件路径
watermarkText | 水印文本
fontSize | 文字大小
fontColor | 文字颜色
fontFamily | 文本字体
watermarkPosition | 水印位置
alpha | 透明度
watermarkFilePath | 水印图片保存路径，不填写则自动创建
返回
static string SinGooCMS.Utility.ImageUtils.AddWatermark | ( | string | originalImagePath,
 |  | string | watermarkType,
 |  | string | watermarkImage,
 |  | string | watermarkText,
 |  | int | fontSize,
 |  | string | fontColor,
 |  | string | fontFamily,
 |  | WatermarkPosition | watermarkPosition,
 |  | float | alpha,
 |  | string | watermarkFilePath = ""
 | ) |  |
static

生成水印图

参数
originalImagePath | 源图绝对路径
watermarkType | 水印类型:文字水印,图片水印
watermarkImage | 水印图绝对路径
watermarkText | 水印文字
fontSize | 字体大小
fontColor | 字体颜色
fontFamily | 字体
watermarkPosition | 水印位置
alpha | 透明度
watermarkFilePath | 水印图片保存路径，不填写则自动创建
返回

在文件 ImageUtils.cs 第 154 行定义.

static Image SinGooCMS.Utility.ImageUtils.Base64StrToImage ( string base64String )
static

将Base64字符串转换为图片

参数
base64String
返回

在文件 ImageUtils.cs 第 43 行定义.

static string SinGooCMS.Utility.ImageUtils.ImageToBase64 ( string fileFullName )
static

Image转成base64字符串

参数
fileFullName

在文件 ImageUtils.cs 第 57 行定义.

static void SinGooCMS.Utility.ImageUtils.MakeThumbnail | ( | string | originalFileName,
 |  | int | width,
 |  | int | height,
 |  | string | thumbnailFileName = "",
 |  | ThumbnailCutMode | mode = ThumbnailCutMode.Cut
 | ) |  |
static

生成缩略图

参数
originalFileName | 原图文件
width | 缩略图宽度
height | 缩略图高度
thumbnailFileName | 缩略图文件（物理路径）
mode | 生成缩略图的方式

在文件 ImageUtils.cs 第 74 行定义.

static Bitmap SinGooCMS.Utility.ImageUtils.ReadFileBitmap ( string filePath )
static

文件转Bitmap对象

参数
filePath
返回
static Image SinGooCMS.Utility.ImageUtils.ReadFileToImage ( string filePath )
static

文件转Image

参数
filePath
返回
该类的文档由以下文件生成:
  • SinGooCMS.Utility/Media/ImageUtils.cs


SinGooCMS.Utility: SinGooCMS.Utility.IPAreaInfo类 参考

  • SinGooCMS
  • Utility
  • IPAreaInfo
Public 成员函数 | 属性 | 所有成员列表
SinGooCMS.Utility.IPAreaInfo类 参考

IP地理位置信息 更多...

Public 成员函数

override string ToString ()
重写ToString 更多...

属性

string | Country [get, set]
国家 更多...
string | Province [get, set]
省 更多...
string | City [get, set]
市 更多...
string | County [get, set]
区 更多...

详细描述

IP地理位置信息

在文件 IPUtils.cs 第 133 行定义.

成员函数说明

override string SinGooCMS.Utility.IPAreaInfo.ToString ( )

重写ToString

返回

在文件 IPUtils.cs 第 156 行定义.

属性说明

string SinGooCMS.Utility.IPAreaInfo.City
getset

市

在文件 IPUtils.cs 第 146 行定义.

string SinGooCMS.Utility.IPAreaInfo.Country
getset

国家

在文件 IPUtils.cs 第 138 行定义.

string SinGooCMS.Utility.IPAreaInfo.County
getset

区

在文件 IPUtils.cs 第 150 行定义.

string SinGooCMS.Utility.IPAreaInfo.Province
getset

省

在文件 IPUtils.cs 第 142 行定义.

该类的文档由以下文件生成:
  • SinGooCMS.Utility/Net/IPUtils.cs


SinGooCMS.Utility: SinGooCMS.Utility.IPScanner类 参考

  • SinGooCMS
  • Utility
  • IPScanner
Public 成员函数 | 属性 | Private 成员函数 | Private 属性 | 所有成员列表
SinGooCMS.Utility.IPScanner类 参考

读取纯真IP数据库，定位IP地址 更多...

Public 成员函数

IPScanner (string dbPath="/ipdata/qqwry.dat")
IP位置查找器 更多...
string | IPLocation (string ip="", string dataPath="")
IP定位 更多...
bool | IsChineseIP (string ip)
是否国内IP，需要调用QQ纯真数据库，路径App_Data/qqwry.dat 更多...

属性

string | DataPath [set]
纯真数据库地址：绝对路径 更多...
string | IP [set]
IP地址 更多...
string | Country [get]
国家 更多...
string | Local [get]
地区 更多...
string | ErrMsg [get]
错误信息 更多...

Private 成员函数

int | QQwry ()
long | IpToInt (string ip)
string | IntToIP (long ip_Int)
long | GetStartIp (long recNO)
long | GetEndIp ()
string | GetCountry ()
string | GetFlagStr (long offSet)
string | GetStr ()

Private 属性

string | dataPath
string | ip
string | country
string | local
long | firstStartIp = 0
long | lastStartIp = 0
FileStream | objfs = null
long | startIp = 0
long | endIp = 0
int | countryFlag = 0
long | endIpOff = 0
string | errMsg = null

详细描述

读取纯真IP数据库，定位IP地址

在文件 IPScanner.cs 第 11 行定义.

构造及析构函数说明

SinGooCMS.Utility.IPScanner.IPScanner ( string dbPath = "/ipdata/qqwry.dat" )

IP位置查找器

参数
dbPath 纯真数据库地址，默认是：/ipdata/qqwry.dat

在文件 IPScanner.cs 第 35 行定义.

成员函数说明

string SinGooCMS.Utility.IPScanner.GetCountry ( )
private

在文件 IPScanner.cs 第 233 行定义.

long SinGooCMS.Utility.IPScanner.GetEndIp ( )
private

在文件 IPScanner.cs 第 220 行定义.

string SinGooCMS.Utility.IPScanner.GetFlagStr ( long offSet )
private

在文件 IPScanner.cs 第 252 行定义.

long SinGooCMS.Utility.IPScanner.GetStartIp ( long recNO )
private

在文件 IPScanner.cs 第 205 行定义.

string SinGooCMS.Utility.IPScanner.GetStr ( )
private

在文件 IPScanner.cs 第 284 行定义.

string SinGooCMS.Utility.IPScanner.IntToIP ( long ip_Int )
private

在文件 IPScanner.cs 第 184 行定义.

string SinGooCMS.Utility.IPScanner.IPLocation | ( | string | ip = "",
 |  | string | dataPath = ""
 | ) |  |

IP定位

参数
ip
dataPath
返回

在文件 IPScanner.cs 第 320 行定义.

这是这个函数的调用关系图:

long SinGooCMS.Utility.IPScanner.IpToInt ( string ip )
private

在文件 IPScanner.cs 第 165 行定义.

bool SinGooCMS.Utility.IPScanner.IsChineseIP ( string ip )

是否国内IP，需要调用QQ纯真数据库，路径App_Data/qqwry.dat

参数
ip
返回

在文件 IPScanner.cs 第 346 行定义.

int SinGooCMS.Utility.IPScanner.QQwry ( )
private

在文件 IPScanner.cs 第 82 行定义.

类成员变量说明

string SinGooCMS.Utility.IPScanner.country
private

在文件 IPScanner.cs 第 16 行定义.

int SinGooCMS.Utility.IPScanner.countryFlag = 0
private

在文件 IPScanner.cs 第 24 行定义.

string SinGooCMS.Utility.IPScanner.dataPath
private

在文件 IPScanner.cs 第 14 行定义.

long SinGooCMS.Utility.IPScanner.endIp = 0
private

在文件 IPScanner.cs 第 23 行定义.

long SinGooCMS.Utility.IPScanner.endIpOff = 0
private

在文件 IPScanner.cs 第 25 行定义.

string SinGooCMS.Utility.IPScanner.errMsg = null
private

在文件 IPScanner.cs 第 26 行定义.

long SinGooCMS.Utility.IPScanner.firstStartIp = 0
private

在文件 IPScanner.cs 第 19 行定义.

string SinGooCMS.Utility.IPScanner.ip
private

在文件 IPScanner.cs 第 15 行定义.

long SinGooCMS.Utility.IPScanner.lastStartIp = 0
private

在文件 IPScanner.cs 第 20 行定义.

string SinGooCMS.Utility.IPScanner.local
private

在文件 IPScanner.cs 第 17 行定义.

FileStream SinGooCMS.Utility.IPScanner.objfs = null
private

在文件 IPScanner.cs 第 21 行定义.

long SinGooCMS.Utility.IPScanner.startIp = 0
private

在文件 IPScanner.cs 第 22 行定义.

属性说明

string SinGooCMS.Utility.IPScanner.Country
get

国家

在文件 IPScanner.cs 第 62 行定义.

string SinGooCMS.Utility.IPScanner.DataPath
set

纯真数据库地址：绝对路径

在文件 IPScanner.cs 第 48 行定义.

string SinGooCMS.Utility.IPScanner.ErrMsg
get

错误信息

在文件 IPScanner.cs 第 76 行定义.

string SinGooCMS.Utility.IPScanner.IP
set

IP地址

在文件 IPScanner.cs 第 55 行定义.

string SinGooCMS.Utility.IPScanner.Local
get

地区

在文件 IPScanner.cs 第 69 行定义.

该类的文档由以下文件生成:
  • SinGooCMS.Utility/Net/IPScanner.cs


SinGooCMS.Utility: SinGooCMS.Utility.IPUtils类 参考

  • SinGooCMS
  • Utility
  • IPUtils
静态 Public 成员函数 | 所有成员列表
SinGooCMS.Utility.IPUtils类 参考

IP工具 更多...

静态 Public 成员函数

static string | GetIP ()
获得当前页面客户端的IP 更多...
static string | GetIPAreaStr (string ip="")
IP定位信息 更多...
static bool | IsInIPDuan (string strCurrIP, string strBeginIP, string strEndIP)
检测当前ip是否在指定的ip段中 更多...
static int[] | IP2IntArr (string strIP)
将ip地址转成整形数组 更多...

详细描述

IP工具

在文件 IPUtils.cs 第 13 行定义.

成员函数说明

static string SinGooCMS.Utility.IPUtils.GetIP ( )
static

获得当前页面客户端的IP

返回
当前页面客户端的IP

在文件 IPUtils.cs 第 19 行定义.

static string SinGooCMS.Utility.IPUtils.GetIPAreaStr ( string ip = "" )
static

IP定位信息

参数
ip 不传IP，默认是当前的IP
返回

在文件 IPUtils.cs 第 60 行定义.

函数调用图:

static int [] SinGooCMS.Utility.IPUtils.IP2IntArr ( string strIP )
static

将ip地址转成整形数组

参数
strIP
返回

在文件 IPUtils.cs 第 103 行定义.

static bool SinGooCMS.Utility.IPUtils.IsInIPDuan | ( | string | strCurrIP,
 |  | string | strBeginIP,
 |  | string | strEndIP
 | ) |  |
static

检测当前ip是否在指定的ip段中

参数
strCurrIP | 当前IP
strBeginIP | 起始IP
strEndIP | 终止IP
返回

在文件 IPUtils.cs 第 77 行定义.

该类的文档由以下文件生成:
  • SinGooCMS.Utility/Net/IPUtils.cs


SinGooCMS.Utility: SinGooCMS.Utility.JsonFileUtils类 参考

  • SinGooCMS
  • Utility
  • JsonFileUtils
静态 Public 成员函数 | 静态 Private 属性 | 所有成员列表
SinGooCMS.Utility.JsonFileUtils类 参考

JSON文件工具 更多...

静态 Public 成员函数

static T | Read< T > (string filePath)
从文件中读对象 更多...
static List< T > | ReadList< T > (string filePath)
从文件中导出对象列表 更多...
static void | Save< T > (T configModel, string filePath)
序列化对象到文件中(线程安全=线程同步) 更多...
static void | Save< T > (List< T > lst, string filePath)
序列化对象到文件中(线程安全=线程同步) 更多...

静态 Private 属性

static readonly object locker = new object()

详细描述

JSON文件工具

在文件 JsonFileUtils.cs 第 12 行定义.

成员函数说明

static T SinGooCMS.Utility.JsonFileUtils.Read< T > ( string filePath )
static

从文件中读对象

模板参数
T
参数
filePath 全文件路径，包括文件名
返回
类型限制
T : class
T : new()

在文件 JsonFileUtils.cs 第 22 行定义.

static List<T> SinGooCMS.Utility.JsonFileUtils.ReadList< T > ( string filePath )
static

从文件中导出对象列表

模板参数
T
参数
filePath 全文件路径，包括文件名
返回
类型限制
T : class
T : new()

在文件 JsonFileUtils.cs 第 47 行定义.

static void SinGooCMS.Utility.JsonFileUtils.Save< T > | ( | T | configModel,
 |  | string | filePath
 | ) |  |
static

序列化对象到文件中(线程安全=线程同步)

模板参数
T
参数
configModel
filePath

在文件 JsonFileUtils.cs 第 77 行定义.

static void SinGooCMS.Utility.JsonFileUtils.Save< T > | ( | List< T > | lst,
 |  | string | filePath
 | ) |  |
static

序列化对象到文件中(线程安全=线程同步)

模板参数
T
参数
lst
filePath

在文件 JsonFileUtils.cs 第 92 行定义.

类成员变量说明

readonly object SinGooCMS.Utility.JsonFileUtils.locker = new object()
staticprivate

在文件 JsonFileUtils.cs 第 70 行定义.

该类的文档由以下文件生成:
  • SinGooCMS.Utility/IO/JsonFileUtils.cs


SinGooCMS.Utility: SinGooCMS.Utility.LibInvoker类 参考

  • SinGooCMS
  • Utility
  • LibInvoker
Public 成员函数 | 静态 Public 成员函数 | Private 成员函数 | 静态 Private 成员函数 | Private 属性 | 所有成员列表
SinGooCMS.Utility.LibInvoker类 参考

非托管方法调用 更多...

Public 成员函数

LibInvoker (string DLLPath)
构造方法 更多...
Delegate Invoke (string APIName, Type t)
利用LoadLibrary方式，动态显示调用非托管DLL函数。 更多...

静态 Public 成员函数

static Object Invoke (string DLLPath, string dllName, string className, string methodName, params object[] methodParam)
利用反射技术，动态显示调用托管DLL函数。 更多...

Private 成员函数

~LibInvoker ()
释放 更多...

静态 Private 成员函数

static IntPtr | LoadLibrary (string path)
static IntPtr | GetProcAddress (IntPtr lib, string funcName)
static bool | FreeLibrary (IntPtr lib)

Private 属性

IntPtr hLib

详细描述

非托管方法调用

在文件 LibInvoker.cs 第 12 行定义.

构造及析构函数说明

SinGooCMS.Utility.LibInvoker.LibInvoker ( string DLLPath )

构造方法

参数
DLLPath

在文件 LibInvoker.cs 第 28 行定义.

SinGooCMS.Utility.LibInvoker.~LibInvoker ( )
private

释放

在文件 LibInvoker.cs 第 36 行定义.

成员函数说明

static bool SinGooCMS.Utility.LibInvoker.FreeLibrary ( IntPtr lib )
staticprivate
static IntPtr SinGooCMS.Utility.LibInvoker.GetProcAddress | ( | IntPtr | lib,
 |  | string | funcName
 | ) |  |
staticprivate
Delegate SinGooCMS.Utility.LibInvoker.Invoke | ( | string | APIName,
 |  | Type | t
 | ) |  |

利用LoadLibrary方式，动态显示调用非托管DLL函数。

参数
APIName
t
返回

在文件 LibInvoker.cs 第 47 行定义.

static Object SinGooCMS.Utility.LibInvoker.Invoke | ( | string | DLLPath,
 |  | string | dllName,
 |  | string | className,
 |  | string | methodName,
 |  | params object[] | methodParam
 | ) |  |
static

利用反射技术，动态显示调用托管DLL函数。

参数
DLLPath
dllName
className
methodName
methodParam
返回

在文件 LibInvoker.cs 第 62 行定义.

static IntPtr SinGooCMS.Utility.LibInvoker.LoadLibrary ( string path )
staticprivate

类成员变量说明

IntPtr SinGooCMS.Utility.LibInvoker.hLib
private

在文件 LibInvoker.cs 第 23 行定义.

该类的文档由以下文件生成:
  • SinGooCMS.Utility/Reflection/LibInvoker.cs


SinGooCMS.Utility: SinGooCMS.Utility.MailConfig类 参考

  • SinGooCMS
  • Utility
  • MailConfig
属性 | 所有成员列表
SinGooCMS.Utility.MailConfig类 参考

邮件服务配置 更多...

属性

string | ServMailSMTP [get, set]
SMTP服务器 更多...
int | ServMailPort [get, set]
SMTP端口 默认25，为了保证安全，建议启用465等SSL端口 更多...
string | ServMailAccount [get, set]
邮箱账户 更多...
string | ServMailUserName [get, set]
邮箱用户名 更多...
string | ServMailUserPwd [get, set]
邮箱密码 更多...
string | FromDisplayName [get, set]
发送方别名，这时使用站点名称 更多...
bool | ServMailIsSSL [get, set]
是否启用SSL，启用用使用465端口/否则使用25端口 更多...

详细描述

邮件服务配置

在文件 MailUtils.cs 第 169 行定义.

属性说明

string SinGooCMS.Utility.MailConfig.FromDisplayName
getset

发送方别名，这时使用站点名称

在文件 MailUtils.cs 第 194 行定义.

string SinGooCMS.Utility.MailConfig.ServMailAccount
getset

邮箱账户

在文件 MailUtils.cs 第 182 行定义.

bool SinGooCMS.Utility.MailConfig.ServMailIsSSL
getset

是否启用SSL，启用用使用465端口/否则使用25端口

在文件 MailUtils.cs 第 198 行定义.

int SinGooCMS.Utility.MailConfig.ServMailPort
getset

SMTP端口 默认25，为了保证安全，建议启用465等SSL端口

在文件 MailUtils.cs 第 178 行定义.

string SinGooCMS.Utility.MailConfig.ServMailSMTP
getset

SMTP服务器

在文件 MailUtils.cs 第 174 行定义.

string SinGooCMS.Utility.MailConfig.ServMailUserName
getset

邮箱用户名

在文件 MailUtils.cs 第 186 行定义.

string SinGooCMS.Utility.MailConfig.ServMailUserPwd
getset

邮箱密码

在文件 MailUtils.cs 第 190 行定义.

该类的文档由以下文件生成:
  • SinGooCMS.Utility/Net/MailUtils.cs


SinGooCMS.Utility: SinGooCMS.Utility.MailUtils类 参考

  • SinGooCMS
  • Utility
  • MailUtils
Public 成员函数 | 静态 Public 成员函数 | Public 属性 | 属性 | Private 成员函数 | 所有成员列表
SinGooCMS.Utility.MailUtils类 参考

更多...

Public 成员函数

async Task<(bool isSuccess, string errMsg)> SendEmailAsync (string rctMail, string subject, string body)
使用SMTP协议，异步发送邮件 更多...

静态 Public 成员函数

static MailUtils Create (MailConfig mailConfig)
创建邮件客户端 更多...

Public 属性

bool isSuccess
使用SMTP协议，异步发送邮件 更多...

属性

MailConfig Config [get, set]

Private 成员函数

bool string errMsg SendEmail (string rctMail, string subject, string body)

详细描述

邮件发送工具
来自:

var result = await MailUtils.Create(new MailConfig()
{
ServMailSMTP = "smtp.qq.com",
ServMailPort = 465,
ServMailAccount = "16826375@qq.com",
ServMailUserName = "16826375",
ServMailUserPwd = "这里是密码",
ServMailIsSSL = true
})
.SendEmailAsync("16826375@qq.com", "测试标题", "测试内容"); ///

在文件 MailUtils.cs 第 27 行定义.

成员函数说明

static MailUtils SinGooCMS.Utility.MailUtils.Create ( MailConfig mailConfig )
static

创建邮件客户端

参数
mailConfig
返回

在文件 MailUtils.cs 第 41 行定义.

bool string errMsg SinGooCMS.Utility.MailUtils.SendEmail | ( | string | rctMail,
 |  | string | subject,
 |  | string | body
 | ) |  |
private

在文件 MailUtils.cs 第 58 行定义.

async Task<(bool isSuccess, string errMsg)> SinGooCMS.Utility.MailUtils.SendEmailAsync | ( | string | rctMail,
 |  | string | subject,
 |  | string | body
 | ) |  |

使用SMTP协议，异步发送邮件

参数
rctMail
subject
body
返回

在文件 MailUtils.cs 第 114 行定义.

类成员变量说明

bool SinGooCMS.Utility.MailUtils.isSuccess

使用SMTP协议，异步发送邮件

参数
rctMail
subject
body
返回

在文件 MailUtils.cs 第 58 行定义.

属性说明

MailConfig SinGooCMS.Utility.MailUtils.Config
getsetprivate

在文件 MailUtils.cs 第 34 行定义.

该类的文档由以下文件生成:
  • SinGooCMS.Utility/Net/MailUtils.cs


SinGooCMS.Utility: SinGooCMS.Utility.NetWorkUtils类 参考

  • SinGooCMS
  • Utility
  • NetWorkUtils
静态 Public 成员函数 | 所有成员列表
SinGooCMS.Utility.NetWorkUtils类 参考

模拟 httpget 和 httppost 更多...

静态 Public 成员函数

static string | GetFQDN ()
获取计算机全限定域名( FQDN ,Fully Qualified Domain Name) 更多...
static string | HttpGet (string strUrl, int timeOut=30 *1000, string encodingType="utf-8")
读取get内容 更多...
static string | HttpGet (string strUrl, int timeOut, string encodingType, ref string reqCookies, ref string rspCookies, bool isHttps=false, IDictionary< string, string > headers=null)
读取get内容 更多...
static string | HttpPost (string strUrl, string postData)
post 提交 更多...
static string | HttpPost (string strUrl, string postData, string host, string referer)
post 提交 更多...
static string | HttpPost (string strUrl, string postData, int timeOut, string encodingType, ref string reqCookies, ref string rspCookies, bool isHttps=false, IDictionary< string, string > headers=null)
POST请求url,并返回结果 更多...
static bool | Download (string originalFile, string targetDir, string targetFileName="")
下载文件到本地，覆盖现有文件 更多...
static bool | Ping (string hostNameOrAddr)
是否能ping通IP 更多...

详细描述

模拟 httpget 和 httppost

在文件 NetWorkUtils.cs 第 16 行定义.

成员函数说明

static bool SinGooCMS.Utility.NetWorkUtils.Download | ( | string | originalFile,
 |  | string | targetDir,
 |  | string | targetFileName = ""
 | ) |  |
static

下载文件到本地，覆盖现有文件

参数
originalFile
targetDir
targetFileName
返回

在文件 NetWorkUtils.cs 第 272 行定义.

static string SinGooCMS.Utility.NetWorkUtils.GetFQDN ( )
static

获取计算机全限定域名( FQDN ,Fully Qualified Domain Name)

关于FQDN:

返回

在文件 NetWorkUtils.cs 第 23 行定义.

static string SinGooCMS.Utility.NetWorkUtils.HttpGet | ( | string | strUrl,
 |  | int | timeOut = 30 * 1000,
 |  | string | encodingType = "utf-8"
 | ) |  |
static

读取get内容

参数
strUrl
timeOut
encodingType
返回

在文件 NetWorkUtils.cs 第 46 行定义.

static string SinGooCMS.Utility.NetWorkUtils.HttpGet | ( | string | strUrl,
 |  | int | timeOut,
 |  | string | encodingType,
 |  | ref string | reqCookies,
 |  | ref string | rspCookies,
 |  | bool | isHttps = false,
 |  | IDictionary< string, string > | headers = null
 | ) |  |
static

读取get内容

参数
strUrl | 网址
timeOut | 超时时间
encodingType | 编码
reqCookies | 请求的cookie
rspCookies | 输出的cookie
isHttps | 是否ssl
headers | 请求头信息
返回

在文件 NetWorkUtils.cs 第 64 行定义.

static string SinGooCMS.Utility.NetWorkUtils.HttpPost | ( | string | strUrl,
 |  | string | postData
 | ) |  |
static

post 提交

参数
strUrl
postData
返回

在文件 NetWorkUtils.cs 第 152 行定义.

static string SinGooCMS.Utility.NetWorkUtils.HttpPost | ( | string | strUrl,
 |  | string | postData,
 |  | string | host,
 |  | string | referer
 | ) |  |
static

post 提交

参数
strUrl
postData
host
referer
返回

在文件 NetWorkUtils.cs 第 165 行定义.

static string SinGooCMS.Utility.NetWorkUtils.HttpPost | ( | string | strUrl,
 |  | string | postData,
 |  | int | timeOut,
 |  | string | encodingType,
 |  | ref string | reqCookies,
 |  | ref string | rspCookies,
 |  | bool | isHttps = false,
 |  | IDictionary< string, string > | headers = null
 | ) |  |
static

POST请求url,并返回结果

参数
strUrl | 网址
postData | 提交的数据
timeOut | 超时时间
encodingType | 编码
reqCookies | 请求的cookie
rspCookies | 输出的cookie
isHttps | 是否ssl
headers | 请求头
返回

在文件 NetWorkUtils.cs 第 190 行定义.

static bool SinGooCMS.Utility.NetWorkUtils.Ping ( string hostNameOrAddr )
static

是否能ping通IP

参数
hostNameOrAddr 域名或者IP
返回

在文件 NetWorkUtils.cs 第 330 行定义.

该类的文档由以下文件生成:
  • SinGooCMS.Utility/Net/NetWorkUtils.cs


SinGooCMS.Utility: SinGooCMS.Utility.NPOIUtils类 参考

  • SinGooCMS
  • Utility
  • NPOIUtils
静态 Public 成员函数 | 所有成员列表
SinGooCMS.Utility.NPOIUtils类 参考

NPOI工具类
来自: 更多...

静态 Public 成员函数

static object | ReadCell (string excelFileFullPath, string sheetName="", string addr="A1")
读取单元格的值 更多...
static object | ReadCell (string excelFileFullPath, string sheetName="", int rowIndex=1, int colIndex=1)
读取单元格的值 更多...
static DataTable | Read (string excelFileFullPath)
读取第一个表单 更多...
static Dictionary< string, DataTable > | Read (string excelFileFullPath, bool hasHeaderTile,(int startRow, int startCol)?startPoint=null,(int endRow, int endCol)?endPoint=null)
读所有表单 更多...
static DataTable | ReadSheet (ISheet sheet, bool hasHeaderTile,(int startRow, int startCol)?startPoint=null,(int endRow, int endCol)?endPoint=null)
读取表单 更多...
static DataTable | ReadSheet (string excelFileFullPath, bool hasHeaderTile, string addrRange)
读表单 更多...
static DataTable | ReadSheet (ISheet sheet, bool hasHeaderTile, string addrRange)
读表单 更多...
static object | GetCellValue (ICell cell)
获取单元格的值 更多...
static bool | Save (DataTable table, string filePath, string sheetName="")
保存到excel 更多...
static bool | Save (Dictionary< string, DataTable > dict, string saveFilePath)
保存到excel 更多...
static bool | SaveWithTmpl (Dictionary< string, DataTable > dict, string tmplFilePath, string saveFilePath)
根据模板写入excel 更多...

详细描述

NPOI工具类
来自:

在文件 NPOIUtils.cs 第 20 行定义.

成员函数说明

static object SinGooCMS.Utility.NPOIUtils.GetCellValue ( ICell cell )
static

获取单元格的值

参数
cell
返回

在文件 NPOIUtils.cs 第 300 行定义.

static DataTable SinGooCMS.Utility.NPOIUtils.Read ( string excelFileFullPath )
static

读取第一个表单

参数
excelFileFullPath
返回

在文件 NPOIUtils.cs 第 87 行定义.

static Dictionary<string, DataTable> SinGooCMS.Utility.NPOIUtils.Read | ( | string | excelFileFullPath,
 |  | bool | hasHeaderTile,
 |  | (int startRow, int startCol)? | startPoint = null,
 |  | (int endRow, int endCol)? | endPoint = null
 | ) |  |
static

读所有表单

参数
excelFileFullPath
hasHeaderTile
startPoint
endPoint
返回

在文件 NPOIUtils.cs 第 101 行定义.

static object SinGooCMS.Utility.NPOIUtils.ReadCell | ( | string | excelFileFullPath,
 |  | string | sheetName = "",
 |  | string | addr = "A1"
 | ) |  |
static

读取单元格的值

参数
excelFileFullPath
sheetName
addr 位置 如A1
返回

在文件 NPOIUtils.cs 第 31 行定义.

static object SinGooCMS.Utility.NPOIUtils.ReadCell | ( | string | excelFileFullPath,
 |  | string | sheetName = "",
 |  | int | rowIndex = 1,
 |  | int | colIndex = 1
 | ) |  |
static

读取单元格的值

参数
excelFileFullPath | excel文件路径
sheetName | 表单名称，未指定默认第一个表单
rowIndex | 行
colIndex | 列
返回

在文件 NPOIUtils.cs 第 61 行定义.

static DataTable SinGooCMS.Utility.NPOIUtils.ReadSheet | ( | ISheet | sheet,
 |  | bool | hasHeaderTile,
 |  | (int startRow, int startCol)? | startPoint = null,
 |  | (int endRow, int endCol)? | endPoint = null
 | ) |  |
static

读取表单

参数
sheet
hasHeaderTile
startPoint
endPoint
返回

在文件 NPOIUtils.cs 第 129 行定义.

static DataTable SinGooCMS.Utility.NPOIUtils.ReadSheet | ( | string | excelFileFullPath,
 |  | bool | hasHeaderTile,
 |  | string | addrRange
 | ) |  |
static

读表单

参数
excelFileFullPath
hasHeaderTile
addrRange 地址范围，如 A1:C2
返回

在文件 NPOIUtils.cs 第 209 行定义.

static DataTable SinGooCMS.Utility.NPOIUtils.ReadSheet | ( | ISheet | sheet,
 |  | bool | hasHeaderTile,
 |  | string | addrRange
 | ) |  |
static

读表单

参数
sheet
hasHeaderTile
addrRange 地址范围，如 A1:C2
返回

在文件 NPOIUtils.cs 第 226 行定义.

static bool SinGooCMS.Utility.NPOIUtils.Save | ( | DataTable | table,
 |  | string | filePath,
 |  | string | sheetName = ""
 | ) |  |
static

保存到excel

参数
table
filePath
sheetName
返回

在文件 NPOIUtils.cs 第 333 行定义.

static bool SinGooCMS.Utility.NPOIUtils.Save | ( | Dictionary< string, DataTable > | dict,
 |  | string | saveFilePath
 | ) |  |
static

保存到excel

参数
dict
saveFilePath
返回

在文件 NPOIUtils.cs 第 350 行定义.

static bool SinGooCMS.Utility.NPOIUtils.SaveWithTmpl | ( | Dictionary< string, DataTable > | dict,
 |  | string | tmplFilePath,
 |  | string | saveFilePath
 | ) |  |
static

根据模板写入excel

参数
dict
tmplFilePath
saveFilePath
返回

在文件 NPOIUtils.cs 第 458 行定义.

该类的文档由以下文件生成:
  • SinGooCMS.Utility/Data/NPOIUtils.cs


SinGooCMS.Utility: SinGooCMS.Utility.ObjectAccessor类 参考

  • SinGooCMS
  • Utility
  • ObjectAccessor
属性 | Private 属性 | 所有成员列表
SinGooCMS.Utility.ObjectAccessor类 参考

快速访问给定类型的对象的属性值, 参照:

参见
Accessor
更多...

类 SinGooCMS.Utility.ObjectAccessor 继承关系图:
[图例]
SinGooCMS.Utility.ObjectAccessor 的协作图:
[图例]

属性

object | this[object instance, string propertyName] [get, set]
根据给定的对象和属性名称对属性进行读写操作 更多...
- 属性 继承自 SinGooCMS.Utility.Accessor
StringComparer | Comparer [get]
获取反射模型属性时用到的名称比较器 StringComparer 更多...
IReflect | Type [get]
当前反射的对象类型 更多...
bool | IgnoreCase [get]
获取的属性是否是忽略大小的 更多...
bool | IncludesNonPublic [get]
获取的属性是否包含非public类型的 更多...
SortedList< string, PropertyInfo > | Properties [get]
所有能获取到的属性信息 更多...

Private 属性

readonly Hashtable | _objectGettersCache
readonly Hashtable | _objectSettersCache

额外继承的成员函数

- 静态 Public 成员函数 继承自 SinGooCMS.Utility.Accessor
static ObjectAccessor | Build (object instance, bool ignoreCase=false, bool includeNonPublic=false)
根据给定的对象创建ObjectAccessor实例 更多...
static ObjectAccessor | Build (Type instanceType, bool ignoreCase=false, bool includeNonPublic=false)
根据给定的对象类型创建ObjectAccessor实例 更多...
static GenericAccessor< TInstance > | Build< TInstance > (bool ignoreCase=false, bool includeNonPublic=false)
根据给定的对象类型创建GenericAccessor<TInstance>实例 更多...
- Protected 成员函数 继承自 SinGooCMS.Utility.Accessor
Accessor (IReflect type, bool ignoreCase, bool includeNonPublic)
用户创建Accessor类型的实例 更多...

详细描述

快速访问给定类型的对象的属性值, 参照:

参见
Accessor

在文件 ObjectAccessor.cs 第 11 行定义.

类成员变量说明

readonly Hashtable SinGooCMS.Utility.ObjectAccessor._objectGettersCache
private

在文件 ObjectAccessor.cs 第 13 行定义.

readonly Hashtable SinGooCMS.Utility.ObjectAccessor._objectSettersCache
private

在文件 ObjectAccessor.cs 第 13 行定义.

属性说明

object SinGooCMS.Utility.ObjectAccessor.this[object instance, string propertyName]
getset

根据给定的对象和属性名称对属性进行读写操作

在文件 ObjectAccessor.cs 第 43 行定义.

该类的文档由以下文件生成:
  • SinGooCMS.Utility/Accessors/ObjectAccessor.cs


SinGooCMS.Utility: SinGooCMS.Utility.OperationResult类 参考

  • SinGooCMS
  • Utility
  • OperationResult
Public 成员函数 | 静态 Public 成员函数 | 静态 Public 属性 | 属性 | Private 属性 | 所有成员列表
SinGooCMS.Utility.OperationResult类 参考

操作返回结果
<exsample> "ReturnStatusType": 1, —返回状态类型
"StatusCode": "200", —错误信息代码
"ErrorMessage": "操作成功", —错误信息
"ErrorENMessage": "ok", —英文错误信息
"TimeStamp": "2020-01-06 12:13:14", —当前时间 </exsample> 更多...

SinGooCMS.Utility.OperationResult 的协作图:
[图例]

Public 成员函数

OperationResult ()
无参构造方法 更多...
OperationResult (int _ReturnStatusType, string _StatusCode, string _ErrorMessage, string _ENErrorMessage="")
构造方法 更多...
override string | ToString ()
返回一个json字符串 更多...
JObject | ToJsonObj ()
返回一个json对象 更多...

静态 Public 成员函数

static OperationResult | Success (string errorMessage, string errorENMessage="")
static OperationResult | Fail (string statusCode, string errorMessage, string errorENMessage="")

静态 Public 属性

static OperationResult | success = new OperationResult(1, "200", "操作成功", "ok")
static OperationResult | fail = new OperationResult(0, "－1", "操作失败", "fail")

属性

int | ReturnStatusType [get, set]
返回状态类型 1 处理成功 0 处理失败 ,默认是失败的 更多...
string | StatusCode = 0 [get, set]
错误信息代码 更多...
string | ErrorMessage = string.Empty [get, set]
错误信息 更多...
string | ErrorENMessage = string.Empty [get, set]
错误信息(英文) 更多...
DateTime | TimeStamp = string.Empty [get, set]
当前时间,可不填，默认当前时间 更多...
string | CallbackUrl = DateTime.Now [get, set]
回调Url 更多...
string | Data = string.Empty [get, set]
附加数据 更多...
int | Timeout = string.Empty [get, set]
超时时间(秒) 超时时间=TimeStamp.AddSecond(Timeout) 更多...
string | Sign [get, set]
签名，用于验证数据是正确性，Sign=DEncryptUtils.DESEncrypt("ReturnStatusType=1&amp;StatusCode=200&amp;TimeStamp=2022-04-01 10:00:00&amp;Timeout=-1",key)
key="singoo" + this.TimeStamp.ToString("yyyyMMdd"); 更多...

Private 属性

string _sign =string.Empty

详细描述

操作返回结果
<exsample> "ReturnStatusType": 1, —返回状态类型
"StatusCode": "200", —错误信息代码
"ErrorMessage": "操作成功", —错误信息
"ErrorENMessage": "ok", —英文错误信息
"TimeStamp": "2020-01-06 12:13:14", —当前时间 </exsample>

在文件 OperationResult.cs 第 16 行定义.

构造及析构函数说明

SinGooCMS.Utility.OperationResult.OperationResult ( )

无参构造方法

在文件 OperationResult.cs 第 85 行定义.

SinGooCMS.Utility.OperationResult.OperationResult | ( | int | _ReturnStatusType,
 |  | string | _StatusCode,
 |  | string | _ErrorMessage,
 |  | string | _ENErrorMessage = ""
 | ) |  |

构造方法

参数
_ReturnStatusType | 状态 1/0
_StatusCode | 状态码 如200，401，404，500
_ErrorMessage | 中文提示
_ENErrorMessage | 英文提示

在文件 OperationResult.cs 第 93 行定义.

成员函数说明

static OperationResult SinGooCMS.Utility.OperationResult.Fail | ( | string | statusCode,
 |  | string | errorMessage,
 |  | string | errorENMessage = ""
 | ) |  |
static
static OperationResult SinGooCMS.Utility.OperationResult.Success | ( | string | errorMessage,
 |  | string | errorENMessage = ""
 | ) |  |
static
JObject SinGooCMS.Utility.OperationResult.ToJsonObj ( )

返回一个json对象

返回

在文件 OperationResult.cs 第 126 行定义.

override string SinGooCMS.Utility.OperationResult.ToString ( )

返回一个json字符串

返回

在文件 OperationResult.cs 第 117 行定义.

类成员变量说明

string SinGooCMS.Utility.OperationResult._sign =string.Empty
private

在文件 OperationResult.cs 第 53 行定义.

OperationResult SinGooCMS.Utility.OperationResult.fail = new OperationResult(0, "－1", "操作失败", "fail")
static

在文件 OperationResult.cs 第 108 行定义.

OperationResult SinGooCMS.Utility.OperationResult.success = new OperationResult(1, "200", "操作成功", "ok")
static

在文件 OperationResult.cs 第 105 行定义.

属性说明

string SinGooCMS.Utility.OperationResult.CallbackUrl = DateTime.Now
getset

回调Url

在文件 OperationResult.cs 第 43 行定义.

string SinGooCMS.Utility.OperationResult.Data = string.Empty
getset

附加数据

在文件 OperationResult.cs 第 47 行定义.

string SinGooCMS.Utility.OperationResult.ErrorENMessage = string.Empty
getset

错误信息(英文)

在文件 OperationResult.cs 第 35 行定义.

string SinGooCMS.Utility.OperationResult.ErrorMessage = string.Empty
getset

错误信息

在文件 OperationResult.cs 第 31 行定义.

int SinGooCMS.Utility.OperationResult.ReturnStatusType
getset

返回状态类型 1 处理成功 0 处理失败 ,默认是失败的

在文件 OperationResult.cs 第 23 行定义.

string SinGooCMS.Utility.OperationResult.Sign
getset

签名，用于验证数据是正确性，Sign=DEncryptUtils.DESEncrypt("ReturnStatusType=1&amp;StatusCode=200&amp;TimeStamp=2022-04-01 10:00:00&amp;Timeout=-1",key)
key="singoo" + this.TimeStamp.ToString("yyyyMMdd");

在文件 OperationResult.cs 第 59 行定义.

string SinGooCMS.Utility.OperationResult.StatusCode = 0
getset

错误信息代码

在文件 OperationResult.cs 第 27 行定义.

int SinGooCMS.Utility.OperationResult.Timeout = string.Empty
getset

超时时间(秒) 超时时间=TimeStamp.AddSecond(Timeout)

在文件 OperationResult.cs 第 51 行定义.

DateTime SinGooCMS.Utility.OperationResult.TimeStamp = string.Empty
getset

当前时间,可不填，默认当前时间

在文件 OperationResult.cs 第 39 行定义.

该类的文档由以下文件生成:
  • SinGooCMS.Utility/Result/OperationResult.cs


SinGooCMS.Utility: SinGooCMS.Utility.PagerModel< T > 模板类 参考

  • SinGooCMS
  • Utility
  • PagerModel
Public 属性 | 属性 | 所有成员列表
SinGooCMS.Utility.PagerModel< T > 模板类 参考

分页模型 更多...

类 SinGooCMS.Utility.PagerModel< T > 继承关系图:
[图例]
SinGooCMS.Utility.PagerModel< T > 的协作图:
[图例]

Public 属性

int | TotalPage
总页数 更多...
int | PrevPage
上一页号 更多...
int | NextPage
下一页号 更多...
bool | HasPrevPage => PageIndex > 1
是否有上一页 更多...
bool | HasNextPage => PageIndex < TotalPage
是否有下一页 更多...

属性

T | PagerData [get, set]
分页数据 更多...
int | PageIndex [get, set]
页号 更多...
int | PageSize = 1 [get, set]
分页记录数 更多...
int | TotalRecord [get, set]
总记录数 更多...
- 属性 继承自 SinGooCMS.Utility.SinGooList< T >
SinGooList< T > | this[int indexBeg, int indexEnd] [get]
获取一段数据，返回一个新列表 更多...

详细描述

分页模型

模板参数
T

在文件 PagerModel.cs 第 12 行定义.

类成员变量说明

bool SinGooCMS.Utility.PagerModel< T >.HasNextPage => PageIndex < TotalPage

是否有下一页

在文件 PagerModel.cs 第 60 行定义.

bool SinGooCMS.Utility.PagerModel< T >.HasPrevPage => PageIndex > 1

是否有上一页

在文件 PagerModel.cs 第 56 行定义.

int SinGooCMS.Utility.PagerModel< T >.NextPage
初始值:
=> HasNextPage
? PageIndex + 1
: TotalPage

下一页号

在文件 PagerModel.cs 第 49 行定义.

int SinGooCMS.Utility.PagerModel< T >.PrevPage
初始值:
=> HasPrevPage
? PageIndex - 1
: PageIndex

上一页号

在文件 PagerModel.cs 第 43 行定义.

int SinGooCMS.Utility.PagerModel< T >.TotalPage
初始值:
=>
PageSize > 0
? TotalRecord % PageSize == 0 ? TotalRecord / PageSize : (1 + TotalRecord / PageSize)
: 0

总页数

在文件 PagerModel.cs 第 35 行定义.

属性说明

int SinGooCMS.Utility.PagerModel< T >.PageIndex
getset

页号

在文件 PagerModel.cs 第 22 行定义.

T SinGooCMS.Utility.PagerModel< T >.PagerData
getset

分页数据

在文件 PagerModel.cs 第 17 行定义.

int SinGooCMS.Utility.PagerModel< T >.PageSize = 1
getset

分页记录数

在文件 PagerModel.cs 第 26 行定义.

int SinGooCMS.Utility.PagerModel< T >.TotalRecord
getset

总记录数

在文件 PagerModel.cs 第 31 行定义.

该类的文档由以下文件生成:
  • SinGooCMS.Utility/Pager/PagerModel.cs


SinGooCMS.Utility: SinGooCMS.Utility.PagerUtils类 参考

  • SinGooCMS
  • Utility
  • PagerUtils
Public 成员函数 | 静态 Public 成员函数 | Public 属性 | 属性 | Private 成员函数 | 所有成员列表
SinGooCMS.Utility.PagerUtils类 参考

分页栏工具 更多...

Public 成员函数

void | Calculate ()
计算分页总数等 更多...
int[] | GetPages (int count)
获取下标数组 更多...
string | GetUrl (int page)
获取分页地址 更多...
string | GetUrl (string getType)
获取分页地址 更多...

静态 Public 成员函数

static PagerUtils Create (int totalRecord, int pageSize=10)
创建分页栏 更多...

Public 属性

int RecordBegin
页开始记录数 更多...

属性

int | PageIndex [get, set]
当前页号 更多...
int | PageSize = 1 [get, set]
每页记录数 更多...
int | TotalRecord = 0 [get, set]
记录总数 更多...
int | TotalPage = 0 [get, set]
分页总数 更多...
int | RecordEnd [get]
页结束记录数 更多...
int | PageBegin [get, set]
页号起始 更多...
int | PageEnd = 1 [get, set]
页号结束 更多...
string | UrlPattern = 0 [get, set]
url地址规则,一般用于替换$page 更多...

Private 成员函数

string GetPageUrl (int page)
替换$page 更多...

详细描述

分页栏工具

在文件 PagerUtils.cs 第 10 行定义.

成员函数说明

void SinGooCMS.Utility.PagerUtils.Calculate ( )

计算分页总数等

在文件 PagerUtils.cs 第 90 行定义.

static PagerUtils SinGooCMS.Utility.PagerUtils.Create | ( | int | totalRecord,
 |  | int | pageSize = 10
 | ) |  |
static

创建分页栏

参数
totalRecord
pageSize
返回

在文件 PagerUtils.cs 第 75 行定义.

int [] SinGooCMS.Utility.PagerUtils.GetPages ( int count )

获取下标数组

参数
count
返回

在文件 PagerUtils.cs 第 119 行定义.

string SinGooCMS.Utility.PagerUtils.GetPageUrl ( int page )
private

替换$page

参数
page
返回

在文件 PagerUtils.cs 第 197 行定义.

string SinGooCMS.Utility.PagerUtils.GetUrl ( int page )

获取分页地址

参数
page
返回

在文件 PagerUtils.cs 第 146 行定义.

string SinGooCMS.Utility.PagerUtils.GetUrl ( string getType )

获取分页地址

参数
getType
返回

在文件 PagerUtils.cs 第 163 行定义.

类成员变量说明

int SinGooCMS.Utility.PagerUtils.RecordBegin
初始值:
=>
((this.PageIndex - 1) * this.PageSize) + 1

页开始记录数

在文件 PagerUtils.cs 第 37 行定义.

属性说明

int SinGooCMS.Utility.PagerUtils.PageBegin
getset

页号起始

在文件 PagerUtils.cs 第 55 行定义.

int SinGooCMS.Utility.PagerUtils.PageEnd = 1
getset

页号结束

在文件 PagerUtils.cs 第 60 行定义.

int SinGooCMS.Utility.PagerUtils.PageIndex
getset

当前页号

在文件 PagerUtils.cs 第 17 行定义.

int SinGooCMS.Utility.PagerUtils.PageSize = 1
getset

每页记录数

在文件 PagerUtils.cs 第 22 行定义.

int SinGooCMS.Utility.PagerUtils.RecordEnd
get

页结束记录数

在文件 PagerUtils.cs 第 44 行定义.

int SinGooCMS.Utility.PagerUtils.TotalPage = 0
getset

分页总数

在文件 PagerUtils.cs 第 32 行定义.

int SinGooCMS.Utility.PagerUtils.TotalRecord = 0
getset

记录总数

在文件 PagerUtils.cs 第 27 行定义.

string SinGooCMS.Utility.PagerUtils.UrlPattern = 0
getset

url地址规则,一般用于替换$page

在文件 PagerUtils.cs 第 65 行定义.

该类的文档由以下文件生成:
  • SinGooCMS.Utility/Pager/PagerUtils.cs


SinGooCMS.Utility: SinGooCMS.Utility.PredicateBuilder类 参考

  • SinGooCMS
  • Utility
  • PredicateBuilder
静态 Public 成员函数 | 所有成员列表
SinGooCMS.Utility.PredicateBuilder类 参考

对 Lambda 表达式进行动态拼接的逻辑 更多...

静态 Public 成员函数

static Expression< Func< T, bool > > | True< T > ()
默认条件成立 更多...
static Expression< Func< T, bool > > | False< T > ()
默认条件不成立 更多...
static Expression< T > | Compose< T > (this Expression< T > first, Expression< T > second, Func< Expression, Expression, Expression > merge)
拼接多个Lambda 表达式，组成一个Lambda表达式 更多...
static Expression< Func< T, bool > > | And< T > (this Expression< Func< T, bool >> first, Expression< Func< T, bool >> second)
两个表达式做And合并 更多...
static Expression< Func< T, bool > > | Or< T > (this Expression< Func< T, bool >> first, Expression< Func< T, bool >> second)
两个表达式做Or合并 更多...

详细描述

对 Lambda 表达式进行动态拼接的逻辑

在文件 PredicateBuilder.cs 第 11 行定义.

成员函数说明

static Expression<Func<T, bool> > SinGooCMS.Utility.PredicateBuilder.And< T > | ( | this Expression< Func< T, bool >> | first,
 |  | Expression< Func< T, bool >> | second
 | ) |  |
static

两个表达式做And合并

模板参数
T
参数
first
second
返回

在文件 PredicateBuilder.cs 第 54 行定义.

static Expression<T> SinGooCMS.Utility.PredicateBuilder.Compose< T > | ( | this Expression< T > | first,
 |  | Expression< T > | second,
 |  | Func< Expression, Expression, Expression > | merge
 | ) |  |
static

拼接多个Lambda 表达式，组成一个Lambda表达式

模板参数
T
参数
first | 第一个lambda表达式
second | 第二个lambda表达式
merge | 合并的类型，AND，OR，NOT 等
返回

在文件 PredicateBuilder.cs 第 35 行定义.

static Expression<Func<T, bool> > SinGooCMS.Utility.PredicateBuilder.False< T > ( )
static

默认条件不成立

模板参数
T
返回

在文件 PredicateBuilder.cs 第 25 行定义.

static Expression<Func<T, bool> > SinGooCMS.Utility.PredicateBuilder.Or< T > | ( | this Expression< Func< T, bool >> | first,
 |  | Expression< Func< T, bool >> | second
 | ) |  |
static

两个表达式做Or合并

模板参数
T
参数
first
second
返回

在文件 PredicateBuilder.cs 第 66 行定义.

static Expression<Func<T, bool> > SinGooCMS.Utility.PredicateBuilder.True< T > ( )
static

默认条件成立

模板参数
T
返回

在文件 PredicateBuilder.cs 第 18 行定义.

该类的文档由以下文件生成:
  • SinGooCMS.Utility/Linq/PredicateBuilder.cs


SinGooCMS.Utility: SinGooCMS.Utility.ProcessUtils类 参考

  • SinGooCMS
  • Utility
  • ProcessUtils
静态 Public 成员函数 | 所有成员列表
SinGooCMS.Utility.ProcessUtils类 参考

执行系统进程 更多...

静态 Public 成员函数

static void | StartService (string serviceName)
开启服务（需要管理员权限） 更多...
static void | StopService (string serviceName)
停止服务（需要管理员权限） 更多...
static void | DeleteService (string serviceName)
删除服务（需要管理员权限） 更多...
static void | Shutdown (int shutSecond=60)
关机 更多...
static void | UnShutdown ()
取消关机 更多...
static bool | ExecuteCMD (IList< string > commandText)
执行cmd命令 更多...
static bool | ExecuteCMD (IList< string > commandText, out string result, out string errMsg)
打开cmd执行一系列命令 更多...
static void | Execute (string fileName, string args)
执行程序 更多...
static bool | Execute (string fileName, string args, IList< string > commandText, out string result, out string errMsg)
执行程序 更多...
static void | Kill (string name)
停止进程 更多...
static void | KillCurrent ()
停止当前进程 更多...

详细描述

执行系统进程

在文件 ProcessUtils.cs 第 12 行定义.

成员函数说明

static void SinGooCMS.Utility.ProcessUtils.DeleteService ( string serviceName )
static

删除服务（需要管理员权限）

参数
serviceName
static void SinGooCMS.Utility.ProcessUtils.Execute | ( | string | fileName,
 |  | string | args
 | ) |  |
static

执行程序

参数
fileName
args
返回

在文件 ProcessUtils.cs 第 87 行定义.

static bool SinGooCMS.Utility.ProcessUtils.Execute | ( | string | fileName,
 |  | string | args,
 |  | IList< string > | commandText,
 |  | out string | result,
 |  | out string | errMsg
 | ) |  |
static

执行程序

参数
fileName | 程序名称
args | 参数
commandText | 执行的命令，如cmd的命令
result | 返回结果
errMsg | 错误信息
返回
返回执行是否成功

在文件 ProcessUtils.cs 第 103 行定义.

static bool SinGooCMS.Utility.ProcessUtils.ExecuteCMD ( IList< string > commandText )
static

执行cmd命令

参数
commandText

在文件 ProcessUtils.cs 第 58 行定义.

这是这个函数的调用关系图:

static bool SinGooCMS.Utility.ProcessUtils.ExecuteCMD | ( | IList< string > | commandText,
 |  | out string | result,
 |  | out string | errMsg
 | ) |  |
static

打开cmd执行一系列命令

参数
commandText
result
errMsg
返回

在文件 ProcessUtils.cs 第 72 行定义.

static void SinGooCMS.Utility.ProcessUtils.Kill ( string name )
static

停止进程

参数
name

在文件 ProcessUtils.cs 第 161 行定义.

static void SinGooCMS.Utility.ProcessUtils.KillCurrent ( )
static

停止当前进程

在文件 ProcessUtils.cs 第 173 行定义.

static void SinGooCMS.Utility.ProcessUtils.Shutdown ( int shutSecond = 60 )
static

关机

参数
shutSecond xx秒后关机，默认是60秒
static void SinGooCMS.Utility.ProcessUtils.StartService ( string serviceName )
static

开启服务（需要管理员权限）

参数
serviceName
static void SinGooCMS.Utility.ProcessUtils.StopService ( string serviceName )
static

停止服务（需要管理员权限）

参数
serviceName
static void SinGooCMS.Utility.ProcessUtils.UnShutdown ( )
static

取消关机

该类的文档由以下文件生成:
  • SinGooCMS.Utility/System/ProcessUtils.cs


SinGooCMS.Utility: SinGooCMS.Utility.QueryExtension类 参考

  • SinGooCMS
  • Utility
  • QueryExtension
静态 Public 成员函数 | 所有成员列表
SinGooCMS.Utility.QueryExtension类 参考

查询并分页 更多...

静态 Public 成员函数

static IQueryable< T > | Page< T > (this IQueryable< T > query, int pageIndex, int pageSize)
分页查询 更多...
static PagerModel< IEnumerable< T > > | PageModel< T > (this IQueryable< T > query, int pageIndex, int pageSize)
分页查询并返回分页数据 更多...

详细描述

查询并分页

在文件 QueryExtension.cs 第 10 行定义.

成员函数说明

static IQueryable<T> SinGooCMS.Utility.QueryExtension.Page< T > | ( | this IQueryable< T > | query,
 |  | int | pageIndex,
 |  | int | pageSize
 | ) |  |
static

分页查询

模板参数
T
参数
query
pageIndex
pageSize
返回

在文件 QueryExtension.cs 第 20 行定义.

static PagerModel<IEnumerable<T> > SinGooCMS.Utility.QueryExtension.PageModel< T > | ( | this IQueryable< T > | query,
 |  | int | pageIndex,
 |  | int | pageSize
 | ) |  |
static

分页查询并返回分页数据

模板参数
T
参数
query
pageIndex
pageSize
返回

在文件 QueryExtension.cs 第 45 行定义.

该类的文档由以下文件生成:
  • SinGooCMS.Utility/Pager/QueryExtension.cs


SinGooCMS.Utility: SinGooCMS.Utility.ReflectionUtils类 参考

  • SinGooCMS
  • Utility
  • ReflectionUtils
静态 Public 成员函数 | 所有成员列表
SinGooCMS.Utility.ReflectionUtils类 参考

反射操作 更多...

静态 Public 成员函数

static Assembly | Load (string dllFileName, string dir="")
加载组件 更多...
static T | CreateInstance< T > (string assemblyFile, object[] parameters=null)
创建实例 更多...
static object | CreateInstance (string assemblyFile, string fullName, object[] parameters=null)
创建实例 更多...
static object | CreateInstance (Type type, object[] parameters=null)
创建实例 更多...
static Type | GetType (string assemblyFile, string fullName)
读取类型 更多...

详细描述

反射操作

在文件 ReflectionUtils.cs 第 10 行定义.

成员函数说明

static object SinGooCMS.Utility.ReflectionUtils.CreateInstance | ( | string | assemblyFile,
 |  | string | fullName,
 |  | object[] | parameters = null
 | ) |  |
static

创建实例

参数
assemblyFile | ddl文件全路径
fullName | 类限定名 如 SinGooCMS.Ado.DbAccess.SqlServerAccess
parameters | 参数集合
返回

在文件 ReflectionUtils.cs 第 45 行定义.

static object SinGooCMS.Utility.ReflectionUtils.CreateInstance | ( | Type | type,
 |  | object[] | parameters = null
 | ) |  |
static

创建实例

参数
type | 类型
parameters | 参数集合
返回

在文件 ReflectionUtils.cs 第 57 行定义.

static T SinGooCMS.Utility.ReflectionUtils.CreateInstance< T > | ( | string | assemblyFile,
 |  | object[] | parameters = null
 | ) |  |
static

创建实例

模板参数
T 泛型
参数
assemblyFile | ddl文件全路径
parameters | 参数集合
返回
static Type SinGooCMS.Utility.ReflectionUtils.GetType | ( | string | assemblyFile,
 |  | string | fullName
 | ) |  |
static

读取类型

参数
assemblyFile | ddl文件全路径 如 F:.Ado.dll
fullName | 类限定名 如 SinGooCMS.Ado.DbAccess.SqlServerAccess
返回

在文件 ReflectionUtils.cs 第 70 行定义.

static Assembly SinGooCMS.Utility.ReflectionUtils.Load | ( | string | dllFileName,
 |  | string | dir = ""
 | ) |  |
static

加载组件

参数
dllFileName | 组件名称，如a.dll
dir | 组件所在目录，默认为当前bin目录
返回

在文件 ReflectionUtils.cs 第 18 行定义.

该类的文档由以下文件生成:
  • SinGooCMS.Utility/Reflection/ReflectionUtils.cs


SinGooCMS.Utility: SinGooCMS.Utility.RegistryUtils类 参考

  • SinGooCMS
  • Utility
  • RegistryUtils
静态 Public 成员函数 | 所有成员列表
SinGooCMS.Utility.RegistryUtils类 参考

注册表操作，Win平台专有(需要有管理员权限) 更多...

静态 Public 成员函数

static object | GetValue (string fullKey, string itemName)
读取注册表键值 更多...
static object | GetRunValue (string itemName)
读取注册表(启动项)键值 更多...
static bool | SetValue (string fullKey, string itemName, string itemValue)
保存注册表键值 更多...
static bool | SetRunValue (string itemName, string itemValue)
保存注册表(启动项)键值 更多...
static void | DeleteRunValue (string itemName)
删除键值 更多...
static void | DeleteValue (string fullKey, string itemName)
删除键值 更多...

详细描述

注册表操作，Win平台专有(需要有管理员权限)

1、添加启动项 RegistryUtils.SetRunValue("CTTools", "D:.v1.2.exe");</para> <para>2、取消启动项 RegistryUtils.DeleteRunValue("CTTools");

在文件 RegistryUtils.cs 第 11 行定义.

成员函数说明

static void SinGooCMS.Utility.RegistryUtils.DeleteRunValue ( string itemName )
static

删除键值

参数
itemName
static void SinGooCMS.Utility.RegistryUtils.DeleteValue | ( | string | fullKey,
 |  | string | itemName
 | ) |  |
static

删除键值

参数
fullKey
itemName

在文件 RegistryUtils.cs 第 80 行定义.

static object SinGooCMS.Utility.RegistryUtils.GetRunValue ( string itemName )
static

读取注册表(启动项)键值

参数
itemName
返回
static object SinGooCMS.Utility.RegistryUtils.GetValue | ( | string | fullKey,
 |  | string | itemName
 | ) |  |
static

读取注册表键值

参数
fullKey
itemName
返回

在文件 RegistryUtils.cs 第 19 行定义.

static bool SinGooCMS.Utility.RegistryUtils.SetRunValue | ( | string | itemName,
 |  | string | itemValue
 | ) |  |
static

保存注册表(启动项)键值

参数
itemName
itemValue
返回
static bool SinGooCMS.Utility.RegistryUtils.SetValue | ( | string | fullKey,
 |  | string | itemName,
 |  | string | itemValue
 | ) |  |
static

保存注册表键值

参数
fullKey
itemName
itemValue
返回

在文件 RegistryUtils.cs 第 40 行定义.

该类的文档由以下文件生成:
  • SinGooCMS.Utility/System/RegistryUtils.cs


SinGooCMS.Utility: SinGooCMS.Utility.RSACryption类 参考

  • SinGooCMS
  • Utility
  • RSACryption
Public 成员函数 | 所有成员列表
SinGooCMS.Utility.RSACryption类 参考

更多...

Public 成员函数

void | RSAKey (out string xmlKeys, out string xmlPublicKey)
RSA 的密钥产生 产生私钥 和公钥 更多...
string | RSAEncrypt (string xmlPublicKey, string m_strEncryptString)
RSA加密 更多...
string | RSAEncrypt (string xmlPublicKey, byte[] EncryptString)
RSA加密 更多...
string | RSADecrypt (string xmlPrivateKey, string m_strDecryptString)
RSA解密 更多...
string | RSADecrypt (string xmlPrivateKey, byte[] DecryptString)
RSA解密 更多...
bool | GetHash (string m_strSource, ref byte[] HashData)
获取Hash描述表 更多...
bool | GetHash (string m_strSource, ref string strHashData)
获取Hash描述表 更多...
bool | GetHash (System.IO.FileStream objFile, ref byte[] HashData)
获取Hash描述表 更多...
bool | GetHash (System.IO.FileStream objFile, ref string strHashData)
获取Hash描述表 更多...
bool | SignatureFormatter (string p_strKeyPrivate, byte[] HashbyteSignature, ref byte[] EncryptedSignatureData)
RSA签名 更多...
bool | SignatureFormatter (string p_strKeyPrivate, byte[] HashbyteSignature, ref string m_strEncryptedSignatureData)
RSA签名 更多...
bool | SignatureFormatter (string p_strKeyPrivate, string m_strHashbyteSignature, ref byte[] EncryptedSignatureData)
RSA签名 更多...
bool | SignatureFormatter (string p_strKeyPrivate, string m_strHashbyteSignature, ref string m_strEncryptedSignatureData)
RSA签名 更多...
bool | SignatureDeformatter (string p_strKeyPublic, byte[] HashbyteDeformatter, byte[] DeformatterData)
签名验证 更多...
bool | SignatureDeformatter (string p_strKeyPublic, string p_strHashbyteDeformatter, byte[] DeformatterData)
签名验证 更多...
bool | SignatureDeformatter (string p_strKeyPublic, byte[] HashbyteDeformatter, string p_strDeformatterData)
签名验证 更多...
bool | SignatureDeformatter (string p_strKeyPublic, string p_strHashbyteDeformatter, string p_strDeformatterData)
签名验证 更多...

详细描述

RSA加密解密及RSA签名和验证

1、生成公钥和私钥 new RSACryption().RSAKey(out privateKey, out publicKey)

2、利用公钥加密 string encode = rsa.RSAEncrypt(publicKey, txt)

3、利用私钥解密 string decode = rsa.RSADecrypt(privateKey, encode)

在文件 RSACryption.cs 第 13 行定义.

成员函数说明

bool SinGooCMS.Utility.RSACryption.GetHash | ( | string | m_strSource,
 |  | ref byte[] | HashData
 | ) |  |

获取Hash描述表

参数
m_strSource
HashData
返回

在文件 RSACryption.cs 第 133 行定义.

bool SinGooCMS.Utility.RSACryption.GetHash | ( | string | m_strSource,
 |  | ref string | strHashData
 | ) |  |

获取Hash描述表

参数
m_strSource
strHashData
返回

在文件 RSACryption.cs 第 150 行定义.

bool SinGooCMS.Utility.RSACryption.GetHash | ( | System.IO.FileStream | objFile,
 |  | ref byte[] | HashData
 | ) |  |

获取Hash描述表

参数
objFile
HashData
返回

在文件 RSACryption.cs 第 171 行定义.

bool SinGooCMS.Utility.RSACryption.GetHash | ( | System.IO.FileStream | objFile,
 |  | ref string | strHashData
 | ) |  |

获取Hash描述表

参数
objFile
strHashData
返回

在文件 RSACryption.cs 第 189 行定义.

string SinGooCMS.Utility.RSACryption.RSADecrypt | ( | string | xmlPrivateKey,
 |  | string | m_strDecryptString
 | ) |  |

RSA解密

参数
xmlPrivateKey
m_strDecryptString
返回

在文件 RSACryption.cs 第 88 行定义.

string SinGooCMS.Utility.RSACryption.RSADecrypt | ( | string | xmlPrivateKey,
 |  | byte[] | DecryptString
 | ) |  |

RSA解密

参数
xmlPrivateKey
DecryptString
返回

在文件 RSACryption.cs 第 108 行定义.

string SinGooCMS.Utility.RSACryption.RSAEncrypt | ( | string | xmlPublicKey,
 |  | string | m_strEncryptString
 | ) |  |

RSA加密

参数
xmlPublicKey
m_strEncryptString
返回

在文件 RSACryption.cs 第 45 行定义.

string SinGooCMS.Utility.RSACryption.RSAEncrypt | ( | string | xmlPublicKey,
 |  | byte[] | EncryptString
 | ) |  |

RSA加密

参数
xmlPublicKey
EncryptString
返回

在文件 RSACryption.cs 第 66 行定义.

void SinGooCMS.Utility.RSACryption.RSAKey | ( | out string | xmlKeys,
 |  | out string | xmlPublicKey
 | ) |  |

RSA 的密钥产生 产生私钥 和公钥

参数
xmlKeys
xmlPublicKey

在文件 RSACryption.cs 第 24 行定义.

bool SinGooCMS.Utility.RSACryption.SignatureDeformatter | ( | string | p_strKeyPublic,
 |  | byte[] | HashbyteDeformatter,
 |  | byte[] | DeformatterData
 | ) |  |

签名验证

参数
p_strKeyPublic
HashbyteDeformatter
DeformatterData
返回

在文件 RSACryption.cs 第 322 行定义.

bool SinGooCMS.Utility.RSACryption.SignatureDeformatter | ( | string | p_strKeyPublic,
 |  | string | p_strHashbyteDeformatter,
 |  | byte[] | DeformatterData
 | ) |  |

签名验证

参数
p_strKeyPublic
p_strHashbyteDeformatter
DeformatterData
返回

在文件 RSACryption.cs 第 349 行定义.

bool SinGooCMS.Utility.RSACryption.SignatureDeformatter | ( | string | p_strKeyPublic,
 |  | byte[] | HashbyteDeformatter,
 |  | string | p_strDeformatterData
 | ) |  |

签名验证

参数
p_strKeyPublic
HashbyteDeformatter
p_strDeformatterData
返回

在文件 RSACryption.cs 第 381 行定义.

bool SinGooCMS.Utility.RSACryption.SignatureDeformatter | ( | string | p_strKeyPublic,
 |  | string | p_strHashbyteDeformatter,
 |  | string | p_strDeformatterData
 | ) |  |

签名验证

参数
p_strKeyPublic
p_strHashbyteDeformatter
p_strDeformatterData
返回

在文件 RSACryption.cs 第 413 行定义.

bool SinGooCMS.Utility.RSACryption.SignatureFormatter | ( | string | p_strKeyPrivate,
 |  | byte[] | HashbyteSignature,
 |  | ref byte[] | EncryptedSignatureData
 | ) |  |

RSA签名

参数
p_strKeyPrivate
HashbyteSignature
EncryptedSignatureData
返回

在文件 RSACryption.cs 第 214 行定义.

bool SinGooCMS.Utility.RSACryption.SignatureFormatter | ( | string | p_strKeyPrivate,
 |  | byte[] | HashbyteSignature,
 |  | ref string | m_strEncryptedSignatureData
 | ) |  |

RSA签名

参数
p_strKeyPrivate
HashbyteSignature
m_strEncryptedSignatureData
返回

在文件 RSACryption.cs 第 237 行定义.

bool SinGooCMS.Utility.RSACryption.SignatureFormatter | ( | string | p_strKeyPrivate,
 |  | string | m_strHashbyteSignature,
 |  | ref byte[] | EncryptedSignatureData
 | ) |  |

RSA签名

参数
p_strKeyPrivate
m_strHashbyteSignature
EncryptedSignatureData
返回

在文件 RSACryption.cs 第 264 行定义.

bool SinGooCMS.Utility.RSACryption.SignatureFormatter | ( | string | p_strKeyPrivate,
 |  | string | m_strHashbyteSignature,
 |  | ref string | m_strEncryptedSignatureData
 | ) |  |

RSA签名

参数
p_strKeyPrivate
m_strHashbyteSignature
m_strEncryptedSignatureData
返回

在文件 RSACryption.cs 第 290 行定义.

该类的文档由以下文件生成:
  • SinGooCMS.Utility/Security/RSACryption.cs


SinGooCMS.Utility: SinGooCMS.Utility.SessionUtils类 参考

  • SinGooCMS
  • Utility
  • SessionUtils
静态 Public 成员函数 | 所有成员列表
SinGooCMS.Utility.SessionUtils类 参考

session会话工具 更多...

静态 Public 成员函数

static bool | ContainKey (string key)
是否包含key 更多...
static void | SetSession (string key, string value, int time=60 *30)
写入Session值 .net core 在Startup配置Session超时时间 services.AddSession(options => {options.IdleTimeout = TimeSpan.FromSeconds(30 * 60);}); 更多...
static void | SetSession< T > (string key, T value, int time=60 *24)
写入Session值 更多...
static T | GetSession< T > (string key)
读Session值 更多...
static void | DelSession (string key)
删除Session 更多...

详细描述

session会话工具

在文件 SessionUtils.cs 第 18 行定义.

成员函数说明

static bool SinGooCMS.Utility.SessionUtils.ContainKey ( string key )
static

是否包含key

参数
key
返回

在文件 SessionUtils.cs 第 25 行定义.

static void SinGooCMS.Utility.SessionUtils.DelSession ( string key )
static

删除Session

参数
key

在文件 SessionUtils.cs 第 113 行定义.

static T SinGooCMS.Utility.SessionUtils.GetSession< T > ( string key )
static

读Session值

模板参数
T
参数
key
返回
类型限制
T : class

在文件 SessionUtils.cs 第 92 行定义.

static void SinGooCMS.Utility.SessionUtils.SetSession | ( | string | key,
 |  | string | value,
 |  | int | time = 60 * 30
 | ) |  |
static

写入Session值 .net core 在Startup配置Session超时时间 services.AddSession(options => {options.IdleTimeout = TimeSpan.FromSeconds(30 * 60);});

参数
key | 键
value | 值
time | 超时时间(分钟)

在文件 SessionUtils.cs 第 43 行定义.

static void SinGooCMS.Utility.SessionUtils.SetSession< T > | ( | string | key,
 |  | T | value,
 |  | int | time = 60 * 24
 | ) |  |
static

写入Session值

模板参数
T
参数
key
value
time

在文件 SessionUtils.cs 第 60 行定义.

该类的文档由以下文件生成:
  • SinGooCMS.Utility/Web/SessionUtils.cs


SinGooCMS.Utility: SinGooCMS.Utility.ShareFileUtils类 参考

  • SinGooCMS
  • Utility
  • ShareFileUtils
Public 成员函数 | 静态 Public 成员函数 | 属性 | 所有成员列表
SinGooCMS.Utility.ShareFileUtils类 参考

局域网共享文件工具 更多...

Public 成员函数

DirectoryInfo | GetDir (string dirPath)
读取共享文件目录信息 更多...
FileInfo | GetFile (string fileName)
读取共享文件信息 更多...
void | DownFile (string shareFileName, string localDir)
从共享文件夹下载到本地目录下 更多...
void | UpFile (string localFileName, string shareDir)
从本地复制到共享目录下 更多...
void | Disconnect ()
断开连接 更多...

静态 Public 成员函数

static ShareFileUtils | Connect (string sharePath, string userName, string password, string localDisk="")
连接远程共享文件夹,并返回对象 更多...
static void | DisconnectAll ()
断开所有连接 更多...
static string | ShowConnect ()
查看当前所有连接 更多...

属性

string | SharePath [get, set]
string | UserName [get, set]
string | Password [get, set]

详细描述

局域网共享文件工具

在文件 ShareFileUtils.cs 第 10 行定义.

成员函数说明

static ShareFileUtils SinGooCMS.Utility.ShareFileUtils.Connect | ( | string | sharePath,
 |  | string | userName,
 |  | string | password,
 |  | string | localDisk = ""
 | ) |  |
static

连接远程共享文件夹,并返回对象

参数
sharePath
userName
password
localDisk
返回

在文件 ShareFileUtils.cs 第 28 行定义.

函数调用图:

void SinGooCMS.Utility.ShareFileUtils.Disconnect ( )

断开连接

在文件 ShareFileUtils.cs 第 131 行定义.

函数调用图:

static void SinGooCMS.Utility.ShareFileUtils.DisconnectAll ( )
static

断开所有连接

在文件 ShareFileUtils.cs 第 144 行定义.

函数调用图:

void SinGooCMS.Utility.ShareFileUtils.DownFile | ( | string | shareFileName,
 |  | string | localDir
 | ) |  |

从共享文件夹下载到本地目录下

参数
shareFileName | 共享文件名
localDir | 本地目录

在文件 ShareFileUtils.cs 第 74 行定义.

DirectoryInfo SinGooCMS.Utility.ShareFileUtils.GetDir ( string dirPath )

读取共享文件目录信息

参数
dirPath
返回
FileInfo SinGooCMS.Utility.ShareFileUtils.GetFile ( string fileName )

读取共享文件信息

参数
fileName
返回
static string SinGooCMS.Utility.ShareFileUtils.ShowConnect ( )
static

查看当前所有连接

返回

在文件 ShareFileUtils.cs 第 154 行定义.

函数调用图:

void SinGooCMS.Utility.ShareFileUtils.UpFile | ( | string | localFileName,
 |  | string | shareDir
 | ) |  |

从本地复制到共享目录下

参数
localFileName | 本地文件名（全路径）
shareDir | 共享目录

在文件 ShareFileUtils.cs 第 103 行定义.

属性说明

string SinGooCMS.Utility.ShareFileUtils.Password
getsetprivate

在文件 ShareFileUtils.cs 第 16 行定义.

string SinGooCMS.Utility.ShareFileUtils.SharePath
getsetprivate

在文件 ShareFileUtils.cs 第 14 行定义.

string SinGooCMS.Utility.ShareFileUtils.UserName
getsetprivate

在文件 ShareFileUtils.cs 第 15 行定义.

该类的文档由以下文件生成:
  • SinGooCMS.Utility/IO/ShareFileUtils.cs


SinGooCMS.Utility: SinGooCMS.Utility.SinGooArray类 参考

  • SinGooCMS
  • Utility
  • SinGooArray
属性 | 所有成员列表
SinGooCMS.Utility.SinGooArray类 参考

ArrayList扩展，实现取范围数据 更多...

类 SinGooCMS.Utility.SinGooArray 继承关系图:
[图例]
SinGooCMS.Utility.SinGooArray 的协作图:
[图例]

属性

object this[int indexBeg, int indexEnd] [get]
获取一段数据，返回一个新数组 更多...

详细描述

ArrayList扩展，实现取范围数据

在文件 SinGooList.cs 第 43 行定义.

属性说明

object SinGooCMS.Utility.SinGooArray.this[int indexBeg, int indexEnd]
get

获取一段数据，返回一个新数组

参数
indexBeg | 起始下标，下标从0开始
indexEnd | 截至下标，下标从0开始
返回

在文件 SinGooList.cs 第 52 行定义.

该类的文档由以下文件生成:
  • SinGooCMS.Utility/List/SinGooList.cs


SinGooCMS.Utility: SinGooCMS.Utility.SinGooDictionary< T1, T2 > 模板类 参考

  • SinGooCMS
  • Utility
  • SinGooDictionary
属性 | 所有成员列表
SinGooCMS.Utility.SinGooDictionary< T1, T2 > 模板类 参考

Dictionary扩展，实现从下标取值 更多...

类 SinGooCMS.Utility.SinGooDictionary< T1, T2 > 继承关系图:
[图例]
SinGooCMS.Utility.SinGooDictionary< T1, T2 > 的协作图:
[图例]

属性

object | this[int indexBeg] [get]
获取一段数据，返回一个新字典 更多...
object | this[int indexBeg, int indexEnd] [get]
获取一段数据，返回一个新字典 更多...

详细描述

Dictionary扩展，实现从下标取值

模板参数
T1
T2

在文件 SinGooList.cs 第 78 行定义.

属性说明

object SinGooCMS.Utility.SinGooDictionary< T1, T2 >.this[int indexBeg, int indexEnd]
get

获取一段数据，返回一个新字典

参数
indexBeg | 起始下标，下标从0开始
indexEnd | 截至下标，下标从0开始
返回

在文件 SinGooList.cs 第 114 行定义.

object SinGooCMS.Utility.SinGooDictionary< T1, T2 >.this[int indexBeg]
get

获取一段数据，返回一个新字典

参数
indexBeg 起始下标，下标从0开始
返回

在文件 SinGooList.cs 第 86 行定义.

该类的文档由以下文件生成:
  • SinGooCMS.Utility/List/SinGooList.cs


SinGooCMS.Utility: SinGooCMS.Utility.SinGooList< T > 模板类 参考

  • SinGooCMS
  • Utility
  • SinGooList
属性 | 所有成员列表
SinGooCMS.Utility.SinGooList< T > 模板类 参考

List扩展，实现取范围数据 更多...

类 SinGooCMS.Utility.SinGooList< T > 继承关系图:
[图例]
SinGooCMS.Utility.SinGooList< T > 的协作图:
[图例]

属性

SinGooList< T > this[int indexBeg, int indexEnd] [get]
获取一段数据，返回一个新列表 更多...

详细描述

List扩展，实现取范围数据

模板参数
T

在文件 SinGooList.cs 第 11 行定义.

属性说明

SinGooList<T> SinGooCMS.Utility.SinGooList< T >.this[int indexBeg, int indexEnd]
get

获取一段数据，返回一个新列表

参数
indexBeg | 起始下标，下标从0开始
indexEnd | 截至下标，下标从0开始
返回

在文件 SinGooList.cs 第 20 行定义.

该类的文档由以下文件生成:
  • SinGooCMS.Utility/List/SinGooList.cs


SinGooCMS.Utility: SinGooCMS.Utility.SocketClient类 参考

  • SinGooCMS
  • Utility
  • SocketClient
静态 Public 成员函数 | 静态 Private 成员函数 | 静态 Private 属性 | 所有成员列表
SinGooCMS.Utility.SocketClient类 参考

Socket客户端操作类 更多...

静态 Public 成员函数

static Socket | ListenerSocket (this TcpListener listener)
服务器侦听方法 返回null则说明没有链接上 更多...
static NetworkStream | ListenerStream (this TcpListener listener)
服务器侦听方法 返回null则说明没有链接上 更多...
static Socket | ConnectSocket (this TcpClient tcpclient, IPEndPoint ipendpoint)
从客户端连接获取socket对象 更多...
static Socket | ConnectSocket (this TcpClient tcpclient, IPAddress ipadd, int port)
从客户端连接获取socket对象 更多...
static NetworkStream | ConnectStream (this TcpClient tcpclient, IPEndPoint ipendpoint)
从客户端获取网络流对象 更多...
static NetworkStream | ConnectStream (this TcpClient tcpclient, IPAddress ipadd, int port)
从客户端获取网络流对象 更多...
static byte[] | ReceiveFixData (this Socket socket, int size)
接受固定长度字符串 更多...
static byte[] | ReceiveVarData (this Socket socket)
接收变长字符串 为了处理粘包问题 ,每次发送数据时 包头(数据字节长度) + 正文 这个发送小数据 设置包头的字节为8,不能超过8位数的字节数组 更多...
static T | ReceiveVarData< T > (this Socket socket)
接收T类对象,反序列化 更多...
static bool | ReceiveFile (this Socket socket, string path, string filename, long size, Action< int > progress)
在预先得到文件的文件名和大小 调用此方法接收文件 更多...
static bool | ReceiveFile (this Socket socket, string path, string filename, long size)
从socket服务端接收文件 更多...
static void | ReceiveFile (this Socket socket, string path)
预先不知道文件名和文件大小 用此方法接收 此方法对于的发送方法是SendFile() 更多...
static string | GetPath (string directory, string file)
得到文件路径(防止有文件名重复) 如:aaa.txt已经在directory目录下存在,则会得到文件aaa(1).txt 更多...
static int | SendFixData (this Socket socket, byte[] msg)
发送固定长度消息 发送字节数不能大于int型最大值 更多...
static int | SendVarData (this Socket socket, string contact)
发送变长信息 格式 包头(包头占8位) + 正文 更多...
static int | SendVarData (this Socket socket, byte[] bytes)
发送变成信息 更多...
static int | SendSerializeObject< T > (this Socket socket, T obj)
发送T类型对象,序列化 更多...
static bool | SendFile (this Socket socket, string path, bool issend, Action< int > progress)
发送文件 更多...
static bool | SendFile (this Socket socket, string path, bool issend)
发送文件,不需要进度信息 更多...
static bool | SendFile (this Socket socket, string path)
发送文件,不需要进度信息和(头)信息 更多...

静态 Private 成员函数

static int | GetPacketLength (byte[] length)
static byte[] | SerializeObject (object obj)
static string | GetSendPacketLengthStr (int size)

静态 Private 属性

static readonly int | m_maxpacket = 1024 * 4
设置数据缓冲区大小 默认1024 更多...
static int | i
static string | markPath = string.Empty

详细描述

Socket客户端操作类

在文件 SocketClient.cs 第 16 行定义.

成员函数说明

static Socket SinGooCMS.Utility.SocketClient.ConnectSocket | ( | this TcpClient | tcpclient,
 |  | IPEndPoint | ipendpoint
 | ) |  |
static

从客户端连接获取socket对象

参数
tcpclient | TCP客户端
ipendpoint | 客户端节点
返回
客户端socket

在文件 SocketClient.cs 第 72 行定义.

static Socket SinGooCMS.Utility.SocketClient.ConnectSocket | ( | this TcpClient | tcpclient,
 |  | IPAddress | ipadd,
 |  | int | port
 | ) |  |
static

从客户端连接获取socket对象

参数
tcpclient | TCP客户端
ipadd | IP地址
port | 端口号
返回
客户端socket

在文件 SocketClient.cs 第 92 行定义.

static NetworkStream SinGooCMS.Utility.SocketClient.ConnectStream | ( | this TcpClient | tcpclient,
 |  | IPEndPoint | ipendpoint
 | ) |  |
static

从客户端获取网络流对象

参数
tcpclient | TCP客户端
ipendpoint | 客户端节点
返回
客户端的网络流

在文件 SocketClient.cs 第 111 行定义.

static NetworkStream SinGooCMS.Utility.SocketClient.ConnectStream | ( | this TcpClient | tcpclient,
 |  | IPAddress | ipadd,
 |  | int | port
 | ) |  |
static

从客户端获取网络流对象

参数
tcpclient | TCP客户端
ipadd | IP地址
port | 端口号
返回
客户端网络流对象

在文件 SocketClient.cs 第 131 行定义.

static int SinGooCMS.Utility.SocketClient.GetPacketLength ( byte[] length )
staticprivate

在文件 SocketClient.cs 第 355 行定义.

static string SinGooCMS.Utility.SocketClient.GetPath | ( | string | directory,
 |  | string | file
 | ) |  |
static

得到文件路径(防止有文件名重复) 如:aaa.txt已经在directory目录下存在,则会得到文件aaa(1).txt

参数
directory | 目录名
file | 文件名
返回
文件路径

在文件 SocketClient.cs 第 373 行定义.

static string SinGooCMS.Utility.SocketClient.GetSendPacketLengthStr ( int size )
staticprivate

在文件 SocketClient.cs 第 576 行定义.

static Socket SinGooCMS.Utility.SocketClient.ListenerSocket ( this TcpListener listener )
static

服务器侦听方法 返回null则说明没有链接上

返回
返回一个套接字(Socket)

在文件 SocketClient.cs 第 33 行定义.

static NetworkStream SinGooCMS.Utility.SocketClient.ListenerStream ( this TcpListener listener )
static

服务器侦听方法 返回null则说明没有链接上

参数
listener TCP监听对象
返回
返回一个网络流

在文件 SocketClient.cs 第 50 行定义.

static bool SinGooCMS.Utility.SocketClient.ReceiveFile | ( | this Socket | socket,
 |  | string | path,
 |  | string | filename,
 |  | long | size,
 |  | Action< int > | progress
 | ) |  |
static

在预先得到文件的文件名和大小 调用此方法接收文件

参数
socket | socket服务端
path | 路径必须存在
filename | 文件名
size | 预先知道的文件大小
progress | 处理过程

在文件 SocketClient.cs 第 257 行定义.

static bool SinGooCMS.Utility.SocketClient.ReceiveFile | ( | this Socket | socket,
 |  | string | path,
 |  | string | filename,
 |  | long | size
 | ) |  |
static

从socket服务端接收文件

参数
socket | socket服务端
path | 文件保存路径(必须存在)
filename | 文件名
size | 预先知道的文件大小
返回
处理结果

在文件 SocketClient.cs 第 326 行定义.

static void SinGooCMS.Utility.SocketClient.ReceiveFile | ( | this Socket | socket,
 |  | string | path
 | ) |  |
static

预先不知道文件名和文件大小 用此方法接收 此方法对于的发送方法是SendFile()

参数
socket | socket服务端
path | 要保存的目录

在文件 SocketClient.cs 第 337 行定义.

static byte [] SinGooCMS.Utility.SocketClient.ReceiveFixData | ( | this Socket | socket,
 |  | int | size
 | ) |  |
static

接受固定长度字符串

参数
socket | socket对象
size | 字符串长度
返回
字节数据

在文件 SocketClient.cs 第 154 行定义.

static byte [] SinGooCMS.Utility.SocketClient.ReceiveVarData ( this Socket socket )
static

接收变长字符串 为了处理粘包问题 ,每次发送数据时 包头(数据字节长度) + 正文 这个发送小数据 设置包头的字节为8,不能超过8位数的字节数组

参数
socket 客户端socket
返回
byte[]数组

在文件 SocketClient.cs 第 182 行定义.

static T SinGooCMS.Utility.SocketClient.ReceiveVarData< T > ( this Socket socket )
static

接收T类对象,反序列化

模板参数
T 接收T类对象,T类必须是一个可序列化类
参数
socket 客户端socket
返回
强类型对象

在文件 SocketClient.cs 第 198 行定义.

static bool SinGooCMS.Utility.SocketClient.SendFile | ( | this Socket | socket,
 |  | string | path,
 |  | bool | issend,
 |  | Action< int > | progress
 | ) |  |
static

发送文件

参数
socket | socket对象
path | 文件路径
issend | 是否发送文件(头)信息,如果当前知道文件[大小,名称]则为false
progress | 处理过程
返回
处理结果

在文件 SocketClient.cs 第 488 行定义.

static bool SinGooCMS.Utility.SocketClient.SendFile | ( | this Socket | socket,
 |  | string | path,
 |  | bool | issend
 | ) |  |
static

发送文件,不需要进度信息

参数
socket | socket对象
path | 文件路径
issend | 是否发生(头)信息
返回
处理结果

在文件 SocketClient.cs 第 550 行定义.

static bool SinGooCMS.Utility.SocketClient.SendFile | ( | this Socket | socket,
 |  | string | path
 | ) |  |
static

发送文件,不需要进度信息和(头)信息

参数
socket | socket对象
path | 文件路径
返回
处理结果

在文件 SocketClient.cs 第 561 行定义.

static int SinGooCMS.Utility.SocketClient.SendFixData | ( | this Socket | socket,
 |  | byte[] | msg
 | ) |  |
static

发送固定长度消息 发送字节数不能大于int型最大值

参数
socket | 源socket
msg | 消息的字节数组
返回
返回发送字节个数

在文件 SocketClient.cs 第 405 行定义.

static int SinGooCMS.Utility.SocketClient.SendSerializeObject< T > | ( | this Socket | socket,
 |  | T | obj
 | ) |  |
static

发送T类型对象,序列化

模板参数
T T类型
参数
socket | 发送方的socket对象
obj | T类型对象,必须是可序列化的
返回
消息长度

在文件 SocketClient.cs 第 474 行定义.

static int SinGooCMS.Utility.SocketClient.SendVarData | ( | this Socket | socket,
 |  | string | contact
 | ) |  |
static

发送变长信息 格式 包头(包头占8位) + 正文

参数
socket | 发送方socket对象
contact | 发送文本
返回
发送的数据内容长度

在文件 SocketClient.cs 第 437 行定义.

static int SinGooCMS.Utility.SocketClient.SendVarData | ( | this Socket | socket,
 |  | byte[] | bytes
 | ) |  |
static

发送变成信息

参数
socket | 发送方socket对象
bytes | 消息的 字节数组
返回
消息长度

在文件 SocketClient.cs 第 455 行定义.

static byte [] SinGooCMS.Utility.SocketClient.SerializeObject ( object obj )
staticprivate

在文件 SocketClient.cs 第 566 行定义.

类成员变量说明

int SinGooCMS.Utility.SocketClient.i
staticprivate

在文件 SocketClient.cs 第 362 行定义.

readonly int SinGooCMS.Utility.SocketClient.m_maxpacket = 1024 * 4
staticprivate

设置数据缓冲区大小 默认1024

在文件 SocketClient.cs 第 23 行定义.

string SinGooCMS.Utility.SocketClient.markPath = string.Empty
staticprivate

在文件 SocketClient.cs 第 364 行定义.

该类的文档由以下文件生成:
  • SinGooCMS.Utility/Net/SocketClient.cs


SinGooCMS.Utility: SinGooCMS.Utility.StopwatchUtils类 参考

  • SinGooCMS
  • Utility
  • StopwatchUtils
静态 Public 成员函数 | 所有成员列表
SinGooCMS.Utility.StopwatchUtils类 参考

计数器帮助类 更多...

静态 Public 成员函数

static double Execute (Action action)
执行方法 更多...

详细描述

计数器帮助类

在文件 StopwatchUtils.cs 第 9 行定义.

成员函数说明

static double SinGooCMS.Utility.StopwatchUtils.Execute ( Action action )
static

执行方法

参数
action
返回

在文件 StopwatchUtils.cs 第 16 行定义.

该类的文档由以下文件生成:
  • SinGooCMS.Utility/System/StopwatchUtils.cs


SinGooCMS.Utility: SinGooCMS.Utility.StringUtils类 参考

  • SinGooCMS
  • Utility
  • StringUtils
Public 类型 | 静态 Public 成员函数 | Private 属性 | 所有成员列表
SinGooCMS.Utility.StringUtils类 参考

字符串处理 更多...

Public 类型

enum SNType { SNType.FULLFOMART, SNType.NORMALFORMAT, SNType.SHORTFORMAT }

静态 Public 成员函数

static string | GetChineseSpellFirst (string strText)
获取汉字拼音的首字母 更多...
static string | GetChineseSpell (string strText)
获取汉字拼音 更多...
static string | GetTraditional (string str)
简体转换为繁体 更多...
static string | GetSimplified (string str)
繁体转换为简体 更多...
static string | Cut (string sourceStr, int len, string appendString="...")
截取字符串 更多...
static string | Cut (string source, string begin, string end)
截取中间一段字符串 更多...
static int | GetStringLength (string str)
返回字符串真实长度, 1个汉字长度为2 更多...
static string | Compress (string strHTML)
压缩HTML 更多...
static string | ChkSQL (string str)
替换单引号到双引号 更多...
static string[] | Split (string input, string pattern, bool ignoreCase=false)
在由正则表达式模式定义的位置拆分输入字符串。 更多...
static string | GetNewFileName ()
生成一个新的文件名 更多...
static string | GetRandomNumber (int length=10)
生成一个全数字随机数(默认10位)，可以用来生成6位验证码 更多...
static string | GetRandomString (int length=10, string custom="", bool useNum=true, bool useLow=true, bool useUpp=true, bool useSpe=false)
static string | GetGUID ()
生成GUID 更多...
static string | GetSpaceChar (int depth)
返回空格 更多...
static string | GetCatePrefix (int intDept, bool boolIsEnd)
返回分类前缀 更多...
static string | GenerateSN (string SNFormat, SNType?snType=null)
按年月随机数生成编号${year}${month}${day}${hour}${minute}${second}${millisecond}${rnd} 更多...
static Uri | GenerateUri (string[] parameters, string protocol="http://")
生成uri地址 更多...

Private 属性

const string | FULLFOMART = "${year}${month}${day}${hour}${minute}${second}${millisecond}${rnd}"
const string | NORMALFORMAT = "${year}${month}${day}${millisecond}${rnd}"
const string | SHORTFORMAT = "${year}${month}${day}${rnd}"

详细描述

字符串处理

在文件 StringUtils.cs 第 17 行定义.

成员枚举类型说明

enum SinGooCMS.Utility.StringUtils.SNType
strong
枚举值
FULLFOMART
NORMALFORMAT
SHORTFORMAT

在文件 StringUtils.cs 第 297 行定义.

成员函数说明

static string SinGooCMS.Utility.StringUtils.ChkSQL ( string str )
static

替换单引号到双引号

在文件 StringUtils.cs 第 159 行定义.

static string SinGooCMS.Utility.StringUtils.Compress ( string strHTML )
static

压缩HTML

返回

在文件 StringUtils.cs 第 147 行定义.

static string SinGooCMS.Utility.StringUtils.Cut | ( | string | sourceStr,
 |  | int | len,
 |  | string | appendString = "..."
 | ) |  |
static

截取字符串

参数
sourceStr
len
appendString
返回

在文件 StringUtils.cs 第 110 行定义.

static string SinGooCMS.Utility.StringUtils.Cut | ( | string | source,
 |  | string | begin,
 |  | string | end
 | ) |  |
static

截取中间一段字符串

参数
source
begin
end
返回

在文件 StringUtils.cs 第 124 行定义.

static string SinGooCMS.Utility.StringUtils.GenerateSN | ( | string | SNFormat,
 |  | SNType? | snType = null
 | ) |  |
static

按年月随机数生成编号${year}${month}${day}${hour}${minute}${second}${millisecond}${rnd}

参数
SNFormat
返回

在文件 StringUtils.cs 第 309 行定义.

函数调用图:

static Uri SinGooCMS.Utility.StringUtils.GenerateUri | ( | string[] | parameters,
 |  | string | protocol = "http://"
 | ) |  |
static

生成uri地址

参数
parameters | 参数
protocol | 协议 http:// https:// ftp://
返回

在文件 StringUtils.cs 第 346 行定义.

这是这个函数的调用关系图:

static string SinGooCMS.Utility.StringUtils.GetCatePrefix | ( | int | intDept,
 |  | bool | boolIsEnd
 | ) |  |
static

返回分类前缀

参数
intDept
boolIsEnd
返回

在文件 StringUtils.cs 第 274 行定义.

static string SinGooCMS.Utility.StringUtils.GetChineseSpell ( string strText )
static

获取汉字拼音

参数
strText
返回

在文件 StringUtils.cs 第 42 行定义.

static string SinGooCMS.Utility.StringUtils.GetChineseSpellFirst ( string strText )
static

获取汉字拼音的首字母

参数
strText
返回

在文件 StringUtils.cs 第 26 行定义.

static string SinGooCMS.Utility.StringUtils.GetGUID ( )
static

生成GUID

返回

在文件 StringUtils.cs 第 245 行定义.

static string SinGooCMS.Utility.StringUtils.GetNewFileName ( )
static

生成一个新的文件名

返回

这是这个函数的调用关系图:

static string SinGooCMS.Utility.StringUtils.GetRandomNumber ( int length = 10 )
static

生成一个全数字随机数(默认10位)，可以用来生成6位验证码

返回

summary> 生成随机字符串 /summary> param name="length">目标字符串的长度

param name="custom">要包含的自定义字符，直接输入要包含的字符列表

param name="useNum">是否包含数字，1=包含，默认为包含

param name="useLow">是否包含小写字母，1=包含，默认为包含

param name="useUpp">是否包含大写字母，1=包含，默认为包含

param name="useSpe">是否包含特殊字符，1=包含，默认为不包含

returns>指定长度的随机字符串

static string SinGooCMS.Utility.StringUtils.GetRandomString | ( | int | length = 10,
 |  | string | custom = "",
 |  | bool | useNum = true,
 |  | bool | useLow = true,
 |  | bool | useUpp = true,
 |  | bool | useSpe = false
 | ) |  |
static

在文件 StringUtils.cs 第 218 行定义.

这是这个函数的调用关系图:

static string SinGooCMS.Utility.StringUtils.GetSimplified ( string str )
static

繁体转换为简体

参数
str 繁体字
返回
简体字

在文件 StringUtils.cs 第 90 行定义.

static string SinGooCMS.Utility.StringUtils.GetSpaceChar ( int depth )
static

返回空格

参数
depth
返回

在文件 StringUtils.cs 第 258 行定义.

static int SinGooCMS.Utility.StringUtils.GetStringLength ( string str )
static

返回字符串真实长度, 1个汉字长度为2

返回
static string SinGooCMS.Utility.StringUtils.GetTraditional ( string str )
static

简体转换为繁体

参数
str 简体字
返回
繁体字

在文件 StringUtils.cs 第 75 行定义.

static string [] SinGooCMS.Utility.StringUtils.Split | ( | string | input,
 |  | string | pattern,
 |  | bool | ignoreCase = false
 | ) |  |
static

在由正则表达式模式定义的位置拆分输入字符串。

参数
input
pattern
ignoreCase
返回

在文件 StringUtils.cs 第 183 行定义.

类成员变量说明

const string SinGooCMS.Utility.StringUtils.FULLFOMART = "${year}${month}${day}${hour}${minute}${second}${millisecond}${rnd}"
private

在文件 StringUtils.cs 第 293 行定义.

const string SinGooCMS.Utility.StringUtils.NORMALFORMAT = "${year}${month}${day}${millisecond}${rnd}"
private

在文件 StringUtils.cs 第 294 行定义.

const string SinGooCMS.Utility.StringUtils.SHORTFORMAT = "${year}${month}${day}${rnd}"
private

在文件 StringUtils.cs 第 295 行定义.

该类的文档由以下文件生成:
  • SinGooCMS.Utility/String/StringUtils.cs


SinGooCMS.Utility: SinGooCMS.Utility.TimeUtils类 参考

  • SinGooCMS
  • Utility
  • TimeUtils
静态 Public 成员函数 | 所有成员列表
SinGooCMS.Utility.TimeUtils类 参考

时间工具 更多...

静态 Public 成员函数

static string | GetDateDiff (DateTime time1, DateTime time2)
返回时间差 更多...
static TimeSpan | GetTimeSpan (DateTime time1, DateTime time2)
获得两个日期的间隔 更多...

详细描述

时间工具

在文件 TimeUtils.cs 第 8 行定义.

成员函数说明

static string SinGooCMS.Utility.TimeUtils.GetDateDiff | ( | DateTime | time1,
 |  | DateTime | time2
 | ) |  |
static

返回时间差

参数
time1 | 起始日期
time2 | 结束日期
返回

在文件 TimeUtils.cs 第 16 行定义.

static TimeSpan SinGooCMS.Utility.TimeUtils.GetTimeSpan | ( | DateTime | time1,
 |  | DateTime | time2
 | ) |  |
static

获得两个日期的间隔

参数
time1 | 起始日期
time2 | 结束日期
返回
日期间隔TimeSpan。

在文件 TimeUtils.cs 第 51 行定义.

该类的文档由以下文件生成:
  • SinGooCMS.Utility/Date/TimeUtils.cs


SinGooCMS.Utility: SinGooCMS.Utility.UnicodeUtils类 参考

  • SinGooCMS
  • Utility
  • UnicodeUtils
静态 Public 成员函数 | 所有成员列表
SinGooCMS.Utility.UnicodeUtils类 参考

unicode 编解码
"空\u0020格" => "空 格"
"空 格" => "\u7a7a\u20\u683c" 更多...

静态 Public 成员函数

static string | Encode (string str)
Unicode编码 更多...
static string | Decode (string str)
Unicode解码 更多...

详细描述

unicode 编解码
"空\u0020格" => "空 格"
"空 格" => "\u7a7a\u20\u683c"

在文件 UnicodeUtils.cs 第 14 行定义.

成员函数说明

static string SinGooCMS.Utility.UnicodeUtils.Decode ( string str )
static

Unicode解码

参数
str
返回

在文件 UnicodeUtils.cs 第 41 行定义.

static string SinGooCMS.Utility.UnicodeUtils.Encode ( string str )
static

Unicode编码

参数
str
返回

在文件 UnicodeUtils.cs 第 21 行定义.

该类的文档由以下文件生成:
  • SinGooCMS.Utility/Text/UnicodeUtils.cs


SinGooCMS.Utility: SinGooCMS.Utility.UtilsBase类 参考

  • SinGooCMS
  • Utility
  • UtilsBase
静态 Public 属性 | 所有成员列表
SinGooCMS.Utility.UtilsBase类 参考

工具底层，主要获取 http上下文 HttpContext。netfx从system.web中读取，core需要注入 更多...

静态 Public 属性

static HttpContext | HttpContext => System.Web.HttpContext.Current
http上下文 更多...
static HttpRequest | Request => System.Web.HttpContext.Current?.Request
请求 更多...
static HttpResponse | Response => System.Web.HttpContext.Current?.Response
输出 更多...

详细描述

工具底层，主要获取 http上下文 HttpContext。netfx从system.web中读取，core需要注入

在文件 UtilsBase.cs 第 13 行定义.

类成员变量说明

HttpContext SinGooCMS.Utility.UtilsBase.HttpContext => System.Web.HttpContext.Current
static

http上下文

在文件 UtilsBase.cs 第 43 行定义.

HttpRequest SinGooCMS.Utility.UtilsBase.Request => System.Web.HttpContext.Current?.Request
static

请求

在文件 UtilsBase.cs 第 47 行定义.

HttpResponse SinGooCMS.Utility.UtilsBase.Response => System.Web.HttpContext.Current?.Response
static

输出

在文件 UtilsBase.cs 第 51 行定义.

该类的文档由以下文件生成:
  • SinGooCMS.Utility/UtilsBase.cs


SinGooCMS.Utility: SinGooCMS.Utility.VideoUtils类 参考

  • SinGooCMS
  • Utility
  • VideoUtils
Public 成员函数 | 静态 Public 成员函数 | 属性 | 所有成员列表
SinGooCMS.Utility.VideoUtils类 参考

视频剪切工具.上传视频后可截取视频存储为图片,注意要调用文件：ffmpeg.exe 更多...

Public 成员函数

bool Save (string fullVideoFile, string fullOutputImg)
保存截图 更多...

静态 Public 成员函数

static VideoUtils Init (string ffmpegPath, string startPoint="00:00:06", int cutImgWidth=500, int cutImgHeight=400, string imgExt=".jpg")
初始化 更多...

属性

string | ToolsPath [get, set]
工具所在路径 更多...
string | StartPoint [get, set]
截图起始时间段 格式 00:00:06 更多...
int | CutImgWidth [get, set]
截图长度 更多...
int | CutImgHeight [get, set]
截图宽度 更多...
string | CutImgExtend [get, set]
截图文件格式 更多...

详细描述

视频剪切工具.上传视频后可截取视频存储为图片,注意要调用文件：ffmpeg.exe

在文件 VideoUtils.cs 第 9 行定义.

成员函数说明

static VideoUtils SinGooCMS.Utility.VideoUtils.Init | ( | string | ffmpegPath,
 |  | string | startPoint = "00:00:06",
 |  | int | cutImgWidth = 500,
 |  | int | cutImgHeight = 400,
 |  | string | imgExt = ".jpg"
 | ) |  |
static

初始化

参数
ffmpegPath | ffmpeg.exe的绝对路径
startPoint | 视频开始时间 如00:00:06 表示第6秒
cutImgWidth | 截图宽 px
cutImgHeight | 截图高 px
imgExt | 截图扩展名
返回
VideoUtils的实例

在文件 VideoUtils.cs 第 45 行定义.

bool SinGooCMS.Utility.VideoUtils.Save | ( | string | fullVideoFile,
 |  | string | fullOutputImg
 | ) |  |

保存截图

参数
fullVideoFile | 视频文件路径
fullOutputImg | 保存的图片文件路径
返回

在文件 VideoUtils.cs 第 63 行定义.

函数调用图:

属性说明

string SinGooCMS.Utility.VideoUtils.CutImgExtend
getset

截图文件格式

在文件 VideoUtils.cs 第 32 行定义.

int SinGooCMS.Utility.VideoUtils.CutImgHeight
getset

截图宽度

在文件 VideoUtils.cs 第 28 行定义.

int SinGooCMS.Utility.VideoUtils.CutImgWidth
getset

截图长度

在文件 VideoUtils.cs 第 24 行定义.

string SinGooCMS.Utility.VideoUtils.StartPoint
getset

截图起始时间段 格式 00:00:06

在文件 VideoUtils.cs 第 20 行定义.

string SinGooCMS.Utility.VideoUtils.ToolsPath
getset

工具所在路径

在文件 VideoUtils.cs 第 16 行定义.

该类的文档由以下文件生成:
  • SinGooCMS.Utility/IO/VideoUtils.cs


SinGooCMS.Utility: SinGooCMS.Utility.WebUtils类 参考

  • SinGooCMS
  • Utility
  • WebUtils
静态 Public 成员函数 | 所有成员列表
SinGooCMS.Utility.WebUtils类 参考

web工具 更多...

静态 Public 成员函数

static T | GetQueryVal< T > (string key, T defaultVal=default(T))
读取Query值，默认只有一个值 更多...
static IEnumerable< T > | GetQueryVals< T > (string key)
读取Query值 更多...
static string | GetQueryString (string key, string defalutValue="")
读取query值 更多...
static int | GetQueryInt (string key, int defaultValue=0)
读取query值 更多...
static bool | GetQueryBool (string key, bool defaultValue=false)
读取query值 更多...
static long | GetQueryLong (string key, long defaultValue=0)
读取query值 更多...
static float | GetQueryFloat (string key, float defaultValue=0.0f)
读取query值 更多...
static double | GetQueryDouble (string key, double defaultValue=0.0d)
读取query值 更多...
static decimal | GetQueryDecimal (string key, decimal defaultValue=0.0m)
读取query值 更多...
static DateTime | GetQueryDatetime (string key)
读取query值并转化为Datetime类型，默认是1900-1-1 更多...
static DateTime | GetQueryDatetime (string key, DateTime defaultValue)
读取query值 更多...
static T | GetFormVal< T > (string key, T defaultVal=default(T))
读取Form值，默认只有一个值 更多...
static IEnumerable< T > | GetFormVals< T > (string key)
读取Form值 更多...
static string | GetFormString (string key, string defalutValue="")
读取form值 更多...
static int | GetFormInt (string key, int defaultValue=0)
读取form值 更多...
static bool | GetFormBool (string key, bool defaultValue=false)
读取form值 更多...
static float | GetFormFloat (string key, float defaultValue=0.0f)
读取form值 更多...
static double | GetFormDouble (string key, double defaultValue=0.0d)
读取form值 更多...
static decimal | GetFormDecimal (string key, decimal defaultValue=0.0m)
读取form值 更多...
static DateTime | GetFormDatetime (string key)
读取form值并转化为Datetime类型，默认是1900-1-1 更多...
static DateTime | GetFormDatetime (string key, DateTime defaultValue)
读取form值 更多...
static string | GetUrlPathPart ()
读取url的path部分，如 /home/index?abc=1 更多...
static string | GetAbsoluteUri ()
获取url完整地址 更多...

详细描述

web工具

在文件 WebUtils.cs 第 14 行定义.

成员函数说明

static string SinGooCMS.Utility.WebUtils.GetAbsoluteUri ( )
static

获取url完整地址

返回

在文件 WebUtils.cs 第 372 行定义.

static bool SinGooCMS.Utility.WebUtils.GetFormBool | ( | string | key,
 |  | bool | defaultValue = false
 | ) |  |
static

读取form值

参数
key
defaultValue
返回

在文件 WebUtils.cs 第 287 行定义.

static DateTime SinGooCMS.Utility.WebUtils.GetFormDatetime ( string key )
static

读取form值并转化为Datetime类型，默认是1900-1-1

参数
key
返回

在文件 WebUtils.cs 第 330 行定义.

static DateTime SinGooCMS.Utility.WebUtils.GetFormDatetime | ( | string | key,
 |  | DateTime | defaultValue
 | ) |  |
static

读取form值

参数
key
defaultValue
返回

在文件 WebUtils.cs 第 341 行定义.

static decimal SinGooCMS.Utility.WebUtils.GetFormDecimal | ( | string | key,
 |  | decimal | defaultValue = 0.0m
 | ) |  |
static

读取form值

参数
key
defaultValue
返回

在文件 WebUtils.cs 第 320 行定义.

static double SinGooCMS.Utility.WebUtils.GetFormDouble | ( | string | key,
 |  | double | defaultValue = 0.0d
 | ) |  |
static

读取form值

参数
key
defaultValue
返回

在文件 WebUtils.cs 第 309 行定义.

static float SinGooCMS.Utility.WebUtils.GetFormFloat | ( | string | key,
 |  | float | defaultValue = 0.0f
 | ) |  |
static

读取form值

参数
key
defaultValue
返回

在文件 WebUtils.cs 第 298 行定义.

static int SinGooCMS.Utility.WebUtils.GetFormInt | ( | string | key,
 |  | int | defaultValue = 0
 | ) |  |
static

读取form值

参数
key
defaultValue
返回

在文件 WebUtils.cs 第 276 行定义.

static string SinGooCMS.Utility.WebUtils.GetFormString | ( | string | key,
 |  | string | defalutValue = ""
 | ) |  |
static

读取form值

参数
key
defalutValue
返回

在文件 WebUtils.cs 第 248 行定义.

static T SinGooCMS.Utility.WebUtils.GetFormVal< T > | ( | string | key,
 |  | T | defaultVal = default(T)
 | ) |  |
static

读取Form值，默认只有一个值

模板参数
T
参数
key
defaultVal
返回

在文件 WebUtils.cs 第 195 行定义.

static IEnumerable<T> SinGooCMS.Utility.WebUtils.GetFormVals< T > ( string key )
static

读取Form值

模板参数
T
参数
key
返回

在文件 WebUtils.cs 第 209 行定义.

static bool SinGooCMS.Utility.WebUtils.GetQueryBool | ( | string | key,
 |  | bool | defaultValue = false
 | ) |  |
static

读取query值

参数
key
defaultValue
返回

在文件 WebUtils.cs 第 114 行定义.

static DateTime SinGooCMS.Utility.WebUtils.GetQueryDatetime ( string key )
static

读取query值并转化为Datetime类型，默认是1900-1-1

参数
key
返回

在文件 WebUtils.cs 第 168 行定义.

static DateTime SinGooCMS.Utility.WebUtils.GetQueryDatetime | ( | string | key,
 |  | DateTime | defaultValue
 | ) |  |
static

读取query值

参数
key
defaultValue
返回

在文件 WebUtils.cs 第 179 行定义.

static decimal SinGooCMS.Utility.WebUtils.GetQueryDecimal | ( | string | key,
 |  | decimal | defaultValue = 0.0m
 | ) |  |
static

读取query值

参数
key
defaultValue
返回

在文件 WebUtils.cs 第 158 行定义.

static double SinGooCMS.Utility.WebUtils.GetQueryDouble | ( | string | key,
 |  | double | defaultValue = 0.0d
 | ) |  |
static

读取query值

参数
key
defaultValue
返回

在文件 WebUtils.cs 第 147 行定义.

static float SinGooCMS.Utility.WebUtils.GetQueryFloat | ( | string | key,
 |  | float | defaultValue = 0.0f
 | ) |  |
static

读取query值

参数
key
defaultValue
返回

在文件 WebUtils.cs 第 136 行定义.

static int SinGooCMS.Utility.WebUtils.GetQueryInt | ( | string | key,
 |  | int | defaultValue = 0
 | ) |  |
static

读取query值

参数
key
defaultValue
返回

在文件 WebUtils.cs 第 103 行定义.

static long SinGooCMS.Utility.WebUtils.GetQueryLong | ( | string | key,
 |  | long | defaultValue = 0
 | ) |  |
static

读取query值

参数
key
defaultValue
返回

在文件 WebUtils.cs 第 125 行定义.

static string SinGooCMS.Utility.WebUtils.GetQueryString | ( | string | key,
 |  | string | defalutValue = ""
 | ) |  |
static

读取query值

参数
key
defalutValue
返回

在文件 WebUtils.cs 第 75 行定义.

static T SinGooCMS.Utility.WebUtils.GetQueryVal< T > | ( | string | key,
 |  | T | defaultVal = default(T)
 | ) |  |
static

读取Query值，默认只有一个值

模板参数
T
参数
key
defaultVal
返回

在文件 WebUtils.cs 第 25 行定义.

static IEnumerable<T> SinGooCMS.Utility.WebUtils.GetQueryVals< T > ( string key )
static

读取Query值

模板参数
T
参数
key
返回

在文件 WebUtils.cs 第 39 行定义.

static string SinGooCMS.Utility.WebUtils.GetUrlPathPart ( )
static

读取url的path部分，如 /home/index?abc=1

返回

在文件 WebUtils.cs 第 354 行定义.

该类的文档由以下文件生成:
  • SinGooCMS.Utility/Web/WebUtils.cs


SinGooCMS.Utility: SinGooCMS.Utility.XmlUtils类 参考

  • SinGooCMS
  • Utility
  • XmlUtils
Public 成员函数 | 静态 Public 成员函数 | Private 成员函数 | 静态 Private 成员函数 | Private 属性 | 所有成员列表
SinGooCMS.Utility.XmlUtils类 参考

xml工具 更多...

Public 成员函数

XmlUtils (string xmlFilePath)
实例化XmlHelper对象 更多...
XmlNode | GetNode (string xPath)
获取指定XPath表达式的节点对象 更多...
string | GetValue (string xPath)
获取指定XPath表达式节点的值 更多...
string | GetAttributeValue (string xPath, string attributeName)
获取指定XPath表达式节点的属性值 更多...
void | AppendNode (XmlNode xmlNode)
void | RemoveNode (string xPath)
删除指定XPath表达式的节点 更多...
void | Save ()
保存XML文件 更多...

静态 Public 成员函数

static string | GetValue (string xmlFilePath, string xPath)
获取指定XPath表达式节点的值 更多...
static string | GetAttributeValue (string xmlFilePath, string xPath, string attributeName)
获取指定XPath表达式节点的属性值 更多...
static XmlDocument | CreateXmlDocument ()
创建xml文档 更多...
static XmlDocument | CreateXmlDocument (string rootName)
创建xml文档 更多...
static string | GetAttributeValue (XmlNode node, string attributeName)
读取节点属性 更多...
static string | GetItemValue (XmlNode node, string itemName)
创建xml节点文本 更多...
static XmlNode | SelectNode (XmlNode parentNode, string attributeName, string attributeValue)
节点选择 更多...
static bool | SetAttributeValue (XmlNode node, string attributeName, string attributeValue)
设置节点属性值 更多...
static bool | SetItemValue (XmlNode node, string itemName, string itemValue)
设置节点值 更多...
static string | XmlEncode (string value)
xml编码 更多...
static string | FormatXML (string xmlStr)
格式化xml 更多...
static void | WriteFormatXML (string xmlStr, string saveFilePath, string encoding="utf-8")
写入格式化xml 更多...

Private 成员函数

void CreateXMLElement ()
创建XML的根节点 更多...

静态 Private 成员函数

static XmlElement CreateRootElement (string xmlFilePath)
创建根节点对象 更多...

Private 属性

string | _filePath = string.Empty
XML文件的物理路径 更多...
XmlDocument | _xml
Xml文档 更多...
XmlElement | _element
XML的根节点 更多...

详细描述

xml工具

在文件 XmlUtils.cs 第 12 行定义.

构造及析构函数说明

SinGooCMS.Utility.XmlUtils.XmlUtils ( string xmlFilePath )

实例化XmlHelper对象

参数
xmlFilePath Xml文件的相对路径

在文件 XmlUtils.cs 第 34 行定义.

成员函数说明

void SinGooCMS.Utility.XmlUtils.AppendNode ( XmlNode xmlNode )

  1. 功能：新增节点。
  2. 使用条件：将任意节点插入到当前Xml文件中。
参数
xmlNode 要插入的Xml节点

在文件 XmlUtils.cs 第 125 行定义.

static XmlElement SinGooCMS.Utility.XmlUtils.CreateRootElement ( string xmlFilePath )
staticprivate

创建根节点对象

参数
xmlFilePath Xml文件的相对路径

在文件 XmlUtils.cs 第 199 行定义.

static XmlDocument SinGooCMS.Utility.XmlUtils.CreateXmlDocument ( )
static

创建xml文档

返回

在文件 XmlUtils.cs 第 264 行定义.

static XmlDocument SinGooCMS.Utility.XmlUtils.CreateXmlDocument ( string rootName )
static

创建xml文档

参数
rootName
返回

在文件 XmlUtils.cs 第 277 行定义.

void SinGooCMS.Utility.XmlUtils.CreateXMLElement ( )
private

创建XML的根节点

在文件 XmlUtils.cs 第 45 行定义.

static string SinGooCMS.Utility.XmlUtils.FormatXML ( string xmlStr )
static

格式化xml

参数
xmlStr
返回

在文件 XmlUtils.cs 第 402 行定义.

string SinGooCMS.Utility.XmlUtils.GetAttributeValue | ( | string | xPath,
 |  | string | attributeName
 | ) |  |

获取指定XPath表达式节点的属性值

参数
xPath | XPath表达式, 范例1: "Skill/First/SkillItem", 等效于 @"//Skill/First/SkillItem" 范例2: @"Table[USERNAME='a']" , []表示筛选,USERNAME是Table下的一个子节点. 范例3: @"ApplyPost/Item[='岗位编号']",是Item节点的属性.
attributeName | 属性名

在文件 XmlUtils.cs 第 109 行定义.

static string SinGooCMS.Utility.XmlUtils.GetAttributeValue | ( | string | xmlFilePath,
 |  | string | xPath,
 |  | string | attributeName
 | ) |  |
static

获取指定XPath表达式节点的属性值

参数
xmlFilePath | Xml文件的相对路径
xPath | XPath表达式, 范例1: "Skill/First/SkillItem", 等效于 @"//Skill/First/SkillItem" 范例2: @"Table[USERNAME='a']" , []表示筛选,USERNAME是Table下的一个子节点. 范例3: @"ApplyPost/Item[='岗位编号']",是Item节点的属性.
attributeName | 属性名

在文件 XmlUtils.cs 第 248 行定义.

static string SinGooCMS.Utility.XmlUtils.GetAttributeValue | ( | XmlNode | node,
 |  | string | attributeName
 | ) |  |
static

读取节点属性

参数
node
attributeName
返回

在文件 XmlUtils.cs 第 293 行定义.

static string SinGooCMS.Utility.XmlUtils.GetItemValue | ( | XmlNode | node,
 |  | string | itemName
 | ) |  |
static

创建xml节点文本

参数
node
itemName
返回

在文件 XmlUtils.cs 第 309 行定义.

XmlNode SinGooCMS.Utility.XmlUtils.GetNode ( string xPath )

获取指定XPath表达式的节点对象

参数
xPath XPath表达式, 范例1: "Skill/First/SkillItem", 等效于 @"//Skill/First/SkillItem" 范例2: @"Table[USERNAME='a']" , []表示筛选,USERNAME是Table下的一个子节点. 范例3: @"ApplyPost/Item[='岗位编号']",是Item节点的属性.

在文件 XmlUtils.cs 第 70 行定义.

string SinGooCMS.Utility.XmlUtils.GetValue ( string xPath )

获取指定XPath表达式节点的值

参数
xPath XPath表达式, 范例1: "Skill/First/SkillItem", 等效于 @"//Skill/First/SkillItem" 范例2: @"Table[USERNAME='a']" , []表示筛选,USERNAME是Table下的一个子节点. 范例3: @"ApplyPost/Item[='岗位编号']",是Item节点的属性.

在文件 XmlUtils.cs 第 89 行定义.

static string SinGooCMS.Utility.XmlUtils.GetValue | ( | string | xmlFilePath,
 |  | string | xPath
 | ) |  |
static

获取指定XPath表达式节点的值

参数
xmlFilePath | Xml文件的相对路径
xPath | XPath表达式, 范例1: "Skill/First/SkillItem", 等效于 @"//Skill/First/SkillItem" 范例2: @"Table[USERNAME='a']" , []表示筛选,USERNAME是Table下的一个子节点. 范例3: @"ApplyPost/Item[='岗位编号']",是Item节点的属性.

在文件 XmlUtils.cs 第 227 行定义.

void SinGooCMS.Utility.XmlUtils.RemoveNode ( string xPath )

删除指定XPath表达式的节点

参数
xPath XPath表达式, 范例1: "Skill/First/SkillItem", 等效于 @"//Skill/First/SkillItem" 范例2: @"Table[USERNAME='a']" , []表示筛选,USERNAME是Table下的一个子节点. 范例3: @"ApplyPost/Item[='岗位编号']",是Item节点的属性.

在文件 XmlUtils.cs 第 165 行定义.

void SinGooCMS.Utility.XmlUtils.Save ( )

保存XML文件

在文件 XmlUtils.cs 第 182 行定义.

static XmlNode SinGooCMS.Utility.XmlUtils.SelectNode | ( | XmlNode | parentNode,
 |  | string | attributeName,
 |  | string | attributeValue
 | ) |  |
static

节点选择

参数
parentNode
attributeName
attributeValue
返回

在文件 XmlUtils.cs 第 325 行定义.

static bool SinGooCMS.Utility.XmlUtils.SetAttributeValue | ( | XmlNode | node,
 |  | string | attributeName,
 |  | string | attributeValue
 | ) |  |
static

设置节点属性值

参数
node
attributeName
attributeValue
返回

在文件 XmlUtils.cs 第 344 行定义.

static bool SinGooCMS.Utility.XmlUtils.SetItemValue | ( | XmlNode | node,
 |  | string | itemName,
 |  | string | itemValue
 | ) |  |
static

设置节点值

参数
node
itemName
itemValue
返回

在文件 XmlUtils.cs 第 365 行定义.

static void SinGooCMS.Utility.XmlUtils.WriteFormatXML | ( | string | xmlStr,
 |  | string | saveFilePath,
 |  | string | encoding = "utf-8"
 | ) |  |
static

写入格式化xml

参数
xmlStr
saveFilePath
encoding

在文件 XmlUtils.cs 第 429 行定义.

static string SinGooCMS.Utility.XmlUtils.XmlEncode ( string value )
static

xml编码

参数
value
返回

在文件 XmlUtils.cs 第 380 行定义.

类成员变量说明

XmlElement SinGooCMS.Utility.XmlUtils._element
private

XML的根节点

在文件 XmlUtils.cs 第 26 行定义.

string SinGooCMS.Utility.XmlUtils._filePath = string.Empty
private

XML文件的物理路径

在文件 XmlUtils.cs 第 18 行定义.

XmlDocument SinGooCMS.Utility.XmlUtils._xml
private

Xml文档

在文件 XmlUtils.cs 第 22 行定义.

该类的文档由以下文件生成:
  • SinGooCMS.Utility/Xml/XmlUtils.cs


SinGooCMS.Utility: SinGooCMS.Utility.ZipUtils类 参考

  • SinGooCMS
  • Utility
  • ZipUtils
静态 Public 成员函数 | 所有成员列表
SinGooCMS.Utility.ZipUtils类 参考

压缩和解压 更多...

静态 Public 成员函数

static string | Zip (string dirPath, string zipFile="")
压缩(支持 zip、rar、7z)，默认zip 更多...
static void | UnZip (string zipFile, string extractPath)
解压 更多...

详细描述

压缩和解压

压缩、ZipUtils.Zip("f:")</para> <para>解压、ZipUtils.UnZip(@"f:.zip",@"f:")

在文件 ZipUtils.cs 第 19 行定义.

成员函数说明

static void SinGooCMS.Utility.ZipUtils.UnZip | ( | string | zipFile,
 |  | string | extractPath
 | ) |  |
static

解压

参数
zipFile | 压缩包文件
extractPath | 解压到目录

在文件 ZipUtils.cs 第 59 行定义.

static string SinGooCMS.Utility.ZipUtils.Zip | ( | string | dirPath,
 |  | string | zipFile = ""
 | ) |  |
static

压缩(支持 zip、rar、7z)，默认zip

参数
dirPath | 需要压缩的目录
zipFile | 文件的绝对路径，如果不指定，将保存到当前压缩的目录下

在文件 ZipUtils.cs 第 26 行定义.

函数调用图:

该类的文档由以下文件生成:
  • SinGooCMS.Utility/IO/ZipUtils.cs


SinGooCMS.Utility: 类索引

类索引
A | B | C | D | E | F | G | H | I | J | L | M | N | O | P | Q | R | S | T | U | V | W | X | Z
A
DictionaryExtension (SinGooCMS.Utility.Extension) IPAreaInfo (SinGooCMS.Utility)
P
StringUtils (SinGooCMS.Utility)
DisplayExtAttribute (SinGooCMS.Utility.Extension) IPScanner (SinGooCMS.Utility)
T
Accessor (SinGooCMS.Utility)
E
IPUtils (SinGooCMS.Utility) PagerModel (SinGooCMS.Utility)
AccessorBuilder (SinGooCMS.Utility)
J
PagerUtils (SinGooCMS.Utility) TaskExtensions (SinGooCMS.Utility.Extension)
AdoUtils (SinGooCMS.Utility) EntityAttrUtils (SinGooCMS.Utility) PredicateBuilder (SinGooCMS.Utility) TimeUtils (SinGooCMS.Utility)
AssemblyExtension (SinGooCMS.Utility.Extension) EnumExtension (SinGooCMS.Utility.Extension) JsonFileUtils (SinGooCMS.Utility) ProcessUtils (SinGooCMS.Utility) TypeExtensions (SinGooCMS.Utility.Extension)
B
EnumUtils (SinGooCMS.Utility) JsonserializeExtension (SinGooCMS.Utility.Extension)
Q
U
ExceptionUtils (SinGooCMS.Utility)
L
Base64FileUtils (SinGooCMS.Utility)
F
QueryExtension (SinGooCMS.Utility) UnicodeUtils (SinGooCMS.Utility)
C
LibInvoker (SinGooCMS.Utility)
R
UriExtension (SinGooCMS.Utility.Extension)
FileUtils (SinGooCMS.Utility) LinqExtension (SinGooCMS.Utility.Extension) UtilsBase (SinGooCMS.Utility)
CacheUtils (SinGooCMS.Utility) FtpClient (SinGooCMS.Utility) ChineseCalendar.LunarHolidayStruct (SinGooCMS.Utility) ReflectExtension (SinGooCMS.Utility.Extension)
V
CaptchaUtils (SinGooCMS.Utility)
G
M
ReflectionUtils (SinGooCMS.Utility)
CellPhonePrefix (SinGooCMS.Utility) RegistryUtils (SinGooCMS.Utility) ValidateExtension (SinGooCMS.Utility.Extension)
ChinaDate (SinGooCMS.Utility) GenericAccessor (SinGooCMS.Utility) MailConfig (SinGooCMS.Utility) RSACryption (SinGooCMS.Utility) VideoUtils (SinGooCMS.Utility)
ChineseCalendar (SinGooCMS.Utility)
H
MailUtils (SinGooCMS.Utility)
S
W
CNDate (SinGooCMS.Utility) MimeMapping.MimeMappingDictionaryBase (SinGooCMS.Utility)
ConfigUtils (SinGooCMS.Utility) HexUtils (SinGooCMS.Utility) MimeMapping.MimeMappingDictionaryClassic (SinGooCMS.Utility) SessionUtils (SinGooCMS.Utility) WebUtils (SinGooCMS.Utility)
CookieUtils (SinGooCMS.Utility)
I
N
ShareFileUtils (SinGooCMS.Utility) ChineseCalendar.WeekHolidayStruct (SinGooCMS.Utility)
CsvUtils (SinGooCMS.Utility) SinGooArray (SinGooCMS.Utility)
X
D
IConvertibleExtension (SinGooCMS.Utility.Extension) NetWorkUtils (SinGooCMS.Utility) SinGooDictionary (SinGooCMS.Utility)
IdCardUtils (SinGooCMS.Utility) NPOIUtils (SinGooCMS.Utility) SinGooList (SinGooCMS.Utility) XmlserializeExtension (SinGooCMS.Utility.Extension)
DataTableExtension (SinGooCMS.Utility.Extension) IEnumerableExtension (SinGooCMS.Utility.Extension)
O
SocketClient (SinGooCMS.Utility) XmlUtils (SinGooCMS.Utility)
DataTypeChangeExtension (SinGooCMS.Utility.Extension) IISUtils (SinGooCMS.Utility) ChineseCalendar.SolarHolidayStruct (SinGooCMS.Utility)
Z
DateTimeExtension (SinGooCMS.Utility.Extension) ImageExtension (SinGooCMS.Utility.Extension) ObjectAccessor (SinGooCMS.Utility) StopwatchUtils (SinGooCMS.Utility)
DatetimeUtils (SinGooCMS.Utility) ImageUtils (SinGooCMS.Utility) ObjectExtension (SinGooCMS.Utility.Extension) StreamExtension (SinGooCMS.Utility.Extension) ZipUtils (SinGooCMS.Utility)
DEncryptUtils (SinGooCMS.Utility) IOExtension (SinGooCMS.Utility.Extension) OperationResult (SinGooCMS.Utility) StringExtension (SinGooCMS.Utility.Extension)
A | B | C | D | E | F | G | H | I | J | L | M | N | O | P | Q | R | S | T | U | V | W | X | Z


SinGooCMS.Utility: 类继承关系

类继承关系

浏览类继承关系图

此继承关系列表按字典顺序粗略的排序:
[详情级别 123]
▼C SinGooCMS.Utility.Accessor | 用于构建ObjectAccessor和 GenericAccessor<TInstance>实例。
▼C SinGooCMS.Utility.ObjectAccessor 快速访问给定类型的对象的属性值, 参照:

参见
Accessor
C SinGooCMS.Utility.GenericAccessor< TInstance > 快速访问给定类型的对象的属性值, 参照:

参见
Accessor
C SinGooCMS.Utility.AccessorBuilder 提供一系列快速构建

参见
Accessor

实例的方法

C SinGooCMS.Utility.AdoUtils | 这里只提供SqlServer的简单操作，具体可参考SinGooCMS.Ado
▼C ArrayList
C SinGooCMS.Utility.SinGooArray | ArrayList扩展，实现取范围数据
C SinGooCMS.Utility.Extension.AssemblyExtension | Assembly扩展类
C SinGooCMS.Utility.Base64FileUtils | base64字符串和文件互转
C SinGooCMS.Utility.CacheUtils | 缓存管理
C SinGooCMS.Utility.CaptchaUtils | 图形验证码工具
C SinGooCMS.Utility.CellPhonePrefix | 手机号码前缀
C SinGooCMS.Utility.ChinaDate | 公历转农历
C SinGooCMS.Utility.ChineseCalendar | 中国日历
C SinGooCMS.Utility.CNDate | 农历属性
C SinGooCMS.Utility.ConfigUtils | 配置管理
C SinGooCMS.Utility.CookieUtils | cookie工具
C SinGooCMS.Utility.CsvUtils | csv工具
C SinGooCMS.Utility.Extension.DataTableExtension | 数据集扩展
C SinGooCMS.Utility.Extension.DataTypeChangeExtension | 数据类型转换,利用TryParse判断是否可转换，如果能则返回转换后的值，否则返回默认值
C SinGooCMS.Utility.Extension.DateTimeExtension | 日期扩展
C SinGooCMS.Utility.DatetimeUtils | 日期工具
C SinGooCMS.Utility.DEncryptUtils | 加密解密工具
▼C Dictionary
C SinGooCMS.Utility.SinGooDictionary< T1, T2 > | Dictionary扩展，实现从下标取值
C SinGooCMS.Utility.Extension.DictionaryExtension | 字典扩展类
▼C DisplayNameAttribute
C SinGooCMS.Utility.Extension.DisplayExtAttribute 特性扩展类
属性的显示扩展,优先使用资源Name,默认使用自带的Name,注意：仅适用于MVC
C SinGooCMS.Utility.EntityAttrUtils | 实体类 特性工具
C SinGooCMS.Utility.Extension.EnumExtension | 枚举扩展
C SinGooCMS.Utility.EnumUtils | 枚举帮助类
C SinGooCMS.Utility.ExceptionUtils | 异常信息格式化
C SinGooCMS.Utility.FileUtils | 文件管理工具
C SinGooCMS.Utility.FtpClient | FTP客户端操作类
C SinGooCMS.Utility.HexUtils | 16进制字符串之间的转换帮助类.
C SinGooCMS.Utility.Extension.IConvertibleExtension | 可转换扩展
C SinGooCMS.Utility.IdCardUtils | 身份证工具
C SinGooCMS.Utility.Extension.IEnumerableExtension | 遍历扩展
C SinGooCMS.Utility.IISUtils | IIS操作
C SinGooCMS.Utility.Extension.ImageExtension | image图像扩展
C SinGooCMS.Utility.ImageUtils | 图片处理
C SinGooCMS.Utility.Extension.IOExtension | IO扩展
C SinGooCMS.Utility.IPAreaInfo | IP地理位置信息
C SinGooCMS.Utility.IPScanner | 读取纯真IP数据库，定位IP地址
C SinGooCMS.Utility.IPUtils | IP工具
C SinGooCMS.Utility.JsonFileUtils | JSON文件工具
C SinGooCMS.Utility.Extension.JsonserializeExtension | json扩展
C SinGooCMS.Utility.LibInvoker | 非托管方法调用
C SinGooCMS.Utility.Extension.LinqExtension | linq扩展方法
▼C List
▼C SinGooCMS.Utility.SinGooList< T > | List扩展，实现取范围数据
C SinGooCMS.Utility.PagerModel< T > | 分页模型
C SinGooCMS.Utility.ChineseCalendar.LunarHolidayStruct | 农历
C SinGooCMS.Utility.MailConfig | 邮件服务配置
C SinGooCMS.Utility.MailUtils
▼C SinGooCMS.Utility.MimeMapping.MimeMappingDictionaryBase
C SinGooCMS.Utility.MimeMapping.MimeMappingDictionaryClassic
C SinGooCMS.Utility.NetWorkUtils | 模拟 httpget 和 httppost
C SinGooCMS.Utility.NPOIUtils NPOI工具类
来自:
C SinGooCMS.Utility.Extension.ObjectExtension | 对象扩展
C SinGooCMS.Utility.OperationResult 操作返回结果
<exsample> "ReturnStatusType": 1, —返回状态类型
"StatusCode": "200", —错误信息代码
"ErrorMessage": "操作成功", —错误信息
"ErrorENMessage": "ok", —英文错误信息
"TimeStamp": "2020-01-06 12:13:14", —当前时间 </exsample>
C SinGooCMS.Utility.PagerUtils | 分页栏工具
C SinGooCMS.Utility.PredicateBuilder | 对 Lambda 表达式进行动态拼接的逻辑
C SinGooCMS.Utility.ProcessUtils | 执行系统进程
C SinGooCMS.Utility.QueryExtension | 查询并分页
C SinGooCMS.Utility.Extension.ReflectExtension | 反射扩展
C SinGooCMS.Utility.ReflectionUtils | 反射操作
C SinGooCMS.Utility.RegistryUtils | 注册表操作，Win平台专有(需要有管理员权限)
C SinGooCMS.Utility.RSACryption
C SinGooCMS.Utility.SessionUtils | session会话工具
C SinGooCMS.Utility.ShareFileUtils | 局域网共享文件工具
C SinGooCMS.Utility.SocketClient | Socket客户端操作类
C SinGooCMS.Utility.ChineseCalendar.SolarHolidayStruct | 阳历
C SinGooCMS.Utility.StopwatchUtils | 计数器帮助类
C SinGooCMS.Utility.Extension.StreamExtension | 流扩展
C SinGooCMS.Utility.Extension.StringExtension | 字符串扩展
C SinGooCMS.Utility.StringUtils | 字符串处理
C SinGooCMS.Utility.Extension.TaskExtensions | System.Threading.Tasks扩展类
C SinGooCMS.Utility.TimeUtils | 时间工具
C SinGooCMS.Utility.Extension.TypeExtensions | Type扩展类
C SinGooCMS.Utility.UnicodeUtils unicode 编解码
"空\u0020格" => "空 格"
"空 格" => "\u7a7a\u20\u683c"
C SinGooCMS.Utility.Extension.UriExtension | 提供一组使用Uri的辅助方法。
C SinGooCMS.Utility.UtilsBase | 工具底层，主要获取 http上下文 HttpContext。netfx从system.web中读取，core需要注入
C SinGooCMS.Utility.Extension.ValidateExtension | 验证扩展
C SinGooCMS.Utility.VideoUtils | 视频剪切工具.上传视频后可截取视频存储为图片,注意要调用文件：ffmpeg.exe
C SinGooCMS.Utility.WebUtils | web工具
C SinGooCMS.Utility.ChineseCalendar.WeekHolidayStruct
C SinGooCMS.Utility.Extension.XmlserializeExtension | xml序列化扩展
C SinGooCMS.Utility.XmlUtils | xml工具
C SinGooCMS.Utility.ZipUtils | 压缩和解压


SinGooCMS.Utility: SinGooCMS.Utility.MimeMapping.MimeMappingDictionaryBase类 参考

  • SinGooCMS
  • Utility
  • MimeMapping
  • MimeMappingDictionaryBase
Public 成员函数 | Protected 成员函数 | Private 成员函数 | 静态 Private 成员函数 | Private 属性 | 静态 Private 属性 | 所有成员列表
SinGooCMS.Utility.MimeMapping.MimeMappingDictionaryBase类 参考abstract
类 SinGooCMS.Utility.MimeMapping.MimeMappingDictionaryBase 继承关系图:
[图例]

Public 成员函数

string GetMimeMapping (string fileName)

Protected 成员函数

void | AddMapping (string fileExtension, string mimeType)
abstract void | PopulateMappings ()

Private 成员函数

void | AddWildcardIfNotPresent ()
void | EnsureMapping ()

静态 Private 成员函数

static string GetFileName (string path)

Private 属性

readonly Dictionary< string, string > | _mappings = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase)
bool | _isInitialized

静态 Private 属性

static readonly char[] _pathSeparatorChars

详细描述

在文件 FileUtils.cs 第 439 行定义.

成员函数说明

void SinGooCMS.Utility.MimeMapping.MimeMappingDictionaryBase.AddMapping | ( | string | fileExtension,
 |  | string | mimeType
 | ) |  |
protected

在文件 FileUtils.cs 第 452 行定义.

void SinGooCMS.Utility.MimeMapping.MimeMappingDictionaryBase.AddWildcardIfNotPresent ( )
private

在文件 FileUtils.cs 第 457 行定义.

void SinGooCMS.Utility.MimeMapping.MimeMappingDictionaryBase.EnsureMapping ( )
private

在文件 FileUtils.cs 第 465 行定义.

static string SinGooCMS.Utility.MimeMapping.MimeMappingDictionaryBase.GetFileName ( string path )
staticprivate

在文件 FileUtils.cs 第 482 行定义.

string SinGooCMS.Utility.MimeMapping.MimeMappingDictionaryBase.GetMimeMapping ( string fileName )

在文件 FileUtils.cs 第 492 行定义.

abstract void SinGooCMS.Utility.MimeMapping.MimeMappingDictionaryBase.PopulateMappings ( )
protectedpure virtual

在 SinGooCMS.Utility.MimeMapping.MimeMappingDictionaryClassic 内被实现.

类成员变量说明

bool SinGooCMS.Utility.MimeMapping.MimeMappingDictionaryBase._isInitialized
private

在文件 FileUtils.cs 第 450 行定义.

readonly Dictionary<string, string> SinGooCMS.Utility.MimeMapping.MimeMappingDictionaryBase._mappings = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase)
private

在文件 FileUtils.cs 第 441 行定义.

readonly char [] SinGooCMS.Utility.MimeMapping.MimeMappingDictionaryBase._pathSeparatorChars
staticprivate
初始值:
= new char[3]
{
Path.DirectorySeparatorChar,
Path.AltDirectorySeparatorChar,
Path.VolumeSeparatorChar
}

在文件 FileUtils.cs 第 443 行定义.

该类的文档由以下文件生成:
  • SinGooCMS.Utility/IO/FileUtils.cs


SinGooCMS.Utility: SinGooCMS.Utility.MimeMapping.MimeMappingDictionaryClassic类 参考

  • SinGooCMS
  • Utility
  • MimeMapping
  • MimeMappingDictionaryClassic
Protected 成员函数 | 所有成员列表
SinGooCMS.Utility.MimeMapping.MimeMappingDictionaryClassic类 参考
类 SinGooCMS.Utility.MimeMapping.MimeMappingDictionaryClassic 继承关系图:
[图例]
SinGooCMS.Utility.MimeMapping.MimeMappingDictionaryClassic 的协作图:
[图例]

Protected 成员函数

override void | PopulateMappings ()
- Protected 成员函数 继承自 SinGooCMS.Utility.MimeMapping.MimeMappingDictionaryBase
void | AddMapping (string fileExtension, string mimeType)

额外继承的成员函数

- Public 成员函数 继承自 SinGooCMS.Utility.MimeMapping.MimeMappingDictionaryBase
string GetMimeMapping (string fileName)

详细描述

在文件 FileUtils.cs 第 507 行定义.

成员函数说明

override void SinGooCMS.Utility.MimeMapping.MimeMappingDictionaryClassic.PopulateMappings ( )
protectedvirtual

实现了 SinGooCMS.Utility.MimeMapping.MimeMappingDictionaryBase.

在文件 FileUtils.cs 第 509 行定义.

该类的文档由以下文件生成:
  • SinGooCMS.Utility/IO/FileUtils.cs


SinGooCMS.Utility: 类成员

  • 全部
  • 函数
  • 变量
  • 枚举
  • 属性
  • _
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • j
  • k
  • l
  • m
  • n
  • o
  • p
  • q
  • r
  • s
  • t
  • u
  • w
  • x
  • y
  • z
  • ~
这里列出了所有类成员，并附带类的详细说明:

- _ -

  • _cDay : SinGooCMS.Utility.ChineseCalendar
  • _chineseConstellationName : SinGooCMS.Utility.ChineseCalendar
  • _cIsLeapMonth : SinGooCMS.Utility.ChineseCalendar
  • _cIsLeapYear : SinGooCMS.Utility.ChineseCalendar
  • _cMonth : SinGooCMS.Utility.ChineseCalendar
  • _constellationName : SinGooCMS.Utility.ChineseCalendar
  • _cYear : SinGooCMS.Utility.ChineseCalendar
  • _date : SinGooCMS.Utility.ChineseCalendar
  • _datetime : SinGooCMS.Utility.ChineseCalendar
  • _element : SinGooCMS.Utility.XmlUtils
  • _filePath : SinGooCMS.Utility.XmlUtils
  • _genericInstanceGettersCache : SinGooCMS.Utility.GenericAccessor< TInstance >
  • _genericInstanceSettersCache : SinGooCMS.Utility.GenericAccessor< TInstance >
  • _genericPropertiesGettersCache : SinGooCMS.Utility.GenericAccessor< TInstance >
  • _genericPropertiesSettersCache : SinGooCMS.Utility.GenericAccessor< TInstance >
  • _isInitialized : SinGooCMS.Utility.MimeMapping.MimeMappingDictionaryBase
  • _lunarHolidayName : SinGooCMS.Utility.ChineseCalendar
  • _mappings : SinGooCMS.Utility.MimeMapping.MimeMappingDictionaryBase
  • _monthString : SinGooCMS.Utility.ChineseCalendar
  • _objectGettersCache : SinGooCMS.Utility.ObjectAccessor
  • _objectSettersCache : SinGooCMS.Utility.ObjectAccessor
  • _pathSeparatorChars : SinGooCMS.Utility.MimeMapping.MimeMappingDictionaryBase
  • _prefix : SinGooCMS.Utility.CellPhonePrefix
  • _sign : SinGooCMS.Utility.OperationResult
  • _xml : SinGooCMS.Utility.XmlUtils


SinGooCMS.Utility: 类成员

  • 全部
  • 函数
  • 变量
  • 枚举
  • 属性
  • _
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • j
  • k
  • l
  • m
  • n
  • o
  • p
  • q
  • r
  • s
  • t
  • u
  • w
  • x
  • y
  • z
  • ~
这里列出了所有类成员，并附带类的详细说明:

- a -

  • Accessor() : SinGooCMS.Utility.Accessor
  • AddConfigurationProperties() : SinGooCMS.Utility.ConfigUtils
  • AddDefaultDocument() : SinGooCMS.Utility.IISUtils
  • AddHostBinding() : SinGooCMS.Utility.IISUtils
  • AddImageWatermark() : SinGooCMS.Utility.ImageUtils
  • AddMapping() : SinGooCMS.Utility.MimeMapping.MimeMappingDictionaryBase
  • AddOrAppendToQueryString() : SinGooCMS.Utility.Extension.UriExtension
  • AddParametersToQueryString() : SinGooCMS.Utility.Extension.UriExtension
  • AddRange< T >() : SinGooCMS.Utility.Extension.IEnumerableExtension
  • AddRangeIf< T >() : SinGooCMS.Utility.Extension.IEnumerableExtension
  • AddRangeIfNotContains< T >() : SinGooCMS.Utility.Extension.IEnumerableExtension
  • AddTextWatermark() : SinGooCMS.Utility.ImageUtils
  • AddWatermark() : SinGooCMS.Utility.ImageUtils
  • AddWildcardIfNotPresent() : SinGooCMS.Utility.MimeMapping.MimeMappingDictionaryBase
  • AESDecrypt() : SinGooCMS.Utility.DEncryptUtils
  • AESEncrypt() : SinGooCMS.Utility.DEncryptUtils
  • Age : SinGooCMS.Utility.IdCardUtils
  • And< T >() : SinGooCMS.Utility.PredicateBuilder
  • Animal : SinGooCMS.Utility.ChineseCalendar
  • Animals : SinGooCMS.Utility.ChinaDate
  • AnimalStartYear : SinGooCMS.Utility.ChineseCalendar
  • animalStr : SinGooCMS.Utility.ChineseCalendar
  • AnimalString : SinGooCMS.Utility.ChineseCalendar
  • AnimalsYear() : SinGooCMS.Utility.ChinaDate
  • AppendNode() : SinGooCMS.Utility.XmlUtils
  • AsDecodeUrl() : SinGooCMS.Utility.Extension.StringExtension
  • AsEncodeUrl() : SinGooCMS.Utility.Extension.StringExtension


SinGooCMS.Utility: 类成员

  • 全部
  • 函数
  • 变量
  • 枚举
  • 属性
  • _
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • j
  • k
  • l
  • m
  • n
  • o
  • p
  • q
  • r
  • s
  • t
  • u
  • w
  • x
  • y
  • z
  • ~
这里列出了所有类成员，并附带类的详细说明:

- b -

  • BackupFile() : SinGooCMS.Utility.FileUtils
  • Base36Characters : SinGooCMS.Utility.DEncryptUtils
  • Base36Decode() : SinGooCMS.Utility.DEncryptUtils
  • Base36Encode() : SinGooCMS.Utility.DEncryptUtils
  • Base64Decrypt() : SinGooCMS.Utility.DEncryptUtils
  • Base64Encrypt() : SinGooCMS.Utility.DEncryptUtils
  • Base64StrToImage() : SinGooCMS.Utility.ImageUtils
  • bindingFlags : SinGooCMS.Utility.Extension.ReflectExtension
  • BirthDay : SinGooCMS.Utility.IdCardUtils
  • BitTest32() : SinGooCMS.Utility.ChineseCalendar
  • BrokenDownload() : SinGooCMS.Utility.FtpClient
  • Build() : SinGooCMS.Utility.Accessor
  • Build< TInstance >() : SinGooCMS.Utility.Accessor
  • BuildGetter() : SinGooCMS.Utility.AccessorBuilder
  • BuildGetter< TInstance >() : SinGooCMS.Utility.AccessorBuilder
  • BuildGetter< TInstance, TProperty >() : SinGooCMS.Utility.AccessorBuilder
  • BuildInstanceCreator< TInstance >() : SinGooCMS.Utility.AccessorBuilder
  • BuildSetter() : SinGooCMS.Utility.AccessorBuilder
  • BuildSetter< TInstance >() : SinGooCMS.Utility.AccessorBuilder
  • BuildSetter< TInstance, TProperty >() : SinGooCMS.Utility.AccessorBuilder


SinGooCMS.Utility: 类成员

  • 全部
  • 函数
  • 变量
  • 枚举
  • 属性
  • _
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • j
  • k
  • l
  • m
  • n
  • o
  • p
  • q
  • r
  • s
  • t
  • u
  • w
  • x
  • y
  • z
  • ~
这里列出了所有类成员，并附带类的详细说明:

- c -

  • cache : SinGooCMS.Utility.CacheUtils
  • CacheUtils() : SinGooCMS.Utility.CacheUtils
  • Calculate() : SinGooCMS.Utility.PagerUtils
  • calElement() : SinGooCMS.Utility.ChinaDate
  • CallbackUrl : SinGooCMS.Utility.OperationResult
  • CardNo : SinGooCMS.Utility.IdCardUtils
  • ChangeColNames() : SinGooCMS.Utility.Extension.DataTableExtension
  • CheckChineseDateLimit() : SinGooCMS.Utility.ChineseCalendar
  • CheckCodeImg : SinGooCMS.Utility.CaptchaUtils
  • CheckCodeString : SinGooCMS.Utility.CaptchaUtils
  • CheckDateLimit() : SinGooCMS.Utility.ChineseCalendar
  • ChineseCalendar() : SinGooCMS.Utility.ChineseCalendar
  • ChineseConstellation : SinGooCMS.Utility.ChineseCalendar
  • ChineseConstellationReferDay : SinGooCMS.Utility.ChineseCalendar
  • ChineseDateString : SinGooCMS.Utility.ChineseCalendar
  • ChineseDay : SinGooCMS.Utility.ChineseCalendar
  • ChineseDayString : SinGooCMS.Utility.ChineseCalendar
  • ChineseHour : SinGooCMS.Utility.ChineseCalendar
  • ChineseMonth : SinGooCMS.Utility.ChineseCalendar
  • ChineseMonthString : SinGooCMS.Utility.ChineseCalendar
  • ChineseTwentyFourDay : SinGooCMS.Utility.ChineseCalendar
  • ChineseTwentyFourNextDay : SinGooCMS.Utility.ChineseCalendar
  • ChineseTwentyFourPrevDay : SinGooCMS.Utility.ChineseCalendar
  • ChineseYear : SinGooCMS.Utility.ChineseCalendar
  • ChineseYearString : SinGooCMS.Utility.ChineseCalendar
  • ChkSQL() : SinGooCMS.Utility.StringUtils
  • City : SinGooCMS.Utility.IPAreaInfo
  • classNamesCache : SinGooCMS.Utility.Extension.TypeExtensions
  • ClearAll() : SinGooCMS.Utility.CacheUtils
  • cnAnm : SinGooCMS.Utility.CNDate
  • cnFtvl : SinGooCMS.Utility.CNDate
  • cnFtvs : SinGooCMS.Utility.CNDate
  • cnIntDay : SinGooCMS.Utility.CNDate
  • cnIntMonth : SinGooCMS.Utility.CNDate
  • cnIntYear : SinGooCMS.Utility.CNDate
  • cnSolarTerm : SinGooCMS.Utility.CNDate
  • cnStrDay : SinGooCMS.Utility.CNDate
  • cnStrMonth : SinGooCMS.Utility.CNDate
  • cnStrYear : SinGooCMS.Utility.CNDate
  • ColorFilter() : SinGooCMS.Utility.Extension.ImageExtension
  • Combine() : SinGooCMS.Utility.FileUtils
  • Comparer : SinGooCMS.Utility.Accessor
  • CompareWeekDayHoliday() : SinGooCMS.Utility.ChineseCalendar
  • Compose< T >() : SinGooCMS.Utility.PredicateBuilder
  • Compress() : SinGooCMS.Utility.Extension.ImageExtension , SinGooCMS.Utility.StringUtils
  • CompressHeight() : SinGooCMS.Utility.Extension.ImageExtension
  • CompressRate() : SinGooCMS.Utility.Extension.ImageExtension
  • CompressWidth() : SinGooCMS.Utility.Extension.ImageExtension
  • Config : SinGooCMS.Utility.MailUtils
  • Connect() : SinGooCMS.Utility.ShareFileUtils
  • ConnectSocket() : SinGooCMS.Utility.SocketClient
  • ConnectStream() : SinGooCMS.Utility.SocketClient
  • Constellation : SinGooCMS.Utility.ChineseCalendar
  • ContainKey() : SinGooCMS.Utility.CacheUtils , SinGooCMS.Utility.CookieUtils , SinGooCMS.Utility.SessionUtils
  • ContainsWithSplitter() : SinGooCMS.Utility.Extension.StringExtension
  • ConvertDayOfWeek() : SinGooCMS.Utility.ChineseCalendar
  • ConvertNumToChineseNum() : SinGooCMS.Utility.ChineseCalendar
  • CopyDirectory() : SinGooCMS.Utility.FileUtils
  • CopyFolder() : SinGooCMS.Utility.FileUtils
  • CopyToFileAsync() : SinGooCMS.Utility.Extension.StreamExtension
  • Country : SinGooCMS.Utility.IPAreaInfo
  • country : SinGooCMS.Utility.IPScanner
  • Country : SinGooCMS.Utility.IPScanner
  • countryFlag : SinGooCMS.Utility.IPScanner
  • County : SinGooCMS.Utility.IPAreaInfo
  • Create() : SinGooCMS.Utility.CaptchaUtils , SinGooCMS.Utility.MailUtils , SinGooCMS.Utility.PagerUtils
  • CreateCheckCodeImage() : SinGooCMS.Utility.CaptchaUtils
  • CreateDirectory() : SinGooCMS.Utility.FileUtils
  • CreateFileAsync() : SinGooCMS.Utility.FileUtils
  • CreateInstance() : SinGooCMS.Utility.ReflectionUtils
  • CreateInstance< T >() : SinGooCMS.Utility.ReflectionUtils
  • CreateRootElement() : SinGooCMS.Utility.XmlUtils
  • CreateSite() : SinGooCMS.Utility.IISUtils
  • CreateVDir() : SinGooCMS.Utility.IISUtils
  • CreateXmlDocument() : SinGooCMS.Utility.XmlUtils
  • CreateXMLElement() : SinGooCMS.Utility.XmlUtils
  • Cut() : SinGooCMS.Utility.StringUtils
  • CutAndResize() : SinGooCMS.Utility.Extension.ImageExtension
  • CutImage() : SinGooCMS.Utility.Extension.ImageExtension
  • CutImgExtend : SinGooCMS.Utility.VideoUtils
  • CutImgHeight : SinGooCMS.Utility.VideoUtils
  • CutImgWidth : SinGooCMS.Utility.VideoUtils
  • cyclical() : SinGooCMS.Utility.ChinaDate
  • cyclicalm() : SinGooCMS.Utility.ChinaDate


SinGooCMS.Utility: 类成员

  • 全部
  • 函数
  • 变量
  • 枚举
  • 属性
  • _
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • j
  • k
  • l
  • m
  • n
  • o
  • p
  • q
  • r
  • s
  • t
  • u
  • w
  • x
  • y
  • z
  • ~
这里列出了所有类成员，并附带类的详细说明:

- d -

  • Data : SinGooCMS.Utility.OperationResult
  • dataPath : SinGooCMS.Utility.IPScanner
  • DataPath : SinGooCMS.Utility.IPScanner
  • Date : SinGooCMS.Utility.ChineseCalendar
  • DateDiff() : SinGooCMS.Utility.Extension.DateTimeExtension
  • DateHoliday : SinGooCMS.Utility.ChineseCalendar
  • DateString : SinGooCMS.Utility.ChineseCalendar
  • Day : SinGooCMS.Utility.ChineseCalendar.LunarHolidayStruct , SinGooCMS.Utility.ChineseCalendar.SolarHolidayStruct
  • Decode() : SinGooCMS.Utility.UnicodeUtils
  • DeepClone< T >() : SinGooCMS.Utility.Extension.ObjectExtension
  • DefConnStr : SinGooCMS.Utility.ConfigUtils
  • Del() : SinGooCMS.Utility.CacheUtils
  • DelByPattern() : SinGooCMS.Utility.CacheUtils
  • Delete() : SinGooCMS.Utility.FtpClient
  • DeleteDefaultDocument() : SinGooCMS.Utility.IISUtils
  • DeleteDirectory() : SinGooCMS.Utility.FileUtils
  • DeleteHostBinding() : SinGooCMS.Utility.IISUtils
  • DeletePool() : SinGooCMS.Utility.IISUtils
  • DeleteRunValue() : SinGooCMS.Utility.RegistryUtils
  • DeleteService() : SinGooCMS.Utility.ProcessUtils
  • DeleteSite() : SinGooCMS.Utility.IISUtils
  • DeleteValue() : SinGooCMS.Utility.RegistryUtils
  • DeleteVDir() : SinGooCMS.Utility.IISUtils
  • DelSession() : SinGooCMS.Utility.SessionUtils
  • DESDecrypt() : SinGooCMS.Utility.DEncryptUtils
  • DESEncrypt() : SinGooCMS.Utility.DEncryptUtils
  • Dictionary : SinGooCMS.Utility.CellPhonePrefix
  • DirectoryExist() : SinGooCMS.Utility.FtpClient
  • Disconnect() : SinGooCMS.Utility.ShareFileUtils
  • DisconnectAll() : SinGooCMS.Utility.ShareFileUtils
  • DisplayExtAttribute() : SinGooCMS.Utility.Extension.DisplayExtAttribute
  • DisplayName : SinGooCMS.Utility.Extension.DisplayExtAttribute
  • DistinctBy< TSource, TKey >() : SinGooCMS.Utility.Extension.IEnumerableExtension
  • DIZHI : SinGooCMS.Utility.Extension.DateTimeExtension
  • DownFile() : SinGooCMS.Utility.ShareFileUtils
  • Download() : SinGooCMS.Utility.FtpClient , SinGooCMS.Utility.NetWorkUtils


SinGooCMS.Utility: 类成员

  • 全部
  • 函数
  • 变量
  • 枚举
  • 属性
  • _
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • j
  • k
  • l
  • m
  • n
  • o
  • p
  • q
  • r
  • s
  • t
  • u
  • w
  • x
  • y
  • z
  • ~
这里列出了所有类成员，并附带类的详细说明:

- e -

  • Encode() : SinGooCMS.Utility.UnicodeUtils
  • endIp : SinGooCMS.Utility.IPScanner
  • endIpOff : SinGooCMS.Utility.IPScanner
  • EnsureMapping() : SinGooCMS.Utility.MimeMapping.MimeMappingDictionaryBase
  • EnumToList< T >() : SinGooCMS.Utility.EnumUtils
  • errMsg : SinGooCMS.Utility.IPScanner
  • ErrMsg : SinGooCMS.Utility.IPScanner
  • ErrorENMessage : SinGooCMS.Utility.OperationResult
  • ErrorMessage : SinGooCMS.Utility.OperationResult
  • Execute() : SinGooCMS.Utility.ProcessUtils , SinGooCMS.Utility.StopwatchUtils
  • ExecuteCMD() : SinGooCMS.Utility.ProcessUtils
  • ExistsRow() : SinGooCMS.Utility.Extension.DataTableExtension


SinGooCMS.Utility: 类成员

  • 全部
  • 函数
  • 变量
  • 枚举
  • 属性
  • _
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • j
  • k
  • l
  • m
  • n
  • o
  • p
  • q
  • r
  • s
  • t
  • u
  • w
  • x
  • y
  • z
  • ~
这里列出了所有类成员，并附带类的详细说明:

- f -

  • Fail() : SinGooCMS.Utility.OperationResult
  • fail : SinGooCMS.Utility.OperationResult
  • False< T >() : SinGooCMS.Utility.PredicateBuilder
  • FileExist() : SinGooCMS.Utility.FtpClient
  • FindRow() : SinGooCMS.Utility.Extension.DataTableExtension
  • firstStartIp : SinGooCMS.Utility.IPScanner
  • ForEach< T >() : SinGooCMS.Utility.Extension.IEnumerableExtension
  • ForEachAsync< T >() : SinGooCMS.Utility.Extension.IEnumerableExtension
  • ForEachInOrder() : SinGooCMS.Utility.Extension.TaskExtensions
  • ForEachInOrder< T >() : SinGooCMS.Utility.Extension.TaskExtensions
  • FormatDate() : SinGooCMS.Utility.ChinaDate
  • FormatMessage() : SinGooCMS.Utility.ExceptionUtils
  • FormatXML() : SinGooCMS.Utility.XmlUtils
  • FreeLibrary() : SinGooCMS.Utility.LibInvoker
  • FriendlyDate() : SinGooCMS.Utility.Extension.DateTimeExtension
  • FromDisplayName : SinGooCMS.Utility.MailConfig
  • FromHex() : SinGooCMS.Utility.HexUtils
  • FromHexTable : SinGooCMS.Utility.HexUtils
  • FromHexTable16 : SinGooCMS.Utility.HexUtils
  • FtpServer : SinGooCMS.Utility.FtpClient
  • FULLFOMART : SinGooCMS.Utility.StringUtils


SinGooCMS.Utility: 类成员

  • 全部
  • 函数
  • 变量
  • 枚举
  • 属性
  • _
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • j
  • k
  • l
  • m
  • n
  • o
  • p
  • q
  • r
  • s
  • t
  • u
  • w
  • x
  • y
  • z
  • ~
这里列出了所有类成员，并附带类的详细说明:

- g -

  • Gan : SinGooCMS.Utility.ChinaDate
  • ganStr : SinGooCMS.Utility.ChineseCalendar
  • GanZhiDateString : SinGooCMS.Utility.ChineseCalendar
  • GanZhiDayString : SinGooCMS.Utility.ChineseCalendar
  • GanZhiMonthString : SinGooCMS.Utility.ChineseCalendar
  • GanZhiStartDay : SinGooCMS.Utility.ChineseCalendar
  • GanZhiStartYear : SinGooCMS.Utility.ChineseCalendar
  • GanZhiYearString : SinGooCMS.Utility.ChineseCalendar
  • GenerateCheckCode() : SinGooCMS.Utility.CaptchaUtils
  • GenerateFtpReq() : SinGooCMS.Utility.FtpClient
  • GenerateSN() : SinGooCMS.Utility.StringUtils
  • GenerateUri() : SinGooCMS.Utility.StringUtils
  • Get< T >() : SinGooCMS.Utility.CacheUtils
  • GetAbsoluteUri() : SinGooCMS.Utility.WebUtils
  • GetAesKey() : SinGooCMS.Utility.DEncryptUtils
  • GetAllFiles() : SinGooCMS.Utility.FileUtils
  • GetAllKeys() : SinGooCMS.Utility.CacheUtils
  • GetAnonymousClient() : SinGooCMS.Utility.FtpClient
  • GetAppSetting< T >() : SinGooCMS.Utility.ConfigUtils
  • GetAppSettingInternal< T >() : SinGooCMS.Utility.ConfigUtils
  • GetAssemblyCodeBase() : SinGooCMS.Utility.Extension.AssemblyExtension
  • GetAssemblyLocation() : SinGooCMS.Utility.Extension.AssemblyExtension
  • GetAttributeToPropertyMapping< T >() : SinGooCMS.Utility.Extension.TypeExtensions
  • GetAttributeValue() : SinGooCMS.Utility.XmlUtils
  • GetAwaiter() : SinGooCMS.Utility.Extension.TaskExtensions
  • GetAwaiter< T >() : SinGooCMS.Utility.Extension.TaskExtensions
  • GetCatePrefix() : SinGooCMS.Utility.StringUtils
  • GetCellValue() : SinGooCMS.Utility.NPOIUtils
  • getChinaDate() : SinGooCMS.Utility.ChinaDate
  • GetChinaDate() : SinGooCMS.Utility.ChinaDate
  • GetChineseHour() : SinGooCMS.Utility.ChineseCalendar
  • GetChineseLeapMonth() : SinGooCMS.Utility.ChineseCalendar
  • GetChineseLeapMonthDays() : SinGooCMS.Utility.ChineseCalendar
  • GetChineseMonthDays() : SinGooCMS.Utility.ChineseCalendar
  • GetChineseSpell() : SinGooCMS.Utility.StringUtils
  • GetChineseSpellFirst() : SinGooCMS.Utility.StringUtils
  • GetChineseYearDays() : SinGooCMS.Utility.ChineseCalendar
  • GetClassFullName() : SinGooCMS.Utility.Extension.TypeExtensions
  • GetClient() : SinGooCMS.Utility.FtpClient
  • GetCNHour() : SinGooCMS.Utility.Extension.DateTimeExtension
  • GetConnectionString() : SinGooCMS.Utility.ConfigUtils
  • GetContentType() : SinGooCMS.Utility.FileUtils
  • GetCookie() : SinGooCMS.Utility.CookieUtils
  • GetCountry() : SinGooCMS.Utility.IPScanner
  • GetDateDiff() : SinGooCMS.Utility.TimeUtils
  • GetDaysByMonth() : SinGooCMS.Utility.ChinaDate
  • GetDefault() : SinGooCMS.Utility.Extension.TypeExtensions
  • GetDescription() : SinGooCMS.Utility.EnumUtils , SinGooCMS.Utility.Extension.EnumExtension
  • GetDir() : SinGooCMS.Utility.ShareFileUtils
  • GetDirectories() : SinGooCMS.Utility.FtpClient
  • GetDirectoryLength() : SinGooCMS.Utility.FileUtils
  • GetDTFromUnixTime() : SinGooCMS.Utility.DatetimeUtils
  • GetEndIp() : SinGooCMS.Utility.IPScanner
  • GetEnumCollectionDescription< T >() : SinGooCMS.Utility.EnumUtils
  • GetEnumDescription() : SinGooCMS.Utility.EnumUtils
  • GetEnumDescription< T >() : SinGooCMS.Utility.EnumUtils
  • GetEnumDescriptions< T >() : SinGooCMS.Utility.EnumUtils
  • GetField() : SinGooCMS.Utility.Extension.ReflectExtension
  • GetFields() : SinGooCMS.Utility.Extension.ReflectExtension
  • GetFieldVal< T >() : SinGooCMS.Utility.Extension.ReflectExtension
  • GetFile() : SinGooCMS.Utility.ShareFileUtils
  • GetFileMD5() : SinGooCMS.Utility.Extension.IOExtension
  • GetFileName() : SinGooCMS.Utility.MimeMapping.MimeMappingDictionaryBase
  • GetFiles() : SinGooCMS.Utility.FtpClient
  • GetFilesDetails() : SinGooCMS.Utility.FtpClient
  • GetFileSha1() : SinGooCMS.Utility.Extension.IOExtension
  • GetFileSize() : SinGooCMS.Utility.FileUtils , SinGooCMS.Utility.FtpClient
  • GetFlagStr() : SinGooCMS.Utility.IPScanner
  • GetFormBool() : SinGooCMS.Utility.WebUtils
  • GetFormDatetime() : SinGooCMS.Utility.WebUtils
  • GetFormDecimal() : SinGooCMS.Utility.WebUtils
  • GetFormDouble() : SinGooCMS.Utility.WebUtils
  • GetFormFloat() : SinGooCMS.Utility.WebUtils
  • GetFormInt() : SinGooCMS.Utility.WebUtils
  • GetFormString() : SinGooCMS.Utility.WebUtils
  • GetFormVal< T >() : SinGooCMS.Utility.WebUtils
  • GetFormVals< T >() : SinGooCMS.Utility.WebUtils
  • GetFQDN() : SinGooCMS.Utility.NetWorkUtils
  • GetFrames() : SinGooCMS.Utility.Extension.ImageExtension
  • GetFrameworkVersion() : SinGooCMS.Utility.Extension.AssemblyExtension
  • GetGUID() : SinGooCMS.Utility.StringUtils
  • GetHash() : SinGooCMS.Utility.RSACryption
  • GetImageResource() : SinGooCMS.Utility.Extension.ReflectExtension
  • GetInstanceProperties() : SinGooCMS.Utility.Extension.TypeExtensions
  • GetIP() : SinGooCMS.Utility.IPUtils
  • GetIPAreaStr() : SinGooCMS.Utility.IPUtils
  • GetItemValue() : SinGooCMS.Utility.XmlUtils
  • GetKey() : SinGooCMS.Utility.EntityAttrUtils
  • GetKey< TKey, TValue >() : SinGooCMS.Utility.Extension.DictionaryExtension
  • GetKeyValue< TEntity >() : SinGooCMS.Utility.EntityAttrUtils
  • GetManifestString() : SinGooCMS.Utility.Extension.ReflectExtension
  • GetMaxLength() : SinGooCMS.Utility.EntityAttrUtils
  • GetMimeMapping() : SinGooCMS.Utility.MimeMapping.MimeMappingDictionaryBase
  • GetMinLength() : SinGooCMS.Utility.EntityAttrUtils
  • GetMonday() : SinGooCMS.Utility.Extension.DateTimeExtension
  • GetMondayDateByDate() : SinGooCMS.Utility.ChinaDate
  • GetMonthFirstDay() : SinGooCMS.Utility.Extension.DateTimeExtension
  • GetMonthLastDay() : SinGooCMS.Utility.Extension.DateTimeExtension
  • GetNewFileName() : SinGooCMS.Utility.StringUtils
  • GetNode() : SinGooCMS.Utility.XmlUtils
  • GetOrderExpression() : SinGooCMS.Utility.Extension.LinqExtension
  • GetPacketLength() : SinGooCMS.Utility.SocketClient
  • GetPages() : SinGooCMS.Utility.PagerUtils
  • GetPageUrl() : SinGooCMS.Utility.PagerUtils
  • GetParents() : SinGooCMS.Utility.Extension.TypeExtensions
  • GetPath() : SinGooCMS.Utility.SocketClient
  • GetProcAddress() : SinGooCMS.Utility.LibInvoker
  • GetPropertiesWithAttribute< T >() : SinGooCMS.Utility.Extension.TypeExtensions
  • GetProperty() : SinGooCMS.Utility.Extension.ReflectExtension
  • GetProperty< TEntity >() : SinGooCMS.Utility.EntityAttrUtils
  • GetPropertyInfo() : SinGooCMS.Utility.Extension.LinqExtension
  • GetPropertyVal< T >() : SinGooCMS.Utility.Extension.ReflectExtension
  • GetQuarterFirstDay() : SinGooCMS.Utility.Extension.DateTimeExtension
  • GetQuarterLastDay() : SinGooCMS.Utility.Extension.DateTimeExtension
  • GetQueryBool() : SinGooCMS.Utility.WebUtils
  • GetQueryDatetime() : SinGooCMS.Utility.WebUtils
  • GetQueryDecimal() : SinGooCMS.Utility.WebUtils
  • GetQueryDouble() : SinGooCMS.Utility.WebUtils
  • GetQueryFloat() : SinGooCMS.Utility.WebUtils
  • GetQueryInt() : SinGooCMS.Utility.WebUtils
  • GetQueryLong() : SinGooCMS.Utility.WebUtils
  • GetQueryString() : SinGooCMS.Utility.WebUtils
  • GetQueryVal< T >() : SinGooCMS.Utility.WebUtils
  • GetQueryVals< T >() : SinGooCMS.Utility.WebUtils
  • GetRandomNumber() : SinGooCMS.Utility.StringUtils
  • GetRandomString() : SinGooCMS.Utility.StringUtils
  • GetResString() : SinGooCMS.Utility.Extension.ReflectExtension
  • GetRunValue() : SinGooCMS.Utility.RegistryUtils
  • GetSafeValue< Tkey, Tvalue >() : SinGooCMS.Utility.Extension.DataTypeChangeExtension
  • GetSendPacketLengthStr() : SinGooCMS.Utility.SocketClient
  • GetSession< T >() : SinGooCMS.Utility.SessionUtils
  • GetShortDate() : SinGooCMS.Utility.Extension.DateTimeExtension
  • GetSimplified() : SinGooCMS.Utility.StringUtils
  • GetSiteInfo() : SinGooCMS.Utility.IISUtils
  • GetSiteList() : SinGooCMS.Utility.IISUtils
  • GetSpaceChar() : SinGooCMS.Utility.StringUtils
  • GetStartIp() : SinGooCMS.Utility.IPScanner
  • GetStr() : SinGooCMS.Utility.IPScanner
  • GetStrFromHex() : SinGooCMS.Utility.HexUtils
  • GetStringLength() : SinGooCMS.Utility.StringUtils
  • GetSunday() : SinGooCMS.Utility.Extension.DateTimeExtension
  • GetTableName() : SinGooCMS.Utility.EntityAttrUtils
  • GetTimeSpan() : SinGooCMS.Utility.TimeUtils
  • GetTotalDays() : SinGooCMS.Utility.Extension.DateTimeExtension
  • GetTotalHours() : SinGooCMS.Utility.Extension.DateTimeExtension
  • GetTotalMicroseconds() : SinGooCMS.Utility.Extension.DateTimeExtension
  • GetTotalMinutes() : SinGooCMS.Utility.Extension.DateTimeExtension
  • GetTotalNanoseconds() : SinGooCMS.Utility.Extension.DateTimeExtension
  • GetTraditional() : SinGooCMS.Utility.StringUtils
  • GetType() : SinGooCMS.Utility.ReflectionUtils
  • GetTypeCode() : SinGooCMS.Utility.Extension.TypeExtensions
  • GetUnixTime() : SinGooCMS.Utility.DatetimeUtils
  • GetUnixTimeMilliseconds() : SinGooCMS.Utility.Extension.DateTimeExtension
  • GetUnixTimeSeconds() : SinGooCMS.Utility.Extension.DateTimeExtension
  • GetUrl() : SinGooCMS.Utility.PagerUtils
  • GetUrlPathPart() : SinGooCMS.Utility.WebUtils
  • GetValue() : SinGooCMS.Utility.RegistryUtils , SinGooCMS.Utility.XmlUtils
  • GetValue< TKey, TValue >() : SinGooCMS.Utility.Extension.DictionaryExtension
  • GetWeekFirstDay() : SinGooCMS.Utility.Extension.DateTimeExtension
  • GetWeekLastDay() : SinGooCMS.Utility.Extension.DateTimeExtension
  • GetXORCode() : SinGooCMS.Utility.DEncryptUtils
  • GetYearFirstDay() : SinGooCMS.Utility.Extension.DateTimeExtension
  • GetYearLastDay() : SinGooCMS.Utility.Extension.DateTimeExtension


SinGooCMS.Utility: 类成员

  • 全部
  • 函数
  • 变量
  • 枚举
  • 属性
  • _
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • j
  • k
  • l
  • m
  • n
  • o
  • p
  • q
  • r
  • s
  • t
  • u
  • w
  • x
  • y
  • z
  • ~
这里列出了所有类成员，并附带类的详细说明:

- h -

  • HandleException< T >() : SinGooCMS.Utility.Extension.TaskExtensions
  • HandleExceptions() : SinGooCMS.Utility.Extension.TaskExtensions
  • HasDefaultConstructor() : SinGooCMS.Utility.Extension.TypeExtensions
  • HashFile() : SinGooCMS.Utility.Extension.IOExtension
  • HasNextPage : SinGooCMS.Utility.PagerModel< T >
  • HasPrevPage : SinGooCMS.Utility.PagerModel< T >
  • hLib : SinGooCMS.Utility.LibInvoker
  • HolidayName : SinGooCMS.Utility.ChineseCalendar.LunarHolidayStruct , SinGooCMS.Utility.ChineseCalendar.SolarHolidayStruct , SinGooCMS.Utility.ChineseCalendar.WeekHolidayStruct
  • HttpContext : SinGooCMS.Utility.UtilsBase
  • HttpGet() : SinGooCMS.Utility.NetWorkUtils
  • HttpPost() : SinGooCMS.Utility.NetWorkUtils
  • HZNum : SinGooCMS.Utility.ChineseCalendar


SinGooCMS.Utility: 类成员

  • 全部
  • 函数
  • 变量
  • 枚举
  • 属性
  • _
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • j
  • k
  • l
  • m
  • n
  • o
  • p
  • q
  • r
  • s
  • t
  • u
  • w
  • x
  • y
  • z
  • ~
这里列出了所有类成员，并附带类的详细说明:

- i -

  • i : SinGooCMS.Utility.SocketClient
  • IdCardUtils() : SinGooCMS.Utility.IdCardUtils
  • IgnoreCase : SinGooCMS.Utility.Accessor
  • ImageToBase64() : SinGooCMS.Utility.ImageUtils
  • IncludesNonPublic : SinGooCMS.Utility.Accessor
  • Init() : SinGooCMS.Utility.VideoUtils
  • Insert< T >() : SinGooCMS.Utility.CacheUtils
  • InsertAfter< T >() : SinGooCMS.Utility.Extension.IEnumerableExtension
  • IntToIP() : SinGooCMS.Utility.IPScanner
  • Invoke() : SinGooCMS.Utility.LibInvoker
  • InvokeMethod() : SinGooCMS.Utility.Extension.ReflectExtension
  • ip : SinGooCMS.Utility.IPScanner
  • IP : SinGooCMS.Utility.IPScanner
  • IP2IntArr() : SinGooCMS.Utility.IPUtils
  • IPLocation() : SinGooCMS.Utility.IPScanner
  • IPScanner() : SinGooCMS.Utility.IPScanner
  • IpToInt() : SinGooCMS.Utility.IPScanner
  • Is32Bit() : SinGooCMS.Utility.Extension.AssemblyExtension
  • IsArrayOf< T >() : SinGooCMS.Utility.Extension.TypeExtensions
  • IsBase64Formatted() : SinGooCMS.Utility.Base64FileUtils
  • IsBetween() : SinGooCMS.Utility.Extension.ValidateExtension
  • IsChineseIP() : SinGooCMS.Utility.IPScanner
  • IsChineseLeapMonth : SinGooCMS.Utility.ChineseCalendar
  • IsChineseLeapYear : SinGooCMS.Utility.ChineseCalendar
  • IsConnected() : SinGooCMS.Utility.AdoUtils
  • IsCredential : SinGooCMS.Utility.FtpClient
  • IsDate() : SinGooCMS.Utility.Extension.ValidateExtension
  • IsDecimal() : SinGooCMS.Utility.Extension.ValidateExtension
  • IsEmail() : SinGooCMS.Utility.Extension.ValidateExtension
  • IsEn() : SinGooCMS.Utility.Extension.ValidateExtension
  • IsFax() : SinGooCMS.Utility.Extension.ValidateExtension
  • IsGenericList() : SinGooCMS.Utility.Extension.TypeExtensions
  • IsGuid() : SinGooCMS.Utility.Extension.ValidateExtension
  • IsIDCard() : SinGooCMS.Utility.Extension.ValidateExtension
  • IsImage() : SinGooCMS.Utility.Extension.ValidateExtension
  • IsImplements< T >() : SinGooCMS.Utility.Extension.TypeExtensions
  • IsInIPDuan() : SinGooCMS.Utility.IPUtils
  • IsInt() : SinGooCMS.Utility.Extension.ValidateExtension
  • IsIP() : SinGooCMS.Utility.Extension.ValidateExtension
  • IsJson() : SinGooCMS.Utility.Extension.ValidateExtension
  • IsKey() : SinGooCMS.Utility.EntityAttrUtils
  • IsLeapYear : SinGooCMS.Utility.ChineseCalendar
  • IsMatch() : SinGooCMS.Utility.Extension.ValidateExtension
  • IsMobile() : SinGooCMS.Utility.Extension.ValidateExtension
  • IsNoInt() : SinGooCMS.Utility.Extension.ValidateExtension
  • IsNotMapped() : SinGooCMS.Utility.EntityAttrUtils
  • IsNotNullOrEmpty() : SinGooCMS.Utility.Extension.ValidateExtension
  • IsNullable() : SinGooCMS.Utility.Extension.TypeExtensions
  • IsNullOrEmpty() : SinGooCMS.Utility.Extension.ValidateExtension
  • IsNullOrWhiteSpace() : SinGooCMS.Utility.Extension.ValidateExtension
  • IsNumeric() : SinGooCMS.Utility.Extension.TypeExtensions
  • IsOptimized() : SinGooCMS.Utility.Extension.AssemblyExtension
  • IsReadRes : SinGooCMS.Utility.Extension.DisplayExtAttribute
  • IsSequence() : SinGooCMS.Utility.Extension.TypeExtensions
  • IsSimpleType() : SinGooCMS.Utility.Extension.TypeExtensions
  • isSuccess : SinGooCMS.Utility.MailUtils
  • IsTelephone() : SinGooCMS.Utility.Extension.ValidateExtension
  • IsUrl() : SinGooCMS.Utility.Extension.ValidateExtension
  • IsZHCN() : SinGooCMS.Utility.Extension.ValidateExtension


SinGooCMS.Utility: 类成员

  • 全部
  • 函数
  • 变量
  • 枚举
  • 属性
  • _
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • j
  • k
  • l
  • m
  • n
  • o
  • p
  • q
  • r
  • s
  • t
  • u
  • w
  • x
  • y
  • z
  • ~
这里列出了所有类成员，并附带类的详细说明:

- j -

  • JoinSplitter() : SinGooCMS.Utility.Extension.StringExtension
  • JsonToAnonymousObject< T >() : SinGooCMS.Utility.Extension.JsonserializeExtension
  • JsonToObject< T >() : SinGooCMS.Utility.Extension.JsonserializeExtension


SinGooCMS.Utility: 类成员

  • 全部
  • 函数
  • 变量
  • 枚举
  • 属性
  • _
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • j
  • k
  • l
  • m
  • n
  • o
  • p
  • q
  • r
  • s
  • t
  • u
  • w
  • x
  • y
  • z
  • ~
这里列出了所有类成员，并附带类的详细说明:

- k -

  • Kill() : SinGooCMS.Utility.ProcessUtils
  • KillCurrent() : SinGooCMS.Utility.ProcessUtils


SinGooCMS.Utility: 类成员

  • 全部
  • 函数
  • 变量
  • 枚举
  • 属性
  • _
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • j
  • k
  • l
  • m
  • n
  • o
  • p
  • q
  • r
  • s
  • t
  • u
  • w
  • x
  • y
  • z
  • ~
这里列出了所有类成员，并附带类的详细说明:

- l -

  • lastStartIp : SinGooCMS.Utility.IPScanner
  • LDPic() : SinGooCMS.Utility.Extension.ImageExtension
  • leapDays() : SinGooCMS.Utility.ChinaDate
  • leapMonth() : SinGooCMS.Utility.ChinaDate
  • LeftRightRev() : SinGooCMS.Utility.Extension.ImageExtension
  • lFtv : SinGooCMS.Utility.ChinaDate
  • lHolidayInfo : SinGooCMS.Utility.ChineseCalendar
  • LibInvoker() : SinGooCMS.Utility.LibInvoker
  • ListenerSocket() : SinGooCMS.Utility.SocketClient
  • ListenerStream() : SinGooCMS.Utility.SocketClient
  • Load() : SinGooCMS.Utility.ReflectionUtils
  • LoadBitmap() : SinGooCMS.Utility.Extension.ReflectExtension
  • LoadLibrary() : SinGooCMS.Utility.LibInvoker
  • Local : SinGooCMS.Utility.IPScanner
  • local : SinGooCMS.Utility.IPScanner
  • locker : SinGooCMS.Utility.JsonFileUtils
  • Lunar() : SinGooCMS.Utility.ChinaDate
  • LunarDateArray : SinGooCMS.Utility.ChineseCalendar
  • LunarHolidayStruct() : SinGooCMS.Utility.ChineseCalendar.LunarHolidayStruct
  • lunarInfo : SinGooCMS.Utility.ChinaDate
  • lYearDays() : SinGooCMS.Utility.ChinaDate


SinGooCMS.Utility: 类成员

  • 全部
  • 函数
  • 变量
  • 枚举
  • 属性
  • _
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • j
  • k
  • l
  • m
  • n
  • o
  • p
  • q
  • r
  • s
  • t
  • u
  • w
  • x
  • y
  • z
  • ~
这里列出了所有类成员，并附带类的详细说明:

- m -

  • m_maxpacket : SinGooCMS.Utility.SocketClient
  • MakeDir() : SinGooCMS.Utility.FtpClient
  • MakeThumbnail() : SinGooCMS.Utility.ImageUtils
  • MapTo< TSource, TDestination >() : SinGooCMS.Utility.Extension.ObjectExtension
  • MapToList< TSource, TDestination >() : SinGooCMS.Utility.Extension.ObjectExtension
  • markPath : SinGooCMS.Utility.SocketClient
  • Mask() : SinGooCMS.Utility.Extension.StringExtension
  • MaxDay : SinGooCMS.Utility.ChineseCalendar
  • MaxYear : SinGooCMS.Utility.ChineseCalendar
  • MD5Encrypt() : SinGooCMS.Utility.DEncryptUtils
  • MinDay : SinGooCMS.Utility.ChineseCalendar
  • MinYear : SinGooCMS.Utility.ChineseCalendar
  • Month : SinGooCMS.Utility.ChineseCalendar.LunarHolidayStruct , SinGooCMS.Utility.ChineseCalendar.SolarHolidayStruct , SinGooCMS.Utility.ChineseCalendar.WeekHolidayStruct
  • monthDays() : SinGooCMS.Utility.ChinaDate
  • Mosaic() : SinGooCMS.Utility.Extension.ImageExtension
  • MoveFile() : SinGooCMS.Utility.FtpClient


SinGooCMS.Utility: 类成员

  • 全部
  • 函数
  • 变量
  • 枚举
  • 属性
  • _
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • j
  • k
  • l
  • m
  • n
  • o
  • p
  • q
  • r
  • s
  • t
  • u
  • w
  • x
  • y
  • z
  • ~
这里列出了所有类成员，并附带类的详细说明:

- n -

  • Name : SinGooCMS.Utility.Extension.DisplayExtAttribute
  • newCalendarHoliday : SinGooCMS.Utility.ChineseCalendar
  • NextPage : SinGooCMS.Utility.PagerModel< T >
  • NonGenericCollectionsToSequenceTypeMapping : SinGooCMS.Utility.Extension.TypeExtensions
  • NORMALFORMAT : SinGooCMS.Utility.StringUtils
  • nStr1 : SinGooCMS.Utility.ChinaDate , SinGooCMS.Utility.ChineseCalendar
  • nStr2 : SinGooCMS.Utility.ChineseCalendar


SinGooCMS.Utility: 类成员

  • 全部
  • 函数
  • 变量
  • 枚举
  • 属性
  • _
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • j
  • k
  • l
  • m
  • n
  • o
  • p
  • q
  • r
  • s
  • t
  • u
  • w
  • x
  • y
  • z
  • ~
这里列出了所有类成员，并附带类的详细说明:

- o -

  • objfs : SinGooCMS.Utility.IPScanner
  • OperationResult() : SinGooCMS.Utility.OperationResult
  • Or< T >() : SinGooCMS.Utility.PredicateBuilder
  • OrderByBatch< T >() : SinGooCMS.Utility.Extension.LinqExtension


SinGooCMS.Utility: 类成员

  • 全部
  • 函数
  • 变量
  • 枚举
  • 属性
  • _
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • j
  • k
  • l
  • m
  • n
  • o
  • p
  • q
  • r
  • s
  • t
  • u
  • w
  • x
  • y
  • z
  • ~
这里列出了所有类成员，并附带类的详细说明:

- p -

  • Page< T >() : SinGooCMS.Utility.QueryExtension
  • PageBegin : SinGooCMS.Utility.PagerUtils
  • PageEnd : SinGooCMS.Utility.PagerUtils
  • PageIndex : SinGooCMS.Utility.PagerModel< T > , SinGooCMS.Utility.PagerUtils
  • PageModel< T >() : SinGooCMS.Utility.QueryExtension
  • PagerData : SinGooCMS.Utility.PagerModel< T >
  • PageSize : SinGooCMS.Utility.PagerModel< T > , SinGooCMS.Utility.PagerUtils
  • Parse() : SinGooCMS.Utility.IdCardUtils
  • parseAge() : SinGooCMS.Utility.IdCardUtils
  • parseBrithday() : SinGooCMS.Utility.IdCardUtils
  • ParseQueryString() : SinGooCMS.Utility.Extension.UriExtension
  • parseSex() : SinGooCMS.Utility.IdCardUtils
  • PassiveMode : SinGooCMS.Utility.FtpClient
  • Password : SinGooCMS.Utility.FtpClient , SinGooCMS.Utility.ShareFileUtils
  • Ping() : SinGooCMS.Utility.NetWorkUtils
  • PoolsStart() : SinGooCMS.Utility.IISUtils
  • PoolsStop() : SinGooCMS.Utility.IISUtils
  • PopulateMappings() : SinGooCMS.Utility.MimeMapping.MimeMappingDictionaryBase , SinGooCMS.Utility.MimeMapping.MimeMappingDictionaryClassic
  • Prefix : SinGooCMS.Utility.CellPhonePrefix
  • PrevPage : SinGooCMS.Utility.PagerModel< T >
  • Properties : SinGooCMS.Utility.Accessor
  • ProviderName : SinGooCMS.Utility.ConfigUtils
  • Province : SinGooCMS.Utility.IPAreaInfo


SinGooCMS.Utility: 类成员

  • 全部
  • 函数
  • 变量
  • 枚举
  • 属性
  • _
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • j
  • k
  • l
  • m
  • n
  • o
  • p
  • q
  • r
  • s
  • t
  • u
  • w
  • x
  • y
  • z
  • ~
这里列出了所有类成员，并附带类的详细说明:

- q -

  • QQwry() : SinGooCMS.Utility.IPScanner
  • QueryStringRegex : SinGooCMS.Utility.Extension.UriExtension


SinGooCMS.Utility: 类成员

  • 全部
  • 函数
  • 变量
  • 枚举
  • 属性
  • _
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • j
  • k
  • l
  • m
  • n
  • o
  • p
  • q
  • r
  • s
  • t
  • u
  • w
  • x
  • y
  • z
  • ~
这里列出了所有类成员，并附带类的详细说明:

- r -

  • RandomArray< T >() : SinGooCMS.Utility.Extension.IEnumerableExtension
  • RandomTake< T >() : SinGooCMS.Utility.Extension.IEnumerableExtension
  • Read() : SinGooCMS.Utility.CsvUtils , SinGooCMS.Utility.NPOIUtils
  • Read< T >() : SinGooCMS.Utility.CsvUtils , SinGooCMS.Utility.JsonFileUtils
  • ReadCell() : SinGooCMS.Utility.NPOIUtils
  • ReadFileBitmap() : SinGooCMS.Utility.ImageUtils
  • ReadFileContentAsync() : SinGooCMS.Utility.FileUtils
  • ReadFileToBytes() : SinGooCMS.Utility.FileUtils
  • ReadFileToImage() : SinGooCMS.Utility.ImageUtils
  • ReadFileToStream() : SinGooCMS.Utility.FileUtils
  • ReadFileToString() : SinGooCMS.Utility.Base64FileUtils
  • ReadList< T >() : SinGooCMS.Utility.JsonFileUtils
  • ReadSheet() : SinGooCMS.Utility.NPOIUtils
  • ReceiveFile() : SinGooCMS.Utility.SocketClient
  • ReceiveFixData() : SinGooCMS.Utility.SocketClient
  • ReceiveVarData() : SinGooCMS.Utility.SocketClient
  • ReceiveVarData< T >() : SinGooCMS.Utility.SocketClient
  • Recess : SinGooCMS.Utility.ChineseCalendar.LunarHolidayStruct , SinGooCMS.Utility.ChineseCalendar.SolarHolidayStruct
  • RecordBegin : SinGooCMS.Utility.PagerUtils
  • RecordEnd : SinGooCMS.Utility.PagerUtils
  • ReferenceEquals() : SinGooCMS.Utility.Extension.ObjectExtension
  • RegionCode : SinGooCMS.Utility.IdCardUtils
  • Relief() : SinGooCMS.Utility.Extension.ImageExtension
  • RemoveCookie() : SinGooCMS.Utility.CookieUtils
  • RemoveDirectory() : SinGooCMS.Utility.FtpClient
  • RemoveEmptyRow() : SinGooCMS.Utility.Extension.DataTableExtension
  • RemoveHtml() : SinGooCMS.Utility.Extension.StringExtension
  • RemoveNode() : SinGooCMS.Utility.XmlUtils
  • RemoveSpaces() : SinGooCMS.Utility.FtpClient
  • RemoveWhere< T >() : SinGooCMS.Utility.Extension.IEnumerableExtension
  • RemoveWhiteSpace() : SinGooCMS.Utility.Extension.StringExtension
  • Rename() : SinGooCMS.Utility.FtpClient
  • ReNameFile() : SinGooCMS.Utility.FileUtils
  • RePic() : SinGooCMS.Utility.Extension.ImageExtension
  • Request : SinGooCMS.Utility.UtilsBase
  • ResizeImage() : SinGooCMS.Utility.Extension.ImageExtension
  • ResName : SinGooCMS.Utility.Extension.DisplayExtAttribute
  • ResourceType : SinGooCMS.Utility.Extension.DisplayExtAttribute
  • Response : SinGooCMS.Utility.UtilsBase
  • RestoreFile() : SinGooCMS.Utility.FileUtils
  • ReturnStatusType : SinGooCMS.Utility.OperationResult
  • RSADecrypt() : SinGooCMS.Utility.RSACryption
  • RSAEncrypt() : SinGooCMS.Utility.RSACryption
  • RSAKey() : SinGooCMS.Utility.RSACryption


SinGooCMS.Utility: 类成员

  • 全部
  • 函数
  • 变量
  • 枚举
  • 属性
  • _
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • j
  • k
  • l
  • m
  • n
  • o
  • p
  • q
  • r
  • s
  • t
  • u
  • w
  • x
  • y
  • z
  • ~
这里列出了所有类成员，并附带类的详细说明:

- s -

  • Save() : SinGooCMS.Utility.NPOIUtils , SinGooCMS.Utility.VideoUtils , SinGooCMS.Utility.XmlUtils
  • Save< T >() : SinGooCMS.Utility.JsonFileUtils
  • SaveAsMemoryStream() : SinGooCMS.Utility.Extension.StreamExtension
  • SaveFile() : SinGooCMS.Utility.Extension.StreamExtension
  • SaveFileAsync() : SinGooCMS.Utility.Extension.IOExtension
  • SaveStringToFile() : SinGooCMS.Utility.Base64FileUtils
  • SaveStringToFileAsync() : SinGooCMS.Utility.Base64FileUtils
  • SaveToCsv() : SinGooCMS.Utility.Extension.DataTableExtension
  • SaveToCsv< T >() : SinGooCMS.Utility.Extension.DataTableExtension
  • SaveToCsvAsync() : SinGooCMS.Utility.Extension.DataTableExtension
  • SaveToCsvAsync< T >() : SinGooCMS.Utility.Extension.DataTableExtension
  • SaveToExcel() : SinGooCMS.Utility.Extension.DataTableExtension
  • SaveWithTmpl() : SinGooCMS.Utility.NPOIUtils
  • SelectNode() : SinGooCMS.Utility.XmlUtils
  • SendEmail() : SinGooCMS.Utility.MailUtils
  • SendEmailAsync() : SinGooCMS.Utility.MailUtils
  • SendFile() : SinGooCMS.Utility.SocketClient
  • SendFixData() : SinGooCMS.Utility.SocketClient
  • SendSerializeObject< T >() : SinGooCMS.Utility.SocketClient
  • SendVarData() : SinGooCMS.Utility.SocketClient
  • SerializeObject() : SinGooCMS.Utility.SocketClient
  • ServMailAccount : SinGooCMS.Utility.MailConfig
  • ServMailIsSSL : SinGooCMS.Utility.MailConfig
  • ServMailPort : SinGooCMS.Utility.MailConfig
  • ServMailSMTP : SinGooCMS.Utility.MailConfig
  • ServMailUserName : SinGooCMS.Utility.MailConfig
  • ServMailUserPwd : SinGooCMS.Utility.MailConfig
  • SetAttributeValue() : SinGooCMS.Utility.XmlUtils
  • SetCookie() : SinGooCMS.Utility.CookieUtils
  • SetFieldVal() : SinGooCMS.Utility.Extension.ReflectExtension
  • SetItemValue() : SinGooCMS.Utility.XmlUtils
  • SetPropertyVal() : SinGooCMS.Utility.Extension.ReflectExtension
  • SetRunValue() : SinGooCMS.Utility.RegistryUtils
  • SetSession() : SinGooCMS.Utility.SessionUtils
  • SetSession< T >() : SinGooCMS.Utility.SessionUtils
  • SetValue() : SinGooCMS.Utility.RegistryUtils
  • Sex : SinGooCMS.Utility.IdCardUtils
  • sFtv : SinGooCMS.Utility.ChinaDate
  • SHA512Encrypt() : SinGooCMS.Utility.DEncryptUtils
  • SharePath : SinGooCMS.Utility.ShareFileUtils
  • sHolidayInfo : SinGooCMS.Utility.ChineseCalendar
  • SHORTFORMAT : SinGooCMS.Utility.StringUtils
  • shortNames : SinGooCMS.Utility.Extension.TypeExtensions
  • ShowConnect() : SinGooCMS.Utility.ShareFileUtils
  • Shutdown() : SinGooCMS.Utility.ProcessUtils
  • Sign : SinGooCMS.Utility.OperationResult
  • SignatureDeformatter() : SinGooCMS.Utility.RSACryption
  • SignatureFormatter() : SinGooCMS.Utility.RSACryption
  • SimpleTypes : SinGooCMS.Utility.Extension.TypeExtensions
  • SNType : SinGooCMS.Utility.StringUtils
  • SolarHolidayStruct() : SinGooCMS.Utility.ChineseCalendar.SolarHolidayStruct
  • solarTerm : SinGooCMS.Utility.ChinaDate
  • SolarTerm : SinGooCMS.Utility.ChineseCalendar
  • SortByKey< TKey, TValue >() : SinGooCMS.Utility.Extension.DictionaryExtension
  • SpaceCharacter : SinGooCMS.Utility.HexUtils
  • Split() : SinGooCMS.Utility.StringUtils
  • Start() : SinGooCMS.Utility.IISUtils
  • startIp : SinGooCMS.Utility.IPScanner
  • StartPoint : SinGooCMS.Utility.VideoUtils
  • StartService() : SinGooCMS.Utility.ProcessUtils
  • StatusCode : SinGooCMS.Utility.OperationResult
  • sTerm() : SinGooCMS.Utility.ChinaDate
  • sTermInfo : SinGooCMS.Utility.ChinaDate , SinGooCMS.Utility.ChineseCalendar
  • Stop() : SinGooCMS.Utility.IISUtils
  • StopService() : SinGooCMS.Utility.ProcessUtils
  • StringToEnum() : SinGooCMS.Utility.EnumUtils
  • StringToEnum< T >() : SinGooCMS.Utility.EnumUtils
  • StringToEnumOrNull< T >() : SinGooCMS.Utility.EnumUtils
  • Success() : SinGooCMS.Utility.OperationResult
  • success : SinGooCMS.Utility.OperationResult


SinGooCMS.Utility: 类成员

  • 全部
  • 函数
  • 变量
  • 枚举
  • 属性
  • _
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • j
  • k
  • l
  • m
  • n
  • o
  • p
  • q
  • r
  • s
  • t
  • u
  • w
  • x
  • y
  • z
  • ~
这里列出了所有类成员，并附带类的详细说明:

- t -

  • this[int indexBeg, int indexEnd] : SinGooCMS.Utility.SinGooArray , SinGooCMS.Utility.SinGooDictionary< T1, T2 > , SinGooCMS.Utility.SinGooList< T >
  • this[int indexBeg] : SinGooCMS.Utility.SinGooDictionary< T1, T2 >
  • this[object instance, string propertyName] : SinGooCMS.Utility.ObjectAccessor
  • this[TInstance instance, string propertyName] : SinGooCMS.Utility.GenericAccessor< TInstance >
  • ThumbnailImage() : SinGooCMS.Utility.Extension.ImageExtension
  • Timeout : SinGooCMS.Utility.OperationResult
  • TimeoutAfter() : SinGooCMS.Utility.Extension.TaskExtensions
  • TimeoutAfter< T >() : SinGooCMS.Utility.Extension.TaskExtensions
  • TimeoutAfterImpl() : SinGooCMS.Utility.Extension.TaskExtensions
  • TimeStamp : SinGooCMS.Utility.OperationResult
  • To< T >() : SinGooCMS.Utility.Extension.IConvertibleExtension
  • ToArray() : SinGooCMS.Utility.Extension.StreamExtension
  • ToArrayList() : SinGooCMS.Utility.Extension.DataTableExtension
  • ToBase64() : SinGooCMS.Utility.Extension.ImageExtension
  • ToBase64String() : SinGooCMS.Utility.Extension.IOExtension
  • ToBool() : SinGooCMS.Utility.Extension.DataTypeChangeExtension
  • ToBWPic() : SinGooCMS.Utility.Extension.ImageExtension
  • ToByte() : SinGooCMS.Utility.Extension.DataTypeChangeExtension
  • ToBytes() : SinGooCMS.Utility.Extension.IOExtension
  • ToCsharpType() : SinGooCMS.Utility.Extension.DataTypeChangeExtension
  • ToDataTable< T >() : SinGooCMS.Utility.Extension.IEnumerableExtension
  • ToDateTime() : SinGooCMS.Utility.Extension.DataTypeChangeExtension
  • ToDecimal() : SinGooCMS.Utility.Extension.DataTypeChangeExtension
  • ToDistinctTable() : SinGooCMS.Utility.Extension.DataTableExtension
  • ToDouble() : SinGooCMS.Utility.Extension.DataTypeChangeExtension
  • ToEntity< T >() : SinGooCMS.Utility.Extension.DataTableExtension
  • ToEnum< T >() : SinGooCMS.Utility.Extension.EnumExtension
  • ToEnumerable< T >() : SinGooCMS.Utility.Extension.DataTableExtension
  • ToFloat() : SinGooCMS.Utility.Extension.DataTypeChangeExtension
  • ToFormatDate() : SinGooCMS.Utility.Extension.DateTimeExtension
  • ToFormatDateString() : SinGooCMS.Utility.Extension.DateTimeExtension
  • ToFormatString() : SinGooCMS.Utility.Extension.DateTimeExtension
  • ToFormatStringFull() : SinGooCMS.Utility.Extension.DateTimeExtension
  • ToFormatTime() : SinGooCMS.Utility.Extension.DateTimeExtension
  • ToHashSet< T, TResult >() : SinGooCMS.Utility.Extension.IEnumerableExtension
  • ToHex() : SinGooCMS.Utility.HexUtils
  • ToHexTable : SinGooCMS.Utility.HexUtils
  • ToHtml() : SinGooCMS.Utility.Extension.StringExtension
  • ToInt() : SinGooCMS.Utility.Extension.DataTypeChangeExtension
  • ToIntArray() : SinGooCMS.Utility.Extension.DataTypeChangeExtension
  • ToJson() : SinGooCMS.Utility.Extension.JsonserializeExtension
  • ToJson< T >() : SinGooCMS.Utility.Extension.JsonserializeExtension
  • ToJsonObj() : SinGooCMS.Utility.OperationResult
  • ToLong() : SinGooCMS.Utility.Extension.DataTypeChangeExtension
  • ToolsPath : SinGooCMS.Utility.VideoUtils
  • ToRMB() : SinGooCMS.Utility.Extension.StringExtension
  • ToShort() : SinGooCMS.Utility.Extension.DataTypeChangeExtension
  • ToSpliterArray< T >() : SinGooCMS.Utility.Extension.DataTypeChangeExtension
  • ToSpliterList< T >() : SinGooCMS.Utility.Extension.DataTypeChangeExtension
  • ToSplitterString() : SinGooCMS.Utility.Extension.IEnumerableExtension
  • ToSplitterString< T >() : SinGooCMS.Utility.Extension.IEnumerableExtension
  • ToSqlParams< T >() : SinGooCMS.Utility.AdoUtils
  • ToStream() : SinGooCMS.Utility.Extension.IOExtension
  • ToString() : SinGooCMS.Utility.CNDate , SinGooCMS.Utility.IPAreaInfo , SinGooCMS.Utility.OperationResult
  • TotalPage : SinGooCMS.Utility.PagerModel< T > , SinGooCMS.Utility.PagerUtils
  • TotalRecord : SinGooCMS.Utility.PagerModel< T > , SinGooCMS.Utility.PagerUtils
  • ToTxt() : SinGooCMS.Utility.Extension.StringExtension
  • ToUrlDictionary() : SinGooCMS.Utility.Extension.StringExtension
  • ToUrlSearch() : SinGooCMS.Utility.Extension.StringExtension
  • ToXml< T >() : SinGooCMS.Utility.Extension.XmlserializeExtension
  • TransIntDict() : SinGooCMS.Utility.EnumUtils
  • TransStrDict() : SinGooCMS.Utility.EnumUtils
  • True< T >() : SinGooCMS.Utility.PredicateBuilder
  • TryGet< TProperty >() : SinGooCMS.Utility.GenericAccessor< TInstance >
  • TryGetAttributes< T >() : SinGooCMS.Utility.Extension.TypeExtensions
  • TryGetGenericArguments() : SinGooCMS.Utility.Extension.TypeExtensions
  • TryGetInstanceProperty() : SinGooCMS.Utility.Extension.TypeExtensions
  • TrySet< TProperty >() : SinGooCMS.Utility.GenericAccessor< TInstance >
  • Type : SinGooCMS.Utility.Accessor


SinGooCMS.Utility: 类成员

  • 全部
  • 函数
  • 变量
  • 枚举
  • 属性
  • _
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • j
  • k
  • l
  • m
  • n
  • o
  • p
  • q
  • r
  • s
  • t
  • u
  • w
  • x
  • y
  • z
  • ~
这里列出了所有类成员，并附带类的详细说明:

- u -

  • UnShutdown() : SinGooCMS.Utility.ProcessUtils
  • UnZip() : SinGooCMS.Utility.ZipUtils
  • UpDownRev() : SinGooCMS.Utility.Extension.ImageExtension
  • UpFile() : SinGooCMS.Utility.ShareFileUtils
  • UploadBroken() : SinGooCMS.Utility.FtpClient
  • UploadFile() : SinGooCMS.Utility.FtpClient
  • UrlPattern : SinGooCMS.Utility.PagerUtils
  • Username : SinGooCMS.Utility.FtpClient
  • UserName : SinGooCMS.Utility.ShareFileUtils


SinGooCMS.Utility: 类成员

  • 全部
  • 函数
  • 变量
  • 枚举
  • 属性
  • _
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • j
  • k
  • l
  • m
  • n
  • o
  • p
  • q
  • r
  • s
  • t
  • u
  • w
  • x
  • y
  • z
  • ~
这里列出了所有类成员，并附带类的详细说明:

- w -

  • WeekAtMonth : SinGooCMS.Utility.ChineseCalendar.WeekHolidayStruct
  • WeekDay : SinGooCMS.Utility.ChineseCalendar , SinGooCMS.Utility.ChineseCalendar.WeekHolidayStruct
  • WeekDayHoliday : SinGooCMS.Utility.ChineseCalendar
  • WeekDayStr : SinGooCMS.Utility.ChineseCalendar
  • WeekHolidayStruct() : SinGooCMS.Utility.ChineseCalendar.WeekHolidayStruct
  • WeekOfYear() : SinGooCMS.Utility.Extension.DateTimeExtension
  • wHolidayInfo : SinGooCMS.Utility.ChineseCalendar
  • Write() : SinGooCMS.Utility.CsvUtils
  • Write< T >() : SinGooCMS.Utility.CsvUtils
  • WriteAsync() : SinGooCMS.Utility.CsvUtils
  • WriteAsync< T >() : SinGooCMS.Utility.CsvUtils
  • WriteFileContentAsync() : SinGooCMS.Utility.FileUtils
  • WriteFormatXML() : SinGooCMS.Utility.XmlUtils
  • WriteToFileAsync() : SinGooCMS.Utility.Extension.IOExtension


SinGooCMS.Utility: 类成员

  • 全部
  • 函数
  • 变量
  • 枚举
  • 属性
  • _
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • j
  • k
  • l
  • m
  • n
  • o
  • p
  • q
  • r
  • s
  • t
  • u
  • w
  • x
  • y
  • z
  • ~
这里列出了所有类成员，并附带类的详细说明:

- x -

  • XmlEncode() : SinGooCMS.Utility.XmlUtils
  • XmlToObject< T >() : SinGooCMS.Utility.Extension.XmlserializeExtension
  • XmlUtils() : SinGooCMS.Utility.XmlUtils


SinGooCMS.Utility: 类成员

  • 全部
  • 函数
  • 变量
  • 枚举
  • 属性
  • _
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • j
  • k
  • l
  • m
  • n
  • o
  • p
  • q
  • r
  • s
  • t
  • u
  • w
  • x
  • y
  • z
  • ~
这里列出了所有类成员，并附带类的详细说明:

- y -

  • year19 : SinGooCMS.Utility.ChinaDate
  • year20 : SinGooCMS.Utility.ChinaDate
  • year2000 : SinGooCMS.Utility.ChinaDate


SinGooCMS.Utility: 类成员

  • 全部
  • 函数
  • 变量
  • 枚举
  • 属性
  • _
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • j
  • k
  • l
  • m
  • n
  • o
  • p
  • q
  • r
  • s
  • t
  • u
  • w
  • x
  • y
  • z
  • ~
这里列出了所有类成员，并附带类的详细说明:

- z -

  • Zhi : SinGooCMS.Utility.ChinaDate
  • zhiStr : SinGooCMS.Utility.ChineseCalendar
  • Zip() : SinGooCMS.Utility.ZipUtils


SinGooCMS.Utility: 类成员

  • 全部
  • 函数
  • 变量
  • 枚举
  • 属性
  • _
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • j
  • k
  • l
  • m
  • n
  • o
  • p
  • q
  • r
  • s
  • t
  • u
  • w
  • x
  • y
  • z
  • ~
这里列出了所有类成员，并附带类的详细说明:

- ~ -

  • ~LibInvoker() : SinGooCMS.Utility.LibInvoker


SinGooCMS.Utility: 类成员 - 函数

  • 全部
  • 函数
  • 变量
  • 枚举
  • 属性
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • j
  • k
  • l
  • m
  • o
  • p
  • q
  • r
  • s
  • t
  • u
  • w
  • x
  • z
  • ~

- a -

  • Accessor() : SinGooCMS.Utility.Accessor
  • AddConfigurationProperties() : SinGooCMS.Utility.ConfigUtils
  • AddDefaultDocument() : SinGooCMS.Utility.IISUtils
  • AddHostBinding() : SinGooCMS.Utility.IISUtils
  • AddImageWatermark() : SinGooCMS.Utility.ImageUtils
  • AddMapping() : SinGooCMS.Utility.MimeMapping.MimeMappingDictionaryBase
  • AddOrAppendToQueryString() : SinGooCMS.Utility.Extension.UriExtension
  • AddParametersToQueryString() : SinGooCMS.Utility.Extension.UriExtension
  • AddRange< T >() : SinGooCMS.Utility.Extension.IEnumerableExtension
  • AddRangeIf< T >() : SinGooCMS.Utility.Extension.IEnumerableExtension
  • AddRangeIfNotContains< T >() : SinGooCMS.Utility.Extension.IEnumerableExtension
  • AddTextWatermark() : SinGooCMS.Utility.ImageUtils
  • AddWatermark() : SinGooCMS.Utility.ImageUtils
  • AddWildcardIfNotPresent() : SinGooCMS.Utility.MimeMapping.MimeMappingDictionaryBase
  • AESDecrypt() : SinGooCMS.Utility.DEncryptUtils
  • AESEncrypt() : SinGooCMS.Utility.DEncryptUtils
  • And< T >() : SinGooCMS.Utility.PredicateBuilder
  • AnimalsYear() : SinGooCMS.Utility.ChinaDate
  • AppendNode() : SinGooCMS.Utility.XmlUtils
  • AsDecodeUrl() : SinGooCMS.Utility.Extension.StringExtension
  • AsEncodeUrl() : SinGooCMS.Utility.Extension.StringExtension


SinGooCMS.Utility: 类成员 - 函数

  • 全部
  • 函数
  • 变量
  • 枚举
  • 属性
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • j
  • k
  • l
  • m
  • o
  • p
  • q
  • r
  • s
  • t
  • u
  • w
  • x
  • z
  • ~

- b -

  • BackupFile() : SinGooCMS.Utility.FileUtils
  • Base36Decode() : SinGooCMS.Utility.DEncryptUtils
  • Base36Encode() : SinGooCMS.Utility.DEncryptUtils
  • Base64Decrypt() : SinGooCMS.Utility.DEncryptUtils
  • Base64Encrypt() : SinGooCMS.Utility.DEncryptUtils
  • Base64StrToImage() : SinGooCMS.Utility.ImageUtils
  • BitTest32() : SinGooCMS.Utility.ChineseCalendar
  • BrokenDownload() : SinGooCMS.Utility.FtpClient
  • Build() : SinGooCMS.Utility.Accessor
  • Build< TInstance >() : SinGooCMS.Utility.Accessor
  • BuildGetter() : SinGooCMS.Utility.AccessorBuilder
  • BuildGetter< TInstance >() : SinGooCMS.Utility.AccessorBuilder
  • BuildGetter< TInstance, TProperty >() : SinGooCMS.Utility.AccessorBuilder
  • BuildInstanceCreator< TInstance >() : SinGooCMS.Utility.AccessorBuilder
  • BuildSetter() : SinGooCMS.Utility.AccessorBuilder
  • BuildSetter< TInstance >() : SinGooCMS.Utility.AccessorBuilder
  • BuildSetter< TInstance, TProperty >() : SinGooCMS.Utility.AccessorBuilder


SinGooCMS.Utility: 类成员 - 函数

  • 全部
  • 函数
  • 变量
  • 枚举
  • 属性
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • j
  • k
  • l
  • m
  • o
  • p
  • q
  • r
  • s
  • t
  • u
  • w
  • x
  • z
  • ~

- c -

  • CacheUtils() : SinGooCMS.Utility.CacheUtils
  • Calculate() : SinGooCMS.Utility.PagerUtils
  • calElement() : SinGooCMS.Utility.ChinaDate
  • ChangeColNames() : SinGooCMS.Utility.Extension.DataTableExtension
  • CheckChineseDateLimit() : SinGooCMS.Utility.ChineseCalendar
  • CheckDateLimit() : SinGooCMS.Utility.ChineseCalendar
  • ChineseCalendar() : SinGooCMS.Utility.ChineseCalendar
  • ChkSQL() : SinGooCMS.Utility.StringUtils
  • ClearAll() : SinGooCMS.Utility.CacheUtils
  • ColorFilter() : SinGooCMS.Utility.Extension.ImageExtension
  • Combine() : SinGooCMS.Utility.FileUtils
  • CompareWeekDayHoliday() : SinGooCMS.Utility.ChineseCalendar
  • Compose< T >() : SinGooCMS.Utility.PredicateBuilder
  • Compress() : SinGooCMS.Utility.Extension.ImageExtension , SinGooCMS.Utility.StringUtils
  • CompressHeight() : SinGooCMS.Utility.Extension.ImageExtension
  • CompressRate() : SinGooCMS.Utility.Extension.ImageExtension
  • CompressWidth() : SinGooCMS.Utility.Extension.ImageExtension
  • Connect() : SinGooCMS.Utility.ShareFileUtils
  • ConnectSocket() : SinGooCMS.Utility.SocketClient
  • ConnectStream() : SinGooCMS.Utility.SocketClient
  • ContainKey() : SinGooCMS.Utility.CacheUtils , SinGooCMS.Utility.CookieUtils , SinGooCMS.Utility.SessionUtils
  • ContainsWithSplitter() : SinGooCMS.Utility.Extension.StringExtension
  • ConvertDayOfWeek() : SinGooCMS.Utility.ChineseCalendar
  • ConvertNumToChineseNum() : SinGooCMS.Utility.ChineseCalendar
  • CopyDirectory() : SinGooCMS.Utility.FileUtils
  • CopyFolder() : SinGooCMS.Utility.FileUtils
  • CopyToFileAsync() : SinGooCMS.Utility.Extension.StreamExtension
  • Create() : SinGooCMS.Utility.CaptchaUtils , SinGooCMS.Utility.MailUtils , SinGooCMS.Utility.PagerUtils
  • CreateCheckCodeImage() : SinGooCMS.Utility.CaptchaUtils
  • CreateDirectory() : SinGooCMS.Utility.FileUtils
  • CreateFileAsync() : SinGooCMS.Utility.FileUtils
  • CreateInstance() : SinGooCMS.Utility.ReflectionUtils
  • CreateInstance< T >() : SinGooCMS.Utility.ReflectionUtils
  • CreateRootElement() : SinGooCMS.Utility.XmlUtils
  • CreateSite() : SinGooCMS.Utility.IISUtils
  • CreateVDir() : SinGooCMS.Utility.IISUtils
  • CreateXmlDocument() : SinGooCMS.Utility.XmlUtils
  • CreateXMLElement() : SinGooCMS.Utility.XmlUtils
  • Cut() : SinGooCMS.Utility.StringUtils
  • CutAndResize() : SinGooCMS.Utility.Extension.ImageExtension
  • CutImage() : SinGooCMS.Utility.Extension.ImageExtension
  • cyclical() : SinGooCMS.Utility.ChinaDate
  • cyclicalm() : SinGooCMS.Utility.ChinaDate


SinGooCMS.Utility: 类成员 - 函数

  • 全部
  • 函数
  • 变量
  • 枚举
  • 属性
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • j
  • k
  • l
  • m
  • o
  • p
  • q
  • r
  • s
  • t
  • u
  • w
  • x
  • z
  • ~

- d -

  • DateDiff() : SinGooCMS.Utility.Extension.DateTimeExtension
  • Decode() : SinGooCMS.Utility.UnicodeUtils
  • DeepClone< T >() : SinGooCMS.Utility.Extension.ObjectExtension
  • Del() : SinGooCMS.Utility.CacheUtils
  • DelByPattern() : SinGooCMS.Utility.CacheUtils
  • Delete() : SinGooCMS.Utility.FtpClient
  • DeleteDefaultDocument() : SinGooCMS.Utility.IISUtils
  • DeleteDirectory() : SinGooCMS.Utility.FileUtils
  • DeleteHostBinding() : SinGooCMS.Utility.IISUtils
  • DeletePool() : SinGooCMS.Utility.IISUtils
  • DeleteRunValue() : SinGooCMS.Utility.RegistryUtils
  • DeleteService() : SinGooCMS.Utility.ProcessUtils
  • DeleteSite() : SinGooCMS.Utility.IISUtils
  • DeleteValue() : SinGooCMS.Utility.RegistryUtils
  • DeleteVDir() : SinGooCMS.Utility.IISUtils
  • DelSession() : SinGooCMS.Utility.SessionUtils
  • DESDecrypt() : SinGooCMS.Utility.DEncryptUtils
  • DESEncrypt() : SinGooCMS.Utility.DEncryptUtils
  • DirectoryExist() : SinGooCMS.Utility.FtpClient
  • Disconnect() : SinGooCMS.Utility.ShareFileUtils
  • DisconnectAll() : SinGooCMS.Utility.ShareFileUtils
  • DisplayExtAttribute() : SinGooCMS.Utility.Extension.DisplayExtAttribute
  • DistinctBy< TSource, TKey >() : SinGooCMS.Utility.Extension.IEnumerableExtension
  • DownFile() : SinGooCMS.Utility.ShareFileUtils
  • Download() : SinGooCMS.Utility.FtpClient , SinGooCMS.Utility.NetWorkUtils


SinGooCMS.Utility: 类成员 - 函数

  • 全部
  • 函数
  • 变量
  • 枚举
  • 属性
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • j
  • k
  • l
  • m
  • o
  • p
  • q
  • r
  • s
  • t
  • u
  • w
  • x
  • z
  • ~

- e -

  • Encode() : SinGooCMS.Utility.UnicodeUtils
  • EnsureMapping() : SinGooCMS.Utility.MimeMapping.MimeMappingDictionaryBase
  • EnumToList< T >() : SinGooCMS.Utility.EnumUtils
  • Execute() : SinGooCMS.Utility.ProcessUtils , SinGooCMS.Utility.StopwatchUtils
  • ExecuteCMD() : SinGooCMS.Utility.ProcessUtils
  • ExistsRow() : SinGooCMS.Utility.Extension.DataTableExtension


SinGooCMS.Utility: 类成员 - 函数

  • 全部
  • 函数
  • 变量
  • 枚举
  • 属性
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • j
  • k
  • l
  • m
  • o
  • p
  • q
  • r
  • s
  • t
  • u
  • w
  • x
  • z
  • ~

- f -

  • Fail() : SinGooCMS.Utility.OperationResult
  • False< T >() : SinGooCMS.Utility.PredicateBuilder
  • FileExist() : SinGooCMS.Utility.FtpClient
  • FindRow() : SinGooCMS.Utility.Extension.DataTableExtension
  • ForEach< T >() : SinGooCMS.Utility.Extension.IEnumerableExtension
  • ForEachAsync< T >() : SinGooCMS.Utility.Extension.IEnumerableExtension
  • ForEachInOrder() : SinGooCMS.Utility.Extension.TaskExtensions
  • ForEachInOrder< T >() : SinGooCMS.Utility.Extension.TaskExtensions
  • FormatDate() : SinGooCMS.Utility.ChinaDate
  • FormatMessage() : SinGooCMS.Utility.ExceptionUtils
  • FormatXML() : SinGooCMS.Utility.XmlUtils
  • FreeLibrary() : SinGooCMS.Utility.LibInvoker
  • FriendlyDate() : SinGooCMS.Utility.Extension.DateTimeExtension
  • FromHex() : SinGooCMS.Utility.HexUtils


SinGooCMS.Utility: 类成员 - 函数

  • 全部
  • 函数
  • 变量
  • 枚举
  • 属性
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • j
  • k
  • l
  • m
  • o
  • p
  • q
  • r
  • s
  • t
  • u
  • w
  • x
  • z
  • ~

- g -

  • GenerateCheckCode() : SinGooCMS.Utility.CaptchaUtils
  • GenerateFtpReq() : SinGooCMS.Utility.FtpClient
  • GenerateSN() : SinGooCMS.Utility.StringUtils
  • GenerateUri() : SinGooCMS.Utility.StringUtils
  • Get< T >() : SinGooCMS.Utility.CacheUtils
  • GetAbsoluteUri() : SinGooCMS.Utility.WebUtils
  • GetAesKey() : SinGooCMS.Utility.DEncryptUtils
  • GetAllFiles() : SinGooCMS.Utility.FileUtils
  • GetAllKeys() : SinGooCMS.Utility.CacheUtils
  • GetAnonymousClient() : SinGooCMS.Utility.FtpClient
  • GetAppSetting< T >() : SinGooCMS.Utility.ConfigUtils
  • GetAppSettingInternal< T >() : SinGooCMS.Utility.ConfigUtils
  • GetAssemblyCodeBase() : SinGooCMS.Utility.Extension.AssemblyExtension
  • GetAssemblyLocation() : SinGooCMS.Utility.Extension.AssemblyExtension
  • GetAttributeToPropertyMapping< T >() : SinGooCMS.Utility.Extension.TypeExtensions
  • GetAttributeValue() : SinGooCMS.Utility.XmlUtils
  • GetAwaiter() : SinGooCMS.Utility.Extension.TaskExtensions
  • GetAwaiter< T >() : SinGooCMS.Utility.Extension.TaskExtensions
  • GetCatePrefix() : SinGooCMS.Utility.StringUtils
  • GetCellValue() : SinGooCMS.Utility.NPOIUtils
  • getChinaDate() : SinGooCMS.Utility.ChinaDate
  • GetChinaDate() : SinGooCMS.Utility.ChinaDate
  • GetChineseHour() : SinGooCMS.Utility.ChineseCalendar
  • GetChineseLeapMonth() : SinGooCMS.Utility.ChineseCalendar
  • GetChineseLeapMonthDays() : SinGooCMS.Utility.ChineseCalendar
  • GetChineseMonthDays() : SinGooCMS.Utility.ChineseCalendar
  • GetChineseSpell() : SinGooCMS.Utility.StringUtils
  • GetChineseSpellFirst() : SinGooCMS.Utility.StringUtils
  • GetChineseYearDays() : SinGooCMS.Utility.ChineseCalendar
  • GetClassFullName() : SinGooCMS.Utility.Extension.TypeExtensions
  • GetClient() : SinGooCMS.Utility.FtpClient
  • GetCNHour() : SinGooCMS.Utility.Extension.DateTimeExtension
  • GetConnectionString() : SinGooCMS.Utility.ConfigUtils
  • GetContentType() : SinGooCMS.Utility.FileUtils
  • GetCookie() : SinGooCMS.Utility.CookieUtils
  • GetCountry() : SinGooCMS.Utility.IPScanner
  • GetDateDiff() : SinGooCMS.Utility.TimeUtils
  • GetDaysByMonth() : SinGooCMS.Utility.ChinaDate
  • GetDefault() : SinGooCMS.Utility.Extension.TypeExtensions
  • GetDescription() : SinGooCMS.Utility.EnumUtils , SinGooCMS.Utility.Extension.EnumExtension
  • GetDir() : SinGooCMS.Utility.ShareFileUtils
  • GetDirectories() : SinGooCMS.Utility.FtpClient
  • GetDirectoryLength() : SinGooCMS.Utility.FileUtils
  • GetDTFromUnixTime() : SinGooCMS.Utility.DatetimeUtils
  • GetEndIp() : SinGooCMS.Utility.IPScanner
  • GetEnumCollectionDescription< T >() : SinGooCMS.Utility.EnumUtils
  • GetEnumDescription() : SinGooCMS.Utility.EnumUtils
  • GetEnumDescription< T >() : SinGooCMS.Utility.EnumUtils
  • GetEnumDescriptions< T >() : SinGooCMS.Utility.EnumUtils
  • GetField() : SinGooCMS.Utility.Extension.ReflectExtension
  • GetFields() : SinGooCMS.Utility.Extension.ReflectExtension
  • GetFieldVal< T >() : SinGooCMS.Utility.Extension.ReflectExtension
  • GetFile() : SinGooCMS.Utility.ShareFileUtils
  • GetFileMD5() : SinGooCMS.Utility.Extension.IOExtension
  • GetFileName() : SinGooCMS.Utility.MimeMapping.MimeMappingDictionaryBase
  • GetFiles() : SinGooCMS.Utility.FtpClient
  • GetFilesDetails() : SinGooCMS.Utility.FtpClient
  • GetFileSha1() : SinGooCMS.Utility.Extension.IOExtension
  • GetFileSize() : SinGooCMS.Utility.FileUtils , SinGooCMS.Utility.FtpClient
  • GetFlagStr() : SinGooCMS.Utility.IPScanner
  • GetFormBool() : SinGooCMS.Utility.WebUtils
  • GetFormDatetime() : SinGooCMS.Utility.WebUtils
  • GetFormDecimal() : SinGooCMS.Utility.WebUtils
  • GetFormDouble() : SinGooCMS.Utility.WebUtils
  • GetFormFloat() : SinGooCMS.Utility.WebUtils
  • GetFormInt() : SinGooCMS.Utility.WebUtils
  • GetFormString() : SinGooCMS.Utility.WebUtils
  • GetFormVal< T >() : SinGooCMS.Utility.WebUtils
  • GetFormVals< T >() : SinGooCMS.Utility.WebUtils
  • GetFQDN() : SinGooCMS.Utility.NetWorkUtils
  • GetFrames() : SinGooCMS.Utility.Extension.ImageExtension
  • GetFrameworkVersion() : SinGooCMS.Utility.Extension.AssemblyExtension
  • GetGUID() : SinGooCMS.Utility.StringUtils
  • GetHash() : SinGooCMS.Utility.RSACryption
  • GetImageResource() : SinGooCMS.Utility.Extension.ReflectExtension
  • GetInstanceProperties() : SinGooCMS.Utility.Extension.TypeExtensions
  • GetIP() : SinGooCMS.Utility.IPUtils
  • GetIPAreaStr() : SinGooCMS.Utility.IPUtils
  • GetItemValue() : SinGooCMS.Utility.XmlUtils
  • GetKey() : SinGooCMS.Utility.EntityAttrUtils
  • GetKey< TKey, TValue >() : SinGooCMS.Utility.Extension.DictionaryExtension
  • GetKeyValue< TEntity >() : SinGooCMS.Utility.EntityAttrUtils
  • GetManifestString() : SinGooCMS.Utility.Extension.ReflectExtension
  • GetMaxLength() : SinGooCMS.Utility.EntityAttrUtils
  • GetMimeMapping() : SinGooCMS.Utility.MimeMapping.MimeMappingDictionaryBase
  • GetMinLength() : SinGooCMS.Utility.EntityAttrUtils
  • GetMonday() : SinGooCMS.Utility.Extension.DateTimeExtension
  • GetMondayDateByDate() : SinGooCMS.Utility.ChinaDate
  • GetMonthFirstDay() : SinGooCMS.Utility.Extension.DateTimeExtension
  • GetMonthLastDay() : SinGooCMS.Utility.Extension.DateTimeExtension
  • GetNewFileName() : SinGooCMS.Utility.StringUtils
  • GetNode() : SinGooCMS.Utility.XmlUtils
  • GetOrderExpression() : SinGooCMS.Utility.Extension.LinqExtension
  • GetPacketLength() : SinGooCMS.Utility.SocketClient
  • GetPages() : SinGooCMS.Utility.PagerUtils
  • GetPageUrl() : SinGooCMS.Utility.PagerUtils
  • GetParents() : SinGooCMS.Utility.Extension.TypeExtensions
  • GetPath() : SinGooCMS.Utility.SocketClient
  • GetProcAddress() : SinGooCMS.Utility.LibInvoker
  • GetPropertiesWithAttribute< T >() : SinGooCMS.Utility.Extension.TypeExtensions
  • GetProperty() : SinGooCMS.Utility.Extension.ReflectExtension
  • GetProperty< TEntity >() : SinGooCMS.Utility.EntityAttrUtils
  • GetPropertyInfo() : SinGooCMS.Utility.Extension.LinqExtension
  • GetPropertyVal< T >() : SinGooCMS.Utility.Extension.ReflectExtension
  • GetQuarterFirstDay() : SinGooCMS.Utility.Extension.DateTimeExtension
  • GetQuarterLastDay() : SinGooCMS.Utility.Extension.DateTimeExtension
  • GetQueryBool() : SinGooCMS.Utility.WebUtils
  • GetQueryDatetime() : SinGooCMS.Utility.WebUtils
  • GetQueryDecimal() : SinGooCMS.Utility.WebUtils
  • GetQueryDouble() : SinGooCMS.Utility.WebUtils
  • GetQueryFloat() : SinGooCMS.Utility.WebUtils
  • GetQueryInt() : SinGooCMS.Utility.WebUtils
  • GetQueryLong() : SinGooCMS.Utility.WebUtils
  • GetQueryString() : SinGooCMS.Utility.WebUtils
  • GetQueryVal< T >() : SinGooCMS.Utility.WebUtils
  • GetQueryVals< T >() : SinGooCMS.Utility.WebUtils
  • GetRandomNumber() : SinGooCMS.Utility.StringUtils
  • GetRandomString() : SinGooCMS.Utility.StringUtils
  • GetResString() : SinGooCMS.Utility.Extension.ReflectExtension
  • GetRunValue() : SinGooCMS.Utility.RegistryUtils
  • GetSafeValue< Tkey, Tvalue >() : SinGooCMS.Utility.Extension.DataTypeChangeExtension
  • GetSendPacketLengthStr() : SinGooCMS.Utility.SocketClient
  • GetSession< T >() : SinGooCMS.Utility.SessionUtils
  • GetShortDate() : SinGooCMS.Utility.Extension.DateTimeExtension
  • GetSimplified() : SinGooCMS.Utility.StringUtils
  • GetSiteInfo() : SinGooCMS.Utility.IISUtils
  • GetSiteList() : SinGooCMS.Utility.IISUtils
  • GetSpaceChar() : SinGooCMS.Utility.StringUtils
  • GetStartIp() : SinGooCMS.Utility.IPScanner
  • GetStr() : SinGooCMS.Utility.IPScanner
  • GetStrFromHex() : SinGooCMS.Utility.HexUtils
  • GetStringLength() : SinGooCMS.Utility.StringUtils
  • GetSunday() : SinGooCMS.Utility.Extension.DateTimeExtension
  • GetTableName() : SinGooCMS.Utility.EntityAttrUtils
  • GetTimeSpan() : SinGooCMS.Utility.TimeUtils
  • GetTotalDays() : SinGooCMS.Utility.Extension.DateTimeExtension
  • GetTotalHours() : SinGooCMS.Utility.Extension.DateTimeExtension
  • GetTotalMicroseconds() : SinGooCMS.Utility.Extension.DateTimeExtension
  • GetTotalMinutes() : SinGooCMS.Utility.Extension.DateTimeExtension
  • GetTotalNanoseconds() : SinGooCMS.Utility.Extension.DateTimeExtension
  • GetTraditional() : SinGooCMS.Utility.StringUtils
  • GetType() : SinGooCMS.Utility.ReflectionUtils
  • GetTypeCode() : SinGooCMS.Utility.Extension.TypeExtensions
  • GetUnixTime() : SinGooCMS.Utility.DatetimeUtils
  • GetUnixTimeMilliseconds() : SinGooCMS.Utility.Extension.DateTimeExtension
  • GetUnixTimeSeconds() : SinGooCMS.Utility.Extension.DateTimeExtension
  • GetUrl() : SinGooCMS.Utility.PagerUtils
  • GetUrlPathPart() : SinGooCMS.Utility.WebUtils
  • GetValue() : SinGooCMS.Utility.RegistryUtils , SinGooCMS.Utility.XmlUtils
  • GetValue< TKey, TValue >() : SinGooCMS.Utility.Extension.DictionaryExtension
  • GetWeekFirstDay() : SinGooCMS.Utility.Extension.DateTimeExtension
  • GetWeekLastDay() : SinGooCMS.Utility.Extension.DateTimeExtension
  • GetXORCode() : SinGooCMS.Utility.DEncryptUtils
  • GetYearFirstDay() : SinGooCMS.Utility.Extension.DateTimeExtension
  • GetYearLastDay() : SinGooCMS.Utility.Extension.DateTimeExtension


SinGooCMS.Utility: 类成员 - 函数

  • 全部
  • 函数
  • 变量
  • 枚举
  • 属性
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • j
  • k
  • l
  • m
  • o
  • p
  • q
  • r
  • s
  • t
  • u
  • w
  • x
  • z
  • ~

- h -

  • HandleException< T >() : SinGooCMS.Utility.Extension.TaskExtensions
  • HandleExceptions() : SinGooCMS.Utility.Extension.TaskExtensions
  • HasDefaultConstructor() : SinGooCMS.Utility.Extension.TypeExtensions
  • HashFile() : SinGooCMS.Utility.Extension.IOExtension
  • HttpGet() : SinGooCMS.Utility.NetWorkUtils
  • HttpPost() : SinGooCMS.Utility.NetWorkUtils


SinGooCMS.Utility: 类成员 - 函数

  • 全部
  • 函数
  • 变量
  • 枚举
  • 属性
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • j
  • k
  • l
  • m
  • o
  • p
  • q
  • r
  • s
  • t
  • u
  • w
  • x
  • z
  • ~

- i -

  • IdCardUtils() : SinGooCMS.Utility.IdCardUtils
  • ImageToBase64() : SinGooCMS.Utility.ImageUtils
  • Init() : SinGooCMS.Utility.VideoUtils
  • Insert< T >() : SinGooCMS.Utility.CacheUtils
  • InsertAfter< T >() : SinGooCMS.Utility.Extension.IEnumerableExtension
  • IntToIP() : SinGooCMS.Utility.IPScanner
  • Invoke() : SinGooCMS.Utility.LibInvoker
  • InvokeMethod() : SinGooCMS.Utility.Extension.ReflectExtension
  • IP2IntArr() : SinGooCMS.Utility.IPUtils
  • IPLocation() : SinGooCMS.Utility.IPScanner
  • IPScanner() : SinGooCMS.Utility.IPScanner
  • IpToInt() : SinGooCMS.Utility.IPScanner
  • Is32Bit() : SinGooCMS.Utility.Extension.AssemblyExtension
  • IsArrayOf< T >() : SinGooCMS.Utility.Extension.TypeExtensions
  • IsBase64Formatted() : SinGooCMS.Utility.Base64FileUtils
  • IsBetween() : SinGooCMS.Utility.Extension.ValidateExtension
  • IsChineseIP() : SinGooCMS.Utility.IPScanner
  • IsConnected() : SinGooCMS.Utility.AdoUtils
  • IsDate() : SinGooCMS.Utility.Extension.ValidateExtension
  • IsDecimal() : SinGooCMS.Utility.Extension.ValidateExtension
  • IsEmail() : SinGooCMS.Utility.Extension.ValidateExtension
  • IsEn() : SinGooCMS.Utility.Extension.ValidateExtension
  • IsFax() : SinGooCMS.Utility.Extension.ValidateExtension
  • IsGenericList() : SinGooCMS.Utility.Extension.TypeExtensions
  • IsGuid() : SinGooCMS.Utility.Extension.ValidateExtension
  • IsIDCard() : SinGooCMS.Utility.Extension.ValidateExtension
  • IsImage() : SinGooCMS.Utility.Extension.ValidateExtension
  • IsImplements< T >() : SinGooCMS.Utility.Extension.TypeExtensions
  • IsInIPDuan() : SinGooCMS.Utility.IPUtils
  • IsInt() : SinGooCMS.Utility.Extension.ValidateExtension
  • IsIP() : SinGooCMS.Utility.Extension.ValidateExtension
  • IsJson() : SinGooCMS.Utility.Extension.ValidateExtension
  • IsKey() : SinGooCMS.Utility.EntityAttrUtils
  • IsMatch() : SinGooCMS.Utility.Extension.ValidateExtension
  • IsMobile() : SinGooCMS.Utility.Extension.ValidateExtension
  • IsNoInt() : SinGooCMS.Utility.Extension.ValidateExtension
  • IsNotMapped() : SinGooCMS.Utility.EntityAttrUtils
  • IsNotNullOrEmpty() : SinGooCMS.Utility.Extension.ValidateExtension
  • IsNullable() : SinGooCMS.Utility.Extension.TypeExtensions
  • IsNullOrEmpty() : SinGooCMS.Utility.Extension.ValidateExtension
  • IsNullOrWhiteSpace() : SinGooCMS.Utility.Extension.ValidateExtension
  • IsNumeric() : SinGooCMS.Utility.Extension.TypeExtensions
  • IsOptimized() : SinGooCMS.Utility.Extension.AssemblyExtension
  • IsSequence() : SinGooCMS.Utility.Extension.TypeExtensions
  • IsSimpleType() : SinGooCMS.Utility.Extension.TypeExtensions
  • IsTelephone() : SinGooCMS.Utility.Extension.ValidateExtension
  • IsUrl() : SinGooCMS.Utility.Extension.ValidateExtension
  • IsZHCN() : SinGooCMS.Utility.Extension.ValidateExtension


SinGooCMS.Utility: 类成员 - 函数

  • 全部
  • 函数
  • 变量
  • 枚举
  • 属性
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • j
  • k
  • l
  • m
  • o
  • p
  • q
  • r
  • s
  • t
  • u
  • w
  • x
  • z
  • ~

- j -

  • JoinSplitter() : SinGooCMS.Utility.Extension.StringExtension
  • JsonToAnonymousObject< T >() : SinGooCMS.Utility.Extension.JsonserializeExtension
  • JsonToObject< T >() : SinGooCMS.Utility.Extension.JsonserializeExtension


SinGooCMS.Utility: 类成员 - 函数

  • 全部
  • 函数
  • 变量
  • 枚举
  • 属性
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • j
  • k
  • l
  • m
  • o
  • p
  • q
  • r
  • s
  • t
  • u
  • w
  • x
  • z
  • ~

- k -

  • Kill() : SinGooCMS.Utility.ProcessUtils
  • KillCurrent() : SinGooCMS.Utility.ProcessUtils


SinGooCMS.Utility: 类成员 - 函数

  • 全部
  • 函数
  • 变量
  • 枚举
  • 属性
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • j
  • k
  • l
  • m
  • o
  • p
  • q
  • r
  • s
  • t
  • u
  • w
  • x
  • z
  • ~

- l -

  • LDPic() : SinGooCMS.Utility.Extension.ImageExtension
  • leapDays() : SinGooCMS.Utility.ChinaDate
  • leapMonth() : SinGooCMS.Utility.ChinaDate
  • LeftRightRev() : SinGooCMS.Utility.Extension.ImageExtension
  • LibInvoker() : SinGooCMS.Utility.LibInvoker
  • ListenerSocket() : SinGooCMS.Utility.SocketClient
  • ListenerStream() : SinGooCMS.Utility.SocketClient
  • Load() : SinGooCMS.Utility.ReflectionUtils
  • LoadBitmap() : SinGooCMS.Utility.Extension.ReflectExtension
  • LoadLibrary() : SinGooCMS.Utility.LibInvoker
  • Lunar() : SinGooCMS.Utility.ChinaDate
  • LunarHolidayStruct() : SinGooCMS.Utility.ChineseCalendar.LunarHolidayStruct
  • lYearDays() : SinGooCMS.Utility.ChinaDate


SinGooCMS.Utility: 类成员 - 函数

  • 全部
  • 函数
  • 变量
  • 枚举
  • 属性
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • j
  • k
  • l
  • m
  • o
  • p
  • q
  • r
  • s
  • t
  • u
  • w
  • x
  • z
  • ~

- m -

  • MakeDir() : SinGooCMS.Utility.FtpClient
  • MakeThumbnail() : SinGooCMS.Utility.ImageUtils
  • MapTo< TSource, TDestination >() : SinGooCMS.Utility.Extension.ObjectExtension
  • MapToList< TSource, TDestination >() : SinGooCMS.Utility.Extension.ObjectExtension
  • Mask() : SinGooCMS.Utility.Extension.StringExtension
  • MD5Encrypt() : SinGooCMS.Utility.DEncryptUtils
  • monthDays() : SinGooCMS.Utility.ChinaDate
  • Mosaic() : SinGooCMS.Utility.Extension.ImageExtension
  • MoveFile() : SinGooCMS.Utility.FtpClient


SinGooCMS.Utility: 类成员 - 函数

  • 全部
  • 函数
  • 变量
  • 枚举
  • 属性
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • j
  • k
  • l
  • m
  • o
  • p
  • q
  • r
  • s
  • t
  • u
  • w
  • x
  • z
  • ~

- o -

  • OperationResult() : SinGooCMS.Utility.OperationResult
  • Or< T >() : SinGooCMS.Utility.PredicateBuilder
  • OrderByBatch< T >() : SinGooCMS.Utility.Extension.LinqExtension


SinGooCMS.Utility: 类成员 - 函数

  • 全部
  • 函数
  • 变量
  • 枚举
  • 属性
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • j
  • k
  • l
  • m
  • o
  • p
  • q
  • r
  • s
  • t
  • u
  • w
  • x
  • z
  • ~

- p -

  • Page< T >() : SinGooCMS.Utility.QueryExtension
  • PageModel< T >() : SinGooCMS.Utility.QueryExtension
  • Parse() : SinGooCMS.Utility.IdCardUtils
  • parseAge() : SinGooCMS.Utility.IdCardUtils
  • parseBrithday() : SinGooCMS.Utility.IdCardUtils
  • ParseQueryString() : SinGooCMS.Utility.Extension.UriExtension
  • parseSex() : SinGooCMS.Utility.IdCardUtils
  • Ping() : SinGooCMS.Utility.NetWorkUtils
  • PoolsStart() : SinGooCMS.Utility.IISUtils
  • PoolsStop() : SinGooCMS.Utility.IISUtils
  • PopulateMappings() : SinGooCMS.Utility.MimeMapping.MimeMappingDictionaryBase , SinGooCMS.Utility.MimeMapping.MimeMappingDictionaryClassic


SinGooCMS.Utility: 类成员 - 函数

  • 全部
  • 函数
  • 变量
  • 枚举
  • 属性
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • j
  • k
  • l
  • m
  • o
  • p
  • q
  • r
  • s
  • t
  • u
  • w
  • x
  • z
  • ~

- q -

  • QQwry() : SinGooCMS.Utility.IPScanner


SinGooCMS.Utility: 类成员 - 函数

  • 全部
  • 函数
  • 变量
  • 枚举
  • 属性
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • j
  • k
  • l
  • m
  • o
  • p
  • q
  • r
  • s
  • t
  • u
  • w
  • x
  • z
  • ~

- r -

  • RandomArray< T >() : SinGooCMS.Utility.Extension.IEnumerableExtension
  • RandomTake< T >() : SinGooCMS.Utility.Extension.IEnumerableExtension
  • Read() : SinGooCMS.Utility.CsvUtils , SinGooCMS.Utility.NPOIUtils
  • Read< T >() : SinGooCMS.Utility.CsvUtils , SinGooCMS.Utility.JsonFileUtils
  • ReadCell() : SinGooCMS.Utility.NPOIUtils
  • ReadFileBitmap() : SinGooCMS.Utility.ImageUtils
  • ReadFileContentAsync() : SinGooCMS.Utility.FileUtils
  • ReadFileToBytes() : SinGooCMS.Utility.FileUtils
  • ReadFileToImage() : SinGooCMS.Utility.ImageUtils
  • ReadFileToStream() : SinGooCMS.Utility.FileUtils
  • ReadFileToString() : SinGooCMS.Utility.Base64FileUtils
  • ReadList< T >() : SinGooCMS.Utility.JsonFileUtils
  • ReadSheet() : SinGooCMS.Utility.NPOIUtils
  • ReceiveFile() : SinGooCMS.Utility.SocketClient
  • ReceiveFixData() : SinGooCMS.Utility.SocketClient
  • ReceiveVarData() : SinGooCMS.Utility.SocketClient
  • ReceiveVarData< T >() : SinGooCMS.Utility.SocketClient
  • ReferenceEquals() : SinGooCMS.Utility.Extension.ObjectExtension
  • Relief() : SinGooCMS.Utility.Extension.ImageExtension
  • RemoveCookie() : SinGooCMS.Utility.CookieUtils
  • RemoveDirectory() : SinGooCMS.Utility.FtpClient
  • RemoveEmptyRow() : SinGooCMS.Utility.Extension.DataTableExtension
  • RemoveHtml() : SinGooCMS.Utility.Extension.StringExtension
  • RemoveNode() : SinGooCMS.Utility.XmlUtils
  • RemoveSpaces() : SinGooCMS.Utility.FtpClient
  • RemoveWhere< T >() : SinGooCMS.Utility.Extension.IEnumerableExtension
  • RemoveWhiteSpace() : SinGooCMS.Utility.Extension.StringExtension
  • Rename() : SinGooCMS.Utility.FtpClient
  • ReNameFile() : SinGooCMS.Utility.FileUtils
  • RePic() : SinGooCMS.Utility.Extension.ImageExtension
  • ResizeImage() : SinGooCMS.Utility.Extension.ImageExtension
  • RestoreFile() : SinGooCMS.Utility.FileUtils
  • RSADecrypt() : SinGooCMS.Utility.RSACryption
  • RSAEncrypt() : SinGooCMS.Utility.RSACryption
  • RSAKey() : SinGooCMS.Utility.RSACryption


SinGooCMS.Utility: 类成员 - 函数

  • 全部
  • 函数
  • 变量
  • 枚举
  • 属性
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • j
  • k
  • l
  • m
  • o
  • p
  • q
  • r
  • s
  • t
  • u
  • w
  • x
  • z
  • ~

- s -

  • Save() : SinGooCMS.Utility.NPOIUtils , SinGooCMS.Utility.VideoUtils , SinGooCMS.Utility.XmlUtils
  • Save< T >() : SinGooCMS.Utility.JsonFileUtils
  • SaveAsMemoryStream() : SinGooCMS.Utility.Extension.StreamExtension
  • SaveFile() : SinGooCMS.Utility.Extension.StreamExtension
  • SaveFileAsync() : SinGooCMS.Utility.Extension.IOExtension
  • SaveStringToFile() : SinGooCMS.Utility.Base64FileUtils
  • SaveStringToFileAsync() : SinGooCMS.Utility.Base64FileUtils
  • SaveToCsv() : SinGooCMS.Utility.Extension.DataTableExtension
  • SaveToCsv< T >() : SinGooCMS.Utility.Extension.DataTableExtension
  • SaveToCsvAsync() : SinGooCMS.Utility.Extension.DataTableExtension
  • SaveToCsvAsync< T >() : SinGooCMS.Utility.Extension.DataTableExtension
  • SaveToExcel() : SinGooCMS.Utility.Extension.DataTableExtension
  • SaveWithTmpl() : SinGooCMS.Utility.NPOIUtils
  • SelectNode() : SinGooCMS.Utility.XmlUtils
  • SendEmail() : SinGooCMS.Utility.MailUtils
  • SendEmailAsync() : SinGooCMS.Utility.MailUtils
  • SendFile() : SinGooCMS.Utility.SocketClient
  • SendFixData() : SinGooCMS.Utility.SocketClient
  • SendSerializeObject< T >() : SinGooCMS.Utility.SocketClient
  • SendVarData() : SinGooCMS.Utility.SocketClient
  • SerializeObject() : SinGooCMS.Utility.SocketClient
  • SetAttributeValue() : SinGooCMS.Utility.XmlUtils
  • SetCookie() : SinGooCMS.Utility.CookieUtils
  • SetFieldVal() : SinGooCMS.Utility.Extension.ReflectExtension
  • SetItemValue() : SinGooCMS.Utility.XmlUtils
  • SetPropertyVal() : SinGooCMS.Utility.Extension.ReflectExtension
  • SetRunValue() : SinGooCMS.Utility.RegistryUtils
  • SetSession() : SinGooCMS.Utility.SessionUtils
  • SetSession< T >() : SinGooCMS.Utility.SessionUtils
  • SetValue() : SinGooCMS.Utility.RegistryUtils
  • SHA512Encrypt() : SinGooCMS.Utility.DEncryptUtils
  • ShowConnect() : SinGooCMS.Utility.ShareFileUtils
  • Shutdown() : SinGooCMS.Utility.ProcessUtils
  • SignatureDeformatter() : SinGooCMS.Utility.RSACryption
  • SignatureFormatter() : SinGooCMS.Utility.RSACryption
  • SolarHolidayStruct() : SinGooCMS.Utility.ChineseCalendar.SolarHolidayStruct
  • SortByKey< TKey, TValue >() : SinGooCMS.Utility.Extension.DictionaryExtension
  • Split() : SinGooCMS.Utility.StringUtils
  • Start() : SinGooCMS.Utility.IISUtils
  • StartService() : SinGooCMS.Utility.ProcessUtils
  • sTerm() : SinGooCMS.Utility.ChinaDate
  • Stop() : SinGooCMS.Utility.IISUtils
  • StopService() : SinGooCMS.Utility.ProcessUtils
  • StringToEnum() : SinGooCMS.Utility.EnumUtils
  • StringToEnum< T >() : SinGooCMS.Utility.EnumUtils
  • StringToEnumOrNull< T >() : SinGooCMS.Utility.EnumUtils
  • Success() : SinGooCMS.Utility.OperationResult


SinGooCMS.Utility: 类成员 - 函数

  • 全部
  • 函数
  • 变量
  • 枚举
  • 属性
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • j
  • k
  • l
  • m
  • o
  • p
  • q
  • r
  • s
  • t
  • u
  • w
  • x
  • z
  • ~

- t -

  • ThumbnailImage() : SinGooCMS.Utility.Extension.ImageExtension
  • TimeoutAfter() : SinGooCMS.Utility.Extension.TaskExtensions
  • TimeoutAfter< T >() : SinGooCMS.Utility.Extension.TaskExtensions
  • TimeoutAfterImpl() : SinGooCMS.Utility.Extension.TaskExtensions
  • To< T >() : SinGooCMS.Utility.Extension.IConvertibleExtension
  • ToArray() : SinGooCMS.Utility.Extension.StreamExtension
  • ToArrayList() : SinGooCMS.Utility.Extension.DataTableExtension
  • ToBase64() : SinGooCMS.Utility.Extension.ImageExtension
  • ToBase64String() : SinGooCMS.Utility.Extension.IOExtension
  • ToBool() : SinGooCMS.Utility.Extension.DataTypeChangeExtension
  • ToBWPic() : SinGooCMS.Utility.Extension.ImageExtension
  • ToByte() : SinGooCMS.Utility.Extension.DataTypeChangeExtension
  • ToBytes() : SinGooCMS.Utility.Extension.IOExtension
  • ToCsharpType() : SinGooCMS.Utility.Extension.DataTypeChangeExtension
  • ToDataTable< T >() : SinGooCMS.Utility.Extension.IEnumerableExtension
  • ToDateTime() : SinGooCMS.Utility.Extension.DataTypeChangeExtension
  • ToDecimal() : SinGooCMS.Utility.Extension.DataTypeChangeExtension
  • ToDistinctTable() : SinGooCMS.Utility.Extension.DataTableExtension
  • ToDouble() : SinGooCMS.Utility.Extension.DataTypeChangeExtension
  • ToEntity< T >() : SinGooCMS.Utility.Extension.DataTableExtension
  • ToEnum< T >() : SinGooCMS.Utility.Extension.EnumExtension
  • ToEnumerable< T >() : SinGooCMS.Utility.Extension.DataTableExtension
  • ToFloat() : SinGooCMS.Utility.Extension.DataTypeChangeExtension
  • ToFormatDate() : SinGooCMS.Utility.Extension.DateTimeExtension
  • ToFormatDateString() : SinGooCMS.Utility.Extension.DateTimeExtension
  • ToFormatString() : SinGooCMS.Utility.Extension.DateTimeExtension
  • ToFormatStringFull() : SinGooCMS.Utility.Extension.DateTimeExtension
  • ToFormatTime() : SinGooCMS.Utility.Extension.DateTimeExtension
  • ToHashSet< T, TResult >() : SinGooCMS.Utility.Extension.IEnumerableExtension
  • ToHex() : SinGooCMS.Utility.HexUtils
  • ToHtml() : SinGooCMS.Utility.Extension.StringExtension
  • ToInt() : SinGooCMS.Utility.Extension.DataTypeChangeExtension
  • ToIntArray() : SinGooCMS.Utility.Extension.DataTypeChangeExtension
  • ToJson() : SinGooCMS.Utility.Extension.JsonserializeExtension
  • ToJson< T >() : SinGooCMS.Utility.Extension.JsonserializeExtension
  • ToJsonObj() : SinGooCMS.Utility.OperationResult
  • ToLong() : SinGooCMS.Utility.Extension.DataTypeChangeExtension
  • ToRMB() : SinGooCMS.Utility.Extension.StringExtension
  • ToShort() : SinGooCMS.Utility.Extension.DataTypeChangeExtension
  • ToSpliterArray< T >() : SinGooCMS.Utility.Extension.DataTypeChangeExtension
  • ToSpliterList< T >() : SinGooCMS.Utility.Extension.DataTypeChangeExtension
  • ToSplitterString() : SinGooCMS.Utility.Extension.IEnumerableExtension
  • ToSplitterString< T >() : SinGooCMS.Utility.Extension.IEnumerableExtension
  • ToSqlParams< T >() : SinGooCMS.Utility.AdoUtils
  • ToStream() : SinGooCMS.Utility.Extension.IOExtension
  • ToString() : SinGooCMS.Utility.CNDate , SinGooCMS.Utility.IPAreaInfo , SinGooCMS.Utility.OperationResult
  • ToTxt() : SinGooCMS.Utility.Extension.StringExtension
  • ToUrlDictionary() : SinGooCMS.Utility.Extension.StringExtension
  • ToUrlSearch() : SinGooCMS.Utility.Extension.StringExtension
  • ToXml< T >() : SinGooCMS.Utility.Extension.XmlserializeExtension
  • TransIntDict() : SinGooCMS.Utility.EnumUtils
  • TransStrDict() : SinGooCMS.Utility.EnumUtils
  • True< T >() : SinGooCMS.Utility.PredicateBuilder
  • TryGet< TProperty >() : SinGooCMS.Utility.GenericAccessor< TInstance >
  • TryGetAttributes< T >() : SinGooCMS.Utility.Extension.TypeExtensions
  • TryGetGenericArguments() : SinGooCMS.Utility.Extension.TypeExtensions
  • TryGetInstanceProperty() : SinGooCMS.Utility.Extension.TypeExtensions
  • TrySet< TProperty >() : SinGooCMS.Utility.GenericAccessor< TInstance >


SinGooCMS.Utility: 类成员 - 函数

  • 全部
  • 函数
  • 变量
  • 枚举
  • 属性
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • j
  • k
  • l
  • m
  • o
  • p
  • q
  • r
  • s
  • t
  • u
  • w
  • x
  • z
  • ~

- u -

  • UnShutdown() : SinGooCMS.Utility.ProcessUtils
  • UnZip() : SinGooCMS.Utility.ZipUtils
  • UpDownRev() : SinGooCMS.Utility.Extension.ImageExtension
  • UpFile() : SinGooCMS.Utility.ShareFileUtils
  • UploadBroken() : SinGooCMS.Utility.FtpClient
  • UploadFile() : SinGooCMS.Utility.FtpClient


SinGooCMS.Utility: 类成员 - 函数

  • 全部
  • 函数
  • 变量
  • 枚举
  • 属性
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • j
  • k
  • l
  • m
  • o
  • p
  • q
  • r
  • s
  • t
  • u
  • w
  • x
  • z
  • ~

- w -

  • WeekHolidayStruct() : SinGooCMS.Utility.ChineseCalendar.WeekHolidayStruct
  • WeekOfYear() : SinGooCMS.Utility.Extension.DateTimeExtension
  • Write() : SinGooCMS.Utility.CsvUtils
  • Write< T >() : SinGooCMS.Utility.CsvUtils
  • WriteAsync() : SinGooCMS.Utility.CsvUtils
  • WriteAsync< T >() : SinGooCMS.Utility.CsvUtils
  • WriteFileContentAsync() : SinGooCMS.Utility.FileUtils
  • WriteFormatXML() : SinGooCMS.Utility.XmlUtils
  • WriteToFileAsync() : SinGooCMS.Utility.Extension.IOExtension


SinGooCMS.Utility: 类成员 - 函数

  • 全部
  • 函数
  • 变量
  • 枚举
  • 属性
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • j
  • k
  • l
  • m
  • o
  • p
  • q
  • r
  • s
  • t
  • u
  • w
  • x
  • z
  • ~

- x -

  • XmlEncode() : SinGooCMS.Utility.XmlUtils
  • XmlToObject< T >() : SinGooCMS.Utility.Extension.XmlserializeExtension
  • XmlUtils() : SinGooCMS.Utility.XmlUtils


SinGooCMS.Utility: 类成员 - 函数

  • 全部
  • 函数
  • 变量
  • 枚举
  • 属性
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • j
  • k
  • l
  • m
  • o
  • p
  • q
  • r
  • s
  • t
  • u
  • w
  • x
  • z
  • ~

- z -

  • Zip() : SinGooCMS.Utility.ZipUtils


SinGooCMS.Utility: 类成员 - 函数

  • 全部
  • 函数
  • 变量
  • 枚举
  • 属性
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • j
  • k
  • l
  • m
  • o
  • p
  • q
  • r
  • s
  • t
  • u
  • w
  • x
  • z
  • ~

- ~ -

  • ~LibInvoker() : SinGooCMS.Utility.LibInvoker


SinGooCMS.Utility: 类成员 - 变量

  • 全部
  • 函数
  • 变量
  • 枚举
  • 属性
  • _
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • l
  • m
  • n
  • o
  • p
  • q
  • r
  • s
  • t
  • w
  • y
  • z

- _ -

  • _cDay : SinGooCMS.Utility.ChineseCalendar
  • _chineseConstellationName : SinGooCMS.Utility.ChineseCalendar
  • _cIsLeapMonth : SinGooCMS.Utility.ChineseCalendar
  • _cIsLeapYear : SinGooCMS.Utility.ChineseCalendar
  • _cMonth : SinGooCMS.Utility.ChineseCalendar
  • _constellationName : SinGooCMS.Utility.ChineseCalendar
  • _cYear : SinGooCMS.Utility.ChineseCalendar
  • _date : SinGooCMS.Utility.ChineseCalendar
  • _datetime : SinGooCMS.Utility.ChineseCalendar
  • _element : SinGooCMS.Utility.XmlUtils
  • _filePath : SinGooCMS.Utility.XmlUtils
  • _genericInstanceGettersCache : SinGooCMS.Utility.GenericAccessor< TInstance >
  • _genericInstanceSettersCache : SinGooCMS.Utility.GenericAccessor< TInstance >
  • _genericPropertiesGettersCache : SinGooCMS.Utility.GenericAccessor< TInstance >
  • _genericPropertiesSettersCache : SinGooCMS.Utility.GenericAccessor< TInstance >
  • _isInitialized : SinGooCMS.Utility.MimeMapping.MimeMappingDictionaryBase
  • _lunarHolidayName : SinGooCMS.Utility.ChineseCalendar
  • _mappings : SinGooCMS.Utility.MimeMapping.MimeMappingDictionaryBase
  • _monthString : SinGooCMS.Utility.ChineseCalendar
  • _objectGettersCache : SinGooCMS.Utility.ObjectAccessor
  • _objectSettersCache : SinGooCMS.Utility.ObjectAccessor
  • _pathSeparatorChars : SinGooCMS.Utility.MimeMapping.MimeMappingDictionaryBase
  • _prefix : SinGooCMS.Utility.CellPhonePrefix
  • _sign : SinGooCMS.Utility.OperationResult
  • _xml : SinGooCMS.Utility.XmlUtils

- a -

  • Animals : SinGooCMS.Utility.ChinaDate
  • AnimalStartYear : SinGooCMS.Utility.ChineseCalendar
  • animalStr : SinGooCMS.Utility.ChineseCalendar

- b -

  • Base36Characters : SinGooCMS.Utility.DEncryptUtils
  • bindingFlags : SinGooCMS.Utility.Extension.ReflectExtension

- c -

  • cache : SinGooCMS.Utility.CacheUtils
  • ChineseConstellationReferDay : SinGooCMS.Utility.ChineseCalendar
  • classNamesCache : SinGooCMS.Utility.Extension.TypeExtensions
  • cnAnm : SinGooCMS.Utility.CNDate
  • cnFtvl : SinGooCMS.Utility.CNDate
  • cnFtvs : SinGooCMS.Utility.CNDate
  • cnIntDay : SinGooCMS.Utility.CNDate
  • cnIntMonth : SinGooCMS.Utility.CNDate
  • cnIntYear : SinGooCMS.Utility.CNDate
  • cnSolarTerm : SinGooCMS.Utility.CNDate
  • cnStrDay : SinGooCMS.Utility.CNDate
  • cnStrMonth : SinGooCMS.Utility.CNDate
  • cnStrYear : SinGooCMS.Utility.CNDate
  • country : SinGooCMS.Utility.IPScanner
  • countryFlag : SinGooCMS.Utility.IPScanner

- d -

  • dataPath : SinGooCMS.Utility.IPScanner
  • Day : SinGooCMS.Utility.ChineseCalendar.LunarHolidayStruct , SinGooCMS.Utility.ChineseCalendar.SolarHolidayStruct
  • DefConnStr : SinGooCMS.Utility.ConfigUtils
  • Dictionary : SinGooCMS.Utility.CellPhonePrefix
  • DIZHI : SinGooCMS.Utility.Extension.DateTimeExtension

- e -

  • endIp : SinGooCMS.Utility.IPScanner
  • endIpOff : SinGooCMS.Utility.IPScanner
  • errMsg : SinGooCMS.Utility.IPScanner

- f -

  • fail : SinGooCMS.Utility.OperationResult
  • firstStartIp : SinGooCMS.Utility.IPScanner
  • FromHexTable : SinGooCMS.Utility.HexUtils
  • FromHexTable16 : SinGooCMS.Utility.HexUtils
  • FULLFOMART : SinGooCMS.Utility.StringUtils

- g -

  • Gan : SinGooCMS.Utility.ChinaDate
  • ganStr : SinGooCMS.Utility.ChineseCalendar
  • GanZhiStartDay : SinGooCMS.Utility.ChineseCalendar
  • GanZhiStartYear : SinGooCMS.Utility.ChineseCalendar

- h -

  • HasNextPage : SinGooCMS.Utility.PagerModel< T >
  • HasPrevPage : SinGooCMS.Utility.PagerModel< T >
  • hLib : SinGooCMS.Utility.LibInvoker
  • HolidayName : SinGooCMS.Utility.ChineseCalendar.LunarHolidayStruct , SinGooCMS.Utility.ChineseCalendar.SolarHolidayStruct , SinGooCMS.Utility.ChineseCalendar.WeekHolidayStruct
  • HttpContext : SinGooCMS.Utility.UtilsBase
  • HZNum : SinGooCMS.Utility.ChineseCalendar

- i -

  • i : SinGooCMS.Utility.SocketClient
  • ip : SinGooCMS.Utility.IPScanner
  • isSuccess : SinGooCMS.Utility.MailUtils

- l -

  • lastStartIp : SinGooCMS.Utility.IPScanner
  • lFtv : SinGooCMS.Utility.ChinaDate
  • lHolidayInfo : SinGooCMS.Utility.ChineseCalendar
  • local : SinGooCMS.Utility.IPScanner
  • locker : SinGooCMS.Utility.JsonFileUtils
  • LunarDateArray : SinGooCMS.Utility.ChineseCalendar
  • lunarInfo : SinGooCMS.Utility.ChinaDate

- m -

  • m_maxpacket : SinGooCMS.Utility.SocketClient
  • markPath : SinGooCMS.Utility.SocketClient
  • MaxDay : SinGooCMS.Utility.ChineseCalendar
  • MaxYear : SinGooCMS.Utility.ChineseCalendar
  • MinDay : SinGooCMS.Utility.ChineseCalendar
  • MinYear : SinGooCMS.Utility.ChineseCalendar
  • Month : SinGooCMS.Utility.ChineseCalendar.LunarHolidayStruct , SinGooCMS.Utility.ChineseCalendar.SolarHolidayStruct , SinGooCMS.Utility.ChineseCalendar.WeekHolidayStruct

- n -

  • NextPage : SinGooCMS.Utility.PagerModel< T >
  • NonGenericCollectionsToSequenceTypeMapping : SinGooCMS.Utility.Extension.TypeExtensions
  • NORMALFORMAT : SinGooCMS.Utility.StringUtils
  • nStr1 : SinGooCMS.Utility.ChinaDate , SinGooCMS.Utility.ChineseCalendar
  • nStr2 : SinGooCMS.Utility.ChineseCalendar

- o -

  • objfs : SinGooCMS.Utility.IPScanner

- p -

  • PrevPage : SinGooCMS.Utility.PagerModel< T >
  • ProviderName : SinGooCMS.Utility.ConfigUtils

- q -

  • QueryStringRegex : SinGooCMS.Utility.Extension.UriExtension

- r -

  • Recess : SinGooCMS.Utility.ChineseCalendar.LunarHolidayStruct , SinGooCMS.Utility.ChineseCalendar.SolarHolidayStruct
  • RecordBegin : SinGooCMS.Utility.PagerUtils
  • RegionCode : SinGooCMS.Utility.IdCardUtils
  • Request : SinGooCMS.Utility.UtilsBase
  • Response : SinGooCMS.Utility.UtilsBase

- s -

  • sFtv : SinGooCMS.Utility.ChinaDate
  • sHolidayInfo : SinGooCMS.Utility.ChineseCalendar
  • SHORTFORMAT : SinGooCMS.Utility.StringUtils
  • shortNames : SinGooCMS.Utility.Extension.TypeExtensions
  • SimpleTypes : SinGooCMS.Utility.Extension.TypeExtensions
  • solarTerm : SinGooCMS.Utility.ChinaDate
  • SolarTerm : SinGooCMS.Utility.ChineseCalendar
  • SpaceCharacter : SinGooCMS.Utility.HexUtils
  • startIp : SinGooCMS.Utility.IPScanner
  • sTermInfo : SinGooCMS.Utility.ChinaDate , SinGooCMS.Utility.ChineseCalendar
  • success : SinGooCMS.Utility.OperationResult

- t -

  • ToHexTable : SinGooCMS.Utility.HexUtils
  • TotalPage : SinGooCMS.Utility.PagerModel< T >

- w -

  • WeekAtMonth : SinGooCMS.Utility.ChineseCalendar.WeekHolidayStruct
  • WeekDay : SinGooCMS.Utility.ChineseCalendar.WeekHolidayStruct
  • wHolidayInfo : SinGooCMS.Utility.ChineseCalendar

- y -

  • year19 : SinGooCMS.Utility.ChinaDate
  • year20 : SinGooCMS.Utility.ChinaDate
  • year2000 : SinGooCMS.Utility.ChinaDate

- z -

  • Zhi : SinGooCMS.Utility.ChinaDate
  • zhiStr : SinGooCMS.Utility.ChineseCalendar


SinGooCMS.Utility: 类成员 - 枚举

  • 全部
  • 函数
  • 变量
  • 枚举
  • 属性
  • SNType : SinGooCMS.Utility.StringUtils


SinGooCMS.Utility: 类成员 - 属性

  • 全部
  • 函数
  • 变量
  • 枚举
  • 属性
  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • i
  • l
  • n
  • p
  • r
  • s
  • t
  • u
  • w

- a -

  • Age : SinGooCMS.Utility.IdCardUtils
  • Animal : SinGooCMS.Utility.ChineseCalendar
  • AnimalString : SinGooCMS.Utility.ChineseCalendar

- b -

  • BirthDay : SinGooCMS.Utility.IdCardUtils

- c -

  • CallbackUrl : SinGooCMS.Utility.OperationResult
  • CardNo : SinGooCMS.Utility.IdCardUtils
  • CheckCodeImg : SinGooCMS.Utility.CaptchaUtils
  • CheckCodeString : SinGooCMS.Utility.CaptchaUtils
  • ChineseConstellation : SinGooCMS.Utility.ChineseCalendar
  • ChineseDateString : SinGooCMS.Utility.ChineseCalendar
  • ChineseDay : SinGooCMS.Utility.ChineseCalendar
  • ChineseDayString : SinGooCMS.Utility.ChineseCalendar
  • ChineseHour : SinGooCMS.Utility.ChineseCalendar
  • ChineseMonth : SinGooCMS.Utility.ChineseCalendar
  • ChineseMonthString : SinGooCMS.Utility.ChineseCalendar
  • ChineseTwentyFourDay : SinGooCMS.Utility.ChineseCalendar
  • ChineseTwentyFourNextDay : SinGooCMS.Utility.ChineseCalendar
  • ChineseTwentyFourPrevDay : SinGooCMS.Utility.ChineseCalendar
  • ChineseYear : SinGooCMS.Utility.ChineseCalendar
  • ChineseYearString : SinGooCMS.Utility.ChineseCalendar
  • City : SinGooCMS.Utility.IPAreaInfo
  • Comparer : SinGooCMS.Utility.Accessor
  • Config : SinGooCMS.Utility.MailUtils
  • Constellation : SinGooCMS.Utility.ChineseCalendar
  • Country : SinGooCMS.Utility.IPAreaInfo , SinGooCMS.Utility.IPScanner
  • County : SinGooCMS.Utility.IPAreaInfo
  • CutImgExtend : SinGooCMS.Utility.VideoUtils
  • CutImgHeight : SinGooCMS.Utility.VideoUtils
  • CutImgWidth : SinGooCMS.Utility.VideoUtils

- d -

  • Data : SinGooCMS.Utility.OperationResult
  • DataPath : SinGooCMS.Utility.IPScanner
  • Date : SinGooCMS.Utility.ChineseCalendar
  • DateHoliday : SinGooCMS.Utility.ChineseCalendar
  • DateString : SinGooCMS.Utility.ChineseCalendar
  • DisplayName : SinGooCMS.Utility.Extension.DisplayExtAttribute

- e -

  • ErrMsg : SinGooCMS.Utility.IPScanner
  • ErrorENMessage : SinGooCMS.Utility.OperationResult
  • ErrorMessage : SinGooCMS.Utility.OperationResult

- f -

  • FromDisplayName : SinGooCMS.Utility.MailConfig
  • FtpServer : SinGooCMS.Utility.FtpClient

- g -

  • GanZhiDateString : SinGooCMS.Utility.ChineseCalendar
  • GanZhiDayString : SinGooCMS.Utility.ChineseCalendar
  • GanZhiMonthString : SinGooCMS.Utility.ChineseCalendar
  • GanZhiYearString : SinGooCMS.Utility.ChineseCalendar

- i -

  • IgnoreCase : SinGooCMS.Utility.Accessor
  • IncludesNonPublic : SinGooCMS.Utility.Accessor
  • IP : SinGooCMS.Utility.IPScanner
  • IsChineseLeapMonth : SinGooCMS.Utility.ChineseCalendar
  • IsChineseLeapYear : SinGooCMS.Utility.ChineseCalendar
  • IsCredential : SinGooCMS.Utility.FtpClient
  • IsLeapYear : SinGooCMS.Utility.ChineseCalendar
  • IsReadRes : SinGooCMS.Utility.Extension.DisplayExtAttribute

- l -

  • Local : SinGooCMS.Utility.IPScanner

- n -

  • Name : SinGooCMS.Utility.Extension.DisplayExtAttribute
  • newCalendarHoliday : SinGooCMS.Utility.ChineseCalendar

- p -

  • PageBegin : SinGooCMS.Utility.PagerUtils
  • PageEnd : SinGooCMS.Utility.PagerUtils
  • PageIndex : SinGooCMS.Utility.PagerModel< T > , SinGooCMS.Utility.PagerUtils
  • PagerData : SinGooCMS.Utility.PagerModel< T >
  • PageSize : SinGooCMS.Utility.PagerModel< T > , SinGooCMS.Utility.PagerUtils
  • PassiveMode : SinGooCMS.Utility.FtpClient
  • Password : SinGooCMS.Utility.FtpClient , SinGooCMS.Utility.ShareFileUtils
  • Prefix : SinGooCMS.Utility.CellPhonePrefix
  • Properties : SinGooCMS.Utility.Accessor
  • Province : SinGooCMS.Utility.IPAreaInfo

- r -

  • RecordEnd : SinGooCMS.Utility.PagerUtils
  • ResName : SinGooCMS.Utility.Extension.DisplayExtAttribute
  • ResourceType : SinGooCMS.Utility.Extension.DisplayExtAttribute
  • ReturnStatusType : SinGooCMS.Utility.OperationResult

- s -

  • ServMailAccount : SinGooCMS.Utility.MailConfig
  • ServMailIsSSL : SinGooCMS.Utility.MailConfig
  • ServMailPort : SinGooCMS.Utility.MailConfig
  • ServMailSMTP : SinGooCMS.Utility.MailConfig
  • ServMailUserName : SinGooCMS.Utility.MailConfig
  • ServMailUserPwd : SinGooCMS.Utility.MailConfig
  • Sex : SinGooCMS.Utility.IdCardUtils
  • SharePath : SinGooCMS.Utility.ShareFileUtils
  • Sign : SinGooCMS.Utility.OperationResult
  • StartPoint : SinGooCMS.Utility.VideoUtils
  • StatusCode : SinGooCMS.Utility.OperationResult

- t -

  • this[int indexBeg, int indexEnd] : SinGooCMS.Utility.SinGooArray , SinGooCMS.Utility.SinGooDictionary< T1, T2 > , SinGooCMS.Utility.SinGooList< T >
  • this[int indexBeg] : SinGooCMS.Utility.SinGooDictionary< T1, T2 >
  • this[object instance, string propertyName] : SinGooCMS.Utility.ObjectAccessor
  • this[TInstance instance, string propertyName] : SinGooCMS.Utility.GenericAccessor< TInstance >
  • Timeout : SinGooCMS.Utility.OperationResult
  • TimeStamp : SinGooCMS.Utility.OperationResult
  • ToolsPath : SinGooCMS.Utility.VideoUtils
  • TotalPage : SinGooCMS.Utility.PagerUtils
  • TotalRecord : SinGooCMS.Utility.PagerModel< T > , SinGooCMS.Utility.PagerUtils
  • Type : SinGooCMS.Utility.Accessor

- u -

  • UrlPattern : SinGooCMS.Utility.PagerUtils
  • Username : SinGooCMS.Utility.FtpClient
  • UserName : SinGooCMS.Utility.ShareFileUtils

- w -

  • WeekDay : SinGooCMS.Utility.ChineseCalendar
  • WeekDayHoliday : SinGooCMS.Utility.ChineseCalendar
  • WeekDayStr : SinGooCMS.Utility.ChineseCalendar


SinGooCMS.Utility: 文件列表

  • 文件列表
文件列表
这里列出了所有文件，并附带简要说明:
[详情级别 12345]
▼ SinGooCMS.Utility
► Accessors
Accessor.cs
AccessorBuilder.cs
GenericAccessor.cs
ObjectAccessor.cs
► Config
ConfigUtils.cs
► Data
AdoUtils.cs
CsvUtils.cs
EntityAttrUtils.cs
IdCard.cs
NPOIUtils.cs
► Date
ChineseDateUtils.cs
DatetimeUtils.cs
TimeUtils.cs
► Extension
AssemblyExtensions.cs
AttributeExtension.cs
DataTableExtension.cs
DataTypeChangeExtension.cs
DateExtension.cs
DictionaryExtension.cs
EnumExtension.cs
IConvertibleExtension.cs
IEnumerableExtension.cs
ImageExtension.cs
IOExtension.cs
JsonserializeExtension.cs
LinqExtension.cs
ObjectExtension.cs
ReflectExtension.cs
ServiceCollectionExtension.cs
StreamExtension.cs
StringExtension.cs
TaskExtensions.cs
TypeExtensions.cs
UriExtensions.cs
ValidateExtension.cs
XmlserializeExtension.cs
► IO
Base64FileUtils.cs
CaptchaUtils.cs
FileUtils.cs
JsonFileUtils.cs
ShareFileUtils.cs
VideoUtils.cs
ZipUtils.cs
► Linq
PredicateBuilder.cs
► List
SinGooList.cs
► Media
ImageUtils.cs
ThumbnailCutMode.cs
WatermarkPosition.cs
► Net
FtpClient.cs
IPScanner.cs
IPUtils.cs
MailUtils.cs
NetWorkUtils.cs
SocketClient.cs
► obj
► Debug
► net4.6.1
.NETFramework,Version=v4.6.1.AssemblyAttributes.cs
SinGooCMS.Utility.AssemblyInfo.cs
► netstandard2.1
.NETStandard,Version=v2.1.AssemblyAttributes.cs
SinGooCMS.Utility.AssemblyInfo.cs
► Pager
PagerModel.cs
PagerUtils.cs
QueryExtension.cs
► Reflection
LibInvoker.cs
ReflectionUtils.cs
► Result
OperationResult.cs
► Security
DEncryptUtils.cs
RSACryption.cs
► String
StringUtils.cs
► System
EnumUtils.cs
IISUtils.cs
ProcessUtils.cs
RegistryUtils.cs
StopwatchUtils.cs
SystemUtils.cs
► Text
CellPhonePrefix.cs
HexUtils.cs
UnicodeUtils.cs
► Web
CacheUtils.cs
CookieUtils.cs
ExceptionUtils.cs
SessionUtils.cs
WebUtils.cs
► Xml
XmlUtils.cs
UtilsBase.cs


SinGooCMS.Utility: SinGooCMS.Utility 目录参考

  • SinGooCMS.Utility
SinGooCMS.Utility 目录参考
SinGooCMS.Utility 的目录依赖关系图

目录

目录 | Accessors
目录 | Config
目录 | Data
目录 | Date
目录 | Extension
目录 | IO
目录 | Linq
目录 | List
目录 | Media
目录 | Net
目录 | obj
目录 | Pager
目录 | Reflection
目录 | Result
目录 | Security
目录 | String
目录 | System
目录 | Text
目录 | Web
目录 | Xml

文件

文件 UtilsBase.cs [代码]


SinGooCMS.Utility: SinGooCMS.Utility/Accessors 目录参考

  • SinGooCMS.Utility
  • Accessors
Accessors 目录参考
Accessors 的目录依赖关系图

文件

文件 | Accessor.cs [代码]
文件 | AccessorBuilder.cs [代码]
文件 | GenericAccessor.cs [代码]
文件 | ObjectAccessor.cs [代码]


SinGooCMS.Utility: SinGooCMS.Utility/Accessors/Accessor.cs 文件参考

  • 文件列表
  • SinGooCMS.Utility
  • Accessors
类 | 命名空间
Accessor.cs 文件参考

浏览源代码.

类

class SinGooCMS.Utility.Accessor
用于构建ObjectAccessor和 GenericAccessor<TInstance>实例。 更多...

命名空间

namespace SinGooCMS.Utility


SinGooCMS.Utility: SinGooCMS.Utility/Accessors/AccessorBuilder.cs 文件参考

  • 文件列表
  • SinGooCMS.Utility
  • Accessors
类 | 命名空间
AccessorBuilder.cs 文件参考

浏览源代码.

类

class SinGooCMS.Utility.AccessorBuilder
提供一系列快速构建

参见
Accessor

实例的方法 更多...

命名空间

namespace SinGooCMS.Utility


SinGooCMS.Utility: SinGooCMS.Utility/Accessors/GenericAccessor.cs 文件参考

  • 文件列表
  • SinGooCMS.Utility
  • Accessors
类 | 命名空间
GenericAccessor.cs 文件参考

浏览源代码.

类

class SinGooCMS.Utility.GenericAccessor< TInstance >
快速访问给定类型的对象的属性值, 参照:

参见
Accessor
更多...

命名空间

namespace SinGooCMS.Utility


SinGooCMS.Utility: SinGooCMS.Utility/Accessors/ObjectAccessor.cs 文件参考

  • 文件列表
  • SinGooCMS.Utility
  • Accessors
类 | 命名空间
ObjectAccessor.cs 文件参考

浏览源代码.

类

class SinGooCMS.Utility.ObjectAccessor
快速访问给定类型的对象的属性值, 参照:

参见
Accessor
更多...

命名空间

namespace SinGooCMS.Utility


SinGooCMS.Utility: SinGooCMS.Utility/Config 目录参考

  • SinGooCMS.Utility
  • Config
Config 目录参考
Config 的目录依赖关系图

文件

文件 ConfigUtils.cs [代码]


SinGooCMS.Utility: SinGooCMS.Utility/Config/ConfigUtils.cs 文件参考

  • 文件列表
  • SinGooCMS.Utility
  • Config
类 | 命名空间
ConfigUtils.cs 文件参考

浏览源代码.

类

class SinGooCMS.Utility.ConfigUtils
配置管理 更多...

命名空间

namespace SinGooCMS.Utility


SinGooCMS.Utility: SinGooCMS.Utility/Data 目录参考

  • SinGooCMS.Utility
  • Data
Data 目录参考
Data 的目录依赖关系图

文件

文件 | AdoUtils.cs [代码]
文件 | CsvUtils.cs [代码]
文件 | EntityAttrUtils.cs [代码]
文件 | IdCard.cs [代码]
文件 | NPOIUtils.cs [代码]


SinGooCMS.Utility: SinGooCMS.Utility/Data/AdoUtils.cs 文件参考

  • 文件列表
  • SinGooCMS.Utility
  • Data
类 | 命名空间
AdoUtils.cs 文件参考

浏览源代码.

类

class SinGooCMS.Utility.AdoUtils
这里只提供SqlServer的简单操作，具体可参考SinGooCMS.Ado 更多...

命名空间

namespace SinGooCMS.Utility


SinGooCMS.Utility: SinGooCMS.Utility/Data/CsvUtils.cs 文件参考

  • 文件列表
  • SinGooCMS.Utility
  • Data
类 | 命名空间
CsvUtils.cs 文件参考

浏览源代码.

类

class SinGooCMS.Utility.CsvUtils
csv工具 更多...

命名空间

namespace SinGooCMS.Utility


SinGooCMS.Utility: SinGooCMS.Utility/Data/EntityAttrUtils.cs 文件参考

  • 文件列表
  • SinGooCMS.Utility
  • Data
类 | 命名空间
EntityAttrUtils.cs 文件参考

浏览源代码.

类

class SinGooCMS.Utility.EntityAttrUtils
实体类 特性工具 更多...

命名空间

namespace SinGooCMS.Utility


SinGooCMS.Utility: SinGooCMS.Utility/Data/IdCard.cs 文件参考

  • 文件列表
  • SinGooCMS.Utility
  • Data
类 | 命名空间
IdCard.cs 文件参考

浏览源代码.

类

class SinGooCMS.Utility.IdCardUtils
身份证工具 更多...

命名空间

namespace SinGooCMS.Utility


SinGooCMS.Utility: SinGooCMS.Utility/Data/NPOIUtils.cs 文件参考

  • 文件列表
  • SinGooCMS.Utility
  • Data
类 | 命名空间
NPOIUtils.cs 文件参考

浏览源代码.

类

class SinGooCMS.Utility.NPOIUtils
NPOI工具类
来自: 更多...

命名空间

namespace SinGooCMS.Utility


SinGooCMS.Utility: SinGooCMS.Utility/Date 目录参考

  • SinGooCMS.Utility
  • Date
Date 目录参考
Date 的目录依赖关系图

文件

文件 | ChineseDateUtils.cs [代码]
文件 | DatetimeUtils.cs [代码]
文件 | TimeUtils.cs [代码]


SinGooCMS.Utility: SinGooCMS.Utility/Date/ChineseDateUtils.cs 文件参考

  • 文件列表
  • SinGooCMS.Utility
  • Date
类 | 命名空间
ChineseDateUtils.cs 文件参考

浏览源代码.

类

class | SinGooCMS.Utility.CNDate
农历属性 更多...
class | SinGooCMS.Utility.ChinaDate
公历转农历 更多...
class | SinGooCMS.Utility.ChineseCalendar
中国日历 更多...
struct | SinGooCMS.Utility.ChineseCalendar.SolarHolidayStruct
阳历 更多...
struct | SinGooCMS.Utility.ChineseCalendar.LunarHolidayStruct
农历 更多...
struct | SinGooCMS.Utility.ChineseCalendar.WeekHolidayStruct

命名空间

namespace SinGooCMS.Utility


SinGooCMS.Utility: SinGooCMS.Utility/Date/DatetimeUtils.cs 文件参考

  • 文件列表
  • SinGooCMS.Utility
  • Date
类 | 命名空间
DatetimeUtils.cs 文件参考

浏览源代码.

类

class SinGooCMS.Utility.DatetimeUtils
日期工具 更多...

命名空间

namespace SinGooCMS.Utility


SinGooCMS.Utility: SinGooCMS.Utility/Date/TimeUtils.cs 文件参考

  • 文件列表
  • SinGooCMS.Utility
  • Date
类 | 命名空间
TimeUtils.cs 文件参考

浏览源代码.

类

class SinGooCMS.Utility.TimeUtils
时间工具 更多...

命名空间

namespace SinGooCMS.Utility


SinGooCMS.Utility: SinGooCMS.Utility/Extension 目录参考

  • SinGooCMS.Utility
  • Extension
Extension 目录参考
Extension 的目录依赖关系图

文件

文件 | AssemblyExtensions.cs [代码]
文件 | AttributeExtension.cs [代码]
文件 | DataTableExtension.cs [代码]
文件 | DataTypeChangeExtension.cs [代码]
文件 | DateExtension.cs [代码]
文件 | DictionaryExtension.cs [代码]
文件 | EnumExtension.cs [代码]
文件 | IConvertibleExtension.cs [代码]
文件 | IEnumerableExtension.cs [代码]
文件 | ImageExtension.cs [代码]
文件 | IOExtension.cs [代码]
文件 | JsonserializeExtension.cs [代码]
文件 | LinqExtension.cs [代码]
文件 | ObjectExtension.cs [代码]
文件 | ReflectExtension.cs [代码]
文件 | ServiceCollectionExtension.cs [代码]
文件 | StreamExtension.cs [代码]
文件 | StringExtension.cs [代码]
文件 | TaskExtensions.cs [代码]
文件 | TypeExtensions.cs [代码]
文件 | UriExtensions.cs [代码]
文件 | ValidateExtension.cs [代码]
文件 | XmlserializeExtension.cs [代码]


SinGooCMS.Utility: SinGooCMS.Utility/Extension/AssemblyExtensions.cs 文件参考

  • 文件列表
  • SinGooCMS.Utility
  • Extension
类 | 命名空间
AssemblyExtensions.cs 文件参考

浏览源代码.

类

class SinGooCMS.Utility.Extension.AssemblyExtension
Assembly扩展类 更多...

命名空间

namespace SinGooCMS.Utility.Extension


SinGooCMS.Utility: SinGooCMS.Utility/Extension/AttributeExtension.cs 文件参考

  • 文件列表
  • SinGooCMS.Utility
  • Extension
类 | 命名空间
AttributeExtension.cs 文件参考

浏览源代码.

类

class SinGooCMS.Utility.Extension.DisplayExtAttribute
特性扩展类
属性的显示扩展,优先使用资源Name,默认使用自带的Name,注意：仅适用于MVC 更多...

命名空间

namespace SinGooCMS.Utility.Extension


SinGooCMS.Utility: SinGooCMS.Utility/Extension/DataTableExtension.cs 文件参考

  • 文件列表
  • SinGooCMS.Utility
  • Extension
类 | 命名空间
DataTableExtension.cs 文件参考

浏览源代码.

类

class SinGooCMS.Utility.Extension.DataTableExtension
数据集扩展 更多...

命名空间

namespace SinGooCMS.Utility.Extension


SinGooCMS.Utility: SinGooCMS.Utility/Extension/DataTypeChangeExtension.cs 文件参考

  • 文件列表
  • SinGooCMS.Utility
  • Extension
类 | 命名空间
DataTypeChangeExtension.cs 文件参考

浏览源代码.

类

class SinGooCMS.Utility.Extension.DataTypeChangeExtension
数据类型转换,利用TryParse判断是否可转换，如果能则返回转换后的值，否则返回默认值 更多...

命名空间

namespace SinGooCMS.Utility.Extension


SinGooCMS.Utility: SinGooCMS.Utility/Extension/DateExtension.cs 文件参考

  • 文件列表
  • SinGooCMS.Utility
  • Extension
类 | 命名空间
DateExtension.cs 文件参考

浏览源代码.

类

class SinGooCMS.Utility.Extension.DateTimeExtension
日期扩展 更多...

命名空间

namespace SinGooCMS.Utility.Extension


SinGooCMS.Utility: SinGooCMS.Utility/Extension/DictionaryExtension.cs 文件参考

  • 文件列表
  • SinGooCMS.Utility
  • Extension
类 | 命名空间
DictionaryExtension.cs 文件参考

浏览源代码.

类

class SinGooCMS.Utility.Extension.DictionaryExtension
字典扩展类 更多...

命名空间

namespace SinGooCMS.Utility.Extension


SinGooCMS.Utility: SinGooCMS.Utility/Extension/EnumExtension.cs 文件参考

  • 文件列表
  • SinGooCMS.Utility
  • Extension
类 | 命名空间
EnumExtension.cs 文件参考

浏览源代码.

类

class SinGooCMS.Utility.Extension.EnumExtension
枚举扩展 更多...

命名空间

namespace SinGooCMS.Utility.Extension


SinGooCMS.Utility: SinGooCMS.Utility/Extension/IConvertibleExtension.cs 文件参考

  • 文件列表
  • SinGooCMS.Utility
  • Extension
类 | 命名空间
IConvertibleExtension.cs 文件参考

浏览源代码.

类

class SinGooCMS.Utility.Extension.IConvertibleExtension
可转换扩展 更多...

命名空间

namespace SinGooCMS.Utility.Extension


SinGooCMS.Utility: SinGooCMS.Utility/Extension/IEnumerableExtension.cs 文件参考

  • 文件列表
  • SinGooCMS.Utility
  • Extension
类 | 命名空间
IEnumerableExtension.cs 文件参考

浏览源代码.

类

class SinGooCMS.Utility.Extension.IEnumerableExtension
遍历扩展 更多...

命名空间

namespace SinGooCMS.Utility.Extension


SinGooCMS.Utility: SinGooCMS.Utility/Extension/ImageExtension.cs 文件参考

  • 文件列表
  • SinGooCMS.Utility
  • Extension
类 | 命名空间
ImageExtension.cs 文件参考

浏览源代码.

类

class SinGooCMS.Utility.Extension.ImageExtension
image图像扩展 更多...

命名空间

namespace SinGooCMS.Utility.Extension


SinGooCMS.Utility: SinGooCMS.Utility/Extension/IOExtension.cs 文件参考

  • 文件列表
  • SinGooCMS.Utility
  • Extension
类 | 命名空间
IOExtension.cs 文件参考

浏览源代码.

类

class SinGooCMS.Utility.Extension.IOExtension
IO扩展 更多...

命名空间

namespace SinGooCMS.Utility.Extension


SinGooCMS.Utility: SinGooCMS.Utility/Extension/JsonserializeExtension.cs 文件参考

  • 文件列表
  • SinGooCMS.Utility
  • Extension
类 | 命名空间
JsonserializeExtension.cs 文件参考

浏览源代码.

类

class SinGooCMS.Utility.Extension.JsonserializeExtension
json扩展 更多...

命名空间

namespace SinGooCMS.Utility.Extension


SinGooCMS.Utility: SinGooCMS.Utility/Extension/LinqExtension.cs 文件参考

  • 文件列表
  • SinGooCMS.Utility
  • Extension
类 | 命名空间
LinqExtension.cs 文件参考

浏览源代码.

类

class SinGooCMS.Utility.Extension.LinqExtension
linq扩展方法 更多...

命名空间

namespace SinGooCMS.Utility.Extension


SinGooCMS.Utility: SinGooCMS.Utility/Extension/ObjectExtension.cs 文件参考

  • 文件列表
  • SinGooCMS.Utility
  • Extension
类 | 命名空间
ObjectExtension.cs 文件参考

浏览源代码.

类

class SinGooCMS.Utility.Extension.ObjectExtension
对象扩展 更多...

命名空间

namespace SinGooCMS.Utility.Extension


SinGooCMS.Utility: SinGooCMS.Utility/Extension/ReflectExtension.cs 文件参考

  • 文件列表
  • SinGooCMS.Utility
  • Extension
类 | 命名空间
ReflectExtension.cs 文件参考

浏览源代码.

类

class SinGooCMS.Utility.Extension.ReflectExtension
反射扩展 更多...

命名空间

namespace SinGooCMS.Utility.Extension


SinGooCMS.Utility: SinGooCMS.Utility/Extension/ServiceCollectionExtension.cs 文件参考

  • 文件列表
  • SinGooCMS.Utility
  • Extension
ServiceCollectionExtension.cs 文件参考

浏览源代码.


SinGooCMS.Utility: SinGooCMS.Utility/Extension/StreamExtension.cs 文件参考

  • 文件列表
  • SinGooCMS.Utility
  • Extension
类 | 命名空间
StreamExtension.cs 文件参考

浏览源代码.

类

class SinGooCMS.Utility.Extension.StreamExtension
流扩展 更多...

命名空间

namespace SinGooCMS.Utility.Extension


SinGooCMS.Utility: SinGooCMS.Utility/Extension/StringExtension.cs 文件参考

  • 文件列表
  • SinGooCMS.Utility
  • Extension
类 | 命名空间
StringExtension.cs 文件参考

浏览源代码.

类

class SinGooCMS.Utility.Extension.StringExtension
字符串扩展 更多...

命名空间

namespace SinGooCMS.Utility.Extension


SinGooCMS.Utility: SinGooCMS.Utility/Extension/TaskExtensions.cs 文件参考

  • 文件列表
  • SinGooCMS.Utility
  • Extension
类 | 命名空间
TaskExtensions.cs 文件参考

浏览源代码.

类

class SinGooCMS.Utility.Extension.TaskExtensions
System.Threading.Tasks扩展类 更多...

命名空间

namespace SinGooCMS.Utility.Extension


SinGooCMS.Utility: SinGooCMS.Utility/Extension/TypeExtensions.cs 文件参考

  • 文件列表
  • SinGooCMS.Utility
  • Extension
类 | 命名空间 | 枚举
TypeExtensions.cs 文件参考

浏览源代码.

类

class SinGooCMS.Utility.Extension.TypeExtensions
Type扩展类 更多...

命名空间

namespace SinGooCMS.Utility.Extension

枚举

enum SinGooCMS.Utility.Extension.SequenceType {
SinGooCMS.Utility.Extension.SequenceType.Invalid = 0, SinGooCMS.Utility.Extension.SequenceType.String, SinGooCMS.Utility.Extension.SequenceType.Array, SinGooCMS.Utility.Extension.SequenceType.BitArray,
SinGooCMS.Utility.Extension.SequenceType.ArrayList, SinGooCMS.Utility.Extension.SequenceType.Queue, SinGooCMS.Utility.Extension.SequenceType.Stack, SinGooCMS.Utility.Extension.SequenceType.Hashtable,
SinGooCMS.Utility.Extension.SequenceType.SortedList, SinGooCMS.Utility.Extension.SequenceType.Dictionary, SinGooCMS.Utility.Extension.SequenceType.ListDictionary, SinGooCMS.Utility.Extension.SequenceType.IList,
SinGooCMS.Utility.Extension.SequenceType.ICollection, SinGooCMS.Utility.Extension.SequenceType.IDictionary, SinGooCMS.Utility.Extension.SequenceType.IEnumerable, SinGooCMS.Utility.Extension.SequenceType.Custom,
SinGooCMS.Utility.Extension.SequenceType.GenericList, SinGooCMS.Utility.Extension.SequenceType.GenericLinkedList, SinGooCMS.Utility.Extension.SequenceType.GenericCollection, SinGooCMS.Utility.Extension.SequenceType.GenericQueue,
SinGooCMS.Utility.Extension.SequenceType.GenericStack, SinGooCMS.Utility.Extension.SequenceType.GenericHashSet, SinGooCMS.Utility.Extension.SequenceType.GenericSortedList, SinGooCMS.Utility.Extension.SequenceType.GenericDictionary,
SinGooCMS.Utility.Extension.SequenceType.GenericSortedDictionary, SinGooCMS.Utility.Extension.SequenceType.GenericBlockingCollection, SinGooCMS.Utility.Extension.SequenceType.GenericConcurrentDictionary, SinGooCMS.Utility.Extension.SequenceType.GenericConcurrentBag,
SinGooCMS.Utility.Extension.SequenceType.GenericIList, SinGooCMS.Utility.Extension.SequenceType.GenericICollection, SinGooCMS.Utility.Extension.SequenceType.GenericIEnumerable, SinGooCMS.Utility.Extension.SequenceType.GenericIDictionary,
SinGooCMS.Utility.Extension.SequenceType.GenericICollectionKeyValue, SinGooCMS.Utility.Extension.SequenceType.GenericIEnumerableKeyValue, SinGooCMS.Utility.Extension.SequenceType.GenericCustom
}
表示可能的序列类型(集合) 更多...


SinGooCMS.Utility: SinGooCMS.Utility/Extension/UriExtensions.cs 文件参考

  • 文件列表
  • SinGooCMS.Utility
  • Extension
类 | 命名空间
UriExtensions.cs 文件参考

浏览源代码.

类

class SinGooCMS.Utility.Extension.UriExtension
提供一组使用Uri的辅助方法。 更多...

命名空间

namespace SinGooCMS.Utility.Extension


SinGooCMS.Utility: SinGooCMS.Utility/Extension/ValidateExtension.cs 文件参考

  • 文件列表
  • SinGooCMS.Utility
  • Extension
类 | 命名空间
ValidateExtension.cs 文件参考

浏览源代码.

类

class SinGooCMS.Utility.Extension.ValidateExtension
验证扩展 更多...

命名空间

namespace SinGooCMS.Utility.Extension


SinGooCMS.Utility: SinGooCMS.Utility/Extension/XmlserializeExtension.cs 文件参考

  • 文件列表
  • SinGooCMS.Utility
  • Extension
类 | 命名空间
XmlserializeExtension.cs 文件参考

浏览源代码.

类

class | SinGooCMS.Utility.Extension.XmlserializeExtension
xml序列化扩展 更多...
class | SinGooCMS.Utility.Extension.StringUTF8Writer
转xml时编码为UTF8

命名空间

namespace SinGooCMS.Utility.Extension


SinGooCMS.Utility: SinGooCMS.Utility/IO 目录参考

  • SinGooCMS.Utility
  • IO
IO 目录参考
IO 的目录依赖关系图

文件

文件 | Base64FileUtils.cs [代码]
文件 | CaptchaUtils.cs [代码]
文件 | FileUtils.cs [代码]
文件 | JsonFileUtils.cs [代码]
文件 | ShareFileUtils.cs [代码]
文件 | VideoUtils.cs [代码]
文件 | ZipUtils.cs [代码]


SinGooCMS.Utility: SinGooCMS.Utility/IO/Base64FileUtils.cs 文件参考

  • 文件列表
  • SinGooCMS.Utility
  • IO
类 | 命名空间
Base64FileUtils.cs 文件参考

浏览源代码.

类

class SinGooCMS.Utility.Base64FileUtils
base64字符串和文件互转 更多...

命名空间

namespace SinGooCMS.Utility


SinGooCMS.Utility: SinGooCMS.Utility/IO/CaptchaUtils.cs 文件参考

  • 文件列表
  • SinGooCMS.Utility
  • IO
类 | 命名空间
CaptchaUtils.cs 文件参考

浏览源代码.

类

class SinGooCMS.Utility.CaptchaUtils
图形验证码工具 更多...

命名空间

namespace SinGooCMS.Utility


SinGooCMS.Utility: SinGooCMS.Utility/IO/FileUtils.cs 文件参考

  • 文件列表
  • SinGooCMS.Utility
  • IO
类 | 命名空间 | 枚举
FileUtils.cs 文件参考

浏览源代码.

类

class | SinGooCMS.Utility.FileUtils
文件管理工具 更多...
class | SinGooCMS.Utility.MimeMapping
class | SinGooCMS.Utility.MimeMapping.MimeMappingDictionaryBase
class | SinGooCMS.Utility.MimeMapping.MimeMappingDictionaryClassic

命名空间

namespace SinGooCMS.Utility

枚举

enum SinGooCMS.Utility.FileSizeUnit { SinGooCMS.Utility.FileSizeUnit.KB, SinGooCMS.Utility.FileSizeUnit.MB, SinGooCMS.Utility.FileSizeUnit.GB, SinGooCMS.Utility.FileSizeUnit.TB }
文件尺寸大小单位 更多...


SinGooCMS.Utility: SinGooCMS.Utility/IO/JsonFileUtils.cs 文件参考

  • 文件列表
  • SinGooCMS.Utility
  • IO
类 | 命名空间
JsonFileUtils.cs 文件参考

浏览源代码.

类

class SinGooCMS.Utility.JsonFileUtils
JSON文件工具 更多...

命名空间

namespace SinGooCMS.Utility


SinGooCMS.Utility: SinGooCMS.Utility/IO/ShareFileUtils.cs 文件参考

  • 文件列表
  • SinGooCMS.Utility
  • IO
类 | 命名空间
ShareFileUtils.cs 文件参考

浏览源代码.

类

class SinGooCMS.Utility.ShareFileUtils
局域网共享文件工具 更多...

命名空间

namespace SinGooCMS.Utility


SinGooCMS.Utility: SinGooCMS.Utility/IO/VideoUtils.cs 文件参考

  • 文件列表
  • SinGooCMS.Utility
  • IO
类 | 命名空间
VideoUtils.cs 文件参考

浏览源代码.

类

class SinGooCMS.Utility.VideoUtils
视频剪切工具.上传视频后可截取视频存储为图片,注意要调用文件：ffmpeg.exe 更多...

命名空间

namespace SinGooCMS.Utility


SinGooCMS.Utility: SinGooCMS.Utility/IO/ZipUtils.cs 文件参考

  • 文件列表
  • SinGooCMS.Utility
  • IO
类 | 命名空间
ZipUtils.cs 文件参考

浏览源代码.

类

class SinGooCMS.Utility.ZipUtils
压缩和解压 更多...

命名空间

namespace SinGooCMS.Utility


SinGooCMS.Utility: SinGooCMS.Utility/Linq 目录参考

  • SinGooCMS.Utility
  • Linq
Linq 目录参考
Linq 的目录依赖关系图

文件

文件 PredicateBuilder.cs [代码]


SinGooCMS.Utility: SinGooCMS.Utility/Linq/PredicateBuilder.cs 文件参考

  • 文件列表
  • SinGooCMS.Utility
  • Linq
类 | 命名空间
PredicateBuilder.cs 文件参考

浏览源代码.

类

class | SinGooCMS.Utility.PredicateBuilder
对 Lambda 表达式进行动态拼接的逻辑 更多...
class | SinGooCMS.Utility.ParameterRebinder

命名空间

namespace SinGooCMS.Utility


SinGooCMS.Utility: SinGooCMS.Utility/List 目录参考

  • SinGooCMS.Utility
  • List
List 目录参考
List 的目录依赖关系图

文件

文件 SinGooList.cs [代码]


SinGooCMS.Utility: SinGooCMS.Utility/List/SinGooList.cs 文件参考

  • 文件列表
  • SinGooCMS.Utility
  • List
类 | 命名空间
SinGooList.cs 文件参考

浏览源代码.

类

class | SinGooCMS.Utility.SinGooList< T >
List扩展，实现取范围数据 更多...
class | SinGooCMS.Utility.SinGooArray
ArrayList扩展，实现取范围数据 更多...
class | SinGooCMS.Utility.SinGooDictionary< T1, T2 >
Dictionary扩展，实现从下标取值 更多...

命名空间

namespace SinGooCMS.Utility


SinGooCMS.Utility: SinGooCMS.Utility/Media 目录参考

  • SinGooCMS.Utility
  • Media
Media 目录参考
Media 的目录依赖关系图

文件

文件 | ImageUtils.cs [代码]
文件 | ThumbnailCutMode.cs [代码]
文件 | WatermarkPosition.cs [代码]


SinGooCMS.Utility: SinGooCMS.Utility/Media/ImageUtils.cs 文件参考

  • 文件列表
  • SinGooCMS.Utility
  • Media
类 | 命名空间
ImageUtils.cs 文件参考

浏览源代码.

类

class SinGooCMS.Utility.ImageUtils
图片处理 更多...

命名空间

namespace SinGooCMS.Utility


SinGooCMS.Utility: SinGooCMS.Utility/Media/ThumbnailCutMode.cs 文件参考

  • 文件列表
  • SinGooCMS.Utility
  • Media
命名空间 | 枚举
ThumbnailCutMode.cs 文件参考

浏览源代码.

命名空间

namespace SinGooCMS.Utility

枚举

enum SinGooCMS.Utility.ThumbnailCutMode { SinGooCMS.Utility.ThumbnailCutMode.LockHeight, SinGooCMS.Utility.ThumbnailCutMode.LockWidth, SinGooCMS.Utility.ThumbnailCutMode.Fixed, SinGooCMS.Utility.ThumbnailCutMode.Cut }
缩略图图像裁剪模式 更多...


SinGooCMS.Utility: SinGooCMS.Utility/Media/WatermarkPosition.cs 文件参考

  • 文件列表
  • SinGooCMS.Utility
  • Media
命名空间 | 枚举
WatermarkPosition.cs 文件参考

浏览源代码.

命名空间

namespace SinGooCMS.Utility

枚举

enum SinGooCMS.Utility.WatermarkPosition {
SinGooCMS.Utility.WatermarkPosition.None, SinGooCMS.Utility.WatermarkPosition.TopLeft, SinGooCMS.Utility.WatermarkPosition.TopCenter, SinGooCMS.Utility.WatermarkPosition.TopRight,
SinGooCMS.Utility.WatermarkPosition.MiddleLeft, SinGooCMS.Utility.WatermarkPosition.MiddleCenter, SinGooCMS.Utility.WatermarkPosition.MiddleRight, SinGooCMS.Utility.WatermarkPosition.BottomLeft,
SinGooCMS.Utility.WatermarkPosition.BottomCenter, SinGooCMS.Utility.WatermarkPosition.BottomRight
}
水印位置 更多...


SinGooCMS.Utility: SinGooCMS.Utility/Net 目录参考

  • SinGooCMS.Utility
  • Net
Net 目录参考
Net 的目录依赖关系图

文件

文件 | FtpClient.cs [代码]
文件 | IPScanner.cs [代码]
文件 | IPUtils.cs [代码]
文件 | MailUtils.cs [代码]
文件 | NetWorkUtils.cs [代码]
文件 | SocketClient.cs [代码]


SinGooCMS.Utility: SinGooCMS.Utility/Net/FtpClient.cs 文件参考

  • 文件列表
  • SinGooCMS.Utility
  • Net
类 | 命名空间
FtpClient.cs 文件参考

浏览源代码.

类

class SinGooCMS.Utility.FtpClient
FTP客户端操作类 更多...

命名空间

namespace SinGooCMS.Utility


SinGooCMS.Utility: SinGooCMS.Utility/Net/IPScanner.cs 文件参考

  • 文件列表
  • SinGooCMS.Utility
  • Net
类 | 命名空间
IPScanner.cs 文件参考

浏览源代码.

类

class SinGooCMS.Utility.IPScanner
读取纯真IP数据库，定位IP地址 更多...

命名空间

namespace SinGooCMS.Utility


SinGooCMS.Utility: SinGooCMS.Utility/Net/IPUtils.cs 文件参考

  • 文件列表
  • SinGooCMS.Utility
  • Net
类 | 命名空间
IPUtils.cs 文件参考

浏览源代码.

类

class | SinGooCMS.Utility.IPUtils
IP工具 更多...
class | SinGooCMS.Utility.IPAreaInfo
IP地理位置信息 更多...

命名空间

namespace SinGooCMS.Utility


SinGooCMS.Utility: SinGooCMS.Utility/Net/MailUtils.cs 文件参考

  • 文件列表
  • SinGooCMS.Utility
  • Net
类 | 命名空间
MailUtils.cs 文件参考

浏览源代码.

类

class | SinGooCMS.Utility.MailUtils
class | SinGooCMS.Utility.MailConfig
邮件服务配置 更多...

命名空间

namespace SinGooCMS.Utility


SinGooCMS.Utility: SinGooCMS.Utility/Net/NetWorkUtils.cs 文件参考

  • 文件列表
  • SinGooCMS.Utility
  • Net
类 | 命名空间
NetWorkUtils.cs 文件参考

浏览源代码.

类

class SinGooCMS.Utility.NetWorkUtils
模拟 httpget 和 httppost 更多...

命名空间

namespace SinGooCMS.Utility


SinGooCMS.Utility: SinGooCMS.Utility/Net/SocketClient.cs 文件参考

  • 文件列表
  • SinGooCMS.Utility
  • Net
类 | 命名空间
SocketClient.cs 文件参考

浏览源代码.

类

class SinGooCMS.Utility.SocketClient
Socket客户端操作类 更多...

命名空间

namespace SinGooCMS.Utility


SinGooCMS.Utility: SinGooCMS.Utility/obj 目录参考

  • SinGooCMS.Utility
  • obj
obj 目录参考
obj 的目录依赖关系图

目录

目录 Debug


SinGooCMS.Utility: SinGooCMS.Utility/obj/Debug 目录参考

  • SinGooCMS.Utility
  • obj
  • Debug
Debug 目录参考
Debug 的目录依赖关系图

目录

目录 | net4.6.1
目录 | netstandard2.1


SinGooCMS.Utility: SinGooCMS.Utility/obj/Debug/net4.6.1 目录参考

  • SinGooCMS.Utility
  • obj
  • Debug
  • net4.6.1
net4.6.1 目录参考
net4.6.1 的目录依赖关系图

文件

文件 | .NETFramework,Version=v4.6.1.AssemblyAttributes.cs [代码]
文件 | SinGooCMS.Utility.AssemblyInfo.cs [代码]


SinGooCMS.Utility: SinGooCMS.Utility/obj/Debug/net4.6.1/.NETFramework,Version=v4.6.1.AssemblyAttributes.cs 文件参考

  • 文件列表
  • SinGooCMS.Utility
  • obj
  • Debug
  • net4.6.1
.NETFramework,Version=v4.6.1.AssemblyAttributes.cs 文件参考

浏览源代码.


SinGooCMS.Utility: SinGooCMS.Utility/obj/Debug/net4.6.1/SinGooCMS.Utility.AssemblyInfo.cs 文件参考

  • 文件列表
  • SinGooCMS.Utility
  • obj
  • Debug
  • net4.6.1
SinGooCMS.Utility.AssemblyInfo.cs 文件参考

浏览源代码.


SinGooCMS.Utility: SinGooCMS.Utility/obj/Debug/netstandard2.1 目录参考

  • SinGooCMS.Utility
  • obj
  • Debug
  • netstandard2.1
netstandard2.1 目录参考
netstandard2.1 的目录依赖关系图

文件

文件 | .NETStandard,Version=v2.1.AssemblyAttributes.cs [代码]
文件 | SinGooCMS.Utility.AssemblyInfo.cs [代码]


SinGooCMS.Utility: SinGooCMS.Utility/obj/Debug/netstandard2.1/.NETStandard,Version=v2.1.AssemblyAttributes.cs 文件参考

  • 文件列表
  • SinGooCMS.Utility
  • obj
  • Debug
  • netstandard2.1
.NETStandard,Version=v2.1.AssemblyAttributes.cs 文件参考

浏览源代码.


SinGooCMS.Utility: SinGooCMS.Utility/obj/Debug/netstandard2.1/SinGooCMS.Utility.AssemblyInfo.cs 文件参考

  • 文件列表
  • SinGooCMS.Utility
  • obj
  • Debug
  • netstandard2.1
SinGooCMS.Utility.AssemblyInfo.cs 文件参考

浏览源代码.


SinGooCMS.Utility: SinGooCMS.Utility/Pager 目录参考

  • SinGooCMS.Utility
  • Pager
Pager 目录参考
Pager 的目录依赖关系图

文件

文件 | PagerModel.cs [代码]
文件 | PagerUtils.cs [代码]
文件 | QueryExtension.cs [代码]


SinGooCMS.Utility: SinGooCMS.Utility/Pager/PagerModel.cs 文件参考

  • 文件列表
  • SinGooCMS.Utility
  • Pager
类 | 命名空间
PagerModel.cs 文件参考

浏览源代码.

类

class SinGooCMS.Utility.PagerModel< T >
分页模型 更多...

命名空间

namespace SinGooCMS.Utility


SinGooCMS.Utility: SinGooCMS.Utility/Pager/PagerUtils.cs 文件参考

  • 文件列表
  • SinGooCMS.Utility
  • Pager
类 | 命名空间
PagerUtils.cs 文件参考

浏览源代码.

类

class SinGooCMS.Utility.PagerUtils
分页栏工具 更多...

命名空间

namespace SinGooCMS.Utility


SinGooCMS.Utility: SinGooCMS.Utility/Pager/QueryExtension.cs 文件参考

  • 文件列表
  • SinGooCMS.Utility
  • Pager
类 | 命名空间
QueryExtension.cs 文件参考

浏览源代码.

类

class SinGooCMS.Utility.QueryExtension
查询并分页 更多...

命名空间

namespace SinGooCMS.Utility


SinGooCMS.Utility: SinGooCMS.Utility/Reflection 目录参考

  • SinGooCMS.Utility
  • Reflection
Reflection 目录参考
Reflection 的目录依赖关系图

文件

文件 | LibInvoker.cs [代码]
文件 | ReflectionUtils.cs [代码]


SinGooCMS.Utility: SinGooCMS.Utility/Reflection/LibInvoker.cs 文件参考

  • 文件列表
  • SinGooCMS.Utility
  • Reflection
类 | 命名空间
LibInvoker.cs 文件参考

浏览源代码.

类

class SinGooCMS.Utility.LibInvoker
非托管方法调用 更多...

命名空间

namespace SinGooCMS.Utility


SinGooCMS.Utility: SinGooCMS.Utility/Reflection/ReflectionUtils.cs 文件参考

  • 文件列表
  • SinGooCMS.Utility
  • Reflection
类 | 命名空间
ReflectionUtils.cs 文件参考

浏览源代码.

类

class SinGooCMS.Utility.ReflectionUtils
反射操作 更多...

命名空间

namespace SinGooCMS.Utility


SinGooCMS.Utility: SinGooCMS.Utility/Result 目录参考

  • SinGooCMS.Utility
  • Result
Result 目录参考
Result 的目录依赖关系图

文件

文件 OperationResult.cs [代码]


SinGooCMS.Utility: SinGooCMS.Utility/Result/OperationResult.cs 文件参考

  • 文件列表
  • SinGooCMS.Utility
  • Result
类 | 命名空间
OperationResult.cs 文件参考

浏览源代码.

类

class SinGooCMS.Utility.OperationResult
操作返回结果
<exsample> "ReturnStatusType": 1, —返回状态类型
"StatusCode": "200", —错误信息代码
"ErrorMessage": "操作成功", —错误信息
"ErrorENMessage": "ok", —英文错误信息
"TimeStamp": "2020-01-06 12:13:14", —当前时间 </exsample> 更多...

命名空间

namespace SinGooCMS.Utility


SinGooCMS.Utility: SinGooCMS.Utility/Security 目录参考

  • SinGooCMS.Utility
  • Security
Security 目录参考
Security 的目录依赖关系图

文件

文件 | DEncryptUtils.cs [代码]
文件 | RSACryption.cs [代码]


SinGooCMS.Utility: SinGooCMS.Utility/Security/DEncryptUtils.cs 文件参考

  • 文件列表
  • SinGooCMS.Utility
  • Security
类 | 命名空间
DEncryptUtils.cs 文件参考

浏览源代码.

类

class SinGooCMS.Utility.DEncryptUtils
加密解密工具 更多...

命名空间

namespace SinGooCMS.Utility


SinGooCMS.Utility: SinGooCMS.Utility/Security/RSACryption.cs 文件参考

  • 文件列表
  • SinGooCMS.Utility
  • Security
类 | 命名空间
RSACryption.cs 文件参考

浏览源代码.

类

class SinGooCMS.Utility.RSACryption

命名空间

namespace SinGooCMS.Utility


SinGooCMS.Utility: SinGooCMS.Utility/String 目录参考

  • SinGooCMS.Utility
  • String
String 目录参考
String 的目录依赖关系图

文件

文件 StringUtils.cs [代码]


SinGooCMS.Utility: SinGooCMS.Utility/String/StringUtils.cs 文件参考

  • 文件列表
  • SinGooCMS.Utility
  • String
类 | 命名空间
StringUtils.cs 文件参考

浏览源代码.

类

class SinGooCMS.Utility.StringUtils
字符串处理 更多...

命名空间

namespace SinGooCMS.Utility


SinGooCMS.Utility: SinGooCMS.Utility/System 目录参考

  • SinGooCMS.Utility
  • System
System 目录参考
System 的目录依赖关系图

文件

文件 | EnumUtils.cs [代码]
文件 | IISUtils.cs [代码]
文件 | ProcessUtils.cs [代码]
文件 | RegistryUtils.cs [代码]
文件 | StopwatchUtils.cs [代码]
文件 | SystemUtils.cs [代码]


SinGooCMS.Utility: SinGooCMS.Utility/System/EnumUtils.cs 文件参考

  • 文件列表
  • SinGooCMS.Utility
  • System
类 | 命名空间
EnumUtils.cs 文件参考

浏览源代码.

类

class SinGooCMS.Utility.EnumUtils
枚举帮助类 更多...

命名空间

namespace SinGooCMS.Utility


SinGooCMS.Utility: SinGooCMS.Utility/System/IISUtils.cs 文件参考

  • 文件列表
  • SinGooCMS.Utility
  • System
类 | 命名空间
IISUtils.cs 文件参考

浏览源代码.

类

class SinGooCMS.Utility.IISUtils
IIS操作 更多...

命名空间

namespace SinGooCMS.Utility


SinGooCMS.Utility: SinGooCMS.Utility/System/ProcessUtils.cs 文件参考

  • 文件列表
  • SinGooCMS.Utility
  • System
类 | 命名空间
ProcessUtils.cs 文件参考

浏览源代码.

类

class SinGooCMS.Utility.ProcessUtils
执行系统进程 更多...

命名空间

namespace SinGooCMS.Utility


SinGooCMS.Utility: SinGooCMS.Utility/System/RegistryUtils.cs 文件参考

  • 文件列表
  • SinGooCMS.Utility
  • System
类 | 命名空间
RegistryUtils.cs 文件参考

浏览源代码.

类

class SinGooCMS.Utility.RegistryUtils
注册表操作，Win平台专有(需要有管理员权限) 更多...

命名空间

namespace SinGooCMS.Utility


SinGooCMS.Utility: SinGooCMS.Utility/System/StopwatchUtils.cs 文件参考

  • 文件列表
  • SinGooCMS.Utility
  • System
类 | 命名空间
StopwatchUtils.cs 文件参考

浏览源代码.

类

class SinGooCMS.Utility.StopwatchUtils
计数器帮助类 更多...

命名空间

namespace SinGooCMS.Utility


SinGooCMS.Utility: SinGooCMS.Utility/System/SystemUtils.cs 文件参考

  • 文件列表
  • SinGooCMS.Utility
  • System
SystemUtils.cs 文件参考

浏览源代码.


SinGooCMS.Utility: SinGooCMS.Utility/Text 目录参考

  • SinGooCMS.Utility
  • Text
Text 目录参考
Text 的目录依赖关系图

文件

文件 | CellPhonePrefix.cs [代码]
文件 | HexUtils.cs [代码]
文件 | UnicodeUtils.cs [代码]


SinGooCMS.Utility: SinGooCMS.Utility/Text/CellPhonePrefix.cs 文件参考

  • 文件列表
  • SinGooCMS.Utility
  • Text
类 | 命名空间
CellPhonePrefix.cs 文件参考

浏览源代码.

类

class SinGooCMS.Utility.CellPhonePrefix
手机号码前缀 更多...

命名空间

namespace SinGooCMS.Utility


SinGooCMS.Utility: SinGooCMS.Utility/Text/HexUtils.cs 文件参考

  • 文件列表
  • SinGooCMS.Utility
  • Text
类 | 命名空间
HexUtils.cs 文件参考

浏览源代码.

类

class SinGooCMS.Utility.HexUtils
16进制字符串之间的转换帮助类. 更多...

命名空间

namespace SinGooCMS.Utility


SinGooCMS.Utility: SinGooCMS.Utility/Text/UnicodeUtils.cs 文件参考

  • 文件列表
  • SinGooCMS.Utility
  • Text
类 | 命名空间
UnicodeUtils.cs 文件参考

浏览源代码.

类

class SinGooCMS.Utility.UnicodeUtils
unicode 编解码
"空\u0020格" => "空 格"
"空 格" => "\u7a7a\u20\u683c" 更多...

命名空间

namespace SinGooCMS.Utility


SinGooCMS.Utility: SinGooCMS.Utility/Web 目录参考

  • SinGooCMS.Utility
  • Web
Web 目录参考
Web 的目录依赖关系图

文件

文件 | CacheUtils.cs [代码]
文件 | CookieUtils.cs [代码]
文件 | ExceptionUtils.cs [代码]
文件 | SessionUtils.cs [代码]
文件 | WebUtils.cs [代码]


SinGooCMS.Utility: SinGooCMS.Utility/Web/CacheUtils.cs 文件参考

  • 文件列表
  • SinGooCMS.Utility
  • Web
类 | 命名空间
CacheUtils.cs 文件参考

浏览源代码.

类

class SinGooCMS.Utility.CacheUtils
缓存管理 更多...

命名空间

namespace SinGooCMS.Utility


SinGooCMS.Utility: SinGooCMS.Utility/Web/CookieUtils.cs 文件参考

  • 文件列表
  • SinGooCMS.Utility
  • Web
类 | 命名空间
CookieUtils.cs 文件参考

浏览源代码.

类

class SinGooCMS.Utility.CookieUtils
cookie工具 更多...

命名空间

namespace SinGooCMS.Utility


SinGooCMS.Utility: SinGooCMS.Utility/Web/ExceptionUtils.cs 文件参考

  • 文件列表
  • SinGooCMS.Utility
  • Web
类 | 命名空间
ExceptionUtils.cs 文件参考

浏览源代码.

类

class SinGooCMS.Utility.ExceptionUtils
异常信息格式化 更多...

命名空间

namespace SinGooCMS.Utility


SinGooCMS.Utility: SinGooCMS.Utility/Web/SessionUtils.cs 文件参考

  • 文件列表
  • SinGooCMS.Utility
  • Web
类 | 命名空间
SessionUtils.cs 文件参考

浏览源代码.

类

class SinGooCMS.Utility.SessionUtils
session会话工具 更多...

命名空间

namespace SinGooCMS.Utility


SinGooCMS.Utility: SinGooCMS.Utility/Web/WebUtils.cs 文件参考

  • 文件列表
  • SinGooCMS.Utility
  • Web
类 | 命名空间
WebUtils.cs 文件参考

浏览源代码.

类

class SinGooCMS.Utility.WebUtils
web工具 更多...

命名空间

namespace SinGooCMS.Utility


SinGooCMS.Utility: SinGooCMS.Utility/Xml 目录参考

  • SinGooCMS.Utility
  • Xml
Xml 目录参考
Xml 的目录依赖关系图

文件

文件 XmlUtils.cs [代码]


SinGooCMS.Utility: SinGooCMS.Utility/Xml/XmlUtils.cs 文件参考

  • 文件列表
  • SinGooCMS.Utility
  • Xml
类 | 命名空间
XmlUtils.cs 文件参考

浏览源代码.

类

class SinGooCMS.Utility.XmlUtils
xml工具 更多...

命名空间

namespace SinGooCMS.Utility


SinGooCMS.Utility: SinGooCMS.Utility/UtilsBase.cs 文件参考

  • 文件列表
  • SinGooCMS.Utility
类 | 命名空间
UtilsBase.cs 文件参考

浏览源代码.

类

class SinGooCMS.Utility.UtilsBase
工具底层，主要获取 http上下文 HttpContext。netfx从system.web中读取，core需要注入 更多...

命名空间

namespace SinGooCMS.Utility


SinGooCMS.Utility: SinGooCMS.Utility/obj/Debug/net4.6.1/.NETFramework,Version=v4.6.1.AssemblyAttributes.cs 源文件

  • 文件列表
  • SinGooCMS.Utility
  • obj
  • Debug
  • net4.6.1
.NETFramework,Version=v4.6.1.AssemblyAttributes.cs
浏览该文件的文档.
1 // <autogenerated />
2 using System;
3 using System.Reflection;
4 [assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETFramework,Version=v4.6.1", FrameworkDisplayName = ".NET Framework 4.6.1")]
System


SinGooCMS.Utility: SinGooCMS.Utility/obj/Debug/netstandard2.1/.NETStandard,Version=v2.1.AssemblyAttributes.cs 源文件

  • 文件列表
  • SinGooCMS.Utility
  • obj
  • Debug
  • netstandard2.1
.NETStandard,Version=v2.1.AssemblyAttributes.cs
浏览该文件的文档.
1 // <autogenerated />
2 using System;
3 using System.Reflection;
4 [assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETStandard,Version=v2.1", FrameworkDisplayName = "")]
System


SinGooCMS.Utility: SinGooCMS.Utility/Accessors/Accessor.cs 源文件

  • 文件列表
  • SinGooCMS.Utility
  • Accessors
Accessor.cs
浏览该文件的文档.
1 using System;
2 using System.Collections.Generic;
3 using System.Diagnostics;
4 using System.Reflection;
5
6 namespace SinGooCMS.Utility
7 {
12 public abstract class Accessor
13 {
26 protected Accessor(IReflect type, bool ignoreCase, bool includeNonPublic)
27 {
28 Type = type;
29 IgnoreCase = ignoreCase;
30 IncludesNonPublic = includeNonPublic;
31
32 Comparer = IgnoreCase ? StringComparer.OrdinalIgnoreCase : StringComparer.Ordinal;
33
34 var flags = BindingFlags.Public | BindingFlags.Instance;
35 if (IncludesNonPublic)
36 {
37 flags = flags | BindingFlags.NonPublic;
38 }
39
40 var props = Type.GetProperties(flags);
41 Properties = new SortedList<string, PropertyInfo>(props.Length, Comparer);
42 foreach (var prop in props)
43 {
44 Properties[prop.Name] = prop;
45 }
46 }
47
51 protected StringComparer Comparer { get; }
52
56 public IReflect Type { get; }
57
61 public bool IgnoreCase { get; }
62
66 public bool IncludesNonPublic { get; }
67
71 public SortedList<string, PropertyInfo> Properties { get; }
72
79 [DebuggerStepThrough]
80 public static ObjectAccessor Build(object instance, bool ignoreCase = false, bool includeNonPublic = false)
81 {
82 return Build(instance.GetType(), ignoreCase, includeNonPublic);
83 }
84
91 [DebuggerStepThrough]
92 public static ObjectAccessor Build(Type instanceType, bool ignoreCase = false, bool includeNonPublic = false)
93 {
94 return new ObjectAccessor(instanceType, ignoreCase, includeNonPublic);
95 }
96
103 [DebuggerStepThrough]
104 public static GenericAccessor<TInstance> Build<TInstance>(
105 bool ignoreCase = false, bool includeNonPublic = false) where TInstance : class
106 => new GenericAccessor<TInstance>(ignoreCase, includeNonPublic);
107 }
108 }
SinGooCMS.Utility.Accessor.Accessor
Accessor(IReflect type, bool ignoreCase, bool includeNonPublic)
用户创建Accessor类型的实例
Definition: Accessor.cs:26
System
SinGooCMS.Utility.GenericAccessor
快速访问给定类型的对象的属性值, 参照: Accessor
Definition: GenericAccessor.cs:13
SinGooCMS.Utility.Accessor.Build
static ObjectAccessor Build(object instance, bool ignoreCase=false, bool includeNonPublic=false)
根据给定的对象创建ObjectAccessor实例
Definition: Accessor.cs:80
SinGooCMS
SinGooCMS.Utility.Accessor
用于构建ObjectAccessor和 GenericAccessor实例。
Definition: Accessor.cs:12
SinGooCMS.Utility.Accessor.Build
static ObjectAccessor Build(Type instanceType, bool ignoreCase=false, bool includeNonPublic=false)
根据给定的对象类型创建ObjectAccessor实例
Definition: Accessor.cs:92
SinGooCMS.Utility.ObjectAccessor
快速访问给定类型的对象的属性值, 参照: Accessor
Definition: ObjectAccessor.cs:11


SinGooCMS.Utility: SinGooCMS.Utility/Accessors/AccessorBuilder.cs 源文件

  • 文件列表
  • SinGooCMS.Utility
  • Accessors
AccessorBuilder.cs
浏览该文件的文档.
1 using SinGooCMS.Utility.Extension;
2 using System;
3 using System.Linq.Expressions;
4 using System.Reflection;
5 using System.Reflection.Emit;
6
7 namespace SinGooCMS.Utility
8 {
12 public static class AccessorBuilder
13 {
19 public static Action<TInstance, TProperty> BuildSetter<TInstance, TProperty>(string propertyName, bool includePrivate = false) where TInstance : class
20 {
21 if (!typeof(TInstance).TryGetInstanceProperty(propertyName, out PropertyInfo propInfo))
22 {
23 throw new InvalidOperationException("Unable to find property: " + propertyName + ".");
24 }
25 return BuildSetter<TInstance, TProperty>(propInfo, includePrivate);
26 }
27
33 public static Action<TInstance, TProperty> BuildSetter<TInstance, TProperty>(PropertyInfo propertyInfo, bool includePrivate = false) where TInstance : class
34 {
35 if (!propertyInfo.CanWrite)
36 {
37 throw new ArgumentException($"Property: `{propertyInfo.Name}` of type: `{propertyInfo.ReflectedType?.FullName}` does not support writing.");
38 }
39
40 var setMethod = propertyInfo.GetSetMethod(includePrivate);
41 return (Action<TInstance, TProperty>)Delegate.CreateDelegate(typeof(Action<TInstance, TProperty>), setMethod);
42 }
43
49 public static Func<TInstance, TProperty> BuildGetter<TInstance, TProperty>(string propertyName, bool includePrivate = false) where TInstance : class
50 {
51 if (!typeof(TInstance).TryGetInstanceProperty(propertyName, out PropertyInfo propInfo))
52 {
53 throw new InvalidOperationException("Unable to find property: " + propertyName + ".");
54 }
55 return BuildGetter<TInstance, TProperty>(propInfo, includePrivate);
56 }
57
63 public static Func<TInstance, TProperty> BuildGetter<TInstance, TProperty>(PropertyInfo propertyInfo, bool includePrivate = false) where TInstance : class
64 {
65 if (!propertyInfo.CanRead)
66 {
67 throw new ArgumentException($"Property: `{propertyInfo.Name}` of type: `{propertyInfo.ReflectedType?.FullName}` does not support reading.");
68 }
69
70 var getMethod = propertyInfo.GetGetMethod(includePrivate);
71 return (Func<TInstance, TProperty>)Delegate.CreateDelegate(typeof(Func<TInstance, TProperty>), getMethod);
72 }
73
79 public static Action<object, object> BuildSetter(PropertyInfo propertyInfo, bool includePrivate = false)
80 {
81 var instanceType = propertyInfo.ReflectedType;
82
83 if (!propertyInfo.CanWrite)
84 {
85 throw new ArgumentException($"Property: `{propertyInfo.Name}` of type: `{instanceType?.FullName}` does not support writing.");
86 }
87
88 var setMethod = propertyInfo.GetSetMethod(includePrivate);
89 var typeofObject = typeof(object);
90
91 var instance = Expression.Parameter(typeofObject, "instance");
92 var value = Expression.Parameter(typeofObject, "value");
93
94 // value as T is slightly faster than (T)value, so if it's not a value type, use that
95 var instanceCast = !instanceType.GetTypeInfo().IsValueType
96 ? Expression.TypeAs(instance, instanceType)
97 : Expression.Convert(instance, instanceType);
98
99 var valueCast = !propertyInfo.PropertyType.GetTypeInfo().IsValueType
100 ? Expression.TypeAs(value, propertyInfo.PropertyType)
101 : Expression.Convert(value, propertyInfo.PropertyType);
102
103 return Expression.Lambda<Action<object, object>>(
104 Expression.Call(instanceCast, setMethod, valueCast), instance, value).Compile();
105 }
106
112 public static Func<object, object> BuildGetter(PropertyInfo propertyInfo, bool includePrivate = false)
113 {
114 var instanceType = propertyInfo.ReflectedType;
115 if (!propertyInfo.CanRead)
116 {
117 throw new ArgumentException($"Property: `{propertyInfo.Name}` of type: `{instanceType?.FullName}` does not support reading.");
118 }
119
120 var getMethod = propertyInfo.GetGetMethod(includePrivate);
121 var typeofObject = typeof(object);
122
123 var instance = Expression.Parameter(typeofObject, "instance");
124 var isValueType = instanceType.GetTypeInfo().IsValueType;
125 var instanceCast = !isValueType
126 ? Expression.TypeAs(instance, instanceType)
127 : Expression.Convert(instance, instanceType);
128
129 return Expression.Lambda<Func<object, object>>(
130 Expression.TypeAs(Expression.Call(instanceCast, getMethod), typeofObject), instance).Compile();
131 }
132
138 public static Action<TInstance, object> BuildSetter<TInstance>(string propertyName, bool includePrivate = false) where TInstance : class
139 {
140 if (!typeof(TInstance).TryGetInstanceProperty(propertyName, out PropertyInfo propInfo))
141 {
142 throw new InvalidOperationException("Unable to find property: " + propertyName + ".");
143 }
144
145 return BuildSetter<TInstance>(propInfo, includePrivate);
146 }
147
153 public static Action<TInstance, object> BuildSetter<TInstance>(PropertyInfo propertyInfo, bool includePrivate = false) where TInstance : class
154 {
155 if (!propertyInfo.CanWrite)
156 {
157 throw new ArgumentException($"Property: `{propertyInfo.Name}` of type: `{propertyInfo.ReflectedType?.FullName}` does not support writing.");
158 }
159
160 var setMethod = propertyInfo.GetSetMethod(includePrivate);
161
162 var instance = Expression.Parameter(typeof(TInstance), "instance");
163 var value = Expression.Parameter(typeof(object), "value");
164 var isValueType = propertyInfo.PropertyType.GetTypeInfo().IsValueType;
165 var valueCast = !isValueType
166 ? Expression.TypeAs(value, propertyInfo.PropertyType)
167 : Expression.Convert(value, propertyInfo.PropertyType);
168
169 return Expression.Lambda<Action<TInstance, object>>(
170 Expression.Call(instance, setMethod, valueCast), instance, value).Compile();
171 }
172
178 public static Func<TInstance, object> BuildGetter<TInstance>(string propertyName, bool includePrivate = false)
179 {
180 if (!typeof(TInstance).TryGetInstanceProperty(propertyName, out PropertyInfo propInfo))
181 {
182 throw new InvalidOperationException("Unable to find property: " + propertyName + ".");
183 }
184
185 return BuildGetter<TInstance>(propInfo, includePrivate);
186 }
187
193 public static Func<TInstance, object> BuildGetter<TInstance>(PropertyInfo propertyInfo, bool includePrivate = false)
194 {
195 if (!propertyInfo.CanRead)
196 {
197 throw new ArgumentException($"Property: `{propertyInfo.Name}` of type: `{propertyInfo.ReflectedType?.FullName}` does not support reading.");
198 }
199
200 var getMethod = propertyInfo.GetGetMethod(includePrivate);
201
202 var instance = Expression.Parameter(typeof(TInstance), "instance");
203 return Expression.Lambda<Func<TInstance, object>>(
204 Expression.TypeAs(Expression.Call(instance, getMethod), typeof(object)), instance).Compile();
205 }
206
210 public static Func<TInstance> BuildInstanceCreator<TInstance>() where TInstance : new()
211 {
212 var type = typeof(TInstance);
213
214 var dynamicMethod = new DynamicMethod("Build_" + type.Name, type, new Type[0], typeof(AccessorBuilder).Module, true);
215 var ilGen = dynamicMethod.GetILGenerator();
216
217 var defaultCtor = type.GetConstructor(Type.EmptyTypes);
218 if (defaultCtor != null)
219 {
220 // Call the ctor, all values on the stack are passed to the ctor
221 ilGen.Emit(OpCodes.Newobj, defaultCtor);
222 }
223 else
224 {
225 var builder = ilGen.DeclareLocal(type);
226 ilGen.Emit(OpCodes.Ldloca, builder);
227 ilGen.Emit(OpCodes.Initobj, type);
228 ilGen.Emit(OpCodes.Ldloc, builder);
229 }
230
231 // Return the new object
232 ilGen.Emit(OpCodes.Ret);
233
234 return (Func<TInstance>)dynamicMethod.CreateDelegate(typeof(Func<TInstance>));
235 }
236
246 public static Func<object[], TInstance> BuildInstanceCreator<TInstance>(ConstructorInfo constructor)
247 {
248 var type = typeof(TInstance);
249
250 var ctroParams = constructor.GetParameters();
251
252 var dynamicMethod = new DynamicMethod("Build_" + type.Name, type, new[] { typeof(object[]) }, typeof(AccessorBuilder).Module, true);
253 var ilGen = dynamicMethod.GetILGenerator();
254
255 // Cast each argument of the input object array to the appropriate type.
256 for (var i = 0; i < ctroParams.Length; i++)
257 {
258 ilGen.Emit(OpCodes.Ldarg_0); // Push Object array
259 ilGen.Emit(OpCodes.Ldc_I4, i); // Push the index to access
260 ilGen.Emit(OpCodes.Ldelem_Ref); // Push the element at the previously loaded index
261
262 // Cast the object to the appropriate ctor Parameter Type
263 var paramType = ctroParams[i].ParameterType;
264 var isValueType = paramType.GetTypeInfo().IsValueType;
265 ilGen.Emit(isValueType ? OpCodes.Unbox_Any : OpCodes.Castclass, paramType);
266 }
267
268 // Call the ctor, all values on the stack are passed to the ctor
269 ilGen.Emit(OpCodes.Newobj, constructor);
270 // Return the new object
271 ilGen.Emit(OpCodes.Ret);
272
273 return (Func<object[], TInstance>)dynamicMethod.CreateDelegate(typeof(Func<object[], TInstance>));
274 }
275 }
276 }
SinGooCMS.Utility
Definition: Accessor.cs:6
System
SinGooCMS.Utility.Extension
Definition: AssemblyExtensions.cs:8
SinGooCMS.Utility.AccessorBuilder.BuildGetter
static Func< object, object > BuildGetter(PropertyInfo propertyInfo, bool includePrivate=false)
根据给定属性信息获取属性的读取逻辑
Definition: AccessorBuilder.cs:112
SinGooCMS.Utility.AccessorBuilder.BuildSetter
static Action< object, object > BuildSetter(PropertyInfo propertyInfo, bool includePrivate=false)
根据给定属性信息获取属性的写入逻辑
Definition: AccessorBuilder.cs:79
SinGooCMS
SinGooCMS.Utility.AccessorBuilder
提供一系列快速构建Accessor实例的方法
Definition: AccessorBuilder.cs:12


SinGooCMS.Utility: SinGooCMS.Utility/Data/AdoUtils.cs 源文件

  • 文件列表
  • SinGooCMS.Utility
  • Data
AdoUtils.cs
浏览该文件的文档.
1 using System;
2 using System.Collections.Generic;
3 using System.Text;
4 using SinGooCMS.Utility.Extension;
5 using System.Linq;
6
7 #if NETSTANDARD2_1
8 using Microsoft.Data.SqlClient;
9 #else
10 using System.Data.SqlClient;
11 #endif
12
13 namespace SinGooCMS.Utility
14 {
18 public static class AdoUtils
19 {
25 public static bool IsConnected(string connStr)
26 {
27 using (var conn = new SqlConnection(connStr))
28 {
29 conn.Open();
30 return conn.State==System.Data.ConnectionState.Open;
31 }
32 }
33
41 public static SqlParameter[] ToSqlParams<T>(this T model, Dictionary<string, (string SqlParamName, bool IsOutput)> dictParamKeys) where T : class, new()
42 {
43 if (dictParamKeys != null && dictParamKeys.Count > 0)
44 {
45 var parameters = new List<SqlParameter>();
46 var pi = typeof(T).GetProperties();
47
48 foreach (KeyValuePair<string, (string, bool)> item in dictParamKeys)
49 {
50 var param = new SqlParameter();
51 param.ParameterName = item.Value.Item1;
52
53 var pi_param = pi.Where(p => p.Name == item.Key).FirstOrDefault();
54 if (pi_param != null)
55 {
56 switch (pi_param.PropertyType.Name)
57 {
58 case "Byte":
59 param.Value = model.GetPropertyVal<byte>(item.Key);
60 break;
61 case "Int16":
62 param.Value = model.GetPropertyVal<short>(item.Key);
63 break;
64 case "Int32":
65 param.Value = model.GetPropertyVal<int>(item.Key);
66 break;
67 case "Int64":
68 param.Value = model.GetPropertyVal<long>(item.Key);
69 break;
70 case "Single":
71 param.Value = model.GetPropertyVal<float>(item.Key);
72 break;
73 case "Double":
74 param.Value = model.GetPropertyVal<double>(item.Key);
75 break;
76 case "Decimal":
77 param.Value = model.GetPropertyVal<decimal>(item.Key);
78 break;
79 case "Boolean":
80 param.Value = model.GetPropertyVal<bool>(item.Key);
81 break;
82 case "DateTime":
83 param.Value = model.GetPropertyVal<DateTime>(item.Key);
84 break;
85 case "String":
86 default:
87 param.Value = model.GetPropertyVal<string>(item.Key);
88 break;
89 }
90 }
91
92 param.Direction = item.Value.Item2
93 ? System.Data.ParameterDirection.Output
94 : System.Data.ParameterDirection.Input;
95
96 parameters.Add(param);
97 }
98
99 return parameters.ToArray();
100 }
101
102 return null;
103 }
104 }
105 }
SinGooCMS.Utility
Definition: Accessor.cs:6
System
SinGooCMS.Utility.Extension
Definition: AssemblyExtensions.cs:8
SinGooCMS.Utility.AdoUtils.IsConnected
static bool IsConnected(string connStr)
是否连接
Definition: AdoUtils.cs:25
SinGooCMS
SinGooCMS.Utility.AdoUtils
这里只提供SqlServer的简单操作，具体可参考SinGooCMS.Ado
Definition: AdoUtils.cs:18


SinGooCMS.Utility: SinGooCMS.Utility/Extension/AssemblyExtensions.cs 源文件

  • 文件列表
  • SinGooCMS.Utility
  • Extension
AssemblyExtensions.cs
浏览该文件的文档.
1 using System;
2 using System.Diagnostics;
3 using System.IO;
4 using System.Linq;
5 using System.Reflection;
6 using System.Runtime.Versioning;
7
8 namespace SinGooCMS.Utility.Extension
9 {
13 public static class AssemblyExtension
14 {
19 public static string GetFrameworkVersion(this Assembly assembly)
20 {
21 var targetFrameAttribute = assembly.GetCustomAttributes(true)
22 .OfType<TargetFrameworkAttribute>().FirstOrDefault();
23
24 if (targetFrameAttribute is null) { return ".NET 2, 3 or 3.5"; }
25
26 return targetFrameAttribute.FrameworkName;
27 }
28
32 public static DirectoryInfo GetAssemblyLocation(this Assembly assembly)
33 {
34 return new DirectoryInfo(Path.GetDirectoryName(assembly.Location) ?? throw new InvalidOperationException());
35 }
36
40 public static DirectoryInfo GetAssemblyCodeBase(this Assembly assembly)
41 {
42 var uri = new Uri(assembly.CodeBase);
43 return new DirectoryInfo(Path.GetDirectoryName(uri.LocalPath));
44 }
45
49 public static bool IsOptimized(this Assembly assembly)
50 {
51 var attributes = assembly.GetCustomAttributes(typeof(DebuggableAttribute), false);
52
53 if (attributes.Length == 0) { return true; }
54
55 foreach (Attribute attr in attributes)
56 {
57 if (attr is DebuggableAttribute d)
58 {
59 // FYI
60 // "Run time Optimizer is enabled: " + !d.IsJITOptimizerDisabled
61 // "Run time Tracking is enabled: " + d.IsJITTrackingEnabled
62 return !d.IsJITOptimizerDisabled;
63 }
64 }
65 return false;
66 }
67
71 public static bool Is32Bit(this Assembly assembly)
72 {
73 var location = assembly.Location;
74 if (location.IsNullOrEmpty()) { location = assembly.CodeBase; }
75
76 var uri = new Uri(location);
77 var assemblyName = AssemblyName.GetAssemblyName(uri.LocalPath);
78 return assemblyName.ProcessorArchitecture == ProcessorArchitecture.X86;
79 }
80 }
81 }
SinGooCMS.Utility.Extension.AssemblyExtension.IsOptimized
static bool IsOptimized(this Assembly assembly)
当前程序集是否以Release模式编译 参照
Definition: AssemblyExtensions.cs:49
System
SinGooCMS.Utility.Extension.AssemblyExtension.Is32Bit
static bool Is32Bit(this Assembly assembly)
当前程序集是否是32位
Definition: AssemblyExtensions.cs:71
SinGooCMS.Utility.Extension.AssemblyExtension.GetFrameworkVersion
static string GetFrameworkVersion(this Assembly assembly)
获取程序集标记的 .net 版本
Definition: AssemblyExtensions.cs:19
SinGooCMS.Utility.Extension.AssemblyExtension.GetAssemblyCodeBase
static DirectoryInfo GetAssemblyCodeBase(this Assembly assembly)
获取程序集文件所在的目录 从 Assembly.CodeBase处实现
Definition: AssemblyExtensions.cs:40
SinGooCMS.Utility.Extension.AssemblyExtension
Assembly扩展类
Definition: AssemblyExtensions.cs:13
SinGooCMS
SinGooCMS.Utility.Extension.AssemblyExtension.GetAssemblyLocation
static DirectoryInfo GetAssemblyLocation(this Assembly assembly)
获取程序集文件所在的目录 从 Assembly.Location处获取
Definition: AssemblyExtensions.cs:32


SinGooCMS.Utility: SinGooCMS.Utility/Extension/AttributeExtension.cs 源文件

  • 文件列表
  • SinGooCMS.Utility
  • Extension
AttributeExtension.cs
浏览该文件的文档.
1 using System;
2 using System.Collections.Generic;
3 using System.ComponentModel;
4 using System.Globalization;
5 using System.Linq;
6 using System.Resources;
7 using System.Text;
8
9 #if NETSTANDARD2_1
10 using Microsoft.AspNetCore.Routing;
11 #endif
12
13 namespace SinGooCMS.Utility.Extension
14 {
22 public class DisplayExtAttribute : DisplayNameAttribute
23 {
27 public string Name { get; set; }
31 public string ResName { get; set; }
35 public Type ResourceType { get; set; }
39 public bool IsReadRes { get; set; } = true;
40
44 public DisplayExtAttribute() { }
45
53 public DisplayExtAttribute(string _name, string _resName, Type _resType, bool _isReadRes = true)
54 {
55 this.Name = _name;
56 this.ResName = _resName;
57 this.ResourceType = _resType;
58 this.IsReadRes = _isReadRes;
59 }
60
64 public override string DisplayName
65 {
66 get
67 {
68 //会读取默认的语言包，加个开关防止读资源
69 if (IsReadRes)
70 {
71 if (!string.IsNullOrEmpty(ResName))
72 {
73 var lang = ""; //从系统中读当前语种
74 #if NETSTANDARD2_1
75 lang = UtilsBase.HttpContext.GetRouteValue("lang")?.ToString();
76 #else
77 var route = System.Web.HttpContext.Current.Request.RequestContext.RouteData;
78 if (route != null && route.Values.Keys.Contains("lang"))
79 {
80 lang = route.Values["lang"].ToString();
81 }
82 #endif
83
84 ResourceManager rm = new ResourceManager(ResourceType);
85 var resDisplayName = string.IsNullOrEmpty(lang)
86 ? rm.GetString(ResName)
87 : rm.GetString(ResName, new CultureInfo(lang));
88
89 if (!string.IsNullOrEmpty(resDisplayName))
90 return resDisplayName;
91 }
92 }
93
94 return Name;
95 }
96 }
97 }
98 }
SinGooCMS.Utility.Extension.DisplayExtAttribute.DisplayExtAttribute
DisplayExtAttribute(string _name, string _resName, Type _resType, bool _isReadRes=true)
快速构建
Definition: AttributeExtension.cs:53
System
SinGooCMS.Utility.UtilsBase.HttpContext
static HttpContext HttpContext
http上下文
Definition: UtilsBase.cs:43
SinGooCMS.Utility.Extension.DisplayExtAttribute
特性扩展类 属性的显示扩展,优先使用资源Name,默认使用自带的Name,注意：仅适用于MVC
Definition: AttributeExtension.cs:22
SinGooCMS
SinGooCMS.Utility.UtilsBase
工具底层，主要获取 http上下文 HttpContext。netfx从system.web中读取，core需要注入
Definition: UtilsBase.cs:13
SinGooCMS.Utility.Extension.DisplayExtAttribute.DisplayExtAttribute
DisplayExtAttribute()
默认警告方法
Definition: AttributeExtension.cs:44


SinGooCMS.Utility: SinGooCMS.Utility/IO/Base64FileUtils.cs 源文件

  • 文件列表
  • SinGooCMS.Utility
  • IO
Base64FileUtils.cs
浏览该文件的文档.
1 using System;
2 using System.Collections.Generic;
3 using System.IO;
4 using System.Text;
5 using System.Threading.Tasks;
6
7 namespace SinGooCMS.Utility
8 {
12 public class Base64FileUtils
13 {
20 public static string ReadFileToString(string filePath, bool isJsFormat = false)
21 {
22 if (!File.Exists(filePath)) return null;
23
24 FileStream fsForRead = new FileStream(filePath, FileMode.Open);//文件路径
25 string base64str = ReadFileToString(fsForRead);
26
27 if (isJsFormat)
28 {
29 //在前端读base64并轩化成文件，需要加上格式
30 //如data:application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;base64,
31 base64str = $"data:{FileUtils.GetContentType(filePath)};base64,"+ base64str;
32 }
33
34 return base64str;
35 }
36
42 public static string ReadFileToString(FileStream fileStream)
43 {
44 string base64Str = "";
45 try
46 {
47 //读写指针移到距开头10个字节处
48 fileStream.Seek(0, SeekOrigin.Begin);
49 byte[] bs = new byte[fileStream.Length];
50 int log = Convert.ToInt32(fileStream.Length);
51 //从文件中读取10个字节放到数组bs中
52 fileStream.Read(bs, 0, log);
53 base64Str = Convert.ToBase64String(bs);
54 return base64Str;
55 }
56 catch (Exception ex)
57 {
58 throw ex;
59 }
60 finally
61 {
62 fileStream.Close();
63 }
64 }
65
72 public static bool SaveStringToFile(string base64String, string fileFullPath)
73 {
74 bool opResult = false;
75 try
76 {
77 var filePath=Path.GetDirectoryName(fileFullPath);
78 if (!Directory.Exists(filePath))
79 {
80 Directory.CreateDirectory(filePath);
81 }
82
83 //如果有前缀格式，要去掉
84 //如data:application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;base64,
85 string strbase64 = base64String.Trim().Substring(base64String.IndexOf(",") + 1); //将‘，’以前的多余字符串删除
86 using (FileStream fs = new FileStream(fileFullPath, FileMode.OpenOrCreate, FileAccess.Write))
87 {
88 MemoryStream stream = new MemoryStream(Convert.FromBase64String(strbase64));
89 byte[] b = stream.ToArray();
90 fs.Write(b, 0, b.Length);
91 fs.Flush();
92 }
93
94 opResult = true;
95 }
96 catch (Exception ex)
97 {
98 throw ex;
99 }
100
101 return opResult;
102 }
103
110 public static async Task<bool> SaveStringToFileAsync(string base64String, string fileFullPath)
111 {
112 bool opResult = false;
113 try
114 {
115 var filePath = Path.GetDirectoryName(fileFullPath);
116 if (!Directory.Exists(filePath))
117 {
118 Directory.CreateDirectory(filePath);
119 }
120
121 //如果有前缀格式，要去掉
122 //如data:application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;base64,
123 string strbase64 = base64String.Trim().Substring(base64String.IndexOf(",") + 1); //将‘，’以前的多余字符串删除
124 using (FileStream fs = new FileStream(fileFullPath, FileMode.OpenOrCreate, FileAccess.Write))
125 {
126 MemoryStream stream = new MemoryStream(Convert.FromBase64String(strbase64));
127 byte[] b = stream.ToArray();
128 await fs.WriteAsync(b, 0, b.Length);
129 await fs.FlushAsync();
130 }
131
132 opResult = true;
133 }
134 catch (Exception ex)
135 {
136 throw ex;
137 }
138
139 return opResult;
140 }
141
147 public static bool IsBase64Formatted(string input)
148 {
149 bool result;
150 try
151 {
152 Convert.FromBase64String(input);
153 result = true;
154 }
155 catch
156 {
157 result = false;
158 }
159
160 return result;
161 }
162 }
163 }
System
SinGooCMS.Utility.Base64FileUtils.SaveStringToFile
static bool SaveStringToFile(string base64String, string fileFullPath)
Base64字符串转文件并保存
Definition: Base64FileUtils.cs:72
SinGooCMS.Utility.Base64FileUtils.SaveStringToFileAsync
static async Task< bool > SaveStringToFileAsync(string base64String, string fileFullPath)
Base64字符串转文件并保存
Definition: Base64FileUtils.cs:110
SinGooCMS
SinGooCMS.Utility.Base64FileUtils.IsBase64Formatted
static bool IsBase64Formatted(string input)
是否base64格式
Definition: Base64FileUtils.cs:147
SinGooCMS.Utility.Base64FileUtils.ReadFileToString
static string ReadFileToString(string filePath, bool isJsFormat=false)
文件转base64
Definition: Base64FileUtils.cs:20
SinGooCMS.Utility.Base64FileUtils.ReadFileToString
static string ReadFileToString(FileStream fileStream)
文件流转为base64字符串
Definition: Base64FileUtils.cs:42
SinGooCMS.Utility.Base64FileUtils
base64字符串和文件互转
Definition: Base64FileUtils.cs:12


SinGooCMS.Utility: SinGooCMS.Utility/Web/CacheUtils.cs 源文件

  • 文件列表
  • SinGooCMS.Utility
  • Web
CacheUtils.cs
浏览该文件的文档.
1 using System;
2 using System.Collections;
3 using System.Collections.Generic;
4 using System.Linq;
5 using System.Reflection;
6 using System.Text.RegularExpressions;
7
8 #if NETSTANDARD2_1
9 using Microsoft.Extensions.Caching.Memory;
10 #else
11 using System.Web;
12 using System.Web.Caching;
13 #endif
14
15 namespace SinGooCMS.Utility
16 {
20 public sealed class CacheUtils
21 {
22 #if NETSTANDARD2_1
23 private static IMemoryCache cache;
24 static CacheUtils()
25 {
26 cache = new MemoryCache(new MemoryCacheOptions() { });
27 }
28 #else
29 private static System.Web.Caching.Cache cache;
30 static CacheUtils()
31 {
32 cache = System.Web.HttpRuntime.Cache;
33 }
34 #endif
35
36 #region Get
37
44 public T Get<T>(string key)
45 {
46 #if NETSTANDARD2_1
47 return cache.Get<T>(key);
48 #else
49 return (T)cache[key];
50 #endif
51 }
52
58 public bool ContainKey(string key) =>
59 GetAllKeys().Contains(key);
60
65 public IList<string> GetAllKeys()
66 {
67 var keys = new List<string>();
68 #if NETSTANDARD2_1
69 const BindingFlags flags = BindingFlags.Instance | BindingFlags.NonPublic;
70 var entries = cache.GetType().GetField("_entries", flags).GetValue(cache);
71 var cacheItems = entries as IDictionary;
72
73 if (cacheItems == null) return keys;
74 foreach (DictionaryEntry cacheItem in cacheItems)
75 {
76 keys.Add(cacheItem.Key.ToString());
77 }
78 #else
79 IDictionaryEnumerator CacheEnum = cache.GetEnumerator();
80 while (CacheEnum.MoveNext())
81 {
82 keys.Add(CacheEnum.Key.ToString());
83 }
84 #endif
85 return keys;
86 }
87
88 #endregion
89
90 #region Insert
91
101 public void Insert<T>(string key, T t, int expireSeconds, CacheItemPriority priority = CacheItemPriority.Normal, bool isSliding = true)
102 {
103 TimeSpan offset = new TimeSpan(0, 0, expireSeconds);
104
105 #if NETSTANDARD2_1
106
107 var option = new MemoryCacheEntryOptions();
108 option.Priority=priority;
109
110 cache.Set(key, t,
111 isSliding
112 ? option.SetSlidingExpiration(offset)
113 : option.SetAbsoluteExpiration(offset));
114 #else
115
116 if (t != null)
117 cache.Insert(key, t, null, DateTime.Now.Add(offset), System.Web.Caching.Cache.NoSlidingExpiration, priority, null);
118 #endif
119 }
120
121 #endregion
122
123 #region Delete
124
129 public void Del(string key) =>
130 cache.Remove(key);
131
136 public void DelByPattern(string pattern)
137 {
138 var cacheNum = GetAllKeys();
139 Regex regex = new Regex(pattern, RegexOptions.Singleline | RegexOptions.Compiled | RegexOptions.IgnoreCase);
140 List<string> list = new List<string>();
141 foreach (var item in cacheNum)
142 {
143 if (regex.IsMatch(item))
144 list.Add(item);
145 }
146
147 foreach (string str in list)
148 cache.Remove(str);
149 }
150
155 public int ClearAll()
156 {
157 #if NETSTANDARD2_1
158 var cacheNum = GetAllKeys();
159 foreach (var item in cacheNum)
160 cache.Remove(item);
161
162 return cacheNum.Count;
163 #else
164 IDictionaryEnumerator CacheEnum = cache.GetEnumerator();
165 var al = new ArrayList();
166 while (CacheEnum.MoveNext())
167 al.Add(CacheEnum.Key);
168
169 foreach (string key in al)
170 cache.Remove(key);
171
172 //返回清空的缓存数量
173 return al.Count;
174 #endif
175 }
176
177 #endregion
178 }
179 }
System
SinGooCMS.Utility.CacheUtils
缓存管理
Definition: CacheUtils.cs:20
SinGooCMS.Utility.CacheUtils.cache
static System.Web.Caching.Cache cache
Definition: CacheUtils.cs:29
SinGooCMS
SinGooCMS.Utility.CacheUtils.DelByPattern
void DelByPattern(string pattern)
删除匹配的缓存
Definition: CacheUtils.cs:136
SinGooCMS.Utility.CacheUtils.CacheUtils
static CacheUtils()
Definition: CacheUtils.cs:30
SinGooCMS.Utility.CacheUtils.GetAllKeys
IList< string > GetAllKeys()
读取所有缓存键
Definition: CacheUtils.cs:65
SinGooCMS.Utility.CacheUtils.ClearAll
int ClearAll()
清除所有缓存
Definition: CacheUtils.cs:155


SinGooCMS.Utility: SinGooCMS.Utility/IO/CaptchaUtils.cs 源文件

  • 文件列表
  • SinGooCMS.Utility
  • IO
CaptchaUtils.cs
浏览该文件的文档.
1 using System;
2 using System.Drawing;
3 using System.Drawing.Imaging;
4 using System.IO;
5
6 namespace SinGooCMS.Utility
7 {
11 public sealed class CaptchaUtils
12 {
13 #region 公共属性
14
18 public string CheckCodeString { get; set; }
22 public byte[] CheckCodeImg { get; set; }
23
24 #endregion
25
30 public static CaptchaUtils Create()
31 {
32 string validCode = GenerateCheckCode();
33 return new CaptchaUtils
34 {
35 CheckCodeString = validCode,
36 CheckCodeImg = CreateCheckCodeImage(validCode)
37 };
38 }
39
40 #region 私有方法
41
42 private static string GenerateCheckCode()
43 {
44 string chkCode = string.Empty;
45 //验证码的字符集，去掉了一些容易混淆的字符
46 char[] character = { '2', '3', '4', '5', '6', '8', '9', 'a', 'b', 'd', 'e', 'f', 'h', 'k', 'm', 'n', 'r', 'x', 'y', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'J', 'K', 'L', 'M', 'N', 'P', 'R', 'S', 'T', 'W', 'X', 'Y' };
47 Random rnd = new Random();
48 //生成验证码字符串
49 for (int i = 0; i < 4; i++)
50 {
51 chkCode += character[rnd.Next(character.Length)];
52 }
53
54 return chkCode;
55 }
56
57 private static byte[] CreateCheckCodeImage(string codeString)
58 {
59 string checkCode = codeString;
60 if (checkCode == null || checkCode.Trim() == String.Empty)
61 return null;
62
63 int codeW = 80;
64 int codeH = 22;
65 int fontSize = 16;
66
67 Random rnd = new Random();
68 //颜色列表，用于验证码、噪线、噪点
69 Color[] color = { Color.Black, Color.Red, Color.Blue, Color.Green, Color.Orange, Color.Brown, Color.Brown, Color.DarkBlue };
70 //字体列表，用于验证码
71 string[] font = { "Times New Roman", "Verdana", "Arial", "Gungsuh", "Impact" };
72
73 //创建画布
74 Bitmap bmp = new Bitmap(codeW, codeH);
75 Graphics g = Graphics.FromImage(bmp);
76 g.Clear(Color.White);
77 //画噪线
78 for (int i = 0; i < 1; i++)
79 {
80 int x1 = rnd.Next(codeW);
81 int y1 = rnd.Next(codeH);
82 int x2 = rnd.Next(codeW);
83 int y2 = rnd.Next(codeH);
84 Color clr = color[rnd.Next(color.Length)];
85 g.DrawLine(new Pen(clr), x1, y1, x2, y2);
86 }
87 //画验证码字符串
88 for (int i = 0; i < checkCode.Length; i++)
89 {
90 string fnt = font[rnd.Next(font.Length)];
91 Font ft = new Font(fnt, fontSize);
92 Color clr = color[rnd.Next(color.Length)];
93 g.DrawString(checkCode[i].ToString(), ft, new SolidBrush(clr), (float)i * 18 + 2, (float)0);
94 }
95 //画噪点
96 for (int i = 0; i < 100; i++)
97 {
98 int x = rnd.Next(bmp.Width);
99 int y = rnd.Next(bmp.Height);
100 Color clr = color[rnd.Next(color.Length)];
101 bmp.SetPixel(x, y, clr);
102 }
103
104 //将验证码图片写入内存流，并将其以 "image/Png" 格式输出
105 MemoryStream ms = new MemoryStream();
106 bmp.Save(ms, ImageFormat.Png);
107
108 //显式释放资源
109 bmp.Dispose();
110 g.Dispose();
111
112 return ms.ToArray();
113 }
114
115 #endregion
116 }
117 }
System
SinGooCMS.Utility.CaptchaUtils
图形验证码工具
Definition: CaptchaUtils.cs:11
SinGooCMS.Utility.CaptchaUtils.GenerateCheckCode
static string GenerateCheckCode()
Definition: CaptchaUtils.cs:42
SinGooCMS
SinGooCMS.Utility.CaptchaUtils.CreateCheckCodeImage
static byte[] CreateCheckCodeImage(string codeString)
Definition: CaptchaUtils.cs:57
SinGooCMS.Utility.CaptchaUtils.Create
static CaptchaUtils Create()
生成验证码
Definition: CaptchaUtils.cs:30


SinGooCMS.Utility: SinGooCMS.Utility/Text/CellPhonePrefix.cs 源文件

  • 文件列表
  • SinGooCMS.Utility
  • Text
CellPhonePrefix.cs
浏览该文件的文档.
1 using System;
2 using System.Collections.Generic;
3 using System.Linq;
4 using System.Text;
5
6 namespace SinGooCMS.Utility
7 {
11 public static class CellPhonePrefix
12 {
16 public static List<(string prefix, string area)> Dictionary = new List<(string prefix, string area)>
17 {
18 ("+86","中国大陆"),
19 ("+852","香港"),
20 ("+853","澳门"),
21 ("+886","台湾"),
22 ("+82","韩国"),
23 ("+81","日本"),
24 ("+1","美国"),
25 ("+1","加拿大"),
26 ("+44","英国"),
27 ("+65","新加坡"),
28 ("+60","马来西亚"),
29 ("+66","泰国"),
30 ("+84","越南"),
31 ("+63","菲律宾"),
32 ("+62","印度尼西亚"),
33 ("+39","意大利"),
34 ("+7","俄罗斯"),
35 ("+64","新西兰"),
36 ("+31","荷兰"),
37 ("+46","瑞典"),
38 ("+61","澳大利亚"),
39 ("+380","乌克兰"),
40 ("+33","法国"),
41 ("+49","德国"),
42 ("+93","阿富汗"),
43 ("+355","阿尔巴尼亚"),
44 ("+213","阿尔及利亚"),
45 ("+1684","东萨摩亚(美)"),
46 ("+376","安道尔"),
47 ("+244","安哥拉"),
48 ("+1264","安圭拉岛(英)"),
49 ("+1268","安提瓜和巴布达"),
50 ("+54","阿根廷"),
51 ("+374","亚美尼亚"),
52 ("+297","阿鲁巴岛"),
53 ("+43","奥地利"),
54 ("+994","阿塞拜疆"),
55 ("+973","巴林"),
56 ("+880","孟加拉国"),
57 ("+1246","巴巴多斯"),
58 ("+375","白俄罗斯"),
59 ("+32","比利时"),
60 ("+501","伯利兹"),
61 ("+229","贝宁"),
62 ("+1441","百慕大群岛(英)"),
63 ("+975","不丹"),
64 ("+591","玻利维亚"),
65 ("+387","波斯尼亚和黑塞哥维那"),
66 ("+267","博茨瓦纳"),
67 ("+55","巴西"),
68 ("+359","保加利亚"),
69 ("+226","布基纳法索"),
70 ("+257","布隆迪"),
71 ("+237","喀麦隆"),
72 ("+238","佛得角"),
73 ("+1345","开曼群岛(英)"),
74 ("+236","中非"),
75 ("+235","乍得"),
76 ("+56","智利"),
77 ("+61","圣诞岛"),
78 ("+61","科科斯岛"),
79 ("+57","哥伦比亚"),
80 ("+269","科摩罗"),
81 ("+242","刚果"),
82 ("+682","科克群岛(新)"),
83 ("+506","哥斯达黎加"),
84 ("+385","克罗地亚"),
85 ("+53","古巴"),
86 ("+357","塞浦路斯"),
87 ("+420","捷克"),
88 ("+45","丹麦"),
89 ("+253","吉布提"),
90 ("+1767","多米尼克国"),
91 ("+1809","多米尼加共和国"),
92 ("+593","厄瓜多尔"),
93 ("+20","埃及"),
94 ("+503","萨尔瓦多"),
95 ("+240","赤道几内亚"),
96 ("+291","厄立特里亚"),
97 ("+372","爱沙尼亚"),
98 ("+251","埃塞俄比亚"),
99 ("+500","福克兰群岛"),
100 ("+298","法罗群岛(丹)"),
101 ("+679","斐济"),
102 ("+358","芬兰"),
103 ("+689","法属波里尼西亚"),
104 ("+241","加蓬"),
105 ("+220","冈比亚"),
106 ("+995","格鲁吉亚"),
107 ("+233","加纳"),
108 ("+350","直布罗陀(英)"),
109 ("+30","希腊"),
110 ("+299","格陵兰岛"),
111 ("+1473","格林纳达"),
112 ("+590","瓜德罗普岛(法)"),
113 ("+1671","关岛(美)"),
114 ("+502","危地马拉"),
115 ("+224","几内亚"),
116 ("+245","几内亚比绍"),
117 ("+592","圭亚那"),
118 ("+509","海地"),
119 ("+504","洪都拉斯"),
120 ("+36","匈牙利"),
121 ("+354","冰岛"),
122 ("+91","印度"),
123 ("+98","伊郎"),
124 ("+964","伊拉克"),
125 ("+353","爱尔兰"),
126 ("+972","以色列"),
127 ("+225","科特迪瓦"),
128 ("+1876","牙买加"),
129 ("+962","约旦"),
130 ("+855","柬埔塞"),
131 ("+7","哈萨克斯坦"),
132 ("+254","肯尼亚"),
133 ("+686","基里巴斯"),
134 ("+965","科威特"),
135 ("+996","吉尔吉斯斯坦"),
136 ("+856","老挝"),
137 ("+371","拉脱维亚"),
138 ("+961","黎巴嫩"),
139 ("+266","莱索托"),
140 ("+231","利比里亚"),
141 ("+218","利比亚"),
142 ("+423","列支敦士登"),
143 ("+370","立陶宛"),
144 ("+352","卢森堡"),
145 ("+389","马其顿"),
146 ("+261","马达加斯加"),
147 ("+265","马拉维"),
148 ("+960","马尔代夫"),
149 ("+223","马里"),
150 ("+356","马耳他"),
151 ("+692","马绍尔群岛"),
152 ("+596","马提尼克(法)"),
153 ("+222","毛里塔尼亚"),
154 ("+230","毛里求斯"),
155 ("+262","马约特岛"),
156 ("+52","墨西哥"),
157 ("+691","密克罗尼西亚(美)"),
158 ("+377","摩纳哥"),
159 ("+976","蒙古"),
160 ("+1664","蒙特塞拉特岛(英)"),
161 ("+212","摩洛哥"),
162 ("+258","莫桑比克"),
163 ("+95","缅甸"),
164 ("+264","纳米比亚"),
165 ("+674","瑙鲁"),
166 ("+977","尼泊尔"),
167 ("+599","荷属安的列斯群岛"),
168 ("+687","新喀里多尼亚群岛(法)"),
169 ("+505","尼加拉瓜"),
170 ("+227","尼日尔"),
171 ("+234","尼日利亚"),
172 ("+683","纽埃岛(新)"),
173 ("+672","诺福克岛(澳)"),
174 ("+850","朝鲜"),
175 ("+1670","马里亚纳群岛"),
176 ("+47","挪威"),
177 ("+968","阿曼"),
178 ("+92","巴基斯坦"),
179 ("+680","帕劳(美)"),
180 ("+507","巴拿马"),
181 ("+675","巴布亚新几内亚"),
182 ("+595","巴拉圭"),
183 ("+51","秘鲁"),
184 ("+48","波兰"),
185 ("+351","葡萄牙"),
186 ("+1","波多黎各(美)"),
187 ("+974","卡塔尔"),
188 ("+373","摩尔多瓦"),
189 ("+262","留尼汪岛"),
190 ("+40","罗马尼亚"),
191 ("+250","卢旺达"),
192 ("+247","阿森松(英)"),
193 ("+290","圣赫勒拿"),
194 ("+1869","圣克里斯托弗和尼维斯"),
195 ("+1758","圣卢西亚"),
196 ("+508","圣皮埃尔岛及密克隆岛"),
197 ("+1784","圣文森特岛(英)"),
198 ("+685","西萨摩亚"),
199 ("+378","圣马力诺"),
200 ("+239","圣多美和普林西比"),
201 ("+966","沙特阿拉伯"),
202 ("+221","塞内加尔"),
203 ("+248","塞舌尔"),
204 ("+232","塞拉利昂"),
205 ("+421","斯洛伐克"),
206 ("+386","斯洛文尼亚"),
207 ("+677","所罗门群岛"),
208 ("+252","索马里"),
209 ("+27","南非"),
210 ("+34","西班牙"),
211 ("+94","斯里兰卡"),
212 ("+249","苏丹"),
213 ("+597","苏里南"),
214 ("+268","斯威士兰"),
215 ("+41","瑞士"),
216 ("+963","叙利亚"),
217 ("+992","塔吉克斯坦"),
218 ("+1242","巴哈马国"),
219 ("+14397","梵蒂冈"),
220 ("+228","多哥"),
221 ("+676","汤加"),
222 ("+1868","特立尼达和多巴哥"),
223 ("+216","突尼斯"),
224 ("+90","土耳其"),
225 ("+993","土库曼斯坦"),
226 ("+1649","特克斯和凯科斯群岛(英)"),
227 ("+688","图瓦卢"),
228 ("+256","乌干达"),
229 ("+44","英国"),
230 ("+255","坦桑尼亚"),
231 ("+598","乌拉圭"),
232 ("+998","乌兹别克斯坦"),
233 ("+678","瓦努阿图"),
234 ("+58","委内瑞拉"),
235 ("+1340","维尔京群岛(英)"),
236 ("+967","也门"),
237 ("+381","南斯拉夫"),
238 ("+260","赞比亚"),
239 ("+259","桑给巴尔"),
240 ("+263","津巴布韦")
241 };
242
243 private static List<string> _prefix = null;
244
248 public static List<string> Prefix
249 {
250 get
251 {
252 if (_prefix == null)
253 {
254 lock (typeof(CellPhonePrefix))
255 {
256 if (_prefix == null)
257 {
258 _prefix = Dictionary.Select(i => i.prefix).Distinct().ToList();
259 }
260 }
261 }
262 return _prefix;
263 }
264 }
265 }
266 }
System
SinGooCMS.Utility.CellPhonePrefix
手机号码前缀
Definition: CellPhonePrefix.cs:11
SinGooCMS


SinGooCMS.Utility: SinGooCMS.Utility/Date/ChineseDateUtils.cs 源文件

  • 文件列表
  • SinGooCMS.Utility
  • Date
ChineseDateUtils.cs
浏览该文件的文档.
1 using System;
2 using System.Collections.Generic;
3 using System.Text;
4
5 namespace SinGooCMS.Utility
6 {
10 public class CNDate
11 {
15 public int cnIntYear = 0;
19 public int cnIntMonth = 0;
23 public int cnIntDay = 0;
27 public string cnStrYear = "";
31 public string cnStrMonth = "";
35 public string cnStrDay = "";
39 public string cnAnm = "";
43 public string cnSolarTerm = "";
47 public string cnFtvl = "";
51 public string cnFtvs = "";
52
57 public override string ToString()
58 {
59 return $"农历{cnStrYear}年{cnStrMonth}月{cnStrDay}";
60 }
61 }
62
66 public class ChinaDate
67 {
68 #region 私有方法
69 private static long[] lunarInfo = new long[] { 0x04bd8, 0x04ae0, 0x0a570, 0x054d5, 0x0d260, 0x0d950, 0x16554,
70 0x056a0, 0x09ad0, 0x055d2, 0x04ae0, 0x0a5b6, 0x0a4d0, 0x0d250, 0x1d255, 0x0b540, 0x0d6a0, 0x0ada2, 0x095b0,
71 0x14977, 0x04970, 0x0a4b0, 0x0b4b5, 0x06a50, 0x06d40, 0x1ab54, 0x02b60, 0x09570, 0x052f2, 0x04970, 0x06566,
72 0x0d4a0, 0x0ea50, 0x06e95, 0x05ad0, 0x02b60, 0x186e3, 0x092e0, 0x1c8d7, 0x0c950, 0x0d4a0, 0x1d8a6, 0x0b550,
73 0x056a0, 0x1a5b4, 0x025d0, 0x092d0, 0x0d2b2, 0x0a950, 0x0b557, 0x06ca0, 0x0b550, 0x15355, 0x04da0, 0x0a5d0,
74 0x14573, 0x052d0, 0x0a9a8, 0x0e950, 0x06aa0, 0x0aea6, 0x0ab50, 0x04b60, 0x0aae4, 0x0a570, 0x05260, 0x0f263,
75 0x0d950, 0x05b57, 0x056a0, 0x096d0, 0x04dd5, 0x04ad0, 0x0a4d0, 0x0d4d4, 0x0d250, 0x0d558, 0x0b540, 0x0b5a0,
76 0x195a6, 0x095b0, 0x049b0, 0x0a974, 0x0a4b0, 0x0b27a, 0x06a50, 0x06d40, 0x0af46, 0x0ab60, 0x09570, 0x04af5,
77 0x04970, 0x064b0, 0x074a3, 0x0ea50, 0x06b58, 0x055c0, 0x0ab60, 0x096d5, 0x092e0, 0x0c960, 0x0d954, 0x0d4a0,
78 0x0da50, 0x07552, 0x056a0, 0x0abb7, 0x025d0, 0x092d0, 0x0cab5, 0x0a950, 0x0b4a0, 0x0baa4, 0x0ad50, 0x055d9,
79 0x04ba0, 0x0a5b0, 0x15176, 0x052b0, 0x0a930, 0x07954, 0x06aa0, 0x0ad50, 0x05b52, 0x04b60, 0x0a6e6, 0x0a4e0,
80 0x0d260, 0x0ea65, 0x0d530, 0x05aa0, 0x076a3, 0x096d0, 0x04bd7, 0x04ad0, 0x0a4d0, 0x1d0b6, 0x0d250, 0x0d520,
81 0x0dd45, 0x0b5a0, 0x056d0, 0x055b2, 0x049b0, 0x0a577, 0x0a4b0, 0x0aa50, 0x1b255, 0x06d20, 0x0ada0 };
82
83 private static int[] year20 = new int[] { 1, 4, 1, 2, 1, 2, 1, 1, 2, 1, 2, 1 };
84 private static int[] year19 = new int[] { 0, 3, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0 };
85 private static int[] year2000 = new int[] { 0, 3, 1, 2, 1, 2, 1, 1, 2, 1, 2, 1 };
86 private static String[] nStr1 = new String[] { "", "正", "二", "三", "四", "五", "六", "七", "八", "九", "十", "十一", "十二" };
87 private static String[] Gan = new String[] { "甲", "乙", "丙", "丁", "戊", "己", "庚", "辛", "壬", "癸" };
88 private static String[] Zhi = new String[] { "子", "丑", "寅", "卯", "辰", "巳", "午", "未", "申", "酉", "戌", "亥" };
89 private static String[] Animals = new String[] { "鼠", "牛", "虎", "兔", "龙", "蛇", "马", "羊", "猴", "鸡", "狗", "猪" };
90 private static String[] solarTerm = new String[] { "小寒", "大寒", "立春", "雨水", "惊蛰", "春分", "清明", "谷雨", "立夏", "小满", "芒种", "夏至", "小暑", "大暑", "立秋", "处暑", "白露", "秋分", "寒露", "霜降", "立冬", "小雪", "大雪", "冬至" };
91 private static int[] sTermInfo = { 0, 21208, 42467, 63836, 85337, 107014, 128867, 150921, 173149, 195551, 218072, 240693, 263343, 285989, 308563, 331033, 353350, 375494, 397447, 419210, 440795, 462224, 483532, 504758 };
92 private static String[] lFtv = new String[] { "0101农历春节", "0202 龙抬头节", "0115 元宵节", "0505 端午节", "0707 七夕情人节", "0815 中秋节", "0909 重阳节", "1208 腊八节", "1114 李君先生生日", "1224 小年", "0100除夕" };
93 private static String[] sFtv = new String[] { "0101 新年元旦",
94 "0202 世界湿地日",
95 "0207 国际声援南非日",
96 "0210 国际气象节",
97 "0214 情人节",
98 "0301 国际海豹日",
99 "0303 全国爱耳日",
100 "0308 国际妇女节",
101 "0312 植树节 孙中山逝世纪念日",
102 "0314 国际警察日",
103 "0315 国际消费者权益日",
104 "0317 中国国医节 国际航海日",
105 "0321 世界森林日 消除种族歧视国际日",
106 "0321 世界儿歌日",
107 "0322 世界水日",
108 "0323 世界气象日",
109 "0324 世界防治结核病日",
110 "0325 全国中小学生安全教育日",
111 "0330 巴勒斯坦国土日",
112 "0401 愚人节 全国爱国卫生运动月(四月) 税收宣传月(四月)",
113 "0407 世界卫生日",
114 "0422 世界地球日",
115 "0423 世界图书和版权日",
116 "0424 亚非新闻工作者日",
117 "0501 国际劳动节",
118 "0504 中国五四青年节",
119 "0505 碘缺乏病防治日",
120 "0508 世界红十字日",
121 "0512 国际护士节",
122 "0515 国际家庭日",
123 "0517 世界电信日",
124 "0518 国际博物馆日",
125 "0520 全国学生营养日",
126 "0523 国际牛奶日",
127 "0531 世界无烟日",
128 "0601 国际儿童节",
129 "0605 世界环境日",
130 "0606 全国爱眼日",
131 "0617 防治荒漠化和干旱日",
132 "0623 国际奥林匹克日",
133 "0625 全国土地日",
134 "0626 国际反毒品日",
135 "0701 中国共产党建党日 世界建筑日",
136 "0702 国际体育记者日",
137 "0707 中国人民抗日战争纪念日",
138 "0711 世界人口日",
139 "0730 非洲妇女日",
140 "0801 中国建军节",
141 "0808 中国男子节(爸爸节)",
142 "0815 日本正式宣布无条件投降日",
143 "0908 国际扫盲日 国际新闻工作者日",
144 "0910 教师节",
145 "0914 世界清洁地球日",
146 "0916 国际臭氧层保护日",
147 "0918 九·一八事变纪念日",
148 "0920 全国爱牙日",
149 "0927 世界旅游日",
150 "1001 国庆节 世界音乐日 国际老人节",
151 "1001 国际音乐日",
152 "1002 国际和平与民主自由斗争日",
153 "1004 世界动物日",
154 "1008 全国高血压日",
155 "1008 世界视觉日",
156 "1009 世界邮政日 万国邮联日",
157 "1010 辛亥革命纪念日 世界精神卫生日",
158 "1013 世界保健日 国际教师节",
159 "1014 世界标准日",
160 "1015 国际盲人节(白手杖节)",
161 "1016 世界粮食日",
162 "1017 世界消除贫困日",
163 "1022 世界传统医药日",
164 "1024 联合国日 世界发展信息日",
165 "1031 世界勤俭日",
166 "1107 十月社会主义革命纪念日",
167 "1108 中国记者日",
168 "1109 全国消防安全宣传教育日",
169 "1110 世界青年节",
170 "1111 国际科学与和平周(本日所属的一周)",
171 "1112 孙中山诞辰纪念日",
172 "1114 世界糖尿病日",
173 "1117 国际大学生节 世界学生节",
174 "1121 世界问候日 世界电视日",
175 "1129 国际声援巴勒斯坦人民国际日",
176 "1201 世界艾滋病日",
177 "1203 世界残疾人日",
178 "1205 国际经济和社会发展志愿人员日",
179 "1208 国际儿童电视日",
180 "1209 世界足球日",
181 "1210 世界人权日",
182 "1212 西安事变纪念日",
183 "1213 南京大屠杀(1937年)纪念日！紧记血泪史！",
184 "1221 国际篮球日",
185 "1224 平安夜",
186 "1225 圣诞节",
187 "1226 毛主席诞辰",
188 "1229 国际生物多样性日" };
189
190
194 private static int lYearDays(int y)
195 {
196 int i, sum = 348;
197 for (i = 0x8000; i > 0x8; i >>= 1)
198 {
199 if ((lunarInfo[y - 1900] & i) != 0)
200 sum += 1;
201 }
202 return (sum + leapDays(y));
203 }
204
208 private static int leapDays(int y)
209 {
210 if (leapMonth(y) != 0)
211 {
212 if ((lunarInfo[y - 1900] & 0x10000) != 0)
213 return 30;
214 else
215 return 29;
216 }
217 else
218 return 0;
219 }
220
224 private static int leapMonth(int y)
225 {
226 return (int)(lunarInfo[y - 1900] & 0xf);
227 }
228
232 private static int monthDays(int y, int m)
233 {
234 if ((lunarInfo[y - 1900] & (0x10000 >> m)) == 0)
235 return 29;
236 else
237 return 30;
238 }
239
243 private static String AnimalsYear(int y)
244 {
245 return Animals[(y - 4) % 12];
246 }
247
251 private static String cyclicalm(int num)
252 {
253 return (Gan[num % 10] + Zhi[num % 12]);
254 }
255
259 private static String cyclical(int y)
260 {
261 int num = y - 1900 + 36;
262 return (cyclicalm(num));
263 }
264
268 private long[] Lunar(int y, int m)
269 {
270 long[] nongDate = new long[7];
271 int i = 0, temp = 0, leap = 0;
272 DateTime baseDate = new DateTime(1900 + 1900, 2, 31);
273 DateTime objDate = new DateTime(y + 1900, m + 1, 1);
274 TimeSpan ts = objDate - baseDate;
275 long offset = (long)ts.TotalDays;
276 if (y < 2000)
277 offset += year19[m - 1];
278 if (y > 2000)
279 offset += year20[m - 1];
280 if (y == 2000)
281 offset += year2000[m - 1];
282 nongDate[5] = offset + 40;
283 nongDate[4] = 14;
284
285 for (i = 1900; i < 2050 && offset > 0; i++)
286 {
287 temp = lYearDays(i);
288 offset -= temp;
289 nongDate[4] += 12;
290 }
291 if (offset < 0)
292 {
293 offset += temp;
294 i--;
295 nongDate[4] -= 12;
296 }
297 nongDate[0] = i;
298 nongDate[3] = i - 1864;
299 leap = leapMonth(i); // 闰哪个月
300 nongDate[6] = 0;
301
302 for (i = 1; i < 13 && offset > 0; i++)
303 {
304 // 闰月
305 if (leap > 0 && i == (leap + 1) && nongDate[6] == 0)
306 {
307 --i;
308 nongDate[6] = 1;
309 temp = leapDays((int)nongDate[0]);
310 }
311 else
312 {
313 temp = monthDays((int)nongDate[0], i);
314 }
315
316 // 解除闰月
317 if (nongDate[6] == 1 && i == (leap + 1))
318 nongDate[6] = 0;
319 offset -= temp;
320 if (nongDate[6] == 0)
321 nongDate[4]++;
322 }
323
324 if (offset == 0 && leap > 0 && i == leap + 1)
325 {
326 if (nongDate[6] == 1)
327 {
328 nongDate[6] = 0;
329 }
330 else
331 {
332 nongDate[6] = 1;
333 --i;
334 --nongDate[4];
335 }
336 }
337 if (offset < 0)
338 {
339 offset += temp;
340 --i;
341 --nongDate[4];
342 }
343 nongDate[1] = i;
344 nongDate[2] = offset + 1;
345 return nongDate;
346 }
347
351 private static long[] calElement(int y, int m, int d)
352 {
353 long[] nongDate = new long[7];
354 int i = 0, temp = 0, leap = 0;
355
356 DateTime baseDate = new DateTime(1900, 1, 31);
357
358 DateTime objDate = new DateTime(y, m, d);
359 TimeSpan ts = objDate - baseDate;
360
361 long offset = (long)ts.TotalDays;
362
363 nongDate[5] = offset + 40;
364 nongDate[4] = 14;
365
366 for (i = 1900; i < 2050 && offset > 0; i++)
367 {
368 temp = lYearDays(i);
369 offset -= temp;
370 nongDate[4] += 12;
371 }
372 if (offset < 0)
373 {
374 offset += temp;
375 i--;
376 nongDate[4] -= 12;
377 }
378 nongDate[0] = i;
379 nongDate[3] = i - 1864;
380 leap = leapMonth(i); // 闰哪个月
381 nongDate[6] = 0;
382
383 for (i = 1; i < 13 && offset > 0; i++)
384 {
385 // 闰月
386 if (leap > 0 && i == (leap + 1) && nongDate[6] == 0)
387 {
388 --i;
389 nongDate[6] = 1;
390 temp = leapDays((int)nongDate[0]);
391 }
392 else
393 {
394 temp = monthDays((int)nongDate[0], i);
395 }
396
397 // 解除闰月
398 if (nongDate[6] == 1 && i == (leap + 1))
399 nongDate[6] = 0;
400 offset -= temp;
401 if (nongDate[6] == 0)
402 nongDate[4]++;
403 }
404
405 if (offset == 0 && leap > 0 && i == leap + 1)
406 {
407 if (nongDate[6] == 1)
408 {
409 nongDate[6] = 0;
410 }
411 else
412 {
413 nongDate[6] = 1;
414 --i;
415 --nongDate[4];
416 }
417 }
418 if (offset < 0)
419 {
420 offset += temp;
421 --i;
422 --nongDate[4];
423 }
424 nongDate[1] = i;
425 nongDate[2] = offset + 1;
426 return nongDate;
427 }
428
429 private static String getChinaDate(int day)
430 {
431 String a = "";
432 if (day == 10)
433 return "初十";
434 if (day == 20)
435 return "二十";
436 if (day == 30)
437 return "三十";
438 int two = (int)((day) / 10);
439 if (two == 0)
440 a = "初";
441 if (two == 1)
442 a = "十";
443 if (two == 2)
444 a = "廿";
445 if (two == 3)
446 a = "三";
447 int one = (int)(day % 10);
448 switch (one)
449 {
450 case 1:
451 a += "一";
452 break;
453 case 2:
454 a += "二";
455 break;
456 case 3:
457 a += "三";
458 break;
459 case 4:
460 a += "四";
461 break;
462 case 5:
463 a += "五";
464 break;
465 case 6:
466 a += "六";
467 break;
468 case 7:
469 a += "七";
470 break;
471 case 8:
472 a += "八";
473 break;
474 case 9:
475 a += "九";
476 break;
477 }
478 return a;
479 }
480
481 private static DateTime sTerm(int y, int n)
482 {
483 double ms = 31556925974.7 * (y - 1900);
484 double ms1 = sTermInfo[n];
485 DateTime offDate = new DateTime(1900, 1, 6, 2, 5, 0);
486 offDate = offDate.AddMilliseconds(ms);
487 offDate = offDate.AddMinutes(ms1);
488 return offDate;
489 }
490
491 static string FormatDate(int m, int d)
492 {
493 return string.Format("{0:00}{1:00}", m, d);
494 }
495 #endregion
496
497 #region 公有方法
498 public static int GetDaysByMonth(int y, int m)
502 {
503 int[] days = new int[] { 31, DateTime.IsLeapYear(y) ? 29 : 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
504 return days[m - 1];
505 }
506
512 public static DateTime GetMondayDateByDate(DateTime dt)
513 {
514 double d = 0;
515 switch ((int)dt.DayOfWeek)
516 {
517 //case 1: d = 0; break;
518 case 2: d = -1; break;
519 case 3: d = -2; break;
520 case 4: d = -3; break;
521 case 5: d = -4; break;
522 case 6: d = -5; break;
523 case 0: d = -6; break;
524 }
525 return dt.AddDays(d);
526 }
527
531 public static CNDate GetChinaDate(DateTime? dtPara = null)
532 {
533 var dt = dtPara ?? DateTime.Now;
534
535 CNDate cd = new CNDate();
536 int year = dt.Year;
537 int month = dt.Month;
538 int date = dt.Day;
539 long[] l = calElement(year, month, date);
540 cd.cnIntYear = (int)l[0];
541 cd.cnIntMonth = (int)l[1];
542 cd.cnIntDay = (int)l[2];
543 cd.cnStrYear = cyclical(year);
544 cd.cnAnm = AnimalsYear(year);
545 cd.cnStrMonth = nStr1[(int)l[1]];
546 cd.cnStrDay = getChinaDate((int)(l[2]));
547 string smd = dt.ToString("MMdd");
548
549 string lmd = FormatDate(cd.cnIntMonth, cd.cnIntDay);
550 for (int i = 0; i < solarTerm.Length; i++)
551 {
552 string s1 = sTerm(dt.Year, i).ToString("MMdd");
553 if (s1.Equals(dt.ToString("MMdd")))
554 {
555 cd.cnSolarTerm = solarTerm[i];
556 break;
557 }
558 }
559 foreach (string s in sFtv)
560 {
561 string s1 = s.Substring(0, 4);
562 if (s1.Equals(smd))
563 {
564 cd.cnFtvs = s.Substring(4, s.Length - 4);
565 break;
566 }
567 }
568 foreach (string s in lFtv)
569 {
570 string s1 = s.Substring(0, 4);
571 if (s1.Equals(lmd))
572 {
573 cd.cnFtvl = s.Substring(4, s.Length - 4);
574 break;
575 }
576 }
577 dt = dt.AddDays(1);
578 year = dt.Year;
579 month = dt.Month;
580 date = dt.Day;
581 l = calElement(year, month, date);
582 lmd = FormatDate((int)l[1], (int)l[2]);
583 if (lmd.Equals("0101")) cd.cnFtvl = "除夕";
584 return cd;
585 }
586 #endregion
587 }
588
592 //-------------------------------------------------------------------------------
593 //调用:
594 //ChineseCalendar c = new ChineseCalendar(new DateTime(1990, 01, 15));
595 //StringBuilder dayInfo = new StringBuilder();
596 //dayInfo.Append("阳历：" + c.DateString + "\r\n");
597 //dayInfo.Append("农历：" + c.ChineseDateString + "\r\n");
598 //dayInfo.Append("星期：" + c.WeekDayStr);
599 //dayInfo.Append("时辰：" + c.ChineseHour + "\r\n");
600 //dayInfo.Append("属相：" + c.AnimalString + "\r\n");
601 //dayInfo.Append("节气：" + c.ChineseTwentyFourDay + "\r\n");
602 //dayInfo.Append("前一个节气：" + c.ChineseTwentyFourPrevDay + "\r\n");
603 //dayInfo.Append("下一个节气：" + c.ChineseTwentyFourNextDay + "\r\n");
604 //dayInfo.Append("节日：" + c.DateHoliday + "\r\n");
605 //dayInfo.Append("干支：" + c.GanZhiDateString + "\r\n");
606 //dayInfo.Append("星宿：" + c.ChineseConstellation + "\r\n");
607 //dayInfo.Append("星座：" + c.Constellation + "\r\n");
608 //-------------------------------------------------------------------------------
609 public class ChineseCalendar
610 {
611 #region 内部结构
612 private struct SolarHolidayStruct
616 {
617 public int Month;
618 public int Day;
619 public int Recess; //假期长度
620 public string HolidayName;
621 public SolarHolidayStruct(int month, int day, int recess, string name)
622 {
623 Month = month;
624 Day = day;
625 Recess = recess;
626 HolidayName = name;
627 }
628 }
629
633 private struct LunarHolidayStruct
634 {
635 public int Month;
636 public int Day;
637 public int Recess;
638 public string HolidayName;
639
640 public LunarHolidayStruct(int month, int day, int recess, string name)
641 {
642 Month = month;
643 Day = day;
644 Recess = recess;
645 HolidayName = name;
646 }
647 }
648
649 private struct WeekHolidayStruct
650 {
651 public int Month;
652 public int WeekAtMonth;
653 public int WeekDay;
654 public string HolidayName;
655
656 public WeekHolidayStruct(int month, int weekAtMonth, int weekDay, string name)
657 {
658 Month = month;
659 WeekAtMonth = weekAtMonth;
660 WeekDay = weekDay;
661 HolidayName = name;
662 }
663 }
664 #endregion
665
666 #region 内部变量
667 private DateTime _date;
668 private DateTime _datetime;
669 private int _cYear;
670 private int _cMonth;
671 private int _cDay;
672 private bool _cIsLeapMonth; //当月是否闰月
673 private bool _cIsLeapYear; //当年是否有闰月
674 #endregion
675
676 #region 基础数据
677 #region 基本常量
678 private const int MinYear = 1900;
679 private const int MaxYear = 2050;
680 private static DateTime MinDay = new DateTime(1900, 1, 30);
681 private static DateTime MaxDay = new DateTime(2049, 12, 31);
682 private const int GanZhiStartYear = 1864; //干支计算起始年
683 private static DateTime GanZhiStartDay = new DateTime(1899, 12, 22);//起始日
684 private const string HZNum = "零一二三四五六七八九";
685 private const int AnimalStartYear = 1900; //1900年为鼠年
686 private static DateTime ChineseConstellationReferDay = new DateTime(2007, 9, 13);//28星宿参考值,本日为角
687 #endregion
688
689 #region 阴历数据
690 private static int[] LunarDateArray = new int[]{
700 0x04BD8,0x04AE0,0x0A570,0x054D5,0x0D260,0x0D950,0x16554,0x056A0,0x09AD0,0x055D2,
701 0x04AE0,0x0A5B6,0x0A4D0,0x0D250,0x1D255,0x0B540,0x0D6A0,0x0ADA2,0x095B0,0x14977,
702 0x04970,0x0A4B0,0x0B4B5,0x06A50,0x06D40,0x1AB54,0x02B60,0x09570,0x052F2,0x04970,
703 0x06566,0x0D4A0,0x0EA50,0x06E95,0x05AD0,0x02B60,0x186E3,0x092E0,0x1C8D7,0x0C950,
704 0x0D4A0,0x1D8A6,0x0B550,0x056A0,0x1A5B4,0x025D0,0x092D0,0x0D2B2,0x0A950,0x0B557,
705 0x06CA0,0x0B550,0x15355,0x04DA0,0x0A5B0,0x14573,0x052B0,0x0A9A8,0x0E950,0x06AA0,
706 0x0AEA6,0x0AB50,0x04B60,0x0AAE4,0x0A570,0x05260,0x0F263,0x0D950,0x05B57,0x056A0,
707 0x096D0,0x04DD5,0x04AD0,0x0A4D0,0x0D4D4,0x0D250,0x0D558,0x0B540,0x0B6A0,0x195A6,
708 0x095B0,0x049B0,0x0A974,0x0A4B0,0x0B27A,0x06A50,0x06D40,0x0AF46,0x0AB60,0x09570,
709 0x04AF5,0x04970,0x064B0,0x074A3,0x0EA50,0x06B58,0x055C0,0x0AB60,0x096D5,0x092E0,
710 0x0C960,0x0D954,0x0D4A0,0x0DA50,0x07552,0x056A0,0x0ABB7,0x025D0,0x092D0,0x0CAB5,
711 0x0A950,0x0B4A0,0x0BAA4,0x0AD50,0x055D9,0x04BA0,0x0A5B0,0x15176,0x052B0,0x0A930,
712 0x07954,0x06AA0,0x0AD50,0x05B52,0x04B60,0x0A6E6,0x0A4E0,0x0D260,0x0EA65,0x0D530,
713 0x05AA0,0x076A3,0x096D0,0x04BD7,0x04AD0,0x0A4D0,0x1D0B6,0x0D250,0x0D520,0x0DD45,
714 0x0B5A0,0x056D0,0x055B2,0x049B0,0x0A577,0x0A4B0,0x0AA50,0x1B255,0x06D20,0x0ADA0,
715 0x14B63
716 };
717
718 #endregion
719
720 #region 星座名称
721 private static string[] _constellationName =
722 {
723 "白羊座", "金牛座", "双子座",
724 "巨蟹座", "狮子座", "处女座",
725 "天秤座", "天蝎座", "射手座",
726 "摩羯座", "水瓶座", "双鱼座"
727 };
728 #endregion
729
730 #region 二十四节气
731 private static string[] _lunarHolidayName =
732 {
733 "小寒", "大寒", "立春", "雨水",
734 "惊蛰", "春分", "清明", "谷雨",
735 "立夏", "小满", "芒种", "夏至",
736 "小暑", "大暑", "立秋", "处暑",
737 "白露", "秋分", "寒露", "霜降",
738 "立冬", "小雪", "大雪", "冬至"
739 };
740 #endregion
741
742 #region 二十八星宿
743 private static string[] _chineseConstellationName =
744 {
745 //四 五 六 日 一 二 三
746 "角木蛟","亢金龙","女土蝠","房日兔","心月狐","尾火虎","箕水豹",
747 "斗木獬","牛金牛","氐土貉","虚日鼠","危月燕","室火猪","壁水獝",
748 "奎木狼","娄金狗","胃土彘","昴日鸡","毕月乌","觜火猴","参水猿",
749 "井木犴","鬼金羊","柳土獐","星日马","张月鹿","翼火蛇","轸水蚓"
750 };
751 #endregion
752
753 #region 节气数据
754 private static string[] SolarTerm = new string[] { "小寒", "大寒", "立春", "雨水", "惊蛰", "春分", "清明", "谷雨", "立夏", "小满", "芒种", "夏至", "小暑", "大暑", "立秋", "处暑", "白露", "秋分", "寒露", "霜降", "立冬", "小雪", "大雪", "冬至" };
755 private static int[] sTermInfo = new int[] { 0, 21208, 42467, 63836, 85337, 107014, 128867, 150921, 173149, 195551, 218072, 240693, 263343, 285989, 308563, 331033, 353350, 375494, 397447, 419210, 440795, 462224, 483532, 504758 };
756 #endregion
757
758 #region 农历相关数据
759 private static string ganStr = "甲乙丙丁戊己庚辛壬癸";
760 private static string zhiStr = "子丑寅卯辰巳午未申酉戌亥";
761 private static string animalStr = "鼠牛虎兔龙蛇马羊猴鸡狗猪";
762 private static string nStr1 = "日一二三四五六七八九";
763 private static string nStr2 = "初十廿卅";
764 private static string[] _monthString =
765 {
766 "出错","正月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","腊月"
767 };
768 #endregion
769
770 #region 按公历计算的节日
771 private static SolarHolidayStruct[] sHolidayInfo = new SolarHolidayStruct[]{
772 new SolarHolidayStruct(1, 1, 1, "元旦"),
773 new SolarHolidayStruct(2, 2, 0, "世界湿地日"),
774 new SolarHolidayStruct(2, 10, 0, "国际气象节"),
775 new SolarHolidayStruct(2, 14, 0, "情人节"),
776 new SolarHolidayStruct(3, 1, 0, "国际海豹日"),
777 new SolarHolidayStruct(3, 5, 0, "学雷锋纪念日"),
778 new SolarHolidayStruct(3, 8, 0, "妇女节"),
779 new SolarHolidayStruct(3, 12, 0, "植树节 孙中山逝世纪念日"),
780 new SolarHolidayStruct(3, 14, 0, "国际警察日"),
781 new SolarHolidayStruct(3, 15, 0, "消费者权益日"),
782 new SolarHolidayStruct(3, 17, 0, "中国国医节 国际航海日"),
783 new SolarHolidayStruct(3, 21, 0, "世界森林日 消除种族歧视国际日 世界儿歌日"),
784 new SolarHolidayStruct(3, 22, 0, "世界水日"),
785 new SolarHolidayStruct(3, 24, 0, "世界防治结核病日"),
786 new SolarHolidayStruct(4, 1, 0, "愚人节"),
787 new SolarHolidayStruct(4, 7, 0, "世界卫生日"),
788 new SolarHolidayStruct(4, 22, 0, "世界地球日"),
789 new SolarHolidayStruct(5, 1, 1, "劳动节"),
790 new SolarHolidayStruct(5, 2, 1, "劳动节假日"),
791 new SolarHolidayStruct(5, 3, 1, "劳动节假日"),
792 new SolarHolidayStruct(5, 4, 0, "青年节"),
793 new SolarHolidayStruct(5, 8, 0, "世界红十字日"),
794 new SolarHolidayStruct(5, 12, 0, "国际护士节"),
795 new SolarHolidayStruct(5, 31, 0, "世界无烟日"),
796 new SolarHolidayStruct(6, 1, 0, "国际儿童节"),
797 new SolarHolidayStruct(6, 5, 0, "世界环境保护日"),
798 new SolarHolidayStruct(6, 26, 0, "国际禁毒日"),
799 new SolarHolidayStruct(7, 1, 0, "建党节 香港回归纪念 世界建筑日"),
800 new SolarHolidayStruct(7, 11, 0, "世界人口日"),
801 new SolarHolidayStruct(8, 1, 0, "建军节"),
802 new SolarHolidayStruct(8, 8, 0, "中国男子节 父亲节"),
803 new SolarHolidayStruct(8, 15, 0, "抗日战争胜利纪念"),
804 new SolarHolidayStruct(9, 9, 0, "毛主席逝世纪念"),
805 new SolarHolidayStruct(9, 10, 0, "教师节"),
806 new SolarHolidayStruct(9, 18, 0, "九·一八事变纪念日"),
807 new SolarHolidayStruct(9, 20, 0, "国际爱牙日"),
808 new SolarHolidayStruct(9, 27, 0, "世界旅游日"),
809 new SolarHolidayStruct(9, 28, 0, "孔子诞辰"),
810 new SolarHolidayStruct(10, 1, 1, "国庆节 国际音乐日"),
811 new SolarHolidayStruct(10, 2, 1, "国庆节假日"),
812 new SolarHolidayStruct(10, 3, 1, "国庆节假日"),
813 new SolarHolidayStruct(10, 6, 0, "老人节"),
814 new SolarHolidayStruct(10, 24, 0, "联合国日"),
815 new SolarHolidayStruct(11, 10, 0, "世界青年节"),
816 new SolarHolidayStruct(11, 12, 0, "孙中山诞辰纪念"),
817 new SolarHolidayStruct(12, 1, 0, "世界艾滋病日"),
818 new SolarHolidayStruct(12, 3, 0, "世界残疾人日"),
819 new SolarHolidayStruct(12, 20, 0, "澳门回归纪念"),
820 new SolarHolidayStruct(12, 24, 0, "平安夜"),
821 new SolarHolidayStruct(12, 25, 0, "圣诞节"),
822 new SolarHolidayStruct(12, 26, 0, "毛主席诞辰纪念")
823 };
824 #endregion
825
826 #region 按农历计算的节日
827 private static LunarHolidayStruct[] lHolidayInfo = new LunarHolidayStruct[]{
828 new LunarHolidayStruct(1, 1, 1, "春节"),
829 new LunarHolidayStruct(1, 15, 0, "元宵节"),
830 new LunarHolidayStruct(5, 5, 0, "端午节"),
831 new LunarHolidayStruct(7, 7, 0, "七夕情人节"),
832 new LunarHolidayStruct(7, 15, 0, "中元节 盂兰盆节"),
833 new LunarHolidayStruct(8, 15, 0, "中秋节"),
834 new LunarHolidayStruct(9, 9, 0, "重阳节"),
835 new LunarHolidayStruct(12, 8, 0, "腊八节"),
836 new LunarHolidayStruct(12, 23, 0, "北方小年(扫房)"),
837 new LunarHolidayStruct(12, 24, 0, "南方小年(掸尘)"),
838 //new LunarHolidayStruct(12, 30, 0, "除夕") //注意除夕需要其它方法进行计算
839 };
840 #endregion
841
842 #region 按某月第几个星期几
843 private static WeekHolidayStruct[] wHolidayInfo = new WeekHolidayStruct[]{
844 new WeekHolidayStruct(5, 2, 1, "母亲节"),
845 new WeekHolidayStruct(5, 3, 1, "全国助残日"),
846 new WeekHolidayStruct(6, 3, 1, "父亲节"),
847 new WeekHolidayStruct(9, 3, 3, "国际和平日"),
848 new WeekHolidayStruct(9, 4, 1, "国际聋人节"),
849 new WeekHolidayStruct(10, 1, 2, "国际住房日"),
850 new WeekHolidayStruct(10, 1, 4, "国际减轻自然灾害日"),
851 new WeekHolidayStruct(11, 4, 5, "感恩节")
852 };
853 #endregion
854 #endregion
855
856 #region 构造函数
857 #region 公历日期初始化
858 public ChineseCalendar(DateTime? dtParam = null)
862 {
863 var dt = dtParam ?? DateTime.Now;
864
865 int i;
866 int leap;
867 int temp;
868 int offset;
869
870 CheckDateLimit(dt);
871
872 _date = dt.Date;
873 _datetime = dt;
874
875 //农历日期计算部分
876 leap = 0;
877 temp = 0;
878
879 //计算两天的基本差距
880 TimeSpan ts = _date - ChineseCalendar.MinDay;
881 offset = ts.Days;
882
883 for (i = MinYear; i <= MaxYear; i++)
884 {
885 //求当年农历年天数
886 temp = GetChineseYearDays(i);
887 if (offset - temp < 1)
888 break;
889 else
890 {
891 offset = offset - temp;
892 }
893 }
894 _cYear = i;
895
896 //计算该年闰哪个月
897 leap = GetChineseLeapMonth(_cYear);
898
899 //设定当年是否有闰月
900 if (leap > 0)
901 {
902 _cIsLeapYear = true;
903 }
904 else
905 {
906 _cIsLeapYear = false;
907 }
908
909 _cIsLeapMonth = false;
910 for (i = 1; i <= 12; i++)
911 {
912 //闰月
913 if ((leap > 0) && (i == leap + 1) && (_cIsLeapMonth == false))
914 {
915 _cIsLeapMonth = true;
916 i = i - 1;
917 temp = GetChineseLeapMonthDays(_cYear); //计算闰月天数
918 }
919 else
920 {
921 _cIsLeapMonth = false;
922 temp = GetChineseMonthDays(_cYear, i); //计算非闰月天数
923 }
924
925 offset = offset - temp;
926 if (offset <= 0) break;
927 }
928
929 offset = offset + temp;
930 _cMonth = i;
931 _cDay = offset;
932 }
933 #endregion
934
935 #region 农历日期初始化
936 public ChineseCalendar(int cy, int cm, int cd, bool leapMonthFlag)
944 {
945 int i, leap, Temp, offset;
946
947 CheckChineseDateLimit(cy, cm, cd, leapMonthFlag);
948
949 _cYear = cy;
950 _cMonth = cm;
951 _cDay = cd;
952
953 offset = 0;
954
955 for (i = MinYear; i < cy; i++)
956 {
957 //求当年农历年天数
958 Temp = GetChineseYearDays(i);
959 offset = offset + Temp;
960 }
961
962 //计算该年应该闰哪个月
963 leap = GetChineseLeapMonth(cy);
964 if (leap != 0)
965 {
966 this._cIsLeapYear = true;
967 }
968 else
969 {
970 this._cIsLeapYear = false;
971 }
972
973 if (cm != leap)
974 {
975 //当前日期并非闰月
976 _cIsLeapMonth = false;
977 }
978 else
979 {
980 //使用用户输入的是否闰月月份
981 _cIsLeapMonth = leapMonthFlag;
982 }
983
984 //当年没有闰月||计算月份小于闰月
985 if ((_cIsLeapYear == false) || (cm < leap))
986 {
987 for (i = 1; i < cm; i++)
988 {
989 Temp = GetChineseMonthDays(cy, i);//计算非闰月天数
990 offset = offset + Temp;
991 }
992
993 //检查日期是否大于最大天
994 if (cd > GetChineseMonthDays(cy, cm))
995 {
996 throw new Exception("不合法的农历日期");
997 }
998 //加上当月的天数
999 offset = offset + cd;
1000 }
1001
1002 //是闰年，且计算月份大于或等于闰月
1003 else
1004 {
1005 for (i = 1; i < cm; i++)
1006 {
1007 //计算非闰月天数
1008 Temp = GetChineseMonthDays(cy, i);
1009 offset = offset + Temp;
1010 }
1011
1012 //计算月大于闰月
1013 if (cm > leap)
1014 {
1015 Temp = GetChineseLeapMonthDays(cy); //计算闰月天数
1016 offset = offset + Temp; //加上闰月天数
1017
1018 if (cd > GetChineseMonthDays(cy, cm))
1019 {
1020 throw new Exception("不合法的农历日期");
1021 }
1022 offset = offset + cd;
1023 }
1024
1025 //计算月等于闰月
1026 else
1027 {
1028 //如果需要计算的是闰月，则应首先加上与闰月对应的普通月的天数
1029 if (this._cIsLeapMonth == true) //计算月为闰月
1030 {
1031 Temp = GetChineseMonthDays(cy, cm); //计算非闰月天数
1032 offset = offset + Temp;
1033 }
1034
1035 if (cd > GetChineseLeapMonthDays(cy))
1036 {
1037 throw new Exception("不合法的农历日期");
1038 }
1039 offset = offset + cd;
1040 }
1041 }
1042 _date = MinDay.AddDays(offset);
1043 }
1044 #endregion
1045 #endregion
1046
1047 #region 私有函数
1048 #region GetChineseMonthDays
1049 private int GetChineseMonthDays(int year, int month)
1053 {
1054 if (BitTest32((LunarDateArray[year - MinYear] & 0x0000FFFF), (16 - month)))
1055 {
1056 return 30;
1057 }
1058 else
1059 {
1060 return 29;
1061 }
1062 }
1063 #endregion
1064
1065 #region GetChineseLeapMonth
1066 private int GetChineseLeapMonth(int year)
1070 {
1071 return LunarDateArray[year - MinYear] & 0xF;
1072 }
1073 #endregion
1074
1075 #region GetChineseLeapMonthDays
1076 private int GetChineseLeapMonthDays(int year)
1080 {
1081 if (GetChineseLeapMonth(year) != 0)
1082 {
1083 if ((LunarDateArray[year - MinYear] & 0x10000) != 0)
1084 {
1085 return 30;
1086 }
1087 else
1088 {
1089 return 29;
1090 }
1091 }
1092 else
1093 {
1094 return 0;
1095 }
1096 }
1097 #endregion
1098
1099 #region GetChineseYearDays
1100 private int GetChineseYearDays(int year)
1104 {
1105 int i, f, sumDay, info;
1106
1107 sumDay = 348; //29天*12个月
1108 i = 0x8000;
1109 info = LunarDateArray[year - MinYear] & 0x0FFFF;
1110
1111 //计算12个月中有多少天为30天
1112 for (int m = 0; m < 12; m++)
1113 {
1114 f = info & i;
1115 if (f != 0)
1116 {
1117 sumDay++;
1118 }
1119 i = i >> 1;
1120 }
1121 return sumDay + GetChineseLeapMonthDays(year);
1122 }
1123 #endregion
1124
1125 #region GetChineseHour
1126 private string GetChineseHour(DateTime dt)
1130 {
1131 int _hour, _minute, offset, i;
1132 int indexGan;
1133 string ganHour, zhiHour;
1134 string tmpGan;
1135
1136 //计算时辰的地支
1137 _hour = dt.Hour; //获得当前时间小时
1138 _minute = dt.Minute; //获得当前时间分钟
1139
1140 if (_minute != 0) _hour += 1;
1141 offset = _hour / 2;
1142 if (offset >= 12) offset = 0;
1143 //zhiHour = zhiStr[offset].ToString();
1144
1145 //计算天干
1146 TimeSpan ts = this._date - GanZhiStartDay;
1147 i = ts.Days % 60;
1148
1149 //ganStr[i % 10] 为日的天干,(n*2-1) %10得出地支对应,n从1开始
1150 indexGan = ((i % 10 + 1) * 2 - 1) % 10 - 1;
1151
1152 tmpGan = ganStr.Substring(indexGan) + ganStr.Substring(0, indexGan + 2);//凑齐12位
1153 //ganHour = ganStr[((i % 10 + 1) * 2 - 1) % 10 - 1].ToString();
1154
1155 return tmpGan[offset].ToString() + zhiStr[offset].ToString();
1156 }
1157 #endregion
1158
1159 #region CheckDateLimit
1160 private void CheckDateLimit(DateTime dt)
1164 {
1165 if ((dt < MinDay) || (dt > MaxDay))
1166 {
1167 throw new Exception("超出可转换的日期");
1168 }
1169 }
1170 #endregion
1171
1172 #region CheckChineseDateLimit
1173 private void CheckChineseDateLimit(int year, int month, int day, bool leapMonth)
1177 {
1178 if ((year < MinYear) || (year > MaxYear))
1179 {
1180 throw new Exception("非法农历日期");
1181 }
1182 if ((month < 1) || (month > 12))
1183 {
1184 throw new Exception("非法农历日期");
1185 }
1186 if ((day < 1) || (day > 30)) //中国的月最多30天
1187 {
1188 throw new Exception("非法农历日期");
1189 }
1190 int leap = GetChineseLeapMonth(year);// 计算该年应该闰哪个月
1191 if ((leapMonth == true) && (month != leap))
1192 {
1193 throw new Exception("非法农历日期");
1194 }
1195 }
1196 #endregion
1197
1198 #region ConvertNumToChineseNum
1199 private string ConvertNumToChineseNum(char n)
1203 {
1204 if ((n < '0') || (n > '9')) return "";
1205 switch (n)
1206 {
1207 case '0':
1208 return HZNum[0].ToString();
1209 case '1':
1210 return HZNum[1].ToString();
1211 case '2':
1212 return HZNum[2].ToString();
1213 case '3':
1214 return HZNum[3].ToString();
1215 case '4':
1216 return HZNum[4].ToString();
1217 case '5':
1218 return HZNum[5].ToString();
1219 case '6':
1220 return HZNum[6].ToString();
1221 case '7':
1222 return HZNum[7].ToString();
1223 case '8':
1224 return HZNum[8].ToString();
1225 case '9':
1226 return HZNum[9].ToString();
1227 default:
1228 return "";
1229 }
1230 }
1231 #endregion
1232
1233 #region BitTest32
1234 private bool BitTest32(int num, int bitpostion)
1238 {
1239 if ((bitpostion > 31) || (bitpostion < 0))
1240 throw new Exception("Error Param: bitpostion[0-31]:" + bitpostion.ToString());
1241
1242 int bit = 1 << bitpostion;
1243
1244 if ((num & bit) == 0)
1245 {
1246 return false;
1247 }
1248 else
1249 {
1250 return true;
1251 }
1252 }
1253 #endregion
1254
1255 #region ConvertDayOfWeek
1256 private int ConvertDayOfWeek(DayOfWeek dayOfWeek)
1260 {
1261 switch (dayOfWeek)
1262 {
1263 case DayOfWeek.Sunday:
1264 return 1;
1265 case DayOfWeek.Monday:
1266 return 2;
1267 case DayOfWeek.Tuesday:
1268 return 3;
1269 case DayOfWeek.Wednesday:
1270 return 4;
1271 case DayOfWeek.Thursday:
1272 return 5;
1273 case DayOfWeek.Friday:
1274 return 6;
1275 case DayOfWeek.Saturday:
1276 return 7;
1277 default:
1278 return 0;
1279 }
1280 }
1281 #endregion
1282
1283 #region CompareWeekDayHoliday
1284 private bool CompareWeekDayHoliday(DateTime date, int month, int week, int day)
1288 {
1289 bool ret = false;
1290
1291 if (date.Month == month) //月份相同
1292 {
1293 if (ConvertDayOfWeek(date.DayOfWeek) == day) //星期几相同
1294 {
1295 DateTime firstDay = new DateTime(date.Year, date.Month, 1);//生成当月第一天
1296 int i = ConvertDayOfWeek(firstDay.DayOfWeek);
1297 int firWeekDays = 7 - ConvertDayOfWeek(firstDay.DayOfWeek) + 1; //计算第一周剩余天数
1298
1299 if (i > day)
1300 {
1301 if ((week - 1) * 7 + day + firWeekDays == date.Day)
1302 {
1303 ret = true;
1304 }
1305 }
1306 else
1307 {
1308 if (day + firWeekDays + (week - 2) * 7 == date.Day)
1309 {
1310 ret = true;
1311 }
1312 }
1313 }
1314 }
1315
1316 return ret;
1317 }
1318 #endregion
1319 #endregion
1320
1321 #region 属性
1322 #region 节日
1323 #region newCalendarHoliday
1324 public string newCalendarHoliday
1328 {
1329 get
1330 {
1331 string tempStr = "";
1332 if (this._cIsLeapMonth == false) //闰月不计算节日
1333 {
1334 foreach (LunarHolidayStruct lh in lHolidayInfo)
1335 {
1336 if ((lh.Month == this._cMonth) && (lh.Day == this._cDay))
1337 {
1338
1339 tempStr = lh.HolidayName;
1340 break;
1341
1342 }
1343 }
1344
1345 //对除夕进行特别处理
1346 if (this._cMonth == 12)
1347 {
1348 int i = GetChineseMonthDays(this._cYear, 12); //计算当年农历12月的总天数
1349 if (this._cDay == i) //如果为最后一天
1350 {
1351 tempStr = "除夕";
1352 }
1353 }
1354 }
1355 return tempStr;
1356 }
1357 }
1358 #endregion
1359
1360 #region WeekDayHoliday
1361 public string WeekDayHoliday
1365 {
1366 get
1367 {
1368 string tempStr = "";
1369 foreach (WeekHolidayStruct wh in wHolidayInfo)
1370 {
1371 if (CompareWeekDayHoliday(_date, wh.Month, wh.WeekAtMonth, wh.WeekDay))
1372 {
1373 tempStr = wh.HolidayName;
1374 break;
1375 }
1376 }
1377 return tempStr;
1378 }
1379 }
1380 #endregion
1381
1382 #region DateHoliday
1383 public string DateHoliday
1387 {
1388 get
1389 {
1390 string tempStr = "";
1391
1392 foreach (SolarHolidayStruct sh in sHolidayInfo)
1393 {
1394 if ((sh.Month == _date.Month) && (sh.Day == _date.Day))
1395 {
1396 tempStr = sh.HolidayName;
1397 break;
1398 }
1399 }
1400 return tempStr;
1401 }
1402 }
1403 #endregion
1404 #endregion
1405
1406 #region 公历日期
1407 #region Date
1408 public DateTime Date
1412 {
1413 get { return _date; }
1414 set { _date = value; }
1415 }
1416 #endregion
1417
1418 #region WeekDay
1419 public DayOfWeek WeekDay
1423 {
1424 get { return _date.DayOfWeek; }
1425 }
1426 #endregion
1427
1428 #region WeekDayStr
1429 public string WeekDayStr
1433 {
1434 get
1435 {
1436 switch (_date.DayOfWeek)
1437 {
1438 case DayOfWeek.Sunday:
1439 return "星期日";
1440 case DayOfWeek.Monday:
1441 return "星期一";
1442 case DayOfWeek.Tuesday:
1443 return "星期二";
1444 case DayOfWeek.Wednesday:
1445 return "星期三";
1446 case DayOfWeek.Thursday:
1447 return "星期四";
1448 case DayOfWeek.Friday:
1449 return "星期五";
1450 default:
1451 return "星期六";
1452 }
1453 }
1454 }
1455 #endregion
1456
1457 #region DateString
1458 public string DateString
1462 {
1463 get
1464 {
1465 return "公元" + this._date.ToLongDateString();
1466 }
1467 }
1468 #endregion
1469
1470 #region IsLeapYear
1471 public bool IsLeapYear
1475 {
1476 get
1477 {
1478 return DateTime.IsLeapYear(this._date.Year);
1479 }
1480 }
1481 #endregion
1482
1483 #region ChineseConstellation
1484 public string ChineseConstellation
1488 {
1489 get
1490 {
1491 int offset = 0;
1492 int modStarDay = 0;
1493
1494 TimeSpan ts = this._date - ChineseConstellationReferDay;
1495 offset = ts.Days;
1496 modStarDay = offset % 28;
1497 return (modStarDay >= 0 ? _chineseConstellationName[modStarDay] : _chineseConstellationName[27 + modStarDay]);
1498 }
1499 }
1500 #endregion
1501
1502 #region ChineseHour
1503 public string ChineseHour
1507 {
1508 get
1509 {
1510 return GetChineseHour(_datetime);
1511 }
1512 }
1513 #endregion
1514
1515 #endregion
1516
1517 #region 农历日期
1518 #region IsChineseLeapMonth
1519 public bool IsChineseLeapMonth
1523 {
1524 get { return this._cIsLeapMonth; }
1525 }
1526 #endregion
1527
1528 #region IsChineseLeapYear
1529 public bool IsChineseLeapYear
1533 {
1534 get
1535 {
1536 return this._cIsLeapYear;
1537 }
1538 }
1539 #endregion
1540
1541 #region ChineseDay
1542 public int ChineseDay
1546 {
1547 get { return this._cDay; }
1548 }
1549 #endregion
1550
1551 #region ChineseDayString
1552 public string ChineseDayString
1556 {
1557 get
1558 {
1559 switch (this._cDay)
1560 {
1561 case 0:
1562 return "";
1563 case 10:
1564 return "初十";
1565 case 20:
1566 return "二十";
1567 case 30:
1568 return "三十";
1569 default:
1570 return nStr2[(int)(_cDay / 10)].ToString() + nStr1[_cDay % 10].ToString();
1571
1572 }
1573 }
1574 }
1575 #endregion
1576
1577 #region ChineseMonth
1578 public int ChineseMonth
1582 {
1583 get { return this._cMonth; }
1584 }
1585 #endregion
1586
1587 #region ChineseMonthString
1588 public string ChineseMonthString
1592 {
1593 get
1594 {
1595 return _monthString[this._cMonth];
1596 }
1597 }
1598 #endregion
1599
1600 #region ChineseYear
1601 public int ChineseYear
1605 {
1606 get { return this._cYear; }
1607 }
1608 #endregion
1609
1610 #region ChineseYearString
1611 public string ChineseYearString
1615 {
1616 get
1617 {
1618 string tempStr = "";
1619 string num = this._cYear.ToString();
1620 for (int i = 0; i < 4; i++)
1621 {
1622 tempStr += ConvertNumToChineseNum(num[i]);
1623 }
1624 return tempStr + "年";
1625 }
1626 }
1627 #endregion
1628
1629 #region ChineseDateString
1630 public string ChineseDateString
1634 {
1635 get
1636 {
1637 if (this._cIsLeapMonth == true)
1638 {
1639 return "农历" + ChineseYearString + "闰" + ChineseMonthString + ChineseDayString;
1640 }
1641 else
1642 {
1643 return "农历" + ChineseYearString + ChineseMonthString + ChineseDayString;
1644 }
1645 }
1646 }
1647 #endregion
1648
1649 #region ChineseTwentyFourDay
1650 public string ChineseTwentyFourDay
1662 {
1663 get
1664 {
1665 DateTime baseDateAndTime = new DateTime(1900, 1, 6, 2, 5, 0); //#1/6/1900 2:05:00 AM#
1666 DateTime newDate;
1667 double num;
1668 int y;
1669 string tempStr = "";
1670
1671 y = this._date.Year;
1672
1673 for (int i = 1; i <= 24; i++)
1674 {
1675 num = 525948.76 * (y - 1900) + sTermInfo[i - 1];
1676
1677 newDate = baseDateAndTime.AddMinutes(num);//按分钟计算
1678 if (newDate.DayOfYear == _date.DayOfYear)
1679 {
1680 tempStr = SolarTerm[i - 1];
1681 break;
1682 }
1683 }
1684 return tempStr;
1685 }
1686 }
1687
1691 public string ChineseTwentyFourPrevDay
1692 {
1693 get
1694 {
1695 DateTime baseDateAndTime = new DateTime(1900, 1, 6, 2, 5, 0); //#1/6/1900 2:05:00 AM#
1696 DateTime newDate;
1697 double num;
1698 int y;
1699 string tempStr = "";
1700
1701 y = this._date.Year;
1702
1703 for (int i = 24; i >= 1; i--)
1704 {
1705 num = 525948.76 * (y - 1900) + sTermInfo[i - 1];
1706
1707 newDate = baseDateAndTime.AddMinutes(num);//按分钟计算
1708
1709 if (newDate.DayOfYear < _date.DayOfYear)
1710 {
1711 tempStr = string.Format("{0}[{1}]", SolarTerm[i - 1], newDate.ToString("yyyy-MM-dd"));
1712 break;
1713 }
1714 }
1715
1716 return tempStr;
1717 }
1718
1719 }
1720
1724 public string ChineseTwentyFourNextDay
1725 {
1726 get
1727 {
1728 DateTime baseDateAndTime = new DateTime(1900, 1, 6, 2, 5, 0); //#1/6/1900 2:05:00 AM#
1729 DateTime newDate;
1730 double num;
1731 int y;
1732 string tempStr = "";
1733
1734 y = this._date.Year;
1735
1736 for (int i = 1; i <= 24; i++)
1737 {
1738 num = 525948.76 * (y - 1900) + sTermInfo[i - 1];
1739
1740 newDate = baseDateAndTime.AddMinutes(num);//按分钟计算
1741
1742 if (newDate.DayOfYear > _date.DayOfYear)
1743 {
1744 tempStr = string.Format("{0}[{1}]", SolarTerm[i - 1], newDate.ToString("yyyy-MM-dd"));
1745 break;
1746 }
1747 }
1748 return tempStr;
1749 }
1750
1751 }
1752 #endregion
1753 #endregion
1754
1755 #region 星座
1756 public string Constellation
1760 {
1761 get
1762 {
1763 int index = 0;
1764 int y, m, d;
1765 y = _date.Year;
1766 m = _date.Month;
1767 d = _date.Day;
1768 y = m * 100 + d;
1769
1770 if (((y >= 321) && (y <= 419))) { index = 0; }
1771 else if ((y >= 420) && (y <= 520)) { index = 1; }
1772 else if ((y >= 521) && (y <= 620)) { index = 2; }
1773 else if ((y >= 621) && (y <= 722)) { index = 3; }
1774 else if ((y >= 723) && (y <= 822)) { index = 4; }
1775 else if ((y >= 823) && (y <= 922)) { index = 5; }
1776 else if ((y >= 923) && (y <= 1022)) { index = 6; }
1777 else if ((y >= 1023) && (y <= 1121)) { index = 7; }
1778 else if ((y >= 1122) && (y <= 1221)) { index = 8; }
1779 else if ((y >= 1222) || (y <= 119)) { index = 9; }
1780 else if ((y >= 120) && (y <= 218)) { index = 10; }
1781 else if ((y >= 219) && (y <= 320)) { index = 11; }
1782 else { index = 0; }
1783
1784 return _constellationName[index];
1785 }
1786 }
1787 #endregion
1788
1789 #region 属相
1790 #region Animal
1791 public int Animal
1796 {
1797 get
1798 {
1799 int offset = _date.Year - AnimalStartYear;
1800 return (offset % 12) + 1;
1801 }
1802 }
1803 #endregion
1804
1805 #region AnimalString
1806 public string AnimalString
1810 {
1811 get
1812 {
1813 int offset = _date.Year - AnimalStartYear; //阳历计算
1814 //int offset = this._cYear - AnimalStartYear;　农历计算
1815 return animalStr[offset % 12].ToString();
1816 }
1817 }
1818 #endregion
1819 #endregion
1820
1821 #region 天干地支
1822 #region GanZhiYearString
1823 public string GanZhiYearString
1827 {
1828 get
1829 {
1830 string tempStr;
1831 int i = (this._cYear - GanZhiStartYear) % 60; //计算干支
1832 tempStr = ganStr[i % 10].ToString() + zhiStr[i % 12].ToString() + "年";
1833 return tempStr;
1834 }
1835 }
1836 #endregion
1837
1838 #region GanZhiMonthString
1839 public string GanZhiMonthString
1843 {
1844 get
1845 {
1846 //每个月的地支总是固定的,而且总是从寅月开始
1847 int zhiIndex;
1848 string zhi;
1849 if (this._cMonth > 10)
1850 {
1851 zhiIndex = this._cMonth - 10;
1852 }
1853 else
1854 {
1855 zhiIndex = this._cMonth + 2;
1856 }
1857 zhi = zhiStr[zhiIndex - 1].ToString();
1858
1859 //根据当年的干支年的干来计算月干的第一个
1860 int ganIndex = 1;
1861 string gan;
1862 int i = (this._cYear - GanZhiStartYear) % 60; //计算干支
1863 switch (i % 10)
1864 {
1865 #region ...
1866 case 0: //甲
1867 ganIndex = 3;
1868 break;
1869 case 1: //乙
1870 ganIndex = 5;
1871 break;
1872 case 2: //丙
1873 ganIndex = 7;
1874 break;
1875 case 3: //丁
1876 ganIndex = 9;
1877 break;
1878 case 4: //戊
1879 ganIndex = 1;
1880 break;
1881 case 5: //己
1882 ganIndex = 3;
1883 break;
1884 case 6: //庚
1885 ganIndex = 5;
1886 break;
1887 case 7: //辛
1888 ganIndex = 7;
1889 break;
1890 case 8: //壬
1891 ganIndex = 9;
1892 break;
1893 case 9: //癸
1894 ganIndex = 1;
1895 break;
1896 #endregion
1897 }
1898 gan = ganStr[(ganIndex + this._cMonth - 2) % 10].ToString();
1899
1900 return gan + zhi + "月";
1901 }
1902 }
1903 #endregion
1904
1905 #region GanZhiDayString
1906 public string GanZhiDayString
1910 {
1911 get
1912 {
1913 int i, offset;
1914 TimeSpan ts = this._date - GanZhiStartDay;
1915 offset = ts.Days;
1916 i = offset % 60;
1917 return ganStr[i % 10].ToString() + zhiStr[i % 12].ToString() + "日";
1918 }
1919 }
1920 #endregion
1921
1922 #region GanZhiDateString
1923 public string GanZhiDateString
1927 {
1928 get
1929 {
1930 return GanZhiYearString + GanZhiMonthString + GanZhiDayString;
1931 }
1932 }
1933 #endregion
1934 #endregion
1935 #endregion
1936 }
1937 }
SinGooCMS.Utility.ChineseCalendar.LunarHolidayStruct.Recess
int Recess
Definition: ChineseDateUtils.cs:637
SinGooCMS.Utility.CNDate.cnStrMonth
string cnStrMonth
农历月份(字符)
Definition: ChineseDateUtils.cs:31
SinGooCMS.Utility.ChineseCalendar._cDay
int _cDay
Definition: ChineseDateUtils.cs:671
SinGooCMS.Utility.ChinaDate.AnimalsYear
static String AnimalsYear(int y)
传回农历y年的生肖
Definition: ChineseDateUtils.cs:243
SinGooCMS.Utility.ChinaDate.calElement
static long[] calElement(int y, int m, int d)
传出y年m月d日对应的农历.year0 .month1 .day2 .yearCyl3 .monCyl4 .dayCyl5 .isLeap6
Definition: ChineseDateUtils.cs:351
SinGooCMS.Utility.ChinaDate.Lunar
long[] Lunar(int y, int m)
传出农历.year0 .month1 .day2 .yearCyl3 .monCyl4 .dayCyl5 .isLeap6
Definition: ChineseDateUtils.cs:268
SinGooCMS.Utility.ChineseCalendar.LunarHolidayStruct.LunarHolidayStruct
LunarHolidayStruct(int month, int day, int recess, string name)
Definition: ChineseDateUtils.cs:640
SinGooCMS.Utility.ChineseCalendar.WeekHolidayStruct.WeekDay
int WeekDay
Definition: ChineseDateUtils.cs:653
SinGooCMS.Utility.ChineseCalendar.SolarHolidayStruct.Month
int Month
Definition: ChineseDateUtils.cs:617
SinGooCMS.Utility.ChinaDate.leapMonth
static int leapMonth(int y)
传回农历y年闰哪个月 1-12 , 没闰传回 0
Definition: ChineseDateUtils.cs:224
System
SinGooCMS.Utility.ChineseCalendar.SolarHolidayStruct
阳历
Definition: ChineseDateUtils.cs:615
SinGooCMS.Utility.ChineseCalendar.WeekHolidayStruct.HolidayName
string HolidayName
Definition: ChineseDateUtils.cs:654
SinGooCMS.Utility.CNDate.cnStrDay
string cnStrDay
农历天(字符)
Definition: ChineseDateUtils.cs:35
SinGooCMS.Utility.ChineseCalendar.WeekHolidayStruct.WeekAtMonth
int WeekAtMonth
Definition: ChineseDateUtils.cs:652
SinGooCMS.Utility.ChineseCalendar.SolarHolidayStruct.Recess
int Recess
Definition: ChineseDateUtils.cs:619
SinGooCMS.Utility.ChineseCalendar.SolarHolidayStruct.HolidayName
string HolidayName
Definition: ChineseDateUtils.cs:620
SinGooCMS.Utility.ChineseCalendar._cYear
int _cYear
Definition: ChineseDateUtils.cs:669
SinGooCMS.Utility.ChineseCalendar._cIsLeapYear
bool _cIsLeapYear
Definition: ChineseDateUtils.cs:673
SinGooCMS.Utility.ChinaDate.cyclical
static String cyclical(int y)
传入offset 传回干支, 0=甲子
Definition: ChineseDateUtils.cs:259
SinGooCMS.Utility.ChinaDate.lYearDays
static int lYearDays(int y)
传回农历y年的总天数
Definition: ChineseDateUtils.cs:194
SinGooCMS.Utility.ChineseCalendar
中国日历
Definition: ChineseDateUtils.cs:609
SinGooCMS.Utility.CNDate.cnIntDay
int cnIntDay
农历天(整型)
Definition: ChineseDateUtils.cs:23
SinGooCMS.Utility.ChinaDate.monthDays
static int monthDays(int y, int m)
传回农历y年m月的总天数
Definition: ChineseDateUtils.cs:232
SinGooCMS.Utility.ChineseCalendar._date
DateTime _date
Definition: ChineseDateUtils.cs:667
SinGooCMS.Utility.ChineseCalendar.SolarHolidayStruct.SolarHolidayStruct
SolarHolidayStruct(int month, int day, int recess, string name)
Definition: ChineseDateUtils.cs:621
SinGooCMS.Utility.CNDate.cnIntYear
int cnIntYear
农历年(整型)
Definition: ChineseDateUtils.cs:15
SinGooCMS.Utility.CNDate.cnSolarTerm
string cnSolarTerm
二十四节气
Definition: ChineseDateUtils.cs:43
SinGooCMS.Utility.ChinaDate.GetChinaDate
static CNDate GetChinaDate(DateTime?dtPara=null)
获取农历
Definition: ChineseDateUtils.cs:531
SinGooCMS.Utility.ChinaDate.cyclicalm
static String cyclicalm(int num)
传入月日的offset 传回干支,0=甲子
Definition: ChineseDateUtils.cs:251
SinGooCMS.Utility.ChineseCalendar.LunarHolidayStruct.HolidayName
string HolidayName
Definition: ChineseDateUtils.cs:638
SinGooCMS.Utility.ChineseCalendar.WeekHolidayStruct
Definition: ChineseDateUtils.cs:649
SinGooCMS.Utility.ChinaDate
公历转农历
Definition: ChineseDateUtils.cs:66
SinGooCMS
SinGooCMS.Utility.CNDate.cnIntMonth
int cnIntMonth
农历月份(整型)
Definition: ChineseDateUtils.cs:19
SinGooCMS.Utility.ChinaDate.sTerm
static DateTime sTerm(int y, int n)
Definition: ChineseDateUtils.cs:481
SinGooCMS.Utility.CNDate.ToString
override string ToString()
重写ToString
Definition: ChineseDateUtils.cs:57
SinGooCMS.Utility.ChineseCalendar.LunarHolidayStruct.Day
int Day
Definition: ChineseDateUtils.cs:636
SinGooCMS.Utility.ChineseCalendar._cMonth
int _cMonth
Definition: ChineseDateUtils.cs:670
SinGooCMS.Utility.ChineseCalendar._cIsLeapMonth
bool _cIsLeapMonth
Definition: ChineseDateUtils.cs:672
SinGooCMS.Utility.ChineseCalendar.WeekHolidayStruct.WeekHolidayStruct
WeekHolidayStruct(int month, int weekAtMonth, int weekDay, string name)
Definition: ChineseDateUtils.cs:656
SinGooCMS.Utility.CNDate.cnAnm
string cnAnm
农历属象
Definition: ChineseDateUtils.cs:39
SinGooCMS.Utility.ChineseCalendar.LunarHolidayStruct.Month
int Month
Definition: ChineseDateUtils.cs:635
SinGooCMS.Utility.ChinaDate.getChinaDate
static String getChinaDate(int day)
Definition: ChineseDateUtils.cs:429
SinGooCMS.Utility.ChineseCalendar.SolarHolidayStruct.Day
int Day
Definition: ChineseDateUtils.cs:618
SinGooCMS.Utility.CNDate.cnStrYear
string cnStrYear
农历年(支干)
Definition: ChineseDateUtils.cs:27
SinGooCMS.Utility.ChineseCalendar.MinDay
static DateTime MinDay
Definition: ChineseDateUtils.cs:680
SinGooCMS.Utility.ChineseCalendar.WeekHolidayStruct.Month
int Month
Definition: ChineseDateUtils.cs:651
SinGooCMS.Utility.ChineseCalendar._datetime
DateTime _datetime
Definition: ChineseDateUtils.cs:668
SinGooCMS.Utility.ChinaDate.FormatDate
static string FormatDate(int m, int d)
Definition: ChineseDateUtils.cs:491
SinGooCMS.Utility.ChinaDate.GetMondayDateByDate
static DateTime GetMondayDateByDate(DateTime dt)
根据日期值获得周一的日期
Definition: ChineseDateUtils.cs:512
SinGooCMS.Utility.CNDate
农历属性
Definition: ChineseDateUtils.cs:10
SinGooCMS.Utility.ChineseCalendar.LunarHolidayStruct
农历
Definition: ChineseDateUtils.cs:633
SinGooCMS.Utility.ChinaDate.leapDays
static int leapDays(int y)
传回农历y年闰月的天数
Definition: ChineseDateUtils.cs:208


SinGooCMS.Utility: SinGooCMS.Utility/Config/ConfigUtils.cs 源文件

  • 文件列表
  • SinGooCMS.Utility
  • Config
ConfigUtils.cs
浏览该文件的文档.
1 using System;
2 using System.Configuration;
3 using System.Collections.Generic;
4 using System.Text;
5 using System.Linq;
6
7 #if NETSTANDARD2_1
8 using Microsoft.Extensions.Configuration;
9 using Microsoft.Extensions.Configuration.Json;
10 #endif
11
12 namespace SinGooCMS.Utility
13 {
20 public sealed class ConfigUtils
21 {
22 #if NETSTANDARD2_1
23 public static IConfiguration Configuration { get; set; }
27
28 static ConfigUtils()
29 {
30 Configuration = new ConfigurationBuilder()
31 .Add(new JsonConfigurationSource { Path = "appsettings.json", ReloadOnChange = true })
32 .Build();
33 }
34
35 #region 常用配置
36
40 public static string ProviderName => Configuration.GetConnectionString("ProviderName");
44 public static string DefConnStr => Configuration.GetConnectionString("SQLConnSTR");
48 public static IConfigurationSection ConnectionStrings => Configuration.GetSection("ConnectionStrings");
49
53 public static IConfigurationSection AppSettings => Configuration.GetSection("AppSettings");
54
55 #endregion
56
57 #region 读取配置
58
65 public static T GetByPath<T>(string path)
66 {
67 var section= Configuration.GetSection(path.Split(':')[0]);
68 return GetByPath<T>(section, path, 0);
69 }
70
71 private static T GetByPath<T>(IConfigurationSection section, string path, int depth)
72 {
73 var arr = path.Split(':');
74 var childs = section.GetChildren();
75
76 if (childs.Count() > 0 && depth < arr.Length - 1)
77 {
78 depth++;
79 var sectionNew = childs.Where(p => p.Key == arr[depth]).FirstOrDefault();
80 if (sectionNew != null)
81 return GetByPath<T>(sectionNew, path, depth);
82 else
83 return (T)Convert.ChangeType(section.Value, typeof(T));
84 }
85 else
86 {
87 return (T)Convert.ChangeType(section.Value, typeof(T));
88 }
89 }
90
97 public static T GetAppSetting<T>(string appSettingName) where T : IConvertible
98 {
99 return GetAppSettingInternal<T>(appSettingName, false, default);
100 }
108 public static T GetAppSetting<T>(string appSettingName, T defaultValue) where T : IConvertible
109 {
110 return GetAppSettingInternal<T>(appSettingName, true, defaultValue);
111 }
112
113 private static T GetAppSettingInternal<T>(string appSettingName, bool useDefaultOnUndefined, T defaultValue) where T : IConvertible
114 {
115 string value = AppSettings[appSettingName];
116 if (value == null)
117 {
118 if (useDefaultOnUndefined)
119 return defaultValue;
120 else
121 throw new Exception(string.Format("{0} not defined in appSettings.", appSettingName));
122 }
123
124 return (T)Convert.ChangeType(value, typeof(T));
125 }
126
127 #endregion
128
129 #else
130 public static T GetAppSetting<T>(string appSettingName) where T : IConvertible
137 {
138 return GetAppSettingInternal<T>(appSettingName, false, default(T));
139 }
147 public static T GetAppSetting<T>(string appSettingName, T defaultValue) where T : IConvertible
148 {
149 return GetAppSettingInternal<T>(appSettingName, true, defaultValue);
150 }
159 private static T GetAppSettingInternal<T>(string appSettingName, bool useDefaultOnUndefined, T defaultValue) where T : IConvertible
160 {
161 string value = ConfigurationManager.AppSettings[appSettingName];
162 if (value == null)
163 {
164 if (useDefaultOnUndefined)
165 return defaultValue;
166 else
167 throw new Exception(string.Format("{0} not defined in appSettings.", appSettingName));
168 }
169
170 return (T)Convert.ChangeType(value, typeof(T));
171 }
177 public static void AddConfigurationProperties(ConfigurationPropertyCollection collection, IEnumerable<ConfigurationProperty> properties)
178 {
179 if (collection == null)
180 throw new ArgumentNullException("collection");
181 if (properties == null)
182 throw new ArgumentNullException("properties");
183
184 foreach (ConfigurationProperty property in properties)
185 collection.Add(property);
186 }
187
191 public static string ProviderName => GetConnectionString().ProviderName;
192
196 public static string DefConnStr => GetConnectionString().ConnectionString;
197
203 public static ConnectionStringSettings GetConnectionString(string connectionStringName= "SQLConnSTR")
204 {
205 var settings = ConfigurationManager.ConnectionStrings[connectionStringName];
206
207 if (settings == null)
208 throw new Exception(string.Format("没有找到名称为'{0}'的连接字符串", connectionStringName));
209
210 return settings;
211 }
212 #endif
213 }
214 }
System
SinGooCMS.Utility.ConfigUtils
配置管理
Definition: ConfigUtils.cs:20
SinGooCMS.Utility.ConfigUtils.AddConfigurationProperties
static void AddConfigurationProperties(ConfigurationPropertyCollection collection, IEnumerable< ConfigurationProperty > properties)
添加配置属性
Definition: ConfigUtils.cs:177
SinGooCMS
SinGooCMS.Utility.ConfigUtils.GetConnectionString
static ConnectionStringSettings GetConnectionString(string connectionStringName="SQLConnSTR")
获取连接字符串 配置如 Definition: ConfigUtils.cs:203


SinGooCMS.Utility: SinGooCMS.Utility/Web/CookieUtils.cs 源文件

  • 文件列表
  • SinGooCMS.Utility
  • Web
CookieUtils.cs
浏览该文件的文档.
1 #if NETSTANDARD2_1
2 using Microsoft.AspNetCore.Http;
3 #else
4 using System.Web;
5 #endif
6 using System;
7 using System.Linq;
8
9
10 namespace SinGooCMS.Utility
11 {
15 public sealed class CookieUtils
16 {
22 public static bool ContainKey(string key)
23 {
24 #if NETSTANDARD2_1
25 return UtilsBase.HttpContext.Request.Cookies.ContainsKey(key);
26 #else
27 return UtilsBase.HttpContext.Request.Cookies.AllKeys.Contains(key);
28 #endif
29 }
30
36 public static void SetCookie(string key, string value)
37 {
38 SetCookie(key, value, 3600 * 24 * 365);
39 }
40
48 public static void SetCookie(string key, string value, int expires = 30 * 60, bool isHttpOnly = true)
49 {
50 #if NETSTANDARD2_1
51 if (!UtilsBase.HttpContext.Response.Headers.IsReadOnly)
52 {
53 UtilsBase.HttpContext.Response.Cookies.Append(key, value, new CookieOptions
54 {
55 Expires = DateTime.Now.AddSeconds(expires),
56 HttpOnly = isHttpOnly
57 });
58 }
59 #else
60 if (UtilsBase.HttpContext != null)
61 {
62 var cookie = UtilsBase.HttpContext.Request.Cookies[key];
63 if (cookie == null)
64 cookie = new HttpCookie(key);
65
66 cookie.Value = value;
67 if (expires > 0)
68 cookie.Expires = DateTime.Now.AddSeconds(expires);
69
70 //cookie.Path = strPath;
71 cookie.HttpOnly = isHttpOnly;
72
73 if (cookie == null)
74 UtilsBase.HttpContext.Response.SetCookie(cookie);
75 else
76 UtilsBase.HttpContext.Response.AppendCookie(cookie);
77 }
78 #endif
79 }
80
86 public static string GetCookie(string key)
87 {
88 #if NETSTANDARD2_1
89 UtilsBase.HttpContext.Request.Cookies.TryGetValue(key, out string value);
90 return string.IsNullOrEmpty(value) ? string.Empty : value;
91 #else
92 if (UtilsBase.HttpContext != null
93 && UtilsBase.HttpContext.Request.Cookies != null
94 && UtilsBase.HttpContext.Request.Cookies[key] != null)
95 {
96 return HttpContext.Current.Request.Cookies[key].Value;
97 }
98
99 return string.Empty;
100 #endif
101 }
102
107 public static void RemoveCookie(string key)
108 {
109 #if NETSTANDARD2_1
110 UtilsBase.HttpContext.Response.Cookies.Delete(key);
111 #else
112 if (UtilsBase.HttpContext != null)
113 {
114 HttpCookie cookie = UtilsBase.HttpContext.Request.Cookies[key];
115 if (cookie != null)
116 {
117 UtilsBase.HttpContext.Request.Cookies.Remove(key);
118 }
119 }
120 #endif
121 }
122 }
123 }
SinGooCMS.Utility.CookieUtils.SetCookie
static void SetCookie(string key, string value)
写入cookie(有效期一年)
Definition: CookieUtils.cs:36
System
SinGooCMS.Utility.UtilsBase.HttpContext
static HttpContext HttpContext
http上下文
Definition: UtilsBase.cs:43
SinGooCMS.Utility.CookieUtils.ContainKey
static bool ContainKey(string key)
是否包含key
Definition: CookieUtils.cs:22
SinGooCMS
SinGooCMS.Utility.CookieUtils
cookie工具
Definition: CookieUtils.cs:15
SinGooCMS.Utility.CookieUtils.GetCookie
static string GetCookie(string key)
读cookie值
Definition: CookieUtils.cs:86
SinGooCMS.Utility.UtilsBase
工具底层，主要获取 http上下文 HttpContext。netfx从system.web中读取，core需要注入
Definition: UtilsBase.cs:13
SinGooCMS.Utility.CookieUtils.SetCookie
static void SetCookie(string key, string value, int expires=30 *60, bool isHttpOnly=true)
写入cookie
Definition: CookieUtils.cs:48
SinGooCMS.Utility.CookieUtils.RemoveCookie
static void RemoveCookie(string key)
清除cookie
Definition: CookieUtils.cs:107


SinGooCMS.Utility: SinGooCMS.Utility/Data/CsvUtils.cs 源文件

  • 文件列表
  • SinGooCMS.Utility
  • Data
CsvUtils.cs
浏览该文件的文档.
1 using System;
2 using System.Collections;
3 using System.Collections.Generic;
4 using System.Data;
5 using System.Globalization;
6 using System.IO;
7 using System.Linq;
8 using System.Text;
9 using System.Threading.Tasks;
10 using CsvHelper;
11 using CsvHelper.Configuration;
12
13 namespace SinGooCMS.Utility
14 {
18 public class CsvUtils
19 {
20 #region Read
21
29 public static IList<T> Read<T>(string csvFilePath, string encoding = "utf-8")
30 {
31 if (File.Exists(csvFilePath))
32 {
33 #if NETSTANDARD2_1
34 Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
35 #endif
36 using (var reader = new StreamReader(csvFilePath, Encoding.GetEncoding(encoding)))
37 {
38 using (var csv = new CsvReader(reader, CultureInfo.InvariantCulture))
39 {
40 return csv.GetRecords<T>()?.ToList();
41 }
42 }
43 }
44
45 return null;
46 }
47
54 public static DataTable Read(string csvFilePath, string encoding = "utf-8")
55 {
56 if (File.Exists(csvFilePath))
57 {
58 var csvData = new DataTable();
59
60 #if NETSTANDARD2_1
61 Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
62 #endif
63 using (var reader = new StreamReader(csvFilePath, Encoding.GetEncoding(encoding)))
64 {
65 using (var csv = new CsvReader(reader, CultureInfo.InvariantCulture))
66 {
67 // Do any configuration to `CsvReader` before creating CsvDataReader.
68 using (var dr = new CsvDataReader(csv))
69 {
70 csvData.Load(dr);
71 }
72 }
73 }
74
75 return csvData;
76 }
77
78 return null;
79 }
80
81 #endregion
82
83 #region Write
84
91 public static void Write(DataTable dt, string csvFilePath, string encoding = "utf-8")
92 {
93 var builder = new StringBuilder();
94 for (var i = 0; i < dt.Columns.Count; i++)
95 {
96 builder.Append(dt.Columns[i].ColumnName);
97 if (i < dt.Columns.Count - 1)
98 builder.Append(",");
99 }
100
101 string colNames = builder.ToString();
102
103 #if NETSTANDARD2_1
104 Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
105 #endif
106 StreamWriter strmWriterObj = new StreamWriter(csvFilePath, false, Encoding.GetEncoding(encoding));
107
108 strmWriterObj.WriteLine(colNames);
109 string strBufferLine = "";
110 for (int i = 0; i < dt.Rows.Count; i++)
111 {
112 strBufferLine = "";
113 for (int j = 0; j < dt.Columns.Count; j++)
114 {
115 if (j > 0)
116 strBufferLine += ",";
117 strBufferLine += dt.Rows[i][j].ToString();
118 }
119 strmWriterObj.WriteLine(strBufferLine);
120 }
121 strmWriterObj.Close();
122 }
123
130 public static async Task WriteAsync(DataTable dt, string csvFilePath, string encoding = "utf-8")
131 {
132 var builder = new StringBuilder();
133 for (var i = 0; i < dt.Columns.Count; i++)
134 {
135 builder.Append(dt.Columns[i].ColumnName);
136 if (i < dt.Columns.Count - 1)
137 builder.Append(",");
138 }
139
140 string colNames = builder.ToString();
141
142 #if NETSTANDARD2_1
143 Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
144 #endif
145 StreamWriter strmWriterObj = new StreamWriter(csvFilePath, false, Encoding.GetEncoding(encoding));
146
147 await strmWriterObj.WriteLineAsync(colNames);
148 string strBufferLine = "";
149 for (int i = 0; i < dt.Rows.Count; i++)
150 {
151 strBufferLine = "";
152 for (int j = 0; j < dt.Columns.Count; j++)
153 {
154 if (j > 0)
155 strBufferLine += ",";
156 strBufferLine += dt.Rows[i][j].ToString();
157 }
158 await strmWriterObj.WriteLineAsync(strBufferLine);
159 }
160 strmWriterObj.Close();
161 }
162
170 public static void Write<T>(IEnumerable<T> csvLst, string csvFilePath, string encoding = "utf-8")
171 {
172 #if NETSTANDARD2_1
173 Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
174 #endif
175 using (var writer = new StreamWriter(csvFilePath, false, Encoding.GetEncoding(encoding)))
176 {
177 var cfg = new CsvConfiguration(CultureInfo.InvariantCulture) { Encoding = Encoding.GetEncoding(encoding) };
178 using (var csv = new CsvWriter(writer, cfg))
179 {
180 csv.WriteRecords(csvLst);
181 csv.Flush();
182 }
183 }
184 }
185
193 public async static Task WriteAsync<T>(IEnumerable<T> csvLst, string csvFilePath, string encoding = "utf-8")
194 {
195 #if NETSTANDARD2_1
196 Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
197 #endif
198 using (var writer = new StreamWriter(csvFilePath, false, Encoding.GetEncoding(encoding)))
199 {
200 var cfg = new CsvConfiguration(CultureInfo.InvariantCulture) { Encoding = Encoding.GetEncoding(encoding) };
201 using (var csv = new CsvWriter(writer, cfg))
202 {
203 await csv.WriteRecordsAsync(csvLst);
204 await csv.FlushAsync();
205 }
206 }
207 }
208
209 #endregion
210 }
211 }
SinGooCMS.Utility.CsvUtils.Write
static void Write(DataTable dt, string csvFilePath, string encoding="utf-8")
写csv文件
Definition: CsvUtils.cs:91
System
SinGooCMS.Utility.CsvUtils
csv工具
Definition: CsvUtils.cs:18
SinGooCMS
CsvHelper
SinGooCMS.Utility.CsvUtils.WriteAsync
static async Task WriteAsync(DataTable dt, string csvFilePath, string encoding="utf-8")
写csv文件
Definition: CsvUtils.cs:130
SinGooCMS.Utility.CsvUtils.Read
static DataTable Read(string csvFilePath, string encoding="utf-8")
读csv到datatable
Definition: CsvUtils.cs:54


SinGooCMS.Utility: SinGooCMS.Utility/Security/DEncryptUtils.cs 源文件

  • 文件列表
  • SinGooCMS.Utility
  • Security
DEncryptUtils.cs
浏览该文件的文档.
1 using System;
2 using System.Text;
3 using System.Security.Cryptography;
4 using System.IO;
5 using System.Collections.Generic;
6 using System.Linq;
7
8 namespace SinGooCMS.Utility
9 {
13 public sealed class DEncryptUtils
14 {
15 #region 对称加密
16
17 #region DES
18
25 public static string DESEncrypt(string strTxt, string strKey)
26 {
27 DESCryptoServiceProvider provider = new DESCryptoServiceProvider();
28 provider.Key = Encoding.ASCII.GetBytes(strKey.Substring(0, 8));
29 provider.IV = Encoding.ASCII.GetBytes(strKey.Substring(0, 8));
30 byte[] bytes = Encoding.UTF8.GetBytes(strTxt);
31 MemoryStream stream = new MemoryStream();
32 CryptoStream stream2 = new CryptoStream(stream, provider.CreateEncryptor(), CryptoStreamMode.Write);
33 stream2.Write(bytes, 0, bytes.Length);
34 stream2.FlushFinalBlock();
35 StringBuilder builder = new StringBuilder();
36 foreach (byte num in stream.ToArray())
37 {
38 builder.AppendFormat("{0:X2}", num);
39 }
40 stream.Close();
41 return builder.ToString();
42 }
43
50 public static string DESDecrypt(string strTxt, string strKey)
51 {
52 DESCryptoServiceProvider provider = new DESCryptoServiceProvider();
53 provider.Key = Encoding.ASCII.GetBytes(strKey.Substring(0, 8));
54 provider.IV = Encoding.ASCII.GetBytes(strKey.Substring(0, 8));
55 byte[] buffer = new byte[strTxt.Length / 2];
56 for (int i = 0; i < (strTxt.Length / 2); i++)
57 {
58 int num2 = Convert.ToInt32(strTxt.Substring(i * 2, 2), 0x10);
59 buffer[i] = (byte)num2;
60 }
61 MemoryStream stream = new MemoryStream();
62 CryptoStream stream2 = new CryptoStream(stream, provider.CreateDecryptor(), CryptoStreamMode.Write);
63 stream2.Write(buffer, 0, buffer.Length);
64 stream2.FlushFinalBlock();
65 stream.Close();
66 return Encoding.UTF8.GetString(stream.ToArray());
67 }
68
69 #endregion
70
71 #region AES
72
78 private static byte[] GetAesKey(string key)
79 {
80 if (string.IsNullOrEmpty(key))
81 {
82 throw new ArgumentNullException("key", "Aes密钥不能为空");
83 }
84 if (key.Length < 32)
85 {
86 // 不足32补全
87 key = key.PadRight(32, '0');
88 }
89 if (key.Length > 32)
90 {
91 key = key.Substring(0, 32);
92 }
93 return Encoding.UTF8.GetBytes(key);
94 }
95
102 public static string AESEncrypt(string text,string key)
103 {
104 using (AesCryptoServiceProvider aesProvider = new AesCryptoServiceProvider())
105 {
106 aesProvider.Key = GetAesKey(key);
107 aesProvider.Mode = CipherMode.ECB;
108 aesProvider.Padding = PaddingMode.PKCS7;
109 using (ICryptoTransform cryptoTransform = aesProvider.CreateEncryptor())
110 {
111 byte[] inputBuffers = Encoding.UTF8.GetBytes(text);
112 byte[] results = cryptoTransform.TransformFinalBlock(inputBuffers, 0, inputBuffers.Length);
113 aesProvider.Clear();
114 aesProvider.Dispose();
115 return Convert.ToBase64String(results, 0, results.Length);
116 }
117 }
118 }
119
126 public static string AESDecrypt(string text,string key)
127 {
128 using (AesCryptoServiceProvider aesProvider = new AesCryptoServiceProvider())
129 {
130 aesProvider.Key = GetAesKey(key);
131 aesProvider.Mode = CipherMode.ECB;
132 aesProvider.Padding = PaddingMode.PKCS7;
133 using (ICryptoTransform cryptoTransform = aesProvider.CreateDecryptor())
134 {
135 byte[] inputBuffers = Convert.FromBase64String(text);
136 byte[] results = cryptoTransform.TransformFinalBlock(inputBuffers, 0, inputBuffers.Length);
137 aesProvider.Clear();
138 return Encoding.UTF8.GetString(results);
139 }
140 }
141 }
142
143 #endregion
144
145 #region Base64
146
152 public static string Base64Encrypt(string strTxt)
153 {
154 byte[] encbuff = System.Text.Encoding.UTF8.GetBytes(strTxt);
155 return Convert.ToBase64String(encbuff);
156 }
157
163 public static string Base64Decrypt(string strTxt)
164 {
165 byte[] decbuff = Convert.FromBase64String(strTxt);
166 return System.Text.Encoding.UTF8.GetString(decbuff);
167 }
168
169 #endregion
170
171 #region 异或加密
172
179 public static string GetXORCode(string strTxt, string strKey)
180 {
181 byte[] bStr = (new UnicodeEncoding()).GetBytes(strTxt);
182 byte[] bKey = (new UnicodeEncoding()).GetBytes(strKey);
183
184 for (int i = 0; i < bStr.Length; i += 2)
185 {
186 for (int j = 0; j < bKey.Length; j += 2)
187 {
188 bStr[i] = Convert.ToByte(bStr[i] ^ bKey[j]);
189 }
190 }
191
192 return (new UnicodeEncoding()).GetString(bStr).TrimEnd('\0');
193 }
194
195 #endregion
196
197 #region Base36
198
199 private const string Base36Characters = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
200
206 public static string Base36Encode(long input)
207 {
208 var arr = Base36Characters.ToCharArray();
209 var result = new Stack<char>();
210 while (input != 0)
211 {
212 result.Push(arr[input % 36]);
213 input /= 36;
214 }
215 return new string(result.ToArray());
216 }
217
223 public static long Base36Decode(string input)
224 {
225 var reversed = input.ToUpper().Reverse();
226 long result = 0;
227 var pos = 0;
228 foreach (var c in reversed)
229 {
230 result += Base36Characters.IndexOf(c) * (long)Math.Pow(36, pos);
231 pos++;
232 }
233 return result;
234 }
235
236 #endregion
237
238 #endregion
239
240 #region 非对称加密
241
242 #region MD5加密
243 public static string MD5Encrypt(string password)
249 {
250 MD5CryptoServiceProvider hashmd5 = new MD5CryptoServiceProvider();
251 string md5 = BitConverter.ToString(hashmd5.ComputeHash(Encoding.Default.GetBytes(password))).Replace("-", "").Substring(6, 13);
252 return BitConverter.ToString(hashmd5.ComputeHash(Encoding.Default.GetBytes(md5))).Replace("-", "").Substring(6, 13);
253 }
254 #endregion
255
256 #region SHA512加密
257 public static string SHA512Encrypt(string strTxt)
263 {
264 byte[] byteTemp;
265 SHA512 sha512 = new SHA512Managed();
266
267 UTF8Encoding utf8 = new UTF8Encoding();
268 byteTemp = utf8.GetBytes(strTxt);
269 byteTemp = sha512.ComputeHash(byteTemp);
270
271 String strTemp = "";
272 for (int i = 0; i < byteTemp.Length; i++)
273 strTemp += byteTemp[i].ToString("x2"); //返回密码串小写x2 大写X2
274
275 return strTemp;
276 }
277 #endregion
278
279 #endregion
280 }
281 }
System
SinGooCMS.Utility.DEncryptUtils.DESEncrypt
static string DESEncrypt(string strTxt, string strKey)
DES加密
Definition: DEncryptUtils.cs:25
SinGooCMS.Utility.DEncryptUtils.AESEncrypt
static string AESEncrypt(string text, string key)
AES加密
Definition: DEncryptUtils.cs:102
SinGooCMS.Utility.DEncryptUtils.GetXORCode
static string GetXORCode(string strTxt, string strKey)
异或加密,对原文加密成密文,对密文加密成原文
Definition: DEncryptUtils.cs:179
SinGooCMS.Utility.DEncryptUtils.Base64Encrypt
static string Base64Encrypt(string strTxt)
Base64加密
Definition: DEncryptUtils.cs:152
SinGooCMS.Utility.DEncryptUtils.Base36Encode
static string Base36Encode(long input)
将给定的数字编码为字符串。
Definition: DEncryptUtils.cs:206
SinGooCMS.Utility.DEncryptUtils.GetAesKey
static byte[] GetAesKey(string key)
获取Aes32位密钥
Definition: DEncryptUtils.cs:78
SinGooCMS.Utility.DEncryptUtils.Base36Decode
static long Base36Decode(string input)
将编码的字符串解码为长整数。
Definition: DEncryptUtils.cs:223
SinGooCMS
SinGooCMS.Utility.DEncryptUtils.AESDecrypt
static string AESDecrypt(string text, string key)
AES解密
Definition: DEncryptUtils.cs:126
SinGooCMS.Utility.DEncryptUtils.DESDecrypt
static string DESDecrypt(string strTxt, string strKey)
Des 解密
Definition: DEncryptUtils.cs:50
SinGooCMS.Utility.DEncryptUtils
加密解密工具
Definition: DEncryptUtils.cs:13
SinGooCMS.Utility.DEncryptUtils.Base64Decrypt
static string Base64Decrypt(string strTxt)
Base64解密
Definition: DEncryptUtils.cs:163


SinGooCMS.Utility: SinGooCMS.Utility/Extension/DataTableExtension.cs 源文件

  • 文件列表
  • SinGooCMS.Utility
  • Extension
DataTableExtension.cs
浏览该文件的文档.
1 using System;
2 using System.Text;
3 using System.Collections;
4 using System.Collections.Generic;
5 using System.Data;
6 using System.Linq;
7 using System.Threading.Tasks;
8
9 namespace SinGooCMS.Utility.Extension
10 {
14 public static class DataTableExtension
15 {
22 public static DataTable ToDistinctTable(this DataTable table, string[] arrFilter)
23 {
24 var dv = table.AsDataView();
25 return dv.ToTable(true, arrFilter);
26 }
27
28 #region DataTable转对象
29
36 public static T ToEntity<T>(this DataTable table) where T : new()
37 {
38 var entity = new T();
39 foreach (DataRow row in table.Rows)
40 {
41 foreach (var item in entity.GetType().GetProperties())
42 {
43 if (!row.Table.Columns.Contains(item.Name)) continue;
44 if (DBNull.Value == row[item.Name]) continue;
45 var newType = item.PropertyType;
46 //判断type类型是否为泛型，因为nullable是泛型类,
47 if (newType.IsGenericType && newType.GetGenericTypeDefinition() == typeof(Nullable<>))
48 {
49 //如果type为nullable类，声明一个NullableConverter类，该类提供从Nullable类到基础基元类型的转换
50 var nullableConverter = new System.ComponentModel.NullableConverter(newType);
51 //将type转换为nullable对的基础基元类型
52 newType = nullableConverter.UnderlyingType;
53 }
54
55 item.SetValue(entity, Convert.ChangeType(row[item.Name], newType), null);
56 }
57 }
58 return entity;
59 }
60
67 public static IEnumerable<T> ToEnumerable<T>(this DataTable table) where T : class, new()
68 {
69 var entities = new List<T>();
70 if (table == null)
71 return null;
72 foreach (DataRow row in table.Rows)
73 {
74 var entity = new T();
75 foreach (var item in entity.GetType().GetProperties())
76 {
77 if (!table.Columns.Contains(item.Name)) continue;
78 if (DBNull.Value == row[item.Name]) continue;
79 var newType = item.PropertyType;
80 //判断type类型是否为泛型，因为nullable是泛型类,
81 if (newType.IsGenericType && newType.GetGenericTypeDefinition() == typeof(Nullable<>))
82 {
83 //如果type为nullable类，声明一个NullableConverter类，该类提供从Nullable类到基础基元类型的转换
84 System.ComponentModel.NullableConverter nullableConverter = new System.ComponentModel.NullableConverter(newType);
85 //将type转换为nullable对的基础基元类型
86 newType = nullableConverter.UnderlyingType;
87 }
88 item.SetValue(entity, Convert.ChangeType(row[item.Name], newType), null);
89 }
90 entities.Add(entity);
91 }
92 return entities;
93 }
94
95 #endregion
96
97 #region dt转arraylist
98
104 public static ArrayList ToArrayList(this DataTable table)
105 {
106 ArrayList array = new ArrayList();
107 if (table != null && table.Rows.Count > 0)
108 {
109 for (int i = 0; i < table.Rows.Count; i++)
110 {
111 DataRow row = table.Rows[i];
112 Hashtable record = new Hashtable();
113 for (int j = 0; j < table.Columns.Count; j++)
114 {
115 object cellValue = row[j];
116 if (cellValue.GetType() == typeof(DBNull))
117 {
118 cellValue = null;
119 }
120 record[table.Columns[j].ColumnName] = cellValue;
121 }
122 array.Add(record);
123 }
124 }
125
126 return array;
127 }
128
129 #endregion
130
131 #region 行处理
132
140 public static DataRow FindRow(this DataTable dt, string colKey, string colValue)
141 {
142 return dt != null && dt.Rows.Count > 0
143 ? dt.AsEnumerable().Where(p => p.Field<string>(colKey).ToString().Equals(colValue)).FirstOrDefault()
144 : null;
145 }
146
154 public static bool ExistsRow(this DataTable dt, string colKey, string colValue)
155 {
156 return dt.FindRow(colKey, colValue) != null;
157 }
158
164 public static DataTable RemoveEmptyRow(this DataTable dt)
165 {
166 var lst = new List<DataRow>();
167 for (int i = 0; i < dt.Rows.Count; i++)
168 {
169 bool IsNull = true;
170 for (int j = 0; j < dt.Columns.Count; j++)
171 {
172 if (!string.IsNullOrEmpty(dt.Rows[i][j].ToString().Trim()))
173 {
174 IsNull = false;
175 break;
176 }
177 }
178
179 if (IsNull)
180 lst.Add(dt.Rows[i]);
181 }
182
183 for (int i = 0; i < lst.Count; i++)
184 {
185 dt.Rows.Remove(lst[i]);
186 }
187
188 return dt;
189 }
190
191 #endregion
192
193 #region 列处理
194
201 public static DataTable ChangeColNames(this DataTable table, Dictionary<string, string> newColNames)
202 {
203 foreach (DataColumn col in table.Columns)
204 {
205 if (newColNames.Any(p => p.Key == col.ColumnName))
206 {
207 col.ColumnName = newColNames[col.ColumnName]; //换成新的列名，比如说导出的excel列头要有意义的中文名
208 }
209 }
210
211 return table;
212 }
213
214 #endregion
215
216 #region datatable写入excel
217
224 public static void SaveToExcel(this DataTable table, string excelFileFullPath, string sheetName = "sheet1") =>
225 NPOIUtils.Save(table, excelFileFullPath, sheetName);
226
232 public static void SaveToExcel(this Dictionary<string, DataTable> tables, string excelFileFullPath) =>
233 NPOIUtils.Save(tables, excelFileFullPath);
234
235 #endregion
236
237 #region datatable写入csv
238
245 public static void SaveToCsv(this DataTable table, string csvFileFullPath, string encoding = "utf-8") =>
246 CsvUtils.Write(table, csvFileFullPath, encoding);
247
254 public static async Task SaveToCsvAsync(this DataTable table, string csvFileFullPath, string encoding = "utf-8") =>
255 await CsvUtils.WriteAsync(table, csvFileFullPath, encoding);
256
263 public static void SaveToCsv<T>(this DataTable table, string csvFileFullPath, string encoding = "utf-8") where T : class, new()
264 {
265 CsvUtils.Write<T>(table.ToEnumerable<T>(), csvFileFullPath, encoding);
266 }
267
276 public static async Task SaveToCsvAsync<T>(this DataTable table, string csvFileFullPath, string encoding = "utf-8") where T : class, new()
277 {
278 await CsvUtils.WriteAsync<T>(table.ToEnumerable<T>(), csvFileFullPath, encoding);
279 }
280
281 #endregion
282 }
283 }
SinGooCMS.Utility.CsvUtils.Write
static void Write(DataTable dt, string csvFilePath, string encoding="utf-8")
写csv文件
Definition: CsvUtils.cs:91
SinGooCMS.Utility.Extension.DataTableExtension.ExistsRow
static bool ExistsRow(this DataTable dt, string colKey, string colValue)
是否存在行值
Definition: DataTableExtension.cs:154
SinGooCMS.Utility.Extension.SequenceType.Hashtable
代表 System.Collections.Hashtable. 非泛型
SinGooCMS.Utility.Extension.DataTableExtension.ToDistinctTable
static DataTable ToDistinctTable(this DataTable table, string[] arrFilter)
获得一个去重的新表
Definition: DataTableExtension.cs:22
SinGooCMS.Utility.Extension.DataTableExtension.ToArrayList
static ArrayList ToArrayList(this DataTable table)
dt转arraylist
Definition: DataTableExtension.cs:104
System
SinGooCMS.Utility.CsvUtils
csv工具
Definition: CsvUtils.cs:18
SinGooCMS.Utility.Extension.SequenceType.ArrayList
代表 System.Collections.ArrayList. 非泛型
SinGooCMS.Utility.Extension.DataTableExtension.FindRow
static DataRow FindRow(this DataTable dt, string colKey, string colValue)
查找数据表的行
Definition: DataTableExtension.cs:140
SinGooCMS.Utility.NPOIUtils
NPOI工具类 来自:
Definition: NPOIUtils.cs:20
SinGooCMS.Utility.Extension.DataTableExtension
数据集扩展
Definition: DataTableExtension.cs:14
SinGooCMS.Utility.NPOIUtils.Save
static bool Save(DataTable table, string filePath, string sheetName="")
保存到excel
Definition: NPOIUtils.cs:333
SinGooCMS
SinGooCMS.Utility.Extension.DataTableExtension.ChangeColNames
static DataTable ChangeColNames(this DataTable table, Dictionary< string, string > newColNames)
更换列名
Definition: DataTableExtension.cs:201
SinGooCMS.Utility.CsvUtils.WriteAsync
static async Task WriteAsync(DataTable dt, string csvFilePath, string encoding="utf-8")
写csv文件
Definition: CsvUtils.cs:130
SinGooCMS.Utility.Extension.DataTableExtension.RemoveEmptyRow
static DataTable RemoveEmptyRow(this DataTable dt)
删除空白行
Definition: DataTableExtension.cs:164


SinGooCMS.Utility: SinGooCMS.Utility/Extension/DataTypeChangeExtension.cs 源文件

  • 文件列表
  • SinGooCMS.Utility
  • Extension
DataTypeChangeExtension.cs
浏览该文件的文档.
1 using System;
2 using System.Collections.Generic;
3 using System.Data;
4
5 namespace SinGooCMS.Utility.Extension
6 {
10 public static class DataTypeChangeExtension
11 {
12 #region 数据类型转换
13
20 public static byte ToByte(this object thisValue, byte defValue = 0)
21 {
22 if (thisValue != null)
23 {
24 //判断是否小数
25 if (thisValue.ToString().IsDecimal())
26 return (byte)(thisValue.ToDecimal());
27
28 if (byte.TryParse(thisValue.ToString(), out byte result))
29 return result;
30 }
31
32 return defValue;
33 }
34
41 public static short ToShort(this object thisValue, short defValue = 0)
42 {
43 if (thisValue != null)
44 {
45 //判断是否小数
46 if (thisValue.ToString().IsDecimal())
47 return (short)(thisValue.ToDecimal());
48
49 if (Int16.TryParse(thisValue.ToString(), out short result))
50 return result;
51 }
52
53 return defValue;
54 }
55
62 public static int ToInt(this object thisValue, int defValue = 0)
63 {
64 if (thisValue != null)
65 {
66 //判断是否小数
67 if (thisValue.ToString().IsDecimal())
68 return (int)(thisValue.ToDecimal());
69
70 //非小数
71 if (Int32.TryParse(thisValue.ToString(), out int result))
72 return result;
73 }
74
75 return defValue;
76 }
77
84 public static long ToLong(this object thisValue, long defValue = 0)
85 {
86 if (thisValue != null)
87 {
88 //判断是否小数
89 if (thisValue.ToString().IsDecimal())
90 return (long)(thisValue.ToDecimal());
91
92 if (Int64.TryParse(thisValue.ToString(), out long result))
93 return result;
94 }
95
96 return defValue;
97 }
98
105 public static bool ToBool(this object thisValue, bool defValue = false)
106 {
107 if (thisValue != null)
108 {
109 if (string.Compare(thisValue.ToString(), "true", true).Equals(0))
110 return true;
111
112 if (thisValue.ToInt() == 1) //sqlite没有布尔型
113 return true;
114
115 if (Boolean.TryParse(thisValue.ToString(), out bool result))
116 return result;
117 }
118
119 return defValue;
120 }
121
128 public static float ToFloat(this object thisValue, float defValue = 0.0f)
129 {
130 if (thisValue != null)
131 {
132 if (float.TryParse(thisValue.ToString(), out float result))
133 return result;
134 }
135
136 return defValue;
137 }
138
145 public static double ToDouble(this object thisValue, double defValue = 0.0d)
146 {
147 if (thisValue != null)
148 {
149 if (Double.TryParse(thisValue.ToString(), out double result))
150 return result;
151 }
152
153 return defValue;
154 }
155
162 public static decimal ToDecimal(this object thisValue, decimal defValue = 0.0m)
163 {
164 if (thisValue != null)
165 {
166 if (decimal.TryParse(thisValue.ToString(), out decimal result))
167 return result;
168 }
169
170 return defValue;
171 }
172
178 public static DateTime ToDateTime(this object thisValue) =>
179 thisValue.ToDateTime(new DateTime(1900, 1, 1));
180
187 public static DateTime ToDateTime(this object thisValue, DateTime defValue)
188 {
189 if (thisValue != null)
190 {
191 if (DateTime.TryParse(thisValue.ToString(), out DateTime result))
192 return result;
193 }
194
195 return defValue;
196 }
197
205 public static T[] ToSpliterArray<T>(this string ids, char splitter = ',') =>
206 ids.ToSpliterList<T>(splitter).ToArray();
207
215 public static List<T> ToSpliterList<T>(this string ids, char splitter = ',')
216 {
217 var result = new List<T>();
218 if (!ids.IsNullOrEmpty())
219 {
220 string[] arr = ids.Split(splitter);
221 foreach (string item in arr)
222 {
223 if (item.Trim().Length > 0)
224 result.Add(item.To<T>());
225 }
226 }
227
228 return result;
229 }
230
237 public static int[] ToIntArray(this string ids, char splitter = ',')
238 {
239 return ids.ToSpliterArray<int>(splitter);
240 }
241
242 #endregion
243
244 #region Dictionary安全取值
245
254 public static Tvalue GetSafeValue<Tkey, Tvalue>(this Dictionary<Tkey, Tvalue> dict, Tkey key)
255 {
256 if (dict.ContainsKey(key))
257 return dict[key];
258
259 return Activator.CreateInstance<Tvalue>(); // default(Tvalue);
260 }
261
262 #endregion
263
264 #region SqlTypeToC#Type
265
271 public static Type ToCsharpType(this SqlDbType sqlType)
272 {
273 switch (sqlType)
274 {
275 case SqlDbType.BigInt:
276 return typeof(Int64);
277 case SqlDbType.Binary:
278 return typeof(Object);
279 case SqlDbType.Bit:
280 return typeof(Boolean);
281 case SqlDbType.Char:
282 return typeof(String);
283 case SqlDbType.DateTime:
284 return typeof(DateTime);
285 case SqlDbType.Decimal:
286 return typeof(Decimal);
287 case SqlDbType.Float:
288 return typeof(Double);
289 case SqlDbType.Image:
290 return typeof(Object);
291 case SqlDbType.Int:
292 return typeof(Int32);
293 case SqlDbType.Money:
294 return typeof(Decimal);
295 case SqlDbType.NChar:
296 return typeof(String);
297 case SqlDbType.NText:
298 return typeof(String);
299 case SqlDbType.NVarChar:
300 return typeof(String);
301 case SqlDbType.Real:
302 return typeof(Single);
303 case SqlDbType.SmallDateTime:
304 return typeof(DateTime);
305 case SqlDbType.SmallInt:
306 return typeof(Int16);
307 case SqlDbType.SmallMoney:
308 return typeof(Decimal);
309 case SqlDbType.Text:
310 return typeof(String);
311 case SqlDbType.Timestamp:
312 return typeof(Object);
313 case SqlDbType.TinyInt:
314 return typeof(Byte);
315 case SqlDbType.Udt://自定义的数据类型
316 return typeof(Object);
317 case SqlDbType.UniqueIdentifier:
318 return typeof(Object);
319 case SqlDbType.VarBinary:
320 return typeof(Object);
321 case SqlDbType.VarChar:
322 return typeof(String);
323 case SqlDbType.Variant:
324 return typeof(Object);
325 case SqlDbType.Xml:
326 return typeof(Object);
327 default:
328 return null;
329 }
330 }
331
332 #endregion
333 }
334 }
SinGooCMS.Utility.Extension.DataTypeChangeExtension.ToLong
static long ToLong(this object thisValue, long defValue=0)
转化为长整型
Definition: DataTypeChangeExtension.cs:84
SinGooCMS.Utility.Extension.SequenceType.String
代表 System.String.
System
SinGooCMS.Utility.Extension.DataTypeChangeExtension.ToInt
static int ToInt(this object thisValue, int defValue=0)
转化为整型，如果是小数，将截断小数部分
Definition: DataTypeChangeExtension.cs:62
SinGooCMS.Utility.Extension.DataTypeChangeExtension.ToIntArray
static int[] ToIntArray(this string ids, char splitter= ',')
ids字符串转整型数组,如 "1,2,3" 转 int[]{1,2,3}
Definition: DataTypeChangeExtension.cs:237
SinGooCMS.Utility.Extension.DataTypeChangeExtension.ToDouble
static double ToDouble(this object thisValue, double defValue=0.0d)
转化为双精度数据类型
Definition: DataTypeChangeExtension.cs:145
SinGooCMS.Utility.Extension.DataTypeChangeExtension.ToDateTime
static DateTime ToDateTime(this object thisValue, DateTime defValue)
转化为日期类型
Definition: DataTypeChangeExtension.cs:187
SinGooCMS.Utility.Extension.DataTypeChangeExtension.ToFloat
static float ToFloat(this object thisValue, float defValue=0.0f)
转化为浮点型
Definition: DataTypeChangeExtension.cs:128
SinGooCMS.Utility.Extension.DataTypeChangeExtension.ToByte
static byte ToByte(this object thisValue, byte defValue=0)
转化为 byte 整形(0 到 255)
Definition: DataTypeChangeExtension.cs:20
SinGooCMS
SinGooCMS.Utility.Extension.DataTypeChangeExtension.ToBool
static bool ToBool(this object thisValue, bool defValue=false)
转化为布尔型
Definition: DataTypeChangeExtension.cs:105
SinGooCMS.Utility.Extension.DataTypeChangeExtension
数据类型转换,利用TryParse判断是否可转换，如果能则返回转换后的值，否则返回默认值
Definition: DataTypeChangeExtension.cs:10
SinGooCMS.Utility.Extension.DataTypeChangeExtension.ToCsharpType
static Type ToCsharpType(this SqlDbType sqlType)
数据库数据类型转c::数据类型
Definition: DataTypeChangeExtension.cs:271
SinGooCMS.Utility.Extension.DataTypeChangeExtension.ToShort
static short ToShort(this object thisValue, short defValue=0)
转化为短整型
Definition: DataTypeChangeExtension.cs:41
SinGooCMS.Utility.Extension.DataTypeChangeExtension.ToDecimal
static decimal ToDecimal(this object thisValue, decimal defValue=0.0m)
转化为小数类型
Definition: DataTypeChangeExtension.cs:162


SinGooCMS.Utility: SinGooCMS.Utility/Extension/DateExtension.cs 源文件

  • 文件列表
  • SinGooCMS.Utility
  • Extension
DateExtension.cs
浏览该文件的文档.
1 using System;
2 using System.Diagnostics;
3 using System.Globalization;
4
5 namespace SinGooCMS.Utility.Extension
6 {
10 public static class DateTimeExtension
11 {
12 #region 周一、周日/每周第一天、每周最后一天
13
19 public static DateTime GetMonday(this DateTime someDate)
20 {
21 var date = GetShortDate(someDate);
22 return date.DayOfWeek == DayOfWeek.Sunday
23 ? date.AddDays(-6)
24 : date.AddDays(1 - Convert.ToInt32(date.DayOfWeek.ToString("d")));
25 }
26
32 public static DateTime GetSunday(this DateTime someDate)
33 {
34 return someDate.GetMonday().AddDays(6);
35 }
36
43 public static DateTime GetWeekFirstDay(this DateTime someDate, bool isCNRule = true)
44 {
45 var date = GetShortDate(someDate);
46 return date.DayOfWeek == DayOfWeek.Sunday && !isCNRule
47 ? date
48 : date.GetMonday(); //国外认为星期天是第一天，我们中国认为周一是第一天
49 }
50
57 public static DateTime GetWeekLastDay(this DateTime someDate, bool isCNRule = true)
58 {
59 return someDate.GetWeekFirstDay(isCNRule).AddDays(6);
60 }
61
62 #endregion
63
64 #region 月初、月尾
65
71 public static DateTime GetMonthFirstDay(this DateTime someDate)
72 {
73 var date = GetShortDate(someDate);
74 return DateTime.Parse(date.ToString("yyyy-MM") + "-01");
75 }
76
82 public static DateTime GetMonthLastDay(this DateTime someDate)
83 {
84 return GetMonthFirstDay(someDate).AddMonths(1).AddDays(-1);
85 }
86
87 #endregion
88
89 #region 季初、季尾
90
96 public static DateTime GetQuarterFirstDay(this DateTime someDate)
97 {
98 var date = GetShortDate(someDate);
99 return date.AddMonths(0 - (date.Month - 1) % 3).AddDays(1 - date.Day);
100 }
101
107 public static DateTime GetQuarterLastDay(this DateTime someDate)
108 {
109 return GetQuarterFirstDay(someDate).AddMonths(3).AddDays(-1);
110 }
111
112 #endregion
113
114 #region 年初、年尾
115
121 public static DateTime GetYearFirstDay(this DateTime someDate)
122 {
123 var date = GetShortDate(someDate);
124 return DateTime.Parse(date.ToString("yyyy") + "-01-01");
125 }
126
132 public static DateTime GetYearLastDay(this DateTime someDate)
133 {
134 return GetYearFirstDay(someDate).AddYears(1).AddDays(-1);
135 }
136
137 #endregion
138
139 #region 本年第几周
140
147 public static int WeekOfYear(this DateTime someDate, bool isOnlyValue = false)
148 {
149 if (isOnlyValue)
150 someDate = someDate.GetWeekLastDay();
151
152 GregorianCalendar gc = new GregorianCalendar(GregorianCalendarTypes.USEnglish);
153 int weekOfYear = gc.GetWeekOfYear(someDate, CalendarWeekRule.FirstDay, DayOfWeek.Monday);
154 return weekOfYear;
155 }
156
157 #endregion
158
159 #region 日期格式化
160
167 public static string ToFormatStringFull(this DateTime dtime, string format = "yyyy-MM-dd HH:mm:ss.fff") =>
168 dtime.ToString(format);
169
176 public static string ToFormatString(this DateTime dtime, string format = "yyyy-MM-dd HH:mm:ss") =>
177 dtime.ToString(format);
178
185 public static string ToFormatDate(this DateTime dtime, string format = "yyyy-MM-dd") =>
186 dtime.ToString(format);
187
194 public static string ToFormatTime(this DateTime dtime, string format = "HH:mm:ss") =>
195 dtime.ToString(format);
196
203 public static string ToFormatDateString(this string strInput, string format = "yyyy-MM-dd")
204 {
205 var date = new DateTime();
206 if (DateTime.TryParse(strInput, out date))
207 return date.ToString(format);
208
209 return new DateTime(1900, 1, 1).ToString(format);
210 }
211
212 #endregion
213
214 #region 读取中国时辰
215
221 public static (string DIZHI, string CNHOUR) GetCNHour(this DateTime time)
222 {
223 if (time.Hour >= 23 || time.Hour < 1)
224 {
225 //子时（23 - 1点）：半夜
226 return ("子时", "半夜");
227 }
228 else if (time.Hour >= 1 && time.Hour < 3)
229 {
230 //丑时（1 - 3点）：凌晨
231 return ("丑时", "凌晨");
232 }
233 else if (time.Hour >= 3 && time.Hour < 5)
234 {
235 //寅时（3 - 5点）：黎明
236 return ("寅时", "黎明");
237 }
238 else if (time.Hour >= 5 && time.Hour < 7)
239 {
240 //卯时（5 - 7点）：清晨
241 return ("卯时", "清晨");
242 }
243 else if (time.Hour >= 7 && time.Hour < 9)
244 {
245 //辰时（7 - 9点）：早上
246 return ("辰时", "早上");
247 }
248 else if (time.Hour >= 9 && time.Hour < 11)
249 {
250 //巳时（9 - 11点）：上午
251 return ("巳时", "上午");
252 }
253 else if (time.Hour >= 11 && time.Hour < 13)
254 {
255 //午时（11 - 13点）：中午
256 return ("午时", "中午");
257 }
258 else if (time.Hour >= 13 && time.Hour < 15)
259 {
260 //未时（13 - 15点）：午后
261 return ("未时", "午后");
262 }
263 else if (time.Hour >= 15 && time.Hour < 17)
264 {
265 //申时（15 - 17点）：下午
266 return ("申时", "下午");
267 }
268 else if (time.Hour >= 17 && time.Hour < 19)
269 {
270 //酉时（17 - 19点）：傍晚
271 return ("酉时", "傍晚");
272 }
273 else if (time.Hour >= 19 && time.Hour < 21)
274 {
275 //戌时（19 - 21点）：晚上
276 return ("戌时", "晚上");
277 }
278 else if (time.Hour >= 21 && time.Hour < 23)
279 {
280 //亥时（21 - 23点）：深夜
281 return ("亥时", "深夜");
282 }
283 else
284 {
285 return ("子时", "半夜");
286 }
287 }
288
289 #endregion
290
291 #region 相对于1970-01-01
292
298 public static double GetUnixTimeSeconds(this in DateTime dt) => new DateTimeOffset(dt).ToUnixTimeSeconds();
299
305 public static double GetUnixTimeMilliseconds(this in DateTime dt) => new DateTimeOffset(dt).ToUnixTimeMilliseconds();
306
312 public static long GetTotalMicroseconds(this in DateTime dt) => new DateTimeOffset(dt).Ticks / 10;
313
319 public static long GetTotalNanoseconds(this in DateTime dt) => new DateTimeOffset(dt).Ticks * 100 + Stopwatch.GetTimestamp() % 100;
320
326 public static double GetTotalMinutes(this in DateTime dt) => new DateTimeOffset(dt).Offset.TotalMinutes;
327
333 public static double GetTotalHours(this in DateTime dt) => new DateTimeOffset(dt).Offset.TotalHours;
334
340 public static double GetTotalDays(this in DateTime dt) => new DateTimeOffset(dt).Offset.TotalDays;
341
342 #endregion
343
344 #region 时间差
345
352 public static string DateDiff(this in DateTime dateTime1, in DateTime dateTime2)
353 {
354 string dateDiff;
355 var ts = dateTime2 - dateTime1;
356 if (ts.Days >= 1)
357 {
358 dateDiff = dateTime1.Month + "月" + dateTime1.Day + "日";
359 }
360 else
361 {
362 dateDiff = ts.Hours > 1 ? ts.Hours + "小时前" : ts.Minutes + "分钟前";
363 }
364
365 return dateDiff;
366 }
367
373 public static string FriendlyDate(this DateTime dt)
374 {
375 var ts = dt.Date - DateTime.Now.Date;
376
377 switch (ts.Days)
378 {
379 case 0:
380 return "今天";
381 case -1:
382 return "昨天";
383 case -2:
384 return "前天";
385 case 1:
386 return "明天";
387 case 2:
388 return "后天";
389 }
390
391 return Math.Abs(ts.Days) + "天" + (ts.Days > 0 ? "后" : "前");
392 }
393
394 #endregion
395
396 private static DateTime GetShortDate(DateTime date)
397 {
398 return DateTime.Parse(date.ToString("yyyy-MM-dd"));
399 }
400 }
401 }
SinGooCMS.Utility.Extension.DateTimeExtension.GetCNHour
static string string CNHOUR GetCNHour(this DateTime time)
Definition: DateExtension.cs:221
SinGooCMS.Utility.Extension.DateTimeExtension.GetMonday
static DateTime GetMonday(this DateTime someDate)
计算周一的日期
Definition: DateExtension.cs:19
System
SinGooCMS.Utility.Extension.DateTimeExtension.GetYearLastDay
static DateTime GetYearLastDay(this DateTime someDate)
计算年尾的日期
Definition: DateExtension.cs:132
SinGooCMS.Utility.Extension.DateTimeExtension.GetWeekLastDay
static DateTime GetWeekLastDay(this DateTime someDate, bool isCNRule=true)
获取周最后一天（星期日）
Definition: DateExtension.cs:57
SinGooCMS.Utility.Extension.DateTimeExtension.GetWeekFirstDay
static DateTime GetWeekFirstDay(this DateTime someDate, bool isCNRule=true)
获取周第一天（星期一）
Definition: DateExtension.cs:43
SinGooCMS.Utility.Extension.DateTimeExtension.WeekOfYear
static int WeekOfYear(this DateTime someDate, bool isOnlyValue=false)
本年第几周，当跨年时有2个值，isOnlyValue=true取新年值
Definition: DateExtension.cs:147
SinGooCMS.Utility.Extension.DateTimeExtension.GetMonthFirstDay
static DateTime GetMonthFirstDay(this DateTime someDate)
计算月初的日期
Definition: DateExtension.cs:71
SinGooCMS
SinGooCMS.Utility.Extension.DateTimeExtension.GetShortDate
static DateTime GetShortDate(DateTime date)
Definition: DateExtension.cs:396
SinGooCMS.Utility.Extension.DateTimeExtension.GetYearFirstDay
static DateTime GetYearFirstDay(this DateTime someDate)
计算年初的日期
Definition: DateExtension.cs:121
SinGooCMS.Utility.Extension.DateTimeExtension.FriendlyDate
static string FriendlyDate(this DateTime dt)
将时间的天转换为友好的标记
Definition: DateExtension.cs:373
SinGooCMS.Utility.Extension.DateTimeExtension.GetSunday
static DateTime GetSunday(this DateTime someDate)
计算周日的日期
Definition: DateExtension.cs:32
SinGooCMS.Utility.Extension.DateTimeExtension.GetQuarterFirstDay
static DateTime GetQuarterFirstDay(this DateTime someDate)
计算月初的日期
Definition: DateExtension.cs:96
SinGooCMS.Utility.Extension.DateTimeExtension.GetMonthLastDay
static DateTime GetMonthLastDay(this DateTime someDate)
计算月尾的日期
Definition: DateExtension.cs:82
SinGooCMS.Utility.Extension.DateTimeExtension.ToFormatDateString
static string ToFormatDateString(this string strInput, string format="yyyy-MM-dd")
格式化为日期格式字符串
Definition: DateExtension.cs:203
SinGooCMS.Utility.Extension.DateTimeExtension.GetQuarterLastDay
static DateTime GetQuarterLastDay(this DateTime someDate)
计算月尾的日期
Definition: DateExtension.cs:107
SinGooCMS.Utility.Extension.DateTimeExtension.DateDiff
static string DateDiff(this in DateTime dateTime1, in DateTime dateTime2)
返回时间差
Definition: DateExtension.cs:352
SinGooCMS.Utility.Extension.DateTimeExtension
日期扩展
Definition: DateExtension.cs:10


SinGooCMS.Utility: SinGooCMS.Utility/Date/DatetimeUtils.cs 源文件

  • 文件列表
  • SinGooCMS.Utility
  • Date
DatetimeUtils.cs
浏览该文件的文档.
1 using System;
2 using System.Collections.Generic;
3 using System.Text;
4 using SinGooCMS.Utility.Extension;
5
6 namespace SinGooCMS.Utility
7 {
11 public sealed class DatetimeUtils
12 {
18 public static double GetUnixTime(DateTime time)
19 {
20 return time.GetUnixTimeMilliseconds();
21 }
22
28 public static DateTime GetDTFromUnixTime(double unixSeconds)
29 {
30 return TimeZone.CurrentTimeZone.ToLocalTime(new DateTime(1970, 1, 1))
31 .Add(new TimeSpan((unixSeconds * 10000).ToLong()));
32 }
33 }
34 }
SinGooCMS.Utility
Definition: Accessor.cs:6
System
SinGooCMS.Utility.Extension
Definition: AssemblyExtensions.cs:8
SinGooCMS.Utility.DatetimeUtils
日期工具
Definition: DatetimeUtils.cs:11
SinGooCMS.Utility.DatetimeUtils.GetDTFromUnixTime
static DateTime GetDTFromUnixTime(double unixSeconds)
unix时间戳转c::日期
Definition: DatetimeUtils.cs:28
SinGooCMS
SinGooCMS.Utility.DatetimeUtils.GetUnixTime
static double GetUnixTime(DateTime time)
转unix时间
Definition: DatetimeUtils.cs:18


SinGooCMS.Utility: SinGooCMS.Utility/Extension/DictionaryExtension.cs 源文件

  • 文件列表
  • SinGooCMS.Utility
  • Extension
DictionaryExtension.cs
浏览该文件的文档.
1 using System;
2 using System.Collections.Generic;
3 using System.Text;
4 using System.Linq;
5
6 namespace SinGooCMS.Utility.Extension
7 {
11 public static class DictionaryExtension
12 {
20 public static IDictionary<TKey, TValue> SortByKey<TKey, TValue>(this IDictionary<TKey, TValue> dict)
21 {
22 return dict.OrderBy(p => p.Key).ToDictionary(p => p.Key, p => p.Value);
23 }
24
33 public static TKey GetKey<TKey, TValue>(this IDictionary<TKey, TValue> dict, int @index)
34 {
35 return dict.ElementAt(@index).Key;
36 }
37
46 public static TValue GetValue<TKey, TValue>(this IDictionary<TKey, TValue> dict, int @index)
47 {
48 return dict.ElementAt(@index).Value;
49 }
50 }
51 }
System
SinGooCMS.Utility.Extension.DictionaryExtension
字典扩展类
Definition: DictionaryExtension.cs:11
SinGooCMS


SinGooCMS.Utility: SinGooCMS.Utility/Data/EntityAttrUtils.cs 源文件

  • 文件列表
  • SinGooCMS.Utility
  • Data
EntityAttrUtils.cs
浏览该文件的文档.
1 using System;
2 using System.Linq;
3 using System.Reflection;
4 using System.ComponentModel.DataAnnotations;
5 using System.ComponentModel.DataAnnotations.Schema;
6 using SinGooCMS.Utility.Extension;
7
8 namespace SinGooCMS.Utility
9 {
13 public static class EntityAttrUtils
14 {
20 public static string GetTableName(Type type)
21 {
22 var tableAttr = type.GetCustomAttributes(false).Where(attr => attr.GetType().Name == "TableAttribute").SingleOrDefault() as dynamic;
23 return tableAttr?.Name ?? string.Empty;
24 }
25
31 public static string GetKey(Type type)
32 {
33 var pi = type.GetProperties().Where(p => p.GetCustomAttributes(true).Any(a => a is KeyAttribute)).FirstOrDefault();
34 return pi?.Name ?? string.Empty;
35 }
36
43 public static object GetKeyValue<TEntity>(TEntity entity) where TEntity : class
44 {
45 var pi = typeof(TEntity).GetProperties()
46 .Where(p => p.GetCustomAttributes(true)
47 .Any(a => a is KeyAttribute))
48 .FirstOrDefault();
49
50 return pi?.GetValue(entity, null);
51 }
52
58 public static bool IsKey(PropertyInfo pi)
59 {
60 return pi.GetCustomAttributes(true).Any(a => a is KeyAttribute);
61 }
62
68 public static bool IsNotMapped(PropertyInfo pi)
69 {
70 return pi.GetCustomAttributes(true).Any(a => a is NotMappedAttribute);
71 }
72
79 public static PropertyInfo GetProperty<TEntity>(string PropertyName)
80 {
81 return typeof(TEntity).GetProperty(PropertyName);
82 //return typeof(TEntity).GetProperties().Where(p => p.Name == PropertyName).FirstOrDefault();
83 }
84
90 public static int GetMaxLength(PropertyInfo pi)
91 {
92 var attrMax = pi.GetCustomAttribute(typeof(MaxLengthAttribute)) as MaxLengthAttribute;
93 //var attrMax = pi.GetCustomAttributes(true).Where(a => a is MaxLengthAttribute).FirstOrDefault() as MaxLengthAttribute;
94 return attrMax?.Length ?? 0;
95 }
96
102 public static int GetMinLength(PropertyInfo pi)
103 {
104 var attrMin = pi.GetCustomAttribute(typeof(MinLengthAttribute)) as MinLengthAttribute;
105 //var attrMin = pi.GetCustomAttributes(true).Where(a => a is MinLengthAttribute).FirstOrDefault() as MinLengthAttribute;
106 return attrMin?.Length ?? 0;
107 }
108 }
109 }
SinGooCMS.Utility
Definition: Accessor.cs:6
System
SinGooCMS.Utility.EntityAttrUtils.GetKey
static string GetKey(Type type)
读取主键名称 - 只支持单主键
Definition: EntityAttrUtils.cs:31
SinGooCMS.Utility.Extension
Definition: AssemblyExtensions.cs:8
SinGooCMS.Utility.EntityAttrUtils.IsNotMapped
static bool IsNotMapped(PropertyInfo pi)
是否映射
Definition: EntityAttrUtils.cs:68
SinGooCMS.Utility.EntityAttrUtils.GetMaxLength
static int GetMaxLength(PropertyInfo pi)
最大值特性
Definition: EntityAttrUtils.cs:90
SinGooCMS.Utility.EntityAttrUtils.GetTableName
static string GetTableName(Type type)
表名
Definition: EntityAttrUtils.cs:20
SinGooCMS
SinGooCMS.Utility.EntityAttrUtils.IsKey
static bool IsKey(PropertyInfo pi)
是否主键 - 只支持单主键（主键ID是自增的）
Definition: EntityAttrUtils.cs:58
SinGooCMS.Utility.EntityAttrUtils.GetMinLength
static int GetMinLength(PropertyInfo pi)
最小值特性
Definition: EntityAttrUtils.cs:102
SinGooCMS.Utility.EntityAttrUtils
实体类 特性工具
Definition: EntityAttrUtils.cs:13


SinGooCMS.Utility: SinGooCMS.Utility/Extension/EnumExtension.cs 源文件

  • 文件列表
  • SinGooCMS.Utility
  • Extension
EnumExtension.cs
浏览该文件的文档.
1 using System;
2 using System.Collections.Generic;
3 using System.Text;
4
5 namespace SinGooCMS.Utility.Extension
6 {
10 public static class EnumExtension
11 {
17 public static string GetDescription(this System.Enum @enum) => EnumUtils.GetEnumDescription(@enum);
18
25 public static T ToEnum<T>(this string enumName) where T : struct =>
26 EnumUtils.StringToEnum<T>(enumName);
27 }
28 }
SinGooCMS.Utility.Extension.EnumExtension
枚举扩展
Definition: EnumExtension.cs:10
System
SinGooCMS.Utility.EnumUtils.StringToEnum
static object StringToEnum(Type enumType, string value)
字符串转枚举类型
Definition: EnumUtils.cs:181
SinGooCMS
SinGooCMS.Utility.EnumUtils.GetEnumDescription
static string GetEnumDescription(Enum value)
读取枚举说明
Definition: EnumUtils.cs:133
SinGooCMS.Utility.EnumUtils
枚举帮助类
Definition: EnumUtils.cs:13


SinGooCMS.Utility: SinGooCMS.Utility/System/EnumUtils.cs 源文件

  • 文件列表
  • SinGooCMS.Utility
  • System
EnumUtils.cs
浏览该文件的文档.
1 using System;
2 using System.Collections.Generic;
3 using System.Collections.ObjectModel;
4 using System.ComponentModel;
5 using System.Reflection;
6 using System.Text;
7
8 namespace SinGooCMS.Utility
9 {
13 public sealed class EnumUtils
14 {
20 public static Dictionary<int, string> TransIntDict(Type enumType)
21 {
22 Dictionary<int, string> dictionary = new Dictionary<int, string>();
23 foreach (Enum enum2 in Enum.GetValues(enumType))
24 {
25 dictionary.Add(int.Parse(enum2.ToString("D")), GetDescription(enum2));
26 }
27 return dictionary;
28 }
29
35 public static Dictionary<string, string> TransStrDict(Type enumType)
36 {
37 Dictionary<string, string> dictionary = new Dictionary<string, string>();
38 foreach (Enum enum2 in Enum.GetValues(enumType))
39 {
40 dictionary.Add(enum2.ToString(), GetDescription(enum2));
41 }
42 return dictionary;
43 }
44
50 public static List<T> EnumToList<T>()
51 {
52 Type enumType = typeof(T);
53 if (enumType.BaseType != typeof(Enum))
54 {
55 throw new ArgumentException("T must be of type System.Enum");
56 }
57 Array values = Enum.GetValues(enumType);
58 List<T> list = new List<T>(values.Length);
59 foreach (int num in values)
60 {
61 list.Add((T)Enum.Parse(enumType, num.ToString()));
62 }
63 return list;
64 }
65
71 private static string GetDescription(Enum value)
72 {
73 DescriptionAttribute[] customAttributes = (DescriptionAttribute[])value.GetType().GetField(value.ToString()).GetCustomAttributes(typeof(DescriptionAttribute), false);
74 if (customAttributes.Length <= 0)
75 {
76 return value.ToString();
77 }
78 return customAttributes[0].Description;
79 }
80
87 public static string GetEnumCollectionDescription<T>(Collection<T> enums)
88 {
89 StringBuilder builder = new StringBuilder();
90 Type type = typeof(T);
91 if (type.BaseType != typeof(Enum))
92 {
93 throw new ArgumentException("T must be of type System.Enum");
94 }
95 foreach (T local in enums)
96 {
97 builder.AppendLine(GetEnumDescription<T>(local));
98 }
99 return builder.ToString();
100 }
101
108 public static string GetEnumDescription<T>(T enumeratedType)
109 {
110 string description = enumeratedType.ToString();
111 Type type = typeof(T);
112 if (type.BaseType != typeof(Enum))
113 {
114 throw new ArgumentException("T must be of type System.Enum");
115 }
116 FieldInfo field = enumeratedType.GetType().GetField(enumeratedType.ToString());
117 if (field != null)
118 {
119 object[] customAttributes = field.GetCustomAttributes(typeof(DescriptionAttribute), false);
120 if ((customAttributes != null) && (customAttributes.Length > 0))
121 {
122 description = ((DescriptionAttribute)customAttributes[0]).Description;
123 }
124 }
125 return description;
126 }
127
133 public static string GetEnumDescription(Enum value)
134 {
135 DescriptionAttribute[] customAttributes = (DescriptionAttribute[])value.GetType().GetField(value.ToString()).GetCustomAttributes(typeof(DescriptionAttribute), false);
136 if ((customAttributes != null) && (customAttributes.Length > 0))
137 {
138 return customAttributes[0].Description;
139 }
140 return value.ToString();
141 }
142
148 public static List<string> GetEnumDescriptions<T>() where T : struct
149 {
150 List<string> list = new List<string>();
151 foreach (int num in Enum.GetValues(typeof(T)))
152 {
153 Enum enum2 = (Enum)Enum.ToObject(typeof(T), num);
154 list.Add(GetEnumDescription(enum2));
155 }
156 return list;
157 }
158
165 public static T StringToEnum<T>(string name) where T : struct
166 {
167 T? nullable = StringToEnumOrNull<T>(name);
168 if (!nullable.HasValue)
169 {
170 return default(T);
171 }
172 return nullable.GetValueOrDefault();
173 }
174
181 public static object StringToEnum(Type enumType, string value)
182 {
183 if (enumType == null)
184 {
185 throw new ArgumentNullException("enumType");
186 }
187 return StringToEnum(enumType, value, false);
188 }
189
197 public static object StringToEnum(Type enumType, string value, bool ignoreCase)
198 {
199 if (enumType == null)
200 {
201 throw new ArgumentNullException("enumType");
202 }
203 if (enumType.IsEnum)
204 {
205 try
206 {
207 return Enum.Parse(enumType, value, ignoreCase);
208 }
209 catch (ArgumentException)
210 {
211 return null;
212 }
213 }
214 return null;
215 }
216
223 public static T? StringToEnumOrNull<T>(string name) where T : struct
224 {
225 if (name != null)
226 {
227 foreach (T local in Enum.GetValues(typeof(T)))
228 {
229 if (Enum.GetName(typeof(T), local) == name)
230 {
231 return new T?(local);
232 }
233 }
234 }
235 return null;
236 }
237 }
238 }
239
SinGooCMS.Utility.EnumUtils.StringToEnum
static object StringToEnum(Type enumType, string value, bool ignoreCase)
字符串转枚举类型
Definition: EnumUtils.cs:197
System
SinGooCMS.Utility.EnumUtils.TransStrDict
static Dictionary< string, string > TransStrDict(Type enumType)
枚举转字典 枚举int-枚举说明
Definition: EnumUtils.cs:35
SinGooCMS.Utility.EnumUtils.StringToEnum
static object StringToEnum(Type enumType, string value)
字符串转枚举类型
Definition: EnumUtils.cs:181
SinGooCMS
SinGooCMS.Utility.EnumUtils.GetDescription
static string GetDescription(Enum value)
读取枚举说明
Definition: EnumUtils.cs:71
SinGooCMS.Utility.EnumUtils.GetEnumDescription
static string GetEnumDescription(Enum value)
读取枚举说明
Definition: EnumUtils.cs:133
SinGooCMS.Utility.EnumUtils
枚举帮助类
Definition: EnumUtils.cs:13
SinGooCMS.Utility.EnumUtils.TransIntDict
static Dictionary< int, string > TransIntDict(Type enumType)
枚举转字典 枚举int-枚举说明
Definition: EnumUtils.cs:20


SinGooCMS.Utility: SinGooCMS.Utility/Web/ExceptionUtils.cs 源文件

  • 文件列表
  • SinGooCMS.Utility
  • Web
ExceptionUtils.cs
浏览该文件的文档.
1 using System;
2 using System.Collections.Generic;
3 using System.Text;
4 using System.Collections;
5
6 namespace SinGooCMS.Utility
7 {
11 public sealed class ExceptionUtils
12 {
13 public static string FormatMessage(Exception e)
14 {
15 if (e == null)
16 throw new ArgumentNullException("e");
17
18 return string.Format("{0}: {1}", e.GetType().Name, e.Message);
19 }
20 }
21 }
SinGooCMS.Utility.ExceptionUtils.FormatMessage
static string FormatMessage(Exception e)
Definition: ExceptionUtils.cs:13
System
SinGooCMS.Utility.ExceptionUtils
异常信息格式化
Definition: ExceptionUtils.cs:11
SinGooCMS


SinGooCMS.Utility: SinGooCMS.Utility/IO/FileUtils.cs 源文件

  • 文件列表
  • SinGooCMS.Utility
  • IO
FileUtils.cs
浏览该文件的文档.
1 using System;
2 using System.Text;
3 using System.IO;
4 using System.Web;
5 using System.Collections.Generic;
6 using System.Threading.Tasks;
7
8 namespace SinGooCMS.Utility
9 {
13 public enum FileSizeUnit
14 {
15 KB,
16 MB,
17 GB,
18 TB
19 }
20
24 public sealed class FileUtils
25 {
26 #region 文件操作
27
34 public static async Task CreateFileAsync(string absolutePath, string fileContent, Encoding encoding = null)
35 {
36 if (encoding == null)
37 encoding = Encoding.UTF8;
38
39 using (StreamWriter sw = new StreamWriter(absolutePath, false, encoding))
40 {
41 await sw.WriteLineAsync(fileContent);
42 await sw.FlushAsync();
43 sw.Close();
44 }
45 }
46
53 public static async Task<string> ReadFileContentAsync(string absolutePath, Encoding encoding = null)
54 {
55 if (encoding == null)
56 encoding = Encoding.UTF8;
57
58 string fileContent = string.Empty;
59 using (StreamReader sr = new StreamReader(absolutePath, encoding))
60 {
61 fileContent = await sr.ReadToEndAsync();
62 }
63 return fileContent;
64
65 }
66
74 public static async Task WriteFileContentAsync(string absolutePath, string fileContent, bool isAppend = false, Encoding encoding = null)
75 {
76 if (!File.Exists(absolutePath))
77 await CreateFileAsync(absolutePath, string.Empty);
78
79 if (encoding == null)
80 encoding = Encoding.UTF8;
81
82 using (StreamWriter sw = new StreamWriter(absolutePath, isAppend, encoding))
83 {
84 await sw.WriteLineAsync(fileContent);
85 await sw.FlushAsync();
86 sw.Close();
87 }
88 }
89
98 public static void ReNameFile(string absolutePath, string oldName, string newName, bool isFile = true)
99 {
100 if (isFile)
101 {
102 if (File.Exists(Combine(absolutePath, oldName)))
103 File.Move(Combine(absolutePath, oldName), Combine(absolutePath, newName));
104 }
105 else
106 {
107 if (Directory.Exists(Combine(absolutePath, oldName)))
108 Directory.Move(Combine(absolutePath, oldName), Combine(absolutePath, newName.Replace(".", "")));
109 }
110 }
111
118 public static string GetFileSize(decimal length, FileSizeUnit unit = FileSizeUnit.KB)
119 {
120 decimal num = 0m;
121 switch (unit)
122 {
123 case FileSizeUnit.TB:
124 num = Math.Round((decimal)(length / (1024m * 1024m * 1024m * 1024m)), 2, MidpointRounding.AwayFromZero);
125 break;
126 case FileSizeUnit.GB:
127 num = Math.Round((decimal)(length / (1024m * 1024m * 1024m)), 2, MidpointRounding.AwayFromZero);
128 break;
129 case FileSizeUnit.MB:
130 num = Math.Round((decimal)(length / (1024m * 1024m)), 2, MidpointRounding.AwayFromZero);
131 break;
132 case FileSizeUnit.KB:
133 default:
134 num = Math.Round((decimal)(length / 1024m), 2, MidpointRounding.AwayFromZero);
135 break;
136 }
137
138 return num.ToString() + unit.ToString();
139 }
140
141 #endregion
142
143 #region 目录操作
144
150 public static void CreateDirectory(string absoluteDir)
151 {
152 if (!Directory.Exists(absoluteDir))
153 Directory.CreateDirectory(absoluteDir);
154 }
155
161 public static void DeleteDirectory(string absoluteDir)
162 {
163 if (Directory.Exists(absoluteDir))
164 Directory.Delete(absoluteDir, true);
165 }
166
172 public static long GetDirectoryLength(string absoluteDir)
173 {
174 //判断给定的路径是否存在,如果不存在则退出
175 if (!Directory.Exists(absoluteDir))
176 return 0;
177
178 long len = 0;
179 //定义一个DirectoryInfo对象
180 DirectoryInfo di = new DirectoryInfo(absoluteDir);
181
182 //通过GetFiles方法,获取di目录中的所有文件的大小
183 foreach (FileInfo fi in di.GetFiles())
184 {
185 len += fi.Length;
186 }
187
188 //获取di中所有的文件夹,并存到一个新的对象数组中,以进行递归
189 DirectoryInfo[] dis = di.GetDirectories();
190 if (dis.Length > 0)
191 {
192 for (int i = 0; i < dis.Length; i++)
193 {
194 len += GetDirectoryLength(dis[i].FullName);
195 }
196 }
197 return len;
198 }
199
205 private static void CopyFolder(string sourcesAbsoluteDir, string destAbsoluteDir)
206 {
207 DirectoryInfo dinfo = new DirectoryInfo(sourcesAbsoluteDir);
208 //注，这里面传的是路径，并不是文件，所以不能保含带后缀的文件
209 foreach (FileSystemInfo f in dinfo.GetFileSystemInfos())
210 {
211 //目标路径destName = 目标文件夹路径 + 原文件夹下的子文件(或文件夹)名字
212 //Path.Combine(string a ,string b) 为合并两个字符串
213 String destName = Path.Combine(destAbsoluteDir, f.Name);
214 if (f is FileInfo)
215 {
216 //如果是文件就复制
217 File.Copy(f.FullName, destName, true);//true代表可以覆盖同名文件
218 }
219 else
220 {
221 //如果是文件夹就创建文件夹然后复制然后递归复制
222 Directory.CreateDirectory(destName);
223 CopyFolder(f.FullName, destName);
224 }
225 }
226 }
227
233 public static void CopyDirectory(string SourcePath, string DestinationPath)
234 {
235 //创建目标目录
236 if (!Directory.Exists(DestinationPath))
237 Directory.CreateDirectory(DestinationPath);
238
239 //创建所有子目录
240 foreach (string dirPath in Directory.GetDirectories(SourcePath, "*", SearchOption.AllDirectories))
241 Directory.CreateDirectory(dirPath.Replace(SourcePath, DestinationPath));
242
243 //复制所有文件 并覆盖现有的文件
244 foreach (string newPath in Directory.GetFiles(SourcePath, "*.*", SearchOption.AllDirectories))
245 File.Copy(newPath, newPath.Replace(SourcePath, DestinationPath), true);
246 }
247
253 public static IEnumerable<FileInfo> GetAllFiles(string absoluteDir)
254 {
255 var lst = new List<FileInfo>();
256 foreach (var item in new DirectoryInfo(absoluteDir).GetFiles())
257 lst.Add(item);
258
259 foreach (var dir in new DirectoryInfo(absoluteDir).GetDirectories())
260 lst.AddRange(GetAllFiles(dir.FullName));
261
262 return lst;
263 }
264
271 public static string Combine(string dir, string fileName)
272 {
273 if (dir.IndexOf(@"\") != -1 && !dir.EndsWith(@"\"))
274 dir += @"\";
275 else if (dir.IndexOf(@"/") != -1 && !dir.EndsWith(@"/"))
276 dir += @"/";
277
278 if (fileName.StartsWith(@"/"))
279 fileName = fileName.TrimStart('/');
280 else if (fileName.StartsWith(@"\"))
281 fileName = fileName.TrimStart('\\');
282
283 return Path.Combine(dir, fileName);
284 }
285
286 #endregion
287
288 #region 备份与恢复
289
297 public static bool BackupFile(string sourceFileName, string destFileName, bool overwrite)
298 {
299 if (!File.Exists(sourceFileName))
300 throw new FileNotFoundException(sourceFileName + "文件不存在！");
301
302 if (!overwrite && File.Exists(destFileName))
303 return false;
304
305 try
306 {
307 File.Copy(sourceFileName, destFileName, true);
308 return true;
309 }
310 catch (Exception e)
311 {
312 throw e;
313 }
314 }
315
316
323 public static bool BackupFile(string sourceFileName, string destFileName)
324 {
325 return BackupFile(sourceFileName, destFileName, true);
326 }
327
328
336 public static bool RestoreFile(string backupFileName, string targetFileName, string backupTargetFileName)
337 {
338 try
339 {
340 if (!File.Exists(backupFileName))
341 throw new FileNotFoundException(backupFileName + "文件不存在！");
342
343 if (backupTargetFileName != null)
344 {
345 if (!File.Exists(targetFileName))
346 throw new FileNotFoundException(targetFileName + "文件不存在！无法备份此文件！");
347 else
348 File.Copy(targetFileName, backupTargetFileName, true);
349 }
350 File.Delete(targetFileName);
351 File.Copy(backupFileName, targetFileName);
352 }
353 catch (Exception e)
354 {
355 throw e;
356 }
357 return true;
358 }
359
366 public static bool RestoreFile(string backupFileName, string targetFileName)
367 {
368 return RestoreFile(backupFileName, targetFileName, null);
369 }
370
371 #endregion
372
373 #region 文件流
374
380 public static Stream ReadFileToStream(string fileName)
381 {
382 return new MemoryStream(ReadFileToBytes(fileName));
383 }
384
390 public static byte[] ReadFileToBytes(string fileName)
391 {
392 FileStream pFileStream = null;
393 byte[] bytes = new byte[0];
394 try
395 {
396 pFileStream = new FileStream(fileName, FileMode.Open, FileAccess.Read);
397 BinaryReader r = new BinaryReader(pFileStream);
398 r.BaseStream.Seek(0, SeekOrigin.Begin); //将文件指针设置到文件开
399 bytes = r.ReadBytes((int)r.BaseStream.Length);
400 return bytes;
401 }
402 catch
403 {
404 return bytes;
405 }
406 finally
407 {
408 if (pFileStream != null)
409 pFileStream.Close();
410 }
411 }
412
413 #endregion
414
415 #region 读文件类型(content_type)
416
422 public static string GetContentType(string filePath)
423 {
424 #if NET451_OR_GREATER || NET461
425 return MimeMapping.GetMimeMapping(filePath);
426 #elif NETSTANDARD2_1
427 return MimeMapping.GetMimeMapping(filePath);
428 #else
429 return "application/octet-stream"; //默认的
430 #endif
431 }
432
433 #endregion
434 }
435
436 #if NETSTANDARD2_1
437 internal static class MimeMapping
438 {
439 private abstract class MimeMappingDictionaryBase
440 {
441 private readonly Dictionary<string, string> _mappings = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
442
443 private static readonly char[] _pathSeparatorChars = new char[3]
444 {
445 Path.DirectorySeparatorChar,
446 Path.AltDirectorySeparatorChar,
447 Path.VolumeSeparatorChar
448 };
449
450 private bool _isInitialized;
451
452 protected void AddMapping(string fileExtension, string mimeType)
453 {
454 _mappings.Add(fileExtension, mimeType);
455 }
456
457 private void AddWildcardIfNotPresent()
458 {
459 if (!_mappings.ContainsKey(".*"))
460 {
461 AddMapping(".*", "application/octet-stream");
462 }
463 }
464
465 private void EnsureMapping()
466 {
467 if (!_isInitialized)
468 {
469 lock (this)
470 {
471 if (!_isInitialized)
472 {
473 PopulateMappings();
474 AddWildcardIfNotPresent();
475 _isInitialized = true;
476 }
477 }
478 }
479 }
480
481 protected abstract void PopulateMappings();
482 private static string GetFileName(string path)
483 {
484 int num = path.LastIndexOfAny(_pathSeparatorChars);
485 if (num < 0)
486 {
487 return path;
488 }
489 return path.Substring(num);
490 }
491
492 public string GetMimeMapping(string fileName)
493 {
494 EnsureMapping();
495 fileName = GetFileName(fileName);
496 for (int i = 0; i < fileName.Length; i++)
497 {
498 if (fileName[i] == '.' && _mappings.TryGetValue(fileName.Substring(i), out string result))
499 {
500 return result;
501 }
502 }
503 return _mappings[".*"];
504 }
505 }
506
507 private sealed class MimeMappingDictionaryClassic : MimeMappingDictionaryBase
508 {
509 protected override void PopulateMappings()
510 {
511 base.AddMapping(".323", "text/h323");
512 base.AddMapping(".aaf", "application/octet-stream");
513 base.AddMapping(".aca", "application/octet-stream");
514 base.AddMapping(".accdb", "application/msaccess");
515 base.AddMapping(".accde", "application/msaccess");
516 base.AddMapping(".accdt", "application/msaccess");
517 base.AddMapping(".acx", "application/internet-property-stream");
518 base.AddMapping(".afm", "application/octet-stream");
519 base.AddMapping(".ai", "application/postscript");
520 base.AddMapping(".aif", "audio/x-aiff");
521 base.AddMapping(".aifc", "audio/aiff");
522 base.AddMapping(".aiff", "audio/aiff");
523 base.AddMapping(".application", "application/x-ms-application");
524 base.AddMapping(".art", "image/x-jg");
525 base.AddMapping(".asd", "application/octet-stream");
526 base.AddMapping(".asf", "video/x-ms-asf");
527 base.AddMapping(".asi", "application/octet-stream");
528 base.AddMapping(".asm", "text/plain");
529 base.AddMapping(".asr", "video/x-ms-asf");
530 base.AddMapping(".asx", "video/x-ms-asf");
531 base.AddMapping(".atom", "application/atom+xml");
532 base.AddMapping(".au", "audio/basic");
533 base.AddMapping(".avi", "video/x-msvideo");
534 base.AddMapping(".axs", "application/olescript");
535 base.AddMapping(".bas", "text/plain");
536 base.AddMapping(".bcpio", "application/x-bcpio");
537 base.AddMapping(".bin", "application/octet-stream");
538 base.AddMapping(".bmp", "image/bmp");
539 base.AddMapping(".c", "text/plain");
540 base.AddMapping(".cab", "application/octet-stream");
541 base.AddMapping(".calx", "application/vnd.ms-office.calx");
542 base.AddMapping(".cat", "application/vnd.ms-pki.seccat");
543 base.AddMapping(".cdf", "application/x-cdf");
544 base.AddMapping(".chm", "application/octet-stream");
545 base.AddMapping(".class", "application/x-java-applet");
546 base.AddMapping(".clp", "application/x-msclip");
547 base.AddMapping(".cmx", "image/x-cmx");
548 base.AddMapping(".cnf", "text/plain");
549 base.AddMapping(".cod", "image/cis-cod");
550 base.AddMapping(".cpio", "application/x-cpio");
551 base.AddMapping(".cpp", "text/plain");
552 base.AddMapping(".crd", "application/x-mscardfile");
553 base.AddMapping(".crl", "application/pkix-crl");
554 base.AddMapping(".crt", "application/x-x509-ca-cert");
555 base.AddMapping(".csh", "application/x-csh");
556 base.AddMapping(".css", "text/css");
557 base.AddMapping(".csv", "application/octet-stream");
558 base.AddMapping(".cur", "application/octet-stream");
559 base.AddMapping(".dcr", "application/x-director");
560 base.AddMapping(".deploy", "application/octet-stream");
561 base.AddMapping(".der", "application/x-x509-ca-cert");
562 base.AddMapping(".dib", "image/bmp");
563 base.AddMapping(".dir", "application/x-director");
564 base.AddMapping(".disco", "text/xml");
565 base.AddMapping(".dll", "application/x-msdownload");
566 base.AddMapping(".dll.config", "text/xml");
567 base.AddMapping(".dlm", "text/dlm");
568 base.AddMapping(".doc", "application/msword");
569 base.AddMapping(".docm", "application/vnd.ms-word.document.macroEnabled.12");
570 base.AddMapping(".docx", "application/vnd.openxmlformats-officedocument.wordprocessingml.document");
571 base.AddMapping(".dot", "application/msword");
572 base.AddMapping(".dotm", "application/vnd.ms-word.template.macroEnabled.12");
573 base.AddMapping(".dotx", "application/vnd.openxmlformats-officedocument.wordprocessingml.template");
574 base.AddMapping(".dsp", "application/octet-stream");
575 base.AddMapping(".dtd", "text/xml");
576 base.AddMapping(".dvi", "application/x-dvi");
577 base.AddMapping(".dwf", "drawing/x-dwf");
578 base.AddMapping(".dwp", "application/octet-stream");
579 base.AddMapping(".dxr", "application/x-director");
580 base.AddMapping(".eml", "message/rfc822");
581 base.AddMapping(".emz", "application/octet-stream");
582 base.AddMapping(".eot", "application/octet-stream");
583 base.AddMapping(".eps", "application/postscript");
584 base.AddMapping(".etx", "text/x-setext");
585 base.AddMapping(".evy", "application/envoy");
586 base.AddMapping(".exe", "application/octet-stream");
587 base.AddMapping(".exe.config", "text/xml");
588 base.AddMapping(".fdf", "application/vnd.fdf");
589 base.AddMapping(".fif", "application/fractals");
590 base.AddMapping(".fla", "application/octet-stream");
591 base.AddMapping(".flr", "x-world/x-vrml");
592 base.AddMapping(".flv", "video/x-flv");
593 base.AddMapping(".gif", "image/gif");
594 base.AddMapping(".gtar", "application/x-gtar");
595 base.AddMapping(".gz", "application/x-gzip");
596 base.AddMapping(".h", "text/plain");
597 base.AddMapping(".hdf", "application/x-hdf");
598 base.AddMapping(".hdml", "text/x-hdml");
599 base.AddMapping(".hhc", "application/x-oleobject");
600 base.AddMapping(".hhk", "application/octet-stream");
601 base.AddMapping(".hhp", "application/octet-stream");
602 base.AddMapping(".hlp", "application/winhlp");
603 base.AddMapping(".hqx", "application/mac-binhex40");
604 base.AddMapping(".hta", "application/hta");
605 base.AddMapping(".htc", "text/x-component");
606 base.AddMapping(".htm", "text/html");
607 base.AddMapping(".html", "text/html");
608 base.AddMapping(".htt", "text/webviewhtml");
609 base.AddMapping(".hxt", "text/html");
610 base.AddMapping(".ico", "image/x-icon");
611 base.AddMapping(".ics", "application/octet-stream");
612 base.AddMapping(".ief", "image/ief");
613 base.AddMapping(".iii", "application/x-iphone");
614 base.AddMapping(".inf", "application/octet-stream");
615 base.AddMapping(".ins", "application/x-internet-signup");
616 base.AddMapping(".isp", "application/x-internet-signup");
617 base.AddMapping(".IVF", "video/x-ivf");
618 base.AddMapping(".jar", "application/java-archive");
619 base.AddMapping(".java", "application/octet-stream");
620 base.AddMapping(".jck", "application/liquidmotion");
621 base.AddMapping(".jcz", "application/liquidmotion");
622 base.AddMapping(".jfif", "image/pjpeg");
623 base.AddMapping(".jpb", "application/octet-stream");
624 base.AddMapping(".jpe", "image/jpeg");
625 base.AddMapping(".jpeg", "image/jpeg");
626 base.AddMapping(".jpg", "image/jpeg");
627 base.AddMapping(".js", "application/x-javascript");
628 base.AddMapping(".jsx", "text/jscript");
629 base.AddMapping(".latex", "application/x-latex");
630 base.AddMapping(".lit", "application/x-ms-reader");
631 base.AddMapping(".lpk", "application/octet-stream");
632 base.AddMapping(".lsf", "video/x-la-asf");
633 base.AddMapping(".lsx", "video/x-la-asf");
634 base.AddMapping(".lzh", "application/octet-stream");
635 base.AddMapping(".m13", "application/x-msmediaview");
636 base.AddMapping(".m14", "application/x-msmediaview");
637 base.AddMapping(".m1v", "video/mpeg");
638 base.AddMapping(".m3u", "audio/x-mpegurl");
639 base.AddMapping(".man", "application/x-troff-man");
640 base.AddMapping(".manifest", "application/x-ms-manifest");
641 base.AddMapping(".map", "text/plain");
642 base.AddMapping(".mdb", "application/x-msaccess");
643 base.AddMapping(".mdp", "application/octet-stream");
644 base.AddMapping(".me", "application/x-troff-me");
645 base.AddMapping(".mht", "message/rfc822");
646 base.AddMapping(".mhtml", "message/rfc822");
647 base.AddMapping(".mid", "audio/mid");
648 base.AddMapping(".midi", "audio/mid");
649 base.AddMapping(".mix", "application/octet-stream");
650 base.AddMapping(".mmf", "application/x-smaf");
651 base.AddMapping(".mno", "text/xml");
652 base.AddMapping(".mny", "application/x-msmoney");
653 base.AddMapping(".mov", "video/quicktime");
654 base.AddMapping(".movie", "video/x-sgi-movie");
655 base.AddMapping(".mp2", "video/mpeg");
656 base.AddMapping(".mp3", "audio/mpeg");
657 base.AddMapping(".mpa", "video/mpeg");
658 base.AddMapping(".mpe", "video/mpeg");
659 base.AddMapping(".mpeg", "video/mpeg");
660 base.AddMapping(".mpg", "video/mpeg");
661 base.AddMapping(".mpp", "application/vnd.ms-project");
662 base.AddMapping(".mpv2", "video/mpeg");
663 base.AddMapping(".ms", "application/x-troff-ms");
664 base.AddMapping(".msi", "application/octet-stream");
665 base.AddMapping(".mso", "application/octet-stream");
666 base.AddMapping(".mvb", "application/x-msmediaview");
667 base.AddMapping(".mvc", "application/x-miva-compiled");
668 base.AddMapping(".nc", "application/x-netcdf");
669 base.AddMapping(".nsc", "video/x-ms-asf");
670 base.AddMapping(".nws", "message/rfc822");
671 base.AddMapping(".ocx", "application/octet-stream");
672 base.AddMapping(".oda", "application/oda");
673 base.AddMapping(".odc", "text/x-ms-odc");
674 base.AddMapping(".ods", "application/oleobject");
675 base.AddMapping(".one", "application/onenote");
676 base.AddMapping(".onea", "application/onenote");
677 base.AddMapping(".onetoc", "application/onenote");
678 base.AddMapping(".onetoc2", "application/onenote");
679 base.AddMapping(".onetmp", "application/onenote");
680 base.AddMapping(".onepkg", "application/onenote");
681 base.AddMapping(".osdx", "application/opensearchdescription+xml");
682 base.AddMapping(".p10", "application/pkcs10");
683 base.AddMapping(".p12", "application/x-pkcs12");
684 base.AddMapping(".p7b", "application/x-pkcs7-certificates");
685 base.AddMapping(".p7c", "application/pkcs7-mime");
686 base.AddMapping(".p7m", "application/pkcs7-mime");
687 base.AddMapping(".p7r", "application/x-pkcs7-certreqresp");
688 base.AddMapping(".p7s", "application/pkcs7-signature");
689 base.AddMapping(".pbm", "image/x-portable-bitmap");
690 base.AddMapping(".pcx", "application/octet-stream");
691 base.AddMapping(".pcz", "application/octet-stream");
692 base.AddMapping(".pdf", "application/pdf");
693 base.AddMapping(".pfb", "application/octet-stream");
694 base.AddMapping(".pfm", "application/octet-stream");
695 base.AddMapping(".pfx", "application/x-pkcs12");
696 base.AddMapping(".pgm", "image/x-portable-graymap");
697 base.AddMapping(".pko", "application/vnd.ms-pki.pko");
698 base.AddMapping(".pma", "application/x-perfmon");
699 base.AddMapping(".pmc", "application/x-perfmon");
700 base.AddMapping(".pml", "application/x-perfmon");
701 base.AddMapping(".pmr", "application/x-perfmon");
702 base.AddMapping(".pmw", "application/x-perfmon");
703 base.AddMapping(".png", "image/png");
704 base.AddMapping(".pnm", "image/x-portable-anymap");
705 base.AddMapping(".pnz", "image/png");
706 base.AddMapping(".pot", "application/vnd.ms-powerpoint");
707 base.AddMapping(".potm", "application/vnd.ms-powerpoint.template.macroEnabled.12");
708 base.AddMapping(".potx", "application/vnd.openxmlformats-officedocument.presentationml.template");
709 base.AddMapping(".ppam", "application/vnd.ms-powerpoint.addin.macroEnabled.12");
710 base.AddMapping(".ppm", "image/x-portable-pixmap");
711 base.AddMapping(".pps", "application/vnd.ms-powerpoint");
712 base.AddMapping(".ppsm", "application/vnd.ms-powerpoint.slideshow.macroEnabled.12");
713 base.AddMapping(".ppsx", "application/vnd.openxmlformats-officedocument.presentationml.slideshow");
714 base.AddMapping(".ppt", "application/vnd.ms-powerpoint");
715 base.AddMapping(".pptm", "application/vnd.ms-powerpoint.presentation.macroEnabled.12");
716 base.AddMapping(".pptx", "application/vnd.openxmlformats-officedocument.presentationml.presentation");
717 base.AddMapping(".prf", "application/pics-rules");
718 base.AddMapping(".prm", "application/octet-stream");
719 base.AddMapping(".prx", "application/octet-stream");
720 base.AddMapping(".ps", "application/postscript");
721 base.AddMapping(".psd", "application/octet-stream");
722 base.AddMapping(".psm", "application/octet-stream");
723 base.AddMapping(".psp", "application/octet-stream");
724 base.AddMapping(".pub", "application/x-mspublisher");
725 base.AddMapping(".qt", "video/quicktime");
726 base.AddMapping(".qtl", "application/x-quicktimeplayer");
727 base.AddMapping(".qxd", "application/octet-stream");
728 base.AddMapping(".ra", "audio/x-pn-realaudio");
729 base.AddMapping(".ram", "audio/x-pn-realaudio");
730 base.AddMapping(".rar", "application/octet-stream");
731 base.AddMapping(".ras", "image/x-cmu-raster");
732 base.AddMapping(".rf", "image/vnd.rn-realflash");
733 base.AddMapping(".rgb", "image/x-rgb");
734 base.AddMapping(".rm", "application/vnd.rn-realmedia");
735 base.AddMapping(".rmi", "audio/mid");
736 base.AddMapping(".roff", "application/x-troff");
737 base.AddMapping(".rpm", "audio/x-pn-realaudio-plugin");
738 base.AddMapping(".rtf", "application/rtf");
739 base.AddMapping(".rtx", "text/richtext");
740 base.AddMapping(".scd", "application/x-msschedule");
741 base.AddMapping(".sct", "text/scriptlet");
742 base.AddMapping(".sea", "application/octet-stream");
743 base.AddMapping(".setpay", "application/set-payment-initiation");
744 base.AddMapping(".setreg", "application/set-registration-initiation");
745 base.AddMapping(".sgml", "text/sgml");
746 base.AddMapping(".sh", "application/x-sh");
747 base.AddMapping(".shar", "application/x-shar");
748 base.AddMapping(".sit", "application/x-stuffit");
749 base.AddMapping(".sldm", "application/vnd.ms-powerpoint.slide.macroEnabled.12");
750 base.AddMapping(".sldx", "application/vnd.openxmlformats-officedocument.presentationml.slide");
751 base.AddMapping(".smd", "audio/x-smd");
752 base.AddMapping(".smi", "application/octet-stream");
753 base.AddMapping(".smx", "audio/x-smd");
754 base.AddMapping(".smz", "audio/x-smd");
755 base.AddMapping(".snd", "audio/basic");
756 base.AddMapping(".snp", "application/octet-stream");
757 base.AddMapping(".spc", "application/x-pkcs7-certificates");
758 base.AddMapping(".spl", "application/futuresplash");
759 base.AddMapping(".src", "application/x-wais-source");
760 base.AddMapping(".ssm", "application/streamingmedia");
761 base.AddMapping(".sst", "application/vnd.ms-pki.certstore");
762 base.AddMapping(".stl", "application/vnd.ms-pki.stl");
763 base.AddMapping(".sv4cpio", "application/x-sv4cpio");
764 base.AddMapping(".sv4crc", "application/x-sv4crc");
765 base.AddMapping(".swf", "application/x-shockwave-flash");
766 base.AddMapping(".t", "application/x-troff");
767 base.AddMapping(".tar", "application/x-tar");
768 base.AddMapping(".tcl", "application/x-tcl");
769 base.AddMapping(".tex", "application/x-tex");
770 base.AddMapping(".texi", "application/x-texinfo");
771 base.AddMapping(".texinfo", "application/x-texinfo");
772 base.AddMapping(".tgz", "application/x-compressed");
773 base.AddMapping(".thmx", "application/vnd.ms-officetheme");
774 base.AddMapping(".thn", "application/octet-stream");
775 base.AddMapping(".tif", "image/tiff");
776 base.AddMapping(".tiff", "image/tiff");
777 base.AddMapping(".toc", "application/octet-stream");
778 base.AddMapping(".tr", "application/x-troff");
779 base.AddMapping(".trm", "application/x-msterminal");
780 base.AddMapping(".tsv", "text/tab-separated-values");
781 base.AddMapping(".ttf", "application/octet-stream");
782 base.AddMapping(".txt", "text/plain");
783 base.AddMapping(".u32", "application/octet-stream");
784 base.AddMapping(".uls", "text/iuls");
785 base.AddMapping(".ustar", "application/x-ustar");
786 base.AddMapping(".vbs", "text/vbscript");
787 base.AddMapping(".vcf", "text/x-vcard");
788 base.AddMapping(".vcs", "text/plain");
789 base.AddMapping(".vdx", "application/vnd.ms-visio.viewer");
790 base.AddMapping(".vml", "text/xml");
791 base.AddMapping(".vsd", "application/vnd.visio");
792 base.AddMapping(".vss", "application/vnd.visio");
793 base.AddMapping(".vst", "application/vnd.visio");
794 base.AddMapping(".vsto", "application/x-ms-vsto");
795 base.AddMapping(".vsw", "application/vnd.visio");
796 base.AddMapping(".vsx", "application/vnd.visio");
797 base.AddMapping(".vtx", "application/vnd.visio");
798 base.AddMapping(".wav", "audio/wav");
799 base.AddMapping(".wax", "audio/x-ms-wax");
800 base.AddMapping(".wbmp", "image/vnd.wap.wbmp");
801 base.AddMapping(".wcm", "application/vnd.ms-works");
802 base.AddMapping(".wdb", "application/vnd.ms-works");
803 base.AddMapping(".wks", "application/vnd.ms-works");
804 base.AddMapping(".wm", "video/x-ms-wm");
805 base.AddMapping(".wma", "audio/x-ms-wma");
806 base.AddMapping(".wmd", "application/x-ms-wmd");
807 base.AddMapping(".wmf", "application/x-msmetafile");
808 base.AddMapping(".wml", "text/vnd.wap.wml");
809 base.AddMapping(".wmlc", "application/vnd.wap.wmlc");
810 base.AddMapping(".wmls", "text/vnd.wap.wmlscript");
811 base.AddMapping(".wmlsc", "application/vnd.wap.wmlscriptc");
812 base.AddMapping(".wmp", "video/x-ms-wmp");
813 base.AddMapping(".wmv", "video/x-ms-wmv");
814 base.AddMapping(".wmx", "video/x-ms-wmx");
815 base.AddMapping(".wmz", "application/x-ms-wmz");
816 base.AddMapping(".wps", "application/vnd.ms-works");
817 base.AddMapping(".wri", "application/x-mswrite");
818 base.AddMapping(".wrl", "x-world/x-vrml");
819 base.AddMapping(".wrz", "x-world/x-vrml");
820 base.AddMapping(".wsdl", "text/xml");
821 base.AddMapping(".wvx", "video/x-ms-wvx");
822 base.AddMapping(".x", "application/directx");
823 base.AddMapping(".xaf", "x-world/x-vrml");
824 base.AddMapping(".xaml", "application/xaml+xml");
825 base.AddMapping(".xap", "application/x-silverlight-app");
826 base.AddMapping(".xbap", "application/x-ms-xbap");
827 base.AddMapping(".xbm", "image/x-xbitmap");
828 base.AddMapping(".xdr", "text/plain");
829 base.AddMapping(".xla", "application/vnd.ms-excel");
830 base.AddMapping(".xlam", "application/vnd.ms-excel.addin.macroEnabled.12");
831 base.AddMapping(".xlc", "application/vnd.ms-excel");
832 base.AddMapping(".xlm", "application/vnd.ms-excel");
833 base.AddMapping(".xls", "application/vnd.ms-excel");
834 base.AddMapping(".xlsb", "application/vnd.ms-excel.sheet.binary.macroEnabled.12");
835 base.AddMapping(".xlsm", "application/vnd.ms-excel.sheet.macroEnabled.12");
836 base.AddMapping(".xlsx", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
837 base.AddMapping(".xlt", "application/vnd.ms-excel");
838 base.AddMapping(".xltm", "application/vnd.ms-excel.template.macroEnabled.12");
839 base.AddMapping(".xltx", "application/vnd.openxmlformats-officedocument.spreadsheetml.template");
840 base.AddMapping(".xlw", "application/vnd.ms-excel");
841 base.AddMapping(".xml", "text/xml");
842 base.AddMapping(".xof", "x-world/x-vrml");
843 base.AddMapping(".xpm", "image/x-xpixmap");
844 base.AddMapping(".xps", "application/vnd.ms-xpsdocument");
845 base.AddMapping(".xsd", "text/xml");
846 base.AddMapping(".xsf", "text/xml");
847 base.AddMapping(".xsl", "text/xml");
848 base.AddMapping(".xslt", "text/xml");
849 base.AddMapping(".xsn", "application/octet-stream");
850 base.AddMapping(".xtp", "application/octet-stream");
851 base.AddMapping(".xwd", "image/x-xwindowdump");
852 base.AddMapping(".z", "application/x-compress");
853 base.AddMapping(".zip", "application/x-zip-compressed");
854 }
855 }
856 private static MimeMappingDictionaryBase _mappingDictionary = new MimeMappingDictionaryClassic();
857
858 public static string GetMimeMapping(string fileName)
859 {
860 if (fileName == null)
861 {
862 throw new ArgumentNullException("fileName");
863 }
864 return _mappingDictionary.GetMimeMapping(fileName);
865 }
866 }
867 #endif
868 }
SinGooCMS.Utility.MimeMapping.MimeMappingDictionaryBase.EnsureMapping
void EnsureMapping()
Definition: FileUtils.cs:465
SinGooCMS.Utility.FileUtils
文件管理工具
Definition: FileUtils.cs:24
SinGooCMS.Utility.MimeMapping.MimeMappingDictionaryBase.AddWildcardIfNotPresent
void AddWildcardIfNotPresent()
Definition: FileUtils.cs:457
System
SinGooCMS.Utility.FileSizeUnit.MB
SinGooCMS.Utility.MimeMapping.MimeMappingDictionaryBase.GetFileName
static string GetFileName(string path)
Definition: FileUtils.cs:482
SinGooCMS.Utility.FileUtils.CreateFileAsync
static async Task CreateFileAsync(string absolutePath, string fileContent, Encoding encoding=null)
异步创建文件并写入文本内容
Definition: FileUtils.cs:34
SinGooCMS.Utility.FileSizeUnit.KB
SinGooCMS.Utility.FileUtils.BackupFile
static bool BackupFile(string sourceFileName, string destFileName)
备份文件,当目标文件存在时覆盖
Definition: FileUtils.cs:323
SinGooCMS.Utility.FileUtils.RestoreFile
static bool RestoreFile(string backupFileName, string targetFileName, string backupTargetFileName)
恢复文件
Definition: FileUtils.cs:336
SinGooCMS.Utility.FileUtils.CreateDirectory
static void CreateDirectory(string absoluteDir)
创建文件夹
Definition: FileUtils.cs:150
SinGooCMS.Utility.FileUtils.RestoreFile
static bool RestoreFile(string backupFileName, string targetFileName)
恢复文件
Definition: FileUtils.cs:366
SinGooCMS.Utility.FileUtils.ReadFileContentAsync
static async Task< string > ReadFileContentAsync(string absolutePath, Encoding encoding=null)
异步读取文件内容
Definition: FileUtils.cs:53
SinGooCMS.Utility.FileUtils.BackupFile
static bool BackupFile(string sourceFileName, string destFileName, bool overwrite)
备份文件
Definition: FileUtils.cs:297
SinGooCMS
SinGooCMS.Utility.FileSizeUnit.TB
SinGooCMS.Utility.FileUtils.ReNameFile
static void ReNameFile(string absolutePath, string oldName, string newName, bool isFile=true)
重命名目录或者文件
Definition: FileUtils.cs:98
SinGooCMS.Utility.MimeMapping.MimeMappingDictionaryBase.GetMimeMapping
string GetMimeMapping(string fileName)
Definition: FileUtils.cs:492
SinGooCMS.Utility.FileUtils.CopyDirectory
static void CopyDirectory(string SourcePath, string DestinationPath)
复制目录及目录下所有文件
Definition: FileUtils.cs:233
SinGooCMS.Utility.FileUtils.DeleteDirectory
static void DeleteDirectory(string absoluteDir)
删除文件夹
Definition: FileUtils.cs:161
SinGooCMS.Utility.FileUtils.GetDirectoryLength
static long GetDirectoryLength(string absoluteDir)
获取目录容量
Definition: FileUtils.cs:172
SinGooCMS.Utility.FileUtils.ReadFileToStream
static Stream ReadFileToStream(string fileName)
读文件到Stream
Definition: FileUtils.cs:380
SinGooCMS.Utility.FileSizeUnit.GB
SinGooCMS.Utility.FileUtils.Combine
static string Combine(string dir, string fileName)
合并目录和文件名成为新的文件路径
Definition: FileUtils.cs:271
SinGooCMS.Utility.MimeMapping.MimeMappingDictionaryClassic.PopulateMappings
override void PopulateMappings()
Definition: FileUtils.cs:509
SinGooCMS.Utility.FileUtils.GetContentType
static string GetContentType(string filePath)
读取文件类型Content_Type
Definition: FileUtils.cs:422
SinGooCMS.Utility.FileUtils.GetAllFiles
static IEnumerable< FileInfo > GetAllFiles(string absoluteDir)
递归获取目录下的所有文件信息
Definition: FileUtils.cs:253
SinGooCMS.Utility.FileUtils.GetFileSize
static string GetFileSize(decimal length, FileSizeUnit unit=FileSizeUnit.KB)
获取文件大小
Definition: FileUtils.cs:118
SinGooCMS.Utility.MimeMapping.MimeMappingDictionaryClassic
Definition: FileUtils.cs:507
SinGooCMS.Utility.FileUtils.ReadFileToBytes
static byte[] ReadFileToBytes(string fileName)
读文件到byte[]
Definition: FileUtils.cs:390
SinGooCMS.Utility.MimeMapping.MimeMappingDictionaryBase
Definition: FileUtils.cs:439
SinGooCMS.Utility.FileUtils.CopyFolder
static void CopyFolder(string sourcesAbsoluteDir, string destAbsoluteDir)
复制文件夹
Definition: FileUtils.cs:205
SinGooCMS.Utility.FileSizeUnit
FileSizeUnit
文件尺寸大小单位
Definition: FileUtils.cs:13
SinGooCMS.Utility.FileUtils.WriteFileContentAsync
static async Task WriteFileContentAsync(string absolutePath, string fileContent, bool isAppend=false, Encoding encoding=null)
异步写文件
Definition: FileUtils.cs:74
SinGooCMS.Utility.MimeMapping.MimeMappingDictionaryBase._isInitialized
bool _isInitialized
Definition: FileUtils.cs:450
SinGooCMS.Utility.MimeMapping.MimeMappingDictionaryBase.AddMapping
void AddMapping(string fileExtension, string mimeType)
Definition: FileUtils.cs:452


SinGooCMS.Utility: SinGooCMS.Utility/Net/FtpClient.cs 源文件

  • 文件列表
  • SinGooCMS.Utility
  • Net
FtpClient.cs
浏览该文件的文档.
1 using System;
2 using System.Collections.Generic;
3 using System.IO;
4 using System.Linq;
5 using System.Net;
6 using System.Text;
7 using SinGooCMS.Utility.Extension;
8
9 namespace SinGooCMS.Utility
10 {
14 public sealed class FtpClient
15 {
16 #region 私有属性
17
21 private string FtpServer { get; set; }
22
26 private string Username { get; set; }
27
31 private string Password { get; set; }
32
36 private bool IsCredential { get; set; }
37
41 private bool PassiveMode { get; set; }
42
43 #endregion
44
45 #region 创建客户端实例
46
53 public static FtpClient GetAnonymousClient(string serverIp, bool passiveModel = false)
54 {
55 if (!serverIp.IsIP())
56 {
57 throw new ArgumentException("IP地址格式不正确");
58 }
59
60 return new FtpClient
61 {
62 FtpServer = serverIp,
63 IsCredential = false,
64 PassiveMode = passiveModel
65 };
66 }
67
76 public static FtpClient GetClient(string serverIp, string username, string password, bool passiveModel = false)
77 {
78 if (!serverIp.IsIP())
79 {
80 throw new ArgumentException("IP地址格式不正确");
81 }
82
83 return new FtpClient
84 {
85 FtpServer = serverIp,
86 Username = username,
87 Password = password,
88 IsCredential = true, //有用户名和密码，表示要验证用户
89 PassiveMode = passiveModel
90 };
91 }
92
93 #endregion
94
95 #region 从FTP服务器下载文件，指定本地路径和本地文件名
96
103 public void Download(string remoteFileName, string localFileName, Action<int, int> updateProgress = null)
104 {
105 using (var outputStream = new FileStream(localFileName, FileMode.Create))
106 {
107 if (FtpServer == null || FtpServer.Trim().Length == 0)
108 {
109 throw new Exception("ftp下载目标服务器地址未设置！");
110 }
111
112 Uri uri = new Uri("ftp://" + FtpServer + "/" + remoteFileName);
113 var ftpsize = (FtpWebRequest)WebRequest.Create(uri);
114 ftpsize.UseBinary = true;
115 var reqFtp = (FtpWebRequest)WebRequest.Create(uri);
116 reqFtp.UseBinary = true;
117 reqFtp.KeepAlive = false;
118 if (IsCredential) //使用用户身份认证
119 {
120 ftpsize.Credentials = new NetworkCredential(Username, Password);
121 reqFtp.Credentials = new NetworkCredential(Username, Password);
122 }
123
124 ftpsize.Method = WebRequestMethods.Ftp.GetFileSize;
125 using (var re = (FtpWebResponse)ftpsize.GetResponse())
126 {
127 long totalBytes = re.ContentLength;
128 reqFtp.Method = WebRequestMethods.Ftp.DownloadFile;
129 reqFtp.UsePassive = PassiveMode; //主动
130 using (var response = (FtpWebResponse)reqFtp.GetResponse())
131 {
132 using (var ftpStream = response.GetResponseStream())
133 {
134 //更新进度
135 updateProgress?.Invoke((int)totalBytes, 0); //更新进度条
136 long totalDownloadedByte = 0;
137 int bufferSize = 1024 * 1024;
138 byte[] buffer = new byte[bufferSize];
139 if (ftpStream != null)
140 {
141 var readCount = ftpStream.Read(buffer, 0, bufferSize);
142 while (readCount > 0)
143 {
144 totalDownloadedByte = readCount + totalDownloadedByte;
145 outputStream.Write(buffer, 0, readCount);
146 //更新进度
147 updateProgress?.Invoke((int)totalBytes, (int)totalDownloadedByte); //更新进度条
148 readCount = ftpStream.Read(buffer, 0, bufferSize);
149 }
150 }
151 }
152 }
153 }
154 }
155 }
156
164 public void BrokenDownload(string remoteFileName, string localFileName, long size, Action<int, int> updateProgress = null)
165 {
166 using (var outputStream = new FileStream(localFileName, FileMode.Append))
167 {
168 if (FtpServer == null || FtpServer.Trim().Length == 0)
169 {
170 throw new Exception("ftp下载目标服务器地址未设置！");
171 }
172
173 Uri uri = new Uri("ftp://" + FtpServer + "/" + remoteFileName);
174 var ftpsize = (FtpWebRequest)WebRequest.Create(uri);
175 ftpsize.UseBinary = true;
176 ftpsize.ContentOffset = size;
177 var reqFtp = (FtpWebRequest)WebRequest.Create(uri);
178 reqFtp.UseBinary = true;
179 reqFtp.KeepAlive = false;
180 reqFtp.ContentOffset = size;
181 if (IsCredential) //使用用户身份认证
182 {
183 ftpsize.Credentials = new NetworkCredential(Username, Password);
184 reqFtp.Credentials = new NetworkCredential(Username, Password);
185 }
186
187 ftpsize.Method = WebRequestMethods.Ftp.GetFileSize;
188 using (var re = (FtpWebResponse)ftpsize.GetResponse())
189 {
190 var totalBytes = re.ContentLength;
191 reqFtp.Method = WebRequestMethods.Ftp.DownloadFile;
192 reqFtp.UsePassive = PassiveMode;
193 using (var response = (FtpWebResponse)reqFtp.GetResponse())
194 {
195 using (var ftpStream = response.GetResponseStream())
196 {
197 updateProgress?.Invoke((int)totalBytes, 0); //更新进度条
198 long totalDownloadedByte = 0;
199 int bufferSize = 1024 * 1024;
200 byte[] buffer = new byte[bufferSize];
201 if (ftpStream != null)
202 {
203 var readCount = ftpStream.Read(buffer, 0, bufferSize);
204 while (readCount > 0)
205 {
206 totalDownloadedByte = readCount + totalDownloadedByte;
207 outputStream.Write(buffer, 0, readCount);
208 //更新进度
209 updateProgress?.Invoke((int)totalBytes, (int)totalDownloadedByte); //更新进度条
210 readCount = ftpStream.Read(buffer, 0, bufferSize);
211 }
212 }
213 }
214 }
215 }
216 }
217 }
218
226 public void Download(string remoteFileName, string localFileName, bool brokenOpen, Action<int, int> updateProgress = null)
227 {
228 if (brokenOpen)
229 {
230 long size = 0;
231 if (File.Exists(localFileName))
232 {
233 using (var outputStream = new FileStream(localFileName, FileMode.Open))
234 {
235 size = outputStream.Length;
236 }
237 }
238
239 BrokenDownload(remoteFileName, localFileName, size, updateProgress);
240 }
241
242 Download(remoteFileName, localFileName, updateProgress);
243 }
244
245 #endregion
246
247 #region 上传文件到FTP服务器
248
255 public void UploadFile(string relativePath, string localFullPathName, Action<int, int> updateProgress = null)
256 {
257 var finfo = new FileInfo(localFullPathName);
258 if (FtpServer == null || FtpServer.Trim().Length == 0)
259 {
260 throw new Exception("ftp上传目标服务器地址未设置！");
261 }
262
263 var reqFtp = GenerateFtpReq(StringUtils.GenerateUri(new string[] { FtpServer, relativePath, finfo.Name }, "ftp://"), WebRequestMethods.Ftp.UploadFile);
264 reqFtp.UseBinary = true;
265 reqFtp.ContentLength = finfo.Length; //为request指定上传文件的大小
266 int buffLength = 1024 * 1024;
267 byte[] buff = new byte[buffLength];
268 using (var fs = finfo.OpenRead())
269 {
270 using (var stream = reqFtp.GetRequestStream())
271 {
272 var contentLen = fs.Read(buff, 0, buffLength);
273 int allbye = (int)finfo.Length;
274 //更新进度
275 updateProgress?.Invoke(allbye, 0); //更新进度条
276 int startbye = 0;
277 while (contentLen != 0)
278 {
279 startbye = contentLen + startbye;
280 stream.Write(buff, 0, contentLen);
281 //更新进度
282 updateProgress?.Invoke(allbye, startbye); //更新进度条
283 contentLen = fs.Read(buff, 0, buffLength);
284 }
285 }
286 }
287 }
288
296 public bool UploadBroken(string localFullPath, string remoteFilepath, Action<int, int> updateProgress = null)
297 {
298 if (remoteFilepath == null)
299 {
300 remoteFilepath = "";
301 }
302
303 string newFileName;
304 var fileInf = new FileInfo(localFullPath);
305 long allbye = fileInf.Length;
306 if (fileInf.Name.IndexOf("#", StringComparison.Ordinal) == -1)
307 {
308 newFileName = RemoveSpaces(fileInf.Name);
309 }
310 else
311 {
312 newFileName = fileInf.Name.Replace("#", "＃");
313 newFileName = RemoveSpaces(newFileName);
314 }
315
316 long startfilesize = GetFileSize(newFileName, remoteFilepath);
317 if (startfilesize >= allbye)
318 {
319 return false;
320 }
321
322 long startbye = startfilesize;
323 //更新进度
324 updateProgress?.Invoke((int)allbye, (int)startfilesize); //更新进度条
325 string uri;
326 if (remoteFilepath.Length == 0)
327 {
328 uri = "ftp://" + FtpServer + "/" + newFileName;
329 }
330 else
331 {
332 uri = "ftp://" + FtpServer + "/" + remoteFilepath + "/" + newFileName;
333 }
334
335 // 根据uri创建FtpWebRequest对象
336 var reqFtp = (FtpWebRequest)WebRequest.Create(new Uri(uri));
337 // ftp用户名和密码
338 reqFtp.Credentials = new NetworkCredential(Username, Password);
339 // 默认为true，连接不会被关闭
340 // 在一个命令之后被执行
341 reqFtp.KeepAlive = false;
342 // 指定执行什么命令
343 reqFtp.Method = WebRequestMethods.Ftp.AppendFile;
344 reqFtp.UsePassive = PassiveMode;
345 // 指定数据传输类型
346 reqFtp.UseBinary = true;
347 // 上传文件时通知服务器文件的大小
348 reqFtp.ContentLength = fileInf.Length;
349 int buffLength = 1024 * 1024; // 缓冲大小设置为2kb
350 byte[] buff = new byte[buffLength];
351 // 打开一个文件流 (System.IO.FileStream) 去读上传的文件
352 using (FileStream fs = fileInf.OpenRead())
353 {
354 using (var strm = reqFtp.GetRequestStream())
355 {
356 // 把上传的文件写入流
357 fs.Seek(startfilesize, 0);
358 int contentLen = fs.Read(buff, 0, buffLength);
359 // 流内容没有结束
360 while (contentLen != 0)
361 {
362 // 把内容从file stream 写入 upload stream
363 strm.Write(buff, 0, contentLen);
364 contentLen = fs.Read(buff, 0, buffLength);
365 startbye += contentLen;
366 //更新进度
367 updateProgress?.Invoke((int)allbye, (int)startbye); //更新进度条
368 }
369
370 return true;
371 }
372 }
373 }
374
380 private string RemoveSpaces(string str)
381 {
382 string a = str.Where(c => Encoding.ASCII.GetBytes(c.ToString())[0] != 32).Aggregate("", (current, c) => current + c);
383 return a.Split('.')[a.Split('.').Length - 2] + "." + a.Split('.')[a.Split('.').Length - 1];
384 }
385
392 public long GetFileSize(string filePath, string remoteFilepath)
393 {
394 try
395 {
396 var fi = new FileInfo(filePath);
397 string uri;
398 if (remoteFilepath.Length == 0)
399 {
400 uri = "ftp://" + FtpServer + "/" + fi.Name;
401 }
402 else
403 {
404 uri = "ftp://" + FtpServer + "/" + remoteFilepath + "/" + fi.Name;
405 }
406
407 var reqFtp = (FtpWebRequest)WebRequest.Create(uri);
408 reqFtp.KeepAlive = false;
409 reqFtp.UseBinary = true;
410 reqFtp.Credentials = new NetworkCredential(Username, Password); //用户，密码
411 reqFtp.Method = WebRequestMethods.Ftp.GetFileSize;
412 reqFtp.UsePassive = PassiveMode;
413 var response = (FtpWebResponse)reqFtp.GetResponse();
414 var filesize = response.ContentLength;
415 return filesize;
416 }
417 catch
418 {
419 return 0;
420 }
421 }
422
423 #endregion
424
425 #region 获取当前目录下明细
426
431 public List<string> GetFilesDetails(string relativePath = "")
432 {
433 var result = new List<string>();
434 var reqFtp = GenerateFtpReq(StringUtils.GenerateUri(new string[] { FtpServer, relativePath }, "ftp://"), WebRequestMethods.Ftp.ListDirectoryDetails);
435
436 using (var response = reqFtp.GetResponse())
437 {
438 using (var reader = new StreamReader(response.GetResponseStream() ?? throw new InvalidOperationException(), Encoding.UTF8))
439 {
440 string line = reader.ReadLine();
441 while (line != null)
442 {
443 result.Add(line);
444 line = reader.ReadLine();
445 }
446
447 return result;
448 }
449 }
450 }
451
456 public List<string> GetFiles(string relativePath = "", string mask = "*.*")
457 {
458 var result = new List<string>();
459 var reqFtp = GenerateFtpReq(StringUtils.GenerateUri(new string[] { FtpServer, relativePath }, "ftp://"), WebRequestMethods.Ftp.ListDirectory);
460
461 using (var response = reqFtp.GetResponse())
462 {
463 using (var reader = new StreamReader(response.GetResponseStream() ?? throw new InvalidOperationException(), Encoding.UTF8))
464 {
465 string line = reader.ReadLine();
466 while (line != null)
467 {
468 if (mask.Trim() != string.Empty && mask.Trim() != "*.*")
469 {
470 string temp = mask.Substring(0, mask.IndexOf("*", StringComparison.Ordinal));
471 if (line.Substring(0, temp.Length) == temp)
472 {
473 result.Add(line);
474 }
475 }
476 else
477 {
478 result.Add(line);
479 }
480
481 line = reader.ReadLine();
482 }
483
484 return result;
485 }
486 }
487 }
488
493 public string[] GetDirectories(string relativePath)
494 {
495 var drectory = GetFilesDetails(relativePath);
496 string m = string.Empty;
497 foreach (string str in drectory)
498 {
499 int dirPos = str.IndexOf("<DIR>", StringComparison.Ordinal);
500 if (dirPos > 0)
501 {
502 /*判断 Windows 风格*/
503 m += str.Substring(dirPos + 5).Trim() + "\n";
504 }
505 else if (str.Trim().StartsWith("d"))
506 {
507 /*判断 Unix 风格*/
508 string dir = str.Split(new[] { " " }, StringSplitOptions.RemoveEmptyEntries)[8];
509 if (dir != "." && dir != "..")
510 {
511 dir = str.Substring(str.IndexOf(dir, StringComparison.Ordinal));
512 m += dir + "\n";
513 }
514 }
515 }
516
517 char[] n =
518 {
519 '\n'
520 };
521 return m.Split(n);
522 }
523 #endregion
524
525 #region 删除文件及文件夹
526
531 public void Delete(string filePath)
532 {
533 var reqFtp = GenerateFtpReq(StringUtils.GenerateUri(new string[] { FtpServer, filePath }, "ftp://"), WebRequestMethods.Ftp.DeleteFile);
534 using (var response = (FtpWebResponse)reqFtp.GetResponse())
535 {
536 using (var datastream = response.GetResponseStream())
537 {
538 using (var sr = new StreamReader(datastream ?? throw new InvalidOperationException()))
539 {
540 sr.ReadToEnd();
541 }
542 }
543 }
544 }
545
550 public void RemoveDirectory(string dirPath)
551 {
552 var reqFtp = GenerateFtpReq(StringUtils.GenerateUri(new string[] { FtpServer, dirPath }, "ftp://"), WebRequestMethods.Ftp.RemoveDirectory);
553 using (var response = (FtpWebResponse)reqFtp.GetResponse())
554 {
555 using (var datastream = response.GetResponseStream())
556 {
557 using (var sr = new StreamReader(datastream ?? throw new InvalidOperationException()))
558 {
559 sr.ReadToEnd();
560 }
561 }
562 }
563 }
564
565 #endregion
566
567 #region 其他操作
568
574 public long GetFileSize(string filePath)
575 {
576 var reqFtp = GenerateFtpReq(StringUtils.GenerateUri(new string[] { FtpServer, filePath }, "ftp://"), WebRequestMethods.Ftp.GetFileSize);
577 reqFtp.UseBinary = true;
578 using (var response = (FtpWebResponse)reqFtp.GetResponse())
579 {
580 var fileSize = response.ContentLength;
581 return fileSize;
582 }
583 }
584
589 public bool DirectoryExist(string remoteDirPath)
590 {
591 try
592 {
593 string[] dirList = GetDirectories(remoteDirPath);
594 return dirList.Any(str => str.Trim() == remoteDirPath.Trim());
595 }
596 catch
597 {
598 return false;
599 }
600 }
601
606 public bool FileExist(string remoteFileName)
607 {
608 return GetFiles("*.*").Any(str => str.Trim() == remoteFileName.Trim());
609 }
610
616 public void MakeDir(string relativePath, string newDir)
617 {
618 var reqFtp = GenerateFtpReq(StringUtils.GenerateUri(new string[] { FtpServer, relativePath, newDir }, "ftp://"), WebRequestMethods.Ftp.MakeDirectory);
619 reqFtp.UseBinary = true;
620 using (var response = (FtpWebResponse)reqFtp.GetResponse())
621 {
622 using (var _ = response.GetResponseStream())
623 {
624 //
625 }
626 }
627 }
628
635 public void Rename(string relativePath, string currentFilename, string newFilename)
636 {
637 var reqFtp = GenerateFtpReq(StringUtils.GenerateUri(new string[] { FtpServer, currentFilename, newFilename }, "ftp://"), WebRequestMethods.Ftp.Rename);
638 reqFtp.RenameTo = newFilename;
639 reqFtp.UseBinary = true;
640
641 using (var response = (FtpWebResponse)reqFtp.GetResponse())
642 {
643 using (var _ = response.GetResponseStream())
644 {
645 //
646 }
647 }
648 }
649
656 public void MoveFile(string relativePath, string currentFilename, string newDirectory)
657 {
658 Rename(relativePath, currentFilename, newDirectory);
659 }
660 #endregion
661
662 #region helper
663
670 private FtpWebRequest GenerateFtpReq(Uri uri, string method)
671 {
672 var reqFtp = (FtpWebRequest)WebRequest.Create(uri);
673 if (!string.IsNullOrEmpty(Username) && !string.IsNullOrEmpty(Password))
674 reqFtp.Credentials = new NetworkCredential(Username, Password);
675
676 reqFtp.KeepAlive = false;
677 reqFtp.Method = method;
678 reqFtp.UsePassive = PassiveMode;
679
680 return reqFtp;
681 }
682
683 #endregion
684 }
685 }
SinGooCMS.Utility.FtpClient.BrokenDownload
void BrokenDownload(string remoteFileName, string localFileName, long size, Action< int, int > updateProgress=null)
从FTP服务器下载文件，指定本地路径和本地文件名（支持断点下载）
Definition: FtpClient.cs:164
SinGooCMS.Utility.StringUtils.GenerateUri
static Uri GenerateUri(string[] parameters, string protocol="http://")
生成uri地址
Definition: StringUtils.cs:346
SinGooCMS.Utility.FtpClient.GetClient
static FtpClient GetClient(string serverIp, string username, string password, bool passiveModel=false)
获取一个匿名登录的ftp客户端
Definition: FtpClient.cs:76
SinGooCMS.Utility.FtpClient.DirectoryExist
bool DirectoryExist(string remoteDirPath)
判断当前目录下指定的子目录是否存在
Definition: FtpClient.cs:589
SinGooCMS.Utility.FtpClient.MakeDir
void MakeDir(string relativePath, string newDir)
创建文件夹
Definition: FtpClient.cs:616
SinGooCMS.Utility.FtpClient.RemoveSpaces
string RemoveSpaces(string str)
去除空格
Definition: FtpClient.cs:380
SinGooCMS.Utility
Definition: Accessor.cs:6
System
SinGooCMS.Utility.Extension
Definition: AssemblyExtensions.cs:8
SinGooCMS.Utility.FtpClient.Download
void Download(string remoteFileName, string localFileName, bool brokenOpen, Action< int, int > updateProgress=null)
从FTP服务器下载文件，指定本地路径和本地文件名
Definition: FtpClient.cs:226
SinGooCMS.Utility.FtpClient.FileExist
bool FileExist(string remoteFileName)
判断当前目录下指定的文件是否存在
Definition: FtpClient.cs:606
SinGooCMS.Utility.FtpClient.GetAnonymousClient
static FtpClient GetAnonymousClient(string serverIp, bool passiveModel=false)
获取一个匿名登录的ftp客户端
Definition: FtpClient.cs:53
SinGooCMS.Utility.FtpClient.GenerateFtpReq
FtpWebRequest GenerateFtpReq(Uri uri, string method)
创建ftp请求
Definition: FtpClient.cs:670
SinGooCMS.Utility.FtpClient.Download
void Download(string remoteFileName, string localFileName, Action< int, int > updateProgress=null)
从FTP服务器下载文件，指定本地路径和本地文件名
Definition: FtpClient.cs:103
SinGooCMS.Utility.FtpClient.Delete
void Delete(string filePath)
删除文件
Definition: FtpClient.cs:531
SinGooCMS
SinGooCMS.Utility.FtpClient.RemoveDirectory
void RemoveDirectory(string dirPath)
删除文件夹
Definition: FtpClient.cs:550
SinGooCMS.Utility.FtpClient.Rename
void Rename(string relativePath, string currentFilename, string newFilename)
改名
Definition: FtpClient.cs:635
SinGooCMS.Utility.FtpClient.GetDirectories
string[] GetDirectories(string relativePath)
获取当前目录下所有的文件夹列表(仅文件夹)
Definition: FtpClient.cs:493
SinGooCMS.Utility.FtpClient
FTP客户端操作类
Definition: FtpClient.cs:14
SinGooCMS.Utility.FtpClient.GetFileSize
long GetFileSize(string filePath)
获取指定文件大小
Definition: FtpClient.cs:574
SinGooCMS.Utility.StringUtils
字符串处理
Definition: StringUtils.cs:17
SinGooCMS.Utility.FtpClient.UploadBroken
bool UploadBroken(string localFullPath, string remoteFilepath, Action< int, int > updateProgress=null)
上传文件到FTP服务器(断点续传)
Definition: FtpClient.cs:296
SinGooCMS.Utility.FtpClient.GetFilesDetails
List< string > GetFilesDetails(string relativePath="")
获取当前目录下明细(包含文件和文件夹)
Definition: FtpClient.cs:431
SinGooCMS.Utility.FtpClient.GetFiles
List< string > GetFiles(string relativePath="", string mask="*.*")
获取当前目录下文件列表(仅文件)
Definition: FtpClient.cs:456
SinGooCMS.Utility.FtpClient.GetFileSize
long GetFileSize(string filePath, string remoteFilepath)
获取已上传文件大小
Definition: FtpClient.cs:392
SinGooCMS.Utility.FtpClient.UploadFile
void UploadFile(string relativePath, string localFullPathName, Action< int, int > updateProgress=null)
上传文件到FTP服务器
Definition: FtpClient.cs:255
SinGooCMS.Utility.FtpClient.MoveFile
void MoveFile(string relativePath, string currentFilename, string newDirectory)
移动文件
Definition: FtpClient.cs:656


SinGooCMS.Utility: SinGooCMS.Utility/Accessors/GenericAccessor.cs 源文件

  • 文件列表
  • SinGooCMS.Utility
  • Accessors
GenericAccessor.cs
浏览该文件的文档.
1 using System;
2 using System.Collections;
3 using System.Diagnostics;
4 using System.Reflection;
5 using System.Runtime.CompilerServices;
6
7 namespace SinGooCMS.Utility
8 {
13 public sealed class GenericAccessor<TInstance> : ObjectAccessor where TInstance : class
14 {
15 private readonly Hashtable
16 _genericInstanceGettersCache,
17 _genericInstanceSettersCache,
18 _genericPropertiesGettersCache,
19 _genericPropertiesSettersCache;
20
21 [DebuggerStepThrough]
22 internal GenericAccessor(bool ignoreCase, bool includeNonPublic)
23 : base(typeof(TInstance), ignoreCase, includeNonPublic)
24 {
25 _genericPropertiesGettersCache = new Hashtable(Properties.Count, Comparer);
26 _genericPropertiesSettersCache = new Hashtable(Properties.Count, Comparer);
27 _genericInstanceGettersCache = new Hashtable(Properties.Count, Comparer);
28 _genericInstanceSettersCache = new Hashtable(Properties.Count, Comparer);
29
30 foreach (var pair in Properties)
31 {
32 var propName = pair.Key;
33 var prop = pair.Value;
34
35 if (prop.CanRead)
36 {
37 _genericPropertiesGettersCache[propName] = AccessorBuilder.BuildGetter<TInstance>(prop, IncludesNonPublic);
38 }
39
40 if (prop.CanWrite)
41 {
42 _genericPropertiesSettersCache[propName] = AccessorBuilder.BuildSetter<TInstance>(prop, IncludesNonPublic);
43 }
44 }
45 }
46
50 public object this[TInstance instance, string propertyName]
51 {
52 get
53 {
54 if (_genericPropertiesGettersCache[propertyName] is Func<TInstance, object> getter)
55 {
56 return getter(instance);
57 }
58 throw new ArgumentException($"Type: `{instance.GetType().FullName}` does not have a property named: `{propertyName}` that supports reading.");
59 }
60
61 set
62 {
63 if (_genericPropertiesSettersCache[propertyName] is Action<TInstance, object> setter)
64 {
65 setter(instance, value);
66 }
67 else
68 {
69 throw new ArgumentException($"Type: `{instance.GetType().FullName}` does not have a property named: `{propertyName}` that supports writing.");
70 }
71 }
72 }
73
77 [MethodImpl(MethodImplOptions.AggressiveInlining)]
78 public bool TryGet<TProperty>(TInstance instance, string propertyName, out TProperty value)
79 {
80 var cache = _genericInstanceGettersCache;
81
82 var getter = cache[propertyName] as Func<TInstance, TProperty>;
83 if (getter is null)
84 {
85 if (!Properties.TryGetValue(propertyName, out var prop))
86 {
87 value = default;
88 return false;
89 }
90
91 lock (cache)
92 {
93 getter = cache[propertyName] as Func<TInstance, TProperty>;
94 if (getter is null)
95 {
96 try
97 {
98 getter = AccessorBuilder.BuildGetter<TInstance, TProperty>(
99 prop.Name, IncludesNonPublic);
100 cache[prop.Name] = getter;
101 }
102 catch (ArgumentException)
103 {
104 value = default;
105 return false;
106 }
107 }
108 }
109 }
110
111 value = getter(instance);
112 return true;
113 }
114
118 [MethodImpl(MethodImplOptions.AggressiveInlining)]
119 public bool TrySet<TProperty>(TInstance instance, string propertyName, TProperty value)
120 {
121 var cache = _genericInstanceSettersCache;
122
123 var setter = cache[propertyName] as Action<TInstance, TProperty>;
124 if (setter is null)
125 {
126 if (!Properties.TryGetValue(propertyName, out var prop)) { return false; }
127
128 lock (cache)
129 {
130 setter = cache[propertyName] as Action<TInstance, TProperty>;
131 if (setter is null)
132 {
133 try
134 {
135 setter = AccessorBuilder.BuildSetter<TInstance, TProperty>(
136 prop.Name, IncludesNonPublic);
137 cache[prop.Name] = setter;
138 }
139 catch (ArgumentException)
140 {
141 return false;
142 }
143 }
144 }
145 }
146
147 setter(instance, value);
148 return true;
149 }
150 }
151 }
System
SinGooCMS.Utility.GenericAccessor
快速访问给定类型的对象的属性值, 参照: Accessor
Definition: GenericAccessor.cs:13
SinGooCMS.Utility.AccessorBuilder.BuildGetter
static Func< object, object > BuildGetter(PropertyInfo propertyInfo, bool includePrivate=false)
根据给定属性信息获取属性的读取逻辑
Definition: AccessorBuilder.cs:112
SinGooCMS.Utility.AccessorBuilder.BuildSetter
static Action< object, object > BuildSetter(PropertyInfo propertyInfo, bool includePrivate=false)
根据给定属性信息获取属性的写入逻辑
Definition: AccessorBuilder.cs:79
SinGooCMS
SinGooCMS.Utility.AccessorBuilder
提供一系列快速构建Accessor实例的方法
Definition: AccessorBuilder.cs:12
SinGooCMS.Utility.GenericAccessor._genericPropertiesSettersCache
readonly Hashtable _genericPropertiesSettersCache
Definition: GenericAccessor.cs:16
SinGooCMS.Utility.ObjectAccessor
快速访问给定类型的对象的属性值, 参照: Accessor
Definition: ObjectAccessor.cs:11


SinGooCMS.Utility: SinGooCMS.Utility/Text/HexUtils.cs 源文件

  • 文件列表
  • SinGooCMS.Utility
  • Text
HexUtils.cs
浏览该文件的文档.
1 using System;
2 using System.Text;
3 using SinGooCMS.Utility.Extension;
4
5 namespace SinGooCMS.Utility
6 {
10 public static class HexUtils
11 {
12 private const char SpaceCharacter = ' ';
13
19 public static unsafe string ToHex(string txt) =>
20 ToHex(Encoding.UTF8.GetBytes(txt));
21
25 public static unsafe string ToHex(byte[] bytes)
26 {
27 // freeze toHexTable position in memory
28 fixed (int* hexRef = ToHexTable)
29 // freeze source position in memory
30 fixed (byte* sourceRef = bytes)
31 {
32 // take first parsing position of source - allow inline pointer positioning
33 var s = sourceRef;
34 // calculate result length
35 var resultLen = bytes.Length << 1;
36
37 // initialize result string with any character expect '\0'
38 var result = new string(SpaceCharacter, resultLen);
39 // take the first character address of result
40 fixed (char* resultRef = result)
41 {
42 // pairs of characters explain the endiness of toHexTable
43 // move on by pairs of characters (2 x 2 bytes) - allow in-line pointer positioning
44 var pair = (int*)resultRef;
45
46 // more to go
47 while (*pair != 0)
48 {
49 // set the value of the current pair and move to next pair and source byte
50 *pair++ = hexRef[*s++];
51 }
52 return result;
53 }
54 }
55 }
56
62 public static unsafe string GetStrFromHex(string hexadecimalInput) =>
63 Encoding.UTF8.GetString(FromHex(hexadecimalInput));
64
68 public static unsafe byte[] FromHex(string hexadecimalInput)
69 {
70 if (hexadecimalInput.IsNullOrEmpty()) { return new byte[0]; }
71
72 // source length must be even
73 if (hexadecimalInput.Length % 2 == 1) { throw new ArgumentException(); }
74
75 int
76 index = 0, // start position for parsing source
77 len = hexadecimalInput.Length >> 1; // initial length of result
78
79 // take the first character address of source
80 fixed (char* sourceRef = hexadecimalInput)
81 {
82 if (*(int*)sourceRef == 7864368) // source starts with "0x"
83 {
84 if (hexadecimalInput.Length == 2) // source must not be just a "0x")
85 {
86 throw new ArgumentException();
87 }
88
89 index += 2; // start position (bypass "0x")
90 len -= 1; // result length (exclude "0x")
91 }
92
93 var result = new byte[len]; // initialization of result for known length
94
95 // freeze fromHexTable16 position in memory
96 fixed (byte* hiRef = FromHexTable16)
97 // freeze fromHexTable position in memory
98 fixed (byte* lowRef = FromHexTable)
99 // take the first byte address of result
100 fixed (byte* resultRef = result)
101 {
102 // take first parsing position of source - allow incremental memory position
103 char* s = &sourceRef[index];
104
105 // take first byte position of result - allow incremental memory position
106 byte* r = resultRef;
107
108 // source has more characters to parse
109 while (*s != 0)
110 {
111 // check for non valid characters in pairs
112 // you may split it if you don't like its readability
113 byte add; // keeps a fromHexTable value
114 if (
115 // check for character > 'f'
116 *s > 102 ||
117 // assign source value to current result position and increment source position
118 // and check if is a valid character
119 (*r = hiRef[*s++]) == 255 ||
120 // check for character > 'f'
121 *s > 102 ||
122 // assign source value to "add" parameter and increment source position
123 // and check if is a valid character
124 (add = lowRef[*s++]) == 255
125 )
126 {
127 throw new ArgumentException();
128 }
129
130 // set final value of current result byte and move pointer to next byte
131 *r++ += add;
132 }
133 return result;
134 }
135 }
136 }
137
138 #region helper
139
140 // assigned int values for bytes (0-255)
141 private static readonly int[] ToHexTable =
142 {
143 3145776, 3211312, 3276848, 3342384, 3407920, 3473456, 3538992, 3604528, 3670064, 3735600,
144 4259888, 4325424, 4390960, 4456496, 4522032, 4587568, 3145777, 3211313, 3276849, 3342385,
145 3407921, 3473457, 3538993, 3604529, 3670065, 3735601, 4259889, 4325425, 4390961, 4456497,
146 4522033, 4587569, 3145778, 3211314, 3276850, 3342386, 3407922, 3473458, 3538994, 3604530,
147 3670066, 3735602, 4259890, 4325426, 4390962, 4456498, 4522034, 4587570, 3145779, 3211315,
148 3276851, 3342387, 3407923, 3473459, 3538995, 3604531, 3670067, 3735603, 4259891, 4325427,
149 4390963, 4456499, 4522035, 4587571, 3145780, 3211316, 3276852, 3342388, 3407924, 3473460,
150 3538996, 3604532, 3670068, 3735604, 4259892, 4325428, 4390964, 4456500, 4522036, 4587572,
151 3145781, 3211317, 3276853, 3342389, 3407925, 3473461, 3538997, 3604533, 3670069, 3735605,
152 4259893, 4325429, 4390965, 4456501, 4522037, 4587573, 3145782, 3211318, 3276854, 3342390,
153 3407926, 3473462, 3538998, 3604534, 3670070, 3735606, 4259894, 4325430, 4390966, 4456502,
154 4522038, 4587574, 3145783, 3211319, 3276855, 3342391, 3407927, 3473463, 3538999, 3604535,
155 3670071, 3735607, 4259895, 4325431, 4390967, 4456503, 4522039, 4587575, 3145784, 3211320,
156 3276856, 3342392, 3407928, 3473464, 3539000, 3604536, 3670072, 3735608, 4259896, 4325432,
157 4390968, 4456504, 4522040, 4587576, 3145785, 3211321, 3276857, 3342393, 3407929, 3473465,
158 3539001, 3604537, 3670073, 3735609, 4259897, 4325433, 4390969, 4456505, 4522041, 4587577,
159 3145793, 3211329, 3276865, 3342401, 3407937, 3473473, 3539009, 3604545, 3670081, 3735617,
160 4259905, 4325441, 4390977, 4456513, 4522049, 4587585, 3145794, 3211330, 3276866, 3342402,
161 3407938, 3473474, 3539010, 3604546, 3670082, 3735618, 4259906, 4325442, 4390978, 4456514,
162 4522050, 4587586, 3145795, 3211331, 3276867, 3342403, 3407939, 3473475, 3539011, 3604547,
163 3670083, 3735619, 4259907, 4325443, 4390979, 4456515, 4522051, 4587587, 3145796, 3211332,
164 3276868, 3342404, 3407940, 3473476, 3539012, 3604548, 3670084, 3735620, 4259908, 4325444,
165 4390980, 4456516, 4522052, 4587588, 3145797, 3211333, 3276869, 3342405, 3407941, 3473477,
166 3539013, 3604549, 3670085, 3735621, 4259909, 4325445, 4390981, 4456517, 4522053, 4587589,
167 3145798, 3211334, 3276870, 3342406, 3407942, 3473478, 3539014, 3604550, 3670086, 3735622,
168 4259910, 4325446, 4390982, 4456518, 4522054, 4587590
169 };
170
171 // values for '\0' to 'f' where 255 indicates invalid input character
172 // starting from '\0' and not from '0' costs 48 bytes
173 // but results 0 subtractions and less if conditions
174 private static readonly byte[] FromHexTable =
175 {
176 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
177 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
178 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
179 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
180 255, 255, 255, 255, 255, 255, 255, 255, 0, 1,
181 2, 3, 4, 5, 6, 7, 8, 9, 255, 255,
182 255, 255, 255, 255, 255, 10, 11, 12, 13, 14,
183 15, 255, 255, 255, 255, 255, 255, 255, 255, 255,
184 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
185 255, 255, 255, 255, 255, 255, 255, 10, 11, 12,
186 13, 14, 15
187 };
188
189 // same as above but valid values are multiplied by 16
190 private static readonly byte[] FromHexTable16 =
191 {
192 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
193 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
194 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
195 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
196 255, 255, 255, 255, 255, 255, 255, 255, 0, 16,
197 32, 48, 64, 80, 96, 112, 128, 144, 255, 255,
198 255, 255, 255, 255, 255, 160, 176, 192, 208, 224,
199 240, 255, 255, 255, 255, 255, 255, 255, 255, 255,
200 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
201 255, 255, 255, 255, 255, 255, 255, 160, 176, 192,
202 208, 224, 240
203 };
204
205 #endregion
206 }
207 }
SinGooCMS.Utility.HexUtils.ToHex
static unsafe string ToHex(byte[] bytes)
将给定的T:byte[]转换成16进制字符串
Definition: HexUtils.cs:25
SinGooCMS.Utility
Definition: Accessor.cs:6
System
SinGooCMS.Utility.Extension
Definition: AssemblyExtensions.cs:8
SinGooCMS.Utility.HexUtils
16进制字符串之间的转换帮助类.
Definition: HexUtils.cs:10
SinGooCMS
SinGooCMS.Utility.HexUtils.FromHex
static unsafe byte[] FromHex(string hexadecimalInput)
将给定的16进制字符串转为 T:byte[].
Definition: HexUtils.cs:68


SinGooCMS.Utility: SinGooCMS.Utility/Extension/IConvertibleExtension.cs 源文件

  • 文件列表
  • SinGooCMS.Utility
  • Extension
IConvertibleExtension.cs
浏览该文件的文档.
1 using System;
2
3 namespace SinGooCMS.Utility.Extension
4 {
8 public static class IConvertibleExtension
9 {
16 public static T To<T>(this IConvertible value)
17 {
18 try
19 {
20 return (T)Convert.ChangeType(value, typeof(T));
21 }
22 catch
23 {
24 return default(T);
25 }
26 }
27 }
28 }
System
SinGooCMS.Utility.Extension.IConvertibleExtension
可转换扩展
Definition: IConvertibleExtension.cs:8
SinGooCMS


SinGooCMS.Utility: SinGooCMS.Utility/Extension/IEnumerableExtension.cs 源文件

  • 文件列表
  • SinGooCMS.Utility
  • Extension
IEnumerableExtension.cs
浏览该文件的文档.
1 using System;
2 using System.Data;
3 using System.Collections.Generic;
4 using System.Linq;
5 using System.Threading.Tasks;
6 using System.Collections;
7
8 namespace SinGooCMS.Utility.Extension
9 {
13 public static partial class IEnumerableExtension
14 {
15 #region SyncForEach
16
23 public static void ForEach<T>(this IEnumerable<T> objs, Action<T> action)
24 {
25 foreach (var o in objs)
26 {
27 action(o);
28 }
29 }
30
31 #endregion SyncForEach
32
33 #region AsyncForEach
34
41 public static async void ForEachAsync<T>(this IEnumerable<T> objs, Action<T> action)
42 {
43 await Task.Run(() => Parallel.ForEach(objs, action));
44 }
45
46 #endregion AsyncForEach
47
56 public static DataTable ToDataTable<T>(this IEnumerable<T> list, IDictionary<string, string> custColHeader = null)
57 {
58 var table = new DataTable();
59 //创建列头
60 var propertys = typeof(T).GetProperties();
61 foreach (var pi in propertys)
62 {
63 var pt = pi.PropertyType;
64 if (pt.IsGenericType && (pt.GetGenericTypeDefinition() == typeof(Nullable<>)))
65 {
66 pt = pt.GetGenericArguments()[0];
67 }
68
69 if (custColHeader != null && custColHeader.Count > 0)
70 {
71 if (custColHeader.ContainsKey(pi.Name))
72 table.Columns.Add(new DataColumn(custColHeader[pi.Name], pt)); //自定义表头
73 }
74 else
75 table.Columns.Add(new DataColumn(pi.Name, pt));
76 }
77 //创建数据行
78 if (list.Count() <= 0) return table;
79 {
80 foreach (var item in list)
81 {
82 var tempList = new ArrayList();
83 foreach (var pi in propertys)
84 {
85 if (custColHeader != null && custColHeader.Count > 0)
86 {
87 if (custColHeader.ContainsKey(pi.Name))
88 tempList.Add(pi.GetValue(item, null));
89 }
90 else
91 {
92 tempList.Add(pi.GetValue(item, null));
93 }
94 }
95
96 var array = tempList.ToArray();
97 table.LoadDataRow(array, true);
98 }
99 }
100 return table;
101 }
102
109 public static string ToSplitterString(this object[] array, string separator = ",")
110 {
111 return string.Join(separator, array);
112 }
113
121 public static string ToSplitterString<T>(this IEnumerable<T> sequence, string separator)
122 {
123 if (!sequence.Any()) { return string.Empty; }
124 return string.Join(separator, sequence);
125 }
126
134 public static IEnumerable<T> RandomArray<T>(this IEnumerable<T> arr, int multiple = 1)
135 {
136 List<T> temp = new T[arr.Count() * multiple].ToList();
137 foreach (var l in arr)
138 {
139 var rd = new Random(Guid.NewGuid().GetHashCode());
140 var index = rd.Next(0, arr.Count() * multiple);
141 temp.Insert(index, l);
142 }
143 temp.RemoveAll(new Predicate<T>((t) => { return !arr.Contains(t); }));
144 return temp;
145 }
146
154 public static T RandomTake<T>(this List<T> list, Random random = null)
155 {
156 if (list == null || list.Count == 0)
157 return default(T);
158
159 return list[(random ?? new Random()).Next(list.Count)];
160 }
161
170 public static IEnumerable<TSource> DistinctBy<TSource, TKey>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector)
171 {
172 var hash = new HashSet<TKey>();
173 return source.Where(p => hash.Add(keySelector(p)));
174 }
175
182 public static void AddRange<T>(this ICollection<T> @this, params T[] values)
183 {
184 foreach (var obj in values)
185 {
186 @this.Add(obj);
187 }
188 }
189
197 public static void AddRangeIf<T>(this ICollection<T> @this, Func<T, bool> predicate, params T[] values)
198 {
199 foreach (var obj in values)
200 {
201 if (predicate(obj))
202 {
203 @this.Add(obj);
204 }
205 }
206 }
207
214 public static void AddRangeIfNotContains<T>(this ICollection<T> @this, params T[] values)
215 {
216 foreach (T obj in values)
217 {
218 if (!@this.Contains(obj))
219 {
220 @this.Add(obj);
221 }
222 }
223 }
224
231 public static void RemoveWhere<T>(this ICollection<T> @this, Func<T, bool> @where)
232 {
233 foreach (var obj in @this.Where(where).ToList())
234 {
235 @this.Remove(obj);
236 }
237 }
238
246 public static void InsertAfter<T>(this IList<T> list, Func<T, bool> condition, T value)
247 {
248 foreach (var item in list.Select((item, index) => new { item, index }).Where(p => condition(p.item)).OrderByDescending(p => p.index))
249 {
250 if (item.index + 1 == list.Count)
251 {
252 list.Add(value);
253 }
254 else
255 {
256 list.Insert(item.index + 1, value);
257 }
258 }
259 }
260
268 public static void InsertAfter<T>(this IList<T> list, int index, T value)
269 {
270 foreach (var item in list.Select((v, i) => new { Value = v, Index = i }).Where(p => p.Index == index).OrderByDescending(p => p.Index))
271 {
272 if (item.Index + 1 == list.Count)
273 {
274 list.Add(value);
275 }
276 else
277 {
278 list.Insert(item.Index + 1, value);
279 }
280 }
281 }
282
291 public static HashSet<TResult> ToHashSet<T, TResult>(this IEnumerable<T> source, Func<T, TResult> selector)
292 {
293 var set = new HashSet<TResult>();
294 set.UnionWith(source.Select(selector));
295 return set;
296 }
297 }
298 }
System
SinGooCMS.Utility.Extension.SequenceType.ArrayList
代表 System.Collections.ArrayList. 非泛型
SinGooCMS.Utility.Extension.IEnumerableExtension.ToSplitterString
static string ToSplitterString(this object[] array, string separator=",")
一维数组转字符串
Definition: IEnumerableExtension.cs:109
SinGooCMS.Utility.Extension.IEnumerableExtension
遍历扩展
Definition: IEnumerableExtension.cs:13
SinGooCMS


SinGooCMS.Utility: SinGooCMS.Utility/System/IISUtils.cs 源文件

  • 文件列表
  • SinGooCMS.Utility
  • System
IISUtils.cs
浏览该文件的文档.
1 using System;
2 using System.Collections.Generic;
3 using System.Text;
4 using Microsoft.Web.Administration;
5
6 namespace SinGooCMS.Utility
7 {
11 public class IISUtils
12 {
13 #region 创建网站
14 public static bool CreateSite(string siteName, string bindingInfo, string physicalPath)
22 {
23 return CreateSite(siteName, "http", bindingInfo, physicalPath, true, siteName, ProcessModelIdentityType.ApplicationPoolIdentity, null, null, ManagedPipelineMode.Integrated, null);
24 }
40 public static bool CreateSite(string siteName, string protocol, string bindingInformation, string physicalPath, bool createAppPool, string appPoolName,
41 ProcessModelIdentityType identityType, string appPoolUserName, string appPoolPassword, ManagedPipelineMode appPoolPipelineMode, string managedRuntimeVersion)
42 {
43 using (ServerManager mgr = new ServerManager())
44 {
45 //删除网站和应用程序池
46 DeleteSite(siteName);
47 Site site = mgr.Sites.Add(siteName, protocol, bindingInformation.ToLower(), physicalPath);
48
49 // PROVISION APPPOOL IF NEEDED
50 if (createAppPool)
51 {
52 ApplicationPool pool = mgr.ApplicationPools.Add(appPoolName);
53 if (pool.ProcessModel.IdentityType != identityType)
54 {
55 pool.ProcessModel.IdentityType = identityType;
56 }
57 if (!String.IsNullOrEmpty(appPoolUserName))
58 {
59 pool.ProcessModel.UserName = appPoolUserName;
60 pool.ProcessModel.Password = appPoolPassword;
61 }
62 if (appPoolPipelineMode != pool.ManagedPipelineMode)
63 {
64 pool.ManagedPipelineMode = appPoolPipelineMode;
65 }
66 site.Applications["/"].ApplicationPoolName = pool.Name;
67 }
68 if (site != null)
69 {
70 mgr.CommitChanges();
71 return true;
72 }
73 }
74 return false;
75 }
76
77 #endregion
78
79 #region 删除网站和应用程序池
80 public static bool DeleteSite(string siteName, Boolean isAppPool = true)
87 {
88 using (ServerManager mgr = new ServerManager())
89 {
90 //判断web应用程序是否存在
91 if (mgr.Sites[siteName] != null)
92 {
93 if (isAppPool)
94 {
95 //判断应用程序池是否存在
96 if (mgr.ApplicationPools[siteName] != null)
97 {
98 mgr.ApplicationPools.Remove(mgr.ApplicationPools[siteName]);
99 }
100 }
101 mgr.Sites.Remove(mgr.Sites[siteName]);
102 mgr.CommitChanges();
103 return true;
104 }
105 else
106 {
107 return false;
108 }
109 }
110 }
116 public static bool DeletePool(string appPoolName)
117 {
118 using (ServerManager mgr = new ServerManager())
119 {
120 ApplicationPool pool = mgr.ApplicationPools[appPoolName];
121 if (pool != null)
122 {
123 mgr.ApplicationPools.Remove(pool);
124 mgr.CommitChanges();
125 return true;
126 }
127 else
128 {
129 return false;
130 }
131 }
132 }
133 #endregion
134
135 #region 默认文档 添加和删除
136 public static bool AddDefaultDocument(string siteName, string defaultDocName)
143 {
144 using (ServerManager mgr = new ServerManager())
145 {
146 Configuration cfg = mgr.GetWebConfiguration(siteName);
147 ConfigurationSection defaultDocumentSection = cfg.GetSection("system.webServer/defaultDocument");
148 ConfigurationElement filesElement = defaultDocumentSection.GetChildElement("files");
149 ConfigurationElementCollection filesCollection = filesElement.GetCollection();
150
151 foreach (ConfigurationElement elt in filesCollection)
152 {
153 if (elt.Attributes["value"].Value.ToString() == defaultDocName)
154 {
155 return false;//添加时存在
156 }
157 }
158 try
159 {
160 //创建一个新的默认页
161 ConfigurationElement docElement = filesCollection.CreateElement();
162 docElement.SetAttributeValue("value", defaultDocName);
163 filesCollection.Add(docElement);
164 }
165 catch (Exception)
166 {
167 return false;//添加时发生错误
168 }
169
170 mgr.CommitChanges();
171 }
172 return true;//添加成功
173 }
180 public static bool DeleteDefaultDocument(string siteName, string defaultDocName)
181 {
182 using (ServerManager mgr = new ServerManager())
183 {
184 Configuration cfg = mgr.GetWebConfiguration(siteName);
185 ConfigurationSection defaultDocumentSection = cfg.GetSection("system.webServer/defaultDocument");
186 ConfigurationElement filesElement = defaultDocumentSection.GetChildElement("files");
187 ConfigurationElementCollection filesCollection = filesElement.GetCollection();
188
189 //创建一个新的默认页
190 ConfigurationElement docElement = filesCollection.CreateElement();
191
192 bool isdefault = false;
193 //不存在则返回
194 foreach (ConfigurationElement elt in filesCollection)
195 {
196 if (elt.Attributes["value"].Value.ToString() == defaultDocName)
197 {
198 docElement = elt;
199 isdefault = true;
200 }
201 }
202 if (!isdefault)
203 {
204 return false;//不存在
205 }
206 try
207 {
208 filesCollection.Remove(docElement);
209 }
210 catch (Exception)
211 {
212 return false;//删除时发生错误
213 }
214
215 mgr.CommitChanges();
216 }
217 return true;//删除成功
218 }
219 #endregion
220
221 #region 虚拟目录添加和删除
222
230 public static bool CreateVDir(string siteName, string vDirName, string physicalPath)
231 {
232 using (ServerManager mgr = new ServerManager())
233 {
234 Site site = mgr.Sites[siteName];
235 if (site == null)
236 {
237 return false;
238 }
239 site.Applications.Add("/" + vDirName, physicalPath);
240 mgr.CommitChanges();
241 }
242 return true;
243 }
250 public static bool DeleteVDir(string siteName, string vDirName)
251 {
252 using (ServerManager mgr = new ServerManager())
253 {
254 Site site = mgr.Sites[siteName];
255 if (site == null)
256 {
257 return false;
258 }
259 site.Applications.Remove(site.Applications["/" + vDirName]);
260 mgr.CommitChanges();
261 }
262 return true;
263 }
264 #endregion
265
266 #region 应用程序池暂停，启动
267 public static bool PoolsStart(string poolName)
273 {
274 try
275 {
276 using (ServerManager mgr = new ServerManager())
277 {
278 if (mgr.ApplicationPools[poolName].State == ObjectState.Stopped)
279 {
280 mgr.ApplicationPools[poolName].Start();
281 }
282 mgr.CommitChanges();
283 }
284 }
285 catch (Exception)
286 {
287 return false;
288 }
289 return true;
290 }
296 public static bool PoolsStop(string poolName)
297 {
298 try
299 {
300 using (ServerManager mgr = new ServerManager())
301 {
302 if (mgr.ApplicationPools[poolName].State == ObjectState.Started)
303 {
304 mgr.ApplicationPools[poolName].Stop();
305 }
306 mgr.CommitChanges();
307 }
308 }
309 catch (Exception)
310 {
311 return false;
312 }
313 return true;
314 }
315 #endregion
316
317 #region 网站暂停，启动
318 public static bool Start(string siteName)
324 {
325 try
326 {
327 using (ServerManager mgr = new ServerManager())
328 {
329 if (mgr.Sites[siteName].State == ObjectState.Stopped)
330 {
331 mgr.Sites[siteName].Start();
332 }
333 mgr.CommitChanges();
334 }
335 }
336 catch (Exception)
337 {
338 return false;
339 }
340 return true;
341 }
347 public static bool Stop(string siteName)
348 {
349 try
350 {
351 using (ServerManager mgr = new ServerManager())
352 {
353 if (mgr.Sites[siteName].State == ObjectState.Started)
354 {
355 mgr.Sites[siteName].Stop();
356 }
357 mgr.CommitChanges();
358 }
359 }
360 catch (Exception)
361 {
362 return false;
363 }
364 return true;
365 }
366 #endregion
367
368 #region 获取网站的信息
369 public static Site GetSiteInfo(string siteName)
375 {
376 using (ServerManager mgr = new ServerManager())
377 {
378 return mgr.Sites[siteName];
379 }
380 }
385 public static SiteCollection GetSiteList()
386 {
387 using (ServerManager mgr = new ServerManager())
388 {
389 return mgr.Sites;
390 }
391 }
392 #endregion
393
394 #region 添加绑定信息
395 public static bool AddHostBinding(string siteName, string ip, string port, string domain, string bindingProtocol = "http")
405 {
406 try
407 {
408 using (ServerManager mgr = new ServerManager())
409 {
410 string binginfo = string.Format("{0}:{1}:{2}", ip, port, domain).ToLower();
411 BindingCollection binding = mgr.Sites[siteName].Bindings;
412 binding.Add(binginfo, bindingProtocol);
413 mgr.CommitChanges();
414 }
415 }
416 catch (Exception)
417 {
418 return false;
419 }
420 return true;
421 }
430 public static bool DeleteHostBinding(string siteName, string ip, string port, string domain)
431 {
432 try
433 {
434 using (ServerManager mgr = new ServerManager())
435 {
436 string binginfo = string.Format("{0}:{1}:{2}", ip, port, domain).ToLower();
437 foreach (Binding item in mgr.Sites[siteName].Bindings)
438 {
439 if (item.BindingInformation == binginfo)
440 {
441 mgr.Sites[siteName].Bindings.Remove(item);
442 break;
443 }
444 }
445 mgr.CommitChanges();
446 }
447 }
448 catch (Exception)
449 {
450 return false;
451 }
452 return true;
453 }
454 #endregion
455 }
456 }
SinGooCMS.Utility.IISUtils.CreateVDir
static bool CreateVDir(string siteName, string vDirName, string physicalPath)
添加虚拟目录
Definition: IISUtils.cs:230
SinGooCMS.Utility.IISUtils.DeleteDefaultDocument
static bool DeleteDefaultDocument(string siteName, string defaultDocName)
删除默认文档
Definition: IISUtils.cs:180
System
SinGooCMS.Utility.IISUtils.DeleteHostBinding
static bool DeleteHostBinding(string siteName, string ip, string port, string domain)
删除绑定信息
Definition: IISUtils.cs:430
SinGooCMS.Utility.IISUtils.PoolsStop
static bool PoolsStop(string poolName)
暂停应用程序池
Definition: IISUtils.cs:296
SinGooCMS
SinGooCMS.Utility.IISUtils.DeletePool
static bool DeletePool(string appPoolName)
删除应用程序池
Definition: IISUtils.cs:116
SinGooCMS.Utility.IISUtils.CreateSite
static bool CreateSite(string siteName, string protocol, string bindingInformation, string physicalPath, bool createAppPool, string appPoolName, ProcessModelIdentityType identityType, string appPoolUserName, string appPoolPassword, ManagedPipelineMode appPoolPipelineMode, string managedRuntimeVersion)
在本机的IIS创建Web网站
Definition: IISUtils.cs:40
SinGooCMS.Utility.IISUtils.DeleteVDir
static bool DeleteVDir(string siteName, string vDirName)
删除虚拟目录
Definition: IISUtils.cs:250
SinGooCMS.Utility.IISUtils
IIS操作
Definition: IISUtils.cs:11
SinGooCMS.Utility.IISUtils.Stop
static bool Stop(string siteName)
暂停网站
Definition: IISUtils.cs:347
SinGooCMS.Utility.IISUtils.GetSiteList
static SiteCollection GetSiteList()
获取所有的网站数据
Definition: IISUtils.cs:385


SinGooCMS.Utility: SinGooCMS.Utility/Extension/IOExtension.cs 源文件

  • 文件列表
  • SinGooCMS.Utility
  • Extension
IOExtension.cs
浏览该文件的文档.
1 using System;
2 using System.IO;
3 using System.Linq;
4 using System.Security.Cryptography;
5 using System.Text;
6 using System.Threading.Tasks;
7
8 namespace SinGooCMS.Utility.Extension
9 {
13 public static class IOExtension
14 {
15 #region 文件流
16
22 public static string ToBase64String(this FileStream fileStream)
23 =>Base64FileUtils.ReadFileToString(fileStream);
24
30 public static Stream ToStream(this byte[] bytes)
31 {
32 Stream stream = new MemoryStream(bytes);
33 stream.Seek(0, SeekOrigin.Begin);
34 return stream;
35 }
36
42 public static byte[] ToBytes(this Stream stream)
43 {
44 byte[] bytes = new byte[stream.Length];
45 stream.Read(bytes, 0, bytes.Length);
46 return bytes;
47 }
48
54 public static async Task WriteToFileAsync(this byte[] bytes, string fileName)
55 {
56 using (var fileStream = new FileStream(fileName, FileMode.OpenOrCreate))
57 {
58 await fileStream.WriteAsync(bytes, 0, bytes.Length);
59 await fileStream.FlushAsync();
60 }
61 }
62
68 public static async Task SaveFileAsync(this Stream ms, string filename)
69 {
70 using (var fs = new FileStream(filename, FileMode.OpenOrCreate, FileAccess.ReadWrite))
71 {
72 byte[] buffer = ms.ToArray(); // 转化为byte格式存储
73 await fs.WriteAsync(buffer, 0, buffer.Length);
74 await fs.FlushAsync();
75 }
76 }
77
78 #endregion
79
80 #region 计算哈希值
81
87 public static string GetFileMD5(this Stream fs) => HashFile(fs, "md5");
88
94 public static string GetFileSha1(this Stream fs) => HashFile(fs, "sha1");
95
102 private static string HashFile(Stream fs, string algo)
103 {
104 HashAlgorithm crypto = null;
105 switch (algo)
106 {
107 case "sha1":
108 crypto = new SHA1CryptoServiceProvider();
109 break;
110 default:
111 crypto = new MD5CryptoServiceProvider();
112 break;
113 }
114 byte[] retVal = crypto.ComputeHash(fs);
115
116 StringBuilder sb = new StringBuilder();
117 foreach (var t in retVal)
118 {
119 sb.Append(t.ToString("x2"));
120 }
121 return sb.ToString();
122 }
123
124 #endregion
125 }
126 }
System
SinGooCMS.Utility.Extension.IOExtension.ToBytes
static byte[] ToBytes(this Stream stream)
stream转为byte[]
Definition: IOExtension.cs:42
SinGooCMS.Utility.Extension.IOExtension.WriteToFileAsync
static async Task WriteToFileAsync(this byte[] bytes, string fileName)
异步写byte[]到fileName
Definition: IOExtension.cs:54
SinGooCMS
SinGooCMS.Utility.Extension.IOExtension.SaveFileAsync
static async Task SaveFileAsync(this Stream ms, string filename)
异步将内存流转储成文件
Definition: IOExtension.cs:68
SinGooCMS.Utility.Extension.IOExtension.ToStream
static Stream ToStream(this byte[] bytes)
byte[] 转为stream
Definition: IOExtension.cs:30
SinGooCMS.Utility.Base64FileUtils.ReadFileToString
static string ReadFileToString(string filePath, bool isJsFormat=false)
文件转base64
Definition: Base64FileUtils.cs:20
SinGooCMS.Utility.Extension.IOExtension.HashFile
static string HashFile(Stream fs, string algo)
计算文件的哈希值
Definition: IOExtension.cs:102
SinGooCMS.Utility.Extension.IOExtension
IO扩展
Definition: IOExtension.cs:13
SinGooCMS.Utility.Base64FileUtils
base64字符串和文件互转
Definition: Base64FileUtils.cs:12


SinGooCMS.Utility: SinGooCMS.Utility/Net/IPScanner.cs 源文件

  • 文件列表
  • SinGooCMS.Utility
  • Net
IPScanner.cs
浏览该文件的文档.
1 using System;
2 using System.IO;
3 using System.Text.RegularExpressions;
4 using System.Linq;
5
6 namespace SinGooCMS.Utility
7 {
11 public class IPScanner
12 {
13 #region 私有成员
14 private string dataPath;
15 private string ip;
16 private string country;
17 private string local;
18
19 private long firstStartIp = 0;
20 private long lastStartIp = 0;
21 private FileStream objfs = null;
22 private long startIp = 0;
23 private long endIp = 0;
24 private int countryFlag = 0;
25 private long endIpOff = 0;
26 private string errMsg = null;
27 #endregion
28
29 #region 构造函数
30
35 public IPScanner(string dbPath = "/ipdata/qqwry.dat")
36 {
37 dataPath = SystemUtils.GetMapPath(dbPath);
38 }
39
40 #endregion
41
42 #region 公共属性
43
47 public string DataPath
48 {
49 set { dataPath = value; }
50 }
54 public string IP
55 {
56 set { ip = value; }
57 }
61 public string Country
62 {
63 get { return country; }
64 }
68 public string Local
69 {
70 get { return local; }
71 }
75 public string ErrMsg
76 {
77 get { return errMsg; }
78 }
79 #endregion
80
81 #region 搜索匹配数据
82 private int QQwry()
83 {
84 string pattern = @"^((2[0-4]\d|25[0-5]|[01]?\d\d?)\.){3}(2[0-4]\d|25[0-5]|[01]?\d\d?)$";
85 Regex objRe = new Regex(pattern);
86 Match objMa = objRe.Match(ip);
87 if (!objMa.Success)
88 {
89 this.errMsg = "IP格式错误";
90 return 4;
91 }
92
93 long ip_Int = this.IpToInt(ip);
94 int nRet = 0;
95 if (ip_Int >= IpToInt("127.0.0.0") && ip_Int <= IpToInt("127.255.255.255"))
96 {
97 this.country = "本机内部环回地址";
98 this.local = "";
99 nRet = 1;
100 }
101 else if ((ip_Int >= IpToInt("0.0.0.0") && ip_Int <= IpToInt("2.255.255.255")) || (ip_Int >= IpToInt("64.0.0.0") && ip_Int <= IpToInt("126.255.255.255")) || (ip_Int >= IpToInt("58.0.0.0") && ip_Int <= IpToInt("60.255.255.255")))
102 {
103 this.country = "网络保留地址";
104 this.local = "";
105 nRet = 1;
106 }
107 objfs = new FileStream(this.dataPath, FileMode.Open, FileAccess.Read);
108 try
109 {
110 //objfs.Seek(0,SeekOrigin.Begin);
111 objfs.Position = 0;
112 byte[] buff = new Byte[8];
113 objfs.Read(buff, 0, 8);
114 firstStartIp = buff[0] + buff[1] * 256 + buff[2] * 256 * 256 + buff[3] * 256 * 256 * 256;
115 lastStartIp = buff[4] * 1 + buff[5] * 256 + buff[6] * 256 * 256 + buff[7] * 256 * 256 * 256;
116 long recordCount = Convert.ToInt64((lastStartIp - firstStartIp) / 7.0);
117 if (recordCount <= 1)
118 {
119 country = "FileDataError";
120 objfs.Close();
121 return 2;
122 }
123 long rangE = recordCount;
124 long rangB = 0;
125 long recNO = 0;
126 while (rangB < rangE - 1)
127 {
128 recNO = (rangE + rangB) / 2;
129 this.GetStartIp(recNO);
130 if (ip_Int == this.startIp)
131 {
132 rangB = recNO;
133 break;
134 }
135 if (ip_Int > this.startIp)
136 rangB = recNO;
137 else
138 rangE = recNO;
139 }
140 this.GetStartIp(rangB);
141 this.GetEndIp();
142 if (this.startIp <= ip_Int && this.endIp >= ip_Int)
143 {
144 this.GetCountry();
145 this.local = this.local.Replace("（我们一定要解放台湾！！！）", "");
146 }
147 else
148 {
149 nRet = 3;
150 this.country = "未知";
151 this.local = "";
152 }
153 objfs.Close();
154 return nRet;
155 }
156 catch (Exception ex)
157 {
158 return 1;
159 }
160
161 }
162 #endregion
163
164 #region IP地址转换成Int数据
165 private long IpToInt(string ip)
166 {
167 char[] dot = new char[] { '.' };
168 string[] ipArr = ip.Split(dot);
169 if (ipArr.Length == 3)
170 ip = ip + ".0";
171 ipArr = ip.Split(dot);
172
173 long ip_Int = 0;
174 long p1 = long.Parse(ipArr[0]) * 256 * 256 * 256;
175 long p2 = long.Parse(ipArr[1]) * 256 * 256;
176 long p3 = long.Parse(ipArr[2]) * 256;
177 long p4 = long.Parse(ipArr[3]);
178 ip_Int = p1 + p2 + p3 + p4;
179 return ip_Int;
180 }
181 #endregion
182
183 #region int转换成IP
184 private string IntToIP(long ip_Int)
185 {
186 long seg1 = (ip_Int & 0xff000000) >> 24;
187 if (seg1 < 0)
188 seg1 += 0x100;
189 long seg2 = (ip_Int & 0x00ff0000) >> 16;
190 if (seg2 < 0)
191 seg2 += 0x100;
192 long seg3 = (ip_Int & 0x0000ff00) >> 8;
193 if (seg3 < 0)
194 seg3 += 0x100;
195 long seg4 = (ip_Int & 0x000000ff);
196 if (seg4 < 0)
197 seg4 += 0x100;
198 string ip = seg1.ToString() + "." + seg2.ToString() + "." + seg3.ToString() + "." + seg4.ToString();
199
200 return ip;
201 }
202 #endregion
203
204 #region 获取起始IP范围
205 private long GetStartIp(long recNO)
206 {
207 long offSet = firstStartIp + recNO * 7;
208 //objfs.Seek(offSet,SeekOrigin.Begin);
209 objfs.Position = offSet;
210 byte[] buff = new Byte[7];
211 objfs.Read(buff, 0, 7);
212
213 endIpOff = Convert.ToInt64(buff[4].ToString()) + Convert.ToInt64(buff[5].ToString()) * 256 + Convert.ToInt64(buff[6].ToString()) * 256 * 256;
214 startIp = Convert.ToInt64(buff[0].ToString()) + Convert.ToInt64(buff[1].ToString()) * 256 + Convert.ToInt64(buff[2].ToString()) * 256 * 256 + Convert.ToInt64(buff[3].ToString()) * 256 * 256 * 256;
215 return startIp;
216 }
217 #endregion
218
219 #region 获取结束IP
220 private long GetEndIp()
221 {
222 //objfs.Seek(endIpOff,SeekOrigin.Begin);
223 objfs.Position = endIpOff;
224 byte[] buff = new Byte[5];
225 objfs.Read(buff, 0, 5);
226 this.endIp = Convert.ToInt64(buff[0].ToString()) + Convert.ToInt64(buff[1].ToString()) * 256 + Convert.ToInt64(buff[2].ToString()) * 256 * 256 + Convert.ToInt64(buff[3].ToString()) * 256 * 256 * 256;
227 this.countryFlag = buff[4];
228 return this.endIp;
229 }
230 #endregion
231
232 #region 获取国家/区域偏移量
233 private string GetCountry()
234 {
235 switch (this.countryFlag)
236 {
237 case 1:
238 case 2:
239 this.country = GetFlagStr(this.endIpOff + 4);
240 this.local = (1 == this.countryFlag) ? " " : this.GetFlagStr(this.endIpOff + 8);
241 break;
242 default:
243 this.country = this.GetFlagStr(this.endIpOff + 4);
244 this.local = this.GetFlagStr(objfs.Position);
245 break;
246 }
247 return " ";
248 }
249 #endregion
250
251 #region 获取国家/区域字符串
252 private string GetFlagStr(long offSet)
253 {
254 int flag = 0;
255 byte[] buff = new Byte[3];
256 while (1 == 1)
257 {
258 //objfs.Seek(offSet,SeekOrigin.Begin);
259 objfs.Position = offSet;
260 flag = objfs.ReadByte();
261 if (flag == 1 || flag == 2)
262 {
263 objfs.Read(buff, 0, 3);
264 if (flag == 2)
265 {
266 this.countryFlag = 2;
267 this.endIpOff = offSet - 4;
268 }
269 offSet = Convert.ToInt64(buff[0].ToString()) + Convert.ToInt64(buff[1].ToString()) * 256 + Convert.ToInt64(buff[2].ToString()) * 256 * 256;
270 }
271 else
272 {
273 break;
274 }
275 }
276 if (offSet < 12)
277 return " ";
278 objfs.Position = offSet;
279 return GetStr();
280 }
281 #endregion
282
283 #region GetStr
284 private string GetStr()
285 {
286 byte lowC = 0;
287 byte upC = 0;
288 string str = "";
289 byte[] buff = new byte[2];
290 while (1 == 1)
291 {
292 lowC = (Byte)objfs.ReadByte();
293 if (lowC == 0)
294 break;
295 if (lowC > 127)
296 {
297 upC = (byte)objfs.ReadByte();
298 buff[0] = lowC;
299 buff[1] = upC;
300 System.Text.Encoding enc = System.Text.Encoding.GetEncoding("GB2312"); //.net core需要加入引用
301 str += enc.GetString(buff);
302 }
303 else
304 {
305 str += (char)lowC;
306 }
307 }
308 return str;
309 }
310 #endregion
311
312 #region 获取IP地址
313
320 public string IPLocation(string ip = "", string dataPath = "")
321 {
322 if (!string.IsNullOrEmpty(dataPath))
323 this.dataPath = dataPath;
324
325 if (!string.IsNullOrEmpty(ip))
326 this.ip = ip;
327
328 if (string.IsNullOrEmpty(this.dataPath) || string.IsNullOrEmpty(ip))
329 return string.Empty;
330 else
331 {
332 this.QQwry();
333 return this.country + this.local;
334 }
335 }
336
337 #endregion
338
339 #region 判断是否国内IP
340
346 public bool IsChineseIP(string ip)
347 {
348 string[] chineseProvince = "北京,上海,天津,重庆,浙江,广东,江苏,河北,山西,四川,河南,辽宁,吉林,黑龙江,山东,安徽,福建,湖北,湖南,海南,江西,贵州,云南,陕西,甘肃,广西,宁夏,青海,新疆,西藏,内蒙古,香港,澳门,台湾".Split(',');
349 IPLocation(ip);
350 string ipCountry = this.Country ?? string.Empty;
351 return chineseProvince.Where(p => ipCountry.Contains(p)).FirstOrDefault() != null;
352 }
353
354 #endregion
355 }
356 }
SinGooCMS.Utility.IPScanner.local
string local
Definition: IPScanner.cs:17
SinGooCMS.Utility.IPScanner.IPLocation
string IPLocation(string ip="", string dataPath="")
IP定位
Definition: IPScanner.cs:320
SinGooCMS.Utility.IPScanner.QQwry
int QQwry()
Definition: IPScanner.cs:82
System
SinGooCMS.Utility.IPScanner.GetStr
string GetStr()
Definition: IPScanner.cs:284
SinGooCMS.Utility.IPScanner.country
string country
Definition: IPScanner.cs:16
SinGooCMS.Utility.IPScanner.IntToIP
string IntToIP(long ip_Int)
Definition: IPScanner.cs:184
SinGooCMS.Utility.IPScanner.GetEndIp
long GetEndIp()
Definition: IPScanner.cs:220
SinGooCMS.Utility.IPScanner.IpToInt
long IpToInt(string ip)
Definition: IPScanner.cs:165
SinGooCMS.Utility.IPScanner
读取纯真IP数据库，定位IP地址
Definition: IPScanner.cs:11
SinGooCMS
SinGooCMS.Utility.IPScanner.ip
string ip
Definition: IPScanner.cs:15
SinGooCMS.Utility.IPScanner.dataPath
string dataPath
Definition: IPScanner.cs:14
SinGooCMS.Utility.IPScanner.GetFlagStr
string GetFlagStr(long offSet)
Definition: IPScanner.cs:252
SinGooCMS.Utility.IPScanner.GetStartIp
long GetStartIp(long recNO)
Definition: IPScanner.cs:205
SinGooCMS.Utility.IPScanner.IsChineseIP
bool IsChineseIP(string ip)
是否国内IP，需要调用QQ纯真数据库，路径App_Data/qqwry.dat
Definition: IPScanner.cs:346
SinGooCMS.Utility.IPScanner.IPScanner
IPScanner(string dbPath="/ipdata/qqwry.dat")
IP位置查找器
Definition: IPScanner.cs:35
SinGooCMS.Utility.IPScanner.GetCountry
string GetCountry()
Definition: IPScanner.cs:233


SinGooCMS.Utility: SinGooCMS.Utility/Net/IPUtils.cs 源文件

  • 文件列表
  • SinGooCMS.Utility
  • Net
IPUtils.cs
浏览该文件的文档.
1 using System;
2 using System.Collections.Generic;
3 using System.Text;
4 using System.Linq;
5 using SinGooCMS.Utility.Extension;
6 using System.Net;
7
8 namespace SinGooCMS.Utility
9 {
13 public sealed class IPUtils
14 {
19 public static string GetIP()
20 {
21 var ip = "0.0.0.0";
22 #if NETSTANDARD2_1
23 if (UtilsBase.HttpContext != null)
24 {
25 ip = UtilsBase.Request.Headers["X-Forwarded-For"].FirstOrDefault();
26 if (ip.IsNullOrEmpty())
27 {
28 ip = UtilsBase.HttpContext.Connection.RemoteIpAddress?.ToString();
29 }
30 }
31 else
32 {
33 return Dns.GetHostEntry(Dns.GetHostName())
34 .AddressList.FirstOrDefault(p => p.AddressFamily.ToString() == "InterNetwork")?.ToString();
35 }
36 #else
37 if (UtilsBase.HttpContext != null)
38 {
39 ip = UtilsBase.HttpContext.Request.ServerVariables["HTTP_X_FORWARDED_FOR"] ?? string.Empty;
40 if (!ip.IsIP())
41 ip = UtilsBase.HttpContext.Request.ServerVariables["REMOTE_ADDR"] ?? string.Empty;
42
43 if (!ip.IsIP())
44 ip = UtilsBase.HttpContext.Request.UserHostAddress;
45 }
46 else
47 {
48 return Dns.GetHostEntry(Dns.GetHostName()).AddressList.FirstOrDefault(p => p.AddressFamily.ToString() == "InterNetwork")?.ToString();
49 }
50 #endif
51
52 return !ip.IsIP() ? "127.0.0.1" : ip;
53 }
54
60 public static string GetIPAreaStr(string ip = "")
61 {
62 if (ip.IsNullOrEmpty())
63 ip = GetIP();
64
65 return new IPScanner().IPLocation(ip); //从纯真数据库读取
66 }
67
68 #region 检查IP是否在IP段中
69
77 public static bool IsInIPDuan(string strCurrIP, string strBeginIP, string strEndIP)
78 {
79 int[] inip, begipint, endipint = new int[4];
80 inip = IP2IntArr(strCurrIP);
81 begipint = IP2IntArr(strBeginIP);
82 endipint = IP2IntArr(strEndIP);
83
84 for (int i = 0; i < 4; i++)
85 {
86 if (inip[i] < begipint[i] || inip[i] > endipint[i])
87 {
88 return false;
89 }
90 else if (inip[i] > begipint[i] || inip[i] < endipint[i])
91 {
92 return true;
93 }
94 }
95 return true;
96 }
97
103 public static int[] IP2IntArr(string strIP)
104 {
105 int[] retip = new int[4];
106 int i, count;
107 char c;
108 for (i = 0, count = 0; i < strIP.Length; i++)
109 {
110 c = strIP[i];
111 if (c != '.')
112 {
113 retip[count] = retip[count] * 10 + int.Parse(c.ToString());
114 }
115 else
116 {
117 count++;
118 }
119 }
120
121 return retip;
122
123 }
124
125 #endregion
126 }
127
128 #region IP地理位置信息
129
133 public class IPAreaInfo
134 {
138 public string Country { get; set; }
142 public string Province { get; set; }
146 public string City { get; set; }
150 public string County { get; set; }
151
156 public override string ToString()
157 {
158 StringBuilder builder = new StringBuilder();
159 if (!Country.IsNullOrEmpty())
160 builder.Append(Country);
161 if (!Province.IsNullOrEmpty())
162 builder.Append("," + Province);
163 if (!City.IsNullOrEmpty())
164 builder.Append("," + City);
165 if (!County.IsNullOrEmpty())
166 builder.Append("," + County);
167
168 return builder.ToString();
169 }
170 }
171
172 #endregion
173 }
SinGooCMS.Utility.IPScanner.IPLocation
string IPLocation(string ip="", string dataPath="")
IP定位
Definition: IPScanner.cs:320
SinGooCMS.Utility
Definition: Accessor.cs:6
System
SinGooCMS.Utility.Extension
Definition: AssemblyExtensions.cs:8
SinGooCMS.Utility.UtilsBase.HttpContext
static HttpContext HttpContext
http上下文
Definition: UtilsBase.cs:43
SinGooCMS.Utility.IPUtils.GetIP
static string GetIP()
获得当前页面客户端的IP
Definition: IPUtils.cs:19
SinGooCMS.Utility.IPAreaInfo
IP地理位置信息
Definition: IPUtils.cs:133
SinGooCMS.Utility.IPAreaInfo.ToString
override string ToString()
重写ToString
Definition: IPUtils.cs:156
SinGooCMS.Utility.IPScanner
读取纯真IP数据库，定位IP地址
Definition: IPScanner.cs:11
SinGooCMS.Utility.IPUtils
IP工具
Definition: IPUtils.cs:13
SinGooCMS.Utility.IPUtils.IsInIPDuan
static bool IsInIPDuan(string strCurrIP, string strBeginIP, string strEndIP)
检测当前ip是否在指定的ip段中
Definition: IPUtils.cs:77
SinGooCMS
SinGooCMS.Utility.UtilsBase.Request
static HttpRequest Request
请求
Definition: UtilsBase.cs:47
SinGooCMS.Utility.IPUtils.GetIPAreaStr
static string GetIPAreaStr(string ip="")
IP定位信息
Definition: IPUtils.cs:60
SinGooCMS.Utility.UtilsBase
工具底层，主要获取 http上下文 HttpContext。netfx从system.web中读取，core需要注入
Definition: UtilsBase.cs:13
SinGooCMS.Utility.IPUtils.IP2IntArr
static int[] IP2IntArr(string strIP)
将ip地址转成整形数组
Definition: IPUtils.cs:103


SinGooCMS.Utility: SinGooCMS.Utility/Data/IdCard.cs 源文件

  • 文件列表
  • SinGooCMS.Utility
  • Data
IdCard.cs
浏览该文件的文档.
1 using System;
2 using System.Collections.Generic;
3 using System.Text;
4 using SinGooCMS.Utility.Extension;
5
6 namespace SinGooCMS.Utility
7 {
15 public class IdCardUtils
16 {
17 #region 公共属性
18
22 public string CardNo { get; internal set; }
23
27 public string RegionCode => CardNo.Substring(0, 6);
28
32 public string Sex { get; internal set; }
33
37 public int Age { get; internal set; }
38
42 public DateTime BirthDay { get; internal set; }
43
44 #endregion
45
46 private IdCardUtils() { }
47
53 public static IdCardUtils Parse(string cardno)
54 {
55 if (!cardno.IsIDCard())
56 return null;
57
58 var inst = new IdCardUtils();
59 inst.CardNo = cardno;
60 inst.parseSex();
61 inst.parseAge();
62 return inst;
63 }
64
65 #region helper
66
71 private void parseSex()
72 {
73 string tmp;
74 tmp = this.CardNo.Substring(this.CardNo.Length - 4);
75 tmp = tmp.Substring(0, 3);
76
77 Math.DivRem(tmp.To<int>(), 2, out int outNum);
78 this.Sex = outNum == 1 ? "男" : "女";
79 }
80
85 private void parseAge()
86 {
87 parseBrithday();
88 DateTime nowDateTime = DateTime.Now;
89 int age = nowDateTime.Year - this.BirthDay.Year;
90 // 再考虑月、天的因素
91 if (nowDateTime.Month < this.BirthDay.Month || (nowDateTime.Month == this.BirthDay.Month && nowDateTime.Day < this.BirthDay.Day))
92 {
93 age--;
94 }
95 this.Age = age;
96 }
97
102 private void parseBrithday()
103 {
104 var rtn = this.CardNo.Substring(6, 8).Insert(6, "-").Insert(4, "-");
105 var birth = DateTime.Parse(rtn);
106 this.BirthDay = birth;
107 }
108
109 #endregion
110 }
111 }
SinGooCMS.Utility.IdCardUtils
身份证工具
Definition: IdCard.cs:15
SinGooCMS.Utility
Definition: Accessor.cs:6
SinGooCMS.Utility.IdCardUtils.Parse
static IdCardUtils Parse(string cardno)
解析身份证号
Definition: IdCard.cs:53
System
SinGooCMS.Utility.IdCardUtils.parseSex
void parseSex()
获取性别
Definition: IdCard.cs:71
SinGooCMS.Utility.Extension
Definition: AssemblyExtensions.cs:8
SinGooCMS
SinGooCMS.Utility.IdCardUtils.parseAge
void parseAge()
获取年龄
Definition: IdCard.cs:85
SinGooCMS.Utility.IdCardUtils.parseBrithday
void parseBrithday()
解析生日
Definition: IdCard.cs:102
SinGooCMS.Utility.IdCardUtils.IdCardUtils
IdCardUtils()
Definition: IdCard.cs:46


SinGooCMS.Utility: SinGooCMS.Utility/Extension/ImageExtension.cs 源文件

  • 文件列表
  • SinGooCMS.Utility
  • Extension
ImageExtension.cs
浏览该文件的文档.
1 using System;
2 using System.Drawing;
3 using System.Drawing.Drawing2D;
4 using System.Drawing.Imaging;
5 using System.IO;
6 using System.Linq;
7 using System.Threading.Tasks;
8
9 namespace SinGooCMS.Utility.Extension
10 {
14 public static class ImageExtension
15 {
16 #region image转base64字符串
17
22 public static string ToBase64(this Image image)
23 {
24 using (MemoryStream memoryStream = new MemoryStream())
25 {
26 image.Save(memoryStream, image.RawFormat);
27 byte[] imageBytes = memoryStream.ToArray();
28 return Convert.ToBase64String(imageBytes);
29 }
30 }
31
32 #endregion
33
34 #region 像素色阶处理
35
36 #region 调整光暗
37
43 public static Image LDPic(this Image mybm, int val)
44 {
45 int width = mybm.Width;
46 int height = mybm.Height;
47 Bitmap bm = new Bitmap(width, height); //初始化一个记录经过处理后的图片对象
48 int x, y; //x、y是循环次数，后面三个是记录红绿蓝三个值的
49 for (x = 0; x < width; x++)
50 {
51 for (y = 0; y < height; y++)
52 {
53 var pixel = ((Bitmap)mybm).GetPixel(x, y);
54 var resultR = pixel.R + val; //x、y是循环次数，后面三个是记录红绿蓝三个值的
55 var resultG = pixel.G + val; //x、y是循环次数，后面三个是记录红绿蓝三个值的
56 var resultB = pixel.B + val; //x、y是循环次数，后面三个是记录红绿蓝三个值的
57 bm.SetPixel(x, y, Color.FromArgb(resultR > 255 ? 255 : resultR, resultG > 255 ? 255 : resultG, resultB > 255 ? 255 : resultB)); //绘图
58 }
59 }
60
61 return bm;
62 }
63
64 #endregion
65
66 #region 反色处理
67
72 public static Image RePic(this Image mybm)
73 {
74 int width = mybm.Width;
75 int height = mybm.Height;
76 var bm = new Bitmap(width, height); //初始化一个记录处理后的图片的对象
77
78 for (var x = 0; x < width; x++)
79 {
80 for (var y = 0; y < height; y++)
81 {
82 var pixel = ((Bitmap)mybm).GetPixel(x, y);
83 var resultR = 255 - pixel.R;
84 var resultG = 255 - pixel.G;
85 var resultB = 255 - pixel.B;
86 bm.SetPixel(x, y, Color.FromArgb(resultR, resultG, resultB)); //绘图
87 }
88 }
89
90 return bm;
91 }
92
93 #endregion
94
95 #region 浮雕处理
96
101 public static Image Relief(this Image oldBitmap)
102 {
103 int width = oldBitmap.Width;
104 int height = oldBitmap.Height;
105 var newBitmap = new Bitmap(width, height);
106
107 for (int x = 0; x < width - 1; x++)
108 {
109 for (int y = 0; y < height - 1; y++)
110 {
111 var color1 = ((Bitmap)oldBitmap).GetPixel(x, y);
112 var color2 = ((Bitmap)oldBitmap).GetPixel(x + 1, y + 1);
113 var r = Math.Abs(color1.R - color2.R + 128);
114 var g = Math.Abs(color1.G - color2.G + 128);
115 var b = Math.Abs(color1.B - color2.B + 128);
116 if (r > 255) r = 255;
117 if (r < 0) r = 0;
118 if (g > 255) g = 255;
119 if (g < 0) g = 0;
120 if (b > 255) b = 255;
121 if (b < 0) b = 0;
122 newBitmap.SetPixel(x, y, Color.FromArgb(r, g, b));
123 }
124 }
125
126 return newBitmap;
127 }
128
129 #endregion
130
131 #region 拉伸图片
132
139 public static Image ResizeImage(this Image bmp, int newW, int newH)
140 {
141 Bitmap bap = new Bitmap(newW, newH);
142 using (Graphics g = Graphics.FromImage(bap))
143 {
144 g.InterpolationMode = InterpolationMode.HighQualityBicubic;
145 g.DrawImage(bmp, new Rectangle(0, 0, newW, newH), new Rectangle(0, 0, bmp.Width, bmp.Height), GraphicsUnit.Pixel);
146 return bap;
147 }
148 }
149
150 #endregion
151
152 #region 滤色处理
153
158 public static Image ColorFilter(this Image mybm)
159 {
160 int width = mybm.Width;
161 int height = mybm.Height;
162 var bm = new Bitmap(width, height);
163
164 for (var x = 0; x < width; x++)
165 {
166 int y;
167 for (y = 0; y < height; y++)
168 {
169 var pixel = ((Bitmap)mybm).GetPixel(x, y);
170 bm.SetPixel(x, y, Color.FromArgb(0, pixel.G, pixel.B)); //绘图
171 }
172 }
173
174 return bm;
175 }
176
177 #endregion
178
179 #region 转换为黑白图片
180
185 public static Image ToBWPic(this Image mybm)
186 {
187 int width = mybm.Width;
188 int height = mybm.Height;
189 var bm = new Bitmap(width, height);
190 for (var x = 0; x < width; x++)
191 {
192 for (var y = 0; y < height; y++)
193 {
194 var pixel = ((Bitmap)mybm).GetPixel(x, y);
195 var result = (pixel.R + pixel.G + pixel.B) / 3; //记录处理后的像素值
196 bm.SetPixel(x, y, Color.FromArgb(result, result, result));
197 }
198 }
199
200 return bm;
201 }
202
203 #endregion
204
205 #region 马赛克
206
213 public static Image Mosaic(this Image mybm, int effectWidth = 10)
214 {
215 var bm = mybm.DeepClone();
216
217 // 差异最多的就是以照一定范围取样 之后直接去下一个范围
218 for (int heightOfffset = 0; heightOfffset < bm.Height; heightOfffset += effectWidth)
219 {
220 for (int widthOffset = 0; widthOffset < bm.Width; widthOffset += effectWidth)
221 {
222 int avgR = 0, avgG = 0, avgB = 0;
223 int blurPixelCount = 0;
224
225 for (int x = widthOffset; (x < widthOffset + effectWidth && x < bm.Width); x++)
226 {
227 for (int y = heightOfffset; (y < heightOfffset + effectWidth && y < bm.Height); y++)
228 {
229 System.Drawing.Color pixel = ((Bitmap)bm).GetPixel(x, y);
230
231 avgR += pixel.R;
232 avgG += pixel.G;
233 avgB += pixel.B;
234
235 blurPixelCount++;
236 }
237 }
238
239 // 计算范围平均
240 avgR = avgR / blurPixelCount;
241 avgG = avgG / blurPixelCount;
242 avgB = avgB / blurPixelCount;
243
244 // 所有范围内都设定此值
245 for (int x = widthOffset; (x < widthOffset + effectWidth && x < bm.Width); x++)
246 {
247 for (int y = heightOfffset; (y < heightOfffset + effectWidth && y < bm.Height); y++)
248 {
249
250 Color newColor = Color.FromArgb(avgR, avgG, avgB);
251 ((Bitmap)bm).SetPixel(x, y, newColor);
252 }
253 }
254 }
255 }
256
257 return bm;
258 }
259
260 #endregion
261
262 #endregion
263
264 #region 左右翻转
265
270 public static Image LeftRightRev(this Image mybm)
271 {
272 int width = mybm.Width;
273 int height = mybm.Height;
274 var bm = new Bitmap(width, height);
275
276 //x,y是循环次数,z是用来记录像素点的x坐标的变化的
277 for (var y = height - 1; y >= 0; y--)
278 {
279 int x; //x,y是循环次数,z是用来记录像素点的x坐标的变化的
280 int z; //x,y是循环次数,z是用来记录像素点的x坐标的变化的
281 for (x = width - 1, z = 0; x >= 0; x--)
282 {
283 var pixel = ((Bitmap)mybm).GetPixel(x, y);
284 bm.SetPixel(z++, y, Color.FromArgb(pixel.R, pixel.G, pixel.B)); //绘图
285 }
286 }
287
288 return bm;
289 }
290
291 #endregion
292
293 #region 上下翻转
294
299 public static Image UpDownRev(this Image mybm)
300 {
301 int width = mybm.Width;
302 int height = mybm.Height;
303 var bm = new Bitmap(width, height);
304
305 for (var x = 0; x < width; x++)
306 {
307 int y;
308 int z;
309 for (y = height - 1, z = 0; y >= 0; y--)
310 {
311 var pixel = ((Bitmap)mybm).GetPixel(x, y);
312 bm.SetPixel(x, z++, Color.FromArgb(pixel.R, pixel.G, pixel.B)); //绘图
313 }
314 }
315
316 return bm;
317 }
318
319 #endregion
320
321 #region 裁剪图片
322
329 public static Image CutImage(this Image b, Rectangle rec)
330 {
331 int w = b.Width;
332 int h = b.Height;
333 if (rec.X >= w || rec.Y >= h)
334 {
335 return null;
336 }
337
338 if (rec.X + rec.Width > w)
339 {
340 rec.Width = w - rec.X;
341 }
342
343 if (rec.Y + rec.Height > h)
344 {
345 rec.Height = h - rec.Y;
346 }
347
348 try
349 {
350 var bmpOut = new Bitmap(rec.Width, rec.Height, PixelFormat.Format24bppRgb);
351 using (var g = Graphics.FromImage(bmpOut))
352 {
353 g.DrawImage(b, new Rectangle(0, 0, rec.Width, rec.Height), new Rectangle(rec.X, rec.Y, rec.Width, rec.Height), GraphicsUnit.Pixel);
354 return bmpOut;
355 }
356 }
357 catch (Exception)
358 {
359 return null;
360 }
361 }
362
363 #endregion
364
365 #region 裁剪并缩放
366
375 public static Image CutAndResize(this Image bmp, Rectangle rec, int newWidth, int newHeight) => bmp.CutImage(rec).Compress(newWidth, newHeight);
376
377 #endregion
378
379 #region 压缩图片
380
387 public static Image CompressRate(this Image bmp, float rate = 0.6f)
388 {
389 int newWidth = (bmp.Width * rate).ToInt();
390 int newHeight = (bmp.Height * rate).ToInt();
391
392 return bmp.Compress(newWidth, newHeight);
393 }
394
401 public static Image CompressWidth(this Image bmp, int newWidth)
402 {
403 int newHeight = ((newWidth / (bmp.Width * 1.0f)) * bmp.Height).ToInt();
404 return bmp.Compress(newWidth, newHeight);
405 }
406
413 public static Image CompressHeight(this Image bmp, int newHeight)
414 {
415 int newWidth = ((newHeight / (bmp.Height * 1.0)) * bmp.Width).ToInt();
416 return bmp.Compress(newWidth, newHeight);
417 }
418
426 public static Image Compress(this Image bmp, int newWidth, int newHeight)
427 {
428 if (bmp.Width < 100 && bmp.Height < 100)
429 return bmp;
430
431 if (newWidth > bmp.Width || newHeight > bmp.Height)
432 return bmp;
433
434 var b = new Bitmap(newWidth, newHeight);
435 using (var g = Graphics.FromImage(b))
436 {
437 g.CompositingQuality = CompositingQuality.HighQuality;
438 g.SmoothingMode = SmoothingMode.HighQuality;
439 g.InterpolationMode = InterpolationMode.HighQualityBicubic;
440 g.DrawImage(bmp, new Rectangle(0, 0, newWidth, newHeight), new Rectangle(0, 0, bmp.Width, bmp.Height), GraphicsUnit.Pixel);
441 return b;
442 }
443 }
444
445 #endregion
446
447 #region 生成缩略图
448
456 public static Image ThumbnailImage(this Image originalImage, int width, int height, ThumbnailCutMode mode = ThumbnailCutMode.Cut)
457 {
458 int towidth = width;
459 int toheight = height;
460
461 int x = 0;
462 int y = 0;
463 int ow = originalImage.Width;
464 int oh = originalImage.Height;
465
466 switch (mode)
467 {
468 case ThumbnailCutMode.Fixed: //指定高宽缩放（可能变形）
469 break;
470 case ThumbnailCutMode.LockWidth: //指定宽，高按比例
471 toheight = originalImage.Height * width / originalImage.Width;
472 break;
473 case ThumbnailCutMode.LockHeight: //指定高，宽按比例
474 towidth = originalImage.Width * height / originalImage.Height;
475 break;
476 case ThumbnailCutMode.Cut: //指定高宽裁减（不变形）
477 if (originalImage.Width / (double)originalImage.Height > towidth / (double)toheight)
478 {
479 oh = originalImage.Height;
480 ow = originalImage.Height * towidth / toheight;
481 y = 0;
482 x = (originalImage.Width - ow) / 2;
483 }
484 else
485 {
486 ow = originalImage.Width;
487 oh = originalImage.Width * height / towidth;
488 x = 0;
489 y = (originalImage.Height - oh) / 2;
490 }
491 break;
492 }
493
494 //新建一个bmp图片
495 Image bitmap = new Bitmap(towidth, toheight);
496
497 //新建一个画板
498 Graphics g = Graphics.FromImage(bitmap);
499
500 //设置高质量插值法
501 g.InterpolationMode = InterpolationMode.High;
502
503 //设置高质量,低速度呈现平滑程度
504 g.SmoothingMode = SmoothingMode.HighQuality;
505
506 //清空画布并以透明背景色填充
507 g.Clear(Color.Transparent);
508
509 //在指定位置并且按指定大小绘制原图片的指定部分
510 g.DrawImage(originalImage, new Rectangle(0, 0, towidth, toheight), new Rectangle(x, y, ow, oh), GraphicsUnit.Pixel);
511
512 try
513 {
514 return bitmap;
515 }
516 catch (Exception e)
517 {
518 throw e;
519 }
520 finally
521 {
522 originalImage.Dispose();
523 g.Dispose();
524 }
525 }
526
527 #endregion
528
529 #region 获取图片中的各帧
530
536 public static void GetFrames(this Image gif, string pSavedPath)
537 {
538 var fd = new FrameDimension(gif.FrameDimensionsList[0]);
539 int count = gif.GetFrameCount(fd); //获取帧数(gif图片可能包含多帧，其它格式图片一般仅一帧)
540 for (int i = 0; i < count; i++) //以Jpeg格式保存各帧
541 {
542 gif.SelectActiveFrame(fd, i);
543 gif.Save(pSavedPath + "\\frame_" + i + ".jpg", ImageFormat.Jpeg);
544 }
545 }
546
547 #endregion
548 }
549 }
SinGooCMS.Utility.Extension.ImageExtension.ResizeImage
static Image ResizeImage(this Image bmp, int newW, int newH)
拉伸图片
Definition: ImageExtension.cs:139
SinGooCMS.Utility.Extension.ImageExtension.LDPic
static Image LDPic(this Image mybm, int val)
调整光暗
Definition: ImageExtension.cs:43
System
SinGooCMS.Utility.Extension.ImageExtension.UpDownRev
static Image UpDownRev(this Image mybm)
上下翻转
Definition: ImageExtension.cs:299
SinGooCMS.Utility.Extension.ImageExtension.Relief
static Image Relief(this Image oldBitmap)
浮雕处理
Definition: ImageExtension.cs:101
SinGooCMS.Utility.Extension.ImageExtension.ThumbnailImage
static Image ThumbnailImage(this Image originalImage, int width, int height, ThumbnailCutMode mode=ThumbnailCutMode.Cut)
生成缩略图
Definition: ImageExtension.cs:456
SinGooCMS.Utility.Extension.ImageExtension.Mosaic
static Image Mosaic(this Image mybm, int effectWidth=10)
图片马赛克
Definition: ImageExtension.cs:213
SinGooCMS.Utility.Extension.ImageExtension.GetFrames
static void GetFrames(this Image gif, string pSavedPath)
获取图片中的各帧
Definition: ImageExtension.cs:536
SinGooCMS.Utility.Extension.ImageExtension.CompressHeight
static Image CompressHeight(this Image bmp, int newHeight)
等高压缩
Definition: ImageExtension.cs:413
SinGooCMS.Utility.Extension.ImageExtension.CutImage
static Image CutImage(this Image b, Rectangle rec)
裁剪图片 – 用GDI+
Definition: ImageExtension.cs:329
SinGooCMS.Utility.Extension.ImageExtension
image图像扩展
Definition: ImageExtension.cs:14
SinGooCMS
SinGooCMS.Utility.Extension.ImageExtension.CompressWidth
static Image CompressWidth(this Image bmp, int newWidth)
等宽压缩
Definition: ImageExtension.cs:401
SinGooCMS.Utility.Extension.ImageExtension.RePic
static Image RePic(this Image mybm)
反色处理
Definition: ImageExtension.cs:72
SinGooCMS.Utility.Extension.ImageExtension.LeftRightRev
static Image LeftRightRev(this Image mybm)
左右翻转
Definition: ImageExtension.cs:270
SinGooCMS.Utility.ThumbnailCutMode
ThumbnailCutMode
缩略图图像裁剪模式
Definition: ThumbnailCutMode.cs:6
SinGooCMS.Utility.Extension.ImageExtension.ColorFilter
static Image ColorFilter(this Image mybm)
滤色处理
Definition: ImageExtension.cs:158
SinGooCMS.Utility.Extension.ImageExtension.Compress
static Image Compress(this Image bmp, int newWidth, int newHeight)
指定宽高压缩图片
Definition: ImageExtension.cs:426
SinGooCMS.Utility.Extension.ImageExtension.CompressRate
static Image CompressRate(this Image bmp, float rate=0.6f)
等比压缩
Definition: ImageExtension.cs:387
SinGooCMS.Utility.Extension.ImageExtension.ToBase64
static string ToBase64(this Image image)
Image转成base64字符串
Definition: ImageExtension.cs:22
SinGooCMS.Utility.Extension.ImageExtension.ToBWPic
static Image ToBWPic(this Image mybm)
转换为黑白图片
Definition: ImageExtension.cs:185


SinGooCMS.Utility: SinGooCMS.Utility/Media/ImageUtils.cs 源文件

  • 文件列表
  • SinGooCMS.Utility
  • Media
ImageUtils.cs
浏览该文件的文档.
1 using System;
2 using System.Drawing;
3 using System.Drawing.Drawing2D;
4 using System.Drawing.Imaging;
5 using System.IO;
6 using System.Linq;
7 using SinGooCMS.Utility.Extension;
8
9 namespace SinGooCMS.Utility
10 {
14 public sealed class ImageUtils
15 {
16 #region 图片文件转Image、Bitmap
17
23 public static Image ReadFileToImage(string filePath) =>
24 new Bitmap(filePath);
25
31 public static Bitmap ReadFileBitmap(string filePath) =>
32 new Bitmap(filePath);
33
34 #endregion
35
36 #region base64和图片互转
37
43 public static Image Base64StrToImage(string base64String)
44 {
45 byte[] imageBytes = Convert.FromBase64String(base64String);
46 using (MemoryStream ms = new MemoryStream(imageBytes, 0, imageBytes.Length))
47 {
48 ms.Write(imageBytes, 0, imageBytes.Length);
49 return Image.FromStream(ms, true);
50 }
51 }
52
57 public static string ImageToBase64(string fileFullName)
58 {
59 return ReadFileToImage(fileFullName).ToBase64();
60 }
61
62 #endregion
63
64 #region 生成缩略图
65
74 public static void MakeThumbnail(string originalFileName, int width, int height, string thumbnailFileName = "", ThumbnailCutMode mode = ThumbnailCutMode.Cut)
75 {
76 Image originalImage = Image.FromFile(originalFileName);
77
78 string ext = Path.GetExtension(originalFileName);
79 if (thumbnailFileName == "")
80 thumbnailFileName = originalFileName.Replace(ext, "_thumb" + ext); //没有指定缩略图文件名，原文件名后面跟上_thumb
81
82 originalImage.ThumbnailImage(width, height, mode).Save(thumbnailFileName);
83 }
84
85 #endregion
86
87 #region 生成水印图
88
98 public static string AddImageWatermark(string originalImagePath, string watermarkImage, WatermarkPosition watermarkPosition = WatermarkPosition.MiddleCenter, float alpha = 0.5f, string watermarkFilePath = "") =>
99 AddWatermark(originalImagePath, "图片水印", watermarkImage, string.Empty, 0, string.Empty, string.Empty, watermarkPosition, alpha, watermarkFilePath);
100
112 public static string AddTextWatermark(string originalImagePath, string watermarkText, string fontColor = "#ff0000", string fontFamily = "黑体", WatermarkPosition watermarkPosition = WatermarkPosition.MiddleCenter, float alpha = 0.2f, string watermarkFilePath = "")
113 {
114 //文字大小 按原图的3/10
115 var img = Image.FromFile(originalImagePath);
116 if (img != null)
117 {
118 int fontSize = ((img.Width / watermarkText.Length * 1.0) * 0.3).ToInt();
119 return AddWatermark(originalImagePath, "文字水印", string.Empty, watermarkText, fontSize, fontColor, fontFamily, watermarkPosition, alpha, watermarkFilePath);
120 }
121
122 return string.Empty;
123 }
124
137 public static string AddTextWatermark(string originalImagePath, string watermarkText, int fontSize, string fontColor, string fontFamily, WatermarkPosition watermarkPosition = WatermarkPosition.MiddleCenter, float alpha = 0.5f, string watermarkFilePath = "") =>
138 AddWatermark(originalImagePath, "文字水印", string.Empty, watermarkText, fontSize, fontColor, fontFamily, watermarkPosition, alpha, watermarkFilePath);
139
154 public static string AddWatermark(string originalImagePath, string watermarkType, string watermarkImage
155 , string watermarkText, int fontSize, string fontColor, string fontFamily, WatermarkPosition watermarkPosition, float alpha, string watermarkFilePath = "")
156 {
157 Image img = Image.FromFile(originalImagePath);
158 // 封装 GDI+ 位图，此位图由图形图像及其属性的像素数据组成。
159 Bitmap bmPhoto = new Bitmap(img.Width, img.Height, PixelFormat.Format32bppRgb);
160 // 设定分辨率
161 bmPhoto.SetResolution(72, 72);
162 System.Drawing.Graphics g = Graphics.FromImage(bmPhoto);
163 //设置高质量插值法
164 g.InterpolationMode = InterpolationMode.High;
165 //消除锯齿
166 g.SmoothingMode = SmoothingMode.AntiAlias;
167 //g.SmoothingMode = SmoothingMode.HighQuality;
168 g.DrawImage(img, new Rectangle(0, 0, img.Width, img.Height), 0, 0, img.Width, img.Height, GraphicsUnit.Pixel);
169
170 //文件扩展名
171 string strExt = Path.GetExtension(originalImagePath);
172 //生成的水印图文件名
173 if (watermarkFilePath.IsNullOrEmpty())
174 watermarkFilePath = originalImagePath.Replace(strExt, "_watermark" + strExt);
175
176 ImageAttributes imageAttributes = new ImageAttributes();
177 ColorMap colorMap = new ColorMap();
178 colorMap.OldColor = Color.FromArgb(255, 0, 255, 0);
179 colorMap.NewColor = Color.FromArgb(0, 0, 0, 0);
180 ColorMap[] remapTable = { colorMap };
181 imageAttributes.SetRemapTable(remapTable, ColorAdjustType.Bitmap);
182
183 float[][] colorMatrixElements = {
184 new float[] {1.0f, 0.0f, 0.0f, 0.0f, 0.0f},
185 new float[] {0.0f, 1.0f, 0.0f, 0.0f, 0.0f},
186 new float[] {0.0f, 0.0f, 1.0f, 0.0f, 0.0f},
187 new float[] {0.0f, 0.0f, 0.0f, alpha, 0.0f}, //水印透明度
188 new float[] {0.0f, 0.0f, 0.0f, 0.0f, 1.0f}
189 };
190 ColorMatrix colorMatrix = new ColorMatrix(colorMatrixElements);
191 imageAttributes.SetColorMatrix(colorMatrix, ColorMatrixFlag.Default, ColorAdjustType.Bitmap);
192
193 //水印所在位置
194 int xpos = 0;
195 int ypos = 0;
196
197 int intWatermarkWidth = 0;
198 int intWatermarkHeight = 0;
199
200 Image watermark = null;
201 if (watermarkType.Equals("图片水印") && File.Exists(watermarkImage))
202 {
203 //加载水印图片
204 watermark = new Bitmap(watermarkImage);
205 intWatermarkWidth = watermark.Width;
206 intWatermarkHeight = watermark.Height;
207 }
208 else if (watermarkType.Equals("文字水印") && watermarkText.Trim().Length > 0)
209 {
210 SizeF size = g.MeasureString(watermarkText, new Font(new FontFamily(fontFamily), fontSize));
211 intWatermarkWidth = (int)size.Width;
212 intWatermarkHeight = (int)size.Height;
213 }
214
215 switch (watermarkPosition)
216 {
217 case WatermarkPosition.TopLeft:
218 xpos = (int)(img.Width * (float).01);
219 ypos = (int)(img.Height * (float).01);
220 break;
221 case WatermarkPosition.TopCenter:
222 xpos = (int)((img.Width * (float).50) - (intWatermarkWidth / 2));
223 ypos = (int)(img.Height * (float).01);
224 break;
225 case WatermarkPosition.TopRight:
226 xpos = (int)((img.Width * (float).99) - (intWatermarkWidth));
227 ypos = (int)(img.Height * (float).01);
228 break;
229 case WatermarkPosition.MiddleLeft:
230 xpos = (int)(img.Width * (float).01);
231 ypos = (int)((img.Height * (float).50) - (intWatermarkHeight / 2));
232 break;
233 case WatermarkPosition.MiddleCenter:
234 xpos = (int)((img.Width * (float).50) - (intWatermarkWidth / 2));
235 ypos = (int)((img.Height * (float).50) - (intWatermarkHeight / 2));
236 break;
237 case WatermarkPosition.MiddleRight:
238 xpos = (int)((img.Width * (float).99) - (intWatermarkWidth));
239 ypos = (int)((img.Height * (float).50) - (intWatermarkHeight / 2));
240 break;
241 case WatermarkPosition.BottomLeft:
242 xpos = (int)(img.Width * (float).01);
243 ypos = (int)((img.Height * (float).99) - intWatermarkHeight);
244 break;
245 case WatermarkPosition.BottomCenter:
246 xpos = (int)((img.Width * (float).50) - (intWatermarkWidth / 2));
247 ypos = (int)((img.Height * (float).99) - intWatermarkHeight);
248 break;
249 case WatermarkPosition.BottomRight:
250 xpos = (int)((img.Width * (float).99) - (intWatermarkWidth));
251 ypos = (int)((img.Height * (float).99) - intWatermarkHeight);
252 break;
253 }
254
255 if (watermark != null) //在原图上画图片水印
256 g.DrawImage(watermark, new Rectangle(xpos, ypos, intWatermarkWidth, intWatermarkHeight), 0, 0, intWatermarkWidth, intWatermarkHeight, GraphicsUnit.Pixel, imageAttributes);
257 else
258 {
259 //在原图上画文本水印
260 Font font = new Font(fontFamily, fontSize); //文字字体
261 Color fColor = ColorTranslator.FromHtml(fontColor);
262 Color txtColor = Color.FromArgb(Convert.ToInt32(alpha * 255), fColor);//文字颜色
263 SolidBrush brush = new SolidBrush(txtColor);
264 g.DrawString(watermarkText, font, brush, xpos, ypos);
265 }
266
267 ImageCodecInfo[] codecs = ImageCodecInfo.GetImageEncoders();
268 ImageCodecInfo ici = null;
269 foreach (ImageCodecInfo codec in codecs)
270 {
271 if (codec.MimeType.IndexOf("jpeg") > -1)
272 {
273 ici = codec;
274 }
275 }
276 EncoderParameters encoderParams = new EncoderParameters();
277 long[] qualityParam = new long[1];
278 qualityParam[0] = 80; //图片质量
279
280 EncoderParameter encoderParam = new EncoderParameter(Encoder.Quality, qualityParam);
281 encoderParams.Param[0] = encoderParam;
282
283 if (ici != null)
284 {
285 bmPhoto.Save(watermarkFilePath, ici, encoderParams);
286 }
287 else
288 {
289 bmPhoto.Save(watermarkFilePath);
290 }
291
292 g.Dispose();
293 img.Dispose();
294 if (watermark != null)
295 watermark.Dispose();
296 imageAttributes.Dispose();
297
298 return watermarkFilePath;
299 }
300
301 #endregion
302 }
303 }
SinGooCMS.Utility.ImageUtils.AddWatermark
static string AddWatermark(string originalImagePath, string watermarkType, string watermarkImage, string watermarkText, int fontSize, string fontColor, string fontFamily, WatermarkPosition watermarkPosition, float alpha, string watermarkFilePath="")
生成水印图
Definition: ImageUtils.cs:154
SinGooCMS.Utility.ImageUtils
图片处理
Definition: ImageUtils.cs:14
SinGooCMS.Utility
Definition: Accessor.cs:6
System
SinGooCMS.Utility.Extension
Definition: AssemblyExtensions.cs:8
SinGooCMS.Utility.ImageUtils.AddTextWatermark
static string AddTextWatermark(string originalImagePath, string watermarkText, string fontColor="#ff0000", string fontFamily="黑体", WatermarkPosition watermarkPosition=WatermarkPosition.MiddleCenter, float alpha=0.2f, string watermarkFilePath="")
生成文字水印
Definition: ImageUtils.cs:112
SinGooCMS.Utility.WatermarkPosition
WatermarkPosition
水印位置
Definition: WatermarkPosition.cs:6
SinGooCMS.Utility.ImageUtils.MakeThumbnail
static void MakeThumbnail(string originalFileName, int width, int height, string thumbnailFileName="", ThumbnailCutMode mode=ThumbnailCutMode.Cut)
生成缩略图
Definition: ImageUtils.cs:74
SinGooCMS.Utility.ImageUtils.ImageToBase64
static string ImageToBase64(string fileFullName)
Image转成base64字符串
Definition: ImageUtils.cs:57
SinGooCMS
SinGooCMS.Utility.ImageUtils.Base64StrToImage
static Image Base64StrToImage(string base64String)
将Base64字符串转换为图片
Definition: ImageUtils.cs:43
SinGooCMS.Utility.ThumbnailCutMode
ThumbnailCutMode
缩略图图像裁剪模式
Definition: ThumbnailCutMode.cs:6


SinGooCMS.Utility: SinGooCMS.Utility/IO/JsonFileUtils.cs 源文件

  • 文件列表
  • SinGooCMS.Utility
  • IO
JsonFileUtils.cs
浏览该文件的文档.
1 using SinGooCMS.Utility.Extension;
2 using System;
3 using System.Collections.Generic;
4 using System.IO;
5 using System.Text;
6
7 namespace SinGooCMS.Utility
8 {
12 public class JsonFileUtils
13 {
14 #region Read
15
22 public static T Read<T>(string filePath) where T : class, new()
23 {
24 if (File.Exists(filePath))
25 {
26 try
27 {
28 string str = File.ReadAllText(filePath);
29 if (!string.IsNullOrEmpty(str))
30 return Newtonsoft.Json.JsonConvert.DeserializeObject<T>(str);
31 }
32 catch
33 {
34 return default(T);
35 }
36 }
37
38 return default(T);
39 }
40
47 public static List<T> ReadList<T>(string filePath) where T : class, new()
48 {
49 if (File.Exists(filePath))
50 {
51 try
52 {
53 string str = File.ReadAllText(filePath);
54 if (!string.IsNullOrEmpty(str))
55 return Newtonsoft.Json.JsonConvert.DeserializeObject<List<T>>(str);
56 }
57 catch
58 {
59 return default(List<T>);
60 }
61 }
62
63 return default(List<T>);
64 }
65
66 #endregion
67
68 #region Save
69
70 static readonly object locker = new object();
77 public static void Save<T>(T configModel, string filePath)
78 {
79 //线程同步，同时仅一个线程可访问资源
80 lock (locker)
81 {
82 File.WriteAllText(filePath, configModel.ToJson());
83 }
84 }
85
92 public static void Save<T>(List<T> lst, string filePath)
93 {
94 //线程同步，同时仅一个线程可访问资源
95 lock (locker)
96 {
97 File.WriteAllText(filePath, lst.ToJson());
98 }
99 }
100
101 #endregion
102 }
103 }
SinGooCMS.Utility
Definition: Accessor.cs:6
System
SinGooCMS.Utility.Extension
Definition: AssemblyExtensions.cs:8
SinGooCMS.Utility.JsonFileUtils
JSON文件工具
Definition: JsonFileUtils.cs:12
SinGooCMS


SinGooCMS.Utility: SinGooCMS.Utility/Extension/JsonserializeExtension.cs 源文件

  • 文件列表
  • SinGooCMS.Utility
  • Extension
JsonserializeExtension.cs
浏览该文件的文档.
1 using System.Data;
2 using Newtonsoft.Json;
3 using Newtonsoft.Json.Converters;
4
5 namespace SinGooCMS.Utility.Extension
6 {
10 public static class JsonserializeExtension
11 {
12 #region 序列化
13
20 public static string ToJson<T>(this T t)
21 {
22 if (t == null)
23 return "{}";
24
25 return JsonConvert.SerializeObject(t, new IsoDateTimeConverter
26 {
27 DateTimeFormat = "yyyy-MM-dd HH:mm:ss"
28 });
29 }
35 public static string ToJson(this DataSet ds)
36 {
37 if (ds == null || (ds != null && ds.Tables.Count == 0))
38 return "{}";
39
40 return JsonConvert.SerializeObject(ds, new IsoDateTimeConverter
41 {
42 DateTimeFormat = "yyyy-MM-dd HH:mm:ss"
43 }, new DataSetConverter());
44 }
50 public static string ToJson(this DataTable dt)
51 {
52 if (dt == null || (dt != null && dt.Rows.Count == 0))
53 return "{}";
54
55 return JsonConvert.SerializeObject(dt, new IsoDateTimeConverter
56 {
57 DateTimeFormat = "yyyy-MM-dd HH:mm:ss"
58 }, new DataTableConverter());
59 }
60 #endregion
61
62 #region 反序列化
63 public static T JsonToObject<T>(this string strJson) =>
70 JsonConvert.DeserializeObject<T>(strJson);
71
84 public static T JsonToAnonymousObject<T>(this string strJson, T obj) =>
85 JsonConvert.DeserializeAnonymousType(strJson, obj);
86
87 #endregion
88 }
89 }
System
SinGooCMS.Utility.Extension.JsonserializeExtension
json扩展
Definition: JsonserializeExtension.cs:10
SinGooCMS
SinGooCMS.Utility.Extension.JsonserializeExtension.ToJson
static string ToJson(this DataSet ds)
序列化
Definition: JsonserializeExtension.cs:35
SinGooCMS.Utility.Extension.JsonserializeExtension.ToJson
static string ToJson(this DataTable dt)
序列化
Definition: JsonserializeExtension.cs:50


SinGooCMS.Utility: SinGooCMS.Utility/Reflection/LibInvoker.cs 源文件

  • 文件列表
  • SinGooCMS.Utility
  • Reflection
LibInvoker.cs
浏览该文件的文档.
1 using System;
2 using System.Collections.Generic;
3 using System.Reflection;
4 using System.Runtime.InteropServices;
5 using System.Text;
6
7 namespace SinGooCMS.Utility
8 {
12 public class LibInvoker
13 {
14 [DllImport("kernel32.dll")]
15 private extern static IntPtr LoadLibrary(string path);
16
17 [DllImport("kernel32.dll")]
18 private extern static IntPtr GetProcAddress(IntPtr lib, string funcName);
19
20 [DllImport("kernel32.dll")]
21 private extern static bool FreeLibrary(IntPtr lib);
22
23 private IntPtr hLib;
28 public LibInvoker(string DLLPath)
29 {
30 hLib = LoadLibrary(DLLPath);
31 }
32
36 ~LibInvoker()
37 {
38 FreeLibrary(hLib);
39 }
40
47 public Delegate Invoke(string APIName, Type t)
48 {
49 IntPtr api = GetProcAddress(hLib, APIName);
50 return (Delegate)Marshal.GetDelegateForFunctionPointer(api, t);
51 }
52
62 public static Object Invoke(string DLLPath, string dllName, string className, string methodName, params object[] methodParam)
63 {
64 string specifyName = dllName.Replace("dll", className);
65 AppDomain newDomain = AppDomain.CreateDomain(specifyName);
66 try
67 {
68 Assembly assem = Assembly.LoadFrom(DLLPath);
69
70 Object o = assem.CreateInstance(specifyName, false,
71 BindingFlags.ExactBinding,
72 null, new Object[] { }, null, null);
73
74 MethodInfo m = assem.GetType(specifyName).GetMethod(methodName);
75 Object ret = m.Invoke(o, methodParam);
76 return ret;
77 }
78 catch (Exception ex)
79 {
80 throw ex;
81 }
82 finally
83 {
84 AppDomain.Unload(newDomain);
85 }
86 }
87 }
88 }
SinGooCMS.Utility.LibInvoker
非托管方法调用
Definition: LibInvoker.cs:12
System
SinGooCMS.Utility.LibInvoker.hLib
IntPtr hLib
Definition: LibInvoker.cs:23
SinGooCMS.Utility.LibInvoker.Invoke
Delegate Invoke(string APIName, Type t)
利用LoadLibrary方式，动态显示调用非托管DLL函数。
Definition: LibInvoker.cs:47
SinGooCMS
SinGooCMS.Utility.LibInvoker.LibInvoker
LibInvoker(string DLLPath)
构造方法
Definition: LibInvoker.cs:28
SinGooCMS.Utility.LibInvoker.~LibInvoker
~LibInvoker()
释放
Definition: LibInvoker.cs:36
SinGooCMS.Utility.LibInvoker.Invoke
static Object Invoke(string DLLPath, string dllName, string className, string methodName, params object[] methodParam)
利用反射技术，动态显示调用托管DLL函数。
Definition: LibInvoker.cs:62


SinGooCMS.Utility: SinGooCMS.Utility/Extension/LinqExtension.cs 源文件

  • 文件列表
  • SinGooCMS.Utility
  • Extension
LinqExtension.cs
浏览该文件的文档.
1 using System;
2 using System.Linq;
3 using System.Linq.Expressions;
4 using System.Reflection;
5 using System.Collections.Generic;
6
7 namespace SinGooCMS.Utility.Extension
8 {
12 public static class LinqExtension
13 {
14 #region order by 字符串转 linq
15
23 public static IEnumerable<T> OrderByBatch<T>(this IEnumerable<T> query, string orderBy)
24 {
25 var index = 0;
26 var arr = orderBy.Split(',');
27 foreach (var item in arr)
28 {
29 var m = index++ > 0 ? "ThenBy" : "OrderBy";
30 if (item.ToLower().Contains("desc"))
31 {
32 m += "Descending";
33 orderBy = item.Replace("desc", "").Replace("DESC", "").Replace("Desc", "");
34 }
35 else
36 {
37 orderBy = item.Replace("asc", "").Replace("ASC", "").Replace("Asc", "");
38 }
39 orderBy = orderBy.Trim();
40
41 var propInfo = GetPropertyInfo(typeof(T), orderBy);
42 var expr = GetOrderExpression(typeof(T), propInfo);
43 var method = typeof(Enumerable).GetMethods().FirstOrDefault(mt => mt.Name == m && mt.GetParameters().Length == 2);
44 var genericMethod = method.MakeGenericMethod(typeof(T), propInfo.PropertyType);
45 query = (IEnumerable<T>)genericMethod.Invoke(null, new object[] { query, expr.Compile() });
46 }
47 return query;
48 }
49
57 public static IQueryable<T> OrderByBatch<T>(this IQueryable<T> query, string orderBy)
58 {
59 var index = 0;
60 var arr = orderBy.Split(',');
61 foreach (var item in arr)
62 {
63 var m = index++ > 0 ? "ThenBy" : "OrderBy";
64 if (item.ToLower().Contains("desc"))
65 {
66 m += "Descending";
67 orderBy = item.Replace("desc", "").Replace("DESC", "").Replace("Desc", "");
68 }
69 else
70 {
71 orderBy = item.Replace("asc", "").Replace("ASC", "").Replace("Asc", "");
72 }
73 orderBy = orderBy.Trim();
74
75 var propInfo = GetPropertyInfo(typeof(T), orderBy);
76 var expr = GetOrderExpression(typeof(T), propInfo);
77 var method = typeof(Queryable).GetMethods().FirstOrDefault(mt => mt.Name == m && mt.GetParameters().Length == 2);
78 var genericMethod = method.MakeGenericMethod(typeof(T), propInfo.PropertyType);
79 query = (IQueryable<T>)genericMethod.Invoke(null, new object[] { query, expr });
80 }
81 return query;
82 }
83
84 private static PropertyInfo GetPropertyInfo(Type objType, string name)
85 {
86 var properties = objType.GetProperties();
87 var matchedProperty = properties.FirstOrDefault(p => p.Name == name);
88 if (matchedProperty == null)
89 {
90 throw new ArgumentException("name");
91 }
92
93 return matchedProperty;
94 }
95 private static LambdaExpression GetOrderExpression(Type objType, PropertyInfo pi)
96 {
97 var paramExpr = Expression.Parameter(objType);
98 var propAccess = Expression.PropertyOrField(paramExpr, pi.Name);
99 var expr = Expression.Lambda(propAccess, paramExpr);
100 return expr;
101 }
102
103 #endregion
104 }
105 }
SinGooCMS.Utility.Extension.LinqExtension.GetPropertyInfo
static PropertyInfo GetPropertyInfo(Type objType, string name)
Definition: LinqExtension.cs:84
SinGooCMS.Utility.Extension.LinqExtension.GetOrderExpression
static LambdaExpression GetOrderExpression(Type objType, PropertyInfo pi)
Definition: LinqExtension.cs:95
System
SinGooCMS.Utility.Extension.LinqExtension
linq扩展方法
Definition: LinqExtension.cs:12
SinGooCMS


SinGooCMS.Utility: SinGooCMS.Utility/Net/MailUtils.cs 源文件

  • 文件列表
  • SinGooCMS.Utility
  • Net
MailUtils.cs
浏览该文件的文档.
1 using System;
2 using MimeKit;
3 using MailKit.Net.Smtp;
4 using MimeKit.Text;
5 using System.Threading.Tasks;
6 using SinGooCMS.Utility.Extension;
7
8 namespace SinGooCMS.Utility
9 {
27 public class MailUtils
28 {
29 /*
30 * MailKit 是一款免费开源的.net邮件发送组件，支持跨平台，发送邮件主要使用这个组件
31 * git：https://github.com/jstedfast/MailKit
32 */
33
34 private MailConfig Config { get; set; }
35
41 public static MailUtils Create(MailConfig mailConfig)
42 {
43 return new MailUtils
44 {
45 Config = mailConfig
46 };
47 }
48
49 #region 发送邮件
50
58 public (bool isSuccess, string errMsg) SendEmail(string rctMail, string subject, string body)
59 {
60 try
61 {
62 if (rctMail.Trim().Length == 0)
63 return (false, "没有找到收件箱地址");
64
65 #region 发送邮件
66
67 var message = new MimeMessage();
68 var addrFrom = MailboxAddress.Parse(Config.ServMailAccount);
69 if (!string.IsNullOrEmpty(Config.FromDisplayName))
70 addrFrom = new MailboxAddress(Config.FromDisplayName, Config.ServMailAccount);
71 message.From.Add(addrFrom);
72
73 foreach (string item in rctMail.Split(','))
74 {
75 if (!string.IsNullOrEmpty(item) && item.IsEmail())
76 {
77 message.To.Add(MailboxAddress.Parse(item));
78 }
79 }
80 message.Subject = subject;
81 message.Body = new TextPart(TextFormat.Html)
82 {
83 Text = body
84 };
85
86 using (var client = new SmtpClient())
87 {
88 client.Connect(Config.ServMailSMTP, Config.ServMailPort, Config.ServMailIsSSL);
89
90 // Note: only needed if the SMTP server requires authentication
91 client.Authenticate(Config.ServMailUserName, Config.ServMailUserPwd);
92
93 client.Send(message);
94 client.Disconnect(true);
95
96 return (true, "");
97 }
98
99 #endregion
100 }
101 catch (Exception ex)
102 {
103 return (false, ex.Message);
104 }
105 }
106
114 public async Task<(bool isSuccess, string errMsg)> SendEmailAsync(string rctMail, string subject, string body)
115 {
116 try
117 {
118 if (rctMail.Trim().Length == 0)
119 return (false, "没有找到收件箱地址");
120
121 #region 发送邮件
122
123 var message = new MimeMessage();
124 var addrFrom = MailboxAddress.Parse(Config.ServMailAccount);
125 if (!string.IsNullOrEmpty(Config.FromDisplayName))
126 addrFrom = new MailboxAddress(Config.FromDisplayName, Config.ServMailAccount);
127 message.From.Add(addrFrom);
128
129 foreach (string item in rctMail.Split(','))
130 {
131 if (!string.IsNullOrEmpty(item) && item.IsEmail())
132 {
133 message.To.Add(MailboxAddress.Parse(item));
134 }
135 }
136 message.Subject = subject;
137 message.Body = new TextPart(TextFormat.Html)
138 {
139 Text = body
140 };
141
142 using (var client = new SmtpClient())
143 {
144 await client.ConnectAsync(Config.ServMailSMTP, Config.ServMailPort, Config.ServMailIsSSL);
145
146 // Note: only needed if the SMTP server requires authentication
147 await client.AuthenticateAsync(Config.ServMailUserName, Config.ServMailUserPwd);
148
149 await client.SendAsync(message);
150 await client.DisconnectAsync(true);
151
152 return (true, "");
153 }
154
155 #endregion
156 }
157 catch (Exception ex)
158 {
159 return (false, ex.Message);
160 }
161 }
162
163 #endregion
164 }
165
169 public class MailConfig
170 {
174 public string ServMailSMTP { get; set; }
178 public int ServMailPort { get; set; }
182 public string ServMailAccount { get; set; }
186 public string ServMailUserName { get; set; }
190 public string ServMailUserPwd { get; set; }
194 public string FromDisplayName { get; set; }
198 public bool ServMailIsSSL { get; set; }
199 }
200 }
SinGooCMS.Utility.MailUtils.SendEmail
bool string errMsg SendEmail(string rctMail, string subject, string body)
Definition: MailUtils.cs:58
SinGooCMS.Utility.MailUtils
Definition: MailUtils.cs:27
SinGooCMS.Utility
Definition: Accessor.cs:6
System
SinGooCMS.Utility.MailUtils.Create
static MailUtils Create(MailConfig mailConfig)
创建邮件客户端
Definition: MailUtils.cs:41
SinGooCMS.Utility.Extension
Definition: AssemblyExtensions.cs:8
MimeKit
SinGooCMS.Utility.MailUtils.SendEmailAsync
async Task<(bool isSuccess, string errMsg)> SendEmailAsync(string rctMail, string subject, string body)
使用SMTP协议，异步发送邮件
Definition: MailUtils.cs:114
SinGooCMS
SinGooCMS.Utility.MailConfig
邮件服务配置
Definition: MailUtils.cs:169


SinGooCMS.Utility: SinGooCMS.Utility/Data/NPOIUtils.cs 源文件

  • 文件列表
  • SinGooCMS.Utility
  • Data
NPOIUtils.cs
浏览该文件的文档.
1 using System;
2 using System.Collections.Generic;
3 using System.Data;
4 using System.IO;
5 using System.Linq;
6 using System.Text;
7 using System.Threading.Tasks;
8 using NPOI.HSSF.UserModel;
9 using NPOI.SS.UserModel;
10 using NPOI.SS.Util;
11 using NPOI.XSSF.UserModel;
12 using SinGooCMS.Utility.Extension;
13
14 namespace SinGooCMS.Utility
15 {
20 public class NPOIUtils
21 {
22 #region Read
23
31 public static object ReadCell(string excelFileFullPath, string sheetName = "", string addr = "A1")
32 {
33 using (FileStream stream = new FileStream(excelFileFullPath, FileMode.Open, FileAccess.Read))
34 {
35 IWorkbook workbook = WorkbookFactory.Create(stream);
36 ISheet sheet = !string.IsNullOrEmpty(sheetName)
37 ? workbook.GetSheet(sheetName)
38 : workbook.GetSheetAt(0);
39
40 var cellAddr = new CellAddress(addr);
41 var row = sheet.GetRow(cellAddr.Row);
42
43 if (row != null)
44 {
45 var cell = row.GetCell(cellAddr.Column);
46 return cell == null ? null : GetCellValue(cell);
47 }
48
49 return null;
50 }
51 }
52
61 public static object ReadCell(string excelFileFullPath, string sheetName = "", int rowIndex = 1, int colIndex = 1)
62 {
63 using (FileStream stream = new FileStream(excelFileFullPath, FileMode.Open, FileAccess.Read))
64 {
65 IWorkbook workbook = WorkbookFactory.Create(stream);
66 ISheet sheet = !string.IsNullOrEmpty(sheetName)
67 ? workbook.GetSheet(sheetName)
68 : workbook.GetSheetAt(0);
69
70 var row = sheet.GetRow(rowIndex);
71
72 if (row != null)
73 {
74 var cell = row.GetCell(colIndex);
75 return cell == null ? null : GetCellValue(cell);
76 }
77
78 return null;
79 }
80 }
81
87 public static DataTable Read(string excelFileFullPath)
88 {
89 var dict = Read(excelFileFullPath, true);
90 return dict != null && dict.Count > 0 ? dict.GetValue(0) : null;
91 }
92
101 public static Dictionary<string, DataTable> Read(string excelFileFullPath, bool hasHeaderTile, (int startRow, int startCol)? startPoint = null, (int endRow, int endCol)? endPoint = null)
102 {
103 var dict = new Dictionary<string, DataTable>();
104 using (FileStream stream = new FileStream(excelFileFullPath, FileMode.Open, FileAccess.Read))
105 {
106 //HSSFWorkbook hssfworkbook = new HSSFWorkbook(stream);
107 //XSSFWorkbook hssfworkbook = new XSSFWorkbook(stream);
108 IWorkbook workbook = WorkbookFactory.Create(stream);
109 for (var i = 0; i < workbook.NumberOfSheets; i++)
110 {
111 ISheet sheet = workbook.GetSheetAt(i);
112 if (sheet == null) continue;
113
114 dict.Add(sheet.SheetName, ReadSheet(sheet, hasHeaderTile, startPoint, endPoint));
115 }
116
117 return dict;
118 }
119 }
120
129 public static DataTable ReadSheet(ISheet sheet, bool hasHeaderTile, (int startRow, int startCol)? startPoint = null, (int endRow, int endCol)? endPoint = null)
130 {
131 //第一行，一般来说是标题行
132 IRow headerRow = sheet.GetRow(startPoint?.startRow ?? 0);
133 if (headerRow.Cells.Count <= 0)
134 return null;
135
136 int startCol = startPoint?.startCol ?? 0;
137 int endCol = endPoint?.endCol ?? headerRow.Cells.Count - 1;
138 if (endCol < startCol)
139 return null;
140
141 var dt = new DataTable();
142 for (var a = startCol; a <= endCol; a++)
143 {
144 //创建标题行
145 if (hasHeaderTile)
146 {
147 dt.Columns.Add(headerRow.Cells[a].StringCellValue);
148 }
149 else
150 {
151 dt.Columns.Add($"SingooCol{a}"); //自动列名
152 }
153 }
154
155 //填充数据行
156 int startRow = hasHeaderTile
157 ? startPoint?.startRow ?? 0 + 1
158 : startPoint?.startRow ?? 0;
159 int endRow = endPoint?.endRow ?? sheet.LastRowNum;
160
161 for (var b = startRow; b <= endRow; b++)
162 {
163 var row = sheet.GetRow(b);
164 if (row == null) continue;
165
166 DataRow dataRow = dt.NewRow();
167 int colIndex = 0;
168 for (var c = startCol; c <= endCol; c++)
169 {
170 var cell = row.GetCell(c);
171 if (cell == null)
172 dataRow[colIndex] = "";
173 else
174 {
175 switch (cell.CellType)
176 {
177 case CellType.Boolean:
178 dataRow[colIndex] = cell.BooleanCellValue;
179 break;
180 case CellType.Numeric:
181 if (cell.CellStyle.DataFormat != 0)
182 dataRow[colIndex] = cell.DateCellValue;
183 else
184 dataRow[colIndex] = cell.NumericCellValue;
185 break;
186 case CellType.String:
187 default:
188 dataRow[colIndex] = cell.StringCellValue;
189 break;
190 }
191 }
192
193 colIndex++;
194 }
195
196 dt.Rows.Add(dataRow);
197 }
198
199 return dt;
200 }
201
209 public static DataTable ReadSheet(string excelFileFullPath, bool hasHeaderTile, string addrRange)
210 {
211 using (FileStream stream = new FileStream(excelFileFullPath, FileMode.Open, FileAccess.Read))
212 {
213 IWorkbook workbook = WorkbookFactory.Create(stream);
214 ISheet sheet = workbook.GetSheetAt(0);
215 return ReadSheet(sheet, hasHeaderTile, addrRange);
216 }
217 }
218
226 public static DataTable ReadSheet(ISheet sheet, bool hasHeaderTile, string addrRange)
227 {
228 var cellRange = CellRangeAddress.ValueOf(addrRange);
229 if (cellRange == null) return null;
230
231 //第一行，一般来说是标题行
232 IRow headerRow = sheet.GetRow(0);
233 if (headerRow.Cells.Count <= 0)
234 return null;
235
236 int firstRow = cellRange.FirstRow;
237 if (hasHeaderTile)
238 firstRow += 1; //有标题的话，第一行是标题，数据行从第二行开始
239
240 var dt = new DataTable();
241 for (var a = cellRange.FirstColumn; a <= cellRange.LastColumn; a++)
242 {
243 //创建标题行
244 if (hasHeaderTile)
245 {
246 dt.Columns.Add(headerRow.Cells[a].StringCellValue);
247 }
248 else
249 {
250 dt.Columns.Add($"SingooCol{a}"); //自动列名
251 }
252 }
253
254 for (var i = firstRow; i <= cellRange.LastRow; i++)
255 {
256 var row = sheet.GetRow(i);
257 if (row == null) continue;
258
259 DataRow dataRow = dt.NewRow();
260 int colIndex = 0;
261 for (var j = cellRange.FirstColumn; j <= cellRange.LastColumn; j++)
262 {
263 var cell = row.GetCell(j);
264 if (cell == null)
265 dataRow[colIndex] = "";
266 else
267 {
268 switch (cell.CellType)
269 {
270 case CellType.Boolean:
271 dataRow[colIndex] = cell.BooleanCellValue;
272 break;
273 case CellType.Numeric:
274 if (cell.CellStyle.DataFormat != 0)
275 dataRow[colIndex] = cell.DateCellValue;
276 else
277 dataRow[colIndex] = cell.NumericCellValue;
278 break;
279 case CellType.String:
280 default:
281 dataRow[colIndex] = cell.StringCellValue;
282 break;
283 }
284 }
285
286 colIndex++;
287 }
288
289 dt.Rows.Add(dataRow);
290 }
291
292 return dt;
293 }
294
300 public static object GetCellValue(ICell cell)
301 {
302 if (cell != null)
303 {
304 switch (cell.CellType)
305 {
306 case CellType.Boolean:
307 return cell.BooleanCellValue;
308 case CellType.Numeric:
309 if (cell.CellStyle.DataFormat != 0)
310 return cell.DateCellValue;
311 else
312 return cell.NumericCellValue;
313 case CellType.String:
314 default:
315 return cell.StringCellValue;
316 }
317 }
318
319 return "";
320 }
321
322 #endregion
323
324 #region Write
325
333 public static bool Save(DataTable table, string filePath, string sheetName = "")
334 {
335 if (string.IsNullOrEmpty(sheetName))
336 sheetName = "Sheet1";
337
338 var dict = new Dictionary<string, DataTable>();
339 dict.Add(sheetName, table);
340
341 return Save(dict, filePath);
342 }
343
350 public static bool Save(Dictionary<string, DataTable> dict, string saveFilePath)
351 {
352 IWorkbook workbook = null;
353 IRow rowTitle = null;
354 IRow rowData = null;
355 ISheet sheet = null;
356 ICell cell = null;
357 DataTable dt = null;
358
359 try
360 {
361 string ext = System.IO.Path.GetExtension(saveFilePath).ToLower();
362
363 if (ext.Equals(".xlsx"))
364 workbook = new XSSFWorkbook();
365 else
366 workbook = new HSSFWorkbook();
367
368 //数据单元格样式
369 NPOI.SS.UserModel.ICellStyle style = workbook.CreateCellStyle();
370 style.BorderBottom = NPOI.SS.UserModel.BorderStyle.Thin;
371 style.BorderLeft = NPOI.SS.UserModel.BorderStyle.Thin;
372 style.BorderRight = NPOI.SS.UserModel.BorderStyle.Thin;
373 style.BorderTop = NPOI.SS.UserModel.BorderStyle.Thin;
374 style.Alignment = HorizontalAlignment.Left;
375
376 //标题样式
377 NPOI.SS.UserModel.ICellStyle styleHeader = workbook.CreateCellStyle();
378 styleHeader.CloneStyleFrom(style);//克隆公共的样式
379 styleHeader.Alignment = HorizontalAlignment.Left;//单元格靠左
380 styleHeader.VerticalAlignment = VerticalAlignment.Center;
381 IFont fontHeader = workbook.CreateFont();//新建一个字体样式对象
382 fontHeader.Color = NPOI.HSSF.Util.HSSFColor.White.Index;
383 fontHeader.IsBold = true; //设置字体加粗样式
384 styleHeader.SetFont(fontHeader);//使用SetFont方法将字体样式添加到单元格样式中
385 //styleHeader.FillForegroundColor = NPOI.HSSF.Util.HSSFColor.Yellow.Index;
386 styleHeader.FillPattern = FillPattern.SolidForeground;
387
388 styleHeader.FillForegroundColor = 0;
389 styleHeader.FillPattern = FillPattern.SolidForeground;
390 ((XSSFColor)styleHeader.FillForegroundColorColor).SetRgb(new byte[] { 80, 130, 190 });
391
392 int counter = 1;
393 string sheetName = "";
394 foreach (KeyValuePair<string, DataTable> kvp in dict)
395 {
396 dt = kvp.Value;
397 sheetName = kvp.Key;
398
399 if (sheetName.Length > 30)
400 sheetName = sheetName.Substring(0, 30);
401
402 sheet = workbook.CreateSheet(sheetName);
403 sheet.DefaultRowHeight = 20 * 20;
404
405 //设置列头
406 rowTitle = sheet.CreateRow(0);//excel第一行设为列头
407 rowTitle.Height = 16 * 20;
408 for (int i = 0; i < dt.Columns.Count; i++)
409 {
410 cell = rowTitle.CreateCell(i);
411 cell.CellStyle = styleHeader;
412 cell.SetCellValue(dt.Columns[i].ColumnName);
413 }
414
415 //设置每行每列的单元格,
416 for (int i = 0; i < dt.Rows.Count; i++)
417 {
418 rowData = sheet.CreateRow(i + 1); //excel第二行开始写入数据
419 for (int j = 0; j < dt.Columns.Count; j++)
420 {
421 cell = rowData.CreateCell(j);
422 cell.CellStyle = style;
423 cell.SetCellValue(dt.Rows[i][j].ToString());
424 }
425 }
426
427 //自动调节行宽度
428 for (int i = 0; i < dt.Columns.Count; i++)
429 {
430 sheet.AutoSizeColumn(i);
431 }
432
433 //CellRangeAddress c = CellRangeAddress.ValueOf("A1");
434 //sheet.SetAutoFilter(c);
435
436 counter++;
437 }
438
439 using (var fs = File.OpenWrite(saveFilePath))
440 {
441 workbook.Write(fs);//写入文件
442 return true;
443 }
444 }
445 catch
446 {
447 return false;
448 }
449 }
450
458 public static bool SaveWithTmpl(Dictionary<string, DataTable> dict, string tmplFilePath, string saveFilePath)
459 {
460 IWorkbook workbook = null;
461 IRow rowData = null;
462 ISheet sheet = null;
463 ICell cell = null;
464 DataTable dt = null;
465
466 try
467 {
468 if (!File.Exists(tmplFilePath))
469 throw new Exception("模板文件不存在");
470
471 workbook = WorkbookFactory.Create(tmplFilePath);
472
473 int counter = 0;
474 string sheetName = "";
475 foreach (KeyValuePair<string, DataTable> kvp in dict)
476 {
477 dt = kvp.Value;
478 sheetName = kvp.Key;
479
480 if (sheetName.Length > 30)
481 sheetName = sheetName.Substring(0, 30);
482
483 sheet = workbook.GetSheetAt(counter);
484 var headerRow = sheet.GetRow(0); //第一行是标题行
485 var colCount = headerRow.Cells.Count;
486 string titleVal = string.Empty;
487
488 //设置每行每列的单元格,
489 for (int i = 0; i < dt.Rows.Count; i++)
490 {
491 rowData = sheet.CreateRow(i + 1); //excel第二行开始写入数据
492 for (int j = 0; j < colCount; j++)
493 {
494 cell = rowData.CreateCell(j);
495
496 //标题值
497 titleVal = headerRow.Cells[j].StringCellValue; //标题行是字符串
498 if (string.IsNullOrEmpty(titleVal))
499 continue;
500
501 var dataColumn = dt.Columns[titleVal];
502 if (dataColumn == null) continue;
503
504 var colVal = dt.Rows[i][titleVal];
505 cell.SetCellValue(colVal.ToString());
506 }
507 }
508
509 counter++;
510 }
511
512 using (var fs = File.OpenWrite(saveFilePath))
513 {
514 workbook.Write(fs);//写入文件
515 return true;
516 }
517 }
518 catch (Exception ex)
519 {
520 return false;
521 }
522 }
523
524 #endregion
525 }
526 }
SinGooCMS.Utility
Definition: Accessor.cs:6
System
SinGooCMS.Utility.NPOIUtils.ReadSheet
static DataTable ReadSheet(string excelFileFullPath, bool hasHeaderTile, string addrRange)
读表单
Definition: NPOIUtils.cs:209
SinGooCMS.Utility.NPOIUtils.ReadCell
static object ReadCell(string excelFileFullPath, string sheetName="", int rowIndex=1, int colIndex=1)
读取单元格的值
Definition: NPOIUtils.cs:61
SinGooCMS.Utility.Extension
Definition: AssemblyExtensions.cs:8
SinGooCMS.Utility.NPOIUtils.GetCellValue
static object GetCellValue(ICell cell)
获取单元格的值
Definition: NPOIUtils.cs:300
SinGooCMS.Utility.NPOIUtils
NPOI工具类 来自:
Definition: NPOIUtils.cs:20
SinGooCMS.Utility.NPOIUtils.SaveWithTmpl
static bool SaveWithTmpl(Dictionary< string, DataTable > dict, string tmplFilePath, string saveFilePath)
根据模板写入excel
Definition: NPOIUtils.cs:458
SinGooCMS.Utility.NPOIUtils.Save
static bool Save(DataTable table, string filePath, string sheetName="")
保存到excel
Definition: NPOIUtils.cs:333
SinGooCMS.Utility.NPOIUtils.Read
static Dictionary< string, DataTable > Read(string excelFileFullPath, bool hasHeaderTile,(int startRow, int startCol)?startPoint=null,(int endRow, int endCol)?endPoint=null)
读所有表单
Definition: NPOIUtils.cs:101
SinGooCMS
SinGooCMS.Utility.NPOIUtils.ReadSheet
static DataTable ReadSheet(ISheet sheet, bool hasHeaderTile, string addrRange)
读表单
Definition: NPOIUtils.cs:226
SinGooCMS.Utility.NPOIUtils.Read
static DataTable Read(string excelFileFullPath)
读取第一个表单
Definition: NPOIUtils.cs:87
SinGooCMS.Utility.NPOIUtils.ReadSheet
static DataTable ReadSheet(ISheet sheet, bool hasHeaderTile,(int startRow, int startCol)?startPoint=null,(int endRow, int endCol)?endPoint=null)
读取表单
Definition: NPOIUtils.cs:129
SinGooCMS.Utility.NPOIUtils.ReadCell
static object ReadCell(string excelFileFullPath, string sheetName="", string addr="A1")
读取单元格的值
Definition: NPOIUtils.cs:31
SinGooCMS.Utility.NPOIUtils.Save
static bool Save(Dictionary< string, DataTable > dict, string saveFilePath)
保存到excel
Definition: NPOIUtils.cs:350


SinGooCMS.Utility: SinGooCMS.Utility/Net/NetWorkUtils.cs 源文件

  • 文件列表
  • SinGooCMS.Utility
  • Net
NetWorkUtils.cs
浏览该文件的文档.
1 using System;
2 using System.Collections;
3 using System.Collections.Generic;
4 using System.IO;
5 using System.Text;
6 using System.Net;
7 using System.Linq;
8 using SinGooCMS.Utility.Extension;
9 using System.Net.NetworkInformation;
10
11 namespace SinGooCMS.Utility
12 {
16 public sealed class NetWorkUtils
17 {
23 public static string GetFQDN()
24 {
25 var domainName = IPGlobalProperties.GetIPGlobalProperties().DomainName;
26 var hostName = Dns.GetHostName();
27
28 domainName = "." + domainName;
29 if (!hostName.EndsWith(domainName, StringComparison.InvariantCultureIgnoreCase))
30 {
31 hostName += domainName;
32 }
33
34 return hostName;
35 }
36
37 #region HttpGet
38
46 public static string HttpGet(string strUrl, int timeOut = 30 * 1000, string encodingType = "utf-8")
47 {
48 string reqCookie = string.Empty;
49 string resCookie = string.Empty;
50 return HttpGet(strUrl, timeOut, encodingType, ref reqCookie, ref resCookie);
51 }
52
64 public static string HttpGet(string strUrl, int timeOut, string encodingType, ref string reqCookies,
65 ref string rspCookies, bool isHttps = false, IDictionary<string, string> headers = null)
66 {
67 if (isHttps)
68 ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12; //注意这个要在.net 4.5里才有
69
70 StringBuilder dataReturnString = new StringBuilder();
71 Stream dataStream = null;
72 System.Net.HttpWebRequest req = (System.Net.HttpWebRequest)System.Net.HttpWebRequest.Create(strUrl);
73 req.Method = "GET";
74 req.Timeout = timeOut;
75 req.AllowWriteStreamBuffering = true;
76 req.AllowAutoRedirect = true;
77
78 WebHeaderCollection heads = new WebHeaderCollection();
79 if (headers != null)
80 {
81 foreach (var item in headers)
82 {
83 switch (item.Key.ToLower().Trim())
84 {
85 case "host":
86 req.Host = item.Value;
87 break;
88 case "referer":
89 req.Referer = item.Value;
90 break;
91 case "user-agent":
92 req.UserAgent = item.Value;
93 break;
94 default:
95 heads.Add(item.Key, item.Value);
96 break;
97 }
98 }
99 }
100 req.Headers = heads;
101
102 if (!req.Headers.AllKeys.Contains("Cookie") && !string.IsNullOrEmpty(reqCookies))
103 req.Headers.Set("Cookie", reqCookies);
104
105 if (!req.Headers.AllKeys.Contains("User-Agent"))
106 req.UserAgent = "Mozilla/5.0 (Windows NT 5.2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.75 Safari/537.36";
107
108 HttpWebResponse rsp = null;
109
110 try
111 {
112 rsp = (System.Net.HttpWebResponse)req.GetResponse();
113 if (rsp.StatusCode == System.Net.HttpStatusCode.OK)
114 {
115 rspCookies = rsp.Headers.Get("Set-Cookie");
116 dataStream = rsp.GetResponseStream();
117 System.Text.Encoding encode = System.Text.Encoding.GetEncoding(encodingType);
118 StreamReader readStream = new StreamReader(dataStream, encode);
119 char[] cCount = new char[500];
120 int count = readStream.Read(cCount, 0, 256);
121 while (count > 0)
122 {
123 String str = new String(cCount, 0, count);
124 dataReturnString.Append(str);
125 count = readStream.Read(cCount, 0, 256);
126 }
127
128 return dataReturnString.ToString();
129 }
130
131 return string.Empty;
132 }
133 finally
134 {
135 if (dataStream != null)
136 dataStream.Close();
137
138 if (rsp != null)
139 rsp.Close();
140 }
141 }
142 #endregion
143
144 #region HttpPost
145
152 public static string HttpPost(string strUrl, string postData)
153 {
154 return HttpPost(strUrl, postData, string.Empty, string.Empty);
155 }
156
165 public static string HttpPost(string strUrl, string postData, string host, string referer)
166 {
167 string reqCookies = string.Empty;
168 string rspCookies = string.Empty;
169 IDictionary<string, string> headers = new Dictionary<string, string>();
170 if (!host.IsNullOrEmpty())
171 headers.Add("Host", host);
172 if (!referer.IsNullOrEmpty())
173 headers.Add("Referer", referer);
174
175 return HttpPost(strUrl, postData, 30 * 1000, "utf-8", ref reqCookies, ref rspCookies, false, headers);
176 }
177
190 public static string HttpPost(string strUrl, string postData, int timeOut, string encodingType,
191 ref string reqCookies, ref string rspCookies, bool isHttps = false, IDictionary<string, string> headers = null)
192 {
193 if (isHttps)
194 ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
195
196 HttpWebRequest req = (HttpWebRequest)HttpWebRequest.Create(strUrl);
197 req.Method = "POST";
198 req.ContentType = "application/x-www-form-urlencoded";
199 //request.ContentLength = postData.Length; //可能会报错 在写入所有字节之前不能关闭流 实际传输的字节可能大于这些数据长度
200 req.Timeout = timeOut;
201 req.AllowAutoRedirect = true;
202
203 WebHeaderCollection heads = new WebHeaderCollection();
204 if (headers != null)
205 {
206 foreach (var item in headers)
207 {
208 switch (item.Key.ToLower().Trim())
209 {
210 case "host":
211 req.Host = item.Value;
212 break;
213 case "referer":
214 req.Referer = item.Value;
215 break;
216 case "user-agent":
217 req.UserAgent = item.Value;
218 break;
219 default:
220 heads.Add(item.Key, item.Value);
221 break;
222 }
223 }
224 }
225 req.Headers = heads;
226
227 if (!req.Headers.AllKeys.Contains("Cookie") && !string.IsNullOrEmpty(reqCookies))
228 req.Headers.Set("Cookie", reqCookies);
229
230 if (!req.Headers.AllKeys.Contains("User-Agent"))
231 req.UserAgent = "Mozilla/5.0 (Windows NT 5.2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.75 Safari/537.36";
232
233 StreamWriter swRequestWriter = null;
234 HttpWebResponse rsp = null;
235
236 try
237 {
238 swRequestWriter = new StreamWriter(req.GetRequestStream());
239 swRequestWriter.Write(postData);
240
241 if (swRequestWriter != null)
242 swRequestWriter.Close();
243
244 rsp = (HttpWebResponse)req.GetResponse();
245 rsp.Headers.Set("Set-Cookie", rspCookies);
246 System.Text.Encoding encode = System.Text.Encoding.GetEncoding(encodingType);
247 using (StreamReader reader = new StreamReader(rsp.GetResponseStream(), encode))
248 {
249 return reader.ReadToEnd();
250 }
251 }
252 finally
253 {
254 if (swRequestWriter != null)
255 swRequestWriter.Close();
256
257 if (rsp != null)
258 rsp.Close();
259 }
260 }
261
262 #endregion
263
264 #region 文件下载
265 public static bool Download(string originalFile, string targetDir, string targetFileName = "")
273 {
274 bool flag = false;
275 try
276 {
277 if (!Directory.Exists(targetDir))
278 Directory.CreateDirectory(targetDir);
279
280 //如果没有指定本地文件名，就用原文件名
281 if (targetFileName == "")
282 {
283 //文件路径如 http://www.abc.com/1.zip
284 targetFileName = originalFile.Substring(originalFile.LastIndexOf("/") + 1);
285 }
286
287 string targetFile = Path.Combine(targetDir + "\\" + targetFileName);
288 if (File.Exists(targetFile))
289 File.Delete(targetFile); //删除本地已存在的文件
290
291 using (FileStream fs = new FileStream(targetFile, FileMode.Create))
292 {
293 //创建请求
294 WebRequest request = WebRequest.Create(originalFile);
295 //接收响应
296 WebResponse response = request.GetResponse();
297 //输出流
298 Stream responseStream = response.GetResponseStream();
299 byte[] bufferBytes = new byte[10000];//缓冲字节数组
300 int bytesRead = -1;
301 while ((bytesRead = responseStream.Read(bufferBytes, 0, bufferBytes.Length)) > 0)
302 {
303 fs.Write(bufferBytes, 0, bytesRead);
304 }
305 if (fs.Length > 0)
306 {
307 flag = true;
308 }
309 //关闭写入
310 fs.Flush();
311 fs.Close();
312 }
313 }
314 catch (Exception ex)
315 {
316 throw ex;
317 }
318
319 return flag;
320 }
321 #endregion
322
323 #region ping工具
324
330 public static bool Ping(string hostNameOrAddr)
331 {
332 try
333 {
334 Ping ping = new Ping();
335 PingReply reply = ping.Send(hostNameOrAddr);
336 return reply.Status == IPStatus.Success;
337 }
338 catch
339 {
340 return false;
341 }
342 }
343
344 #endregion
345 }
346 }
SinGooCMS.Utility.NetWorkUtils.HttpPost
static string HttpPost(string strUrl, string postData, int timeOut, string encodingType, ref string reqCookies, ref string rspCookies, bool isHttps=false, IDictionary< string, string > headers=null)
POST请求url,并返回结果
Definition: NetWorkUtils.cs:190
SinGooCMS.Utility.NetWorkUtils.Ping
static bool Ping(string hostNameOrAddr)
是否能ping通IP
Definition: NetWorkUtils.cs:330
SinGooCMS.Utility.Extension.SequenceType.String
代表 System.String.
SinGooCMS.Utility
Definition: Accessor.cs:6
System
SinGooCMS.Utility.Extension
Definition: AssemblyExtensions.cs:8
SinGooCMS.Utility.NetWorkUtils.HttpGet
static string HttpGet(string strUrl, int timeOut=30 *1000, string encodingType="utf-8")
读取get内容
Definition: NetWorkUtils.cs:46
SinGooCMS.Utility.NetWorkUtils.HttpGet
static string HttpGet(string strUrl, int timeOut, string encodingType, ref string reqCookies, ref string rspCookies, bool isHttps=false, IDictionary< string, string > headers=null)
读取get内容
Definition: NetWorkUtils.cs:64
SinGooCMS.Utility.NetWorkUtils.HttpPost
static string HttpPost(string strUrl, string postData, string host, string referer)
post 提交
Definition: NetWorkUtils.cs:165
SinGooCMS.Utility.NetWorkUtils.HttpPost
static string HttpPost(string strUrl, string postData)
post 提交
Definition: NetWorkUtils.cs:152
SinGooCMS
SinGooCMS.Utility.NetWorkUtils
模拟 httpget 和 httppost
Definition: NetWorkUtils.cs:16
SinGooCMS.Utility.NetWorkUtils.GetFQDN
static string GetFQDN()
获取计算机全限定域名( FQDN ,Fully Qualified Domain Name)
Definition: NetWorkUtils.cs:23


SinGooCMS.Utility: SinGooCMS.Utility/Accessors/ObjectAccessor.cs 源文件

  • 文件列表
  • SinGooCMS.Utility
  • Accessors
ObjectAccessor.cs
浏览该文件的文档.
1 using System;
2 using System.Collections;
3 using System.Diagnostics;
4 using System.Reflection;
5
6 namespace SinGooCMS.Utility
7 {
11 public class ObjectAccessor : Accessor
12 {
13 private readonly Hashtable _objectGettersCache, _objectSettersCache;
14
15 [DebuggerStepThrough]
16 internal ObjectAccessor(IReflect type, bool ignoreCase, bool includeNonPublic)
17 : base(type, ignoreCase, includeNonPublic)
18 {
19 _objectGettersCache = new Hashtable(Properties.Count, Comparer);
20 _objectSettersCache = new Hashtable(Properties.Count, Comparer);
21
22 foreach (var pair in Properties)
23 {
24 var propName = pair.Key;
25 var prop = pair.Value;
26
27 if (prop.CanRead)
28 {
29 _objectGettersCache[propName] = AccessorBuilder.BuildGetter(prop, IncludesNonPublic);
30 }
31
32 if (prop.CanWrite)
33 {
34 _objectSettersCache[propName] = AccessorBuilder.BuildSetter(prop, IncludesNonPublic);
35 }
36 }
37 }
38
42 public object this[object instance, string propertyName]
43 {
44 get
45 {
46 if (_objectGettersCache[propertyName] is Func<object, object> getter)
47 {
48 return getter(instance);
49 }
50 throw new ArgumentException($"Type: `{instance.GetType().FullName}` does not have a property named: `{propertyName}` that supports reading.");
51 }
52
53 set
54 {
55 if (_objectSettersCache[propertyName] is Action<object, object> setter)
56 {
57 setter(instance, value);
58 }
59 else
60 {
61 throw new ArgumentException($"Type: `{instance.GetType().FullName}` does not have a property named: `{propertyName}` that supports writing.");
62 }
63 }
64 }
65 }
66 }
System
SinGooCMS.Utility.AccessorBuilder.BuildGetter
static Func< object, object > BuildGetter(PropertyInfo propertyInfo, bool includePrivate=false)
根据给定属性信息获取属性的读取逻辑
Definition: AccessorBuilder.cs:112
SinGooCMS.Utility.AccessorBuilder.BuildSetter
static Action< object, object > BuildSetter(PropertyInfo propertyInfo, bool includePrivate=false)
根据给定属性信息获取属性的写入逻辑
Definition: AccessorBuilder.cs:79
SinGooCMS
SinGooCMS.Utility.AccessorBuilder
提供一系列快速构建Accessor实例的方法
Definition: AccessorBuilder.cs:12
SinGooCMS.Utility.Accessor
用于构建ObjectAccessor和 GenericAccessor实例。
Definition: Accessor.cs:12
SinGooCMS.Utility.ObjectAccessor._objectSettersCache
readonly Hashtable _objectSettersCache
Definition: ObjectAccessor.cs:13
SinGooCMS.Utility.ObjectAccessor
快速访问给定类型的对象的属性值, 参照: Accessor
Definition: ObjectAccessor.cs:11


SinGooCMS.Utility: SinGooCMS.Utility/Extension/ObjectExtension.cs 源文件

  • 文件列表
  • SinGooCMS.Utility
  • Extension
ObjectExtension.cs
浏览该文件的文档.
1 using System;
2 using System.Collections.Generic;
3 using System.IO;
4 using System.Runtime.Serialization.Formatters.Binary;
5 using AutoMapper;
6
7 namespace SinGooCMS.Utility.Extension
8 {
12 public static class ObjectExtension
13 {
14 #region AutoMapper
15
24 public static TDestination MapTo<TSource, TDestination>(this TSource source, Func<TDestination, TDestination> thenDeal = null)
25 where TDestination : class
26 where TSource : class
27 {
28 if (source == null) return default(TDestination);
29
30 var config = new MapperConfiguration(cfg => cfg.CreateMap(typeof(TSource), typeof(TDestination)));
31 var mapper = config.CreateMapper();
32
33 var result = mapper.Map<TDestination>(source);
34 if (thenDeal != null)
35 result = thenDeal(result);
36
37 return result;
38 }
39
48 public static IEnumerable<TDestination> MapToList<TSource, TDestination>(this IEnumerable<TSource> source, Func<IEnumerable<TDestination>, IEnumerable<TDestination>> thenDeal = null)
49 where TDestination : class
50 where TSource : class
51 {
52 if (source == null) return default(IEnumerable<TDestination>);
53
54 Type sourceType = source.GetType().GetGenericArguments()[0]; //获取枚举的成员类型
55 var config = new MapperConfiguration(cfg => cfg.CreateMap(sourceType, typeof(TDestination)));
56 var mapper = config.CreateMapper();
57
58 var result = mapper.Map<IEnumerable<TDestination>>(source);
59 if (thenDeal != null)
60 result = thenDeal(result);
61
62 return result;
63 }
64
65 #endregion
66
73 public static T DeepClone<T>(this T obj)
74 {
75 using (MemoryStream ms = new MemoryStream())
76 {
77 BinaryFormatter bf = new BinaryFormatter();
78 bf.Serialize(ms, obj);
79 ms.Position = 0;
80 return (T)bf.Deserialize(ms);
81 }
82 }
83
90 public new static bool ReferenceEquals(this object obj, object o)
91 {
92 return object.ReferenceEquals(obj, o);
93 }
94 }
95 }
System
SinGooCMS.Utility.Extension.ObjectExtension
对象扩展
Definition: ObjectExtension.cs:12
SinGooCMS
AutoMapper
SinGooCMS.Utility.Extension.ObjectExtension.ReferenceEquals
static new bool ReferenceEquals(this object obj, object o)
严格比较两个对象是否是同一对象(判断引用)
Definition: ObjectExtension.cs:90


SinGooCMS.Utility: SinGooCMS.Utility/Result/OperationResult.cs 源文件

  • 文件列表
  • SinGooCMS.Utility
  • Result
OperationResult.cs
浏览该文件的文档.
1 using System;
2 using Newtonsoft.Json.Linq;
3
4 namespace SinGooCMS.Utility
5 {
16 public class OperationResult
17 {
18 #region 公共属性
19
23 public int ReturnStatusType { get; set; } = 0;
27 public string StatusCode { get; set; } = string.Empty;
31 public string ErrorMessage { get; set; } = string.Empty;
35 public string ErrorENMessage { get; set; } = string.Empty;
39 public DateTime TimeStamp { get; set; } = DateTime.Now;
43 public string CallbackUrl { get; set; } = string.Empty;
47 public string Data { get; set; } = string.Empty;
51 public int Timeout { get; set; } = -1; //-1表示不限制
52
53 private string _sign=string.Empty;
58 public string Sign
59 {
60 get
61 {
62 //如果没有指定签名，给个默认签名
63 string _sign = this._sign ?? string.Empty;
64 if (_sign.Trim() == "")
65 {
66 string key = "singoo" + this.TimeStamp.ToString("yyyyMMdd");
67 _sign = DEncryptUtils.DESEncrypt($"ReturnStatusType={this.ReturnStatusType}&StatusCode={this.StatusCode}&TimeStamp={this.TimeStamp}&Timeout={this.Timeout}", key);
68 }
69
70 return _sign;
71 }
72 set
73 {
74 _sign = value;
75 }
76 }
77
78 #endregion
79
80 #region 构造函数
81
85 public OperationResult() { }
93 public OperationResult(int _ReturnStatusType, string _StatusCode, string _ErrorMessage, string _ENErrorMessage = "")
94 {
95 this.ReturnStatusType = _ReturnStatusType;
96 this.StatusCode = _StatusCode;
97 this.ErrorMessage = _ErrorMessage;
98 this.ErrorENMessage = _ENErrorMessage;
99 }
100
101 #endregion
102
103 #region 快速返回结果
104
105 public static OperationResult success = new OperationResult(1, "200", "操作成功", "ok");
106 public static OperationResult Success(string errorMessage, string errorENMessage = "") => new OperationResult(1, "200", errorMessage, errorENMessage);
107
108 public static OperationResult fail = new OperationResult(0, "－1", "操作失败", "fail");
109 public static OperationResult Fail(string statusCode, string errorMessage, string errorENMessage = "") => new OperationResult(0, statusCode, errorMessage, errorENMessage);
110
111 #endregion
112
117 public override string ToString()
118 {
119 return $"{{\"ReturnStatusType\":{ReturnStatusType},\"StatusCode\":\"{StatusCode}\",\"ErrorMessage\":\"{ErrorMessage}\",\"ErrorENMessage\":\"{ErrorENMessage}\",\"TimeStamp\":\"{TimeStamp.ToString("yyyy-MM-dd HH:mm:ss")}\",\"CallbackUrl\":\"{CallbackUrl}\",\"Data\":\"{Data}\",\"Timeout\":\"{Timeout}\",\"Sign\":\"{Sign}\"}}";
120 }
121
126 public JObject ToJsonObj()
127 {
128 var json = this.ToString();
129 if (!string.IsNullOrEmpty(json))
130 return JObject.Parse(json);
131
132 return null;
133 }
134 }
135 }
SinGooCMS.Utility.OperationResult.ToString
override string ToString()
返回一个json字符串
Definition: OperationResult.cs:117
SinGooCMS.Utility.OperationResult.OperationResult
OperationResult()
无参构造方法
Definition: OperationResult.cs:85
System
SinGooCMS.Utility.DEncryptUtils.DESEncrypt
static string DESEncrypt(string strTxt, string strKey)
DES加密
Definition: DEncryptUtils.cs:25
SinGooCMS
SinGooCMS.Utility.OperationResult.ToJsonObj
JObject ToJsonObj()
返回一个json对象
Definition: OperationResult.cs:126
SinGooCMS.Utility.OperationResult
操作返回结果 "ReturnStatusType": 1, —返回状态类型 "StatusCode": "200", —错误信息代码 "ErrorMessage": "操作成功", —错误信息 "ErrorENMessage": "ok", —英文错误信息 "TimeStamp": "2020-01-06 12:13:14", —当前时间
Definition: OperationResult.cs:16
SinGooCMS.Utility.DEncryptUtils
加密解密工具
Definition: DEncryptUtils.cs:13
SinGooCMS.Utility.OperationResult.OperationResult
OperationResult(int _ReturnStatusType, string _StatusCode, string _ErrorMessage, string _ENErrorMessage="")
构造方法
Definition: OperationResult.cs:93


SinGooCMS.Utility: SinGooCMS.Utility/Pager/PagerModel.cs 源文件

  • 文件列表
  • SinGooCMS.Utility
  • Pager
PagerModel.cs
浏览该文件的文档.
1 using System;
2 using System.Collections;
3 using System.Collections.Generic;
4 using System.Text;
5
6 namespace SinGooCMS.Utility
7 {
12 public class PagerModel<T> : SinGooList<T> //List<T>
13 {
17 public T PagerData { get; set; }
18
22 public int PageIndex { get; set; } = 1;
26 public int PageSize { get; set; }
27
31 public int TotalRecord { get; set; }
35 public int TotalPage =>
36 PageSize > 0
37 ? TotalRecord % PageSize == 0 ? TotalRecord / PageSize : (1 + TotalRecord / PageSize)
38 : 0;
39
43 public int PrevPage => HasPrevPage
44 ? PageIndex - 1
45 : PageIndex;
49 public int NextPage => HasNextPage
50 ? PageIndex + 1
51 : TotalPage;
52
56 public bool HasPrevPage => PageIndex > 1;
60 public bool HasNextPage => PageIndex < TotalPage;
61
62 }
63 }
SinGooCMS.Utility.PagerModel
分页模型
Definition: PagerModel.cs:12
System
SinGooCMS
SinGooCMS.Utility.SinGooList
List扩展，实现取范围数据
Definition: SinGooList.cs:11


SinGooCMS.Utility: SinGooCMS.Utility/Pager/PagerUtils.cs 源文件

  • 文件列表
  • SinGooCMS.Utility
  • Pager
PagerUtils.cs
浏览该文件的文档.
1 using System;
2 using System.Collections.Generic;
3 using System.Text;
4
5 namespace SinGooCMS.Utility
6 {
10 public class PagerUtils
11 {
12 #region 公共属性
13
17 public int PageIndex { get; set; } = 1;
18
22 public int PageSize { get; set; } = 0;
23
27 public int TotalRecord { get; set; } = 0;
28
32 public int TotalPage { get; set; } = 1;
33
37 public int RecordBegin =>
38 ((this.PageIndex - 1) * this.PageSize) + 1;
39
43 public int RecordEnd
44 {
45 get
46 {
47 int tempRecord = this.PageIndex * this.PageSize;
48 return this.TotalRecord > tempRecord ? tempRecord : this.TotalRecord;
49 }
50 }
51
55 public int PageBegin { get; set; } = 1;
56
60 public int PageEnd { get; set; } = 0;
61
65 public string UrlPattern { get; set; } = "";
66
67 #endregion
68
75 public static PagerUtils Create(int totalRecord, int pageSize = 10)
76 {
77 var pager=new PagerUtils();
78 pager.TotalRecord = totalRecord;
79 pager.PageSize = (pageSize < 1) ? 10 : pageSize;
80 pager.Calculate();
81
82 return pager;
83 }
84
85 #region 分页方法
86
90 public void Calculate()
91 {
92 if (this.TotalRecord > 0)
93 {
94 this.TotalPage = this.TotalRecord / this.PageSize;
95 if ((this.TotalRecord % this.PageSize) > 0)
96 {
97 this.TotalPage++;
98 }
99 if (this.TotalPage == 0)
100 {
101 this.TotalPage = 1;
102 }
103
104 if (this.PageIndex < 1)
105 {
106 this.PageIndex = 1;
107 }
108 else if (this.PageIndex > this.TotalPage)
109 {
110 this.PageIndex = this.TotalPage;
111 }
112 }
113 }
119 public int[] GetPages(int count)
120 {
121 int num = this.PageIndex / count;
122 if ((this.PageIndex % count) == 0)
123 {
124 num--;
125 }
126 int num2 = (num * count) + 1;
127 int num3 = Math.Min((num * count) + count, this.TotalPage);
128 int[] numArray = new int[(num3 - num2) + 1];
129 int index = 0;
130 for (int i = num2; i <= num3; i++)
131 {
132 numArray[index] = i;
133 index++;
134 }
135
136 this.PageBegin = num2;
137 this.PageEnd = num3;
138
139 return numArray;
140 }
146 public string GetUrl(int page)
147 {
148 if (page < 1)
149 {
150 page = 1;
151 }
152 else if (page > this.TotalPage)
153 {
154 page = this.TotalPage;
155 }
156 return this.GetPageUrl(page);
157 }
163 public string GetUrl(string getType)
164 {
165 string str = string.Empty;
166 string str2 = getType.ToLower();
167 if (str2 == null)
168 {
169 return str;
170 }
171 if (!(str2 == "first"))
172 {
173 if (str2 != "next")
174 {
175 if (str2 == "prev")
176 {
177 return this.GetUrl((int)(this.PageIndex - 1));
178 }
179 if (str2 != "last")
180 {
181 return str;
182 }
183 return this.GetUrl(this.TotalRecord);
184 }
185 }
186 else
187 {
188 return this.GetUrl(1);
189 }
190 return this.GetUrl((int)(this.PageIndex + 1));
191 }
197 private string GetPageUrl(int page)
198 {
199 return this.UrlPattern.Replace("$page", page.ToString());
200 }
201
202 #endregion
203 }
204 }
SinGooCMS.Utility.PagerUtils
分页栏工具
Definition: PagerUtils.cs:10
System
SinGooCMS.Utility.PagerUtils.GetUrl
string GetUrl(int page)
获取分页地址
Definition: PagerUtils.cs:146
SinGooCMS
SinGooCMS.Utility.PagerUtils.Calculate
void Calculate()
计算分页总数等
Definition: PagerUtils.cs:90
SinGooCMS.Utility.PagerUtils.GetPageUrl
string GetPageUrl(int page)
替换$page
Definition: PagerUtils.cs:197
SinGooCMS.Utility.PagerUtils.Create
static PagerUtils Create(int totalRecord, int pageSize=10)
创建分页栏
Definition: PagerUtils.cs:75
SinGooCMS.Utility.PagerUtils.GetPages
int[] GetPages(int count)
获取下标数组
Definition: PagerUtils.cs:119
SinGooCMS.Utility.PagerUtils.GetUrl
string GetUrl(string getType)
获取分页地址
Definition: PagerUtils.cs:163


SinGooCMS.Utility: SinGooCMS.Utility/Linq/PredicateBuilder.cs 源文件

  • 文件列表
  • SinGooCMS.Utility
  • Linq
PredicateBuilder.cs
浏览该文件的文档.
1 using System;
2 using System.Collections.Generic;
3 using System.Linq;
4 using System.Linq.Expressions;
5
6 namespace SinGooCMS.Utility
7 {
11 public static class PredicateBuilder
12 {
18 public static Expression<Func<T, bool>> True<T>() { return f => true; }
19
25 public static Expression<Func<T, bool>> False<T>() { return f => false; }
26
35 public static Expression<T> Compose<T>(this Expression<T> first, Expression<T> second, Func<Expression, Expression, Expression> merge)
36 {
37 //uild parameter map (from parameters of second to parameters of first)
38 var map = first.Parameters.Select((f, i) => new { f, s = second.Parameters[i] }).ToDictionary(p => p.s, p => p.f);
39
40 //eplace parameters in the second lambda expression with parameters from the first
41 var secondBody = ParameterRebinder.ReplaceParameters(map, second.Body);
42
43 //pply composition of lambda expression bodies to parameters from the first expression
44 return Expression.Lambda<T>(merge(first.Body, secondBody), first.Parameters);
45 }
46
54 public static Expression<Func<T, bool>> And<T>(this Expression<Func<T, bool>> first, Expression<Func<T, bool>> second)
55 {
56 return first.Compose(second, Expression.And);
57 }
58
66 public static Expression<Func<T, bool>> Or<T>(this Expression<Func<T, bool>> first, Expression<Func<T, bool>> second)
67 {
68 return first.Compose(second, Expression.Or);
69 }
70 }
71
72 internal class ParameterRebinder : ExpressionVisitor
73 {
74 private readonly Dictionary<ParameterExpression, ParameterExpression> map;
75
76 public ParameterRebinder(Dictionary<ParameterExpression, ParameterExpression> map)
77 {
78 this.map = map ?? new Dictionary<ParameterExpression, ParameterExpression>();
79 }
80
81 public static Expression ReplaceParameters(Dictionary<ParameterExpression, ParameterExpression> map, Expression exp)
82 {
83 return new ParameterRebinder(map).Visit(exp);
84 }
85
86 protected override Expression VisitParameter(ParameterExpression p)
87 {
88 ParameterExpression replacement;
89 if (map.TryGetValue(p, out replacement))
90 {
91 p = replacement;
92 }
93 return base.VisitParameter(p);
94 }
95 }
96 }
System
SinGooCMS.Utility.PredicateBuilder
对 Lambda 表达式进行动态拼接的逻辑
Definition: PredicateBuilder.cs:11
SinGooCMS


SinGooCMS.Utility: SinGooCMS.Utility/System/ProcessUtils.cs 源文件

  • 文件列表
  • SinGooCMS.Utility
  • System
ProcessUtils.cs
浏览该文件的文档.
1 using System;
2 using System.Collections.Generic;
3 using System.Diagnostics;
4 using System.IO;
5 using System.Text;
6
7 namespace SinGooCMS.Utility
8 {
12 public sealed class ProcessUtils
13 {
14 #region 服务
15
20 public static void StartService(string serviceName) =>
21 ExecuteCMD(new List<string>() { $"sc start {serviceName}" });
22
27 public static void StopService(string serviceName) =>
28 ExecuteCMD(new List<string>() { $"sc stop {serviceName}" });
29
34 public static void DeleteService(string serviceName) =>
35 ExecuteCMD(new List<string>() { $"sc delete {serviceName}" });
36
37 #endregion
38
39 #region cmd命令
40
45 public static void Shutdown(int shutSecond = 60) =>
46 ExecuteCMD(new List<string>() { "shutdown -s -t " + shutSecond.ToString() });
47
51 public static void UnShutdown() =>
52 ExecuteCMD(new List<string>() { "shutdown -a " });
53
58 public static bool ExecuteCMD(IList<string> commandText)
59 {
60 string result = "";
61 string errMsg = "";
62 return ExecuteCMD(commandText, out result, out errMsg);
63 }
64
72 public static bool ExecuteCMD(IList<string> commandText, out string result, out string errMsg)
73 {
74 return Execute("cmd", null, commandText, out result, out errMsg);
75 }
76
77 #endregion
78
79 #region 执行程序
80
87 public static void Execute(string fileName, string args)
88 {
89 string result = "";
90 string errMsg = "";
91 Execute(fileName, args, null, out result, out errMsg);
92 }
93
103 public static bool Execute(string fileName, string args, IList<string> commandText, out string result, out string errMsg)
104 {
105 Process process = new Process();
106 try
107 {
108 process.StartInfo.FileName = fileName;
109
110 if (!string.IsNullOrEmpty(args))
111 process.StartInfo.Arguments = args;
112
113 process.StartInfo.UseShellExecute = false;
114 process.StartInfo.RedirectStandardInput = true;
115 process.StartInfo.RedirectStandardOutput = true;
116 process.StartInfo.RedirectStandardError = true;
117 process.StartInfo.CreateNoWindow = true;
118 process.Start();
119
120 if (commandText != null && commandText.Count > 0)
121 {
122 foreach (var item in commandText)
123 process.StandardInput.WriteLine(item); //执行的命令
124
125 process.StandardInput.WriteLine("exit");
126 }
127
128 result = process.StandardOutput.ReadToEnd(); //执行命令的返回值
129
130 while (!process.HasExited)
131 {
132 process.WaitForExit(1000);
133 }
134 errMsg = process.StandardError.ReadToEnd();
135 process.StandardError.Close();
136
137 if (string.IsNullOrEmpty(errMsg))
138 return true;
139
140 return false;
141 }
142 catch (Exception ex)
143 {
144 throw ex;
145 }
146 finally
147 {
148 process.Close();
149 process.Dispose();
150 }
151 }
152
153 #endregion
154
155 #region 关闭进程
156
161 public static void Kill(string name)
162 {
163 Process[] processes = Process.GetProcessesByName(name);
164 foreach (Process p in processes)
165 {
166 p.Kill();
167 p.Close();
168 }
169 }
173 public static void KillCurrent()
174 {
175 Process current = Process.GetCurrentProcess();
176 current.Kill();
177 }
178
179 #endregion
180 }
181 }
SinGooCMS.Utility.ProcessUtils.KillCurrent
static void KillCurrent()
停止当前进程
Definition: ProcessUtils.cs:173
SinGooCMS.Utility.ProcessUtils.Execute
static bool Execute(string fileName, string args, IList< string > commandText, out string result, out string errMsg)
执行程序
Definition: ProcessUtils.cs:103
System
SinGooCMS.Utility.ProcessUtils.Execute
static void Execute(string fileName, string args)
执行程序
Definition: ProcessUtils.cs:87
SinGooCMS.Utility.ProcessUtils
执行系统进程
Definition: ProcessUtils.cs:12
SinGooCMS.Utility.ProcessUtils.ExecuteCMD
static bool ExecuteCMD(IList< string > commandText)
执行cmd命令
Definition: ProcessUtils.cs:58
SinGooCMS.Utility.ProcessUtils.ExecuteCMD
static bool ExecuteCMD(IList< string > commandText, out string result, out string errMsg)
打开cmd执行一系列命令
Definition: ProcessUtils.cs:72
SinGooCMS
SinGooCMS.Utility.ProcessUtils.Kill
static void Kill(string name)
停止进程
Definition: ProcessUtils.cs:161


SinGooCMS.Utility: SinGooCMS.Utility/Pager/QueryExtension.cs 源文件

  • 文件列表
  • SinGooCMS.Utility
  • Pager
QueryExtension.cs
浏览该文件的文档.
1 using System;
2 using System.Collections.Generic;
3 using System.Linq;
4
5 namespace SinGooCMS.Utility
6 {
10 public static class QueryExtension
11 {
20 public static IQueryable<T> Page<T>(this IQueryable<T> query, int pageIndex, int pageSize)
21 {
22 if (pageIndex <= 0)
23 {
24 throw new ArgumentOutOfRangeException(nameof(pageIndex));
25 }
26
27 if (pageSize <= 0)
28 {
29 throw new ArgumentOutOfRangeException(nameof(pageSize));
30 }
31
32 return pageIndex == 1
33 ? query.Take(pageSize)
34 : query.Skip(pageSize * (pageIndex - 1)).Take(pageSize);
35 }
36
45 public static PagerModel<IEnumerable<T>> PageModel<T>(this IQueryable<T> query, int pageIndex, int pageSize)
46 {
47 if (pageIndex <= 0)
48 {
49 throw new ArgumentOutOfRangeException(nameof(pageIndex));
50 }
51
52 if (pageSize <= 0)
53 {
54 throw new ArgumentOutOfRangeException(nameof(pageSize));
55 }
56
57 return new PagerModel<IEnumerable<T>>()
58 {
59 PagerData = pageIndex == 1
60 ? query.Take(pageSize).ToList()
61 : query.Skip(pageSize * (pageIndex - 1)).Take(pageSize).ToList(),
62 PageIndex = pageIndex,
63 PageSize = pageSize,
64 TotalRecord = query.Count()
65 };
66
67 }
68 }
69 }
SinGooCMS.Utility.PagerModel
分页模型
Definition: PagerModel.cs:12
System
SinGooCMS
SinGooCMS.Utility.QueryExtension
查询并分页
Definition: QueryExtension.cs:10


SinGooCMS.Utility: SinGooCMS.Utility/Security/RSACryption.cs 源文件

  • 文件列表
  • SinGooCMS.Utility
  • Security
RSACryption.cs
浏览该文件的文档.
1 using System;
2 using System.Text;
3 using System.Security.Cryptography;
4
5 namespace SinGooCMS.Utility
6 {
13 public sealed class RSACryption
14 {
15 #region RSA 加密解密
16
17 #region RSA 的密钥产生
18
24 public void RSAKey(out string xmlKeys, out string xmlPublicKey)
25 {
26 System.Security.Cryptography.RSACryptoServiceProvider rsa = new RSACryptoServiceProvider();
27 xmlKeys = rsa.ToXmlString(true);
28 xmlPublicKey = rsa.ToXmlString(false);
29 }
30 #endregion
31
32 #region RSA的加密函数
33 //##############################################################################
34 //RSA 方式加密
35 //说明KEY必须是XML的行式,返回的是字符串
36 //在有一点需要说明！！该加密方式有 长度 限制的！！
37 //##############################################################################
38
45 public string RSAEncrypt(string xmlPublicKey, string m_strEncryptString)
46 {
47
48 byte[] PlainTextBArray;
49 byte[] CypherTextBArray;
50 string Result;
51 RSACryptoServiceProvider rsa = new RSACryptoServiceProvider();
52 rsa.FromXmlString(xmlPublicKey);
53 PlainTextBArray = (new UnicodeEncoding()).GetBytes(m_strEncryptString);
54 CypherTextBArray = rsa.Encrypt(PlainTextBArray, false);
55 Result = Convert.ToBase64String(CypherTextBArray);
56 return Result;
57
58 }
59
66 public string RSAEncrypt(string xmlPublicKey, byte[] EncryptString)
67 {
68
69 byte[] CypherTextBArray;
70 string Result;
71 RSACryptoServiceProvider rsa = new RSACryptoServiceProvider();
72 rsa.FromXmlString(xmlPublicKey);
73 CypherTextBArray = rsa.Encrypt(EncryptString, false);
74 Result = Convert.ToBase64String(CypherTextBArray);
75 return Result;
76
77 }
78 #endregion
79
80 #region RSA的解密函数
81
88 public string RSADecrypt(string xmlPrivateKey, string m_strDecryptString)
89 {
90 byte[] PlainTextBArray;
91 byte[] DypherTextBArray;
92 string Result;
93 System.Security.Cryptography.RSACryptoServiceProvider rsa = new RSACryptoServiceProvider();
94 rsa.FromXmlString(xmlPrivateKey);
95 PlainTextBArray = Convert.FromBase64String(m_strDecryptString);
96 DypherTextBArray = rsa.Decrypt(PlainTextBArray, false);
97 Result = (new UnicodeEncoding()).GetString(DypherTextBArray);
98 return Result;
99
100 }
101
108 public string RSADecrypt(string xmlPrivateKey, byte[] DecryptString)
109 {
110 byte[] DypherTextBArray;
111 string Result;
112 System.Security.Cryptography.RSACryptoServiceProvider rsa = new RSACryptoServiceProvider();
113 rsa.FromXmlString(xmlPrivateKey);
114 DypherTextBArray = rsa.Decrypt(DecryptString, false);
115 Result = (new UnicodeEncoding()).GetString(DypherTextBArray);
116 return Result;
117
118 }
119 #endregion
120
121 #endregion
122
123 #region RSA数字签名
124
125 #region 获取Hash描述表
126
133 public bool GetHash(string m_strSource, ref byte[] HashData)
134 {
135 //从字符串中取得Hash描述
136 byte[] Buffer;
137 System.Security.Cryptography.HashAlgorithm MD5 = System.Security.Cryptography.HashAlgorithm.Create("MD5");
138 Buffer = System.Text.Encoding.GetEncoding("GB2312").GetBytes(m_strSource);
139 HashData = MD5.ComputeHash(Buffer);
140
141 return true;
142 }
143
150 public bool GetHash(string m_strSource, ref string strHashData)
151 {
152
153 //从字符串中取得Hash描述
154 byte[] Buffer;
155 byte[] HashData;
156 System.Security.Cryptography.HashAlgorithm MD5 = System.Security.Cryptography.HashAlgorithm.Create("MD5");
157 Buffer = System.Text.Encoding.GetEncoding("GB2312").GetBytes(m_strSource);
158 HashData = MD5.ComputeHash(Buffer);
159
160 strHashData = Convert.ToBase64String(HashData);
161 return true;
162
163 }
164
171 public bool GetHash(System.IO.FileStream objFile, ref byte[] HashData)
172 {
173
174 //从文件中取得Hash描述
175 System.Security.Cryptography.HashAlgorithm MD5 = System.Security.Cryptography.HashAlgorithm.Create("MD5");
176 HashData = MD5.ComputeHash(objFile);
177 objFile.Close();
178
179 return true;
180
181 }
182
189 public bool GetHash(System.IO.FileStream objFile, ref string strHashData)
190 {
191
192 //从文件中取得Hash描述
193 byte[] HashData;
194 System.Security.Cryptography.HashAlgorithm MD5 = System.Security.Cryptography.HashAlgorithm.Create("MD5");
195 HashData = MD5.ComputeHash(objFile);
196 objFile.Close();
197
198 strHashData = Convert.ToBase64String(HashData);
199
200 return true;
201
202 }
203 #endregion
204
205 #region RSA签名
206
214 public bool SignatureFormatter(string p_strKeyPrivate, byte[] HashbyteSignature, ref byte[] EncryptedSignatureData)
215 {
216
217 System.Security.Cryptography.RSACryptoServiceProvider RSA = new System.Security.Cryptography.RSACryptoServiceProvider();
218
219 RSA.FromXmlString(p_strKeyPrivate);
220 System.Security.Cryptography.RSAPKCS1SignatureFormatter RSAFormatter = new System.Security.Cryptography.RSAPKCS1SignatureFormatter(RSA);
221 //设置签名的算法为MD5
222 RSAFormatter.SetHashAlgorithm("MD5");
223 //执行签名
224 EncryptedSignatureData = RSAFormatter.CreateSignature(HashbyteSignature);
225
226 return true;
227
228 }
229
237 public bool SignatureFormatter(string p_strKeyPrivate, byte[] HashbyteSignature, ref string m_strEncryptedSignatureData)
238 {
239
240 byte[] EncryptedSignatureData;
241
242 System.Security.Cryptography.RSACryptoServiceProvider RSA = new System.Security.Cryptography.RSACryptoServiceProvider();
243
244 RSA.FromXmlString(p_strKeyPrivate);
245 System.Security.Cryptography.RSAPKCS1SignatureFormatter RSAFormatter = new System.Security.Cryptography.RSAPKCS1SignatureFormatter(RSA);
246 //设置签名的算法为MD5
247 RSAFormatter.SetHashAlgorithm("MD5");
248 //执行签名
249 EncryptedSignatureData = RSAFormatter.CreateSignature(HashbyteSignature);
250
251 m_strEncryptedSignatureData = Convert.ToBase64String(EncryptedSignatureData);
252
253 return true;
254
255 }
256
264 public bool SignatureFormatter(string p_strKeyPrivate, string m_strHashbyteSignature, ref byte[] EncryptedSignatureData)
265 {
266
267 byte[] HashbyteSignature;
268
269 HashbyteSignature = Convert.FromBase64String(m_strHashbyteSignature);
270 System.Security.Cryptography.RSACryptoServiceProvider RSA = new System.Security.Cryptography.RSACryptoServiceProvider();
271
272 RSA.FromXmlString(p_strKeyPrivate);
273 System.Security.Cryptography.RSAPKCS1SignatureFormatter RSAFormatter = new System.Security.Cryptography.RSAPKCS1SignatureFormatter(RSA);
274 //设置签名的算法为MD5
275 RSAFormatter.SetHashAlgorithm("MD5");
276 //执行签名
277 EncryptedSignatureData = RSAFormatter.CreateSignature(HashbyteSignature);
278
279 return true;
280
281 }
282
290 public bool SignatureFormatter(string p_strKeyPrivate, string m_strHashbyteSignature, ref string m_strEncryptedSignatureData)
291 {
292
293 byte[] HashbyteSignature;
294 byte[] EncryptedSignatureData;
295
296 HashbyteSignature = Convert.FromBase64String(m_strHashbyteSignature);
297 System.Security.Cryptography.RSACryptoServiceProvider RSA = new System.Security.Cryptography.RSACryptoServiceProvider();
298
299 RSA.FromXmlString(p_strKeyPrivate);
300 System.Security.Cryptography.RSAPKCS1SignatureFormatter RSAFormatter = new System.Security.Cryptography.RSAPKCS1SignatureFormatter(RSA);
301 //设置签名的算法为MD5
302 RSAFormatter.SetHashAlgorithm("MD5");
303 //执行签名
304 EncryptedSignatureData = RSAFormatter.CreateSignature(HashbyteSignature);
305
306 m_strEncryptedSignatureData = Convert.ToBase64String(EncryptedSignatureData);
307
308 return true;
309
310 }
311 #endregion
312
313 #region RSA 签名验证
314
322 public bool SignatureDeformatter(string p_strKeyPublic, byte[] HashbyteDeformatter, byte[] DeformatterData)
323 {
324 System.Security.Cryptography.RSACryptoServiceProvider RSA = new System.Security.Cryptography.RSACryptoServiceProvider();
325
326 RSA.FromXmlString(p_strKeyPublic);
327 System.Security.Cryptography.RSAPKCS1SignatureDeformatter RSADeformatter = new System.Security.Cryptography.RSAPKCS1SignatureDeformatter(RSA);
328 //指定解密的时候HASH算法为MD5
329 RSADeformatter.SetHashAlgorithm("MD5");
330
331 if (RSADeformatter.VerifySignature(HashbyteDeformatter, DeformatterData))
332 {
333 return true;
334 }
335 else
336 {
337 return false;
338 }
339
340 }
341
349 public bool SignatureDeformatter(string p_strKeyPublic, string p_strHashbyteDeformatter, byte[] DeformatterData)
350 {
351
352 byte[] HashbyteDeformatter;
353
354 HashbyteDeformatter = Convert.FromBase64String(p_strHashbyteDeformatter);
355
356 System.Security.Cryptography.RSACryptoServiceProvider RSA = new System.Security.Cryptography.RSACryptoServiceProvider();
357
358 RSA.FromXmlString(p_strKeyPublic);
359 System.Security.Cryptography.RSAPKCS1SignatureDeformatter RSADeformatter = new System.Security.Cryptography.RSAPKCS1SignatureDeformatter(RSA);
360 //指定解密的时候HASH算法为MD5
361 RSADeformatter.SetHashAlgorithm("MD5");
362
363 if (RSADeformatter.VerifySignature(HashbyteDeformatter, DeformatterData))
364 {
365 return true;
366 }
367 else
368 {
369 return false;
370 }
371
372 }
373
381 public bool SignatureDeformatter(string p_strKeyPublic, byte[] HashbyteDeformatter, string p_strDeformatterData)
382 {
383
384 byte[] DeformatterData;
385
386 System.Security.Cryptography.RSACryptoServiceProvider RSA = new System.Security.Cryptography.RSACryptoServiceProvider();
387
388 RSA.FromXmlString(p_strKeyPublic);
389 System.Security.Cryptography.RSAPKCS1SignatureDeformatter RSADeformatter = new System.Security.Cryptography.RSAPKCS1SignatureDeformatter(RSA);
390 //指定解密的时候HASH算法为MD5
391 RSADeformatter.SetHashAlgorithm("MD5");
392
393 DeformatterData = Convert.FromBase64String(p_strDeformatterData);
394
395 if (RSADeformatter.VerifySignature(HashbyteDeformatter, DeformatterData))
396 {
397 return true;
398 }
399 else
400 {
401 return false;
402 }
403
404 }
405
413 public bool SignatureDeformatter(string p_strKeyPublic, string p_strHashbyteDeformatter, string p_strDeformatterData)
414 {
415
416 byte[] DeformatterData;
417 byte[] HashbyteDeformatter;
418
419 HashbyteDeformatter = Convert.FromBase64String(p_strHashbyteDeformatter);
420 System.Security.Cryptography.RSACryptoServiceProvider RSA = new System.Security.Cryptography.RSACryptoServiceProvider();
421
422 RSA.FromXmlString(p_strKeyPublic);
423 System.Security.Cryptography.RSAPKCS1SignatureDeformatter RSADeformatter = new System.Security.Cryptography.RSAPKCS1SignatureDeformatter(RSA);
424 //指定解密的时候HASH算法为MD5
425 RSADeformatter.SetHashAlgorithm("MD5");
426
427 DeformatterData = Convert.FromBase64String(p_strDeformatterData);
428
429 if (RSADeformatter.VerifySignature(HashbyteDeformatter, DeformatterData))
430 {
431 return true;
432 }
433 else
434 {
435 return false;
436 }
437
438 }
439
440
441 #endregion
442
443 #endregion
444
445 }
446 }
SinGooCMS.Utility.RSACryption.GetHash
bool GetHash(string m_strSource, ref byte[] HashData)
获取Hash描述表
Definition: RSACryption.cs:133
SinGooCMS.Utility.RSACryption.SignatureDeformatter
bool SignatureDeformatter(string p_strKeyPublic, byte[] HashbyteDeformatter, string p_strDeformatterData)
签名验证
Definition: RSACryption.cs:381
SinGooCMS.Utility.RSACryption.SignatureFormatter
bool SignatureFormatter(string p_strKeyPrivate, string m_strHashbyteSignature, ref string m_strEncryptedSignatureData)
RSA签名
Definition: RSACryption.cs:290
SinGooCMS.Utility.RSACryption.SignatureFormatter
bool SignatureFormatter(string p_strKeyPrivate, byte[] HashbyteSignature, ref byte[] EncryptedSignatureData)
RSA签名
Definition: RSACryption.cs:214
SinGooCMS.Utility.RSACryption.RSADecrypt
string RSADecrypt(string xmlPrivateKey, string m_strDecryptString)
RSA解密
Definition: RSACryption.cs:88
SinGooCMS.Utility.RSACryption.SignatureDeformatter
bool SignatureDeformatter(string p_strKeyPublic, byte[] HashbyteDeformatter, byte[] DeformatterData)
签名验证
Definition: RSACryption.cs:322
System
SinGooCMS.Utility.RSACryption.GetHash
bool GetHash(System.IO.FileStream objFile, ref byte[] HashData)
获取Hash描述表
Definition: RSACryption.cs:171
SinGooCMS.Utility.RSACryption.GetHash
bool GetHash(System.IO.FileStream objFile, ref string strHashData)
获取Hash描述表
Definition: RSACryption.cs:189
SinGooCMS.Utility.RSACryption.SignatureFormatter
bool SignatureFormatter(string p_strKeyPrivate, string m_strHashbyteSignature, ref byte[] EncryptedSignatureData)
RSA签名
Definition: RSACryption.cs:264
SinGooCMS.Utility.RSACryption.RSADecrypt
string RSADecrypt(string xmlPrivateKey, byte[] DecryptString)
RSA解密
Definition: RSACryption.cs:108
SinGooCMS.Utility.RSACryption.SignatureDeformatter
bool SignatureDeformatter(string p_strKeyPublic, string p_strHashbyteDeformatter, byte[] DeformatterData)
签名验证
Definition: RSACryption.cs:349
SinGooCMS
SinGooCMS.Utility.RSACryption.SignatureDeformatter
bool SignatureDeformatter(string p_strKeyPublic, string p_strHashbyteDeformatter, string p_strDeformatterData)
签名验证
Definition: RSACryption.cs:413
SinGooCMS.Utility.RSACryption.SignatureFormatter
bool SignatureFormatter(string p_strKeyPrivate, byte[] HashbyteSignature, ref string m_strEncryptedSignatureData)
RSA签名
Definition: RSACryption.cs:237
SinGooCMS.Utility.RSACryption.RSAKey
void RSAKey(out string xmlKeys, out string xmlPublicKey)
RSA 的密钥产生 产生私钥 和公钥
Definition: RSACryption.cs:24
SinGooCMS.Utility.RSACryption.GetHash
bool GetHash(string m_strSource, ref string strHashData)
获取Hash描述表
Definition: RSACryption.cs:150
SinGooCMS.Utility.RSACryption
Definition: RSACryption.cs:13
SinGooCMS.Utility.RSACryption.RSAEncrypt
string RSAEncrypt(string xmlPublicKey, byte[] EncryptString)
RSA加密
Definition: RSACryption.cs:66
SinGooCMS.Utility.RSACryption.RSAEncrypt
string RSAEncrypt(string xmlPublicKey, string m_strEncryptString)
RSA加密
Definition: RSACryption.cs:45


SinGooCMS.Utility: SinGooCMS.Utility/Extension/ReflectExtension.cs 源文件

  • 文件列表
  • SinGooCMS.Utility
  • Extension
ReflectExtension.cs
浏览该文件的文档.
1 using System;
2 using System.Drawing;
3 using System.Globalization;
4 using System.IO;
5 using System.Linq;
6 using System.Reflection;
7 using System.Resources;
8 using System.Text;
9
10 namespace SinGooCMS.Utility.Extension
11 {
15 public static class ReflectExtension
16 {
17 private static readonly BindingFlags bindingFlags = BindingFlags.DeclaredOnly | BindingFlags.Public |
18 BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Static;
19
20 #region 方法调用
21
32 public static object InvokeMethod(this object obj, string methodName, Type[] typeParameters, object[] args)
33 {
34 object objResult;
35 var methods = obj.GetType().GetMethods(bindingFlags);
36
37 //这里要区别泛型和非泛型，否则同名的方法会提示 模糊匹配，typeParameters有值就是泛型，泛型才要指定类型参数
38 MethodInfo method = null;
39 if (typeParameters != null)
40 method = methods.Where(p => p.IsGenericMethod && p.Name == methodName).FirstOrDefault();
41 else
42 method = methods.Where(p => !p.IsGenericMethod && p.Name == methodName).FirstOrDefault();
43
44 if (method == null)
45 return null;
46
47 if (method.IsGenericMethod) //泛型方法
48 {
49 method = method.MakeGenericMethod(typeParameters);
50 objResult = method.Invoke(obj, args);
51 }
52 else
53 {
54 objResult = method.Invoke(obj, args);
55 //obj.GetType().InvokeMember(methodName, bindingFlags | BindingFlags.InvokeMethod, null, obj, args);
56 }
57
58 return objResult; //无返回值的方法 这里返回null
59 }
60
61 #endregion
62
63 #region 属性与字段、成员读写
64
65 #region 属性 Property
66
73 public static PropertyInfo GetProperty(this object obj, string name) =>
74 obj.GetType().GetProperty(name, bindingFlags);
75
83 public static T GetPropertyVal<T>(this object obj, string name) =>
84 (T)obj.GetProperty(name).GetValue(obj, null);
85
92 public static void SetPropertyVal(this object obj, string name, object value)
93 {
94 var propertyInfo = obj.GetProperty(name);
95 object objValue = Convert.ChangeType(value, propertyInfo.PropertyType);
96 propertyInfo.SetValue(obj, objValue, null);
97 }
98
99 #endregion
100
101 #region 字段 Field
102
109 public static FieldInfo GetField(this object obj, string name) =>
110 obj.GetType().GetField(name, bindingFlags);
111
117 public static FieldInfo[] GetFields(this object obj) =>
118 obj.GetType().GetFields(bindingFlags);
119
127 public static T GetFieldVal<T>(this object obj, string name) =>
128 (T)obj.GetField(name).GetValue(obj);
129
136 public static void SetFieldVal(this object obj, string name, object value) =>
137 obj.GetField(name).SetValue(obj, value);
138
139 #endregion
140
141 #endregion
142
143 #region 资源获取
144
151 public static Stream GetImageResource(this Type assemblyType, string resourceName)
152 {
153 Assembly thisAssembly = Assembly.GetAssembly(assemblyType);
154 return thisAssembly.GetManifestResourceStream(resourceName);
155 }
156
163 public static Bitmap LoadBitmap(this Type assemblyType, string resourceHolder, string imageName)
164 {
165 Assembly thisAssembly = Assembly.GetAssembly(assemblyType);
166 ResourceManager rm = new ResourceManager(resourceHolder, thisAssembly);
167 return (Bitmap)rm.GetObject(imageName);
168 }
169
176 public static string GetResString(this Type assemblyType, string resName, string resourceHolder)
177 {
178 Assembly thisAssembly = Assembly.GetAssembly(assemblyType);
179 ResourceManager rm = new ResourceManager(resourceHolder, thisAssembly);
180 return rm.GetString(resName);
181 }
182
190 public static string GetResString(this Type assemblyType, string resName, CultureInfo cultureInfo = null)
191 {
192 ResourceManager rm = new ResourceManager(assemblyType);
193 return cultureInfo == null
194 ? rm.GetString(resName)
195 : rm.GetString(resName, cultureInfo);
196 }
197
205 public static string GetManifestString(this Type assemblyType, string charset, string resName)
206 {
207 Assembly asm = Assembly.GetAssembly(assemblyType);
208 Stream st = asm.GetManifestResourceStream(string.Concat(assemblyType.Namespace, ".", resName.Replace("/", ".")));
209 if (st == null)
210 {
211 return "";
212 }
213
214 int iLen = (int)st.Length;
215 byte[] bytes = new byte[iLen];
216 st.Read(bytes, 0, iLen);
217 return (bytes != null) ? Encoding.GetEncoding(charset).GetString(bytes) : "";
218 }
219
220 #endregion
221 }
222 }
SinGooCMS.Utility.Extension.ReflectExtension.GetResString
static string GetResString(this Type assemblyType, string resName, string resourceHolder)
获取程序集资源的文本资源
Definition: ReflectExtension.cs:176
SinGooCMS.Utility.Extension.ReflectExtension.GetImageResource
static Stream GetImageResource(this Type assemblyType, string resourceName)
根据资源名称获取图片资源流
Definition: ReflectExtension.cs:151
System
SinGooCMS.Utility.Extension.ReflectExtension
反射扩展
Definition: ReflectExtension.cs:15
SinGooCMS.Utility.Extension.ReflectExtension.LoadBitmap
static Bitmap LoadBitmap(this Type assemblyType, string resourceHolder, string imageName)
获取程序集资源的位图资源
Definition: ReflectExtension.cs:163
SinGooCMS
SinGooCMS.Utility.Extension.ReflectExtension.InvokeMethod
static object InvokeMethod(this object obj, string methodName, Type[] typeParameters, object[] args)
执行方法
Definition: ReflectExtension.cs:32
SinGooCMS.Utility.Extension.ReflectExtension.GetResString
static string GetResString(this Type assemblyType, string resName, CultureInfo cultureInfo=null)
读取资源多语言文本
Definition: ReflectExtension.cs:190
SinGooCMS.Utility.Extension.ReflectExtension.GetManifestString
static string GetManifestString(this Type assemblyType, string charset, string resName)
获取程序集嵌入资源的文本形式
Definition: ReflectExtension.cs:205


SinGooCMS.Utility: SinGooCMS.Utility/Reflection/ReflectionUtils.cs 源文件

  • 文件列表
  • SinGooCMS.Utility
  • Reflection
ReflectionUtils.cs
浏览该文件的文档.
1 using System;
2 using System.IO;
3 using System.Reflection;
4
5 namespace SinGooCMS.Utility
6 {
10 public sealed class ReflectionUtils
11 {
18 public static Assembly Load(string dllFileName, string dir = "")
19 {
20 if (string.IsNullOrEmpty(dir))
21 dir = AppDomain.CurrentDomain.BaseDirectory;
22
23 return Assembly.LoadFrom(Path.Combine(dir, dllFileName));
24 }
25
26 #region 通过dll文件创建实例
27
35 public static T CreateInstance<T>(string assemblyFile, object[] parameters = null) =>
36 (T)CreateInstance(assemblyFile, typeof(T).FullName, parameters);
37
45 public static object CreateInstance(string assemblyFile, string fullName, object[] parameters = null)
46 {
47 Type type = GetType(assemblyFile, fullName);
48 return CreateInstance(type, parameters);
49 }
50
57 public static object CreateInstance(Type type, object[] parameters = null)
58 {
59 return parameters == null
60 ? Activator.CreateInstance(type)
61 : Activator.CreateInstance(type, parameters);
62 }
63
70 public static Type GetType(string assemblyFile, string fullName)
71 {
72 Assembly tempAssembly = Assembly.LoadFrom(assemblyFile);
73 return tempAssembly.GetType(fullName);
74 }
75
76 #endregion
77 }
78 }
SinGooCMS.Utility.ReflectionUtils.Load
static Assembly Load(string dllFileName, string dir="")
加载组件
Definition: ReflectionUtils.cs:18
System
SinGooCMS.Utility.ReflectionUtils.GetType
static Type GetType(string assemblyFile, string fullName)
读取类型
Definition: ReflectionUtils.cs:70
SinGooCMS
SinGooCMS.Utility.ReflectionUtils
反射操作
Definition: ReflectionUtils.cs:10
SinGooCMS.Utility.ReflectionUtils.CreateInstance
static object CreateInstance(Type type, object[] parameters=null)
创建实例
Definition: ReflectionUtils.cs:57


SinGooCMS.Utility: SinGooCMS.Utility/System/RegistryUtils.cs 源文件

  • 文件列表
  • SinGooCMS.Utility
  • System
RegistryUtils.cs
浏览该文件的文档.
1 using System;
2 using Microsoft.Win32;
3
4 namespace SinGooCMS.Utility
5 {
11 public class RegistryUtils
12 {
19 public static object GetValue(string fullKey, string itemName)
20 {
21 RegistryKey registry = Registry.CurrentUser.OpenSubKey(fullKey, true);
22 return registry?.GetValue(itemName);
23 }
24
30 public static object GetRunValue(string itemName) =>
31 GetValue("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", itemName);
32
40 public static bool SetValue(string fullKey, string itemName, string itemValue)
41 {
42 try
43 {
44 RegistryKey registry = Registry.CurrentUser.OpenSubKey(fullKey, true);
45 if (registry == null)//若指定的子项不存在
46 registry = Registry.CurrentUser.CreateSubKey(fullKey);//则创建指定的子项
47
48 registry.SetValue(itemName, itemValue);//设置该子项的新的“键值对”
49 registry.Close();
50 }
51 catch
52 {
53 return false;
54 }
55
56 return false;
57 }
58
65 public static bool SetRunValue(string itemName, string itemValue) =>
66 SetValue("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", itemName, itemValue);
67
72 public static void DeleteRunValue(string itemName) =>
73 DeleteValue("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", itemName);
74
80 public static void DeleteValue(string fullKey, string itemName)
81 {
82 RegistryKey registry = Registry.CurrentUser.OpenSubKey(fullKey, true);
83 if (registry != null)
84 registry.DeleteValue(itemName);
85 }
86 }
87 }
System
SinGooCMS.Utility.RegistryUtils.SetValue
static bool SetValue(string fullKey, string itemName, string itemValue)
保存注册表键值
Definition: RegistryUtils.cs:40
SinGooCMS.Utility.RegistryUtils.GetValue
static object GetValue(string fullKey, string itemName)
读取注册表键值
Definition: RegistryUtils.cs:19
SinGooCMS
SinGooCMS.Utility.RegistryUtils.DeleteValue
static void DeleteValue(string fullKey, string itemName)
删除键值
Definition: RegistryUtils.cs:80
SinGooCMS.Utility.RegistryUtils
注册表操作，Win平台专有(需要有管理员权限)
Definition: RegistryUtils.cs:11


SinGooCMS.Utility: SinGooCMS.Utility/Extension/ServiceCollectionExtension.cs 源文件

  • 文件列表
  • SinGooCMS.Utility
  • Extension
ServiceCollectionExtension.cs
浏览该文件的文档.
1 #if NETSTANDARD2_1
2 using Microsoft.AspNetCore.Builder;
3 using Microsoft.AspNetCore.Http;
4 using Microsoft.AspNetCore.Mvc.Infrastructure;
5 using Microsoft.Extensions.DependencyInjection;
6 using Microsoft.Extensions.DependencyInjection.Extensions;
7
8 namespace SinGooCMS.Utility.Extension
9 {
13 public static class ServiceCollectionExtension
14 {
19 public static void AddStaticHttpContext(this IServiceCollection services)
20 {
21 services.TryAddSingleton<IHttpContextAccessor, HttpContextAccessor>();
22 }
23
29 public static IApplicationBuilder UseStaticHttpContext(this IApplicationBuilder app)
30 {
31 var httpContextAccessor = app.ApplicationServices.GetRequiredService<IHttpContextAccessor>();
32 UtilsBase.Configure(httpContextAccessor);
33 return app;
34 }
35 }
36 }
37 #endif
SinGooCMS


SinGooCMS.Utility: SinGooCMS.Utility/Web/SessionUtils.cs 源文件

  • 文件列表
  • SinGooCMS.Utility
  • Web
SessionUtils.cs
浏览该文件的文档.
1 using System;
2 using System.Collections.Generic;
3 using System.Linq;
4 using System.Text;
5 using SinGooCMS.Utility.Extension;
6
7 #if NETSTANDARD2_1
8 using Microsoft.AspNetCore.Http;
9 #else
10 using System.Web;
11 #endif
12
13 namespace SinGooCMS.Utility
14 {
18 public sealed class SessionUtils
19 {
25 public static bool ContainKey(string key)
26 {
27 #if NETSTANDARD2_1
28 return UtilsBase.HttpContext.Session.Keys.Contains(key);
29 #else
30 return UtilsBase.HttpContext.Session[key] == null;
31 #endif
32 }
33
34 #region 写入Session
35
43 public static void SetSession(string key, string value, int time = 60 * 30)
44 {
45 #if NETSTANDARD2_1
46 UtilsBase.HttpContext.Session.SetString(key, value); //net core的session过期时间在startup里面设置
47 #else
48 HttpContext.Current.Session[key] = value;
49 HttpContext.Current.Session.Timeout = time;
50 #endif
51 }
52
60 public static void SetSession<T>(string key, T value, int time = 60 * 24)
61 {
62 #if NETSTANDARD2_1
63 SetSession(key, value.ToJson());
64 #else
65 HttpContext.Current.Session[key] = value;
66 HttpContext.Current.Session.Timeout = time;
67 #endif
68 }
69
70 #endregion
71
72 #region 读取Session
73
74 #if NETSTANDARD2_1
75 public static string GetSession(string key)
81 {
82 return UtilsBase.HttpContext.Session.GetString(key);
83 }
84 #endif
85
92 public static T GetSession<T>(string key) where T : class
93 {
94 #if NETSTANDARD2_1
95 var value = GetSession(key);
96 return value != null ? value.JsonToObject<T>() : default;
97 #else
98 if (UtilsBase.HttpContext.Session != null && UtilsBase.HttpContext.Session[key] != null)
99 return (T)UtilsBase.HttpContext.Session[key];
100 else
101 return null;
102 #endif
103 }
104
105 #endregion
106
107 #region 删除Session
108
113 public static void DelSession(string key)
114 {
115 UtilsBase.HttpContext.Session.Remove(key);
116 }
117
118 #endregion
119 }
120 }
SinGooCMS.Utility.SessionUtils.ContainKey
static bool ContainKey(string key)
是否包含key
Definition: SessionUtils.cs:25
SinGooCMS.Utility
Definition: Accessor.cs:6
System
SinGooCMS.Utility.SessionUtils.SetSession
static void SetSession(string key, string value, int time=60 *30)
写入Session值 .net core 在Startup配置Session超时时间 services.AddSession(options => {options...
Definition: SessionUtils.cs:43
SinGooCMS.Utility.Extension
Definition: AssemblyExtensions.cs:8
SinGooCMS.Utility.UtilsBase.HttpContext
static HttpContext HttpContext
http上下文
Definition: UtilsBase.cs:43
SinGooCMS.Utility.SessionUtils.DelSession
static void DelSession(string key)
删除Session
Definition: SessionUtils.cs:113
SinGooCMS.Utility.SessionUtils
session会话工具
Definition: SessionUtils.cs:18
SinGooCMS
SinGooCMS.Utility.UtilsBase
工具底层，主要获取 http上下文 HttpContext。netfx从system.web中读取，core需要注入
Definition: UtilsBase.cs:13


SinGooCMS.Utility: SinGooCMS.Utility/IO/ShareFileUtils.cs 源文件

  • 文件列表
  • SinGooCMS.Utility
  • IO
ShareFileUtils.cs
浏览该文件的文档.
1 using System;
2 using System.Collections.Generic;
3 using System.IO;
4
5 namespace SinGooCMS.Utility
6 {
10 public sealed class ShareFileUtils
11 {
12 #region 属性
13
14 private string SharePath { get; set; }
15 private string UserName { get; set; }
16 private string Password { get; set; }
17
18 #endregion
19
28 public static ShareFileUtils Connect(string sharePath, string userName, string password, string localDisk = "")
29 {
30 if (!string.IsNullOrEmpty(localDisk) && !localDisk.EndsWith(":"))
31 localDisk += ":"; //盘符
32
33 if (!string.IsNullOrEmpty(localDisk))
34 sharePath = localDisk + " " + sharePath;
35
36 var commandTexts = new List<string>() {
37 $"net use {sharePath} {password} /user:{userName}"
38 };
39
40 if (ProcessUtils.ExecuteCMD(commandTexts))
41 return new ShareFileUtils
42 {
43 SharePath = sharePath,
44 UserName = userName,
45 Password = password
46 };
47 else
48 return null;
49 }
50
51 #region 成员方法
52
58 public DirectoryInfo GetDir(string dirPath) =>
59 new DirectoryInfo(System.IO.Path.Combine(SharePath, dirPath));
60
66 public FileInfo GetFile(string fileName) =>
67 new FileInfo(System.IO.Path.Combine(SharePath, fileName));
68
74 public void DownFile(string shareFileName,string localDir)
75 {
76 var file = GetFile(shareFileName);
77 FileStream inFileStream = new FileStream(file.FullName, FileMode.Open);
78
79 if (!Directory.Exists(localDir))
80 Directory.CreateDirectory(localDir);
81
82 string localFileName = System.IO.Path.Combine(localDir, file.Name);
83 FileStream outFileStream = new FileStream(localFileName, FileMode.OpenOrCreate);
84
85 byte[] buf = new byte[inFileStream.Length];
86 int byteCount;
87 while ((byteCount = inFileStream.Read(buf, 0, buf.Length)) > 0)
88 {
89 outFileStream.Write(buf, 0, byteCount);
90 }
91
92 inFileStream.Flush();
93 inFileStream.Close();
94 outFileStream.Flush();
95 outFileStream.Close();
96 }
97
103 public void UpFile(string localFileName, string shareDir)
104 {
105 var dir = GetDir(shareDir);
106 if (!Directory.Exists(dir.FullName))
107 Directory.CreateDirectory(dir.FullName);
108
109 var file = new FileInfo(localFileName);
110 FileStream inFileStream = new FileStream(localFileName, FileMode.Open);
111
112 string shareFileName = System.IO.Path.Combine(dir.FullName, file.Name);
113 FileStream outFileStream = new FileStream(shareFileName, FileMode.OpenOrCreate);
114
115 byte[] buf = new byte[inFileStream.Length];
116 int byteCount;
117 while ((byteCount = inFileStream.Read(buf, 0, buf.Length)) > 0)
118 {
119 outFileStream.Write(buf, 0, byteCount);
120 }
121
122 inFileStream.Flush();
123 inFileStream.Close();
124 outFileStream.Flush();
125 outFileStream.Close();
126 }
127
131 public void Disconnect()
132 {
133 string commandText = $"net use {SharePath} /del";
134 ProcessUtils.ExecuteCMD(new List<string>() { commandText });
135 }
136
137 #endregion
138
139 #region 静态方法
140
144 public static void DisconnectAll()
145 {
146 string commandText = "net use * /del /y";
147 ProcessUtils.ExecuteCMD(new List<string>() { commandText });
148 }
149
154 public static string ShowConnect()
155 {
156 string result = "";
157 string errMsg = "";
158 ProcessUtils.ExecuteCMD(new List<string>() { "net use" }, out result, out errMsg);
159 return result;
160 }
161
162 #endregion
163 }
164 }
SinGooCMS.Utility.ShareFileUtils.ShowConnect
static string ShowConnect()
查看当前所有连接
Definition: ShareFileUtils.cs:154
SinGooCMS.Utility.ShareFileUtils.DownFile
void DownFile(string shareFileName, string localDir)
从共享文件夹下载到本地目录下
Definition: ShareFileUtils.cs:74
System
SinGooCMS.Utility.ShareFileUtils
局域网共享文件工具
Definition: ShareFileUtils.cs:10
SinGooCMS.Utility.ShareFileUtils.Connect
static ShareFileUtils Connect(string sharePath, string userName, string password, string localDisk="")
连接远程共享文件夹,并返回对象
Definition: ShareFileUtils.cs:28
SinGooCMS.Utility.ShareFileUtils.Disconnect
void Disconnect()
断开连接
Definition: ShareFileUtils.cs:131
SinGooCMS.Utility.ProcessUtils
执行系统进程
Definition: ProcessUtils.cs:12
SinGooCMS.Utility.ProcessUtils.ExecuteCMD
static bool ExecuteCMD(IList< string > commandText)
执行cmd命令
Definition: ProcessUtils.cs:58
SinGooCMS
SinGooCMS.Utility.ShareFileUtils.UpFile
void UpFile(string localFileName, string shareDir)
从本地复制到共享目录下
Definition: ShareFileUtils.cs:103
SinGooCMS.Utility.ShareFileUtils.DisconnectAll
static void DisconnectAll()
断开所有连接
Definition: ShareFileUtils.cs:144


SinGooCMS.Utility: SinGooCMS.Utility/List/SinGooList.cs 源文件

  • 文件列表
  • SinGooCMS.Utility
  • List
SinGooList.cs
浏览该文件的文档.
1 using System;
2 using System.Collections;
3 using System.Collections.Generic;
4
5 namespace SinGooCMS.Utility
6 {
11 public class SinGooList<T> : List<T>
12 {
19 public SinGooList<T> this[int indexBeg, int indexEnd]
20 {
21 get
22 {
23 if (indexBeg < 0 || indexEnd < indexBeg || indexEnd > this.Count - 1)
24 return null;
25
26 var lst = new SinGooList<T>();
27 for (var i = 0; i < this.Count; i++)
28 {
29 if (i < indexBeg || i > indexEnd)
30 continue;
31
32 lst.Add(this[i]);
33 }
34
35 return lst;
36 }
37 }
38 }
39
43 public class SinGooArray : ArrayList
44 {
51 public object this[int indexBeg, int indexEnd]
52 {
53 get
54 {
55 if (indexBeg < 0 || indexEnd < indexBeg || indexEnd > this.Count - 1)
56 return null;
57
58 var arr = new ArrayList();
59 for (var i = 0; i < this.Count; i++)
60 {
61 if (i < indexBeg || i > indexEnd)
62 continue;
63
64 arr.Add(this[i]);
65 }
66
67 return arr;
68 }
69 }
70
71 }
72
78 public class SinGooDictionary<T1, T2> : Dictionary<T1, T2>
79 {
85 public object this[int indexBeg]
86 {
87 get
88 {
89 if (indexBeg < 0 || indexBeg > this.Count - 1)
90 return null;
91
92 int counter = 0;
93 var dict = new Dictionary<T1, T2>();
94 foreach (KeyValuePair<T1, T2> item in this)
95 {
96 if (indexBeg == counter)
97 {
98 dict.Add(item.Key,item.Value);
99 break;
100 }
101 }
102
103 return dict;
104 }
105 }
106
113 public object this[int indexBeg, int indexEnd]
114 {
115 get
116 {
117 if (indexBeg < 0 || indexEnd < indexBeg || indexEnd > this.Count - 1)
118 return null;
119
120 int counter = 0;
121 var dict = new Dictionary<T1, T2>();
122 foreach (KeyValuePair<T1, T2> item in this)
123 {
124 if (counter < indexBeg || counter > indexEnd)
125 {
126 counter++;
127 continue;
128 }
129 else
130 {
131 dict.Add(item.Key, item.Value);
132 counter++;
133 }
134 }
135
136 return dict;
137 }
138 }
139 }
140 }
SinGooCMS.Utility.SinGooDictionary
Dictionary扩展，实现从下标取值
Definition: SinGooList.cs:78
System
SinGooCMS
SinGooCMS.Utility.SinGooList
List扩展，实现取范围数据
Definition: SinGooList.cs:11
SinGooCMS.Utility.SinGooArray
ArrayList扩展，实现取范围数据
Definition: SinGooList.cs:43


SinGooCMS.Utility: SinGooCMS.Utility/Net/SocketClient.cs 源文件

  • 文件列表
  • SinGooCMS.Utility
  • Net
SocketClient.cs
浏览该文件的文档.
1 using System;
2 using System.IO;
3 using System.Net;
4 using System.Net.Sockets;
5 using System.Runtime.Serialization;
6 using System.Runtime.Serialization.Formatters.Binary;
7 using System.Text;
8 using System.Threading;
9
10 namespace SinGooCMS.Utility
11 {
15 [Obsolete("似乎有点问题，暂时不建议使用")]
16 public static class SocketClient
17 {
18 #region 私有字段
19
23 private static readonly int m_maxpacket = 1024 * 4;
24
25 #endregion
26
27 #region 服务器侦听
28
33 public static Socket ListenerSocket(this TcpListener listener)
34 {
35 try
36 {
37 return listener.AcceptSocket();
38 }
39 catch (Exception ex)
40 {
41 return null;
42 }
43 }
44
50 public static NetworkStream ListenerStream(this TcpListener listener)
51 {
52 try
53 {
54 return listener.AcceptTcpClient().GetStream();
55 }
56 catch (Exception)
57 {
58 return null;
59 }
60 }
61
62 #endregion
63
64 #region 客户端连接
65
72 public static Socket ConnectSocket(this TcpClient tcpclient, IPEndPoint ipendpoint)
73 {
74 try
75 {
76 tcpclient.Connect(ipendpoint);
77 return tcpclient.Client;
78 }
79 catch (Exception)
80 {
81 return null;
82 }
83 }
84
92 public static Socket ConnectSocket(this TcpClient tcpclient, IPAddress ipadd, int port)
93 {
94 try
95 {
96 tcpclient.Connect(ipadd, port);
97 return tcpclient.Client;
98 }
99 catch (Exception)
100 {
101 return null;
102 }
103 }
104
111 public static NetworkStream ConnectStream(this TcpClient tcpclient, IPEndPoint ipendpoint)
112 {
113 try
114 {
115 tcpclient.Connect(ipendpoint);
116 return tcpclient.GetStream();
117 }
118 catch (Exception)
119 {
120 return null;
121 }
122 }
123
131 public static NetworkStream ConnectStream(this TcpClient tcpclient, IPAddress ipadd, int port)
132 {
133 try
134 {
135 tcpclient.Connect(ipadd, port);
136 return tcpclient.GetStream();
137 }
138 catch (Exception)
139 {
140 return null;
141 }
142 }
143
144 #endregion
145
146 #region Socket接收数据
147
154 public static byte[] ReceiveFixData(this Socket socket, int size)
155 {
156 int offset = 0;
157 int dataleft = size;
158 byte[] msg = new byte[size];
159 while (dataleft > 0)
160 {
161 var recv = socket.Receive(msg, offset, dataleft, 0);
162 if (recv == 0)
163 {
164 break;
165 }
166
167 offset += recv;
168 dataleft -= recv;
169 }
170
171 return msg;
172 }
173
182 public static byte[] ReceiveVarData(this Socket socket)
183 {
184 //每次接受数据时,接收固定长度的包头,包头长度为8
185 byte[] lengthbyte = ReceiveFixData(socket, 8);
186 //length得到字符长度 然后加工处理得到数字
187 int length = GetPacketLength(lengthbyte);
188 //得到正文
189 return ReceiveFixData(socket, length);
190 }
191
198 public static T ReceiveVarData<T>(this Socket socket)
199 {
200 //先接收包头长度 固定8个字节
201 byte[] lengthbyte = ReceiveFixData(socket, 8);
202 //得到字节长度
203 int length = GetPacketLength(lengthbyte);
204 byte[] bytecoll = new byte[m_maxpacket];
205 IFormatter format = new BinaryFormatter();
206 MemoryStream stream = new MemoryStream();
207 int offset = 0; //接收字节个数
208 int lastdata = length; //还剩下多少没有接收,初始大小等于实际大小
209 int receivedata = m_maxpacket; //每次接收大小
210 //循环接收
211 int mark = 0; //标记几次接收到的数据为0长度
212 while (true)
213 {
214 //剩下的字节数是否小于缓存大小
215 if (lastdata < m_maxpacket)
216 {
217 receivedata = lastdata; //就只接收剩下的字节数
218 }
219
220 int count = socket.Receive(bytecoll, 0, receivedata, 0);
221 if (count > 0)
222 {
223 stream.Write(bytecoll, 0, count);
224 offset += count;
225 lastdata -= count;
226 mark = 0;
227 }
228 else
229 {
230 mark++;
231 if (mark == 10)
232 {
233 break;
234 }
235 }
236
237 if (offset == length)
238 {
239 break;
240 }
241 }
242
243 stream.Seek(0, SeekOrigin.Begin); //必须要这个 或者stream.Position = 0;
244 T t = (T)format.Deserialize(stream);
245 return t;
246 }
247
257 public static bool ReceiveFile(this Socket socket, string path, string filename, long size, Action<int> progress)
258 {
259 if (!Directory.Exists(path))
260 {
261 return false;
262 }
263
264 //主要是防止有重名文件
265 string savepath = GetPath(path, filename); //得到文件路径
266 //缓冲区
267 byte[] file = new byte[m_maxpacket];
268 int receivedata = m_maxpacket; //每次要接收的长度
269 long offset = 0; //循环接收的总长度
270 long lastdata = size; //剩余多少还没接收
271 int mark = 0;
272 using (var fs = new FileStream(savepath, FileMode.OpenOrCreate, FileAccess.Write))
273 {
274 if (size <= 0)
275 {
276 return false;
277 }
278
279 bool ret = false;
280 while (true)
281 {
282 if (lastdata < receivedata)
283 {
284 receivedata = Convert.ToInt32(lastdata);
285 }
286
287 var count = socket.Receive(file, 0, receivedata, SocketFlags.None); //每次接收的实际长度
288 if (count > 0)
289 {
290 fs.Write(file, 0, count);
291 offset += count;
292 lastdata -= count;
293 mark = 0;
294 }
295 else
296 {
297 mark++; //连续5次接收为0字节 则跳出循环
298 if (mark == 10)
299 {
300 break;
301 }
302 }
303
304 //接收进度
305 progress(Convert.ToInt32(Convert.ToDouble(offset) / Convert.ToDouble(size) * 100));
306 //接收完毕
307 if (offset == size)
308 {
309 ret = true;
310 break;
311 }
312 }
313
314 return ret;
315 }
316 }
317
326 public static bool ReceiveFile(this Socket socket, string path, string filename, long size)
327 {
328 return ReceiveFile(socket, path, filename, size, null);
329 }
330
337 public static void ReceiveFile(this Socket socket, string path)
338 {
339 //得到包头信息字节数组 (文件名 + 文件大小 的字符串长度)
340 //取前8位
341 byte[] info_bt = ReceiveFixData(socket, 8);
342 //得到包头信息字符长度
343 int info_length = GetPacketLength(info_bt);
344 //提取包头信息,(文件名 + 文件大小 的字符串长度)
345 byte[] info = ReceiveFixData(socket, info_length);
346 //得到文件信息字符串 (文件名 + 文件大小)
347 string info_str = Encoding.UTF8.GetString(info);
348 string[] strs = info_str.Split('|');
349 string filename = strs[0]; //文件名
350 long length = Convert.ToInt64(strs[1]); //文件大小
351 //开始接收文件
352 ReceiveFile(socket, path, filename, length);
353 }
354
355 private static int GetPacketLength(byte[] length)
356 {
357 string str = Encoding.UTF8.GetString(length);
358 str = str.TrimEnd('*');
359 return int.TryParse(str, out var _length) ? _length : 0;
360 }
361
362 private static int i;
363
364 private static string markPath = string.Empty;
365
373 public static string GetPath(string directory, string file)
374 {
375 if (markPath == string.Empty)
376 {
377 markPath = Path.Combine(directory, file);
378 }
379
380 string path = Path.Combine(directory, file);
381 if (File.Exists(path))
382 {
383 i++;
384 string filename = Path.GetFileNameWithoutExtension(markPath) + "(" + i + ")";
385 string extension = Path.GetExtension(markPath);
386 return GetPath(directory, filename + extension);
387 }
388
389 i = 0;
390 markPath = string.Empty;
391 return path;
392 }
393
394 #endregion
395
396 #region Socket发送数据
397
405 public static int SendFixData(this Socket socket, byte[] msg)
406 {
407 int size = msg.Length; //要发送字节长度
408 int offset = 0; //已经发送长度
409 int dataleft = size; //剩下字符
410 int senddata = m_maxpacket; //每次发送大小
411 while (true)
412 {
413 //如过剩下的字节数 小于 每次发送字节数
414 if (dataleft < senddata)
415 {
416 senddata = dataleft;
417 }
418
419 int count = socket.Send(msg, offset, senddata, SocketFlags.None);
420 offset += count;
421 dataleft -= count;
422 if (offset == size)
423 {
424 break;
425 }
426 }
427
428 return offset;
429 }
430
437 public static int SendVarData(this Socket socket, string contact)
438 {
439 //得到字符长度
440 int size = Encoding.UTF8.GetBytes(contact).Length;
441 //包头字符
442 string length = GetSendPacketLengthStr(size);
443 //包头 + 正文
444 byte[] sendbyte = Encoding.UTF8.GetBytes(length + contact);
445 //发送
446 return SendFixData(socket, sendbyte);
447 }
448
455 public static int SendVarData(this Socket socket, byte[] bytes)
456 {
457 //得到包头字节
458 int size = bytes.Length;
459 string length = GetSendPacketLengthStr(size);
460 byte[] lengthbyte = Encoding.UTF8.GetBytes(length);
461 //发送包头
462 SendFixData(socket, lengthbyte); //因为不知道正文是什么编码所以没有合并
463 //发送正文
464 return SendFixData(socket, bytes);
465 }
466
474 public static int SendSerializeObject<T>(this Socket socket, T obj)
475 {
476 byte[] bytes = SerializeObject(obj);
477 return SendVarData(socket, bytes);
478 }
479
488 public static bool SendFile(this Socket socket, string path, bool issend, Action<int> progress)
489 {
490 if (!File.Exists(path))
491 {
492 return false;
493 }
494
495 var fileinfo = new FileInfo(path);
496 string filename = fileinfo.Name;
497 long length = fileinfo.Length;
498 //发送文件信息
499 if (issend)
500 {
501 SendVarData(socket, filename + "|" + length);
502 }
503
504 //发送文件
505 long offset = 0;
506 byte[] b = new byte[m_maxpacket];
507 int mark = 0;
508 using (var fs = new FileStream(path, FileMode.Open, FileAccess.Read))
509 {
510 int senddata = b.Length;
511 //循环读取发送
512 while (true)
513 {
514 int count = fs.Read(b, 0, senddata);
515 if (count > 0)
516 {
517 socket.Send(b, 0, count, SocketFlags.None);
518 offset += count;
519 mark = 0;
520 }
521 else
522 {
523 mark++;
524 if (mark == 10)
525 {
526 break;
527 }
528 }
529
530 progress(Convert.ToInt32(Convert.ToDouble(offset) / Convert.ToDouble(length) * 100));
531 if (offset == length)
532 {
533 return true;
534 }
535
536 Thread.Sleep(50); //设置等待时间,以免粘包
537 }
538 }
539
540 return false;
541 }
542
550 public static bool SendFile(this Socket socket, string path, bool issend)
551 {
552 return SendFile(socket, path, issend, null);
553 }
554
561 public static bool SendFile(this Socket socket, string path)
562 {
563 return SendFile(socket, path, false, null);
564 }
565
566 private static byte[] SerializeObject(object obj)
567 {
568 IFormatter format = new BinaryFormatter();
569 using (var stream = new MemoryStream())
570 {
571 format.Serialize(stream, obj);
572 return stream.ToArray();
573 }
574 }
575
576 private static string GetSendPacketLengthStr(int size)
577 {
578 string length = size + "********"; //得到size的长度
579 return length.Substring(0, 8); //截取前前8位
580 }
581
582 #endregion
583 }
584 }
SinGooCMS.Utility.SocketClient.GetPath
static string GetPath(string directory, string file)
得到文件路径(防止有文件名重复) 如:aaa.txt已经在directory目录下存在,则会得到文件aaa(1).txt
Definition: SocketClient.cs:373
SinGooCMS.Utility.SocketClient.ReceiveFixData
static byte[] ReceiveFixData(this Socket socket, int size)
接受固定长度字符串
Definition: SocketClient.cs:154
SinGooCMS.Utility.SocketClient.ListenerStream
static NetworkStream ListenerStream(this TcpListener listener)
服务器侦听方法 返回null则说明没有链接上
Definition: SocketClient.cs:50
SinGooCMS.Utility.SocketClient.ReceiveFile
static bool ReceiveFile(this Socket socket, string path, string filename, long size)
从socket服务端接收文件
Definition: SocketClient.cs:326
SinGooCMS.Utility.SocketClient.ListenerSocket
static Socket ListenerSocket(this TcpListener listener)
服务器侦听方法 返回null则说明没有链接上
Definition: SocketClient.cs:33
System
SinGooCMS.Utility.SocketClient.SendFixData
static int SendFixData(this Socket socket, byte[] msg)
发送固定长度消息 发送字节数不能大于int型最大值
Definition: SocketClient.cs:405
SinGooCMS.Utility.SocketClient.ConnectSocket
static Socket ConnectSocket(this TcpClient tcpclient, IPEndPoint ipendpoint)
从客户端连接获取socket对象
Definition: SocketClient.cs:72
SinGooCMS.Utility.SocketClient.GetPacketLength
static int GetPacketLength(byte[] length)
Definition: SocketClient.cs:355
SinGooCMS.Utility.SocketClient.SerializeObject
static byte[] SerializeObject(object obj)
Definition: SocketClient.cs:566
SinGooCMS.Utility.SocketClient.SendFile
static bool SendFile(this Socket socket, string path, bool issend)
发送文件,不需要进度信息
Definition: SocketClient.cs:550
SinGooCMS.Utility.SocketClient.SendVarData
static int SendVarData(this Socket socket, string contact)
发送变长信息 格式 包头(包头占8位) + 正文
Definition: SocketClient.cs:437
SinGooCMS.Utility.SocketClient.ReceiveFile
static void ReceiveFile(this Socket socket, string path)
预先不知道文件名和文件大小 用此方法接收 此方法对于的发送方法是SendFile()
Definition: SocketClient.cs:337
SinGooCMS
SinGooCMS.Utility.SocketClient.SendFile
static bool SendFile(this Socket socket, string path, bool issend, Action< int > progress)
发送文件
Definition: SocketClient.cs:488
SinGooCMS.Utility.SocketClient
Socket客户端操作类
Definition: SocketClient.cs:16
SinGooCMS.Utility.SocketClient.GetSendPacketLengthStr
static string GetSendPacketLengthStr(int size)
Definition: SocketClient.cs:576
SinGooCMS.Utility.SocketClient.ReceiveVarData
static byte[] ReceiveVarData(this Socket socket)
接收变长字符串 为了处理粘包问题 ,每次发送数据时 包头(数据字节长度) + 正文 这个发送小数据 设置包头的字...
Definition: SocketClient.cs:182
SinGooCMS.Utility.SocketClient.SendVarData
static int SendVarData(this Socket socket, byte[] bytes)
发送变成信息
Definition: SocketClient.cs:455
SinGooCMS.Utility.SocketClient.ConnectSocket
static Socket ConnectSocket(this TcpClient tcpclient, IPAddress ipadd, int port)
从客户端连接获取socket对象
Definition: SocketClient.cs:92
SinGooCMS.Utility.SocketClient.ConnectStream
static NetworkStream ConnectStream(this TcpClient tcpclient, IPAddress ipadd, int port)
从客户端获取网络流对象
Definition: SocketClient.cs:131
SinGooCMS.Utility.SocketClient.i
static int i
Definition: SocketClient.cs:362
SinGooCMS.Utility.SocketClient.ConnectStream
static NetworkStream ConnectStream(this TcpClient tcpclient, IPEndPoint ipendpoint)
从客户端获取网络流对象
Definition: SocketClient.cs:111
SinGooCMS.Utility.SocketClient.ReceiveFile
static bool ReceiveFile(this Socket socket, string path, string filename, long size, Action< int > progress)
在预先得到文件的文件名和大小 调用此方法接收文件
Definition: SocketClient.cs:257
SinGooCMS.Utility.SocketClient.SendFile
static bool SendFile(this Socket socket, string path)
发送文件,不需要进度信息和(头)信息
Definition: SocketClient.cs:561


SinGooCMS.Utility: SinGooCMS.Utility/System/StopwatchUtils.cs 源文件

  • 文件列表
  • SinGooCMS.Utility
  • System
StopwatchUtils.cs
浏览该文件的文档.
1 using System;
2 using System.Diagnostics;
3
4 namespace SinGooCMS.Utility
5 {
9 public sealed class StopwatchUtils
10 {
16 public static double Execute(Action action)
17 {
18 var sw = Stopwatch.StartNew();
19 action();
20 return sw.ElapsedMilliseconds;
21 }
22 }
23 }
SinGooCMS.Utility.StopwatchUtils.Execute
static double Execute(Action action)
执行方法
Definition: StopwatchUtils.cs:16
System
SinGooCMS.Utility.StopwatchUtils
计数器帮助类
Definition: StopwatchUtils.cs:9
SinGooCMS


SinGooCMS.Utility: SinGooCMS.Utility/Extension/StreamExtension.cs 源文件

  • 文件列表
  • SinGooCMS.Utility
  • Extension
StreamExtension.cs
浏览该文件的文档.
1 using System.IO;
2 using System.Security.Cryptography;
3 using System.Text;
4 using System.Threading.Tasks;
5
6 namespace SinGooCMS.Utility.Extension
7 {
11 public static class StreamExtension
12 {
18 public static MemoryStream SaveAsMemoryStream(this Stream stream)
19 {
20 stream.Position = 0;
21 return new MemoryStream(stream.ToArray());
22 }
23
29 public static byte[] ToArray(this Stream stream)
30 {
31 stream.Position = 0;
32 byte[] bytes = new byte[stream.Length];
33 stream.Read(bytes, 0, bytes.Length);
34
35 // 设置当前流的位置为流的开始
36 stream.Seek(0, SeekOrigin.Begin);
37 return bytes;
38 }
39
46 public static async Task CopyToFileAsync(this Stream fs, string dest, int bufferSize = 1024 * 1024 * 8)
47 {
48 using (var fsWrite = new FileStream(dest, FileMode.OpenOrCreate, FileAccess.ReadWrite))
49 {
50 byte[] buf = new byte[bufferSize];
51 int len;
52 while ((len = await fs.ReadAsync(buf, 0, buf.Length)) != 0)
53 {
54 await fsWrite.WriteAsync(buf, 0, len);
55 }
56 }
57 }
58
64 public static async Task SaveFile(this MemoryStream ms, string filename)
65 {
66 using (var fs = new FileStream(filename, FileMode.OpenOrCreate, FileAccess.ReadWrite))
67 {
68 byte[] buffer = ms.ToArray(); // 转化为byte格式存储
69 await fs.WriteAsync(buffer, 0, buffer.Length);
70 await fs.FlushAsync();
71 }
72 }
73 }
74 }
System
SinGooCMS.Utility.Extension.StreamExtension.SaveAsMemoryStream
static MemoryStream SaveAsMemoryStream(this Stream stream)
将流转换为内存流
Definition: StreamExtension.cs:18
SinGooCMS.Utility.Extension.StreamExtension.SaveFile
static async Task SaveFile(this MemoryStream ms, string filename)
将内存流转储成文件
Definition: StreamExtension.cs:64
SinGooCMS.Utility.Extension.StreamExtension.CopyToFileAsync
static async Task CopyToFileAsync(this Stream fs, string dest, int bufferSize=1024 *1024 *8)
以文件流的形式复制大文件(异步方式)
Definition: StreamExtension.cs:46
SinGooCMS.Utility.Extension.StreamExtension
流扩展
Definition: StreamExtension.cs:11
SinGooCMS
SinGooCMS.Utility.Extension.StreamExtension.ToArray
static byte[] ToArray(this Stream stream)
将流转换为数组
Definition: StreamExtension.cs:29


SinGooCMS.Utility: SinGooCMS.Utility/Extension/StringExtension.cs 源文件

  • 文件列表
  • SinGooCMS.Utility
  • Extension
StringExtension.cs
浏览该文件的文档.
1 using System;
2 using System.Collections.Generic;
3 using System.Text;
4 using System.Text.RegularExpressions;
5
6 namespace SinGooCMS.Utility.Extension
7 {
11 public static class StringExtension
12 {
13 #region 转化为大写的人民币
14
20 public static string ToRMB(this decimal decMoney)
21 {
22 string[] strN = { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9" };
23 string[] strC = { "零", "壹", "贰", "叁", "肆", "伍", "陆", "柒", "捌", "玖" };
24 string[] strA = { "", "圆", "拾", "佰", "仟", "万", "拾", "佰", "仟", "亿", "拾", "佰", "仟", "万亿", "拾", "佰", "仟", "亿亿", };
25 int[] nLoc = { 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0 };
26
27 string strFrom = "";
28 string strTo = "";
29 string strChar;
30 int m, mLast = -1, nCount = 0;
31
32 if (strFrom.Length > strA.GetUpperBound(0) - 1) return "***拜托，这么多钱还需要数吗***";
33
34 if (decMoney < 0)
35 {
36 decMoney *= -1;
37 strTo = "负";
38 }
39
40 Int64 n1 = (Int64)decMoney; // 元
41 strFrom = n1.ToString();
42
43 for (int i = strFrom.Length; i > 0; i--)
44 {
45 strChar = strFrom.Substring(strFrom.Length - i, 1);
46 m = Convert.ToInt32(strChar);
47 if (m == 0)
48 {
49 // 连续为０时需要补齐中间单位,且只补第一次
50 if (nLoc[i] > 0 && nCount == 0 && strFrom.Length > 1)
51 {
52 strTo = strTo + strA[i];
53 nCount++;
54 }
55 }
56 else
57 {
58 // 补０
59 if (mLast == 0)
60 {
61 strTo = strTo + strC[0];
62 }
63
64 // 数字转换为大写
65 strTo = strTo + strC[m];
66 // 补足单位
67 strTo = strTo + strA[i];
68 nCount = 0;
69 }
70 mLast = m;
71 }
72
73 Int64 n2 = ((Int64)(decMoney * 100)) % 100; // 角分
74 Int64 n3 = n2 / 10; // 角
75 Int64 n4 = n2 % 10; // 分
76 string s2 = "";
77
78 if (n4 > 0)
79 {
80 s2 = strC[n4] + "分";
81 if (n3 > 0)
82 {
83 s2 = strC[n3] + "角" + s2;
84 }
85 }
86 else
87 {
88 if (n3 > 0)
89 {
90 s2 = strC[n3] + "角";
91 }
92 }
93 strTo = strTo + s2;
94
95 if (strTo == "") strTo = strC[0]; // 全0显示为零
96 else if (s2 == "") strTo = strTo + "整"; // 无角分显示整
97 return strTo;
98 }
99 #endregion
100
101 #region 去除空格
102
108 public static string RemoveWhiteSpace(this string strInput)
109 {
110 bool changed = false;
111 char[] output = strInput.ToCharArray();
112 int cursor = 0;
113 for (int i = 0, size = output.Length; i < size; i++)
114 {
115 char c = output[i];
116 if (Char.IsWhiteSpace(c))
117 {
118 changed = true;
119 continue;
120 }
121
122 output[cursor] = c;
123 cursor++;
124 }
125
126 return changed ? new string(output, 0, cursor) : strInput;
127 }
128 #endregion
129
130 #region HTML代码与TXT格式转换
131
137 public static string RemoveHtml(this string htmlstring)
138 {
139 //删除脚本
140 htmlstring = Regex.Replace(htmlstring, @"<script[^>]*?>.*?</script>", "", RegexOptions.IgnoreCase);
141 //删除HTML
142 htmlstring = Regex.Replace(htmlstring, @"<(.[^>]*)>", "", RegexOptions.IgnoreCase);
143 htmlstring = Regex.Replace(htmlstring, @"([\r\n])[\s]+", "", RegexOptions.IgnoreCase);
144 htmlstring = Regex.Replace(htmlstring, @"-->", "", RegexOptions.IgnoreCase);
145 htmlstring = Regex.Replace(htmlstring, @"<!--.*", "", RegexOptions.IgnoreCase);
146
147 htmlstring = Regex.Replace(htmlstring, @"&(quot|#34);", "\"", RegexOptions.IgnoreCase);
148 htmlstring = Regex.Replace(htmlstring, @"&(amp|#38);", "&", RegexOptions.IgnoreCase);
149 htmlstring = Regex.Replace(htmlstring, @"&(lt|#60);", "<", RegexOptions.IgnoreCase);
150 htmlstring = Regex.Replace(htmlstring, @"&(gt|#62);", ">", RegexOptions.IgnoreCase);
151 htmlstring = Regex.Replace(htmlstring, @"&(nbsp|#160);", " ", RegexOptions.IgnoreCase);
152 htmlstring = Regex.Replace(htmlstring, @"&(iexcl|#161);", "\xa1", RegexOptions.IgnoreCase);
153 htmlstring = Regex.Replace(htmlstring, @"&(cent|#162);", "\xa2", RegexOptions.IgnoreCase);
154 htmlstring = Regex.Replace(htmlstring, @"&(pound|#163);", "\xa3", RegexOptions.IgnoreCase);
155 htmlstring = Regex.Replace(htmlstring, @"&(copy|#169);", "\xa9", RegexOptions.IgnoreCase);
156 htmlstring = Regex.Replace(htmlstring, @"&#(\d+);", "", RegexOptions.IgnoreCase);
157
158 htmlstring.Replace("<", "");
159 htmlstring.Replace(">", "");
160 htmlstring.Replace("\r\n", "");
161
162 return htmlstring.Trim();
163 }
164
170 public static string ToTxt(this string htmlBlock)
171 {
172 var builder = new StringBuilder(htmlBlock);
173 builder.Replace("&nbsp;", " ");
174 builder.Replace("<br>", "\r\n");
175 builder.Replace("<br>", "\n");
176 builder.Replace("<br />", "\n");
177 builder.Replace("<br />", "\r\n");
178 builder.Replace("&lt;", "<");
179 builder.Replace("&gt;", ">");
180 builder.Replace("&amp;", "&");
181 return builder.ToString();
182 }
183
189 public static string ToHtml(this string strTxt)
190 {
191 var sb = new StringBuilder(strTxt);
192 sb.Replace("&", "&amp;");
193 sb.Replace("<", "&lt;");
194 sb.Replace(">", "&gt;");
195 sb.Replace("\r\n", "<br />");
196 sb.Replace("\n", "<br />");
197 sb.Replace("\t", " ");
198 return sb.ToString();
199 }
200
201 #endregion
202
203 #region url及参数处理
204
210 public static string AsEncodeUrl(this string urlString) =>
211 Uri.EscapeDataString(urlString);
212
218 public static string AsDecodeUrl(this string urlString) =>
219 Uri.UnescapeDataString(urlString);
220
226 public static string ToUrlSearch(this IDictionary<string, string> data)
227 {
228 var builder = new StringBuilder();
229 foreach (var item in data)
230 builder.Append(Uri.EscapeDataString(item.Key) + "=" + Uri.EscapeDataString(item.Value) + "&");
231
232 return builder.ToString().TrimEnd('&');
233 }
234
240 public static IDictionary<string, string> ToUrlDictionary(this string url)
241 {
242 var result = new Dictionary<string, string>();
243 string[] arrData = Uri.UnescapeDataString(url).Split('&');
244 foreach (var item in arrData)
245 {
246 if (item.IndexOf("=") != -1)
247 result.Add(item.Split('=')[0], item.Split('=')[1]);
248 }
249
250 return result;
251 }
252
253 #endregion
254
255 #region 掩码
256
263 public static string Mask(this string str, char mask = '*')
264 {
265 str = str.Trim();
266 string masks = mask.ToString().PadLeft(4, mask);
267 if (str.Length >= 11)
268 return Regex.Replace(str, "(.{3}).*(.{4})", $"$1{masks}$2");
269 else if (str.Length == 10)
270 return Regex.Replace(str, "(.{3}).*(.{3})", $"$1{masks}$2");
271 else if (str.Length == 9)
272 return Regex.Replace(str, "(.{2}).*(.{3})", $"$1{masks}$2");
273 else if (str.Length == 8)
274 return Regex.Replace(str, "(.{2}).*(.{2})", $"$1{masks}$2");
275 else if (str.Length == 7)
276 return Regex.Replace(str, "(.{1}).*(.{2})", $"$1{masks}$2");
277 else if (str.Length == 6)
278 return Regex.Replace(str, "(.{1}).*(.{1})", $"$1{masks}$2");
279 else
280 return Regex.Replace(str, "(.{1}).*", $"$1{masks}");
281 }
282
283 #endregion
284
285 #region 判断是否包含
286
293 public static string JoinSplitter(this string str, string splitter = ",")
294 {
295 if (!str.StartsWith(splitter))
296 str = splitter + str;
297 if (!str.EndsWith(splitter))
298 str = str + splitter;
299
300 return str;
301 }
302
311 public static bool ContainsWithSplitter(this string source, string target, string splitter = ",")
312 {
313 return source.JoinSplitter(splitter).Contains(target.JoinSplitter(splitter));
314 }
315
316 #endregion
317
318 }
319 }
System
SinGooCMS.Utility.Extension.StringExtension.ToUrlSearch
static string ToUrlSearch(this IDictionary< string, string > data)
字典转url查询部分
Definition: StringExtension.cs:226
SinGooCMS.Utility.Extension.StringExtension.ContainsWithSplitter
static bool ContainsWithSplitter(this string source, string target, string splitter=",")
是否包含,如"1,2,34,5".ContainsWithSplitter("3")=false
Definition: StringExtension.cs:311
SinGooCMS.Utility.Extension.StringExtension.Mask
static string Mask(this string str, char mask= '*')
字符串掩码
Definition: StringExtension.cs:263
SinGooCMS.Utility.Extension.StringExtension.ToHtml
static string ToHtml(this string strTxt)
把TXT代码转换成HTML格式
Definition: StringExtension.cs:189
SinGooCMS.Utility.Extension.StringExtension.RemoveWhiteSpace
static string RemoveWhiteSpace(this string strInput)
去除空格
Definition: StringExtension.cs:108
SinGooCMS
SinGooCMS.Utility.Extension.StringExtension.JoinSplitter
static string JoinSplitter(this string str, string splitter=",")
加入分割符
Definition: StringExtension.cs:293
SinGooCMS.Utility.Extension.StringExtension.RemoveHtml
static string RemoveHtml(this string htmlstring)
清除html脚本
Definition: StringExtension.cs:137
SinGooCMS.Utility.Extension.StringExtension
字符串扩展
Definition: StringExtension.cs:11
SinGooCMS.Utility.Extension.StringExtension.ToUrlDictionary
static IDictionary< string, string > ToUrlDictionary(this string url)
url查询转字典
Definition: StringExtension.cs:240
SinGooCMS.Utility.Extension.StringExtension.ToTxt
static string ToTxt(this string htmlBlock)
把HTML代码转换成TXT格式
Definition: StringExtension.cs:170
SinGooCMS.Utility.Extension.StringExtension.ToRMB
static string ToRMB(this decimal decMoney)
转化为大写的人民币
Definition: StringExtension.cs:20


SinGooCMS.Utility: SinGooCMS.Utility/String/StringUtils.cs 源文件

  • 文件列表
  • SinGooCMS.Utility
  • String
StringUtils.cs
浏览该文件的文档.
1 using System;
2 using System.Text;
3 using System.Text.RegularExpressions;
4 using Microsoft.International.Converters.PinYinConverter;
5 using SinGooCMS.Utility.Extension;
6 #if NETSTANDARD2_1
7 using Microsoft.International.Converters.TraditionalChineseToSimplifiedConverter;
8 #else
9 using Microsoft.International.Converters.TraditionalChineseToSimplifiedConverter;
10 #endif
11
12 namespace SinGooCMS.Utility
13 {
17 public sealed class StringUtils
18 {
19 #region 获取汉字拼音的第一个字母
20
26 public static string GetChineseSpellFirst(string strText)
27 {
28 var builder = new StringBuilder();
29 strText.ToCharArray().ForEach((p) =>
30 {
31 builder.Append(GetChineseSpell(p.ToString()).Substring(0, 1));
32 });
33
34 return builder.ToString();
35 }
36
42 public static string GetChineseSpell(string strText)
43 {
44 string py = "";
45 var builder = new StringBuilder();
46 strText.ToCharArray().ForEach((p) =>
47 {
48 if (!ChineseChar.IsValidChar(p))
49 builder.Append(p.ToString()); //不是有效的汉字，原字输出
50 else
51 {
52 var chineseChar = new ChineseChar(p);
53 if (chineseChar.PinyinCount > 0)
54 {
55 py = chineseChar.Pinyins[0].ToString();
56 builder.Append(py.Substring(0, py.Length - 1));
57 }
58 else
59 builder.Append(p.ToString());
60 }
61 });
62
63 return builder.ToString();
64 }
65
66 #endregion
67
68 #region 简繁转换
69
75 public static string GetTraditional(string str)
76 {
77 #if NETSTANDARD2_1
78 return ChineseConverter.Convert(str, ChineseConversionDirection.SimplifiedToTraditional);//转繁体
79 #else
80 return ChineseConverter.Convert(str, ChineseConversionDirection.SimplifiedToTraditional);//转繁体
81 #endif
82
83 }
84
90 public static string GetSimplified(string str)
91 {
92 #if NETSTANDARD2_1
93 return ChineseConverter.Convert(str, ChineseConversionDirection.TraditionalToSimplified);//转简体
94 #else
95 return ChineseConverter.Convert(str, ChineseConversionDirection.TraditionalToSimplified);//转简体
96 #endif
97 }
98
99 #endregion
100
101 #region 截取字符串
102
110 public static string Cut(string sourceStr, int len, string appendString = "...")
111 {
112 return sourceStr.Length >= len
113 ? sourceStr.Substring(0, len) + appendString
114 : sourceStr;
115 }
116
124 public static string Cut(string source, string begin, string end)
125 {
126 string sub;
127 sub = source.Substring(source.IndexOf(begin) + begin.Length);
128 sub = sub.Substring(0, sub.IndexOf(end));
129 return sub;
130 }
131
136 public static int GetStringLength(string str) =>
137 Encoding.Default.GetBytes(str).Length;
138
139 #endregion
140
141 #region 处理字符
142
147 public static string Compress(string strHTML)
148 {
149 strHTML = Regex.Replace(strHTML, @">\s+\r", ">");
150 strHTML = Regex.Replace(strHTML, @">\s+\n", ">");
151 strHTML = Regex.Replace(strHTML, @">\s+<", "><");
152
153 return strHTML;
154 }
155
159 public static string ChkSQL(string str)
160 {
161 /*
162 * 在执行拼接sql语句时需要特别注意 sql注入
163 * 如 ExecSQL(" select * from Student where UserName='"+inputVal+"' ");
164 * 假如 inputVal="';use master;exec sp_addlogin 'admin','123';select '1";
165 * 那么sql语句相当于：select * from Student where UserName='';use master;exec sp_addlogin 'admin','123';select '1'
166 * 解决的办法：1）参数化 2）替换单引号 在SQL查询中两个单引号表示 一个单引号
167 */
168
169 return str.Replace("'", "''");
170 }
171
172 #endregion
173
174 #region 正则分割
175
183 public static string[] Split(string input, string pattern, bool ignoreCase = false)
184 {
185 return ignoreCase
186 ? Regex.Split(input, pattern, RegexOptions.IgnoreCase)
187 : Regex.Split(input, pattern);
188 }
189
190 #endregion
191
192 #region 随机数
193
198 public static string GetNewFileName() =>
199 DateTime.Now.ToString("yyyyMMdd") + GetRandomString(12);
200
205 public static string GetRandomNumber(int length = 10) =>
206 GetRandomString(length, "", true, false, false, false);
207
218 public static string GetRandomString(int length = 10, string custom = "", bool useNum = true, bool useLow = true, bool useUpp = true, bool useSpe = false)
219 {
220 byte[] b = new byte[4];
221 new System.Security.Cryptography.RNGCryptoServiceProvider().GetBytes(b);
222 Random r = new Random(BitConverter.ToInt32(b, 0));
223 var builder = new StringBuilder();
224 if (!custom.IsNullOrEmpty())
225 builder.Append(custom);
226
227 if (useNum == true) { builder.Append("0123456789"); }
228 if (useLow == true) { builder.Append("abcdefghijklmnopqrstuvwxyz"); }
229 if (useUpp == true) { builder.Append("ABCDEFGHIJKLMNOPQRSTUVWXYZ"); }
230 if (useSpe == true) { builder.Append("!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~"); }
231 string str = builder.ToString();
232
233 var builder2 = new StringBuilder();
234 for (int i = 0; i < length; i++)
235 {
236 builder2.Append(str.Substring(r.Next(0, str.Length - 1), 1));
237 }
238 return builder2.ToString();
239 }
240
245 public static string GetGUID()
246 {
247 return System.Guid.NewGuid().ToString().Replace("-", "");
248 }
249 #endregion
250
251 #region 返回分类前缀
252
258 public static string GetSpaceChar(int depth)
259 {
260 StringBuilder builder = new StringBuilder();
261 for (int i = 0; i < depth; i++)
262 {
263 builder.Append(System.Web.HttpUtility.HtmlDecode("&nbsp;&nbsp;"));
264 }
265 return builder.ToString();
266 }
267
274 public static string GetCatePrefix(int intDept, bool boolIsEnd)
275 {
276 char ch = '\x00a0';
277 StringBuilder builder = new StringBuilder();
278 for (int i = 0; i < intDept; i++)
279 {
280 builder.Append(ch);
281 }
282 if (boolIsEnd)
283 builder.Append("└");
284 else
285 builder.Append("├");
286
287 return builder.ToString();
288 }
289 #endregion
290
291 #region 生成编号
292
293 private const string FULLFOMART = "${year}${month}${day}${hour}${minute}${second}${millisecond}${rnd}";
294 private const string NORMALFORMAT = "${year}${month}${day}${millisecond}${rnd}";
295 private const string SHORTFORMAT = "${year}${month}${day}${rnd}";
296
297 public enum SNType
298 {
299 FULLFOMART,
300 NORMALFORMAT,
301 SHORTFORMAT
302 }
303
309 public static string GenerateSN(string SNFormat, SNType? snType = null)
310 {
311 if (SNFormat.IsNullOrEmpty() && snType == null)
312 return null;
313
314 if (SNFormat.IsNullOrEmpty() && snType != null)
315 {
316 switch (snType)
317 {
318 case SNType.FULLFOMART:
319 SNFormat = FULLFOMART;
320 break;
321 case SNType.NORMALFORMAT:
322 SNFormat = NORMALFORMAT;
323 break;
324 case SNType.SHORTFORMAT:
325 SNFormat = SHORTFORMAT;
326 break;
327 }
328 }
329
330 return SNFormat.Replace("${year}", System.DateTime.Now.ToString("yyyy")).Replace("${month}", System.DateTime.Now.ToString("MM"))
331 .Replace("${day}", System.DateTime.Now.ToString("dd")).Replace("${hour}", System.DateTime.Now.ToString("HH"))
332 .Replace("${minute}", System.DateTime.Now.ToString("mm")).Replace("${second}", System.DateTime.Now.ToString("ss"))
333 .Replace("${millisecond}", System.DateTime.Now.ToString("ffff")).Replace("${rnd}", StringUtils.GetRandomString(3));
334
335 }
336 #endregion
337
338 #region 生成uri地址
339
346 public static Uri GenerateUri(string[] parameters, string protocol = "http://")
347 {
348 if (protocol.IndexOf("://") == -1)
349 protocol += "://";
350
351 var builder = new StringBuilder(protocol);
352 for (var i = 0; i < parameters.Length; i++)
353 {
354 if (i == parameters.Length - 1)
355 builder.Append(parameters[i].Replace("//", "/").TrimStart('/').TrimEnd('/'));
356 else
357 builder.Append(parameters[i].Replace("//", "/").TrimStart('/').TrimEnd('/') + "/");
358 }
359
360 return new Uri(builder.ToString());
361 }
362
363 #endregion
364 }
365 }
SinGooCMS.Utility.StringUtils.GenerateUri
static Uri GenerateUri(string[] parameters, string protocol="http://")
生成uri地址
Definition: StringUtils.cs:346
SinGooCMS.Utility.StringUtils.Cut
static string Cut(string source, string begin, string end)
截取中间一段字符串
Definition: StringUtils.cs:124
SinGooCMS.Utility.StringUtils.Cut
static string Cut(string sourceStr, int len, string appendString="...")
截取字符串
Definition: StringUtils.cs:110
SinGooCMS.Utility.StringUtils.GetChineseSpellFirst
static string GetChineseSpellFirst(string strText)
获取汉字拼音的首字母
Definition: StringUtils.cs:26
SinGooCMS.Utility.StringUtils.SNType
SNType
Definition: StringUtils.cs:297
SinGooCMS.Utility
Definition: Accessor.cs:6
System
SinGooCMS.Utility.StringUtils.GetTraditional
static string GetTraditional(string str)
简体转换为繁体
Definition: StringUtils.cs:75
SinGooCMS.Utility.StringUtils.GenerateSN
static string GenerateSN(string SNFormat, SNType?snType=null)
按年月随机数生成编号${year}${month}${day}${hour}${minute}${second}${millisecond}${rnd} ...
Definition: StringUtils.cs:309
SinGooCMS.Utility.StringUtils.GetChineseSpell
static string GetChineseSpell(string strText)
获取汉字拼音
Definition: StringUtils.cs:42
SinGooCMS.Utility.Extension
Definition: AssemblyExtensions.cs:8
SinGooCMS.Utility.StringUtils.ChkSQL
static string ChkSQL(string str)
替换单引号到双引号
Definition: StringUtils.cs:159
SinGooCMS.Utility.StringUtils.GetSimplified
static string GetSimplified(string str)
繁体转换为简体
Definition: StringUtils.cs:90
SinGooCMS.Utility.StringUtils.GetRandomString
static string GetRandomString(int length=10, string custom="", bool useNum=true, bool useLow=true, bool useUpp=true, bool useSpe=false)
Definition: StringUtils.cs:218
SinGooCMS.Utility.StringUtils.GetSpaceChar
static string GetSpaceChar(int depth)
返回空格
Definition: StringUtils.cs:258
SinGooCMS.Utility.StringUtils.Split
static string[] Split(string input, string pattern, bool ignoreCase=false)
在由正则表达式模式定义的位置拆分输入字符串。
Definition: StringUtils.cs:183
SinGooCMS.Utility.StringUtils.GetGUID
static string GetGUID()
生成GUID
Definition: StringUtils.cs:245
SinGooCMS.Utility.StringUtils.Compress
static string Compress(string strHTML)
压缩HTML
Definition: StringUtils.cs:147
SinGooCMS
SinGooCMS.Utility.StringUtils
字符串处理
Definition: StringUtils.cs:17
SinGooCMS.Utility.StringUtils.GetCatePrefix
static string GetCatePrefix(int intDept, bool boolIsEnd)
返回分类前缀
Definition: StringUtils.cs:274


SinGooCMS.Utility: SinGooCMS.Utility/System/SystemUtils.cs 源文件

  • 文件列表
  • SinGooCMS.Utility
  • System
SystemUtils.cs
浏览该文件的文档.
1 using System;
2 using System.Collections.Generic;
3 using System.Text;
4 using System.IO;
5 using System.Web;
6 using System.Runtime.InteropServices;
7 using System.Text.RegularExpressions;
8 using System.Diagnostics;
9
10 namespace SinGooCMS.Utility
11 {
15 public sealed class SystemUtils
16 {
20 public static TimeSpan GetProcessStartupDuration() =>
21 DateTime.Now.Subtract(Process.GetCurrentProcess().StartTime);
22
23 #region 系统目录
24
28 public static string Desktop =>
29 Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
30
34 public static string Favorites =>
35 Environment.GetFolderPath(Environment.SpecialFolder.Favorites);
36
40 public static string MyDocuments =>
41 Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
42
46 public static string BaseDir => AppDomain.CurrentDomain.BaseDirectory;
47
48 #endregion
49
50 #region 判断浏览器客户端来源
51
56 public static Lazy<string> UserAgent => new Lazy<string>(() =>
57 {
58 #if NETSTANDARD2_1
59 return UtilsBase.Request.Headers["User-Agent"].ToString();
60 #else
61 return UtilsBase.Request.UserAgent;
62 #endif
63 });
64
69 public static Lazy<bool> IsMobileClient => new Lazy<bool>(() =>
70 {
71 string mobileUserAgent = "iphone|android|nokia|zte|huawei|lenovo|samsung|motorola|sonyericsson|lg|philips|gionee|htc|coolpad|symbian|sony|ericsson|mot|cmcc|iemobile|sgh|panasonic|alcatel|cldc|midp|wap|mobile|blackberry|windows ce|mqqbrowser|ucweb";
72 Regex MOBILE_REGEX = new Regex(mobileUserAgent, RegexOptions.IgnoreCase | RegexOptions.Compiled);
73 if (!string.IsNullOrEmpty(UserAgent.Value) && MOBILE_REGEX.IsMatch(UserAgent.Value.ToLower()))
74 return true;
75
76 return false;
77 });
78
83 public static Lazy<bool> IsWeixinClient => new Lazy<bool>(() => UserAgent.Value.ToLower().IndexOf("micromessenger") != -1);
84
89 public static Lazy<bool> IsMacClient => new Lazy<bool>(() => UserAgent.Value.ToLower().IndexOf("macintosh") != -1);
90
95 public static Lazy<bool> IsIphone => new Lazy<bool>(() => UserAgent.Value.ToLower().IndexOf("iphone") != -1);
96
101 public static Lazy<bool> IsAndroid => new Lazy<bool>(() => UserAgent.Value.ToLower().IndexOf("android") != -1);
102
103
104 #endregion
105
106 #if NETSTANDARD2_1
107 public static Lazy<bool> IsWindows => new Lazy<bool>(() => RuntimeInformation.IsOSPlatform(OSPlatform.Windows));
114 public static Lazy<bool> IsLinux => new Lazy<bool>(() => RuntimeInformation.IsOSPlatform(OSPlatform.Linux));
118 public static Lazy<bool> IsMacOs => new Lazy<bool>(() => RuntimeInformation.IsOSPlatform(OSPlatform.OSX));
119 #endif
120
126 public static string GetMapPath(string path = "/")
127 {
128 /*
129 * 1）windows系统支持 /和\两种路径，最终是\，如f:\abc.txt
130 * 2）linux系统只支持 /一种路径，认为\路径不合法，如/etc/home/wwwroot，因此路径都转成/
131 * 3）net framework不支持跨平台，不用考虑linux
132 */
133
134 #if NETSTANDARD2_1
135 if (IsLinux.Value)
136 return FileUtils.Combine(AppDomain.CurrentDomain.BaseDirectory, path).Replace(@"\", "/");
137
138 return FileUtils.Combine(AppDomain.CurrentDomain.BaseDirectory, path).Replace("/", @"\");
139 #else
140 return System.Web.HttpContext.Current != null
141 ? System.Web.HttpContext.Current.Server.MapPath(path).Replace("/",@"\")
142 : FileUtils.Combine(AppDomain.CurrentDomain.BaseDirectory, path).Replace("/",@"\");
143 #endif
144 }
145 }
146 }
System
SinGooCMS


SinGooCMS.Utility: SinGooCMS.Utility/Extension/TaskExtensions.cs 源文件

  • 文件列表
  • SinGooCMS.Utility
  • Extension
TaskExtensions.cs
浏览该文件的文档.
1 using System;
2 using System.Collections.Generic;
3 using System.Diagnostics;
4 using System.Runtime.CompilerServices;
5 using System.Threading;
6 using System.Threading.Tasks;
7
8 namespace SinGooCMS.Utility.Extension
9 {
13 public static class TaskExtensions
14 {
18 public static async Task<T> TimeoutAfter<T>(this Task<T> task, TimeSpan timeout)
19 {
20 await TimeoutAfterImpl(task, timeout).ConfigureAwait(false);
21 return task.Result;
22 }
23
27 public static async Task<IEnumerable<Task<T>>> TimeoutAfter<T>(
28 this IEnumerable<Task<T>> tasks, TimeSpan timeout)
29 {
30 await TimeoutAfterImpl(tasks, timeout).ConfigureAwait(false);
31 return tasks;
32 }
33
37 public static async Task TimeoutAfter(this Task task, TimeSpan timeout) =>
38 await TimeoutAfterImpl(task, timeout).ConfigureAwait(false);
39
43 public static async Task TimeoutAfter(this IEnumerable<Task> tasks, TimeSpan timeout) =>
44 await TimeoutAfterImpl(tasks, timeout).ConfigureAwait(false);
45
49 public static async Task ForEachInOrder<T>(this IEnumerable<Task<T>> tasks, Action<T> action)
50 {
51 if (tasks is null) { throw new ArgumentNullException(nameof(tasks)); }
52
53 foreach (var task in tasks)
54 {
55 var value = await task.ConfigureAwait(false);
56 action(value);
57 }
58 }
59
63 public static async Task ForEachInOrder(this IEnumerable<Task> tasks, Action<Task> action)
64 {
65 if (tasks is null) { throw new ArgumentNullException(nameof(tasks)); }
66
67 foreach (var task in tasks)
68 {
69 await task.ConfigureAwait(false);
70 action(task);
71 }
72 }
73
88 public static TaskAwaiter<T[]> GetAwaiter<T>(this IEnumerable<Task<T>> tasks) =>
89 Task.WhenAll(tasks).GetAwaiter();
90
103 public static TaskAwaiter GetAwaiter(this IEnumerable<Task> tasks) =>
104 Task.WhenAll(tasks).GetAwaiter();
105
106 #region Exception Handling
107 public static Task HandleExceptions(this Task task, Action<Exception> exceptionsHandler)
127 {
128 return task.ContinueWith(t =>
129 {
130 var aggEx = t.Exception;
131
132 if (aggEx is null) { return; }
133
134 aggEx.Flatten().Handle(ie =>
135 {
136 exceptionsHandler(ie);
137 return true;
138 });
139 },
140 CancellationToken.None,
141 TaskContinuationOptions.ExecuteSynchronously,
142 TaskScheduler.Default);
143 }
144
152 public static Task HandleExceptions(
153 this Task task, Func<Exception, bool> exceptionPredicate, Action<Exception> exceptionHandler)
154 {
155 return task.ContinueWith(t =>
156 {
157 var aggEx = t.Exception;
158
159 if (aggEx is null) { return; }
160
161 aggEx.Flatten().Handle(ie =>
162 {
163 if (exceptionPredicate(ie))
164 {
165 exceptionHandler(ie);
166 return true;
167 }
168
169 return false;
170 });
171 },
172 CancellationToken.None,
173 TaskContinuationOptions.ExecuteSynchronously,
174 TaskScheduler.Default);
175 }
176
184 public static Task HandleException<T>(this Task task, Action<T> exceptionHandler)
185 where T : Exception
186 {
187 return task.ContinueWith(t =>
188 {
189 var aggEx = t.Exception;
190
191 if (aggEx is null) { return; }
192
193 aggEx.Flatten().Handle(ex =>
194 {
195 if (ex is T expectedException)
196 {
197 exceptionHandler(expectedException);
198 return true;
199 }
200
201 return false;
202 });
203 },
204 CancellationToken.None,
205 TaskContinuationOptions.ExecuteSynchronously,
206 TaskScheduler.Default);
207 }
208 #endregion
209
210 private static async Task TimeoutAfterImpl(this Task task, TimeSpan timeoutPeriod)
211 {
212 if (task is null) { throw new ArgumentNullException(nameof(task)); }
213
214 using (var cts = new CancellationTokenSource())
215 {
216 var timeoutTask = Task.Delay(timeoutPeriod, cts.Token);
217 var finishedTask = await Task.WhenAny(task, timeoutTask).ConfigureAwait(false);
218
219 if (finishedTask == timeoutTask)
220 {
221 throw new TimeoutException("Task timed out after: " + timeoutPeriod.ToString());
222 }
223
224 cts.Cancel();
225 }
226 }
227
228 private static async Task TimeoutAfterImpl(this IEnumerable<Task> tasks, TimeSpan timeoutPeriod)
229 {
230 if (tasks is null) { throw new ArgumentNullException(nameof(tasks)); }
231
232 using (var cts = new CancellationTokenSource())
233 {
234 var cToken = cts.Token;
235 var timeoutTask = Task.Delay(timeoutPeriod, cToken);
236 var tasksList = new List<Task>(tasks) { timeoutTask };
237
238 while (tasksList.Count > 0)
239 {
240 var finishedTask = await Task.WhenAny(tasksList).ConfigureAwait(false);
241
242 if (finishedTask == timeoutTask)
243 {
244 throw new TimeoutException("At least one of the tasks timed out after: " + timeoutPeriod.ToString());
245 }
246
247 tasksList.Remove(finishedTask);
248
249 if (tasksList.Count == 1 && tasksList[0] == timeoutTask) { break; }
250 }
251
252 cts.Cancel();
253 }
254 }
255 }
256 }
SinGooCMS.Utility.Extension.TaskExtensions.TimeoutAfterImpl
static async Task TimeoutAfterImpl(this IEnumerable< Task > tasks, TimeSpan timeoutPeriod)
Definition: TaskExtensions.cs:228
System
SinGooCMS.Utility.Extension.TaskExtensions
System.Threading.Tasks扩展类
Definition: TaskExtensions.cs:13
SinGooCMS.Utility.Extension.TaskExtensions.HandleExceptions
static Task HandleExceptions(this Task task, Func< Exception, bool > exceptionPredicate, Action< Exception > exceptionHandler)
使用exceptionHandler 处理当前任务预测 (exceptionPredicate ) 的异常, 如果exceptionPredicate 返回false...
Definition: TaskExtensions.cs:152
SinGooCMS
SinGooCMS.Utility.Extension.TaskExtensions.ForEachInOrder
static async Task ForEachInOrder(this IEnumerable< Task > tasks, Action< Task > action)
使用指定的逻辑顺序处理任务集合的返回结果
Definition: TaskExtensions.cs:63
SinGooCMS.Utility.Extension.TaskExtensions.TimeoutAfterImpl
static async Task TimeoutAfterImpl(this Task task, TimeSpan timeoutPeriod)
Definition: TaskExtensions.cs:210


SinGooCMS.Utility: SinGooCMS.Utility/Media/ThumbnailCutMode.cs 源文件

  • 文件列表
  • SinGooCMS.Utility
  • Media
ThumbnailCutMode.cs
浏览该文件的文档.
1 namespace SinGooCMS.Utility
2 {
6 public enum ThumbnailCutMode
7 {
11 LockHeight,
15 LockWidth,
19 Fixed,
23 Cut
24 }
25 }
SinGooCMS.Utility.ThumbnailCutMode.LockWidth
锁定宽度
SinGooCMS
SinGooCMS.Utility.ThumbnailCutMode.Fixed
固定宽高
SinGooCMS.Utility.ThumbnailCutMode.LockHeight
锁定高度
SinGooCMS.Utility.ThumbnailCutMode.Cut
裁剪
SinGooCMS.Utility.ThumbnailCutMode
ThumbnailCutMode
缩略图图像裁剪模式
Definition: ThumbnailCutMode.cs:6


SinGooCMS.Utility: SinGooCMS.Utility/Date/TimeUtils.cs 源文件

  • 文件列表
  • SinGooCMS.Utility
  • Date
TimeUtils.cs
浏览该文件的文档.
1 using System;
2
3 namespace SinGooCMS.Utility
4 {
8 public sealed class TimeUtils
9 {
16 public static string GetDateDiff(DateTime time1, DateTime time2)
17 {
18 string dateDiff = null;
19 try
20 {
21 TimeSpan ts = time2 - time1;
22 if (ts.Days >= 1)
23 {
24 dateDiff = time1.Month + "月" + time1.Day + "日";
25 }
26 else
27 {
28 if (ts.Hours > 1)
29 {
30 dateDiff = ts.Hours + "小时前";
31 }
32 else
33 {
34 dateDiff = ts.Minutes + "分钟前";
35 }
36 }
37 }
38 catch
39 {
40 // ignored
41 }
42 return dateDiff;
43 }
44
51 public static TimeSpan GetTimeSpan(DateTime time1, DateTime time2)
52 {
53 TimeSpan ts1 = new TimeSpan(time1.Ticks);
54 TimeSpan ts2 = new TimeSpan(time2.Ticks);
55 TimeSpan ts = ts1.Subtract(ts2).Duration();
56 return ts;
57 }
58 }
59 }
System
SinGooCMS.Utility.TimeUtils.GetDateDiff
static string GetDateDiff(DateTime time1, DateTime time2)
返回时间差
Definition: TimeUtils.cs:16
SinGooCMS
SinGooCMS.Utility.TimeUtils
时间工具
Definition: TimeUtils.cs:8
SinGooCMS.Utility.TimeUtils.GetTimeSpan
static TimeSpan GetTimeSpan(DateTime time1, DateTime time2)
获得两个日期的间隔
Definition: TimeUtils.cs:51


SinGooCMS.Utility: SinGooCMS.Utility/Extension/TypeExtensions.cs 源文件

  • 文件列表
  • SinGooCMS.Utility
  • Extension
TypeExtensions.cs
浏览该文件的文档.
1 using System;
2 using System.Collections.Concurrent;
3 using System.Collections.Generic;
4 using System.Collections.ObjectModel;
5 using System.Linq;
6 using System.Reflection;
7
8 namespace SinGooCMS.Utility.Extension
9 {
13 public static class TypeExtensions
14 {
15 private static readonly Type[] SimpleTypes =
16 {
17 typeof(byte),
18 typeof(sbyte),
19 typeof(short),
20 typeof(ushort),
21 typeof(int),
22 typeof(uint),
23 typeof(long),
24 typeof(ulong),
25 typeof(float),
26 typeof(double),
27 typeof(decimal),
28 typeof(bool),
29 typeof(string),
30 typeof(char),
31 typeof(Guid),
32 typeof(DateTime),
33 typeof(DateTimeOffset),
34 typeof(TimeSpan),
35 typeof(byte[])
36 };
37
38 private static readonly Dictionary<string, SequenceType> NonGenericCollectionsToSequenceTypeMapping = new Dictionary<string, SequenceType>(StringComparer.Ordinal)
39 {
40 { "System.String", SequenceType.String },
41 { "System.Collections.ArrayList", SequenceType.ArrayList },
42 { "System.Collections.Queue", SequenceType.Queue },
43 { "System.Collections.Stack", SequenceType.Stack },
44 { "System.Collections.BitArray", SequenceType.BitArray },
45 { "System.Collections.SortedList", SequenceType.SortedList },
46 { "System.Collections.Hashtable", SequenceType.Hashtable },
47 { "System.Collections.Specialized.ListDictionary", SequenceType.ListDictionary },
48 { "System.Collections.IList", SequenceType.IList },
49 { "System.Collections.ICollection", SequenceType.ICollection },
50 { "System.Collections.IDictionary", SequenceType.IDictionary },
51 { "System.Collections.IEnumerable", SequenceType.IEnumerable }
52 };
53
62 public static bool TryGetInstanceProperty(this Type type, string propertyName, out PropertyInfo property, bool inherit = true)
63 {
64 var flags = BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public;
65 if (!inherit) { flags = flags | BindingFlags.DeclaredOnly; }
66
67 property = type.GetProperties(flags)
68 .FirstOrDefault(p => p.Name.Equals(propertyName, StringComparison.Ordinal));
69
70 return property != null;
71 }
72
81 public static PropertyInfo[] GetInstanceProperties(this Type type, bool inherit = true, bool includePrivate = true)
82 {
83 return GetInstanceProperties(type.GetTypeInfo(), inherit, includePrivate);
84 }
85
93 public static PropertyInfo[] GetInstanceProperties(this TypeInfo typeInfo, bool inherit, bool includePrivate)
94 {
95 var flags = BindingFlags.Instance | BindingFlags.Public;
96 if (includePrivate) { flags = flags | BindingFlags.NonPublic; }
97 if (!inherit) { flags = flags | BindingFlags.DeclaredOnly; }
98
99 return typeInfo.GetProperties(flags);
100 }
101
107 public static IEnumerable<PropertyInfo> GetPropertiesWithAttribute<T>(this Type type, bool inherit = true) where T : Attribute
108 {
109 return type.GetProperties()
110 .Where(prop => Attribute.IsDefined(prop, typeof(T)) && (prop.DeclaringType == type || inherit));
111 }
112
118 public static Dictionary<T, PropertyInfo> GetAttributeToPropertyMapping<T>(this Type type, bool inherit = true) where T : Attribute
119 {
120 var properties = type.GetProperties();
121 var result = new Dictionary<T, PropertyInfo>(properties.Length);
122 foreach (var property in properties)
123 {
124 var attributes = property.GetCustomAttributes<T>(inherit);
125 var attr = attributes.FirstOrDefault();
126 if (attr is null) { continue; }
127
128 result[attr] = property;
129 }
130 return result;
131 }
132
139 public static bool TryGetAttributes<T>(this Type type, out T[] attributes, bool inherit = true) where T : Attribute
140 {
141 var result = Attribute.GetCustomAttributes(type, typeof(T), inherit);
142
143 if (result.Length > 0)
144 {
145 attributes = result as T[];
146 return true;
147 }
148
149 attributes = null;
150 return false;
151 }
152
165 public static bool TryGetGenericArguments(this Type type, out Type[] genericArguments)
166 {
167 if (type.IsArray)
168 {
169 genericArguments = new[] { type.GetElementType() };
170 return true;
171 }
172
173 if (!type.IsGenericType)
174 {
175 genericArguments = null;
176 return false;
177 }
178
179 genericArguments = type.GetGenericArguments();
180 return true;
181 }
182
186 public static bool IsSequence(this Type type, out SequenceType sequenceType)
187 {
188 if (type.IsArray)
189 {
190 sequenceType = SequenceType.Array;
191 return true;
192 }
193
194 if (NonGenericCollectionsToSequenceTypeMapping.TryGetValue(type.FullName, out sequenceType))
195 {
196 return true;
197 }
198
199 if (type.FullName.StartsWith("System.Collections.Generic.List`1", StringComparison.Ordinal))
200 {
201 sequenceType = SequenceType.GenericList;
202 return true;
203 }
204
205 if (type.FullName.StartsWith("System.Collections.Generic.HashSet`1", StringComparison.Ordinal))
206 {
207 sequenceType = SequenceType.GenericHashSet;
208 return true;
209 }
210
211 if (type.FullName.StartsWith("System.Collections.ObjectModel.Collection`1", StringComparison.Ordinal))
212 {
213 sequenceType = SequenceType.GenericCollection;
214 return true;
215 }
216
217 if (type.FullName.StartsWith("System.Collections.Generic.LinkedList`1", StringComparison.Ordinal))
218 {
219 sequenceType = SequenceType.GenericLinkedList;
220 return true;
221 }
222
223 if (type.FullName.StartsWith("System.Collections.Generic.Stack`1", StringComparison.Ordinal))
224 {
225 sequenceType = SequenceType.GenericStack;
226 return true;
227 }
228
229 if (type.FullName.StartsWith("System.Collections.Generic.Queue`1", StringComparison.Ordinal))
230 {
231 sequenceType = SequenceType.GenericQueue;
232 return true;
233 }
234
235 if (type.FullName.StartsWith("System.Collections.Generic.IList`1", StringComparison.Ordinal))
236 {
237 sequenceType = SequenceType.GenericIList;
238 return true;
239 }
240
241 if (type.FullName.StartsWith("System.Collections.Generic.ICollection`1[[System.Collections.Generic.KeyValuePair`2", StringComparison.Ordinal))
242 {
243 sequenceType = SequenceType.GenericICollectionKeyValue;
244 return true;
245 }
246
247 if (type.FullName.StartsWith("System.Collections.Generic.ICollection`1", StringComparison.Ordinal))
248 {
249 sequenceType = SequenceType.GenericICollection;
250 return true;
251 }
252
253 if (type.FullName.StartsWith("System.Collections.Generic.IEnumerable`1[[System.Collections.Generic.KeyValuePair`2", StringComparison.Ordinal))
254 {
255 sequenceType = SequenceType.GenericIEnumerableKeyValue;
256 return true;
257 }
258
259 if (type.FullName.StartsWith("System.Collections.Generic.IEnumerable`1", StringComparison.Ordinal))
260 {
261 sequenceType = SequenceType.GenericIEnumerable;
262 return true;
263 }
264
265 if (type.FullName.StartsWith("System.Collections.Generic.Dictionary`2", StringComparison.Ordinal))
266 {
267 sequenceType = SequenceType.GenericDictionary;
268 return true;
269 }
270
271 if (type.FullName.StartsWith("System.Collections.Generic.SortedDictionary`2", StringComparison.Ordinal))
272 {
273 sequenceType = SequenceType.GenericSortedDictionary;
274 return true;
275 }
276
277 if (type.FullName.StartsWith("System.Collections.Generic.SortedList`2", StringComparison.Ordinal))
278 {
279 sequenceType = SequenceType.GenericSortedList;
280 return true;
281 }
282
283 if (type.FullName.StartsWith("System.Collections.Generic.IDictionary`2", StringComparison.Ordinal))
284 {
285 sequenceType = SequenceType.GenericIDictionary;
286 return true;
287 }
288
289 if (type.FullName.StartsWith("System.Collections.Generic.ICollection`2", StringComparison.Ordinal))
290 {
291 sequenceType = SequenceType.GenericIDictionary;
292 return true;
293 }
294
295 if (type.FullName.StartsWith("System.Collections.Concurrent.BlockingCollection`1", StringComparison.Ordinal))
296 {
297 sequenceType = SequenceType.GenericBlockingCollection;
298 return true;
299 }
300
301 if (type.FullName.StartsWith("System.Collections.Concurrent.ConcurrentBag`1", StringComparison.Ordinal))
302 {
303 sequenceType = SequenceType.GenericConcurrentBag;
304 return true;
305 }
306
307 if (type.FullName.StartsWith("System.Collections.Concurrent.ConcurrentDictionary`2[[", StringComparison.Ordinal))
308 {
309 sequenceType = SequenceType.GenericConcurrentDictionary;
310 return true;
311 }
312
313 var interfaces = type.GetInterfaces().ToArray();
314
315 if (interfaces.Any(i => i.Name.StartsWith("IEnumerable`1", StringComparison.Ordinal)))
316 {
317 sequenceType = SequenceType.GenericCustom;
318 return true;
319 }
320
321 if (interfaces.Any(i => i.Name.StartsWith("IEnumerable", StringComparison.Ordinal)))
322 {
323 sequenceType = SequenceType.Custom;
324 return true;
325 }
326
327 sequenceType = SequenceType.Invalid;
328 return false;
329 }
330
334 public static bool IsImplements<T>(this Type type)
335 {
336 return typeof(T).IsAssignableFrom(type);
337 }
338
342 public static bool HasDefaultConstructor(this Type type)
343 {
344 return type.IsValueType || type.GetConstructor(Type.EmptyTypes) != null;
345 }
346
376 public static bool IsSimpleType(this Type type)
377 {
378 var underlyingType = Nullable.GetUnderlyingType(type);
379 type = underlyingType ?? type;
380
381 return Array.IndexOf(SimpleTypes, type) > -1 || type.IsEnum;
382 }
383
387 public static bool IsArrayOf<T>(this Type type) => type == typeof(T[]);
388
392 public static bool IsGenericList(this Type type)
393 {
394 if (!type.IsGenericType) { return false; }
395
396 var typeDef = type.GetGenericTypeDefinition();
397
398 if (typeDef == typeof(List<>) || typeDef == typeof(IList<>)) { return true; }
399
400 return false;
401 }
402
406 public static bool IsNumeric(this Type type)
407 {
408 if (type is null) { return false; }
409
410 var underlyingType = Nullable.GetUnderlyingType(type) ?? type;
411 if (underlyingType.GetTypeInfo().IsEnum) { return false; }
412
413 // ReSharper disable once SwitchStatementMissingSomeCases
414 switch (underlyingType.GetTypeCode())
415 {
416 case TypeCode.Byte:
417 case TypeCode.Decimal:
418 case TypeCode.Double:
419 case TypeCode.Int16:
420 case TypeCode.Int32:
421 case TypeCode.Int64:
422 case TypeCode.SByte:
423 case TypeCode.Single:
424 case TypeCode.UInt16:
425 case TypeCode.UInt32:
426 case TypeCode.UInt64:
427 return true;
428 default:
429 return false;
430 }
431 }
432
436 public static TypeCode GetTypeCode(this Type type)
437 {
438 if (type == typeof(bool)) { return TypeCode.Boolean; }
439 if (type == typeof(char)) { return TypeCode.Char; }
440 if (type == typeof(sbyte)) { return TypeCode.SByte; }
441 if (type == typeof(byte)) { return TypeCode.Byte; }
442 if (type == typeof(short)) { return TypeCode.Int16; }
443 if (type == typeof(ushort)) { return TypeCode.UInt16; }
444 if (type == typeof(int)) { return TypeCode.Int32; }
445 if (type == typeof(uint)) { return TypeCode.UInt32; }
446 if (type == typeof(long)) { return TypeCode.Int64; }
447 if (type == typeof(ulong)) { return TypeCode.UInt64; }
448 if (type == typeof(float)) { return TypeCode.Single; }
449 if (type == typeof(double)) { return TypeCode.Double; }
450 if (type == typeof(decimal)) { return TypeCode.Decimal; }
451 if (type == typeof(DateTime)) { return TypeCode.DateTime; }
452 if (type == typeof(string)) { return TypeCode.String; }
453 // ReSharper disable once TailRecursiveCall
454 // ReSharper disable once ConvertIfStatementToReturnStatement
455 if (type.GetTypeInfo().IsEnum) { return Enum.GetUnderlyingType(type).GetTypeCode(); }
456 return TypeCode.Object;
457 }
458
470 public static string GetClassFullName(this Type type)
471 {
472 return classNamesCache.GetOrAdd(type, sun =>
473 {
474 var types = type.GetGenericArguments().ToList();
475 var parents = new List<Type>();
476 //获取所有父类型
477 GetParents(parents, type);
478 parents.Reverse();
479 //
480 var names = new List<string>();
481 var counter = 0;
482 for (var i = 0; i < parents.Count; i++)
483 {
484 var parent = parents[i];
485 var name = "";
486 if (shortNames.ContainsKey(parent))
487 {
488 name = shortNames[parent];
489 names.Add(name);
490 continue;
491 }
492 else
493 {
494 name = (i == 0 ? parent.Namespace + "." : "") + parent.Name.ToSpliterArray<string>('`').FirstOrDefault();
495 }
496
497 if (parent.IsGenericType)
498 {
499 var defs = parent.GetGenericTypeDefinition().GetGenericArguments();
500 var geneTypes = types.Take(defs.Length).Skip(counter)
501 .Select(p => shortNames.ContainsKey(p)
502 ? shortNames[p]
503 : (p.IsGenericParameter ? p.Name : GetClassFullName(p))
504 )
505 .ToSplitterString(",");
506
507 if (parent.IsNullable())
508 {
509 if (geneTypes.Length > 0) name = $"{geneTypes}?";
510 }
511 else
512 {
513 if (geneTypes.Length > 0) name += "<" + geneTypes + ">";
514 }
515
516 counter = defs.Length;
517 }
518 names.Add(name);
519 }
520 if (type.IsArray && !names.LastOrDefault().Contains("[]")) return names.ToSplitterString(".") + "[]";
521 return names.ToSplitterString(".");
522 });
523 }
524 private static void GetParents(List<Type> parents, Type type)
525 {
526 parents.Add(type);
527 if (type.IsArray)
528 {
529 var tmp = type.GetElementType();
530 if (tmp.DeclaringType != null) GetParents(parents, tmp.DeclaringType);
531 }
532 else if (type.DeclaringType != null)
533 {
534 GetParents(parents, type.DeclaringType);
535 }
536 }
537 private static Dictionary<Type, string> shortNames = new Dictionary<Type, string>()
538 {
539 { typeof(byte),"byte"},{ typeof(byte?),"byte?"},{ typeof(byte[]),"byte[]"},{ typeof(byte?[]),"byte?[]"},
540 { typeof(sbyte),"sbyte"},{ typeof(sbyte?),"sbyte?"},{ typeof(sbyte[]),"sbyte[]"},{ typeof(sbyte?[]),"sbyte?[]"},
541 { typeof(short),"short"},{ typeof(short?),"short?"},{ typeof(short[]),"short[]"},{ typeof(short?[]),"short?[]"},
542 { typeof(ushort),"ushort"},{ typeof(ushort?),"ushort?"},{ typeof(ushort[]),"ushort[]"},{ typeof(ushort?[]),"ushort?[]"},
543 { typeof(int),"int"},{ typeof(int?),"int?"},{ typeof(int[]),"int[]"},{ typeof(int?[]),"int?[]"},
544 { typeof(uint),"uint"},{ typeof(uint?),"uint?"},{ typeof(uint[]),"uint[]"},{ typeof(uint?[]),"uint?[]"},
545 { typeof(long),"long"},{ typeof(long?),"long?"},{ typeof(long[]),"long[]"},{ typeof(long?[]),"long?[]"},
546 { typeof(ulong),"ulong"},{ typeof(ulong?),"ulong?"},{ typeof(ulong[]),"ulong[]"},{ typeof(ulong?[]),"ulong?[]"},
547 { typeof(float),"float"},{ typeof(float?),"float?"},{ typeof(float[]),"float[]"},{ typeof(float?[]),"float?[]"},
548 { typeof(double),"double"},{ typeof(double?),"double?"},{ typeof(double[]),"double[]"},{ typeof(double?[]),"double?[]"},
549 { typeof(decimal),"decimal"},{ typeof(decimal?),"decimal?"},{ typeof(decimal[]),"decimal[]"},{ typeof(decimal?[]),"decimal?[]"},
550 { typeof(char),"char"},{ typeof(char?),"char?"},{ typeof(char[]),"char[]"},{ typeof(char?[]),"char?[]"},
551 { typeof(string),"string"},{ typeof(string[]),"string[]"},
552 { typeof(bool),"bool"},{ typeof(bool?),"bool?"},{ typeof(bool[]),"bool[]"},{ typeof(bool?[]),"bool?[]"},
553 };
554 private static ConcurrentDictionary<Type, string> classNamesCache = new ConcurrentDictionary<Type, string>();
555
560 public static bool IsNullable(this Type type)
561 {
562 if (type == null) return false;
563 return type.FullName.StartsWith("System.Nullable`1[");
564 }
565
570 public static object GetDefault(this Type type) => type.IsValueType ? Activator.CreateInstance(type) : null;
571 }
572
576 public enum SequenceType
577 {
581 Invalid = 0,
582
586 String,
587
591 Array,
592
596 BitArray,
597
601 ArrayList,
602
606 Queue,
607
611 Stack,
612
616 Hashtable,
617
621 SortedList,
622
626 Dictionary,
627
631 ListDictionary,
632
636 IList,
637
641 ICollection,
642
646 IDictionary,
647
651 IEnumerable,
652
656 Custom,
657
661 GenericList,
662
666 GenericLinkedList,
667
671 GenericCollection,
672
676 GenericQueue,
677
681 GenericStack,
682
686 GenericHashSet,
687
691 GenericSortedList,
692
696 GenericDictionary,
697
701 GenericSortedDictionary,
702
706 GenericBlockingCollection,
707
711 GenericConcurrentDictionary,
712
716 GenericConcurrentBag,
717
721 GenericIList,
722
726 GenericICollection,
727
731 GenericIEnumerable,
732
736 GenericIDictionary,
737
741 GenericICollectionKeyValue,
742
746 GenericIEnumerableKeyValue,
747
751 GenericCustom
752 }
753 }
SinGooCMS.Utility.Extension.TypeExtensions.TryGetInstanceProperty
static bool TryGetInstanceProperty(this Type type, string propertyName, out PropertyInfo property, bool inherit=true)
尝试反射返回给定type 的实例属性
Definition: TypeExtensions.cs:62
SinGooCMS.Utility.Extension.SequenceType.IDictionary
代表 System.Collections.IDictionary. 非泛型
SinGooCMS.Utility.Extension.SequenceType.Hashtable
代表 System.Collections.Hashtable. 非泛型
SinGooCMS.Utility.Extension.SequenceType.GenericICollectionKeyValue
代表 ICollection{KeyValuePair{TKey, TValue}}.
SinGooCMS.Utility.Extension.TypeExtensions.GetParents
static void GetParents(List< Type > parents, Type type)
Definition: TypeExtensions.cs:524
SinGooCMS.Utility.Extension.TypeExtensions.IsGenericList
static bool IsGenericList(this Type type)
判断当前类型是否是 List<> 或 IList<>
Definition: TypeExtensions.cs:392
SinGooCMS.Utility.Extension.SequenceType.Stack
代表 System.Collections.Stack. 非泛型
SinGooCMS.Utility.Extension.SequenceType.SortedList
代表 System.Collections.SortedList. 非泛型
SinGooCMS.Utility.Extension.SequenceType.GenericCustom
代表 自定义实现的 IEnumerable.
SinGooCMS.Utility.Extension.SequenceType.GenericIEnumerableKeyValue
代表 IEnumerable{KeyValuePair{TKey, TValue}}.
SinGooCMS.Utility.Extension.SequenceType.Array
代表 Array.
SinGooCMS.Utility.Extension.SequenceType.GenericCollection
代表 Collection.
SinGooCMS.Utility.Extension.SequenceType.String
代表 System.String.
System
SinGooCMS.Utility.Extension.SequenceType.BitArray
代表 System.Collections.BitArray. 非泛型
SinGooCMS.Utility.Extension.SequenceType.GenericIEnumerable
代表 IEnumerable.
SinGooCMS.Utility.Extension.TypeExtensions.HasDefaultConstructor
static bool HasDefaultConstructor(this Type type)
判断当前类型是否具有空参数构造函数
Definition: TypeExtensions.cs:342
SinGooCMS.Utility.Extension.SequenceType.Dictionary
代表 Dictionary. 非泛型
SinGooCMS.Utility.Extension.SequenceType.GenericIList
代表 IList.
SinGooCMS.Utility.Extension.TypeExtensions.GetInstanceProperties
static PropertyInfo[] GetInstanceProperties(this TypeInfo typeInfo, bool inherit, bool includePrivate)
根据条件返回所有能获取到的属性描述
Definition: TypeExtensions.cs:93
SinGooCMS.Utility.Extension.SequenceType
SequenceType
表示可能的序列类型(集合)
Definition: TypeExtensions.cs:576
SinGooCMS.Utility.Extension.TypeExtensions
Type扩展类
Definition: TypeExtensions.cs:13
SinGooCMS.Utility.Extension.SequenceType.GenericSortedList
代表 System.Collections.Generic.SortedList.
SinGooCMS.Utility.Extension.SequenceType.GenericICollection
代表 ICollection.
SinGooCMS.Utility.Extension.SequenceType.IEnumerable
代表n System.Collections.IEnumerable. 非泛型
SinGooCMS.Utility.Extension.SequenceType.GenericIDictionary
代表 IDictionary.
SinGooCMS.Utility.Extension.SequenceType.ArrayList
代表 System.Collections.ArrayList. 非泛型
SinGooCMS.Utility.Extension.SequenceType.ListDictionary
代表 ListDictionary. 非泛型
SinGooCMS.Utility.Extension.SequenceType.GenericSortedDictionary
代表 System.Collections.Generic.SortedDictionary.
SinGooCMS.Utility.Extension.SequenceType.GenericDictionary
代表 System.Collections.Generic.Dictionary.
SinGooCMS.Utility.Extension.SequenceType.Custom
代表 自己实现的 System.Collections.IEnumerable.
SinGooCMS.Utility.Extension.SequenceType.GenericBlockingCollection
代表 System.Collections.Concurrent.BlockingCollection.
SinGooCMS.Utility.Extension.SequenceType.GenericList
代表 System.Collections.Generic.List.
SinGooCMS.Utility.Extension.TypeExtensions.GetClassFullName
static string GetClassFullName(this Type type)
获取当前类型的名称,如: typeof(List<>) => System.Collections.Generic.List typeof(List) => S...
Definition: TypeExtensions.cs:470
SinGooCMS.Utility.Extension.TypeExtensions.GetInstanceProperties
static PropertyInfo[] GetInstanceProperties(this Type type, bool inherit=true, bool includePrivate=true)
尝试反射返回给定type 的实例属性
Definition: TypeExtensions.cs:81
SinGooCMS.Utility.Extension.TypeExtensions.TryGetGenericArguments
static bool TryGetGenericArguments(this Type type, out Type[] genericArguments)
如果当前类型具有泛型参数的话,就返回所有的泛型类型，代码示例：
Definition: TypeExtensions.cs:165
SinGooCMS.Utility.Extension.SequenceType.Invalid
不是一个序列类型
SinGooCMS.Utility.Extension.TypeExtensions.GetTypeCode
static TypeCode GetTypeCode(this Type type)
获取当前类型的TypeCode
Definition: TypeExtensions.cs:436
SinGooCMS.Utility.Extension.SequenceType.GenericLinkedList
代表 System.Collections.Generic.LinkedList.
SinGooCMS
SinGooCMS.Utility.Extension.SequenceType.GenericConcurrentDictionary
代表 System.Collections.Concurrent.ConcurrentDictionary.
SinGooCMS.Utility.Extension.TypeExtensions.IsNumeric
static bool IsNumeric(this Type type)
判断当前类型是否是数字类型(如: "int","int?" 均是数字类型 )
Definition: TypeExtensions.cs:406
SinGooCMS.Utility.Extension.SequenceType.Queue
代表 System.Collections.Queue. 非泛型
SinGooCMS.Utility.Extension.SequenceType.ICollection
代表 System.Collections.ICollection. 非泛型
SinGooCMS.Utility.Extension.SequenceType.GenericQueue
代表 System.Collections.Generic.Queue.
SinGooCMS.Utility.Extension.TypeExtensions.IsSequence
static bool IsSequence(this Type type, out SequenceType sequenceType)
判断当前类型是否是序列(数组、集合) 注意：包括字符串
Definition: TypeExtensions.cs:186
SinGooCMS.Utility.Extension.SequenceType.GenericStack
代表 System.Collections.Generic.Stack.
SinGooCMS.Utility.Extension.SequenceType.IList
代表 System.Collections.IList. 非泛型
SinGooCMS.Utility.Extension.TypeExtensions.IsSimpleType
static bool IsSimpleType(this Type type)
判断当前类型是否是简单类型
Definition: TypeExtensions.cs:376
SinGooCMS.Utility.Extension.SequenceType.GenericConcurrentBag
代表 System.Collections.Concurrent.ConcurrentBag.
SinGooCMS.Utility.Extension.SequenceType.GenericHashSet
代表 System.Collections.Generic.HashSet.
SinGooCMS.Utility.Extension.TypeExtensions.IsNullable
static bool IsNullable(this Type type)
是否是Nullable类型的
Definition: TypeExtensions.cs:560


SinGooCMS.Utility: SinGooCMS.Utility/Text/UnicodeUtils.cs 源文件

  • 文件列表
  • SinGooCMS.Utility
  • Text
UnicodeUtils.cs
浏览该文件的文档.
1 using System;
2 using System.Collections.Generic;
3 using System.Text;
4 using System.Text.RegularExpressions;
5 using SinGooCMS.Utility.Extension;
6
7 namespace SinGooCMS.Utility
8 {
14 public class UnicodeUtils
15 {
21 public static string Encode(string str)
22 {
23 if (str.IsNullOrEmpty()) return str;
24 StringBuilder strResult = new StringBuilder();
25 if (!string.IsNullOrEmpty(str))
26 {
27 for (int i = 0; i < str.Length; i++)
28 {
29 strResult.Append("\\u");
30 strResult.Append(((int)str[i]).ToString("x4"));
31 }
32 }
33 return strResult.ToString();
34 }
35
41 public static string Decode(string str)
42 {
43 if (str.IsNullOrEmpty()) return str;
44 //最直接的方法Regex.Unescape(str);
45 Regex reg = new Regex(@"(?i)\\[uU]([0-9a-f]{4})");
46 return reg.Replace(str, delegate (Match m) { return ((char)Convert.ToInt32(m.Groups[1].Value, 16)).ToString(); });
47 }
48 }
49 }
SinGooCMS.Utility
Definition: Accessor.cs:6
System
SinGooCMS.Utility.UnicodeUtils.Decode
static string Decode(string str)
Unicode解码
Definition: UnicodeUtils.cs:41
SinGooCMS.Utility.UnicodeUtils
unicode 编解码 "空\u0020格" => "空 格" "空 格" => "\u7a7a\u20\u683c"
Definition: UnicodeUtils.cs:14
SinGooCMS.Utility.Extension
Definition: AssemblyExtensions.cs:8
SinGooCMS
SinGooCMS.Utility.UnicodeUtils.Encode
static string Encode(string str)
Unicode编码
Definition: UnicodeUtils.cs:21


SinGooCMS.Utility: SinGooCMS.Utility/Extension/UriExtensions.cs 源文件

  • 文件列表
  • SinGooCMS.Utility
  • Extension
UriExtensions.cs
浏览该文件的文档.
1 using System;
2 using System.Collections.Generic;
3 using System.Linq;
4 using System.Net;
5 using System.Text.RegularExpressions;
6
7 namespace SinGooCMS.Utility.Extension
8 {
12 public static class UriExtension
13 {
14 private static readonly Regex QueryStringRegex = new Regex(@"[?|&]([%23\w\.-]+)=([^?|^&]+)", RegexOptions.Compiled);
15
22 public static IEnumerable<KeyValuePair<string, string>> ParseQueryString(this Uri uri)
23 {
24 var match = QueryStringRegex.Match(uri.OriginalString);
25 while (match.Success)
26 {
27 yield return new KeyValuePair<string, string>(
28 WebUtility.UrlDecode(match.Groups[1].Value),
29 WebUtility.UrlDecode(match.Groups[2].Value));
30 match = match.NextMatch();
31 }
32 }
33
34 #region 追加参数
35
43 public static Uri AddParametersToQueryString(this Uri uri, string parameter, string value)
44 {
45 var queryToAppend = string.Concat(WebUtility.UrlEncode(parameter), "=", WebUtility.UrlEncode(value));
46 return AddOrAppendToQueryString(uri, queryToAppend);
47 }
48
55 public static Uri AddParametersToQueryString(this Uri uri, IDictionary<string, string> pairs)
56 {
57 if (!pairs.Any()) { return uri; }
58
59 var keysAndVals = pairs.Select(kv => string.Concat(WebUtility.UrlEncode(kv.Key), "=", WebUtility.UrlEncode(kv.Value)));
60
61 return AddOrAppendToQueryString(uri, string.Join("&", keysAndVals));
62 }
63
64 private static Uri AddOrAppendToQueryString(Uri uri, string query)
65 {
66 var baseUri = new UriBuilder(uri);
67
68 if (baseUri.Query.Length > 1)
69 {
70 baseUri.Query = uri.Query.Substring(1) + "&" + query;
71 }
72 else
73 {
74 baseUri.Query = query;
75 }
76
77 return baseUri.Uri;
78 }
79
80 #endregion
81 }
82 }
System
SinGooCMS.Utility.Extension.UriExtension.AddParametersToQueryString
static Uri AddParametersToQueryString(this Uri uri, IDictionary< string, string > pairs)
将键和值的给定pairs 添加或附加到uri 的查询字符串中。
Definition: UriExtensions.cs:55
SinGooCMS.Utility.Extension.UriExtension.AddOrAppendToQueryString
static Uri AddOrAppendToQueryString(Uri uri, string query)
Definition: UriExtensions.cs:64
SinGooCMS.Utility.Extension.UriExtension
提供一组使用Uri的辅助方法。
Definition: UriExtensions.cs:12
SinGooCMS
SinGooCMS.Utility.Extension.UriExtension.ParseQueryString
static IEnumerable< KeyValuePair< string, string > > ParseQueryString(this Uri uri)
从查询字符串中提取参数和值。
Definition: UriExtensions.cs:22
SinGooCMS.Utility.Extension.UriExtension.AddParametersToQueryString
static Uri AddParametersToQueryString(this Uri uri, string parameter, string value)
添加或附加给定的parameter 和value 到uri 的查询字符串。
Definition: UriExtensions.cs:43


SinGooCMS.Utility: SinGooCMS.Utility/UtilsBase.cs 源文件

  • 文件列表
  • SinGooCMS.Utility
UtilsBase.cs
浏览该文件的文档.
1 using System;
2 #if NETSTANDARD2_1
3 using Microsoft.AspNetCore.Http;
4 #else
5 using System.Web;
6 #endif
7
8 namespace SinGooCMS.Utility
9 {
13 public sealed class UtilsBase
14 {
15 #if NETSTANDARD2_1
16
17 private static IHttpContextAccessor _accessor;
18
22 public static HttpContext HttpContext => _accessor?.HttpContext;
23
24 internal static void Configure(IHttpContextAccessor accessor)
25 {
26 _accessor = accessor;
27 }
28
32 public static HttpRequest Request => HttpContext?.Request;
33
37 public static HttpResponse Response => HttpContext?.Response;
38 #else
39
43 public static HttpContext HttpContext => System.Web.HttpContext.Current;
47 public static HttpRequest Request => System.Web.HttpContext.Current?.Request;
51 public static HttpResponse Response => System.Web.HttpContext.Current?.Response;
52
53 #endif
54 }
55 }
System
SinGooCMS.Utility.UtilsBase.HttpContext
static HttpContext HttpContext
http上下文
Definition: UtilsBase.cs:43
SinGooCMS
SinGooCMS.Utility.UtilsBase
工具底层，主要获取 http上下文 HttpContext。netfx从system.web中读取，core需要注入
Definition: UtilsBase.cs:13


SinGooCMS.Utility: SinGooCMS.Utility/Extension/ValidateExtension.cs 源文件

  • 文件列表
  • SinGooCMS.Utility
  • Extension
ValidateExtension.cs
浏览该文件的文档.
1 using System;
2 using System.Linq;
3 using System.Text.RegularExpressions;
4 using Newtonsoft.Json;
5
6 namespace SinGooCMS.Utility.Extension
7 {
11 public static class ValidateExtension
12 {
13 #region 判断
14
20 public static bool IsNullOrEmpty(this object thisValue)
21 {
22 return thisValue != null && thisValue.ToString().Trim().Length > 0
23 ? false
24 : true;
25 }
26
32 public static bool IsNullOrWhiteSpace(this object thisValue)
33 {
34 return thisValue != null && !string.IsNullOrWhiteSpace(thisValue.ToString())
35 ? false
36 : true;
37 }
38
44 public static bool IsNotNullOrEmpty(this object thisValue)
45 {
46 return thisValue != null && thisValue.ToString().Trim() != "" && !thisValue.ToString().Trim().IsNullOrWhiteSpace()
47 ? true
48 : false;
49 }
50
56 public static bool IsJson(this string txtJson)
57 {
58 return JsonConvert.DeserializeObject(txtJson) != null;
59 }
60
68 public static bool IsBetween(this int thisValue, int begin, int end)
69 {
70 return thisValue >= begin && thisValue <= end;
71 }
79 public static bool IsBetween(this decimal thisValue, decimal begin, decimal end)
80 {
81 return thisValue >= begin && thisValue <= end;
82 }
90 public static bool IsBetween(this DateTime thisValue, DateTime begin, DateTime end)
91 {
92 return thisValue >= begin && thisValue <= end;
93 }
94
100 public static bool IsInt(this string thisValue)
101 {
102 return thisValue.IsNullOrEmpty()
103 ? false
104 : Regex.IsMatch(thisValue, @"^\d+$");
105 }
111 public static bool IsNoInt(this string thisValue)
112 {
113 return !thisValue.IsInt();
114 }
115
121 public static bool IsGuid(this string thisValue)
122 {
123 return thisValue.IsNullOrEmpty()
124 ? false
125 : Guid.TryParse(thisValue, out _);
126 }
127
133 public static bool IsDate(this string thisValue)
134 {
135 return thisValue.IsNullOrEmpty()
136 ? false
137 : DateTime.TryParse(thisValue, out _);
138 }
139
145 public static bool IsEmail(this string thisValue)
146 {
147 return thisValue.IsNullOrEmpty()
148 ? false
149 : Regex.IsMatch(thisValue, @"\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*");
150 }
151
157 public static bool IsMobile(this string thisValue)
158 {
159 return thisValue.IsNullOrEmpty()
160 ? false
161 : Regex.IsMatch(thisValue, @"^\d{11}$");
162 }
163
169 public static bool IsTelephone(this string thisValue)
170 {
171 return thisValue.IsNullOrEmpty()
172 ? false
173 : Regex.IsMatch(thisValue, @"^(\(\d{3,4}\)|\d{3,4}-|\s)?\d{8}$");
174 }
175
181 public static bool IsIDCard(this string thisValue)
182 {
183 return thisValue.IsNullOrEmpty()
184 ? false
185 : Regex.IsMatch(thisValue, @"^(\d{15}$|^\d{18}$|^\d{17}(\d|X|x))$");
186 }
187
193 public static bool IsFax(this string thisValue)
194 {
195 return thisValue.IsNullOrEmpty()
196 ? false
197 : Regex.IsMatch(thisValue, @"^[+]{0,1}(\d){1,3}[ ]?([-]?((\d)|[ ]){1,12})+$");
198 }
199
206 public static bool IsMatch(this string thisValue, string pattern)
207 {
208 return thisValue.IsNullOrEmpty()
209 ? false
210 : new Regex(pattern).IsMatch(thisValue);
211 }
212
218 public static bool IsEn(this string thisValue)
219 {
220 return thisValue.IsNullOrEmpty()
221 ? false
222 : Regex.IsMatch(thisValue, @"^[a-zA-Z]+$");
223 }
224
230 public static bool IsZHCN(this string thisValue)
231 {
232 return thisValue.IsNullOrEmpty()
233 ? false
234 : Regex.IsMatch(thisValue, @"[\u4e00-\u9fa5]");
235 }
236
242 public static bool IsUrl(this string thisValue)
243 {
244 return thisValue.IsNullOrEmpty()
245 ? false
246 : Regex.IsMatch(thisValue, @"(ht|f)tp(s?)\:\/\/[0-9a-zA-Z]([-.\w]*[0-9a-zA-Z])*(:(0-9)*)*(\/?)([a-zA-Z0-9\-\.\?\,\'\/\\\+&amp;%\$#_]*)?");
247 }
248
254 public static bool IsIP(this string thisValue)
255 {
256 return thisValue.IsNullOrEmpty()
257 ? false
258 : Regex.IsMatch(thisValue, @"^((2[0-4]\d|25[0-5]|[01]?\d\d?)\.){3}(2[0-4]\d|25[0-5]|[01]?\d\d?)$");
259 }
260
266 public static bool IsDecimal(this string thisValue)
267 {
268 return thisValue.IsNullOrEmpty()
269 ? false
270 : Regex.IsMatch(thisValue, @"^[+-]?[0-9]+[.]?[0-9]+$");
271 }
272
278 public static bool IsImage(this string fileName)
279 {
280 return new string[] { ".jpg", ".jpeg", ".gif", ".png", ".bmp" }
281 .Contains(System.IO.Path.GetExtension(fileName).ToLower());
282 }
283
284 #endregion
285 }
286 }
SinGooCMS.Utility.Extension.ValidateExtension.IsGuid
static bool IsGuid(this string thisValue)
是否GUID
Definition: ValidateExtension.cs:121
SinGooCMS.Utility.Extension.ValidateExtension.IsIDCard
static bool IsIDCard(this string thisValue)
是否身份证号
Definition: ValidateExtension.cs:181
SinGooCMS.Utility.Extension.ValidateExtension.IsNullOrEmpty
static bool IsNullOrEmpty(this object thisValue)
是否null或者空字符串
Definition: ValidateExtension.cs:20
SinGooCMS.Utility.Extension.ValidateExtension.IsDate
static bool IsDate(this string thisValue)
是否日期
Definition: ValidateExtension.cs:133
SinGooCMS.Utility.Extension.ValidateExtension.IsNoInt
static bool IsNoInt(this string thisValue)
不是整数
Definition: ValidateExtension.cs:111
SinGooCMS.Utility.Extension.ValidateExtension.IsNotNullOrEmpty
static bool IsNotNullOrEmpty(this object thisValue)
非null而且有值（非空格）
Definition: ValidateExtension.cs:44
SinGooCMS.Utility.Extension.ValidateExtension.IsMobile
static bool IsMobile(this string thisValue)
是否手机号
Definition: ValidateExtension.cs:157
SinGooCMS.Utility.Extension.ValidateExtension.IsDecimal
static bool IsDecimal(this string thisValue)
是否小数
Definition: ValidateExtension.cs:266
SinGooCMS.Utility.Extension.ValidateExtension.IsImage
static bool IsImage(this string fileName)
根据文件后缀名来判断是否图片文件
Definition: ValidateExtension.cs:278
System
SinGooCMS.Utility.Extension.ValidateExtension.IsTelephone
static bool IsTelephone(this string thisValue)
是否电话
Definition: ValidateExtension.cs:169
SinGooCMS.Utility.Extension.ValidateExtension.IsZHCN
static bool IsZHCN(this string thisValue)
是否中文
Definition: ValidateExtension.cs:230
SinGooCMS.Utility.Extension.ValidateExtension.IsEmail
static bool IsEmail(this string thisValue)
是否邮件地址
Definition: ValidateExtension.cs:145
SinGooCMS.Utility.Extension.ValidateExtension.IsEn
static bool IsEn(this string thisValue)
是否英文
Definition: ValidateExtension.cs:218
SinGooCMS.Utility.Extension.ValidateExtension
验证扩展
Definition: ValidateExtension.cs:11
SinGooCMS.Utility.Extension.ValidateExtension.IsUrl
static bool IsUrl(this string thisValue)
是否URL
Definition: ValidateExtension.cs:242
SinGooCMS.Utility.Extension.ValidateExtension.IsInt
static bool IsInt(this string thisValue)
是否整数
Definition: ValidateExtension.cs:100
SinGooCMS
SinGooCMS.Utility.Extension.ValidateExtension.IsNullOrWhiteSpace
static bool IsNullOrWhiteSpace(this object thisValue)
是否null或者空格
Definition: ValidateExtension.cs:32
SinGooCMS.Utility.Extension.ValidateExtension.IsIP
static bool IsIP(this string thisValue)
是否IP
Definition: ValidateExtension.cs:254
SinGooCMS.Utility.Extension.ValidateExtension.IsMatch
static bool IsMatch(this string thisValue, string pattern)
是否匹配
Definition: ValidateExtension.cs:206
SinGooCMS.Utility.Extension.ValidateExtension.IsJson
static bool IsJson(this string txtJson)
判断是否json格式字符串
Definition: ValidateExtension.cs:56
SinGooCMS.Utility.Extension.ValidateExtension.IsBetween
static bool IsBetween(this int thisValue, int begin, int end)
是否在两者之间（包含）
Definition: ValidateExtension.cs:68
SinGooCMS.Utility.Extension.ValidateExtension.IsFax
static bool IsFax(this string thisValue)
是否传真
Definition: ValidateExtension.cs:193
SinGooCMS.Utility.Extension.ValidateExtension.IsBetween
static bool IsBetween(this decimal thisValue, decimal begin, decimal end)
是否在两者之间（包含）
Definition: ValidateExtension.cs:79
SinGooCMS.Utility.Extension.ValidateExtension.IsBetween
static bool IsBetween(this DateTime thisValue, DateTime begin, DateTime end)
是否在两者之间（包含）
Definition: ValidateExtension.cs:90


SinGooCMS.Utility: SinGooCMS.Utility/IO/VideoUtils.cs 源文件

  • 文件列表
  • SinGooCMS.Utility
  • IO
VideoUtils.cs
浏览该文件的文档.
1 using System;
2 using System.Collections.Generic;
3
4 namespace SinGooCMS.Utility
5 {
9 public sealed class VideoUtils
10 {
11 #region 公共属性
12
16 public string ToolsPath { get; set; }
20 public string StartPoint { get; set; }
24 public int CutImgWidth { get; set; }
28 public int CutImgHeight { get; set; }
32 public string CutImgExtend { get; set; }
33
34 #endregion
35
45 public static VideoUtils Init(string ffmpegPath, string startPoint = "00:00:06", int cutImgWidth = 500, int cutImgHeight = 400, string imgExt = ".jpg")
46 {
47 return new VideoUtils
48 {
49 ToolsPath = ffmpegPath,
50 StartPoint = startPoint,
51 CutImgWidth = cutImgWidth,
52 CutImgHeight = cutImgHeight,
53 CutImgExtend = imgExt
54 };
55 }
56
63 public bool Save(string fullVideoFile, string fullOutputImg)
64 {
65 var commandTexts = new List<string>() {
66 $"{ToolsPath} -i {fullVideoFile} -y -f image2 -ss {StartPoint} -t 0.001 -s {CutImgWidth} x {CutImgHeight} {fullOutputImg}"
67 };
68 return ProcessUtils.ExecuteCMD(commandTexts);
69 }
70 }
71 }
System
SinGooCMS.Utility.VideoUtils
视频剪切工具.上传视频后可截取视频存储为图片,注意要调用文件：ffmpeg.exe
Definition: VideoUtils.cs:9
SinGooCMS.Utility.VideoUtils.Init
static VideoUtils Init(string ffmpegPath, string startPoint="00:00:06", int cutImgWidth=500, int cutImgHeight=400, string imgExt=".jpg")
初始化
Definition: VideoUtils.cs:45
SinGooCMS.Utility.ProcessUtils
执行系统进程
Definition: ProcessUtils.cs:12
SinGooCMS.Utility.ProcessUtils.ExecuteCMD
static bool ExecuteCMD(IList< string > commandText)
执行cmd命令
Definition: ProcessUtils.cs:58
SinGooCMS
SinGooCMS.Utility.VideoUtils.Save
bool Save(string fullVideoFile, string fullOutputImg)
保存截图
Definition: VideoUtils.cs:63


SinGooCMS.Utility: SinGooCMS.Utility/Media/WatermarkPosition.cs 源文件

  • 文件列表
  • SinGooCMS.Utility
  • Media
WatermarkPosition.cs
浏览该文件的文档.
1 namespace SinGooCMS.Utility
2 {
6 public enum WatermarkPosition
7 {
11 None,
15 TopLeft,
19 TopCenter,
23 TopRight,
27 MiddleLeft,
31 MiddleCenter,
35 MiddleRight,
39 BottomLeft,
43 BottomCenter,
47 BottomRight
48 }
49 }
SinGooCMS.Utility.WatermarkPosition.MiddleRight
中右位置
SinGooCMS.Utility.WatermarkPosition.None
无水印
SinGooCMS.Utility.WatermarkPosition.TopLeft
左上位置
SinGooCMS.Utility.WatermarkPosition.MiddleCenter
正中位置
SinGooCMS.Utility.WatermarkPosition.BottomRight
右下位置
SinGooCMS.Utility.WatermarkPosition.BottomLeft
左下位置
SinGooCMS.Utility.WatermarkPosition.TopRight
右上位置
SinGooCMS.Utility.WatermarkPosition.TopCenter
上中位置
SinGooCMS.Utility.WatermarkPosition
WatermarkPosition
水印位置
Definition: WatermarkPosition.cs:6
SinGooCMS
SinGooCMS.Utility.WatermarkPosition.MiddleLeft
中左位置
SinGooCMS.Utility.WatermarkPosition.BottomCenter
下中位置


SinGooCMS.Utility: SinGooCMS.Utility/Web/WebUtils.cs 源文件

  • 文件列表
  • SinGooCMS.Utility
  • Web
WebUtils.cs
浏览该文件的文档.
1 using System;
2 using System.Collections;
3 using System.Collections.Generic;
4 using System.Linq;
5 using System.Text;
6 using System.Web;
7 using SinGooCMS.Utility.Extension;
8
9 namespace SinGooCMS.Utility
10 {
14 public sealed class WebUtils
15 {
16 #region query
17
25 public static T GetQueryVal<T>(string key, T defaultVal = default(T))
26 {
27 var cols = GetQueryVals<T>(key);
28 return cols == null
29 ? defaultVal
30 : cols.First();
31 }
32
39 public static IEnumerable<T> GetQueryVals<T>(string key)
40 {
41 var lst = new List<T>();
42 #if NETSTANDARD2_1
43 if (UtilsBase.HttpContext != null
44 && UtilsBase.HttpContext.Request != null
45 && UtilsBase.HttpContext.Request.Query.ContainsKey(key))
46 {
47 var cols = UtilsBase.HttpContext.Request.Query[key];
48 for (var i = 0; i < cols.Count; i++)
49 lst.Add(HttpUtility.UrlDecode(cols[i]).Trim().To<T>()); //中文需要URL解码
50
51 return lst;
52 }
53 #else
54 if (UtilsBase.HttpContext != null && UtilsBase.HttpContext.Request.QueryString[key] != null)
55 {
56 //中文需要URL解码
57 string queryVal = HttpUtility.UrlDecode(UtilsBase.HttpContext.Request.QueryString[key]).Trim();
58 queryVal.Split(',').ForEach(item =>
59 {
60 lst.Add(item.To<T>());
61 });
62
63 return lst;
64 }
65 #endif
66 return null;
67 }
68
75 public static string GetQueryString(string key, string defalutValue = "")
76 {
77 #if NETSTANDARD2_1
78 if (UtilsBase.HttpContext != null
79 && UtilsBase.HttpContext.Request != null
80 && UtilsBase.HttpContext.Request.Query.ContainsKey(key)
81 && !string.IsNullOrEmpty(UtilsBase.HttpContext.Request.Query[key].ToString()))
82 {
83 //这里中文需要URL解码
84 return HttpUtility.UrlDecode(UtilsBase.HttpContext.Request.Query[key]).Trim();
85 }
86 #else
87 if (UtilsBase.HttpContext != null && UtilsBase.HttpContext.Request.QueryString[key] != null)
88 {
89 //这里中文需要URL解码
90 return HttpUtility.UrlDecode(UtilsBase.HttpContext.Request.QueryString[key]).Trim();
91 }
92 #endif
93
94 return defalutValue;
95 }
96
103 public static int GetQueryInt(string key, int defaultValue = 0)
104 {
105 return GetQueryString(key).ToInt(defaultValue);
106 }
107
114 public static bool GetQueryBool(string key, bool defaultValue = false)
115 {
116 return GetQueryString(key).ToBool(defaultValue);
117 }
118
125 public static long GetQueryLong(string key, long defaultValue = 0)
126 {
127 return GetQueryString(key).ToLong(defaultValue);
128 }
129
136 public static float GetQueryFloat(string key, float defaultValue = 0.0f)
137 {
138 return GetQueryString(key).ToFloat(defaultValue);
139 }
140
147 public static double GetQueryDouble(string key, double defaultValue = 0.0d)
148 {
149 return GetQueryString(key).ToDouble(defaultValue);
150 }
151
158 public static decimal GetQueryDecimal(string key, decimal defaultValue = 0.0m)
159 {
160 return GetQueryString(key).ToDecimal(defaultValue);
161 }
162
168 public static DateTime GetQueryDatetime(string key)
169 {
170 return GetQueryString(key).ToDateTime();
171 }
172
179 public static DateTime GetQueryDatetime(string key, DateTime defaultValue)
180 {
181 return GetQueryString(key).ToDateTime(defaultValue);
182 }
183
184 #endregion
185
186 #region form
187
195 public static T GetFormVal<T>(string key, T defaultVal = default(T))
196 {
197 var cols = GetFormVals<T>(key);
198 return cols == null
199 ? defaultVal
200 : cols.First();
201 }
202
209 public static IEnumerable<T> GetFormVals<T>(string key)
210 {
211 var lst = new List<T>();
212 #if NETSTANDARD2_1
213 //直接引用UtilsBase.HttpContext.Request.Form会抛出异常，首先要判断 HasFormContentType
214 if (UtilsBase.HttpContext != null
215 && UtilsBase.HttpContext.Request != null
216 && UtilsBase.HttpContext.Request.HasFormContentType
217 && UtilsBase.HttpContext.Request.Form.ContainsKey(key))
218 {
219 var cols = UtilsBase.HttpContext.Request.Form[key];
220 //Post数据有多个同名键，值以逗号分隔 如111,2222，也可以用下标读取 Form[key][0]
221 for (var i = 0; i < cols.Count; i++)
222 lst.Add(HttpUtility.UrlDecode(cols[i]).Trim().To<T>()); //中文需要URL解码
223
224 return lst;
225 }
226 #else
227 if (UtilsBase.HttpContext != null && UtilsBase.HttpContext.Request.Form[key] != null)
228 {
229 //中文需要URL解码
230 string formVal = HttpUtility.UrlDecode(UtilsBase.HttpContext.Request.Form[key]).Trim();
231 formVal.Split(',').ForEach(item =>
232 {
233 lst.Add(item.To<T>());
234 });
235
236 return lst;
237 }
238 #endif
239 return null;
240 }
241
248 public static string GetFormString(string key, string defalutValue = "")
249 {
250 #if NETSTANDARD2_1
251 if (UtilsBase.HttpContext != null
252 && UtilsBase.HttpContext.Request != null
253 && UtilsBase.HttpContext.Request.HasFormContentType
254 && UtilsBase.HttpContext.Request.Form.ContainsKey(key)
255 && !string.IsNullOrEmpty(UtilsBase.HttpContext.Request.Form[key]))
256 {
257 return HttpUtility.UrlDecode(UtilsBase.HttpContext.Request.Form[key]).Trim();
258 }
259 #else
260 if (UtilsBase.HttpContext != null && UtilsBase.HttpContext.Request.Form[key] != null)
261 {
262 //这里中文需要URL解码
263 return HttpUtility.UrlDecode(UtilsBase.HttpContext.Request.Form[key]).Trim();
264 }
265 #endif
266
267 return defalutValue;
268 }
269
276 public static int GetFormInt(string key, int defaultValue = 0)
277 {
278 return GetFormString(key).ToInt(defaultValue);
279 }
280
287 public static bool GetFormBool(string key, bool defaultValue = false)
288 {
289 return GetFormString(key).ToBool(defaultValue);
290 }
291
298 public static float GetFormFloat(string key, float defaultValue = 0.0f)
299 {
300 return GetFormString(key).ToFloat(defaultValue);
301 }
302
309 public static double GetFormDouble(string key, double defaultValue = 0.0d)
310 {
311 return GetFormString(key).ToDouble(defaultValue);
312 }
313
320 public static decimal GetFormDecimal(string key, decimal defaultValue = 0.0m)
321 {
322 return GetFormString(key).ToDecimal(defaultValue);
323 }
324
330 public static DateTime GetFormDatetime(string key)
331 {
332 return GetFormString(key).ToDateTime();
333 }
334
341 public static DateTime GetFormDatetime(string key, DateTime defaultValue)
342 {
343 return GetFormString(key).ToDateTime(defaultValue);
344 }
345
346 #endregion
347
348 #region 其它
349
354 public static string GetUrlPathPart()
355 {
356 #if NETSTANDARD2_1
357 var request = UtilsBase.Request;
358 return new StringBuilder()
359 .Append(request.PathBase)
360 .Append(request.Path)
361 .Append(request.QueryString)
362 .ToString();
363 #else
364 return UtilsBase.Request.Url.PathAndQuery;
365 #endif
366 }
367
372 public static string GetAbsoluteUri()
373 {
374 #if NETSTANDARD2_1
375 var request = UtilsBase.Request;
376 return new StringBuilder()
377 .Append(request.Scheme)
378 .Append("://")
379 .Append(request.Host)
380 .Append(request.PathBase)
381 .Append(request.Path)
382 .Append(request.QueryString)
383 .ToString();
384 #else
385 return UtilsBase.Request.Url.ToString();
386 #endif
387 }
388
389 #endregion
390 }
391 }
SinGooCMS.Utility.WebUtils.GetFormInt
static int GetFormInt(string key, int defaultValue=0)
读取form值
Definition: WebUtils.cs:276
SinGooCMS.Utility.WebUtils.GetQueryDouble
static double GetQueryDouble(string key, double defaultValue=0.0d)
读取query值
Definition: WebUtils.cs:147
SinGooCMS.Utility
Definition: Accessor.cs:6
System
SinGooCMS.Utility.WebUtils.GetQueryDatetime
static DateTime GetQueryDatetime(string key, DateTime defaultValue)
读取query值
Definition: WebUtils.cs:179
SinGooCMS.Utility.WebUtils.GetQueryString
static string GetQueryString(string key, string defalutValue="")
读取query值
Definition: WebUtils.cs:75
SinGooCMS.Utility.WebUtils.GetQueryFloat
static float GetQueryFloat(string key, float defaultValue=0.0f)
读取query值
Definition: WebUtils.cs:136
SinGooCMS.Utility.Extension
Definition: AssemblyExtensions.cs:8
SinGooCMS.Utility.UtilsBase.HttpContext
static HttpContext HttpContext
http上下文
Definition: UtilsBase.cs:43
SinGooCMS.Utility.WebUtils.GetAbsoluteUri
static string GetAbsoluteUri()
获取url完整地址
Definition: WebUtils.cs:372
SinGooCMS.Utility.WebUtils.GetFormBool
static bool GetFormBool(string key, bool defaultValue=false)
读取form值
Definition: WebUtils.cs:287
SinGooCMS.Utility.WebUtils.GetFormFloat
static float GetFormFloat(string key, float defaultValue=0.0f)
读取form值
Definition: WebUtils.cs:298
SinGooCMS.Utility.WebUtils.GetFormDecimal
static decimal GetFormDecimal(string key, decimal defaultValue=0.0m)
读取form值
Definition: WebUtils.cs:320
SinGooCMS
SinGooCMS.Utility.WebUtils.GetFormDouble
static double GetFormDouble(string key, double defaultValue=0.0d)
读取form值
Definition: WebUtils.cs:309
SinGooCMS.Utility.UtilsBase.Request
static HttpRequest Request
请求
Definition: UtilsBase.cs:47
SinGooCMS.Utility.WebUtils.GetFormDatetime
static DateTime GetFormDatetime(string key)
读取form值并转化为Datetime类型，默认是1900-1-1
Definition: WebUtils.cs:330
SinGooCMS.Utility.WebUtils.GetFormString
static string GetFormString(string key, string defalutValue="")
读取form值
Definition: WebUtils.cs:248
SinGooCMS.Utility.WebUtils.GetQueryDatetime
static DateTime GetQueryDatetime(string key)
读取query值并转化为Datetime类型，默认是1900-1-1
Definition: WebUtils.cs:168
SinGooCMS.Utility.WebUtils.GetFormDatetime
static DateTime GetFormDatetime(string key, DateTime defaultValue)
读取form值
Definition: WebUtils.cs:341
SinGooCMS.Utility.WebUtils.GetQueryDecimal
static decimal GetQueryDecimal(string key, decimal defaultValue=0.0m)
读取query值
Definition: WebUtils.cs:158
SinGooCMS.Utility.WebUtils
web工具
Definition: WebUtils.cs:14
SinGooCMS.Utility.UtilsBase
工具底层，主要获取 http上下文 HttpContext。netfx从system.web中读取，core需要注入
Definition: UtilsBase.cs:13
SinGooCMS.Utility.WebUtils.GetQueryInt
static int GetQueryInt(string key, int defaultValue=0)
读取query值
Definition: WebUtils.cs:103
SinGooCMS.Utility.WebUtils.GetQueryLong
static long GetQueryLong(string key, long defaultValue=0)
读取query值
Definition: WebUtils.cs:125
SinGooCMS.Utility.WebUtils.GetQueryBool
static bool GetQueryBool(string key, bool defaultValue=false)
读取query值
Definition: WebUtils.cs:114
SinGooCMS.Utility.WebUtils.GetUrlPathPart
static string GetUrlPathPart()
读取url的path部分，如 /home/index?abc=1
Definition: WebUtils.cs:354


SinGooCMS.Utility: SinGooCMS.Utility/Xml/XmlUtils.cs 源文件

  • 文件列表
  • SinGooCMS.Utility
  • Xml
XmlUtils.cs
浏览该文件的文档.
1 using System;
2 using System.IO;
3 using System.Xml;
4 using System.Data;
5 using System.Text;
6
7 namespace SinGooCMS.Utility
8 {
12 public class XmlUtils
13 {
14 #region 字段定义
15 private string _filePath = string.Empty;
22 private XmlDocument _xml;
26 private XmlElement _element;
27 #endregion
28
29 #region 构造方法
30 public XmlUtils(string xmlFilePath)
35 {
36 //获取XML文件的绝对路径
37 _filePath = SystemUtils.GetMapPath(xmlFilePath);
38 }
39 #endregion
40
41 #region 创建XML的根节点
42 private void CreateXMLElement()
46 {
47 //创建一个XML对象
48 _xml = new XmlDocument();
49
50 if (File.Exists(_filePath))
51 {
52 //加载XML文件
53 _xml.Load(this._filePath);
54 }
55
56 //为XML的根节点赋值
57 _element = _xml.DocumentElement;
58 }
59 #endregion
60
61 #region 获取指定XPath表达式的节点对象
62 public XmlNode GetNode(string xPath)
71 {
72 //创建XML的根节点
73 CreateXMLElement();
74
75 //返回XPath节点
76 return _element.SelectSingleNode(xPath);
77 }
78 #endregion
79
80 #region 获取指定XPath表达式节点的值
81 public string GetValue(string xPath)
90 {
91 //创建XML的根节点
92 CreateXMLElement();
93
94 //返回XPath节点的值
95 return _element.SelectSingleNode(xPath).InnerText;
96 }
97 #endregion
98
99 #region 获取指定XPath表达式节点的属性值
100 public string GetAttributeValue(string xPath, string attributeName)
110 {
111 //创建XML的根节点
112 CreateXMLElement();
113
114 //返回XPath节点的属性值
115 return _element.SelectSingleNode(xPath).Attributes[attributeName].Value;
116 }
117 #endregion
118
119 #region 新增节点
120 public void AppendNode(XmlNode xmlNode)
126 {
127 //创建XML的根节点
128 CreateXMLElement();
129
130 //导入节点
131 XmlNode node = _xml.ImportNode(xmlNode, true);
132
133 //将节点插入到根节点下
134 _element.AppendChild(node);
135 }
136 #if NET461
137 public void AppendNode(DataSet ds)
143 {
144 //创建XmlDataDocument对象
145 XmlDataDocument xmlDataDocument = new XmlDataDocument(ds);
146
147 //导入节点
148 XmlNode node = xmlDataDocument.DocumentElement.FirstChild;
149
150 //将节点插入到根节点下
151 AppendNode(node);
152 }
153 #endif
154 #endregion
155
156 #region 删除节点
157 public void RemoveNode(string xPath)
166 {
167 //创建XML的根节点
168 CreateXMLElement();
169
170 //获取要删除的节点
171 XmlNode node = _xml.SelectSingleNode(xPath);
172
173 //删除节点
174 _element.RemoveChild(node);
175 }
176 #endregion //删除节点
177
178 #region 保存XML文件
179 public void Save()
183 {
184 //创建XML的根节点
185 CreateXMLElement();
186
187 //保存XML文件
188 _xml.Save(this._filePath);
189 }
190 #endregion //保存XML文件
191
192 #region 静态方法
193
194 #region 创建根节点对象
195 private static XmlElement CreateRootElement(string xmlFilePath)
200 {
201 //定义变量，表示XML文件的绝对路径
202 string filePath = "";
203
204 //获取XML文件的绝对路径
205 filePath = SystemUtils.GetMapPath(xmlFilePath);
206
207 //创建XmlDocument对象
208 XmlDocument xmlDocument = new XmlDocument();
209 //加载XML文件
210 xmlDocument.Load(filePath);
211
212 //返回根节点
213 return xmlDocument.DocumentElement;
214 }
215 #endregion
216
217 #region 获取指定XPath表达式节点的值
218 public static string GetValue(string xmlFilePath, string xPath)
228 {
229 //创建根对象
230 XmlElement rootElement = CreateRootElement(xmlFilePath);
231
232 //返回XPath节点的值
233 return rootElement.SelectSingleNode(xPath).InnerText;
234 }
235 #endregion
236
237 #region 获取指定XPath表达式节点的属性值
238 public static string GetAttributeValue(string xmlFilePath, string xPath, string attributeName)
249 {
250 //创建根对象
251 XmlElement rootElement = CreateRootElement(xmlFilePath);
252
253 //返回XPath节点的属性值
254 return rootElement.SelectSingleNode(xPath).Attributes[attributeName].Value;
255 }
256 #endregion
257
258 #region 其它操作
259
264 public static XmlDocument CreateXmlDocument()
265 {
266 XmlDocument document = new XmlDocument();
267 XmlDeclaration newChild = document.CreateXmlDeclaration("1.0", "utf-8", "");
268 document.InsertBefore(newChild, document.DocumentElement);
269 return document;
270 }
271
277 public static XmlDocument CreateXmlDocument(string rootName)
278 {
279 XmlDocument document = new XmlDocument();
280 XmlDeclaration newChild = document.CreateXmlDeclaration("1.0", "utf-8", "");
281 document.InsertBefore(newChild, document.DocumentElement);
282 XmlNode node = document.CreateElement(rootName);
283 document.AppendChild(node);
284 return document;
285 }
286
293 public static string GetAttributeValue(XmlNode node, string attributeName)
294 {
295 XmlAttribute attribute = node.Attributes[attributeName];
296 if (attribute == null)
297 {
298 return null;
299 }
300 return attribute.Value;
301 }
302
309 public static string GetItemValue(XmlNode node, string itemName)
310 {
311 if ((node != null) && (node[itemName] != null))
312 {
313 return node[itemName].InnerText;
314 }
315 return null;
316 }
317
325 public static XmlNode SelectNode(XmlNode parentNode, string attributeName, string attributeValue)
326 {
327 XmlNode node = null;
328 if (parentNode.HasChildNodes)
329 {
330 string name = parentNode.ChildNodes[0].Name;
331 string xpath = name + "[@" + attributeName + "='" + attributeValue + "']";
332 node = parentNode.SelectSingleNode(xpath);
333 }
334 return node;
335 }
336
344 public static bool SetAttributeValue(XmlNode node, string attributeName, string attributeValue)
345 {
346 if (node != null)
347 {
348 XmlAttribute attribute = node.Attributes[attributeName];
349 if (attribute != null)
350 {
351 attribute.Value = attributeValue;
352 return true;
353 }
354 }
355 return false;
356 }
357
365 public static bool SetItemValue(XmlNode node, string itemName, string itemValue)
366 {
367 if ((node != null) && (node[itemName] != null))
368 {
369 node[itemName].InnerText = itemValue;
370 return true;
371 }
372 return false;
373 }
374
380 public static string XmlEncode(string value)
381 {
382 if (!string.IsNullOrEmpty(value))
383 {
384 value = value.Replace("&", "&amp;");
385 value = value.Replace("<", "&lt;");
386 value = value.Replace(">", "&gt;");
387 value = value.Replace("'", "&apos;");
388 value = value.Replace("\"", "&quot;");
389 }
390 return value;
391 }
392
393 #endregion
394
395 #region xml格式化
396
402 public static string FormatXML(string xmlStr)
403 {
404 //校验是否是XML报文
405 if (!xmlStr.Contains("<?xml version")) return xmlStr;
406 XmlDocument doc = new XmlDocument();
407 doc.LoadXml(xmlStr);
408
409 MemoryStream memoryStream = new MemoryStream();
410 XmlTextWriter writer = new XmlTextWriter(memoryStream, null)
411 {
412 Formatting = Formatting.Indented//缩进
413 };
414 doc.Save(writer);
415 StreamReader streamReader = new StreamReader(memoryStream);
416 memoryStream.Position = 0;
417 string xmlString = streamReader.ReadToEnd();
418 streamReader.Close();
419 memoryStream.Close();
420 return xmlString;
421 }
422
429 public static void WriteFormatXML(string xmlStr, string saveFilePath, string encoding = "utf-8")
430 {
431 //load unformatted xml into a dom
432 XmlDocument xd = new XmlDocument();
433 xd.LoadXml(xmlStr);
434
435 //will hold formatted xml
436 StringBuilder sb = new StringBuilder();
437
438 //pumps the formatted xml into the StringBuilder above
439 StringWriter sw = new StringWriter(sb);
440
441 //does the formatting
442 XmlTextWriter xtw = null;
443
444 try
445 {
446 //point the xtw at the StringWriter
447 xtw = new XmlTextWriter(sw);
448
449 //we want the output formatted
450 xtw.Formatting = Formatting.Indented;
451
452 //get the dom to dump its contents into the xtw
453 xd.WriteTo(xtw);
454 }
455 finally
456 {
457 //clean up even if error
458 if (xtw != null)
459 xtw.Close();
460 }
461
462 xd.Save(saveFilePath);
463 }
464
465 #endregion
466
467 #endregion
468 }
469 }
470
SinGooCMS.Utility.XmlUtils._element
XmlElement _element
XML的根节点
Definition: XmlUtils.cs:26
SinGooCMS.Utility.XmlUtils.SetItemValue
static bool SetItemValue(XmlNode node, string itemName, string itemValue)
设置节点值
Definition: XmlUtils.cs:365
System
SinGooCMS.Utility.XmlUtils.SelectNode
static XmlNode SelectNode(XmlNode parentNode, string attributeName, string attributeValue)
节点选择
Definition: XmlUtils.cs:325
SinGooCMS.Utility.XmlUtils
xml工具
Definition: XmlUtils.cs:12
SinGooCMS.Utility.XmlUtils.GetItemValue
static string GetItemValue(XmlNode node, string itemName)
创建xml节点文本
Definition: XmlUtils.cs:309
SinGooCMS.Utility.XmlUtils.GetAttributeValue
static string GetAttributeValue(XmlNode node, string attributeName)
读取节点属性
Definition: XmlUtils.cs:293
SinGooCMS
SinGooCMS.Utility.XmlUtils.CreateXmlDocument
static XmlDocument CreateXmlDocument(string rootName)
创建xml文档
Definition: XmlUtils.cs:277
SinGooCMS.Utility.XmlUtils.XmlEncode
static string XmlEncode(string value)
xml编码
Definition: XmlUtils.cs:380
SinGooCMS.Utility.XmlUtils.SetAttributeValue
static bool SetAttributeValue(XmlNode node, string attributeName, string attributeValue)
设置节点属性值
Definition: XmlUtils.cs:344
SinGooCMS.Utility.XmlUtils.WriteFormatXML
static void WriteFormatXML(string xmlStr, string saveFilePath, string encoding="utf-8")
写入格式化xml
Definition: XmlUtils.cs:429
SinGooCMS.Utility.XmlUtils._xml
XmlDocument _xml
Xml文档
Definition: XmlUtils.cs:22
SinGooCMS.Utility.XmlUtils.FormatXML
static string FormatXML(string xmlStr)
格式化xml
Definition: XmlUtils.cs:402
SinGooCMS.Utility.XmlUtils.CreateXmlDocument
static XmlDocument CreateXmlDocument()
创建xml文档
Definition: XmlUtils.cs:264


SinGooCMS.Utility: SinGooCMS.Utility/Extension/XmlserializeExtension.cs 源文件

  • 文件列表
  • SinGooCMS.Utility
  • Extension
XmlserializeExtension.cs
浏览该文件的文档.
1 using System;
2 using System.IO;
3 using System.Text;
4 using System.Xml.Serialization;
5
6 namespace SinGooCMS.Utility.Extension
7 {
11 public static class XmlserializeExtension
12 {
13 #region 序列化
14
21 public static string ToXml<T>(this T t)
22 {
23 XmlSerializerNamespaces namespaces = new XmlSerializerNamespaces();
24 namespaces.Add(string.Empty, string.Empty);
25 XmlSerializer serializer = new XmlSerializer(typeof(T));
26 using (StringUTF8Writer writer = new StringUTF8Writer(new StringBuilder()))
27 {
28 serializer.Serialize(writer, t, namespaces);
29 return writer.ToString();
30 }
31 }
32
33 #endregion
34
35 #region 反序列化
36
43 public static T XmlToObject<T>(this string strXml)
44 {
45 T local = default;
46 if (!string.IsNullOrEmpty(strXml))
47 {
48 try
49 {
50 XmlSerializer serializer = new XmlSerializer(typeof(T));
51 TextReader textReader = new StringReader(strXml);
52 local = (T)serializer.Deserialize(textReader);
53 textReader.Close();
54 return local;
55 }
56 catch (InvalidOperationException ex)
57 {
58 return default;
59 }
60 }
61
62 return default;
63 }
64
65 #endregion
66
67 }
68
72 internal class StringUTF8Writer : System.IO.StringWriter
73 {
74 public StringUTF8Writer(StringBuilder builder)
75 : base(builder)
76 {
77 //调用基类
78 }
79 public override Encoding Encoding
80 {
81 get { return Encoding.UTF8; }
82 }
83 }
84 }
SinGooCMS.Utility.Extension.XmlserializeExtension
xml序列化扩展
Definition: XmlserializeExtension.cs:11
System
SinGooCMS


SinGooCMS.Utility: SinGooCMS.Utility/IO/ZipUtils.cs 源文件

  • 文件列表
  • SinGooCMS.Utility
  • IO
ZipUtils.cs
浏览该文件的文档.
1 using System;
2 using System.Text;
3 using System.IO;
4 using System.Linq;
5 using SharpCompress.Common;
6 using SharpCompress.Archives;
7 using SharpCompress.Archives.Zip; //zip
8 using SharpCompress.Archives.Rar; //rar
9 using SharpCompress.Archives.SevenZip; //7z
10 using SinGooCMS.Utility.Extension;
11
12 namespace SinGooCMS.Utility
13 {
19 public sealed class ZipUtils
20 {
26 public static string Zip(string dirPath, string zipFile = "")
27 {
28 if (!Directory.Exists(dirPath))
29 throw new DirectoryNotFoundException("参数[dirPath]不是一个有效的文件夹路径");
30
31 if (!zipFile.IsNullOrEmpty() && !(new string[] { ".zip", ".rar", ".7z" }.Contains(Path.GetExtension(zipFile).ToLower())))
32 throw new DirectoryNotFoundException("文件名格式不正确");
33
34 if (zipFile.IsNullOrEmpty())
35 zipFile = FileUtils.Combine(dirPath, StringUtils.GetNewFileName() + ".zip");
36
37 //解决中文乱码问题
38 var options = new SharpCompress.Writers.WriterOptions(CompressionType.Deflate)
39 {
40 ArchiveEncoding = new ArchiveEncoding
41 {
42 Default = Encoding.GetEncoding("utf-8")
43 }
44 };
45 using (var archive = ZipArchive.Create())
46 {
47 archive.AddAllFromDirectory(dirPath);
48 archive.SaveTo(zipFile, options);
49
50 return zipFile;
51 }
52 }
53
59 public static void UnZip(string zipFile, string extractPath)
60 {
61 //注意压缩包是zip还是rar
62 string ext = System.IO.Path.GetExtension(zipFile).ToLower();
63 switch (ext)
64 {
65 case ".7z":
66 using (var archive = SevenZipArchive.Open(zipFile))
67 {
68 foreach (var entry in archive.Entries.Where(entry => !entry.IsDirectory))
69 {
70 entry.WriteToDirectory(extractPath, new ExtractionOptions()
71 {
72 ExtractFullPath = true,
73 Overwrite = true
74 });
75 }
76 }
77 break;
78 case ".zip":
79 using (var archive = ZipArchive.Open(zipFile))
80 {
81 foreach (var entry in archive.Entries.Where(entry => !entry.IsDirectory))
82 {
83 entry.WriteToDirectory(extractPath, new ExtractionOptions()
84 {
85 ExtractFullPath = true,
86 Overwrite = true
87 });
88 }
89 }
90 break;
91 case ".rar":
92 default:
93 using (var archive = RarArchive.Open(zipFile))
94 {
95 foreach (var entry in archive.Entries.Where(entry => !entry.IsDirectory))
96 {
97 entry.WriteToDirectory(extractPath, new ExtractionOptions()
98 {
99 ExtractFullPath = true,
100 Overwrite = true
101 });
102 }
103 }
104 break;
105
106 }
107 }
108 }
109 }
SinGooCMS.Utility.ZipUtils.Zip
static string Zip(string dirPath, string zipFile="")
压缩(支持 zip、rar、7z)，默认zip
Definition: ZipUtils.cs:26
SinGooCMS.Utility.ZipUtils.UnZip
static void UnZip(string zipFile, string extractPath)
解压
Definition: ZipUtils.cs:59
SinGooCMS.Utility.FileUtils
文件管理工具
Definition: FileUtils.cs:24
SinGooCMS.Utility
Definition: Accessor.cs:6
System
SinGooCMS.Utility.Extension
Definition: AssemblyExtensions.cs:8
SinGooCMS.Utility.ZipUtils
压缩和解压
Definition: ZipUtils.cs:19
SinGooCMS
SinGooCMS.Utility.FileUtils.Combine
static string Combine(string dir, string fileName)
合并目录和文件名成为新的文件路径
Definition: FileUtils.cs:271
SinGooCMS.Utility.StringUtils.GetNewFileName
static string GetNewFileName()
生成一个新的文件名
SinGooCMS.Utility.StringUtils
字符串处理
Definition: StringUtils.cs:17


SinGooCMS.Utility: 成员列表

  • SinGooCMS
  • Utility
  • Accessor
SinGooCMS.Utility.Accessor 成员列表

成员的完整列表，这些成员属于 SinGooCMS.Utility.Accessor,包括所有继承而来的类成员

Accessor(IReflect type, bool ignoreCase, bool includeNonPublic) | SinGooCMS.Utility.Accessor | protected
Build(object instance, bool ignoreCase=false, bool includeNonPublic=false) | SinGooCMS.Utility.Accessor | static
Build(Type instanceType, bool ignoreCase=false, bool includeNonPublic=false) | SinGooCMS.Utility.Accessor | static
Build< TInstance >(bool ignoreCase=false, bool includeNonPublic=false) | SinGooCMS.Utility.Accessor | static
Comparer | SinGooCMS.Utility.Accessor | protected
IgnoreCase | SinGooCMS.Utility.Accessor |
IncludesNonPublic | SinGooCMS.Utility.Accessor |
Properties | SinGooCMS.Utility.Accessor |
Type | SinGooCMS.Utility.Accessor |


SinGooCMS.Utility: 成员列表

  • SinGooCMS
  • Utility
  • AccessorBuilder
SinGooCMS.Utility.AccessorBuilder 成员列表

成员的完整列表，这些成员属于 SinGooCMS.Utility.AccessorBuilder,包括所有继承而来的类成员

BuildGetter(PropertyInfo propertyInfo, bool includePrivate=false) | SinGooCMS.Utility.AccessorBuilder | static
BuildGetter< TInstance >(string propertyName, bool includePrivate=false) | SinGooCMS.Utility.AccessorBuilder | static
BuildGetter< TInstance >(PropertyInfo propertyInfo, bool includePrivate=false) | SinGooCMS.Utility.AccessorBuilder | static
BuildGetter< TInstance, TProperty >(string propertyName, bool includePrivate=false) | SinGooCMS.Utility.AccessorBuilder | static
BuildGetter< TInstance, TProperty >(PropertyInfo propertyInfo, bool includePrivate=false) | SinGooCMS.Utility.AccessorBuilder | static
BuildInstanceCreator< TInstance >() | SinGooCMS.Utility.AccessorBuilder | static
BuildInstanceCreator< TInstance >(ConstructorInfo constructor) | SinGooCMS.Utility.AccessorBuilder | static
BuildSetter(PropertyInfo propertyInfo, bool includePrivate=false) | SinGooCMS.Utility.AccessorBuilder | static
BuildSetter< TInstance >(string propertyName, bool includePrivate=false) | SinGooCMS.Utility.AccessorBuilder | static
BuildSetter< TInstance >(PropertyInfo propertyInfo, bool includePrivate=false) | SinGooCMS.Utility.AccessorBuilder | static
BuildSetter< TInstance, TProperty >(string propertyName, bool includePrivate=false) | SinGooCMS.Utility.AccessorBuilder | static
BuildSetter< TInstance, TProperty >(PropertyInfo propertyInfo, bool includePrivate=false) | SinGooCMS.Utility.AccessorBuilder | static


SinGooCMS.Utility: 成员列表

  • SinGooCMS
  • Utility
  • AdoUtils
SinGooCMS.Utility.AdoUtils 成员列表

成员的完整列表，这些成员属于 SinGooCMS.Utility.AdoUtils,包括所有继承而来的类成员

IsConnected(string connStr) | SinGooCMS.Utility.AdoUtils | static
ToSqlParams< T >(this T model, Dictionary< string,(string SqlParamName, bool IsOutput)> dictParamKeys) | SinGooCMS.Utility.AdoUtils | static


SinGooCMS.Utility: 成员列表

  • SinGooCMS
  • Utility
  • Base64FileUtils
SinGooCMS.Utility.Base64FileUtils 成员列表

成员的完整列表，这些成员属于 SinGooCMS.Utility.Base64FileUtils,包括所有继承而来的类成员

IsBase64Formatted(string input) | SinGooCMS.Utility.Base64FileUtils | static
ReadFileToString(string filePath, bool isJsFormat=false) | SinGooCMS.Utility.Base64FileUtils | static
ReadFileToString(FileStream fileStream) | SinGooCMS.Utility.Base64FileUtils | static
SaveStringToFile(string base64String, string fileFullPath) | SinGooCMS.Utility.Base64FileUtils | static
SaveStringToFileAsync(string base64String, string fileFullPath) | SinGooCMS.Utility.Base64FileUtils | static


SinGooCMS.Utility: 成员列表

  • SinGooCMS
  • Utility
  • CNDate
SinGooCMS.Utility.CNDate 成员列表

成员的完整列表，这些成员属于 SinGooCMS.Utility.CNDate,包括所有继承而来的类成员

cnAnm | SinGooCMS.Utility.CNDate
cnFtvl | SinGooCMS.Utility.CNDate
cnFtvs | SinGooCMS.Utility.CNDate
cnIntDay | SinGooCMS.Utility.CNDate
cnIntMonth | SinGooCMS.Utility.CNDate
cnIntYear | SinGooCMS.Utility.CNDate
cnSolarTerm | SinGooCMS.Utility.CNDate
cnStrDay | SinGooCMS.Utility.CNDate
cnStrMonth | SinGooCMS.Utility.CNDate
cnStrYear | SinGooCMS.Utility.CNDate
ToString() | SinGooCMS.Utility.CNDate


SinGooCMS.Utility: 成员列表

  • SinGooCMS
  • Utility
  • CacheUtils
SinGooCMS.Utility.CacheUtils 成员列表

成员的完整列表，这些成员属于 SinGooCMS.Utility.CacheUtils,包括所有继承而来的类成员

cache | SinGooCMS.Utility.CacheUtils | privatestatic
CacheUtils() | SinGooCMS.Utility.CacheUtils | privatestatic
ClearAll() | SinGooCMS.Utility.CacheUtils |
ContainKey(string key) | SinGooCMS.Utility.CacheUtils |
Del(string key) | SinGooCMS.Utility.CacheUtils |
DelByPattern(string pattern) | SinGooCMS.Utility.CacheUtils |
Get< T >(string key) | SinGooCMS.Utility.CacheUtils |
GetAllKeys() | SinGooCMS.Utility.CacheUtils |
Insert< T >(string key, T t, int expireSeconds, CacheItemPriority priority=CacheItemPriority.Normal, bool isSliding=true) | SinGooCMS.Utility.CacheUtils |


SinGooCMS.Utility: 成员列表

  • SinGooCMS
  • Utility
  • CaptchaUtils
SinGooCMS.Utility.CaptchaUtils 成员列表

成员的完整列表，这些成员属于 SinGooCMS.Utility.CaptchaUtils,包括所有继承而来的类成员

CheckCodeImg | SinGooCMS.Utility.CaptchaUtils |
CheckCodeString | SinGooCMS.Utility.CaptchaUtils |
Create() | SinGooCMS.Utility.CaptchaUtils | static
CreateCheckCodeImage(string codeString) | SinGooCMS.Utility.CaptchaUtils | privatestatic
GenerateCheckCode() | SinGooCMS.Utility.CaptchaUtils | privatestatic


SinGooCMS.Utility: 成员列表

  • SinGooCMS
  • Utility
  • CellPhonePrefix
SinGooCMS.Utility.CellPhonePrefix 成员列表

成员的完整列表，这些成员属于 SinGooCMS.Utility.CellPhonePrefix,包括所有继承而来的类成员

_prefix | SinGooCMS.Utility.CellPhonePrefix | privatestatic
Dictionary | SinGooCMS.Utility.CellPhonePrefix | static
Prefix | SinGooCMS.Utility.CellPhonePrefix | static


SinGooCMS.Utility: 成员列表

  • SinGooCMS
  • Utility
  • ChinaDate
SinGooCMS.Utility.ChinaDate 成员列表

成员的完整列表，这些成员属于 SinGooCMS.Utility.ChinaDate,包括所有继承而来的类成员

Animals | SinGooCMS.Utility.ChinaDate | privatestatic
AnimalsYear(int y) | SinGooCMS.Utility.ChinaDate | privatestatic
calElement(int y, int m, int d) | SinGooCMS.Utility.ChinaDate | privatestatic
cyclical(int y) | SinGooCMS.Utility.ChinaDate | privatestatic
cyclicalm(int num) | SinGooCMS.Utility.ChinaDate | privatestatic
FormatDate(int m, int d) | SinGooCMS.Utility.ChinaDate | privatestatic
Gan | SinGooCMS.Utility.ChinaDate | privatestatic
getChinaDate(int day) | SinGooCMS.Utility.ChinaDate | privatestatic
GetChinaDate(DateTime?dtPara=null) | SinGooCMS.Utility.ChinaDate | static
GetDaysByMonth(int y, int m) | SinGooCMS.Utility.ChinaDate | static
GetMondayDateByDate(DateTime dt) | SinGooCMS.Utility.ChinaDate | static
leapDays(int y) | SinGooCMS.Utility.ChinaDate | privatestatic
leapMonth(int y) | SinGooCMS.Utility.ChinaDate | privatestatic
lFtv | SinGooCMS.Utility.ChinaDate | privatestatic
Lunar(int y, int m) | SinGooCMS.Utility.ChinaDate | private
lunarInfo | SinGooCMS.Utility.ChinaDate | privatestatic
lYearDays(int y) | SinGooCMS.Utility.ChinaDate | privatestatic
monthDays(int y, int m) | SinGooCMS.Utility.ChinaDate | privatestatic
nStr1 | SinGooCMS.Utility.ChinaDate | privatestatic
sFtv | SinGooCMS.Utility.ChinaDate | privatestatic
solarTerm | SinGooCMS.Utility.ChinaDate | privatestatic
sTerm(int y, int n) | SinGooCMS.Utility.ChinaDate | privatestatic
sTermInfo | SinGooCMS.Utility.ChinaDate | privatestatic
year19 | SinGooCMS.Utility.ChinaDate | privatestatic
year20 | SinGooCMS.Utility.ChinaDate | privatestatic
year2000 | SinGooCMS.Utility.ChinaDate | privatestatic
Zhi | SinGooCMS.Utility.ChinaDate | privatestatic


SinGooCMS.Utility: 成员列表

  • SinGooCMS
  • Utility
  • ChineseCalendar
SinGooCMS.Utility.ChineseCalendar 成员列表

成员的完整列表，这些成员属于 SinGooCMS.Utility.ChineseCalendar,包括所有继承而来的类成员

_cDay | SinGooCMS.Utility.ChineseCalendar | private
_chineseConstellationName | SinGooCMS.Utility.ChineseCalendar | privatestatic
_cIsLeapMonth | SinGooCMS.Utility.ChineseCalendar | private
_cIsLeapYear | SinGooCMS.Utility.ChineseCalendar | private
_cMonth | SinGooCMS.Utility.ChineseCalendar | private
_constellationName | SinGooCMS.Utility.ChineseCalendar | privatestatic
_cYear | SinGooCMS.Utility.ChineseCalendar | private
_date | SinGooCMS.Utility.ChineseCalendar | private
_datetime | SinGooCMS.Utility.ChineseCalendar | private
_lunarHolidayName | SinGooCMS.Utility.ChineseCalendar | privatestatic
_monthString | SinGooCMS.Utility.ChineseCalendar | privatestatic
Animal | SinGooCMS.Utility.ChineseCalendar |
AnimalStartYear | SinGooCMS.Utility.ChineseCalendar | private
animalStr | SinGooCMS.Utility.ChineseCalendar | privatestatic
AnimalString | SinGooCMS.Utility.ChineseCalendar |
BitTest32(int num, int bitpostion) | SinGooCMS.Utility.ChineseCalendar | private
CheckChineseDateLimit(int year, int month, int day, bool leapMonth) | SinGooCMS.Utility.ChineseCalendar | private
CheckDateLimit(DateTime dt) | SinGooCMS.Utility.ChineseCalendar | private
ChineseCalendar(DateTime?dtParam=null) | SinGooCMS.Utility.ChineseCalendar |
ChineseCalendar(int cy, int cm, int cd, bool leapMonthFlag) | SinGooCMS.Utility.ChineseCalendar |
ChineseConstellation | SinGooCMS.Utility.ChineseCalendar |
ChineseConstellationReferDay | SinGooCMS.Utility.ChineseCalendar | privatestatic
ChineseDateString | SinGooCMS.Utility.ChineseCalendar |
ChineseDay | SinGooCMS.Utility.ChineseCalendar |
ChineseDayString | SinGooCMS.Utility.ChineseCalendar |
ChineseHour | SinGooCMS.Utility.ChineseCalendar |
ChineseMonth | SinGooCMS.Utility.ChineseCalendar |
ChineseMonthString | SinGooCMS.Utility.ChineseCalendar |
ChineseTwentyFourDay | SinGooCMS.Utility.ChineseCalendar |
ChineseTwentyFourNextDay | SinGooCMS.Utility.ChineseCalendar |
ChineseTwentyFourPrevDay | SinGooCMS.Utility.ChineseCalendar |
ChineseYear | SinGooCMS.Utility.ChineseCalendar |
ChineseYearString | SinGooCMS.Utility.ChineseCalendar |
CompareWeekDayHoliday(DateTime date, int month, int week, int day) | SinGooCMS.Utility.ChineseCalendar | private
Constellation | SinGooCMS.Utility.ChineseCalendar |
ConvertDayOfWeek(DayOfWeek dayOfWeek) | SinGooCMS.Utility.ChineseCalendar | private
ConvertNumToChineseNum(char n) | SinGooCMS.Utility.ChineseCalendar | private
Date | SinGooCMS.Utility.ChineseCalendar |
DateHoliday | SinGooCMS.Utility.ChineseCalendar |
DateString | SinGooCMS.Utility.ChineseCalendar |
ganStr | SinGooCMS.Utility.ChineseCalendar | privatestatic
GanZhiDateString | SinGooCMS.Utility.ChineseCalendar |
GanZhiDayString | SinGooCMS.Utility.ChineseCalendar |
GanZhiMonthString | SinGooCMS.Utility.ChineseCalendar |
GanZhiStartDay | SinGooCMS.Utility.ChineseCalendar | privatestatic
GanZhiStartYear | SinGooCMS.Utility.ChineseCalendar | private
GanZhiYearString | SinGooCMS.Utility.ChineseCalendar |
GetChineseHour(DateTime dt) | SinGooCMS.Utility.ChineseCalendar | private
GetChineseLeapMonth(int year) | SinGooCMS.Utility.ChineseCalendar | private
GetChineseLeapMonthDays(int year) | SinGooCMS.Utility.ChineseCalendar | private
GetChineseMonthDays(int year, int month) | SinGooCMS.Utility.ChineseCalendar | private
GetChineseYearDays(int year) | SinGooCMS.Utility.ChineseCalendar | private
HZNum | SinGooCMS.Utility.ChineseCalendar | private
IsChineseLeapMonth | SinGooCMS.Utility.ChineseCalendar |
IsChineseLeapYear | SinGooCMS.Utility.ChineseCalendar |
IsLeapYear | SinGooCMS.Utility.ChineseCalendar |
lHolidayInfo | SinGooCMS.Utility.ChineseCalendar | privatestatic
LunarDateArray | SinGooCMS.Utility.ChineseCalendar | privatestatic
MaxDay | SinGooCMS.Utility.ChineseCalendar | privatestatic
MaxYear | SinGooCMS.Utility.ChineseCalendar | private
MinDay | SinGooCMS.Utility.ChineseCalendar | privatestatic
MinYear | SinGooCMS.Utility.ChineseCalendar | private
newCalendarHoliday | SinGooCMS.Utility.ChineseCalendar |
nStr1 | SinGooCMS.Utility.ChineseCalendar | privatestatic
nStr2 | SinGooCMS.Utility.ChineseCalendar | privatestatic
sHolidayInfo | SinGooCMS.Utility.ChineseCalendar | privatestatic
SolarTerm | SinGooCMS.Utility.ChineseCalendar | privatestatic
sTermInfo | SinGooCMS.Utility.ChineseCalendar | privatestatic
WeekDay | SinGooCMS.Utility.ChineseCalendar |
WeekDayHoliday | SinGooCMS.Utility.ChineseCalendar |
WeekDayStr | SinGooCMS.Utility.ChineseCalendar |
wHolidayInfo | SinGooCMS.Utility.ChineseCalendar | privatestatic
zhiStr | SinGooCMS.Utility.ChineseCalendar | privatestatic


SinGooCMS.Utility: 成员列表

  • SinGooCMS
  • Utility
  • ConfigUtils
SinGooCMS.Utility.ConfigUtils 成员列表

成员的完整列表，这些成员属于 SinGooCMS.Utility.ConfigUtils,包括所有继承而来的类成员

AddConfigurationProperties(ConfigurationPropertyCollection collection, IEnumerable< ConfigurationProperty > properties) | SinGooCMS.Utility.ConfigUtils | static
DefConnStr | SinGooCMS.Utility.ConfigUtils | static
GetAppSetting< T >(string appSettingName) | SinGooCMS.Utility.ConfigUtils | static
GetAppSetting< T >(string appSettingName, T defaultValue) | SinGooCMS.Utility.ConfigUtils | static
GetAppSettingInternal< T >(string appSettingName, bool useDefaultOnUndefined, T defaultValue) | SinGooCMS.Utility.ConfigUtils | privatestatic
GetConnectionString(string connectionStringName="SQLConnSTR") | SinGooCMS.Utility.ConfigUtils | static
ProviderName | SinGooCMS.Utility.ConfigUtils | static


SinGooCMS.Utility: 成员列表

  • SinGooCMS
  • Utility
  • CookieUtils
SinGooCMS.Utility.CookieUtils 成员列表

成员的完整列表，这些成员属于 SinGooCMS.Utility.CookieUtils,包括所有继承而来的类成员

ContainKey(string key) | SinGooCMS.Utility.CookieUtils | static
GetCookie(string key) | SinGooCMS.Utility.CookieUtils | static
RemoveCookie(string key) | SinGooCMS.Utility.CookieUtils | static
SetCookie(string key, string value) | SinGooCMS.Utility.CookieUtils | static
SetCookie(string key, string value, int expires=30 *60, bool isHttpOnly=true) | SinGooCMS.Utility.CookieUtils | static


SinGooCMS.Utility: 成员列表

  • SinGooCMS
  • Utility
  • CsvUtils
SinGooCMS.Utility.CsvUtils 成员列表

成员的完整列表，这些成员属于 SinGooCMS.Utility.CsvUtils,包括所有继承而来的类成员

Read(string csvFilePath, string encoding="utf-8") | SinGooCMS.Utility.CsvUtils | static
Read< T >(string csvFilePath, string encoding="utf-8") | SinGooCMS.Utility.CsvUtils | static
Write(DataTable dt, string csvFilePath, string encoding="utf-8") | SinGooCMS.Utility.CsvUtils | static
Write< T >(IEnumerable< T > csvLst, string csvFilePath, string encoding="utf-8") | SinGooCMS.Utility.CsvUtils | static
WriteAsync(DataTable dt, string csvFilePath, string encoding="utf-8") | SinGooCMS.Utility.CsvUtils | static
WriteAsync< T >(IEnumerable< T > csvLst, string csvFilePath, string encoding="utf-8") | SinGooCMS.Utility.CsvUtils | static


SinGooCMS.Utility: 成员列表

  • SinGooCMS
  • Utility
  • DEncryptUtils
SinGooCMS.Utility.DEncryptUtils 成员列表

成员的完整列表，这些成员属于 SinGooCMS.Utility.DEncryptUtils,包括所有继承而来的类成员

AESDecrypt(string text, string key) | SinGooCMS.Utility.DEncryptUtils | static
AESEncrypt(string text, string key) | SinGooCMS.Utility.DEncryptUtils | static
Base36Characters | SinGooCMS.Utility.DEncryptUtils | private
Base36Decode(string input) | SinGooCMS.Utility.DEncryptUtils | static
Base36Encode(long input) | SinGooCMS.Utility.DEncryptUtils | static
Base64Decrypt(string strTxt) | SinGooCMS.Utility.DEncryptUtils | static
Base64Encrypt(string strTxt) | SinGooCMS.Utility.DEncryptUtils | static
DESDecrypt(string strTxt, string strKey) | SinGooCMS.Utility.DEncryptUtils | static
DESEncrypt(string strTxt, string strKey) | SinGooCMS.Utility.DEncryptUtils | static
GetAesKey(string key) | SinGooCMS.Utility.DEncryptUtils | privatestatic
GetXORCode(string strTxt, string strKey) | SinGooCMS.Utility.DEncryptUtils | static
MD5Encrypt(string password) | SinGooCMS.Utility.DEncryptUtils | static
SHA512Encrypt(string strTxt) | SinGooCMS.Utility.DEncryptUtils | static


SinGooCMS.Utility: 成员列表

  • SinGooCMS
  • Utility
  • DatetimeUtils
SinGooCMS.Utility.DatetimeUtils 成员列表

成员的完整列表，这些成员属于 SinGooCMS.Utility.DatetimeUtils,包括所有继承而来的类成员

GetDTFromUnixTime(double unixSeconds) | SinGooCMS.Utility.DatetimeUtils | static
GetUnixTime(DateTime time) | SinGooCMS.Utility.DatetimeUtils | static


SinGooCMS.Utility: 成员列表

  • SinGooCMS
  • Utility
  • EntityAttrUtils
SinGooCMS.Utility.EntityAttrUtils 成员列表

成员的完整列表，这些成员属于 SinGooCMS.Utility.EntityAttrUtils,包括所有继承而来的类成员

GetKey(Type type) | SinGooCMS.Utility.EntityAttrUtils | static
GetKeyValue< TEntity >(TEntity entity) | SinGooCMS.Utility.EntityAttrUtils | static
GetMaxLength(PropertyInfo pi) | SinGooCMS.Utility.EntityAttrUtils | static
GetMinLength(PropertyInfo pi) | SinGooCMS.Utility.EntityAttrUtils | static
GetProperty< TEntity >(string PropertyName) | SinGooCMS.Utility.EntityAttrUtils | static
GetTableName(Type type) | SinGooCMS.Utility.EntityAttrUtils | static
IsKey(PropertyInfo pi) | SinGooCMS.Utility.EntityAttrUtils | static
IsNotMapped(PropertyInfo pi) | SinGooCMS.Utility.EntityAttrUtils | static


SinGooCMS.Utility: 成员列表

  • SinGooCMS
  • Utility
  • EnumUtils
SinGooCMS.Utility.EnumUtils 成员列表

成员的完整列表，这些成员属于 SinGooCMS.Utility.EnumUtils,包括所有继承而来的类成员

EnumToList< T >() | SinGooCMS.Utility.EnumUtils | static
GetDescription(Enum value) | SinGooCMS.Utility.EnumUtils | privatestatic
GetEnumCollectionDescription< T >(Collection< T > enums) | SinGooCMS.Utility.EnumUtils | static
GetEnumDescription(Enum value) | SinGooCMS.Utility.EnumUtils | static
GetEnumDescription< T >(T enumeratedType) | SinGooCMS.Utility.EnumUtils | static
GetEnumDescriptions< T >() | SinGooCMS.Utility.EnumUtils | static
StringToEnum(Type enumType, string value) | SinGooCMS.Utility.EnumUtils | static
StringToEnum(Type enumType, string value, bool ignoreCase) | SinGooCMS.Utility.EnumUtils | static
StringToEnum< T >(string name) | SinGooCMS.Utility.EnumUtils | static
StringToEnumOrNull< T >(string name) | SinGooCMS.Utility.EnumUtils | static
TransIntDict(Type enumType) | SinGooCMS.Utility.EnumUtils | static
TransStrDict(Type enumType) | SinGooCMS.Utility.EnumUtils | static


SinGooCMS.Utility: 成员列表

  • SinGooCMS
  • Utility
  • ExceptionUtils
SinGooCMS.Utility.ExceptionUtils 成员列表

成员的完整列表，这些成员属于 SinGooCMS.Utility.ExceptionUtils,包括所有继承而来的类成员

FormatMessage(Exception e) SinGooCMS.Utility.ExceptionUtils static


SinGooCMS.Utility: 成员列表

  • SinGooCMS
  • Utility
  • Extension
  • AssemblyExtension
SinGooCMS.Utility.Extension.AssemblyExtension 成员列表

成员的完整列表，这些成员属于 SinGooCMS.Utility.Extension.AssemblyExtension,包括所有继承而来的类成员

GetAssemblyCodeBase(this Assembly assembly) | SinGooCMS.Utility.Extension.AssemblyExtension | static
GetAssemblyLocation(this Assembly assembly) | SinGooCMS.Utility.Extension.AssemblyExtension | static
GetFrameworkVersion(this Assembly assembly) | SinGooCMS.Utility.Extension.AssemblyExtension | static
Is32Bit(this Assembly assembly) | SinGooCMS.Utility.Extension.AssemblyExtension | static
IsOptimized(this Assembly assembly) | SinGooCMS.Utility.Extension.AssemblyExtension | static


SinGooCMS.Utility: 成员列表

  • SinGooCMS
  • Utility
  • Extension
  • DataTableExtension
SinGooCMS.Utility.Extension.DataTableExtension 成员列表

成员的完整列表，这些成员属于 SinGooCMS.Utility.Extension.DataTableExtension,包括所有继承而来的类成员

ChangeColNames(this DataTable table, Dictionary< string, string > newColNames) | SinGooCMS.Utility.Extension.DataTableExtension | static
ExistsRow(this DataTable dt, string colKey, string colValue) | SinGooCMS.Utility.Extension.DataTableExtension | static
FindRow(this DataTable dt, string colKey, string colValue) | SinGooCMS.Utility.Extension.DataTableExtension | static
RemoveEmptyRow(this DataTable dt) | SinGooCMS.Utility.Extension.DataTableExtension | static
SaveToCsv(this DataTable table, string csvFileFullPath, string encoding="utf-8") | SinGooCMS.Utility.Extension.DataTableExtension | static
SaveToCsv< T >(this DataTable table, string csvFileFullPath, string encoding="utf-8") | SinGooCMS.Utility.Extension.DataTableExtension | static
SaveToCsvAsync(this DataTable table, string csvFileFullPath, string encoding="utf-8") | SinGooCMS.Utility.Extension.DataTableExtension | static
SaveToCsvAsync< T >(this DataTable table, string csvFileFullPath, string encoding="utf-8") | SinGooCMS.Utility.Extension.DataTableExtension | static
SaveToExcel(this DataTable table, string excelFileFullPath, string sheetName="sheet1") | SinGooCMS.Utility.Extension.DataTableExtension | static
SaveToExcel(this Dictionary< string, DataTable > tables, string excelFileFullPath) | SinGooCMS.Utility.Extension.DataTableExtension | static
ToArrayList(this DataTable table) | SinGooCMS.Utility.Extension.DataTableExtension | static
ToDistinctTable(this DataTable table, string[] arrFilter) | SinGooCMS.Utility.Extension.DataTableExtension | static
ToEntity< T >(this DataTable table) | SinGooCMS.Utility.Extension.DataTableExtension | static
ToEnumerable< T >(this DataTable table) | SinGooCMS.Utility.Extension.DataTableExtension | static


SinGooCMS.Utility: 成员列表

  • SinGooCMS
  • Utility
  • Extension
  • DataTypeChangeExtension
SinGooCMS.Utility.Extension.DataTypeChangeExtension 成员列表

成员的完整列表，这些成员属于 SinGooCMS.Utility.Extension.DataTypeChangeExtension,包括所有继承而来的类成员

GetSafeValue< Tkey, Tvalue >(this Dictionary< Tkey, Tvalue > dict, Tkey key) | SinGooCMS.Utility.Extension.DataTypeChangeExtension | static
ToBool(this object thisValue, bool defValue=false) | SinGooCMS.Utility.Extension.DataTypeChangeExtension | static
ToByte(this object thisValue, byte defValue=0) | SinGooCMS.Utility.Extension.DataTypeChangeExtension | static
ToCsharpType(this SqlDbType sqlType) | SinGooCMS.Utility.Extension.DataTypeChangeExtension | static
ToDateTime(this object thisValue) | SinGooCMS.Utility.Extension.DataTypeChangeExtension | static
ToDateTime(this object thisValue, DateTime defValue) | SinGooCMS.Utility.Extension.DataTypeChangeExtension | static
ToDecimal(this object thisValue, decimal defValue=0.0m) | SinGooCMS.Utility.Extension.DataTypeChangeExtension | static
ToDouble(this object thisValue, double defValue=0.0d) | SinGooCMS.Utility.Extension.DataTypeChangeExtension | static
ToFloat(this object thisValue, float defValue=0.0f) | SinGooCMS.Utility.Extension.DataTypeChangeExtension | static
ToInt(this object thisValue, int defValue=0) | SinGooCMS.Utility.Extension.DataTypeChangeExtension | static
ToIntArray(this string ids, char splitter= ',') | SinGooCMS.Utility.Extension.DataTypeChangeExtension | static
ToLong(this object thisValue, long defValue=0) | SinGooCMS.Utility.Extension.DataTypeChangeExtension | static
ToShort(this object thisValue, short defValue=0) | SinGooCMS.Utility.Extension.DataTypeChangeExtension | static
ToSpliterArray< T >(this string ids, char splitter= ',') | SinGooCMS.Utility.Extension.DataTypeChangeExtension | static
ToSpliterList< T >(this string ids, char splitter= ',') | SinGooCMS.Utility.Extension.DataTypeChangeExtension | static


SinGooCMS.Utility: 成员列表

  • SinGooCMS
  • Utility
  • Extension
  • DateTimeExtension
SinGooCMS.Utility.Extension.DateTimeExtension 成员列表

成员的完整列表，这些成员属于 SinGooCMS.Utility.Extension.DateTimeExtension,包括所有继承而来的类成员

DateDiff(this in DateTime dateTime1, in DateTime dateTime2) | SinGooCMS.Utility.Extension.DateTimeExtension | static
DIZHI | SinGooCMS.Utility.Extension.DateTimeExtension | static
FriendlyDate(this DateTime dt) | SinGooCMS.Utility.Extension.DateTimeExtension | static
GetCNHour(this DateTime time) | SinGooCMS.Utility.Extension.DateTimeExtension | privatestatic
GetMonday(this DateTime someDate) | SinGooCMS.Utility.Extension.DateTimeExtension | static
GetMonthFirstDay(this DateTime someDate) | SinGooCMS.Utility.Extension.DateTimeExtension | static
GetMonthLastDay(this DateTime someDate) | SinGooCMS.Utility.Extension.DateTimeExtension | static
GetQuarterFirstDay(this DateTime someDate) | SinGooCMS.Utility.Extension.DateTimeExtension | static
GetQuarterLastDay(this DateTime someDate) | SinGooCMS.Utility.Extension.DateTimeExtension | static
GetShortDate(DateTime date) | SinGooCMS.Utility.Extension.DateTimeExtension | privatestatic
GetSunday(this DateTime someDate) | SinGooCMS.Utility.Extension.DateTimeExtension | static
GetTotalDays(this in DateTime dt) | SinGooCMS.Utility.Extension.DateTimeExtension | static
GetTotalHours(this in DateTime dt) | SinGooCMS.Utility.Extension.DateTimeExtension | static
GetTotalMicroseconds(this in DateTime dt) | SinGooCMS.Utility.Extension.DateTimeExtension | static
GetTotalMinutes(this in DateTime dt) | SinGooCMS.Utility.Extension.DateTimeExtension | static
GetTotalNanoseconds(this in DateTime dt) | SinGooCMS.Utility.Extension.DateTimeExtension | static
GetUnixTimeMilliseconds(this in DateTime dt) | SinGooCMS.Utility.Extension.DateTimeExtension | static
GetUnixTimeSeconds(this in DateTime dt) | SinGooCMS.Utility.Extension.DateTimeExtension | static
GetWeekFirstDay(this DateTime someDate, bool isCNRule=true) | SinGooCMS.Utility.Extension.DateTimeExtension | static
GetWeekLastDay(this DateTime someDate, bool isCNRule=true) | SinGooCMS.Utility.Extension.DateTimeExtension | static
GetYearFirstDay(this DateTime someDate) | SinGooCMS.Utility.Extension.DateTimeExtension | static
GetYearLastDay(this DateTime someDate) | SinGooCMS.Utility.Extension.DateTimeExtension | static
ToFormatDate(this DateTime dtime, string format="yyyy-MM-dd") | SinGooCMS.Utility.Extension.DateTimeExtension | static
ToFormatDateString(this string strInput, string format="yyyy-MM-dd") | SinGooCMS.Utility.Extension.DateTimeExtension | static
ToFormatString(this DateTime dtime, string format="yyyy-MM-dd HH:mm:ss") | SinGooCMS.Utility.Extension.DateTimeExtension | static
ToFormatStringFull(this DateTime dtime, string format="yyyy-MM-dd HH:mm:ss.fff") | SinGooCMS.Utility.Extension.DateTimeExtension | static
ToFormatTime(this DateTime dtime, string format="HH:mm:ss") | SinGooCMS.Utility.Extension.DateTimeExtension | static
WeekOfYear(this DateTime someDate, bool isOnlyValue=false) | SinGooCMS.Utility.Extension.DateTimeExtension | static


SinGooCMS.Utility: 成员列表

  • SinGooCMS
  • Utility
  • Extension
  • DictionaryExtension
SinGooCMS.Utility.Extension.DictionaryExtension 成员列表

成员的完整列表，这些成员属于 SinGooCMS.Utility.Extension.DictionaryExtension,包括所有继承而来的类成员

GetKey< TKey, TValue >(this IDictionary< TKey, TValue > dict, int @index) | SinGooCMS.Utility.Extension.DictionaryExtension | static
GetValue< TKey, TValue >(this IDictionary< TKey, TValue > dict, int @index) | SinGooCMS.Utility.Extension.DictionaryExtension | static
SortByKey< TKey, TValue >(this IDictionary< TKey, TValue > dict) | SinGooCMS.Utility.Extension.DictionaryExtension | static


SinGooCMS.Utility: 成员列表

  • SinGooCMS
  • Utility
  • Extension
  • DisplayExtAttribute
SinGooCMS.Utility.Extension.DisplayExtAttribute 成员列表

成员的完整列表，这些成员属于 SinGooCMS.Utility.Extension.DisplayExtAttribute,包括所有继承而来的类成员

DisplayExtAttribute() | SinGooCMS.Utility.Extension.DisplayExtAttribute
DisplayExtAttribute(string _name, string _resName, Type _resType, bool _isReadRes=true) | SinGooCMS.Utility.Extension.DisplayExtAttribute
DisplayName | SinGooCMS.Utility.Extension.DisplayExtAttribute
IsReadRes | SinGooCMS.Utility.Extension.DisplayExtAttribute
Name | SinGooCMS.Utility.Extension.DisplayExtAttribute
ResName | SinGooCMS.Utility.Extension.DisplayExtAttribute
ResourceType | SinGooCMS.Utility.Extension.DisplayExtAttribute


SinGooCMS.Utility: 成员列表

  • SinGooCMS
  • Utility
  • Extension
  • EnumExtension
SinGooCMS.Utility.Extension.EnumExtension 成员列表

成员的完整列表，这些成员属于 SinGooCMS.Utility.Extension.EnumExtension,包括所有继承而来的类成员

GetDescription(this System.Enum @enum) | SinGooCMS.Utility.Extension.EnumExtension | static
ToEnum< T >(this string enumName) | SinGooCMS.Utility.Extension.EnumExtension | static


SinGooCMS.Utility: 成员列表

  • SinGooCMS
  • Utility
  • Extension
  • IConvertibleExtension
SinGooCMS.Utility.Extension.IConvertibleExtension 成员列表

成员的完整列表，这些成员属于 SinGooCMS.Utility.Extension.IConvertibleExtension,包括所有继承而来的类成员

To< T >(this IConvertible value) SinGooCMS.Utility.Extension.IConvertibleExtension static


SinGooCMS.Utility: 成员列表

  • SinGooCMS
  • Utility
  • Extension
  • IEnumerableExtension
SinGooCMS.Utility.Extension.IEnumerableExtension 成员列表

成员的完整列表，这些成员属于 SinGooCMS.Utility.Extension.IEnumerableExtension,包括所有继承而来的类成员

AddRange< T >(this ICollection< T > @this, params T[] values) | SinGooCMS.Utility.Extension.IEnumerableExtension | static
AddRangeIf< T >(this ICollection< T > @this, Func< T, bool > predicate, params T[] values) | SinGooCMS.Utility.Extension.IEnumerableExtension | static
AddRangeIfNotContains< T >(this ICollection< T > @this, params T[] values) | SinGooCMS.Utility.Extension.IEnumerableExtension | static
DistinctBy< TSource, TKey >(this IEnumerable< TSource > source, Func< TSource, TKey > keySelector) | SinGooCMS.Utility.Extension.IEnumerableExtension | static
ForEach< T >(this IEnumerable< T > objs, Action< T > action) | SinGooCMS.Utility.Extension.IEnumerableExtension | static
ForEachAsync< T >(this IEnumerable< T > objs, Action< T > action) | SinGooCMS.Utility.Extension.IEnumerableExtension | static
InsertAfter< T >(this IList< T > list, Func< T, bool > condition, T value) | SinGooCMS.Utility.Extension.IEnumerableExtension | static
InsertAfter< T >(this IList< T > list, int index, T value) | SinGooCMS.Utility.Extension.IEnumerableExtension | static
RandomArray< T >(this IEnumerable< T > arr, int multiple=1) | SinGooCMS.Utility.Extension.IEnumerableExtension | static
RandomTake< T >(this List< T > list, Random random=null) | SinGooCMS.Utility.Extension.IEnumerableExtension | static
RemoveWhere< T >(this ICollection< T > @this, Func< T, bool > @where) | SinGooCMS.Utility.Extension.IEnumerableExtension | static
ToDataTable< T >(this IEnumerable< T > list, IDictionary< string, string > custColHeader=null) | SinGooCMS.Utility.Extension.IEnumerableExtension | static
ToHashSet< T, TResult >(this IEnumerable< T > source, Func< T, TResult > selector) | SinGooCMS.Utility.Extension.IEnumerableExtension | static
ToSplitterString(this object[] array, string separator=",") | SinGooCMS.Utility.Extension.IEnumerableExtension | static
ToSplitterString< T >(this IEnumerable< T > sequence, string separator) | SinGooCMS.Utility.Extension.IEnumerableExtension | static


SinGooCMS.Utility: 成员列表

  • SinGooCMS
  • Utility
  • Extension
  • IOExtension
SinGooCMS.Utility.Extension.IOExtension 成员列表

成员的完整列表，这些成员属于 SinGooCMS.Utility.Extension.IOExtension,包括所有继承而来的类成员

GetFileMD5(this Stream fs) | SinGooCMS.Utility.Extension.IOExtension | static
GetFileSha1(this Stream fs) | SinGooCMS.Utility.Extension.IOExtension | static
HashFile(Stream fs, string algo) | SinGooCMS.Utility.Extension.IOExtension | privatestatic
SaveFileAsync(this Stream ms, string filename) | SinGooCMS.Utility.Extension.IOExtension | static
ToBase64String(this FileStream fileStream) | SinGooCMS.Utility.Extension.IOExtension | static
ToBytes(this Stream stream) | SinGooCMS.Utility.Extension.IOExtension | static
ToStream(this byte[] bytes) | SinGooCMS.Utility.Extension.IOExtension | static
WriteToFileAsync(this byte[] bytes, string fileName) | SinGooCMS.Utility.Extension.IOExtension | static


SinGooCMS.Utility: 成员列表

  • SinGooCMS
  • Utility
  • Extension
  • ImageExtension
SinGooCMS.Utility.Extension.ImageExtension 成员列表

成员的完整列表，这些成员属于 SinGooCMS.Utility.Extension.ImageExtension,包括所有继承而来的类成员

ColorFilter(this Image mybm) | SinGooCMS.Utility.Extension.ImageExtension | static
Compress(this Image bmp, int newWidth, int newHeight) | SinGooCMS.Utility.Extension.ImageExtension | static
CompressHeight(this Image bmp, int newHeight) | SinGooCMS.Utility.Extension.ImageExtension | static
CompressRate(this Image bmp, float rate=0.6f) | SinGooCMS.Utility.Extension.ImageExtension | static
CompressWidth(this Image bmp, int newWidth) | SinGooCMS.Utility.Extension.ImageExtension | static
CutAndResize(this Image bmp, Rectangle rec, int newWidth, int newHeight) | SinGooCMS.Utility.Extension.ImageExtension | static
CutImage(this Image b, Rectangle rec) | SinGooCMS.Utility.Extension.ImageExtension | static
GetFrames(this Image gif, string pSavedPath) | SinGooCMS.Utility.Extension.ImageExtension | static
LDPic(this Image mybm, int val) | SinGooCMS.Utility.Extension.ImageExtension | static
LeftRightRev(this Image mybm) | SinGooCMS.Utility.Extension.ImageExtension | static
Mosaic(this Image mybm, int effectWidth=10) | SinGooCMS.Utility.Extension.ImageExtension | static
Relief(this Image oldBitmap) | SinGooCMS.Utility.Extension.ImageExtension | static
RePic(this Image mybm) | SinGooCMS.Utility.Extension.ImageExtension | static
ResizeImage(this Image bmp, int newW, int newH) | SinGooCMS.Utility.Extension.ImageExtension | static
ThumbnailImage(this Image originalImage, int width, int height, ThumbnailCutMode mode=ThumbnailCutMode.Cut) | SinGooCMS.Utility.Extension.ImageExtension | static
ToBase64(this Image image) | SinGooCMS.Utility.Extension.ImageExtension | static
ToBWPic(this Image mybm) | SinGooCMS.Utility.Extension.ImageExtension | static
UpDownRev(this Image mybm) | SinGooCMS.Utility.Extension.ImageExtension | static


SinGooCMS.Utility: 成员列表

  • SinGooCMS
  • Utility
  • Extension
  • JsonserializeExtension
SinGooCMS.Utility.Extension.JsonserializeExtension 成员列表

成员的完整列表，这些成员属于 SinGooCMS.Utility.Extension.JsonserializeExtension,包括所有继承而来的类成员

JsonToAnonymousObject< T >(this string strJson, T obj) | SinGooCMS.Utility.Extension.JsonserializeExtension | static
JsonToObject< T >(this string strJson) | SinGooCMS.Utility.Extension.JsonserializeExtension | static
ToJson(this DataSet ds) | SinGooCMS.Utility.Extension.JsonserializeExtension | static
ToJson(this DataTable dt) | SinGooCMS.Utility.Extension.JsonserializeExtension | static
ToJson< T >(this T t) | SinGooCMS.Utility.Extension.JsonserializeExtension | static


SinGooCMS.Utility: 成员列表

  • SinGooCMS
  • Utility
  • Extension
  • LinqExtension
SinGooCMS.Utility.Extension.LinqExtension 成员列表

成员的完整列表，这些成员属于 SinGooCMS.Utility.Extension.LinqExtension,包括所有继承而来的类成员

GetOrderExpression(Type objType, PropertyInfo pi) | SinGooCMS.Utility.Extension.LinqExtension | privatestatic
GetPropertyInfo(Type objType, string name) | SinGooCMS.Utility.Extension.LinqExtension | privatestatic
OrderByBatch< T >(this IEnumerable< T > query, string orderBy) | SinGooCMS.Utility.Extension.LinqExtension | static
OrderByBatch< T >(this IQueryable< T > query, string orderBy) | SinGooCMS.Utility.Extension.LinqExtension | static


SinGooCMS.Utility: 成员列表

  • SinGooCMS
  • Utility
  • Extension
  • ObjectExtension
SinGooCMS.Utility.Extension.ObjectExtension 成员列表

成员的完整列表，这些成员属于 SinGooCMS.Utility.Extension.ObjectExtension,包括所有继承而来的类成员

DeepClone< T >(this T obj) | SinGooCMS.Utility.Extension.ObjectExtension | static
MapTo< TSource, TDestination >(this TSource source, Func< TDestination, TDestination > thenDeal=null) | SinGooCMS.Utility.Extension.ObjectExtension | static
MapToList< TSource, TDestination >(this IEnumerable< TSource > source, Func< IEnumerable< TDestination >, IEnumerable< TDestination >> thenDeal=null) | SinGooCMS.Utility.Extension.ObjectExtension | static
ReferenceEquals(this object obj, object o) | SinGooCMS.Utility.Extension.ObjectExtension | static


SinGooCMS.Utility: 成员列表

  • SinGooCMS
  • Utility
  • Extension
  • ReflectExtension
SinGooCMS.Utility.Extension.ReflectExtension 成员列表

成员的完整列表，这些成员属于 SinGooCMS.Utility.Extension.ReflectExtension,包括所有继承而来的类成员

bindingFlags | SinGooCMS.Utility.Extension.ReflectExtension | privatestatic
GetField(this object obj, string name) | SinGooCMS.Utility.Extension.ReflectExtension | static
GetFields(this object obj) | SinGooCMS.Utility.Extension.ReflectExtension | static
GetFieldVal< T >(this object obj, string name) | SinGooCMS.Utility.Extension.ReflectExtension | static
GetImageResource(this Type assemblyType, string resourceName) | SinGooCMS.Utility.Extension.ReflectExtension | static
GetManifestString(this Type assemblyType, string charset, string resName) | SinGooCMS.Utility.Extension.ReflectExtension | static
GetProperty(this object obj, string name) | SinGooCMS.Utility.Extension.ReflectExtension | static
GetPropertyVal< T >(this object obj, string name) | SinGooCMS.Utility.Extension.ReflectExtension | static
GetResString(this Type assemblyType, string resName, string resourceHolder) | SinGooCMS.Utility.Extension.ReflectExtension | static
GetResString(this Type assemblyType, string resName, CultureInfo cultureInfo=null) | SinGooCMS.Utility.Extension.ReflectExtension | static
InvokeMethod(this object obj, string methodName, Type[] typeParameters, object[] args) | SinGooCMS.Utility.Extension.ReflectExtension | static
LoadBitmap(this Type assemblyType, string resourceHolder, string imageName) | SinGooCMS.Utility.Extension.ReflectExtension | static
SetFieldVal(this object obj, string name, object value) | SinGooCMS.Utility.Extension.ReflectExtension | static
SetPropertyVal(this object obj, string name, object value) | SinGooCMS.Utility.Extension.ReflectExtension | static


SinGooCMS.Utility: 成员列表

  • SinGooCMS
  • Utility
  • Extension
  • StreamExtension
SinGooCMS.Utility.Extension.StreamExtension 成员列表

成员的完整列表，这些成员属于 SinGooCMS.Utility.Extension.StreamExtension,包括所有继承而来的类成员

CopyToFileAsync(this Stream fs, string dest, int bufferSize=1024 *1024 *8) | SinGooCMS.Utility.Extension.StreamExtension | static
SaveAsMemoryStream(this Stream stream) | SinGooCMS.Utility.Extension.StreamExtension | static
SaveFile(this MemoryStream ms, string filename) | SinGooCMS.Utility.Extension.StreamExtension | static
ToArray(this Stream stream) | SinGooCMS.Utility.Extension.StreamExtension | static


SinGooCMS.Utility: 成员列表

  • SinGooCMS
  • Utility
  • Extension
  • StringExtension
SinGooCMS.Utility.Extension.StringExtension 成员列表

成员的完整列表，这些成员属于 SinGooCMS.Utility.Extension.StringExtension,包括所有继承而来的类成员

AsDecodeUrl(this string urlString) | SinGooCMS.Utility.Extension.StringExtension | static
AsEncodeUrl(this string urlString) | SinGooCMS.Utility.Extension.StringExtension | static
ContainsWithSplitter(this string source, string target, string splitter=",") | SinGooCMS.Utility.Extension.StringExtension | static
JoinSplitter(this string str, string splitter=",") | SinGooCMS.Utility.Extension.StringExtension | static
Mask(this string str, char mask= '*') | SinGooCMS.Utility.Extension.StringExtension | static
RemoveHtml(this string htmlstring) | SinGooCMS.Utility.Extension.StringExtension | static
RemoveWhiteSpace(this string strInput) | SinGooCMS.Utility.Extension.StringExtension | static
ToHtml(this string strTxt) | SinGooCMS.Utility.Extension.StringExtension | static
ToRMB(this decimal decMoney) | SinGooCMS.Utility.Extension.StringExtension | static
ToTxt(this string htmlBlock) | SinGooCMS.Utility.Extension.StringExtension | static
ToUrlDictionary(this string url) | SinGooCMS.Utility.Extension.StringExtension | static
ToUrlSearch(this IDictionary< string, string > data) | SinGooCMS.Utility.Extension.StringExtension | static


SinGooCMS.Utility: 成员列表

  • SinGooCMS
  • Utility
  • Extension
  • TaskExtensions
SinGooCMS.Utility.Extension.TaskExtensions 成员列表

成员的完整列表，这些成员属于 SinGooCMS.Utility.Extension.TaskExtensions,包括所有继承而来的类成员

ForEachInOrder(this IEnumerable< Task > tasks, Action< Task > action) | SinGooCMS.Utility.Extension.TaskExtensions | static
ForEachInOrder< T >(this IEnumerable< Task< T >> tasks, Action< T > action) | SinGooCMS.Utility.Extension.TaskExtensions | static
GetAwaiter(this IEnumerable< Task > tasks) | SinGooCMS.Utility.Extension.TaskExtensions | static
GetAwaiter< T >(this IEnumerable< Task< T >> tasks) | SinGooCMS.Utility.Extension.TaskExtensions | static
HandleException< T >(this Task task, Action< T > exceptionHandler) | SinGooCMS.Utility.Extension.TaskExtensions | static
HandleExceptions(this Task task, Action< Exception > exceptionsHandler) | SinGooCMS.Utility.Extension.TaskExtensions | static
HandleExceptions(this Task task, Func< Exception, bool > exceptionPredicate, Action< Exception > exceptionHandler) | SinGooCMS.Utility.Extension.TaskExtensions | static
TimeoutAfter(this Task task, TimeSpan timeout) | SinGooCMS.Utility.Extension.TaskExtensions | static
TimeoutAfter(this IEnumerable< Task > tasks, TimeSpan timeout) | SinGooCMS.Utility.Extension.TaskExtensions | static
TimeoutAfter< T >(this Task< T > task, TimeSpan timeout) | SinGooCMS.Utility.Extension.TaskExtensions | static
TimeoutAfter< T >(this IEnumerable< Task< T >> tasks, TimeSpan timeout) | SinGooCMS.Utility.Extension.TaskExtensions | static
TimeoutAfterImpl(this Task task, TimeSpan timeoutPeriod) | SinGooCMS.Utility.Extension.TaskExtensions | privatestatic
TimeoutAfterImpl(this IEnumerable< Task > tasks, TimeSpan timeoutPeriod) | SinGooCMS.Utility.Extension.TaskExtensions | privatestatic


SinGooCMS.Utility: 成员列表

  • SinGooCMS
  • Utility
  • Extension
  • TypeExtensions
SinGooCMS.Utility.Extension.TypeExtensions 成员列表

成员的完整列表，这些成员属于 SinGooCMS.Utility.Extension.TypeExtensions,包括所有继承而来的类成员

classNamesCache | SinGooCMS.Utility.Extension.TypeExtensions | privatestatic
GetAttributeToPropertyMapping< T >(this Type type, bool inherit=true) | SinGooCMS.Utility.Extension.TypeExtensions | static
GetClassFullName(this Type type) | SinGooCMS.Utility.Extension.TypeExtensions | static
GetDefault(this Type type) | SinGooCMS.Utility.Extension.TypeExtensions | static
GetInstanceProperties(this Type type, bool inherit=true, bool includePrivate=true) | SinGooCMS.Utility.Extension.TypeExtensions | static
GetInstanceProperties(this TypeInfo typeInfo, bool inherit, bool includePrivate) | SinGooCMS.Utility.Extension.TypeExtensions | static
GetParents(List< Type > parents, Type type) | SinGooCMS.Utility.Extension.TypeExtensions | privatestatic
GetPropertiesWithAttribute< T >(this Type type, bool inherit=true) | SinGooCMS.Utility.Extension.TypeExtensions | static
GetTypeCode(this Type type) | SinGooCMS.Utility.Extension.TypeExtensions | static
HasDefaultConstructor(this Type type) | SinGooCMS.Utility.Extension.TypeExtensions | static
IsArrayOf< T >(this Type type) | SinGooCMS.Utility.Extension.TypeExtensions | static
IsGenericList(this Type type) | SinGooCMS.Utility.Extension.TypeExtensions | static
IsImplements< T >(this Type type) | SinGooCMS.Utility.Extension.TypeExtensions | static
IsNullable(this Type type) | SinGooCMS.Utility.Extension.TypeExtensions | static
IsNumeric(this Type type) | SinGooCMS.Utility.Extension.TypeExtensions | static
IsSequence(this Type type, out SequenceType sequenceType) | SinGooCMS.Utility.Extension.TypeExtensions | static
IsSimpleType(this Type type) | SinGooCMS.Utility.Extension.TypeExtensions | static
NonGenericCollectionsToSequenceTypeMapping | SinGooCMS.Utility.Extension.TypeExtensions | privatestatic
shortNames | SinGooCMS.Utility.Extension.TypeExtensions | privatestatic
SimpleTypes | SinGooCMS.Utility.Extension.TypeExtensions | privatestatic
TryGetAttributes< T >(this Type type, out T[] attributes, bool inherit=true) | SinGooCMS.Utility.Extension.TypeExtensions | static
TryGetGenericArguments(this Type type, out Type[] genericArguments) | SinGooCMS.Utility.Extension.TypeExtensions | static
TryGetInstanceProperty(this Type type, string propertyName, out PropertyInfo property, bool inherit=true) | SinGooCMS.Utility.Extension.TypeExtensions | static


SinGooCMS.Utility: 成员列表

  • SinGooCMS
  • Utility
  • Extension
  • UriExtension
SinGooCMS.Utility.Extension.UriExtension 成员列表

成员的完整列表，这些成员属于 SinGooCMS.Utility.Extension.UriExtension,包括所有继承而来的类成员

AddOrAppendToQueryString(Uri uri, string query) | SinGooCMS.Utility.Extension.UriExtension | privatestatic
AddParametersToQueryString(this Uri uri, string parameter, string value) | SinGooCMS.Utility.Extension.UriExtension | static
AddParametersToQueryString(this Uri uri, IDictionary< string, string > pairs) | SinGooCMS.Utility.Extension.UriExtension | static
ParseQueryString(this Uri uri) | SinGooCMS.Utility.Extension.UriExtension | static
QueryStringRegex | SinGooCMS.Utility.Extension.UriExtension | privatestatic


SinGooCMS.Utility: 成员列表

  • SinGooCMS
  • Utility
  • Extension
  • ValidateExtension
SinGooCMS.Utility.Extension.ValidateExtension 成员列表

成员的完整列表，这些成员属于 SinGooCMS.Utility.Extension.ValidateExtension,包括所有继承而来的类成员

IsBetween(this int thisValue, int begin, int end) | SinGooCMS.Utility.Extension.ValidateExtension | static
IsBetween(this decimal thisValue, decimal begin, decimal end) | SinGooCMS.Utility.Extension.ValidateExtension | static
IsBetween(this DateTime thisValue, DateTime begin, DateTime end) | SinGooCMS.Utility.Extension.ValidateExtension | static
IsDate(this string thisValue) | SinGooCMS.Utility.Extension.ValidateExtension | static
IsDecimal(this string thisValue) | SinGooCMS.Utility.Extension.ValidateExtension | static
IsEmail(this string thisValue) | SinGooCMS.Utility.Extension.ValidateExtension | static
IsEn(this string thisValue) | SinGooCMS.Utility.Extension.ValidateExtension | static
IsFax(this string thisValue) | SinGooCMS.Utility.Extension.ValidateExtension | static
IsGuid(this string thisValue) | SinGooCMS.Utility.Extension.ValidateExtension | static
IsIDCard(this string thisValue) | SinGooCMS.Utility.Extension.ValidateExtension | static
IsImage(this string fileName) | SinGooCMS.Utility.Extension.ValidateExtension | static
IsInt(this string thisValue) | SinGooCMS.Utility.Extension.ValidateExtension | static
IsIP(this string thisValue) | SinGooCMS.Utility.Extension.ValidateExtension | static
IsJson(this string txtJson) | SinGooCMS.Utility.Extension.ValidateExtension | static
IsMatch(this string thisValue, string pattern) | SinGooCMS.Utility.Extension.ValidateExtension | static
IsMobile(this string thisValue) | SinGooCMS.Utility.Extension.ValidateExtension | static
IsNoInt(this string thisValue) | SinGooCMS.Utility.Extension.ValidateExtension | static
IsNotNullOrEmpty(this object thisValue) | SinGooCMS.Utility.Extension.ValidateExtension | static
IsNullOrEmpty(this object thisValue) | SinGooCMS.Utility.Extension.ValidateExtension | static
IsNullOrWhiteSpace(this object thisValue) | SinGooCMS.Utility.Extension.ValidateExtension | static
IsTelephone(this string thisValue) | SinGooCMS.Utility.Extension.ValidateExtension | static
IsUrl(this string thisValue) | SinGooCMS.Utility.Extension.ValidateExtension | static
IsZHCN(this string thisValue) | SinGooCMS.Utility.Extension.ValidateExtension | static


SinGooCMS.Utility: 成员列表

  • SinGooCMS
  • Utility
  • Extension
  • XmlserializeExtension
SinGooCMS.Utility.Extension.XmlserializeExtension 成员列表

成员的完整列表，这些成员属于 SinGooCMS.Utility.Extension.XmlserializeExtension,包括所有继承而来的类成员

ToXml< T >(this T t) | SinGooCMS.Utility.Extension.XmlserializeExtension | static
XmlToObject< T >(this string strXml) | SinGooCMS.Utility.Extension.XmlserializeExtension | static


SinGooCMS.Utility: 成员列表

  • SinGooCMS
  • Utility
  • FileUtils
SinGooCMS.Utility.FileUtils 成员列表

成员的完整列表，这些成员属于 SinGooCMS.Utility.FileUtils,包括所有继承而来的类成员

BackupFile(string sourceFileName, string destFileName, bool overwrite) | SinGooCMS.Utility.FileUtils | static
BackupFile(string sourceFileName, string destFileName) | SinGooCMS.Utility.FileUtils | static
Combine(string dir, string fileName) | SinGooCMS.Utility.FileUtils | static
CopyDirectory(string SourcePath, string DestinationPath) | SinGooCMS.Utility.FileUtils | static
CopyFolder(string sourcesAbsoluteDir, string destAbsoluteDir) | SinGooCMS.Utility.FileUtils | privatestatic
CreateDirectory(string absoluteDir) | SinGooCMS.Utility.FileUtils | static
CreateFileAsync(string absolutePath, string fileContent, Encoding encoding=null) | SinGooCMS.Utility.FileUtils | static
DeleteDirectory(string absoluteDir) | SinGooCMS.Utility.FileUtils | static
GetAllFiles(string absoluteDir) | SinGooCMS.Utility.FileUtils | static
GetContentType(string filePath) | SinGooCMS.Utility.FileUtils | static
GetDirectoryLength(string absoluteDir) | SinGooCMS.Utility.FileUtils | static
GetFileSize(decimal length, FileSizeUnit unit=FileSizeUnit.KB) | SinGooCMS.Utility.FileUtils | static
ReadFileContentAsync(string absolutePath, Encoding encoding=null) | SinGooCMS.Utility.FileUtils | static
ReadFileToBytes(string fileName) | SinGooCMS.Utility.FileUtils | static
ReadFileToStream(string fileName) | SinGooCMS.Utility.FileUtils | static
ReNameFile(string absolutePath, string oldName, string newName, bool isFile=true) | SinGooCMS.Utility.FileUtils | static
RestoreFile(string backupFileName, string targetFileName, string backupTargetFileName) | SinGooCMS.Utility.FileUtils | static
RestoreFile(string backupFileName, string targetFileName) | SinGooCMS.Utility.FileUtils | static
WriteFileContentAsync(string absolutePath, string fileContent, bool isAppend=false, Encoding encoding=null) | SinGooCMS.Utility.FileUtils | static


SinGooCMS.Utility: 成员列表

  • SinGooCMS
  • Utility
  • FtpClient
SinGooCMS.Utility.FtpClient 成员列表

成员的完整列表，这些成员属于 SinGooCMS.Utility.FtpClient,包括所有继承而来的类成员

BrokenDownload(string remoteFileName, string localFileName, long size, Action< int, int > updateProgress=null) | SinGooCMS.Utility.FtpClient |
Delete(string filePath) | SinGooCMS.Utility.FtpClient |
DirectoryExist(string remoteDirPath) | SinGooCMS.Utility.FtpClient |
Download(string remoteFileName, string localFileName, Action< int, int > updateProgress=null) | SinGooCMS.Utility.FtpClient |
Download(string remoteFileName, string localFileName, bool brokenOpen, Action< int, int > updateProgress=null) | SinGooCMS.Utility.FtpClient |
FileExist(string remoteFileName) | SinGooCMS.Utility.FtpClient |
FtpServer | SinGooCMS.Utility.FtpClient | private
GenerateFtpReq(Uri uri, string method) | SinGooCMS.Utility.FtpClient | private
GetAnonymousClient(string serverIp, bool passiveModel=false) | SinGooCMS.Utility.FtpClient | static
GetClient(string serverIp, string username, string password, bool passiveModel=false) | SinGooCMS.Utility.FtpClient | static
GetDirectories(string relativePath) | SinGooCMS.Utility.FtpClient |
GetFiles(string relativePath="", string mask="*.*") | SinGooCMS.Utility.FtpClient |
GetFilesDetails(string relativePath="") | SinGooCMS.Utility.FtpClient |
GetFileSize(string filePath, string remoteFilepath) | SinGooCMS.Utility.FtpClient |
GetFileSize(string filePath) | SinGooCMS.Utility.FtpClient |
IsCredential | SinGooCMS.Utility.FtpClient | private
MakeDir(string relativePath, string newDir) | SinGooCMS.Utility.FtpClient |
MoveFile(string relativePath, string currentFilename, string newDirectory) | SinGooCMS.Utility.FtpClient |
PassiveMode | SinGooCMS.Utility.FtpClient | private
Password | SinGooCMS.Utility.FtpClient | private
RemoveDirectory(string dirPath) | SinGooCMS.Utility.FtpClient |
RemoveSpaces(string str) | SinGooCMS.Utility.FtpClient | private
Rename(string relativePath, string currentFilename, string newFilename) | SinGooCMS.Utility.FtpClient |
UploadBroken(string localFullPath, string remoteFilepath, Action< int, int > updateProgress=null) | SinGooCMS.Utility.FtpClient |
UploadFile(string relativePath, string localFullPathName, Action< int, int > updateProgress=null) | SinGooCMS.Utility.FtpClient |
Username | SinGooCMS.Utility.FtpClient | private


SinGooCMS.Utility: 成员列表

  • SinGooCMS
  • Utility
  • GenericAccessor
SinGooCMS.Utility.GenericAccessor< TInstance > 成员列表

成员的完整列表，这些成员属于 SinGooCMS.Utility.GenericAccessor< TInstance >,包括所有继承而来的类成员

_genericInstanceGettersCache | SinGooCMS.Utility.GenericAccessor< TInstance > | private
_genericInstanceSettersCache | SinGooCMS.Utility.GenericAccessor< TInstance > | private
_genericPropertiesGettersCache | SinGooCMS.Utility.GenericAccessor< TInstance > | private
_genericPropertiesSettersCache | SinGooCMS.Utility.GenericAccessor< TInstance > | private
Accessor(IReflect type, bool ignoreCase, bool includeNonPublic) | SinGooCMS.Utility.Accessor | protected
Build(object instance, bool ignoreCase=false, bool includeNonPublic=false) | SinGooCMS.Utility.Accessor | static
Build(Type instanceType, bool ignoreCase=false, bool includeNonPublic=false) | SinGooCMS.Utility.Accessor | static
Build< TInstance >(bool ignoreCase=false, bool includeNonPublic=false) | SinGooCMS.Utility.Accessor | static
Comparer | SinGooCMS.Utility.Accessor | protected
IgnoreCase | SinGooCMS.Utility.Accessor |
IncludesNonPublic | SinGooCMS.Utility.Accessor |
Properties | SinGooCMS.Utility.Accessor |
this[object instance, string propertyName] | SinGooCMS.Utility.ObjectAccessor |
this[TInstance instance, string propertyName] | SinGooCMS.Utility.GenericAccessor< TInstance > |
TryGet< TProperty >(TInstance instance, string propertyName, out TProperty value) | SinGooCMS.Utility.GenericAccessor< TInstance > |
TrySet< TProperty >(TInstance instance, string propertyName, TProperty value) | SinGooCMS.Utility.GenericAccessor< TInstance > |
Type | SinGooCMS.Utility.Accessor |


SinGooCMS.Utility: 成员列表

  • SinGooCMS
  • Utility
  • HexUtils
SinGooCMS.Utility.HexUtils 成员列表

成员的完整列表，这些成员属于 SinGooCMS.Utility.HexUtils,包括所有继承而来的类成员

FromHex(string hexadecimalInput) | SinGooCMS.Utility.HexUtils | static
FromHexTable | SinGooCMS.Utility.HexUtils | privatestatic
FromHexTable16 | SinGooCMS.Utility.HexUtils | privatestatic
GetStrFromHex(string hexadecimalInput) | SinGooCMS.Utility.HexUtils | static
SpaceCharacter | SinGooCMS.Utility.HexUtils | private
ToHex(string txt) | SinGooCMS.Utility.HexUtils | static
ToHex(byte[] bytes) | SinGooCMS.Utility.HexUtils | static
ToHexTable | SinGooCMS.Utility.HexUtils | privatestatic


SinGooCMS.Utility: 成员列表

  • SinGooCMS
  • Utility
  • IISUtils
SinGooCMS.Utility.IISUtils 成员列表

成员的完整列表，这些成员属于 SinGooCMS.Utility.IISUtils,包括所有继承而来的类成员

AddDefaultDocument(string siteName, string defaultDocName) | SinGooCMS.Utility.IISUtils | static
AddHostBinding(string siteName, string ip, string port, string domain, string bindingProtocol="http") | SinGooCMS.Utility.IISUtils | static
CreateSite(string siteName, string bindingInfo, string physicalPath) | SinGooCMS.Utility.IISUtils | static
CreateSite(string siteName, string protocol, string bindingInformation, string physicalPath, bool createAppPool, string appPoolName, ProcessModelIdentityType identityType, string appPoolUserName, string appPoolPassword, ManagedPipelineMode appPoolPipelineMode, string managedRuntimeVersion) | SinGooCMS.Utility.IISUtils | static
CreateVDir(string siteName, string vDirName, string physicalPath) | SinGooCMS.Utility.IISUtils | static
DeleteDefaultDocument(string siteName, string defaultDocName) | SinGooCMS.Utility.IISUtils | static
DeleteHostBinding(string siteName, string ip, string port, string domain) | SinGooCMS.Utility.IISUtils | static
DeletePool(string appPoolName) | SinGooCMS.Utility.IISUtils | static
DeleteSite(string siteName, Boolean isAppPool=true) | SinGooCMS.Utility.IISUtils | static
DeleteVDir(string siteName, string vDirName) | SinGooCMS.Utility.IISUtils | static
GetSiteInfo(string siteName) | SinGooCMS.Utility.IISUtils | static
GetSiteList() | SinGooCMS.Utility.IISUtils | static
PoolsStart(string poolName) | SinGooCMS.Utility.IISUtils | static
PoolsStop(string poolName) | SinGooCMS.Utility.IISUtils | static
Start(string siteName) | SinGooCMS.Utility.IISUtils | static
Stop(string siteName) | SinGooCMS.Utility.IISUtils | static


SinGooCMS.Utility: 成员列表

  • SinGooCMS
  • Utility
  • IPAreaInfo
SinGooCMS.Utility.IPAreaInfo 成员列表

成员的完整列表，这些成员属于 SinGooCMS.Utility.IPAreaInfo,包括所有继承而来的类成员

City | SinGooCMS.Utility.IPAreaInfo
Country | SinGooCMS.Utility.IPAreaInfo
County | SinGooCMS.Utility.IPAreaInfo
Province | SinGooCMS.Utility.IPAreaInfo
ToString() | SinGooCMS.Utility.IPAreaInfo


SinGooCMS.Utility: 成员列表

  • SinGooCMS
  • Utility
  • IPScanner
SinGooCMS.Utility.IPScanner 成员列表

成员的完整列表，这些成员属于 SinGooCMS.Utility.IPScanner,包括所有继承而来的类成员

country | SinGooCMS.Utility.IPScanner | private
Country | SinGooCMS.Utility.IPScanner |
countryFlag | SinGooCMS.Utility.IPScanner | private
DataPath | SinGooCMS.Utility.IPScanner |
dataPath | SinGooCMS.Utility.IPScanner | private
endIp | SinGooCMS.Utility.IPScanner | private
endIpOff | SinGooCMS.Utility.IPScanner | private
ErrMsg | SinGooCMS.Utility.IPScanner |
errMsg | SinGooCMS.Utility.IPScanner | private
firstStartIp | SinGooCMS.Utility.IPScanner | private
GetCountry() | SinGooCMS.Utility.IPScanner | private
GetEndIp() | SinGooCMS.Utility.IPScanner | private
GetFlagStr(long offSet) | SinGooCMS.Utility.IPScanner | private
GetStartIp(long recNO) | SinGooCMS.Utility.IPScanner | private
GetStr() | SinGooCMS.Utility.IPScanner | private
IntToIP(long ip_Int) | SinGooCMS.Utility.IPScanner | private
ip | SinGooCMS.Utility.IPScanner | private
IP | SinGooCMS.Utility.IPScanner |
IPLocation(string ip="", string dataPath="") | SinGooCMS.Utility.IPScanner |
IPScanner(string dbPath="/ipdata/qqwry.dat") | SinGooCMS.Utility.IPScanner |
IpToInt(string ip) | SinGooCMS.Utility.IPScanner | private
IsChineseIP(string ip) | SinGooCMS.Utility.IPScanner |
lastStartIp | SinGooCMS.Utility.IPScanner | private
local | SinGooCMS.Utility.IPScanner | private
Local | SinGooCMS.Utility.IPScanner |
objfs | SinGooCMS.Utility.IPScanner | private
QQwry() | SinGooCMS.Utility.IPScanner | private
startIp | SinGooCMS.Utility.IPScanner | private


SinGooCMS.Utility: 成员列表

  • SinGooCMS
  • Utility
  • IPUtils
SinGooCMS.Utility.IPUtils 成员列表

成员的完整列表，这些成员属于 SinGooCMS.Utility.IPUtils,包括所有继承而来的类成员

GetIP() | SinGooCMS.Utility.IPUtils | static
GetIPAreaStr(string ip="") | SinGooCMS.Utility.IPUtils | static
IP2IntArr(string strIP) | SinGooCMS.Utility.IPUtils | static
IsInIPDuan(string strCurrIP, string strBeginIP, string strEndIP) | SinGooCMS.Utility.IPUtils | static


SinGooCMS.Utility: 成员列表

  • SinGooCMS
  • Utility
  • IdCardUtils
SinGooCMS.Utility.IdCardUtils 成员列表

成员的完整列表，这些成员属于 SinGooCMS.Utility.IdCardUtils,包括所有继承而来的类成员

Age | SinGooCMS.Utility.IdCardUtils |
BirthDay | SinGooCMS.Utility.IdCardUtils |
CardNo | SinGooCMS.Utility.IdCardUtils |
IdCardUtils() | SinGooCMS.Utility.IdCardUtils | private
Parse(string cardno) | SinGooCMS.Utility.IdCardUtils | static
parseAge() | SinGooCMS.Utility.IdCardUtils | private
parseBrithday() | SinGooCMS.Utility.IdCardUtils | private
parseSex() | SinGooCMS.Utility.IdCardUtils | private
RegionCode | SinGooCMS.Utility.IdCardUtils |
Sex | SinGooCMS.Utility.IdCardUtils |


SinGooCMS.Utility: 成员列表

  • SinGooCMS
  • Utility
  • ImageUtils
SinGooCMS.Utility.ImageUtils 成员列表

成员的完整列表，这些成员属于 SinGooCMS.Utility.ImageUtils,包括所有继承而来的类成员

AddImageWatermark(string originalImagePath, string watermarkImage, WatermarkPosition watermarkPosition=WatermarkPosition.MiddleCenter, float alpha=0.5f, string watermarkFilePath="") | SinGooCMS.Utility.ImageUtils | static
AddTextWatermark(string originalImagePath, string watermarkText, string fontColor="#ff0000", string fontFamily="黑体", WatermarkPosition watermarkPosition=WatermarkPosition.MiddleCenter, float alpha=0.2f, string watermarkFilePath="") | SinGooCMS.Utility.ImageUtils | static
AddTextWatermark(string originalImagePath, string watermarkText, int fontSize, string fontColor, string fontFamily, WatermarkPosition watermarkPosition=WatermarkPosition.MiddleCenter, float alpha=0.5f, string watermarkFilePath="") | SinGooCMS.Utility.ImageUtils | static
AddWatermark(string originalImagePath, string watermarkType, string watermarkImage, string watermarkText, int fontSize, string fontColor, string fontFamily, WatermarkPosition watermarkPosition, float alpha, string watermarkFilePath="") | SinGooCMS.Utility.ImageUtils | static
Base64StrToImage(string base64String) | SinGooCMS.Utility.ImageUtils | static
ImageToBase64(string fileFullName) | SinGooCMS.Utility.ImageUtils | static
MakeThumbnail(string originalFileName, int width, int height, string thumbnailFileName="", ThumbnailCutMode mode=ThumbnailCutMode.Cut) | SinGooCMS.Utility.ImageUtils | static
ReadFileBitmap(string filePath) | SinGooCMS.Utility.ImageUtils | static
ReadFileToImage(string filePath) | SinGooCMS.Utility.ImageUtils | static


SinGooCMS.Utility: 成员列表

  • SinGooCMS
  • Utility
  • JsonFileUtils
SinGooCMS.Utility.JsonFileUtils 成员列表

成员的完整列表，这些成员属于 SinGooCMS.Utility.JsonFileUtils,包括所有继承而来的类成员

locker | SinGooCMS.Utility.JsonFileUtils | privatestatic
Read< T >(string filePath) | SinGooCMS.Utility.JsonFileUtils | static
ReadList< T >(string filePath) | SinGooCMS.Utility.JsonFileUtils | static
Save< T >(T configModel, string filePath) | SinGooCMS.Utility.JsonFileUtils | static
Save< T >(List< T > lst, string filePath) | SinGooCMS.Utility.JsonFileUtils | static


SinGooCMS.Utility: 成员列表

  • SinGooCMS
  • Utility
  • LibInvoker
SinGooCMS.Utility.LibInvoker 成员列表

成员的完整列表，这些成员属于 SinGooCMS.Utility.LibInvoker,包括所有继承而来的类成员

FreeLibrary(IntPtr lib) | SinGooCMS.Utility.LibInvoker | privatestatic
GetProcAddress(IntPtr lib, string funcName) | SinGooCMS.Utility.LibInvoker | privatestatic
hLib | SinGooCMS.Utility.LibInvoker | private
Invoke(string APIName, Type t) | SinGooCMS.Utility.LibInvoker |
Invoke(string DLLPath, string dllName, string className, string methodName, params object[] methodParam) | SinGooCMS.Utility.LibInvoker | static
LibInvoker(string DLLPath) | SinGooCMS.Utility.LibInvoker |
LoadLibrary(string path) | SinGooCMS.Utility.LibInvoker | privatestatic
~LibInvoker() | SinGooCMS.Utility.LibInvoker | private


SinGooCMS.Utility: 成员列表

  • SinGooCMS
  • Utility
  • MailConfig
SinGooCMS.Utility.MailConfig 成员列表

成员的完整列表，这些成员属于 SinGooCMS.Utility.MailConfig,包括所有继承而来的类成员

FromDisplayName | SinGooCMS.Utility.MailConfig
ServMailAccount | SinGooCMS.Utility.MailConfig
ServMailIsSSL | SinGooCMS.Utility.MailConfig
ServMailPort | SinGooCMS.Utility.MailConfig
ServMailSMTP | SinGooCMS.Utility.MailConfig
ServMailUserName | SinGooCMS.Utility.MailConfig
ServMailUserPwd | SinGooCMS.Utility.MailConfig


SinGooCMS.Utility: 成员列表

  • SinGooCMS
  • Utility
  • MailUtils
SinGooCMS.Utility.MailUtils 成员列表

成员的完整列表，这些成员属于 SinGooCMS.Utility.MailUtils,包括所有继承而来的类成员

Config | SinGooCMS.Utility.MailUtils | private
Create(MailConfig mailConfig) | SinGooCMS.Utility.MailUtils | static
isSuccess | SinGooCMS.Utility.MailUtils |
SendEmail(string rctMail, string subject, string body) | SinGooCMS.Utility.MailUtils | private
SendEmailAsync(string rctMail, string subject, string body) | SinGooCMS.Utility.MailUtils |


SinGooCMS.Utility: 成员列表

  • SinGooCMS
  • Utility
  • MimeMapping
  • MimeMappingDictionaryBase
SinGooCMS.Utility.MimeMapping.MimeMappingDictionaryBase 成员列表

成员的完整列表，这些成员属于 SinGooCMS.Utility.MimeMapping.MimeMappingDictionaryBase,包括所有继承而来的类成员

_isInitialized | SinGooCMS.Utility.MimeMapping.MimeMappingDictionaryBase | private
_mappings | SinGooCMS.Utility.MimeMapping.MimeMappingDictionaryBase | private
_pathSeparatorChars | SinGooCMS.Utility.MimeMapping.MimeMappingDictionaryBase | privatestatic
AddMapping(string fileExtension, string mimeType) | SinGooCMS.Utility.MimeMapping.MimeMappingDictionaryBase | protected
AddWildcardIfNotPresent() | SinGooCMS.Utility.MimeMapping.MimeMappingDictionaryBase | private
EnsureMapping() | SinGooCMS.Utility.MimeMapping.MimeMappingDictionaryBase | private
GetFileName(string path) | SinGooCMS.Utility.MimeMapping.MimeMappingDictionaryBase | privatestatic
GetMimeMapping(string fileName) | SinGooCMS.Utility.MimeMapping.MimeMappingDictionaryBase |
PopulateMappings() | SinGooCMS.Utility.MimeMapping.MimeMappingDictionaryBase | protectedpure virtual


SinGooCMS.Utility: 成员列表

  • SinGooCMS
  • Utility
  • MimeMapping
  • MimeMappingDictionaryClassic
SinGooCMS.Utility.MimeMapping.MimeMappingDictionaryClassic 成员列表

成员的完整列表，这些成员属于 SinGooCMS.Utility.MimeMapping.MimeMappingDictionaryClassic,包括所有继承而来的类成员

AddMapping(string fileExtension, string mimeType) | SinGooCMS.Utility.MimeMapping.MimeMappingDictionaryBase | protected
GetMimeMapping(string fileName) | SinGooCMS.Utility.MimeMapping.MimeMappingDictionaryBase |
PopulateMappings() | SinGooCMS.Utility.MimeMapping.MimeMappingDictionaryClassic | protectedvirtual


SinGooCMS.Utility: 成员列表

  • SinGooCMS
  • Utility
  • NPOIUtils
SinGooCMS.Utility.NPOIUtils 成员列表

成员的完整列表，这些成员属于 SinGooCMS.Utility.NPOIUtils,包括所有继承而来的类成员

GetCellValue(ICell cell) | SinGooCMS.Utility.NPOIUtils | static
Read(string excelFileFullPath) | SinGooCMS.Utility.NPOIUtils | static
Read(string excelFileFullPath, bool hasHeaderTile,(int startRow, int startCol)?startPoint=null,(int endRow, int endCol)?endPoint=null) | SinGooCMS.Utility.NPOIUtils | static
ReadCell(string excelFileFullPath, string sheetName="", string addr="A1") | SinGooCMS.Utility.NPOIUtils | static
ReadCell(string excelFileFullPath, string sheetName="", int rowIndex=1, int colIndex=1) | SinGooCMS.Utility.NPOIUtils | static
ReadSheet(ISheet sheet, bool hasHeaderTile,(int startRow, int startCol)?startPoint=null,(int endRow, int endCol)?endPoint=null) | SinGooCMS.Utility.NPOIUtils | static
ReadSheet(string excelFileFullPath, bool hasHeaderTile, string addrRange) | SinGooCMS.Utility.NPOIUtils | static
ReadSheet(ISheet sheet, bool hasHeaderTile, string addrRange) | SinGooCMS.Utility.NPOIUtils | static
Save(DataTable table, string filePath, string sheetName="") | SinGooCMS.Utility.NPOIUtils | static
Save(Dictionary< string, DataTable > dict, string saveFilePath) | SinGooCMS.Utility.NPOIUtils | static
SaveWithTmpl(Dictionary< string, DataTable > dict, string tmplFilePath, string saveFilePath) | SinGooCMS.Utility.NPOIUtils | static


SinGooCMS.Utility: 成员列表

  • SinGooCMS
  • Utility
  • NetWorkUtils
SinGooCMS.Utility.NetWorkUtils 成员列表

成员的完整列表，这些成员属于 SinGooCMS.Utility.NetWorkUtils,包括所有继承而来的类成员

Download(string originalFile, string targetDir, string targetFileName="") | SinGooCMS.Utility.NetWorkUtils | static
GetFQDN() | SinGooCMS.Utility.NetWorkUtils | static
HttpGet(string strUrl, int timeOut=30 *1000, string encodingType="utf-8") | SinGooCMS.Utility.NetWorkUtils | static
HttpGet(string strUrl, int timeOut, string encodingType, ref string reqCookies, ref string rspCookies, bool isHttps=false, IDictionary< string, string > headers=null) | SinGooCMS.Utility.NetWorkUtils | static
HttpPost(string strUrl, string postData) | SinGooCMS.Utility.NetWorkUtils | static
HttpPost(string strUrl, string postData, string host, string referer) | SinGooCMS.Utility.NetWorkUtils | static
HttpPost(string strUrl, string postData, int timeOut, string encodingType, ref string reqCookies, ref string rspCookies, bool isHttps=false, IDictionary< string, string > headers=null) | SinGooCMS.Utility.NetWorkUtils | static
Ping(string hostNameOrAddr) | SinGooCMS.Utility.NetWorkUtils | static


SinGooCMS.Utility: 成员列表

  • SinGooCMS
  • Utility
  • ObjectAccessor
SinGooCMS.Utility.ObjectAccessor 成员列表

成员的完整列表，这些成员属于 SinGooCMS.Utility.ObjectAccessor,包括所有继承而来的类成员

_objectGettersCache | SinGooCMS.Utility.ObjectAccessor | private
_objectSettersCache | SinGooCMS.Utility.ObjectAccessor | private
Accessor(IReflect type, bool ignoreCase, bool includeNonPublic) | SinGooCMS.Utility.Accessor | protected
Build(object instance, bool ignoreCase=false, bool includeNonPublic=false) | SinGooCMS.Utility.Accessor | static
Build(Type instanceType, bool ignoreCase=false, bool includeNonPublic=false) | SinGooCMS.Utility.Accessor | static
Build< TInstance >(bool ignoreCase=false, bool includeNonPublic=false) | SinGooCMS.Utility.Accessor | static
Comparer | SinGooCMS.Utility.Accessor | protected
IgnoreCase | SinGooCMS.Utility.Accessor |
IncludesNonPublic | SinGooCMS.Utility.Accessor |
Properties | SinGooCMS.Utility.Accessor |
this[object instance, string propertyName] | SinGooCMS.Utility.ObjectAccessor |
Type | SinGooCMS.Utility.Accessor |


SinGooCMS.Utility: 成员列表

  • SinGooCMS
  • Utility
  • OperationResult
SinGooCMS.Utility.OperationResult 成员列表

成员的完整列表，这些成员属于 SinGooCMS.Utility.OperationResult,包括所有继承而来的类成员

_sign | SinGooCMS.Utility.OperationResult | private
CallbackUrl | SinGooCMS.Utility.OperationResult |
Data | SinGooCMS.Utility.OperationResult |
ErrorENMessage | SinGooCMS.Utility.OperationResult |
ErrorMessage | SinGooCMS.Utility.OperationResult |
fail | SinGooCMS.Utility.OperationResult | static
Fail(string statusCode, string errorMessage, string errorENMessage="") | SinGooCMS.Utility.OperationResult | static
OperationResult() | SinGooCMS.Utility.OperationResult |
OperationResult(int _ReturnStatusType, string _StatusCode, string _ErrorMessage, string _ENErrorMessage="") | SinGooCMS.Utility.OperationResult |
ReturnStatusType | SinGooCMS.Utility.OperationResult |
Sign | SinGooCMS.Utility.OperationResult |
StatusCode | SinGooCMS.Utility.OperationResult |
Success(string errorMessage, string errorENMessage="") | SinGooCMS.Utility.OperationResult | static
success | SinGooCMS.Utility.OperationResult | static
Timeout | SinGooCMS.Utility.OperationResult |
TimeStamp | SinGooCMS.Utility.OperationResult |
ToJsonObj() | SinGooCMS.Utility.OperationResult |
ToString() | SinGooCMS.Utility.OperationResult |


SinGooCMS.Utility: 成员列表

  • SinGooCMS
  • Utility
  • PagerModel
SinGooCMS.Utility.PagerModel< T > 成员列表

成员的完整列表，这些成员属于 SinGooCMS.Utility.PagerModel< T >,包括所有继承而来的类成员

HasNextPage | SinGooCMS.Utility.PagerModel< T >
HasPrevPage | SinGooCMS.Utility.PagerModel< T >
NextPage | SinGooCMS.Utility.PagerModel< T >
PageIndex | SinGooCMS.Utility.PagerModel< T >
PagerData | SinGooCMS.Utility.PagerModel< T >
PageSize | SinGooCMS.Utility.PagerModel< T >
PrevPage | SinGooCMS.Utility.PagerModel< T >
this[int indexBeg, int indexEnd] | SinGooCMS.Utility.SinGooList< T >
TotalPage | SinGooCMS.Utility.PagerModel< T >
TotalRecord | SinGooCMS.Utility.PagerModel< T >


SinGooCMS.Utility: 成员列表

  • SinGooCMS
  • Utility
  • PagerUtils
SinGooCMS.Utility.PagerUtils 成员列表

成员的完整列表，这些成员属于 SinGooCMS.Utility.PagerUtils,包括所有继承而来的类成员

Calculate() | SinGooCMS.Utility.PagerUtils |
Create(int totalRecord, int pageSize=10) | SinGooCMS.Utility.PagerUtils | static
GetPages(int count) | SinGooCMS.Utility.PagerUtils |
GetPageUrl(int page) | SinGooCMS.Utility.PagerUtils | private
GetUrl(int page) | SinGooCMS.Utility.PagerUtils |
GetUrl(string getType) | SinGooCMS.Utility.PagerUtils |
PageBegin | SinGooCMS.Utility.PagerUtils |
PageEnd | SinGooCMS.Utility.PagerUtils |
PageIndex | SinGooCMS.Utility.PagerUtils |
PageSize | SinGooCMS.Utility.PagerUtils |
RecordBegin | SinGooCMS.Utility.PagerUtils |
RecordEnd | SinGooCMS.Utility.PagerUtils |
TotalPage | SinGooCMS.Utility.PagerUtils |
TotalRecord | SinGooCMS.Utility.PagerUtils |
UrlPattern | SinGooCMS.Utility.PagerUtils |


SinGooCMS.Utility: 成员列表

  • SinGooCMS
  • Utility
  • PredicateBuilder
SinGooCMS.Utility.PredicateBuilder 成员列表

成员的完整列表，这些成员属于 SinGooCMS.Utility.PredicateBuilder,包括所有继承而来的类成员

And< T >(this Expression< Func< T, bool >> first, Expression< Func< T, bool >> second) | SinGooCMS.Utility.PredicateBuilder | static
Compose< T >(this Expression< T > first, Expression< T > second, Func< Expression, Expression, Expression > merge) | SinGooCMS.Utility.PredicateBuilder | static
False< T >() | SinGooCMS.Utility.PredicateBuilder | static
Or< T >(this Expression< Func< T, bool >> first, Expression< Func< T, bool >> second) | SinGooCMS.Utility.PredicateBuilder | static
True< T >() | SinGooCMS.Utility.PredicateBuilder | static


SinGooCMS.Utility: 成员列表

  • SinGooCMS
  • Utility
  • ProcessUtils
SinGooCMS.Utility.ProcessUtils 成员列表

成员的完整列表，这些成员属于 SinGooCMS.Utility.ProcessUtils,包括所有继承而来的类成员

DeleteService(string serviceName) | SinGooCMS.Utility.ProcessUtils | static
Execute(string fileName, string args) | SinGooCMS.Utility.ProcessUtils | static
Execute(string fileName, string args, IList< string > commandText, out string result, out string errMsg) | SinGooCMS.Utility.ProcessUtils | static
ExecuteCMD(IList< string > commandText) | SinGooCMS.Utility.ProcessUtils | static
ExecuteCMD(IList< string > commandText, out string result, out string errMsg) | SinGooCMS.Utility.ProcessUtils | static
Kill(string name) | SinGooCMS.Utility.ProcessUtils | static
KillCurrent() | SinGooCMS.Utility.ProcessUtils | static
Shutdown(int shutSecond=60) | SinGooCMS.Utility.ProcessUtils | static
StartService(string serviceName) | SinGooCMS.Utility.ProcessUtils | static
StopService(string serviceName) | SinGooCMS.Utility.ProcessUtils | static
UnShutdown() | SinGooCMS.Utility.ProcessUtils | static


SinGooCMS.Utility: 成员列表

  • SinGooCMS
  • Utility
  • QueryExtension
SinGooCMS.Utility.QueryExtension 成员列表

成员的完整列表，这些成员属于 SinGooCMS.Utility.QueryExtension,包括所有继承而来的类成员

Page< T >(this IQueryable< T > query, int pageIndex, int pageSize) | SinGooCMS.Utility.QueryExtension | static
PageModel< T >(this IQueryable< T > query, int pageIndex, int pageSize) | SinGooCMS.Utility.QueryExtension | static


SinGooCMS.Utility: 成员列表

  • SinGooCMS
  • Utility
  • RSACryption
SinGooCMS.Utility.RSACryption 成员列表

成员的完整列表，这些成员属于 SinGooCMS.Utility.RSACryption,包括所有继承而来的类成员

GetHash(string m_strSource, ref byte[] HashData) | SinGooCMS.Utility.RSACryption
GetHash(string m_strSource, ref string strHashData) | SinGooCMS.Utility.RSACryption
GetHash(System.IO.FileStream objFile, ref byte[] HashData) | SinGooCMS.Utility.RSACryption
GetHash(System.IO.FileStream objFile, ref string strHashData) | SinGooCMS.Utility.RSACryption
RSADecrypt(string xmlPrivateKey, string m_strDecryptString) | SinGooCMS.Utility.RSACryption
RSADecrypt(string xmlPrivateKey, byte[] DecryptString) | SinGooCMS.Utility.RSACryption
RSAEncrypt(string xmlPublicKey, string m_strEncryptString) | SinGooCMS.Utility.RSACryption
RSAEncrypt(string xmlPublicKey, byte[] EncryptString) | SinGooCMS.Utility.RSACryption
RSAKey(out string xmlKeys, out string xmlPublicKey) | SinGooCMS.Utility.RSACryption
SignatureDeformatter(string p_strKeyPublic, byte[] HashbyteDeformatter, byte[] DeformatterData) | SinGooCMS.Utility.RSACryption
SignatureDeformatter(string p_strKeyPublic, string p_strHashbyteDeformatter, byte[] DeformatterData) | SinGooCMS.Utility.RSACryption
SignatureDeformatter(string p_strKeyPublic, byte[] HashbyteDeformatter, string p_strDeformatterData) | SinGooCMS.Utility.RSACryption
SignatureDeformatter(string p_strKeyPublic, string p_strHashbyteDeformatter, string p_strDeformatterData) | SinGooCMS.Utility.RSACryption
SignatureFormatter(string p_strKeyPrivate, byte[] HashbyteSignature, ref byte[] EncryptedSignatureData) | SinGooCMS.Utility.RSACryption
SignatureFormatter(string p_strKeyPrivate, byte[] HashbyteSignature, ref string m_strEncryptedSignatureData) | SinGooCMS.Utility.RSACryption
SignatureFormatter(string p_strKeyPrivate, string m_strHashbyteSignature, ref byte[] EncryptedSignatureData) | SinGooCMS.Utility.RSACryption
SignatureFormatter(string p_strKeyPrivate, string m_strHashbyteSignature, ref string m_strEncryptedSignatureData) | SinGooCMS.Utility.RSACryption


SinGooCMS.Utility: 成员列表

  • SinGooCMS
  • Utility
  • ReflectionUtils
SinGooCMS.Utility.ReflectionUtils 成员列表

成员的完整列表，这些成员属于 SinGooCMS.Utility.ReflectionUtils,包括所有继承而来的类成员

CreateInstance(string assemblyFile, string fullName, object[] parameters=null) | SinGooCMS.Utility.ReflectionUtils | static
CreateInstance(Type type, object[] parameters=null) | SinGooCMS.Utility.ReflectionUtils | static
CreateInstance< T >(string assemblyFile, object[] parameters=null) | SinGooCMS.Utility.ReflectionUtils | static
GetType(string assemblyFile, string fullName) | SinGooCMS.Utility.ReflectionUtils | static
Load(string dllFileName, string dir="") | SinGooCMS.Utility.ReflectionUtils | static


SinGooCMS.Utility: 成员列表

  • SinGooCMS
  • Utility
  • RegistryUtils
SinGooCMS.Utility.RegistryUtils 成员列表

成员的完整列表，这些成员属于 SinGooCMS.Utility.RegistryUtils,包括所有继承而来的类成员

DeleteRunValue(string itemName) | SinGooCMS.Utility.RegistryUtils | static
DeleteValue(string fullKey, string itemName) | SinGooCMS.Utility.RegistryUtils | static
GetRunValue(string itemName) | SinGooCMS.Utility.RegistryUtils | static
GetValue(string fullKey, string itemName) | SinGooCMS.Utility.RegistryUtils | static
SetRunValue(string itemName, string itemValue) | SinGooCMS.Utility.RegistryUtils | static
SetValue(string fullKey, string itemName, string itemValue) | SinGooCMS.Utility.RegistryUtils | static


SinGooCMS.Utility: 成员列表

  • SinGooCMS
  • Utility
  • SessionUtils
SinGooCMS.Utility.SessionUtils 成员列表

成员的完整列表，这些成员属于 SinGooCMS.Utility.SessionUtils,包括所有继承而来的类成员

ContainKey(string key) | SinGooCMS.Utility.SessionUtils | static
DelSession(string key) | SinGooCMS.Utility.SessionUtils | static
GetSession< T >(string key) | SinGooCMS.Utility.SessionUtils | static
SetSession(string key, string value, int time=60 *30) | SinGooCMS.Utility.SessionUtils | static
SetSession< T >(string key, T value, int time=60 *24) | SinGooCMS.Utility.SessionUtils | static


SinGooCMS.Utility: 成员列表

  • SinGooCMS
  • Utility
  • ShareFileUtils
SinGooCMS.Utility.ShareFileUtils 成员列表

成员的完整列表，这些成员属于 SinGooCMS.Utility.ShareFileUtils,包括所有继承而来的类成员

Connect(string sharePath, string userName, string password, string localDisk="") | SinGooCMS.Utility.ShareFileUtils | static
Disconnect() | SinGooCMS.Utility.ShareFileUtils |
DisconnectAll() | SinGooCMS.Utility.ShareFileUtils | static
DownFile(string shareFileName, string localDir) | SinGooCMS.Utility.ShareFileUtils |
GetDir(string dirPath) | SinGooCMS.Utility.ShareFileUtils |
GetFile(string fileName) | SinGooCMS.Utility.ShareFileUtils |
Password | SinGooCMS.Utility.ShareFileUtils | private
SharePath | SinGooCMS.Utility.ShareFileUtils | private
ShowConnect() | SinGooCMS.Utility.ShareFileUtils | static
UpFile(string localFileName, string shareDir) | SinGooCMS.Utility.ShareFileUtils |
UserName | SinGooCMS.Utility.ShareFileUtils | private


SinGooCMS.Utility: 成员列表

  • SinGooCMS
  • Utility
  • SinGooArray
SinGooCMS.Utility.SinGooArray 成员列表

成员的完整列表，这些成员属于 SinGooCMS.Utility.SinGooArray,包括所有继承而来的类成员

this[int indexBeg, int indexEnd] SinGooCMS.Utility.SinGooArray


SinGooCMS.Utility: 成员列表

  • SinGooCMS
  • Utility
  • SinGooDictionary
SinGooCMS.Utility.SinGooDictionary< T1, T2 > 成员列表

成员的完整列表，这些成员属于 SinGooCMS.Utility.SinGooDictionary< T1, T2 >,包括所有继承而来的类成员

this[int indexBeg, int indexEnd] | SinGooCMS.Utility.SinGooDictionary< T1, T2 >
this[int indexBeg] | SinGooCMS.Utility.SinGooDictionary< T1, T2 >


SinGooCMS.Utility: 成员列表

  • SinGooCMS
  • Utility
  • SinGooList
SinGooCMS.Utility.SinGooList< T > 成员列表

成员的完整列表，这些成员属于 SinGooCMS.Utility.SinGooList< T >,包括所有继承而来的类成员

this[int indexBeg, int indexEnd] SinGooCMS.Utility.SinGooList< T >


SinGooCMS.Utility: 成员列表

  • SinGooCMS
  • Utility
  • SocketClient
SinGooCMS.Utility.SocketClient 成员列表

成员的完整列表，这些成员属于 SinGooCMS.Utility.SocketClient,包括所有继承而来的类成员

ConnectSocket(this TcpClient tcpclient, IPEndPoint ipendpoint) | SinGooCMS.Utility.SocketClient | static
ConnectSocket(this TcpClient tcpclient, IPAddress ipadd, int port) | SinGooCMS.Utility.SocketClient | static
ConnectStream(this TcpClient tcpclient, IPEndPoint ipendpoint) | SinGooCMS.Utility.SocketClient | static
ConnectStream(this TcpClient tcpclient, IPAddress ipadd, int port) | SinGooCMS.Utility.SocketClient | static
GetPacketLength(byte[] length) | SinGooCMS.Utility.SocketClient | privatestatic
GetPath(string directory, string file) | SinGooCMS.Utility.SocketClient | static
GetSendPacketLengthStr(int size) | SinGooCMS.Utility.SocketClient | privatestatic
i | SinGooCMS.Utility.SocketClient | privatestatic
ListenerSocket(this TcpListener listener) | SinGooCMS.Utility.SocketClient | static
ListenerStream(this TcpListener listener) | SinGooCMS.Utility.SocketClient | static
m_maxpacket | SinGooCMS.Utility.SocketClient | privatestatic
markPath | SinGooCMS.Utility.SocketClient | privatestatic
ReceiveFile(this Socket socket, string path, string filename, long size, Action< int > progress) | SinGooCMS.Utility.SocketClient | static
ReceiveFile(this Socket socket, string path, string filename, long size) | SinGooCMS.Utility.SocketClient | static
ReceiveFile(this Socket socket, string path) | SinGooCMS.Utility.SocketClient | static
ReceiveFixData(this Socket socket, int size) | SinGooCMS.Utility.SocketClient | static
ReceiveVarData(this Socket socket) | SinGooCMS.Utility.SocketClient | static
ReceiveVarData< T >(this Socket socket) | SinGooCMS.Utility.SocketClient | static
SendFile(this Socket socket, string path, bool issend, Action< int > progress) | SinGooCMS.Utility.SocketClient | static
SendFile(this Socket socket, string path, bool issend) | SinGooCMS.Utility.SocketClient | static
SendFile(this Socket socket, string path) | SinGooCMS.Utility.SocketClient | static
SendFixData(this Socket socket, byte[] msg) | SinGooCMS.Utility.SocketClient | static
SendSerializeObject< T >(this Socket socket, T obj) | SinGooCMS.Utility.SocketClient | static
SendVarData(this Socket socket, string contact) | SinGooCMS.Utility.SocketClient | static
SendVarData(this Socket socket, byte[] bytes) | SinGooCMS.Utility.SocketClient | static
SerializeObject(object obj) | SinGooCMS.Utility.SocketClient | privatestatic


SinGooCMS.Utility: 成员列表

  • SinGooCMS
  • Utility
  • StopwatchUtils
SinGooCMS.Utility.StopwatchUtils 成员列表

成员的完整列表，这些成员属于 SinGooCMS.Utility.StopwatchUtils,包括所有继承而来的类成员

Execute(Action action) SinGooCMS.Utility.StopwatchUtils static


SinGooCMS.Utility: 成员列表

  • SinGooCMS
  • Utility
  • StringUtils
SinGooCMS.Utility.StringUtils 成员列表

成员的完整列表，这些成员属于 SinGooCMS.Utility.StringUtils,包括所有继承而来的类成员

ChkSQL(string str) | SinGooCMS.Utility.StringUtils | static
Compress(string strHTML) | SinGooCMS.Utility.StringUtils | static
Cut(string sourceStr, int len, string appendString="...") | SinGooCMS.Utility.StringUtils | static
Cut(string source, string begin, string end) | SinGooCMS.Utility.StringUtils | static
FULLFOMART | SinGooCMS.Utility.StringUtils | private
GenerateSN(string SNFormat, SNType?snType=null) | SinGooCMS.Utility.StringUtils | static
GenerateUri(string[] parameters, string protocol="http://") | SinGooCMS.Utility.StringUtils | static
GetCatePrefix(int intDept, bool boolIsEnd) | SinGooCMS.Utility.StringUtils | static
GetChineseSpell(string strText) | SinGooCMS.Utility.StringUtils | static
GetChineseSpellFirst(string strText) | SinGooCMS.Utility.StringUtils | static
GetGUID() | SinGooCMS.Utility.StringUtils | static
GetNewFileName() | SinGooCMS.Utility.StringUtils | static
GetRandomNumber(int length=10) | SinGooCMS.Utility.StringUtils | static
GetRandomString(int length=10, string custom="", bool useNum=true, bool useLow=true, bool useUpp=true, bool useSpe=false) | SinGooCMS.Utility.StringUtils | static
GetSimplified(string str) | SinGooCMS.Utility.StringUtils | static
GetSpaceChar(int depth) | SinGooCMS.Utility.StringUtils | static
GetStringLength(string str) | SinGooCMS.Utility.StringUtils | static
GetTraditional(string str) | SinGooCMS.Utility.StringUtils | static
NORMALFORMAT | SinGooCMS.Utility.StringUtils | private
SHORTFORMAT | SinGooCMS.Utility.StringUtils | private
SNType 枚举名称 | SinGooCMS.Utility.StringUtils |
Split(string input, string pattern, bool ignoreCase=false) | SinGooCMS.Utility.StringUtils | static


SinGooCMS.Utility: 成员列表

  • SinGooCMS
  • Utility
  • TimeUtils
SinGooCMS.Utility.TimeUtils 成员列表

成员的完整列表，这些成员属于 SinGooCMS.Utility.TimeUtils,包括所有继承而来的类成员

GetDateDiff(DateTime time1, DateTime time2) | SinGooCMS.Utility.TimeUtils | static
GetTimeSpan(DateTime time1, DateTime time2) | SinGooCMS.Utility.TimeUtils | static


SinGooCMS.Utility: 成员列表

  • SinGooCMS
  • Utility
  • UnicodeUtils
SinGooCMS.Utility.UnicodeUtils 成员列表

成员的完整列表，这些成员属于 SinGooCMS.Utility.UnicodeUtils,包括所有继承而来的类成员

Decode(string str) | SinGooCMS.Utility.UnicodeUtils | static
Encode(string str) | SinGooCMS.Utility.UnicodeUtils | static


SinGooCMS.Utility: 成员列表

  • SinGooCMS
  • Utility
  • UtilsBase
SinGooCMS.Utility.UtilsBase 成员列表

成员的完整列表，这些成员属于 SinGooCMS.Utility.UtilsBase,包括所有继承而来的类成员

HttpContext | SinGooCMS.Utility.UtilsBase | static
Request | SinGooCMS.Utility.UtilsBase | static
Response | SinGooCMS.Utility.UtilsBase | static


SinGooCMS.Utility: 成员列表

  • SinGooCMS
  • Utility
  • VideoUtils
SinGooCMS.Utility.VideoUtils 成员列表

成员的完整列表，这些成员属于 SinGooCMS.Utility.VideoUtils,包括所有继承而来的类成员

CutImgExtend | SinGooCMS.Utility.VideoUtils |
CutImgHeight | SinGooCMS.Utility.VideoUtils |
CutImgWidth | SinGooCMS.Utility.VideoUtils |
Init(string ffmpegPath, string startPoint="00:00:06", int cutImgWidth=500, int cutImgHeight=400, string imgExt=".jpg") | SinGooCMS.Utility.VideoUtils | static
Save(string fullVideoFile, string fullOutputImg) | SinGooCMS.Utility.VideoUtils |
StartPoint | SinGooCMS.Utility.VideoUtils |
ToolsPath | SinGooCMS.Utility.VideoUtils |


SinGooCMS.Utility: 成员列表

  • SinGooCMS
  • Utility
  • WebUtils
SinGooCMS.Utility.WebUtils 成员列表

成员的完整列表，这些成员属于 SinGooCMS.Utility.WebUtils,包括所有继承而来的类成员

GetAbsoluteUri() | SinGooCMS.Utility.WebUtils | static
GetFormBool(string key, bool defaultValue=false) | SinGooCMS.Utility.WebUtils | static
GetFormDatetime(string key) | SinGooCMS.Utility.WebUtils | static
GetFormDatetime(string key, DateTime defaultValue) | SinGooCMS.Utility.WebUtils | static
GetFormDecimal(string key, decimal defaultValue=0.0m) | SinGooCMS.Utility.WebUtils | static
GetFormDouble(string key, double defaultValue=0.0d) | SinGooCMS.Utility.WebUtils | static
GetFormFloat(string key, float defaultValue=0.0f) | SinGooCMS.Utility.WebUtils | static
GetFormInt(string key, int defaultValue=0) | SinGooCMS.Utility.WebUtils | static
GetFormString(string key, string defalutValue="") | SinGooCMS.Utility.WebUtils | static
GetFormVal< T >(string key, T defaultVal=default(T)) | SinGooCMS.Utility.WebUtils | static
GetFormVals< T >(string key) | SinGooCMS.Utility.WebUtils | static
GetQueryBool(string key, bool defaultValue=false) | SinGooCMS.Utility.WebUtils | static
GetQueryDatetime(string key) | SinGooCMS.Utility.WebUtils | static
GetQueryDatetime(string key, DateTime defaultValue) | SinGooCMS.Utility.WebUtils | static
GetQueryDecimal(string key, decimal defaultValue=0.0m) | SinGooCMS.Utility.WebUtils | static
GetQueryDouble(string key, double defaultValue=0.0d) | SinGooCMS.Utility.WebUtils | static
GetQueryFloat(string key, float defaultValue=0.0f) | SinGooCMS.Utility.WebUtils | static
GetQueryInt(string key, int defaultValue=0) | SinGooCMS.Utility.WebUtils | static
GetQueryLong(string key, long defaultValue=0) | SinGooCMS.Utility.WebUtils | static
GetQueryString(string key, string defalutValue="") | SinGooCMS.Utility.WebUtils | static
GetQueryVal< T >(string key, T defaultVal=default(T)) | SinGooCMS.Utility.WebUtils | static
GetQueryVals< T >(string key) | SinGooCMS.Utility.WebUtils | static
GetUrlPathPart() | SinGooCMS.Utility.WebUtils | static


SinGooCMS.Utility: 成员列表

  • SinGooCMS
  • Utility
  • XmlUtils
SinGooCMS.Utility.XmlUtils 成员列表

成员的完整列表，这些成员属于 SinGooCMS.Utility.XmlUtils,包括所有继承而来的类成员

_element | SinGooCMS.Utility.XmlUtils | private
_filePath | SinGooCMS.Utility.XmlUtils | private
_xml | SinGooCMS.Utility.XmlUtils | private
AppendNode(XmlNode xmlNode) | SinGooCMS.Utility.XmlUtils |
CreateRootElement(string xmlFilePath) | SinGooCMS.Utility.XmlUtils | privatestatic
CreateXmlDocument() | SinGooCMS.Utility.XmlUtils | static
CreateXmlDocument(string rootName) | SinGooCMS.Utility.XmlUtils | static
CreateXMLElement() | SinGooCMS.Utility.XmlUtils | private
FormatXML(string xmlStr) | SinGooCMS.Utility.XmlUtils | static
GetAttributeValue(string xPath, string attributeName) | SinGooCMS.Utility.XmlUtils |
GetAttributeValue(string xmlFilePath, string xPath, string attributeName) | SinGooCMS.Utility.XmlUtils | static
GetAttributeValue(XmlNode node, string attributeName) | SinGooCMS.Utility.XmlUtils | static
GetItemValue(XmlNode node, string itemName) | SinGooCMS.Utility.XmlUtils | static
GetNode(string xPath) | SinGooCMS.Utility.XmlUtils |
GetValue(string xPath) | SinGooCMS.Utility.XmlUtils |
GetValue(string xmlFilePath, string xPath) | SinGooCMS.Utility.XmlUtils | static
RemoveNode(string xPath) | SinGooCMS.Utility.XmlUtils |
Save() | SinGooCMS.Utility.XmlUtils |
SelectNode(XmlNode parentNode, string attributeName, string attributeValue) | SinGooCMS.Utility.XmlUtils | static
SetAttributeValue(XmlNode node, string attributeName, string attributeValue) | SinGooCMS.Utility.XmlUtils | static
SetItemValue(XmlNode node, string itemName, string itemValue) | SinGooCMS.Utility.XmlUtils | static
WriteFormatXML(string xmlStr, string saveFilePath, string encoding="utf-8") | SinGooCMS.Utility.XmlUtils | static
XmlEncode(string value) | SinGooCMS.Utility.XmlUtils | static
XmlUtils(string xmlFilePath) | SinGooCMS.Utility.XmlUtils |


SinGooCMS.Utility: 成员列表

  • SinGooCMS
  • Utility
  • ZipUtils
SinGooCMS.Utility.ZipUtils 成员列表

成员的完整列表，这些成员属于 SinGooCMS.Utility.ZipUtils,包括所有继承而来的类成员

UnZip(string zipFile, string extractPath) | SinGooCMS.Utility.ZipUtils | static
Zip(string dirPath, string zipFile="") | SinGooCMS.Utility.ZipUtils | static


SinGooCMS.Utility: 图例

图例

本页将向您解释如何理解由 doxygen 生成的图.

考虑如下例子:

1 /*! 由于截断而使 Invisible 不可见 */
2 class Invisible { };
3
4 /*! Truncated 的继承关系将被隐藏 */
5 class Truncated : public Invisible { };
6
7 /* 没有被doxygen文档化的类 */
8 class Undocumented { };
9
10 /*! public 继承关系的类 */
11 class PublicBase : public Truncated { };
12
13 /*! 一个模板类 */
14 template<class T> class Templ { };
15
16 /*! protected 继承关系的类 */
17 class ProtectedBase { };
18
19 /*! private 继承关系的类 */
20 class PrivateBase { };
21
22 /*! 被 Inherited 使用的类 */
23 class Used { };
24
25 /*! 继承自其它若干类的超级类 */
26 class Inherited : public PublicBase,
27 protected ProtectedBase,
28 private PrivateBase,
29 public Undocumented,
30 public Templ<int>
31 {
32 private:
33 Used *m_usedClass;
34 };

结果将会生成以下图:

上图中的矩形有如下意义:

  • 灰色填充的矩形 表示上图是由该结构体或类生成.
  • 黑色边框的矩形 表示已经被文档化的结构体或类.
  • 灰色边框的矩形 表示未被文档化的结构体或类.
  • 红色边框的矩形 表示该结构体或类的关系没有被完全显示.如果生成的图不能调整到制定的尺寸，有一些关系就会被截断而不显示出来.

箭头有如下意义:

  • 深蓝色的箭头被用于展示 public 的继承关系.
  • 深绿色的箭头表示 protected 的继承关系.
  • 深红色的箭头说明了是 privated 的继承关系.
  • 紫色虚线箭头用来表示两个类之间的聚合关系. 被箭头指向的类的类型的变量,可以通过箭头旁标明的变量去访问.
  • 黄色虚线箭头表示模板类实例和模板类之间的关系. 箭头旁边标明了模板类实例化的参数.


SinGooCMS.Utility: 首页

SinGooCMS.Utility 文档


SinGooCMS.Utility: 类继承关系

类继承关系

浏览类继承关系表


SinGooCMS.Utility: SinGooCMS.Utility/obj/Debug/net4.6.1/SinGooCMS.Utility.AssemblyInfo.cs 源文件

  • 文件列表
  • SinGooCMS.Utility
  • obj
  • Debug
  • net4.6.1
SinGooCMS.Utility.AssemblyInfo.cs
浏览该文件的文档.
1 //------------------------------------------------------------------------------
2 // <auto-generated>
3 // 此代码由工具生成。
4 // 运行时版本:4.0.30319.42000
5 //
6 // 对此文件的更改可能会导致不正确的行为，并且如果
7 // 重新生成代码，这些更改将会丢失。
8 // </auto-generated>
9 //------------------------------------------------------------------------------
10
11 using System;
12 using System.Reflection;
13
14 [assembly: System.Reflection.AssemblyCompanyAttribute("jasonlee")]
15 [assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
16 [assembly: System.Reflection.AssemblyCopyrightAttribute("jsonlee")]
17 [assembly: System.Reflection.AssemblyDescriptionAttribute("SinGooCMS.Utility是一款工具类集合，包括配置、文件、日期、数据、序列化、反射、图像处理、网络、缓存、Web相关、加解密、压缩、类扩展等工具类，几乎" +
18 "囊括了开发中的所有工具需求！支持netstandard2.1和net framework 4.6.1。")]
19 [assembly: System.Reflection.AssemblyFileVersionAttribute("1.6.0.0")]
20 [assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.6.1")]
21 [assembly: System.Reflection.AssemblyProductAttribute("SinGooCMS.Utility")]
22 [assembly: System.Reflection.AssemblyTitleAttribute("SinGooCMS.Utility")]
23 [assembly: System.Reflection.AssemblyVersionAttribute("1.6.0.0")]
24 [assembly: System.Reflection.AssemblyMetadataAttribute("RepositoryUrl", "https://github.com/SinGooCMS/SinGooCMSUtility")]
25
26 // 由 MSBuild WriteCodeFragment 类生成。
27
System


SinGooCMS.Utility: SinGooCMS.Utility/obj/Debug/netstandard2.1/SinGooCMS.Utility.AssemblyInfo.cs 源文件

  • 文件列表
  • SinGooCMS.Utility
  • obj
  • Debug
  • netstandard2.1
SinGooCMS.Utility.AssemblyInfo.cs
浏览该文件的文档.
1 //------------------------------------------------------------------------------
2 // <auto-generated>
3 // 此代码由工具生成。
4 // 运行时版本:4.0.30319.42000
5 //
6 // 对此文件的更改可能会导致不正确的行为，并且如果
7 // 重新生成代码，这些更改将会丢失。
8 // </auto-generated>
9 //------------------------------------------------------------------------------
10
11 using System;
12 using System.Reflection;
13
14 [assembly: System.Reflection.AssemblyCompanyAttribute("jasonlee")]
15 [assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
16 [assembly: System.Reflection.AssemblyCopyrightAttribute("jsonlee")]
17 [assembly: System.Reflection.AssemblyDescriptionAttribute("SinGooCMS.Utility是一款工具类集合，包括配置、文件、日期、数据、序列化、反射、图像处理、网络、缓存、Web相关、加解密、压缩、类扩展等工具类，几乎" +
18 "囊括了开发中的所有工具需求！支持netstandard2.1和net framework 4.6.1。")]
19 [assembly: System.Reflection.AssemblyFileVersionAttribute("1.6.0.0")]
20 [assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.6.1")]
21 [assembly: System.Reflection.AssemblyProductAttribute("SinGooCMS.Utility")]
22 [assembly: System.Reflection.AssemblyTitleAttribute("SinGooCMS.Utility")]
23 [assembly: System.Reflection.AssemblyVersionAttribute("1.6.0.0")]
24 [assembly: System.Reflection.AssemblyMetadataAttribute("RepositoryUrl", "https://github.com/SinGooCMS/SinGooCMSUtility")]
25
26 // 由 MSBuild WriteCodeFragment 类生成。
27
System


SinGooCMS.Utility: 成员列表

  • SinGooCMS
  • Utility
  • ChineseCalendar
  • LunarHolidayStruct
SinGooCMS.Utility.ChineseCalendar.LunarHolidayStruct 成员列表

成员的完整列表，这些成员属于 SinGooCMS.Utility.ChineseCalendar.LunarHolidayStruct,包括所有继承而来的类成员

Day | SinGooCMS.Utility.ChineseCalendar.LunarHolidayStruct
HolidayName | SinGooCMS.Utility.ChineseCalendar.LunarHolidayStruct
LunarHolidayStruct(int month, int day, int recess, string name) | SinGooCMS.Utility.ChineseCalendar.LunarHolidayStruct
Month | SinGooCMS.Utility.ChineseCalendar.LunarHolidayStruct
Recess | SinGooCMS.Utility.ChineseCalendar.LunarHolidayStruct


SinGooCMS.Utility: 成员列表

  • SinGooCMS
  • Utility
  • ChineseCalendar
  • SolarHolidayStruct
SinGooCMS.Utility.ChineseCalendar.SolarHolidayStruct 成员列表

成员的完整列表，这些成员属于 SinGooCMS.Utility.ChineseCalendar.SolarHolidayStruct,包括所有继承而来的类成员

Day | SinGooCMS.Utility.ChineseCalendar.SolarHolidayStruct
HolidayName | SinGooCMS.Utility.ChineseCalendar.SolarHolidayStruct
Month | SinGooCMS.Utility.ChineseCalendar.SolarHolidayStruct
Recess | SinGooCMS.Utility.ChineseCalendar.SolarHolidayStruct
SolarHolidayStruct(int month, int day, int recess, string name) | SinGooCMS.Utility.ChineseCalendar.SolarHolidayStruct


SinGooCMS.Utility: 成员列表

  • SinGooCMS
  • Utility
  • ChineseCalendar
  • WeekHolidayStruct
SinGooCMS.Utility.ChineseCalendar.WeekHolidayStruct 成员列表

成员的完整列表，这些成员属于 SinGooCMS.Utility.ChineseCalendar.WeekHolidayStruct,包括所有继承而来的类成员

HolidayName | SinGooCMS.Utility.ChineseCalendar.WeekHolidayStruct
Month | SinGooCMS.Utility.ChineseCalendar.WeekHolidayStruct
WeekAtMonth | SinGooCMS.Utility.ChineseCalendar.WeekHolidayStruct
WeekDay | SinGooCMS.Utility.ChineseCalendar.WeekHolidayStruct
WeekHolidayStruct(int month, int weekAtMonth, int weekDay, string name) | SinGooCMS.Utility.ChineseCalendar.WeekHolidayStruct