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

最近在网上发行一个挺不错的Utility库,基于C#4,部分类库可用于更低版本C#。

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

示例如下:

 

   1:  using (Bitmap TestObject = new Bitmap(@"..\..\Data\Image\Lenna.jpg"))
   2:  {
   3:      string Value = Utilities.Media.Image.ASCIIArt.ConvertToASCII(TestObject);
   4:  }

 

效果如下

pics_max_jin_1280283407

 

5W_{5PR7R}`22LHA0778OME

 

功能列表:

 

MM~6NPW0A40ZG[@3RY[TQJL

 

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

 

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

 

最后是传送门

 

posted @ 2012-01-05 11:44  风雷云雪电  Views(9282)  Comments(38Edit  收藏  举报