您的位置:首页 > 编程语言 > C#

很不错的Utility库,C#4扩展 各种功能齐全,两行代码搞定图片转字符

2012-01-05 11:44 405 查看
最近在网上发行一个挺不错的Utility库,基于C#4,部分类库可用于更低版本C#。

该库功能比较全,而且有很多很炫的功能,两行代码就能搞定图片装字符。

示例如下:

 

using (Bitmap TestObject = new Bitmap(@"..\..\Data\Image\Lenna.jpg"))


[code]{


string Value = Utilities.Media.Image.ASCIIArt.ConvertToASCII(TestObject);


}

[/code]

.csharpcode, .csharpcode pre
{
font-size: small;
color: black;
font-family: consolas, "Courier New", courier, monospace;
background-color: #ffffff;
/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt
{
background-color: #f4f4f4;
width: 100%;
margin: 0em;
}
.csharpcode .lnum { color: #606060; }

 

效果如下





 





 

功能列表:

 





 

Utilities.DataTypes.ExtensionMethods

Array extensions

Clear

Combine

DateTime extensions

DaysInMonth

DaysLeftInMonth

DaysLeftInYear

FirstDayOfMonth

FirstDayOfWeek

FromUnixTime (actually extension for int and long values)

IsInFuture

IsInPast

IsWeekDay

IsWeekEnd

LastDayOfMonth

LastDayOfWeek

ToUnix

Generic object extensions

If

NotIf

Return

Chain

Do

Execute

ICollection extensions

AddAndReturn

AddRange

AddIf

AddIfUnique

Remove

RemoveRange

IComparable extensions

Between

IDictionary extensions

Sort

SortByValue

IEnumerable extensions

Exists

For

ForEach

ForParallel

ForEachParallel

IsNullOrEmpty

RemoveDefaults

ToArray

ToString

TrueForAll

TryAll

TryAllParallel

MatchCollection extensions

Where

string extensions

Encode

FromBase64

Left

Right

ToBase64

ToByteArray

ToFirstCharacterUpperCase

ToSentenceCapitalize

ToTitleCase

NumberTimesOccurs

Reverse

FilterOutText

KeepFilterText

AlphaNumericOnly

AlphaCharactersOnly

NumericOnly

IsUnicode

FormatString

RegexFormat

Various type conversion/type checking extensions

FormatToString

IsNotDefault

IsDefault

IsNotNull

IsNull

IsNotNullOrDBNull

IsNullOrDBNull

NullCheck

ThrowIfDefault

ThrowIfNullOrEmpty

ThrowIfNullOrDBNull

ToSQLDbType

ToDbType

ToType

TryTo

Various value type extensions

ToBool (int)

ToInt (bool)

ToBase64String (byte array)

ToEncodedString (byte array)

IsUnicode (byte array)

Utilities.IO.ExtensionMethods

Serialization extensions

ToBinary

ToJSON

ToSOAP

ToXML

ToObject

JSONToObject

SOAPToObject

XMLToObject

Uri extensions

Read

ReadBinary

Math extensions

Betweek

Clamp

Factorial

Max

Median

Min

Mode

Pow

Round

StandardDeviation

Sqrt

Variance

Permute

Utilities.SQL.ExtensionMethods

DbCommand extensions

AddParameter

BeginTransaction

ClearParameters

Close

Commit

ExecuteDataSet

ExecuteScalar

GetOutputParameter

Open

Rollback

DbDataReader extensions

GetParameter

Utilities.Compression.ExtensionMethods

Compress (both byte arrays and strings)

Decompress (both byte arrays and strings)

Utilities.Encryption.ExtensionMethods

Hash (Now handles all hash algorithms in one function for both byte arrays and strings)

Encrypt (Handles any symmetric encryption algorithm inside .Net)

Decrypt (Handles any symmetric encryption algorithm inside .Net)

Utilities.IO.ExtensionMethods

DirectoryInfo extensions

CopyTo

DeleteAll

DeleteFiles

DeleteFilesNewerThan

DeleteFilesOlderThan

Size

SetAttribute

FileInfo extensions

Append

CompareTo

Read

ReadBinary

Save

SaveAsync

SetAttributes

String extensions

RemoveIllegalDirectoryNameCharacters

RemoveIllegalFileNameCharacters

Utilities.Web.ExtensionMethods

Web related extensions

AbsoluteRoot

AddScriptFile

ContainsHTML

HTTPCompress

IsEncodingAccepted

RelativeRoot

RemoveURLIllegalCharacters

SetEncoding

StripHTML

IPAddress extensions

GetHostName

Minification

Combine (can be used for HTML,JavaScript, or CSS)

Minify (can be used for HTML, JavaScript, or CSS)

HttpRequest extensions

IsMobile

Utilities.Image.ExtensionMethods

All Bitmap functions were moved

Added ToBase64 extension method

Added DrawRoundedRectangle extension

Screen extensions

TakeScreenShot

Utilities.Error.ExtensionMethods

Various error related extensions

DumpApplicationState

DumpCache

DumpCookies

DumpRequestVariable

DumpResponseVariable

DumpServerVars

DumpSession

Utilities.Reflection.ExtensionMethods

Various reflection related extensions

CallMethod

CreateInstance

DumpProperties

GetAttribute

GetAttributes

GetName

GetObjects

GetProperty

GetPropertyGetter

GetPropertyName

GetPropertyType

GetPropertySetter

GetTypes

IsIEnumerable

IsOfType

Load

LoadAssemblies

MarkedWith

MakeShallowCopy

SetProperty

ToLongVersionString

ToShortVersionString

Utilities.Environment.ExtensionMethods

Process related extensions

KillProcessAsync

GetInformation

On top of that there are a number of helper classes for a number of various tasks including (note that there are actually more, this is what I can remember off the top of my head):

Email

Pop3 client (SSL capable)

MIME parser

SMTP email sending (SSL capable)

Exchange inbox email retrieval

Image manipulation (one of the larger collections of functions dealing in image manipulation out there)

Cropping, resizing, rotating, flipping

To black and white or sepia tone

Threshold and edge detection (including Sobel and Laplace)

Text drawing, watermarks, object drawing helpers

Taking a screenshot which spans monitors

RGB Histograms

Various convolution filters such as sharpen, sobel emboss, etc. along with the ability to create your own easily.

Various other filters such as "jitter", pixelate, sin wave, median filter, and dilation, red/green/blue filters,

Multiple blurring techniques including box blur, Gaussian blur, Kuwahara, and Symmetric Nearest Neighbor blur

Bump map and Normal map helpers

ASCII art generator

Adjust brightness, gamma, and contrast

Active Directory querying

Includes functions for active users, all users, all groups, active members in groups, etc.

Exchange querying

Free/Busy data

Get next/previous available time for appointments

Get contacts

Get appointments/events

Get emails

Get the GAL

SQL query helper

MicroORM

ORM (which includes lazy loading, etc.)

SQL Server structural analysis helpers

File formats/Microformats

XMDP

RSS (with iTunes/Zune information embedded for podcasts)

vCard/hCard

vCalendar/hCalendar

iCalendar (with email sending capabilities, cancellation, and automatically putting it in Exchange)

APML

OPML

XFN

CSV

RSD

BlogML

INI

Cisco phone app helpers

WMI query helpers

Code to render a web page to BMP file

Icon extraction from a file

WebBrowser control cache clearing class

Helper classes for simplifying System.Reflection.Emit namespace

Randomization

Including string randomization based on allowable characters, date randomization, Color, Enum, TimeSpan, and Lorem Ipsum generation.

Environment information

Process management

Error/Information gathering

Math related classes

Matrix

Vector3

Set

Factorial

Permutation

Data types

Vector

Bag

List

ListMapping

Priority Queue

BTree

Base classes for various patterns including

Singleton

Factory

OAuth helper class

Code for setting up an OpenID relay

REST helper class

Classes to help with various media services/websites including

Twitter

Hulu

Netflix

Craigslist

eBay

Naive Bayes classifier

Validation classes

Caching helper classes

Logging helper classes

Configuration helper classes

AOP helper classes

 

喜爱的码农们,走过路过可不要错过了。

 

最后是传送门

 

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐