Exemplo n.º 1
0
        public static string Encrypt(string str)
        {
            if (StringType.StrCmp(str.Trim(), "", false) == 0)
            {
                return("");
            }
            StringBuilder builder = new StringBuilder();

            try
            {
                short num3 = (short)(str.Length - 1);
                for (short i = 0; i <= num3; i = (short)(i + 1))
                {
                    short charPos = GetCharPos(CharType.FromString(str.Substring(i, 1)));
                    if (charPos == Key.Length)
                    {
                        charPos = -1;
                    }
                    builder.Append(GetChar((short)(((short)(charPos + i)) + 1)));
                }
            }
            catch (Exception exception1)
            {
                ProjectData.SetProjectError(exception1);
                Exception exception = exception1;
                ProjectData.ClearProjectError();
            }
            return(builder.ToString());
        }
Exemplo n.º 2
0
 public void FromString_ThrowsOverflowException(string value)
 {
     Assert.Throws <OverflowException>(() => CharType.FromString(value));
 }
Exemplo n.º 3
0
 public void FromString_ThrowsInvalidCastException(string value)
 {
     Assert.Throws <InvalidCastException>(() => CharType.FromString(value));
 }
Exemplo n.º 4
0
 public void FromString_NotSupported(string value, char expected)
 {
     Assert.Throws <InvalidCastException>(() => CharType.FromString(value));
 }
Exemplo n.º 5
0
 public void FromString(string value, char expected)
 {
     Assert.Equal(expected, CharType.FromString(value));
 }