Beispiel #1
0
 public void SetUp()
 {
     Converter = new Base4096();
 }
Beispiel #2
0
 private Base GetMethod()
 {
     Base method = null;
     string alphabet = tbAlphabet.Text;
     if (tbSpecialChar.Text.Length > 1)
         throw new ArgumentException("Special char should contains one symbol");
     char special = string.IsNullOrWhiteSpace(tbSpecialChar.Text) ? (char)0 : tbSpecialChar.Text[0];
     Encoding textEncoding = cmbTextEncoding.SelectedItem != null ?
         (Encoding)((ComboBoxItem)cmbTextEncoding.SelectedItem).Value : null;
     bool parallel = cbParallel.Checked;
     switch (cmbMethod.SelectedItem.ToString())
     {
         case "Base32":
             method = new Base32(alphabet, special, textEncoding);
             break;
         case "Base64":
             method = new Base64(alphabet, special, textEncoding, parallel);
             break;
         case "Base128":
             method = new Base128(alphabet, special, textEncoding);
             break;
         case "Base256":
             method = new Base256(alphabet, special, textEncoding);
             break;
         case "Base1024":
             method = new Base1024(alphabet, special, textEncoding);
             break;
         case "Base4096":
             method = new Base4096(alphabet, special, textEncoding);
             break;
         case "ZBase32":
             method = new ZBase32(alphabet, special, textEncoding);
             break;
         case "Base85":
             method = new Base85(alphabet, special, cbPrefixPostfix.Checked, textEncoding);
             break;
         case "Base91":
             method = new Base91(alphabet, special, textEncoding);
             break;
         case "BaseN":
             method = new BaseN(alphabet, (uint)nudMaxBitsCount.Value, textEncoding, cbReverseOrder.Checked, parallel);
             break;
         case "BaseBigN":
             method = new BaseBigN(alphabet, (uint)nudMaxBitsCount.Value, textEncoding,
                 cbReverseOrder.Checked, parallel, cbMaxCompression.Checked);
             break;
     }
     tbBitsPerChars.Text = method.BlockBitsCount + "/" + method.BlockCharsCount;
     tbRatio.Text = ((double)method.BlockBitsCount / method.BlockCharsCount).ToString("0.000000");
     nudAlphabetLength.Value = method.CharsCount;
     return method;
 }
Beispiel #3
0
 public void SetUp()
 {
     Converter = new Base4096();
 }
Beispiel #4
0
        private Base GetMethod()
        {
            Base   method   = null;
            string alphabet = tbAlphabet.Text;

            if (tbSpecialChar.Text.Length > 1)
            {
                throw new ArgumentException("Special char should contains one symbol");
            }
            char     special      = string.IsNullOrWhiteSpace(tbSpecialChar.Text) ? (char)0 : tbSpecialChar.Text[0];
            Encoding textEncoding = cmbTextEncoding.SelectedItem != null ?
                                    (Encoding)((ComboBoxItem)cmbTextEncoding.SelectedItem).Value : null;
            bool parallel = cbParallel.Checked;

            switch (cmbMethod.SelectedItem.ToString())
            {
            case "Base32":
                method = new Base32(alphabet, special, textEncoding);
                break;

            case "Base64":
                method = new Base64(alphabet, special, textEncoding, parallel);
                break;

            case "Base128":
                method = new Base128(alphabet, special, textEncoding);
                break;

            case "Base256":
                method = new Base256(alphabet, special, textEncoding);
                break;

            case "Base1024":
                method = new Base1024(alphabet, special, textEncoding);
                break;

            case "Base4096":
                method = new Base4096(alphabet, special, textEncoding);
                break;

            case "ZBase32":
                method = new ZBase32(alphabet, special, textEncoding);
                break;

            case "Base85":
                method = new Base85(alphabet, special, cbPrefixPostfix.Checked, textEncoding);
                break;

            case "Base91":
                method = new Base91(alphabet, special, textEncoding);
                break;

            case "BaseN":
                method = new BaseN(alphabet, (uint)nudMaxBitsCount.Value, textEncoding, cbReverseOrder.Checked, parallel);
                break;

            case "BaseBigN":
                method = new BaseBigN(alphabet, (uint)nudMaxBitsCount.Value, textEncoding,
                                      cbReverseOrder.Checked, parallel, cbMaxCompression.Checked);
                break;
            }
            tbBitsPerChars.Text     = method.BlockBitsCount + "/" + method.BlockCharsCount;
            tbRatio.Text            = ((double)method.BlockBitsCount / method.BlockCharsCount).ToString("0.000000");
            nudAlphabetLength.Value = method.CharsCount;
            return(method);
        }