예제 #1
0
파일: Shrtn.cs 프로젝트: ryan-nauman/Shrtn
 /// <summary>
 /// Encode an integer and specify one of the builtin encoders
 /// </summary>
 /// <param name="value">Value to be encoded</param>
 /// <param name="encoderType">The encoder to be used</param>
 /// <returns>An integer encoded to a string</returns>
 public static string Encode(ulong value, EncoderTypes encoderType)
 {
     EncoderFactory factory = new EncoderFactory();
     BaseEncoder encoder = factory.GetEncoder(encoderType);
     return encoder.Encode(value);
 }
예제 #2
0
파일: Shrtn.cs 프로젝트: ryan-nauman/Shrtn
 /// <summary>
 /// Decode a string and specify one of the builtin encoders
 /// </summary>
 /// <param name="encodedValue">The encoded string</param>
 /// <param name="encoderType">The encoder used on this string</param>
 /// <returns>A converted integer</returns>
 public static ulong Decode(string encodedValue, EncoderTypes encoderType)
 {
     EncoderFactory factory = new EncoderFactory();
     BaseEncoder encoder = factory.GetEncoder(encoderType);
     return encoder.Decode(encodedValue);
 }