欲善其事,必利其器 - Librame Utility R1 实用工具包(.NET Framework 3.5)
Librame Utility R1 基于 .NET Framework 3.5 开发,支持 WinForm 与 WebForm 开发环境。
一、Librame Utility 功能介绍
1、Librame.Caching(缓存功能)
支持文件缓存与 SQL 缓存依赖;
支持缓存队列、支持线程安全等功能;(比System.Web.Caching 更加强大)
2、Librame.Language(多语种功能)
支持枚举、异常、框架、其它等类型的多语言配置功能。
3、Librame.Logging(日志功能)
支持调试、信息、警告、错误、致命等类别的日志记录功能。
4、Librame.Security(算法功能)
支持散列、对称加解密等功能。
1)、散列算法:支持MD5、SHA1、SHA256、SHA384、SHA512等;
2)、对称加解密算法:支持BASE64、DES、三重DES、AES等(注:Key 和 IV 由 LibrameSettings.AppID 提供,采用GUID全球唯一标识符,更安全);
5、Librame.Settings(文件配置功能)
结合缓存功能,原生提供对 XML、JSON 等文件类实例进行实时自动更新的配置功能(JSON 由 Newtonsoft.Json 实现)。
6、Librame.Media(媒体功能)
1)、媒体信息识别:需引入 MediaInfo.dll(32位)功能组件;
2)、创建视频截图:需引入 ffmpeg.exe 功能组件;
3)、创建缩略图:支持创建限制最大高宽的自适应缩放的预览图;
4)、生成图片水印:支持生成文字或图片类水印内容;
二、Librame Utility 功能测试(由于时间关系,测试环境基于 Web )
1、算法综合测试
2
3 Test Project: 我是谁?;Who am I ? [2012/4/23 15:02:04]
4
5 --------------------------------------------------------------------------------
6 Base64 加/解密: %%5oiR5piv6LCB77yf77ybV2hvIGFtIEkgPw__ / 我是谁?;Who am I ?
7 Base64 验证: True / True
8
9 --------------------------------------------------------------------------------
10 Aes 加/解密: 62qAv0AR4I1ZmNt0kEsxSLILdgE41HcqAe5fPG!Qvvw_ / 我是谁?;Who am I ?
11 Aes 验证: True / True
12
13 --------------------------------------------------------------------------------
14 Des 加/解密: jSJbFligCHciiAl96oJAyP7XhTchmk9Dr96NF6oBhbE_ / 我是谁?;Who am I ?
15 Des 验证: True / True
16
17 --------------------------------------------------------------------------------
18 Triple Des 加/解密: kUhu0Uewjoq5IycYun7ajne0D3bKajAaHGm7UPvFDqg_ / 我是谁?;Who am I ?
19 Triple Des 验证: True / True
20
21 --------------------------------------------------------------------------------
22 MD5 加密: c7ee880ae76580af2b729b430d8fa8a6
23 MD5 验证: True / True
24
25 --------------------------------------------------------------------------------
26 SHA1 加密: 6748c5764d2af1d02828b6bfa152f134eb017cf3
27 SHA1 验证: True / True
28
29 --------------------------------------------------------------------------------
30 SHA256 加密: 17e590c838f5b93bc276c5f8ed5d543b937192918c28d670332e8c04e2a57e40
31 SHA256 验证: True / True
32
33 --------------------------------------------------------------------------------
34 SHA384 加密: 924c18e049c5184d1b3382557697d60d4b27d35bbb143be8c19f61d6b3b5721feb2d790202a0f14a1659c7c7f754611b
35 SHA384 验证: True / True
36
37 --------------------------------------------------------------------------------
38 SHA512 加密: a118cf43f5b8f016ff1a679b8d1d7f8ce889c4bee709b0cdd3f4149114823ae8aa5a1b45653f215dd0a6b26179be192c5f3717549df51a01770a93bda361ec23
39 SHA512 验证: True / True
40
41 --------------------------------------------------------------------------------
42
43 Processing: 54 ms
2、枚举语言包与默认值综合测试
2
3 Test Project: Enum to Dictionary [2012/4/23 15:03:14]
4
5 --------------------------------------------------------------------------------
6 Text/DefaultValue: 小于/less_than_value
7 Text/DefaultValue: 小于等于/less_and_equals_value
8 Text/DefaultValue: 等于/equal_to_value
9 Text/DefaultValue: 大于/more_than_value
10 Text/DefaultValue: 大于等于/more_and_equals_value
11 Text/DefaultValue: 倍数/multiple_value
12
13 --------------------------------------------------------------------------------
14
15 Processing: 9 ms
3、语言综合测试
2
3 Test Project: zh-cn [2012/4/23 15:04:53]
4
5 --------------------------------------------------------------------------------
6 Name: zh-cn
7 LocalName: 简体中文
8 Version: 3.5.12.04
9 Author: librame.net
10
11 --------------------------------------------------------------------------------
12 Librame.Extensions.IntCompare: 整数对比
13 LessThan: 小于
14 LessAndEquals: 小于等于
15 EqualTo: 等于
16 MoreThan: 大于
17 MoreAndEquals: 大于等于
18 Multiple: 倍数
19
20 --------------------------------------------------------------------------------
21 Librame.Extensions.TypeMatch: 类型匹配
22 FieldName: 字段名
23 PropertyName: 属性名
24
25 --------------------------------------------------------------------------------
26 Librame.Extensions.EnumMatch: 枚举匹配
27 Name: 枚举名
28 Value: 常数值
29 Description: 描述
30 DefaultValue: 默认值(如果存在)
31
32 --------------------------------------------------------------------------------
33 Librame.Caching.CacheItemPriority: 缓存项优先级
34 Low: 低
35 BelowNormal: 低于普通
36 Normal: 普通
37 Default: 默认
38 AboveNormal: 高于普通
39 High: 高
40 NotRemovable: 永不删除
41
42 --------------------------------------------------------------------------------
43 Librame.Caching.CacheItemRemovedReason: 缓存项删除原因
44 Removed: 被移除
45 Expired: 已过期
46 Underused: 未使用
47 DependencyChanged: 依赖性已改变
48
49 --------------------------------------------------------------------------------
50 Librame.Caching.CacheItemUpdateReason: 缓存项更新原因
51 Expired: 已过期
52 DependencyChanged: 依赖性已改变
53
54 --------------------------------------------------------------------------------
55 Librame.Logging.LogLevel: 日志级别
56 Debug: 调试
57 Information: 信息
58 Warning: 警告
59 Error: 错误
60 Fatal: 致命
61
62 --------------------------------------------------------------------------------
63 Librame.Security.HashAlgorithm: 散列算法
64 MD5: MD5
65 SHA1: SHA1
66 SHA256: SHA256
67 SHA384: SHA384
68 SHA512: SHA512
69
70 --------------------------------------------------------------------------------
71 Librame.Security.SymmetricAlgorithm: 对称加密算法
72 BASE64: Base64
73 AES: AES
74 DES: DES
75 TripleDES: 三重DES
76
77 --------------------------------------------------------------------------------
78 ImportComponents: 缺少必要功能组件“{0}”。
79 FileNotExists: 指定文件不存在“{0}”。
80
81 --------------------------------------------------------------------------------
82 LogDateTime: 时间
83 LogLanguage: 语言
84 LogException: 异常
85 TestOther: 测试其它语言项
86
87 --------------------------------------------------------------------------------
88
89 Processing: 90 ms
4、日志综合测试
2
3 Test Project: Log [2012/4/23 15:09:18]
4
5 --------------------------------------------------------------------------------
6 Debug: 测试调试记录!
7 Information: 测试信息记录!
8 Warning: 测试警告记录!
9 Error: 测试错误记录!
10 Fatal: 测试致命记录!
11
12 --------------------------------------------------------------------------------
13 ImportComponents: 缺少必要功能组件“{0}”。
14
15 --------------------------------------------------------------------------------
16
17 Processing: 49 ms
日志记录效果
2
3 时间:2012-04-23 15:09:18
4 语言:简体中文 [zh-cn]
5 调试:测试调试记录!
6 --------------------------------------- 2012-04-23 15:09:18 ---------------------------------------
7
8 时间:2012-04-23 15:09:18
9 语言:简体中文 [zh-cn]
10 信息:测试信息记录!
11 --------------------------------------- 2012-04-23 15:09:18 ---------------------------------------
12
13 时间:2012-04-23 15:09:18
14 语言:简体中文 [zh-cn]
15 警告:测试警告记录!
16 --------------------------------------- 2012-04-23 15:09:18 ---------------------------------------
17
18 时间:2012-04-23 15:09:18
19 语言:简体中文 [zh-cn]
20 错误:测试错误记录!
21 --------------------------------------- 2012-04-23 15:09:18 ---------------------------------------
22
23 时间:2012-04-23 15:09:18
24 语言:简体中文 [zh-cn]
25 致命:测试致命记录!
26 --------------------------------------- 2012-04-23 15:09:18 ---------------------------------------
27
28 时间:2012-04-23 15:09:18
29 语言:简体中文 [zh-cn]
30 错误:缺少必要功能组件“{0}”。
31 --------------------------------------- 2012-04-23 15:09:18 ---------------------------------------
5、创建视频截图及生成自适应缩略图并添加文字水印测试(FFmpeg)
注:在本本上反复测试,由FFmpeg创建截图并完整地另存为图像文件耗时始终需要20~22秒左右,让本人很费解。
6、媒体文件信息识别测试
2
3 Test Project: /_demo.mkv [2012/4/23 15:18:27]
4
5 --------------------------------------------------------------------------------
6 UniqueID: 201998698691846446268886151526523723250
7 UniqueIDString: 201998698691846446268886151526523723250 (0x97F788C4DB340374B1151BDA290DDDF2)
8 VideoFormatList: AVC
9 VideoCodecList: AVC
10 VideoLanguageList: English
11 AudioFormatList: AAC / AAC
12 AudioCodecList: AAC LC-SBR-PS / AAC LC-SBR-PS
13 AudioLanguageList: Chinese / English
14 TextFormatList: SSA / SSA / UTF-8 / UTF-8 / UTF-8 / UTF-8
15 TextCodecList: SSA / SSA / UTF-8 / UTF-8 / UTF-8 / UTF-8
16 TextLanguageList: Chinese / English / Chinese / Chinese / English / Chinese
17 ImageFormatList:
18 ImageCodecList:
19 ImageLanguageList:
20 Format: Matroska
21 FormatString: Matroska
22 FormatInfo:
23 FormatUrl: http://packs.matroska.org/
24 FormatExtensions: mkv mk3d mka mks
25 FormatVersion: Version 1
26 InternetMediaType:
27 FileSize: 447907676
28 FileSizeString: 427.2 MiB
29 Duration: 5360896
30 DurationString: 1h 29mn 20s 896ms
31 DurationTime: 01:29:20.896
32 OverallBitRate: 668407
33 OverallBitRateString: 668 Kbps
34 StreamSize:
35 StreamSizeString:
36 StreamSizeProportion:
37 EncodedDate: UTC 2012-03-18 04:25:40
38 EncodedApplication: mkvmerge v2.2.0 ('Turn It On Again') built on Mar 4 2008 12:58:26
39 EncodedLibrary: libebml v0.7.7 + libmatroska v0.8.1
40 EncodedLibraryString: libebml v0.7.7 + libmatroska v0.8.1
41
42 --------------------------------------------------------------------------------
43 ID: 1
44 IDString: 1
45 UniqueID: 1
46 UniqueIDString:
47 Format: AVC
48 FormatInfo: Advanced Video Codec
49 FormatUrl: http://developers.videolan.org/x264.html
50 FormatVersion:
51 FormatProfile: High@L3.2
52 FormatSettings: CABAC / 16 Ref Frames
53 InternetMediaType: video/H264
54 Codec: V_MPEG4/ISO/AVC
55 CodecString: AVC
56 CodecFamily: AVC
57 CodecInfo: Advanced Video Codec
58 CodecUrl: http://ffdshow-tryout.sourceforge.net/
59 CodecProfile: High@L3.2
60 CodecSettings: CABAC / 16 Ref Frames
61 Duration: 5360903
62 DurationFullString: 1h 29mn 20s 903ms
63 DurationTime: 01:29:20.903
64 BitRateMode:
65 BitRateModeString:
66 BitRate:
67 BitRateString:
68 BitRateMinimum:
69 BitRateMinimumString:
70 BitRateNominal: 600000
71 BitRateNominalString: 600 Kbps
72 BitRateMaximum:
73 BitRateMaximumString:
74 Width: 848
75 WidthString: 848 pixels
76 Height: 352
77 HeightString: 352 pixels
78 PixelAspectRatio: 1.000
79 DisplayAspectRatio: 2.409
80 DisplayAspectRatioString: 2.40:1
81 DisplayAspectRatioWidth: 2.40
82 DisplayAspectRatioHeight: 1
83 FrameRateMode:
84 FrameRateModeString:
85 FrameRate: 23.976
86 FrameRateString: 23.976 fps
87 FrameRateMinimum:
88 FrameRateMinimumString:
89 FrameRateMaximum:
90 FrameRateMaximumString:
91 FrameCount: 128533
92 ColorSpace: YUV
93 ChromaSubsampling: 4:2:0
94 Resolution: 8
95 ResolutionString: 8 bits
96 BitDepth: 8
97 BitDepthString: 8 bits
98 ScanType: Progressive
99 ScanTypeString: Progressive
100 Interlacement: PPF
101 InterlacementString: Progressive
102 CompressionMode:
103 Bits: 0.084
104 StreamSize:
105 StreamSizeFullString:
106 StreamSizeProportion:
107 Title: CHD.BD1080p-HALFCD3.NORM.by.tcwuning压制
108 EncodedApplication:
109 EncodedLibrary: x264 - core 68 r1183M f21daff
110 EncodedLibraryString: x264 core 68 r1183M f21daff
111 EncodedLibraryName: x264
112 EncodedLibraryVersion: core 68 r1183M f21daff
113 EncodedLibrarySettings: cabac=1 / ref=16 / deblock=1:-1:-1 / analyse=0x3:0x133 / me=umh / subme=9 / psy_rd=0.0:0.0 / mixed_ref=1 / me_range=32 / chroma_me=1 / trellis=2 / 8x8dct=1 / cqm=0 / deadzone=21,11 / chroma_qp_offset=0 / threads=6 / nr=0 / decimate=1 / mbaff=0 / bframes=16 / b_pyramid=1 / b_adapt=2 / b_bias=0 / direct=3 / wpredb=1 / keyint=250 / keyint_min=25 / scenecut=40 / rc=2pass / bitrate=600 / ratetol=1.0 / qcomp=0.60 / qpmin=10 / qpmax=51 / qpstep=4 / cplxblur=20.0 / qblur=0.5 / ip_ratio=1.40 / pb_ratio=1.30 / aq=1:1.00
114 Language: en
115 LanguageString: English
116 LanguageAbbreviation: eng
117 Default: Yes
118 Forced: No
119 BufferSize:
120
121 --------------------------------------------------------------------------------
122 ID: 2
123 IDString: 2
124 UniqueID: 197058999
125 UniqueIDString:
126 Format: AAC
127 FormatInfo: Advanced Audio Codec
128 FormatUrl:
129 FormatVersion:
130 FormatProfile: HE-AACv2 / HE-AAC / LC
131 FormatSettingsMode:
132 FormatSettingsModeExtension:
133 InternetMediaType:
134 Codec: AAC LC-SBR-PS
135 CodecString: AAC LC-SBR-PS
136 CodecFamily: AAC
137 CodecInfo:
138 CodecUrl:
139 CodecProfile:
140 CodecSettings:
141 Duration: 5360896
142 DurationString: 1h 29mn 20s 896ms
143 DurationTime: 01:29:20.896
144 BitRateMode:
145 BitRateModeString:
146 BitRate:
147 BitRateString:
148 Channels: 2 / 1 / 1
149 ChannelsString: 2 channels / 1 channel / 1 channel
150 ChannelPositions: Front: L R / Front: C / Front: C
151 ChannelPositionsString: 1/0/0
152 SamplingRate: 48000 / 48000 / 24000
153 SamplingRateString: 48.0 KHz / 48.0 KHz / 24.0 KHz
154 SamplingCount: 257323008
155 CompressionMode: Lossy
156 CompressionModeString: Lossy
157 StreamSize:
158 StreamSizeString:
159 StreamSizeProportion:
160 Title: 国语
161 EncodedApplication:
162 EncodedLibrary:
163 EncodedLibraryString:
164 EncodedLibraryName:
165 EncodedLibraryVersion:
166 EncodedLibrarySettings:
167 Language: zh
168 LanguageString: Chinese
169 LanguageAbbreviation: chi
170 Default: Yes
171 Forced: No
172
173 --------------------------------------------------------------------------------
174 ID: 4
175 IDString: 4
176 UniqueID: 3598764698
177 UniqueIDString:
178 Format: SSA
179 FormatInfo:
180 FormatUrl: http://ffdshow.sourceforge.net/tikiwiki/tiki-index.php?page=Getting+ffdshow
181 FormatVersion:
182 FormatProfile:
183 InternetMediaType:
184 Codec: S_TEXT/SSA
185 CodecString: SSA
186 CodecInfo: Sub Station Alpha
187 CodecUrl:
188 CompressionMode: Lossless
189 CompressionModeString: Lossless
190 Title: 特效简英
191 Language: zh
192 LanguageString: Chinese
193 LanguageAbbreviation: chi
194 Default: Yes
195 Forced: No
196
197 --------------------------------------------------------------------------------
198
199 Processing: 286 ms
附:采用 Silverlight 制作的简易视频播放器结合媒体文件信息识别功能的540P(960*540)在线视频播放测试
下载:Librame Utility 实用工具包(查看新版)
说明:因限制文件大小,所以移除了_demo.mp4和_demo.mkv等视频文件,测试的朋友可以自行复制两个视频文件到网站根目录做测试;另外这个工具包先供大家测试,稍后再发布工具包的源代码,敬请大家理解、关注,谢谢!
稍后为大家带来,如何在自己的项目中使用好 Librame Utility 实用工具包。
另外由于时间关系,未在 WinForm 中作详细测试,如果有BUG,请直接与我(QQ:312535437)联系,我会尽快修正。