public static void Main(string[] args)
    {
        string     str  = "Использование контейнеров.";
        Container  cont = new Container();
        CipherComp cc   = new CipherComp();
        CipherComp cc2  = new CipherComp();

        cont.Add(cc);
        cont.Add(cc2, "Второй компонент");
        Console.WriteLine("Первое сообщение: " + str);
        str = cc.Encode(str);
        Console.WriteLine("Первое сообщение в зашифрованном виде: " + str);
        str = cc.Decode(str);
        Console.WriteLine("Первое сообщение в дешифрованном виде: " + str);
        str = "один, два, три";
        Console.WriteLine("Второе сообщение: " + str);
        str = cc2.Encode(str);
        Console.WriteLine("Второе сообщение в зашифрованном виде: " + str);
        str = cc2.Decode(str);
        Console.WriteLine("Второе сообщение в дешифрованном виде: " + str);
        Console.WriteLine("\nИмя объекта cc2: " + cc2.Site.Name);
        Console.WriteLine();
        // Освобождаем оба компонента.
        cont.Dispose();
    }
Example #2
0
 public static void Main()
 {
     // Объект ее разрушится по завершении этого блока.
     using (CipherComp cc = new CipherComp())
     {
         string text       = "Инструкция using.";
         string ciphertext = cc.Encode(text);
         Console.WriteLine(ciphertext);
         string plaintext = cc.Decode(ciphertext);
         Console.WriteLine(plaintext);
     }
 }
Example #3
0
    public static void Main()
    {
        CipherComp cc         = new CipherComp();
        string     text       = "Это простой тест";
        string     ciphertext = cc.Encode(text);

        Console.WriteLine(ciphertext);
        string plaintext = cc.Decode(ciphertext);

        Console.WriteLine(plaintext);
        cc.Dispose(); // Освобождаем ресурсы.
    }
Example #4
0
 static void Main(string[] args)
 {
     {
         for (int k = 1; k <= 1000; k++)
         {
             CipherComp сc = new CipherComp();
             for (uint i = 0; i < 32; i++)
             {
                 сc.Fn(i, 1);
             }
             сc.Dispose();
         }
     }
 }
Example #5
0
 public static void Main()
 {
     CipherComp cc = new CipherComp();
     string text = "Testing";
     string ciphertext = cc.Encode(text);
     Console.WriteLine(ciphertext);
     string plaintext = cc.Decode(ciphertext);
     Console.WriteLine(plaintext);
     text = "Components are powerful";
     ciphertext = cc.Encode(text);
     Console.WriteLine(ciphertext);
     plaintext = cc.Decode(ciphertext);
     Console.WriteLine(plaintext);
     cc.Dispose();
     Console.Read();
 }
    public static void Main()
    {
        CipherComp cc         = new CipherComp();
        string     text       = "Тестирование";
        string     ciphertext = cc.Encode(text);

        Console.WriteLine(ciphertext);
        string plaintext = cc.Decode(ciphertext);

        Console.WriteLine(plaintext);
        text       = "Компоненты - мощное средство языка C#.";
        ciphertext = cc.Encode(text);
        Console.WriteLine(ciphertext);
        plaintext = cc.Decode(ciphertext);
        Console.WriteLine(plaintext);
        cc.Dispose(); // Освобождаем ресурсы.
    }