public void PosTest2()
 {
     Byte[] bytes = new Byte[] { };
     UTF7Encoding UTF7 = new UTF7Encoding();
     int charCount = UTF7.GetCharCount(bytes, 0, 0);
     Assert.Equal(0, charCount);
 }
Exemple #2
0
 public void PosTest2()
 {
     UTF7Encoding utf71 = new UTF7Encoding();
     UTF7Encoding utf72 = new UTF7Encoding();
     utf71 = utf72;
     Assert.True(utf71.Equals(utf72));
 }
        public string Decompress(string filename)
        {
            StringBuilder result = null;

            try
            {
                Stream s = new GZipInputStream(File.OpenRead(filename));

                result = new StringBuilder(8192);
                UTF7Encoding encoding = new UTF7Encoding(true);

                int size = 2048;
                byte[] writeData = new byte[2048];
                while (true)
                {
                    size = s.Read(writeData, 0, size);
                    if (size > 0)
                    {
                       result.Append(encoding.GetString(writeData,0,size));
                    }
                    else
                    {
                        break;
                    }
                }
                s.Close();

            } // end try
            catch (GZipException)
            {
                throw new Exception("Error: The file being read contains invalid data.");
            }
            catch (FileNotFoundException)
            {
                throw new Exception("Error:The file specified was not found.");
            }
            catch (ArgumentException)
            {
                throw new Exception("Error: path is a zero-length string, contains only white space, or contains one or more invalid characters");
            }
            catch (PathTooLongException)
            {
                throw new Exception("Error: The specified path, file name, or both exceed the system-defined maximum length. For example, on Windows-based platforms, paths must be less than 248 characters, and file names must be less than 260 characters.");
            }
            catch (DirectoryNotFoundException)
            {
                throw new Exception("Error: The specified path is invalid, such as being on an unmapped drive.");
            }
            catch (IOException)
            {
                throw new Exception("Error: An I/O error occurred while opening the file.");
            }
            catch (UnauthorizedAccessException)
            {
                throw new Exception("Error: path specified a file that is read-only, the path is a directory, or caller does not have the required permissions.");
            }

            return result.ToString();
        }
 public void NegTest1()
 {
     Byte[] bytes = null;
     UTF7Encoding utf7 = new UTF7Encoding();
     Assert.Throws<ArgumentNullException>(() =>
     {
         string str = utf7.GetString(bytes, 0, 2);
     });
 }
 public void PosTest1()
 {
     Byte[] bytes = new Byte[] {
                      85,  84,  70,  56,  32,  69, 110,
                      99, 111, 100, 105, 110, 103,  32,
                      69, 120,  97, 109, 112, 108, 101};
     UTF7Encoding utf7 = new UTF7Encoding();
     string str = utf7.GetString(bytes, 0, bytes.Length);
 }
 public void NegTest1()
 {
     UTF7Encoding utf7 = new UTF7Encoding();
     int byteCount = -1;
     Assert.Throws<ArgumentOutOfRangeException>(() =>
     {
         int maxCharCount = utf7.GetMaxCharCount(byteCount);
     });
 }
 public void NegTest1()
 {
     Byte[] bytes = null;
     UTF7Encoding UTF7 = new UTF7Encoding();
     Assert.Throws<ArgumentNullException>(() =>
     {
         int charCount = UTF7.GetCharCount(bytes, 2, 8);
     });
 }
 public void PosTest2()
 {
     Char[] chars;
     Byte[] bytes = new Byte[] { };
     UTF7Encoding UTF7 = new UTF7Encoding();
     int charCount = UTF7.GetCharCount(bytes, 0, 0);
     chars = new Char[] { };
     int charsDecodedCount = UTF7.GetChars(bytes, 0, 0, chars, 0);
     Assert.Equal(0, charsDecodedCount);
 }
 public void PosTest2()
 {
     Byte[] bytes;
     Char[] chars = new Char[] { };
     UTF7Encoding UTF7 = new UTF7Encoding();
     int byteCount = UTF7.GetByteCount(chars, 0, 0);
     bytes = new Byte[byteCount];
     int bytesEncodedCount = UTF7.GetBytes(chars, 0, 0, bytes, 0);
     Assert.Equal(0, bytesEncodedCount);
 }
 public void PosTest1()
 {
     Byte[] bytes = new Byte[] {
                                  85,  84,  70,  56,  32,  69, 110,
                                  99, 111, 100, 105, 110, 103,  32,
                                  69, 120,  97, 109, 112, 108, 101};
     UTF7Encoding UTF7 = new UTF7Encoding();
     int charCount = UTF7.GetCharCount(bytes, 2, 8);
     Assert.Equal(8, charCount);
 }
 public void NegTest1()
 {
     Char[] chars;
     Byte[] bytes = null;
     UTF7Encoding UTF7 = new UTF7Encoding();
     chars = new Char[] { };
     Assert.Throws<ArgumentNullException>(() =>
     {
         int charsDecodedCount = UTF7.GetChars(bytes, 0, 0, chars, 0);
     });
 }
 public void AcceptsNullContent()
 {
     Encoding utf7 = new UTF7Encoding();
     StringResource r = new StringResource(null, utf7);
     Assert.AreEqual(string.Empty, r.Content);
     Stream stm = r.InputStream;
     Assert.IsTrue(stm.CanRead);
     Assert.IsNotNull(stm);
     Assert.AreEqual(0, stm.Length);
     stm.Close();
 }
 public void NegTest4()
 {
     Byte[] bytes = new Byte[] {
                                  85,  84,  70,  56,  32,  69, 110,
                                  99, 111, 100, 105, 110, 103,  32,
                                  69, 120,  97, 109, 112, 108, 101};
     UTF7Encoding UTF7 = new UTF7Encoding();
     Assert.Throws<ArgumentOutOfRangeException>(() =>
     {
         int charCount = UTF7.GetCharCount(bytes, bytes.Length, 6);
     });
 }
 public void NegTest3()
 {
     Byte[] bytes = new Byte[] {
                      85,  84,  70,  56,  32,  69, 110,
                      99, 111, 100, 105, 110, 103,  32,
                      69, 120,  97, 109, 112, 108, 101};
     UTF7Encoding utf7 = new UTF7Encoding();
     Assert.Throws<ArgumentOutOfRangeException>(() =>
     {
         string str = utf7.GetString(bytes, 0, -1);
     });
 }
 protected byte[] Decode7Bit(string value)
 {
     try
     {
         UTF7Encoding utf7 = new UTF7Encoding();                
         return utf7.GetBytes(value);
     }
     catch
     {
         return null;
     }
 }
 public void NegTest1()
 {
     Byte[] bytes;
     Char[] chars = null;
     UTF7Encoding UTF7 = new UTF7Encoding();
     int byteCount = 10;
     bytes = new Byte[byteCount];
     Assert.Throws<ArgumentNullException>(() =>
     {
         int bytesEncodedCount = UTF7.GetBytes(chars, 1, 2, bytes, 0);
     });
 }
 public void PosTest1()
 {
     Char[] chars;
     Byte[] bytes = new Byte[] {
          85,  84,  70,  55,  32,  69, 110,
          99, 111, 100, 105, 110, 103,  32,
          69, 120,  97, 109, 112, 108, 101
     };
     UTF7Encoding UTF7 = new UTF7Encoding();
     int charCount = UTF7.GetCharCount(bytes, 2, 8);
     chars = new Char[charCount];
     int charsDecodedCount = UTF7.GetChars(bytes, 2, 8, chars, 0);
 }
 public void PosTest1()
 {
     Byte[] bytes;
     Char[] chars = new Char[] {
                     '\u0023',
                     '\u0025',
                     '\u03a0',
                     '\u03a3'  };
     UTF7Encoding UTF7 = new UTF7Encoding();
     int byteCount = UTF7.GetByteCount(chars, 1, 2);
     bytes = new Byte[byteCount];
     int bytesEncodedCount = UTF7.GetBytes(chars, 1, 2, bytes, 0);
 }
 public void PosTest2()
 {
     int startIndex = 0;
     int count = 0;
     Byte[] bytes = new Byte[] {
                      85,  84,  70,  56,  32,  69, 110,
                      99, 111, 100, 105, 110, 103,  32,
                      69, 120,  97, 109, 112, 108, 101};
     startIndex = _generator.GetInt32(-55) % bytes.Length;
     count = _generator.GetInt32(-55) % (bytes.Length - startIndex) + 1;
     UTF7Encoding utf7 = new UTF7Encoding();
     string str = utf7.GetString(bytes, startIndex, count);
 }
Exemple #20
0
        public string Hash2(string Input, string partialSalt)
        {
            string szData = Input + this.baseSalt + partialSalt;
            byte[] workData = new UTF7Encoding().GetBytes(szData);
            workData = new MD5CryptoServiceProvider().ComputeHash(workData);

            StringBuilder sb = new StringBuilder(32);
            foreach (byte b in workData)
            {
                sb.Append(b.ToString("x2"));
            }

            return sb.ToString();
        }
 public void NegTest2()
 {
     Char[] chars = null;
     Byte[] bytes = new Byte[] {
          85,  84,  70,  55,  32,  69, 110,
          99, 111, 100, 105, 110, 103,  32,
          69, 120,  97, 109, 112, 108, 101
     };
     UTF7Encoding UTF7 = new UTF7Encoding();
     Assert.Throws<ArgumentNullException>(() =>
     {
         int charsDecodedCount = UTF7.GetChars(bytes, 2, 8, chars, 0);
     });
 }
 public void NegTest3()
 {
     Byte[] bytes;
     Char[] chars = new Char[] {
                     '\u0023',
                     '\u0025',
                     '\u03a0',
                     '\u03a3'  };
     UTF7Encoding UTF7 = new UTF7Encoding();
     int byteCount = UTF7.GetByteCount(chars, 1, 2);
     bytes = new Byte[byteCount];
     Assert.Throws<ArgumentOutOfRangeException>(() =>
     {
         int bytesEncodedCount = UTF7.GetBytes(chars, -1, 2, bytes, 0);
     });
 }
 public void NegTest3()
 {
     Char[] chars;
     Byte[] bytes = new Byte[] {
          85,  84,  70,  55,  32,  69, 110,
          99, 111, 100, 105, 110, 103,  32,
          69, 120,  97, 109, 112, 108, 101
     };
     UTF7Encoding UTF7 = new UTF7Encoding();
     int charCount = UTF7.GetCharCount(bytes, 2, 8);
     chars = new Char[charCount];
     Assert.Throws<ArgumentOutOfRangeException>(() =>
     {
         int charsDecodedCount = UTF7.GetChars(bytes, -2, 8, chars, 0);
     });
 }
        public void EnsureDefaults()
        {
            Encoding enc = Encoding.Default;
            string FOO_CONTENT = "foo";
            string FOO_DESCRIPTION = "foo description";

            StringResource r = new StringResource(FOO_CONTENT);    
            Assert.AreEqual(FOO_CONTENT, r.Content);
            Assert.AreEqual(enc, r.Encoding);
            Assert.AreEqual(string.Empty, r.Description);

            enc = new UTF7Encoding();
            r = new StringResource(FOO_CONTENT, enc, FOO_DESCRIPTION);    
            Assert.AreEqual(FOO_CONTENT, r.Content);
            Assert.AreEqual(enc, r.Encoding);
            Assert.AreEqual(FOO_DESCRIPTION, r.Description);
        }
 public void TestDirectlyEncoded1() 
 {
         // Unicode characters a-z, A-Z, 0-9 and '()_./:? are directly encoded.
         string UniCodeString = "\u0061\u007A\u0041\u005A\u0030\u0039\u0027\u003F";
         byte[] UTF7Bytes = null;
         UTF7Encoding UTF7enc = new UTF7Encoding ();
         
         UTF7Bytes = UTF7enc.GetBytes (UniCodeString);
         
         Assertion.AssertEquals ("UTF7 #1", 0x61, UTF7Bytes [0]);
         Assertion.AssertEquals ("UTF7 #2", 0x7A, UTF7Bytes [1]);
         Assertion.AssertEquals ("UTF7 #3", 0x41, UTF7Bytes [2]);
         Assertion.AssertEquals ("UTF7 #4", 0x5A, UTF7Bytes [3]);
         Assertion.AssertEquals ("UTF7 #5", 0x30, UTF7Bytes [4]);
         Assertion.AssertEquals ("UTF7 #6", 0x39, UTF7Bytes [5]);
         Assertion.AssertEquals ("UTF7 #7", 0x27, UTF7Bytes [6]);
         Assertion.AssertEquals ("UTF7 #8", 0x3F, UTF7Bytes [7]);
 }
Exemple #26
0
                public void TestDirectlyEncoded2()
                {
                        // Unicode characters a-z, A-Z, 0-9 and '()_./:? are directly encoded.
                        string UniCodeString = "\u0061\u007A\u0041\u005A\u0030\u0039\u0027\u003F";
                        byte[] UTF7Bytes = new byte [8];
                        int Length = UniCodeString.Length;
                        UTF7Encoding UTF7enc = new UTF7Encoding ();
                        
                        int Cnt = UTF7enc.GetBytes (UniCodeString.ToCharArray(), 0, Length, UTF7Bytes, 0);
                
		        Assert.AreEqual (0x61, UTF7Bytes [0], "UTF7 #1");
                        Assert.AreEqual (0x7A, UTF7Bytes [1], "UTF7 #2");
                        Assert.AreEqual (0x41, UTF7Bytes [2], "UTF7 #3");
                        Assert.AreEqual (0x5A, UTF7Bytes [3], "UTF7 #4");
                        Assert.AreEqual (0x30, UTF7Bytes [4], "UTF7 #5");
                        Assert.AreEqual (0x39, UTF7Bytes [5], "UTF7 #6");
                        Assert.AreEqual (0x27, UTF7Bytes [6], "UTF7 #7");
                        Assert.AreEqual (0x3F, UTF7Bytes [7], "UTF7 #8");
		}
 public static string ByteArrayToString(byte[] bytes, EncodingType encodingType)
 {
     System.Text.Encoding encoding = null;
     switch (encodingType)
     {
         case EncodingType.ASCII:
             encoding = new System.Text.ASCIIEncoding();
             break;
         case EncodingType.Unicode:
             encoding = new System.Text.UnicodeEncoding();
             break;
         case EncodingType.UTF7:
             encoding = new System.Text.UTF7Encoding();
             break;
         case EncodingType.UTF8:
             encoding = new System.Text.UTF8Encoding();
             break;
     }
     return encoding.GetString(bytes);
 }
Exemple #28
0
        /// <summary>
        /// this method is for converting string to byte array.
        /// </summary>
        /// <param name="post">String to be transformed.</param>
        /// <param name="encodingType">the required  encoding type</param>
        /// <returns>Byte array</returns>
        private byte[] StringToByteArray(string post, string encodingType)
        {
            Encoding encoding = null;

            if (string.IsNullOrEmpty(encodingType))
            {
                encodingType = string.Empty;
            }

            switch (encodingType.ToLower())
            {
            case "ascii":
                encoding = new System.Text.ASCIIEncoding();
                break;

            case "unicode":
                encoding = new System.Text.UnicodeEncoding();
                break;

            case "utf7":
                encoding = new System.Text.UTF7Encoding();
                break;

            default:
                encoding = new System.Text.UTF8Encoding();
                break;
            }

            try
            {
                return(encoding.GetBytes(post));
            }
            catch (ArgumentNullException ane)
            {
                throw new ArgumentNullException(ane.Message);
            }
            catch (EncoderFallbackException efe)
            {
                throw new EncoderFallbackException(efe.Message);
            }
        }
        /// <summary>
        /// Converts a byte array to a string using specified encoding.
        /// </summary>
        /// <param name="bytes">Array of bytes to be converted.</param>
        /// <param name="encodingType">EncodingType enum.</param>
        public static string ByteArrayToString(byte[] bytes, EncodingType encodingType)
        {
            System.Text.Encoding encoding = null;
            switch (encodingType)
            {
            case EncodingType.ASCII:
                encoding = new System.Text.ASCIIEncoding();
                break;

            case EncodingType.Unicode:
                encoding = new System.Text.UnicodeEncoding();
                break;

            case EncodingType.UTF7:
                encoding = new System.Text.UTF7Encoding();
                break;

            case EncodingType.UTF8:
                encoding = new System.Text.UTF8Encoding();
                break;
            }
            return(encoding.GetString(bytes));
        }
Exemple #30
0
        /// <summary>
        /// Converts a string to a byte array using specified encoding.
        /// </summary>
        /// <param name="str">String to be converted.</param>
        /// <param name="encodingType">EncodingType enum.</param>
        /// <returns>byte array</returns>
        public static byte[] StringToByteArray(string str, EncodingType encodingType)
        {
            System.Text.Encoding encoding = null;
            switch (encodingType)
            {
            case EncodingType.ASCII:
                encoding = new System.Text.ASCIIEncoding();
                break;

            case EncodingType.Unicode:
                encoding = new System.Text.UnicodeEncoding();
                break;

            case EncodingType.UTF7:
                encoding = new System.Text.UTF7Encoding();
                break;

            case EncodingType.UTF8:
                encoding = new System.Text.UTF8Encoding();
                break;
            }
            return(encoding.GetBytes(str));
        }
Exemple #31
0
        private static string ByteArrayToString(byte[] bytes, EncodingType encodingType)
        {
            System.Text.Encoding encoding = null;
            string result = "";

            switch (encodingType)

            {
            case EncodingType.ASCII:
                encoding = new System.Text.ASCIIEncoding();
                break;

            case EncodingType.Unicode:
                encoding = new System.Text.UnicodeEncoding();
                break;

            case EncodingType.UTF7:
                encoding = new System.Text.UTF7Encoding();
                break;

            case EncodingType.UTF8:
                encoding = new System.Text.UTF8Encoding();
                break;
            }

            for (int i = 0; i < bytes.Length; i += 2)
            {
                if (bytes[i] == 0 && bytes[i + 1] == 0)
                {
                    result = encoding.GetString(bytes, 0, i);
                    break;
                }
            }

            return(result);
        }
        /// <summary> 
        /// Converts a byte array to a string using specified encoding. 
        /// </summary> 
        /// <param name="bytes">Array of bytes to be converted.</param> 
        /// <param name="encodingType">EncodingType enum.</param> 
        public static string ByteArrayToString(byte[] bytes, EncodingType encodingType)
        {
            Encoding encoding;
            switch (encodingType)
            {
                case EncodingType.ASCII:
                    encoding = new ASCIIEncoding();
                    break;
                case EncodingType.Unicode:
                    encoding = new UnicodeEncoding();
                    break;
                case EncodingType.UTF7:
                    encoding = new UTF7Encoding();
                    break;
                case EncodingType.UTF8:
                    encoding = new UTF8Encoding();
                    break;

                default:
                    encoding = new ASCIIEncoding();
                    break;
            }
            return encoding.GetString(bytes);
        }
 public void TestEncodeOptionalEncoded()
 {
         string UniCodeString = "\u0021\u0026\u002A\u003B";
         byte[] UTF7Bytes = null;
         
         //Optional Characters are allowed.	
         UTF7Encoding UTF7enc = new UTF7Encoding (true); 
         UTF7Bytes = UTF7enc.GetBytes (UniCodeString);
         
         Assertion.AssertEquals ("UTF7 #1", 0x21, UTF7Bytes [0]);
         Assertion.AssertEquals ("UTF7 #2", 0x26, UTF7Bytes [1]);
         Assertion.AssertEquals ("UTF7 #3", 0x2A, UTF7Bytes [2]);
         Assertion.AssertEquals ("UTF7 #4", 0x3B, UTF7Bytes [3]);
         
         //Optional characters are not allowed.
         UTF7enc = new UTF7Encoding (false);
         UTF7Bytes = UTF7enc.GetBytes (UniCodeString);
         
         Assertion.AssertEquals ("UTF7 #5", 0x2B, UTF7Bytes [0]);
         Assertion.AssertEquals ("UTF7 #6", 0x41, UTF7Bytes [1]);
         Assertion.AssertEquals ("UTF7 #7", 0x43, UTF7Bytes [2]);
         Assertion.AssertEquals ("UTF7 #8", 0x45, UTF7Bytes [3]);
         Assertion.AssertEquals ("UTF7 #6", 0x41, UTF7Bytes [1]);
 }
 public override int GetByteCount(char[] chars, int index, int count, bool flush)
 {
     return(UTF7Encoding.InternalGetByteCount(chars, index, count, flush, this.leftOver, this.isInShifted, this.allowOptionals));
 }
 public override int GetChars(byte[] bytes, int byteIndex, int byteCount, char[] chars, int charIndex)
 {
     return(UTF7Encoding.InternalGetChars(bytes, byteIndex, byteCount, chars, charIndex, ref this.leftOver));
 }
Exemple #36
0
 // Constructor.
 public UTF7Encoder(bool allowOptionals, UTF7Encoding encoding)
     : base(encoding)
 {
     this.allowOptionals = allowOptionals;
 }
Exemple #37
0
 public Encoder(UTF7Encoding encoding) : base(encoding)
 {
 }
 /// <summary>Calculates the number of bytes produced by encoding a set of characters from the specified character array.</summary>
 /// <returns>The number of bytes produced by encoding the specified characters.</returns>
 /// <param name="chars">The character array containing the set of characters to encode. </param>
 /// <param name="index">The index of the first character to encode. </param>
 /// <param name="count">The number of characters to encode. </param>
 /// <exception cref="T:System.ArgumentNullException">
 ///   <paramref name="chars" /> is null (Nothing). </exception>
 /// <exception cref="T:System.ArgumentOutOfRangeException">
 ///   <paramref name="index" /> or <paramref name="count" /> is less than zero.-or- <paramref name="index" /> and <paramref name="count" /> do not denote a valid range in <paramref name="chars" />.-or- The resulting number of bytes is greater than the maximum number that can be returned as an int. </exception>
 /// <exception cref="T:System.Text.EncoderFallbackException">A fallback occurred (see Understanding Encodings for complete explanation)-and-<see cref="P:System.Text.Encoding.EncoderFallback" /> is set to <see cref="T:System.Text.EncoderExceptionFallback" />.</exception>
 /// <filterpriority>1</filterpriority>
 public override int GetByteCount(char[] chars, int index, int count)
 {
     return(UTF7Encoding.InternalGetByteCount(chars, index, count, true, 0, false, this.allowOptionals));
 }
Exemple #39
0
 public Encoder(UTF7Encoding encoding) : base(encoding)
 {
     // base calls reset
 }
 public Encoder(UTF7Encoding encoding)
 {
     this.encoding = encoding;
     bitCount      = -1;
 }
 /// <summary>Calculates the number of characters produced by decoding a sequence of bytes from the specified byte array.</summary>
 /// <returns>The number of characters produced by decoding the specified sequence of bytes.</returns>
 /// <param name="bytes">The byte array containing the sequence of bytes to decode. </param>
 /// <param name="index">The index of the first byte to decode. </param>
 /// <param name="count">The number of bytes to decode. </param>
 /// <exception cref="T:System.ArgumentNullException">
 ///   <paramref name="bytes" /> is null (Nothing). </exception>
 /// <exception cref="T:System.ArgumentOutOfRangeException">
 ///   <paramref name="index" /> or <paramref name="count" /> is less than zero.-or- <paramref name="index" /> and <paramref name="count" /> do not denote a valid range in <paramref name="bytes" />.-or- The resulting number of characters is greater than the maximum number that can be returned as an int. </exception>
 /// <exception cref="T:System.Text.DecoderFallbackException">A fallback occurred (see Understanding Encodings for complete explanation)-and-<see cref="P:System.Text.Encoding.DecoderFallback" /> is set to <see cref="T:System.Text.DecoderExceptionFallback" />.</exception>
 /// <filterpriority>1</filterpriority>
 public override int GetCharCount(byte[] bytes, int index, int count)
 {
     return(UTF7Encoding.InternalGetCharCount(bytes, index, count, 0));
 }
        public override bool Equals(object value)
        {
            UTF7Encoding utf7Encoding = value as UTF7Encoding;

            return(utf7Encoding != null && (this.allowOptionals == utf7Encoding.allowOptionals && base.EncoderFallback.Equals(utf7Encoding.EncoderFallback)) && base.DecoderFallback.Equals(utf7Encoding.DecoderFallback));
        }
Exemple #43
0
 private void encodingToolStripComboBox_SelectedIndexChanged(object sender, EventArgs e)
 {
     Encoding encod = null;
     if (string.IsNullOrEmpty(encodingToolStripComboBox.Text))
         encod = Module.FilesEncoding;
     else if (encodingToolStripComboBox.Text.StartsWith("Default", StringComparison.CurrentCultureIgnoreCase))
         encod = Encoding.Default;
     else if (encodingToolStripComboBox.Text.Equals("ASCII", StringComparison.CurrentCultureIgnoreCase))
         encod = new ASCIIEncoding();
     else if (encodingToolStripComboBox.Text.Equals("Unicode", StringComparison.CurrentCultureIgnoreCase))
         encod = new UnicodeEncoding();
     else if (encodingToolStripComboBox.Text.Equals("UTF7", StringComparison.CurrentCultureIgnoreCase))
         encod = new UTF7Encoding();
     else if (encodingToolStripComboBox.Text.Equals("UTF8", StringComparison.CurrentCultureIgnoreCase))
         encod = new UTF8Encoding(false);
     else if (encodingToolStripComboBox.Text.Equals("UTF32", StringComparison.CurrentCultureIgnoreCase))
         encod = new UTF32Encoding(true, false);
     else
         encod = Module.FilesEncoding;
     if (encod != this.Encoding)
     {
         this.Encoding = encod;
         this.OnExtraDiffArgumentsChanged();
     }
 }
 public override int GetBytes(char[] chars, int charIndex, int charCount, byte[] bytes, int byteIndex, bool flush)
 {
     return(UTF7Encoding.InternalGetBytes(chars, charIndex, charCount, bytes, byteIndex, flush, ref this.leftOver, ref this.isInShifted, this.allowOptionals));
 }