void SetInfo(string text, bool error)
        {
            ETextBox textBoxInfo = (ETextBox)window.Controls["Info"];

            textBoxInfo.Text      = text;
            textBoxInfo.TextColor = error ? new ColorValue(1, 0, 0) : new ColorValue(1, 1, 1);
        }
Exemple #2
0
        protected override void  OnAttach()
        {
            Box1      = new ETextBox();
            Box2      = new ETextBox();
            Box1.Name = "A";
            Box2.Name = "B";

            Box1.Text = "1";
            Box2.Text = "2";

            base.OnAttach();
        }
Exemple #3
0
        ///////////////////////////////////////////

        /// <summary>
        /// Creates a window of the main menu and creates the background world.
        /// </summary>
        protected override void OnAttach()
        {
            base.OnAttach();

            //create main menu window
            window = ControlDeclarationManager.Instance.CreateControl("Gui\\MainMenuWindow.gui");

            window.ColorMultiplier = new ColorValue(1, 1, 1, 0);
            Controls.Add(window);

            //no shader model 3 warning
            if (window.Controls["NoShaderModel3"] != null)
            {
                window.Controls["NoShaderModel3"].Visible = !RenderSystem.Instance.HasShaderModel3();
            }

            //button handlers
            ((EButton)window.Controls["Run"]).Click         += Run_Click;
            ((EButton)window.Controls["Multiplayer"]).Click += Multiplayer_Click;
            ((EButton)window.Controls["GuiTest"]).Click     += GuiTest_Click;

            //add version info control
            versionTextBox = new ETextBox();
            versionTextBox.TextHorizontalAlign = HorizontalAlign.Left;
            versionTextBox.TextVerticalAlign   = VerticalAlign.Bottom;
            versionTextBox.Text            = "Version " + EngineVersionInformation.Version;
            versionTextBox.ColorMultiplier = new ColorValue(1, 1, 1, 0);

            Controls.Add(versionTextBox);

            //play background music
            GameMusic.MusicPlay("Sounds\\Music\\MainMenu.ogg", true);

            //update sound listener
            SoundWorld.Instance.SetListener(new Vec3(1000, 1000, 1000),
                                            Vec3.Zero, new Vec3(1, 0, 0), new Vec3(0, 0, 1));

            //create the background world
            CreateMap();

            ResetTime();
        }
        ///////////////////////////////////////////
        /// <summary>
        /// Creates a window of the main menu and creates the background world.
        /// </summary>
        protected override void OnAttach()
        {
            base.OnAttach();

            //create main menu window
            window = ControlDeclarationManager.Instance.CreateControl( "Gui\\MainMenuWindow.gui" );

            window.ColorMultiplier = new ColorValue( 1, 1, 1, 0 );
            Controls.Add( window );

            //no shader model 2 warning
            if( window.Controls[ "NoShaderModel2" ] != null )
                window.Controls[ "NoShaderModel2" ].Visible = !RenderSystem.Instance.HasShaderModel2();

            //button handlers
            ( (EButton)window.Controls[ "Run" ] ).Click += Run_Click;
            ( (EButton)window.Controls[ "Multiplayer" ] ).Click += Multiplayer_Click;

            //add version info control
            versionTextBox = new ETextBox();
            versionTextBox.TextHorizontalAlign = HorizontalAlign.Left;
            versionTextBox.TextVerticalAlign = VerticalAlign.Bottom;
            versionTextBox.Text = "Version " + EngineVersionInformation.Version;
            versionTextBox.ColorMultiplier = new ColorValue( 1, 1, 1, 0 );

            Controls.Add( versionTextBox );

            //play background music
            GameMusic.MusicPlay( "Sounds\\Music\\MainMenu.ogg", true );

            //update sound listener
            SoundWorld.Instance.SetListener( new Vec3( 1000, 1000, 1000 ),
                Vec3.Zero, new Vec3( 1, 0, 0 ), new Vec3( 0, 0, 1 ) );

            //create the background world
            CreateMap();

            ResetTime();
        }
Exemple #5
0
 private void InitializeComponent()
 {
     this.nameLabel    = new System.Windows.Forms.Label();
     this.tokenLabel   = new System.Windows.Forms.Label();
     this.tokenDisplay = new System.Windows.Forms.Label();
     this.okButton     = new System.Windows.Forms.Button();
     this.cancelButton = new System.Windows.Forms.Button();
     this.nameETextBox = new LibETextBox.ETextBox();
     this.SuspendLayout();
     //
     // nameLabel
     //
     this.nameLabel.Location  = new System.Drawing.Point(94, 6);
     this.nameLabel.Name      = "nameLabel";
     this.nameLabel.Size      = new System.Drawing.Size(49, 20);
     this.nameLabel.TabIndex  = 0;
     this.nameLabel.Text      = "Name";
     this.nameLabel.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
     //
     // tokenLabel
     //
     this.tokenLabel.Location  = new System.Drawing.Point(86, 55);
     this.tokenLabel.Name      = "tokenLabel";
     this.tokenLabel.Size      = new System.Drawing.Size(49, 20);
     this.tokenLabel.TabIndex  = 2;
     this.tokenLabel.Text      = "Token";
     this.tokenLabel.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
     //
     // tokenDisplay
     //
     this.tokenDisplay.BackColor   = System.Drawing.Color.Red;
     this.tokenDisplay.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
     this.tokenDisplay.Location    = new System.Drawing.Point(103, 76);
     this.tokenDisplay.Name        = "tokenDisplay";
     this.tokenDisplay.Size        = new System.Drawing.Size(15, 20);
     this.tokenDisplay.TabIndex    = 3;
     this.tokenDisplay.TextAlign   = System.Drawing.ContentAlignment.MiddleCenter;
     this.tokenDisplay.Click      += new System.EventHandler(this.tokenDisplay_Click);
     //
     // okButton
     //
     this.okButton.Location = new System.Drawing.Point(32, 121);
     this.okButton.Name     = "okButton";
     this.okButton.Size     = new System.Drawing.Size(75, 22);
     this.okButton.TabIndex = 4;
     this.okButton.Text     = "OK";
     this.okButton.UseVisualStyleBackColor = true;
     this.okButton.Click += new System.EventHandler(this.okButton_Click);
     //
     // cancelButton
     //
     this.cancelButton.DialogResult            = System.Windows.Forms.DialogResult.Cancel;
     this.cancelButton.Location                = new System.Drawing.Point(118, 121);
     this.cancelButton.Name                    = "cancelButton";
     this.cancelButton.Size                    = new System.Drawing.Size(75, 22);
     this.cancelButton.TabIndex                = 5;
     this.cancelButton.Text                    = "Cancel";
     this.cancelButton.UseVisualStyleBackColor = true;
     //
     // nameETextBox
     //
     this.nameETextBox.Location = new System.Drawing.Point(60, 28);
     this.nameETextBox.Name     = "nameETextBox";
     this.nameETextBox.Size     = new System.Drawing.Size(100, 20);
     this.nameETextBox.TabIndex = 1;
     //
     // PlayerDialog
     //
     this.AcceptButton        = this.okButton;
     this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
     this.AutoScaleMode       = System.Windows.Forms.AutoScaleMode.Font;
     this.CancelButton        = this.cancelButton;
     this.ClientSize          = new System.Drawing.Size(224, 153);
     this.Controls.Add(this.nameETextBox);
     this.Controls.Add(this.cancelButton);
     this.Controls.Add(this.okButton);
     this.Controls.Add(this.tokenDisplay);
     this.Controls.Add(this.tokenLabel);
     this.Controls.Add(this.nameLabel);
     this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.Fixed3D;
     this.Name            = "PlayerDialog";
     this.ShowIcon        = false;
     this.StartPosition   = System.Windows.Forms.FormStartPosition.CenterParent;
     this.Text            = "Human Player";
     this.ResumeLayout(false);
     this.PerformLayout();
 }
        ///////////////////////////////////////////
        /// <summary>
        /// Creates a window of the main menu and creates the background world.
        /// </summary>
        protected override void OnAttach()
        {
            base.OnAttach();

            //create main menu window
            window = ControlDeclarationManager.Instance.CreateControl( "Gui\\AntMain.gui" );

            string[] mapList = VirtualDirectory.GetFiles("Maps\\AntRTS", "*.map", SearchOption.AllDirectories);

            window.ColorMultiplier = new ColorValue( 1, 1, 1, 0 );
            Controls.Add( window );

            //no shader model 2 warning
            //if( window.Controls[ "NoShaderModel2" ] != null )
                //window.Controls[ "NoShaderModel2" ].Visible = !RenderSystem.Instance.HasShaderModel2();

            //button handlers
            //( (EButton)window.Controls[ "Run" ] ).Click += Run_Click;

            //( (EButton)window.Controls[ "Multiplayer" ] ).Click += Multiplayer_Click;
            ((EButton)window.Controls["ToggleFaction"]).Click += ToggleFaction_Click;
            ((EButton)window.Controls["SelectFaction"]).Click += Faction_Click;
            ((EButton)window.Controls["Back"]).Click += Back_Click;
            //add version info control
            versionTextBox = new ETextBox();
            versionTextBox.TextHorizontalAlign = HorizontalAlign.Left;
            versionTextBox.TextVerticalAlign = VerticalAlign.Bottom;
            versionTextBox.Text = "Version " + EngineVersionInformation.Version;
            versionTextBox.ColorMultiplier = new ColorValue( 1, 1, 1, 0 );

            Controls.Add( versionTextBox );

            //maps listBox

                listBox = (EListBox)window.Controls["MapSelect"];

                foreach (string name in mapList)
                {
                    listBox.Items.Add(name);
                    if (Map.Instance != null)
                    {
                        if (string.Compare(name.Replace('/', '\\'),
                            Map.Instance.VirtualFileName.Replace('/', '\\'), true) == 0)
                            listBox.SelectedIndex = listBox.Items.Count - 1;
                    }
                }

                listBox.SelectedIndexChange += listBox_SelectedIndexChanged;
                if (listBox.Items.Count != 0 && listBox.SelectedIndex == -1)
                    listBox.SelectedIndex = 0;
                if (listBox.Items.Count != 0)
                    listBox_SelectedIndexChanged(null);

                listBox.ItemMouseDoubleClick += delegate(object sender, EListBox.ItemMouseEventArgs e)
                {
                    GameEngineApp.Instance.SetNeedMapLoad((string)e.Item);
                };

            ((EButton)window.Controls["Run"]).Click += delegate(EButton sender)
            {
                if (listBox.SelectedIndex != -1)
                    GameEngineApp.Instance.SetNeedMapLoad((string)listBox.SelectedItem);
            };

            //play background music
            GameMusic.MusicPlay( "Sounds\\Music\\Bumps.ogg", true );

            //update sound listener
            SoundWorld.Instance.SetListener( new Vec3( 1000, 1000, 1000 ),
                Vec3.Zero, new Vec3( 1, 0, 0 ), new Vec3( 0, 0, 1 ) );

            //create the background world
            CreateMap();

            ResetTime();
        }
Exemple #7
0
            public override void OnUpdate()
            {
                RenderStatisticsInfo statistics = RendererWorld.Instance.Statistics;

                PageControl.Controls["Triangles"].Text = statistics.Triangles.ToString("N0");
                PageControl.Controls["Batches"].Text   = statistics.Batches.ToString("N0");
                PageControl.Controls["Lights"].Text    = statistics.Lights.ToString("N0");

                //performance counter
                {
                    float otherTime = 0;

                    foreach (PerformanceCounter.Counter counter in PerformanceCounter.Counters)
                    {
                        PerformanceCounter.TimeCounter timeCounter =
                            counter as PerformanceCounter.TimeCounter;

                        if (timeCounter != null)
                        {
                            string counterNameWithoutSpaces = counter.Name.Replace(" ", "");

                            EControl timeControl = PageControl.Controls[
                                counterNameWithoutSpaces + "Time"];
                            EControl fpsControl = PageControl.Controls[
                                counterNameWithoutSpaces + "FPS"];

                            if (timeControl != null)
                            {
                                timeControl.Text = (timeCounter.CalculatedValue * 1000.0f).
                                                   ToString("F2");
                            }
                            if (fpsControl != null)
                            {
                                fpsControl.Text = (1.0f / timeCounter.CalculatedValue).ToString("F1");
                            }

                            if (!counter.InnerCounter)
                            {
                                if (counter == PerformanceCounter.TotalTimeCounter)
                                {
                                    otherTime += timeCounter.CalculatedValue;
                                }
                                else
                                {
                                    otherTime -= timeCounter.CalculatedValue;
                                }
                            }
                        }
                    }

                    {
                        ETextBox timeControl = PageControl.Controls["OtherTime"] as ETextBox;
                        ETextBox fpsControl  = PageControl.Controls["OtherFPS"] as ETextBox;

                        if (timeControl != null)
                        {
                            timeControl.Text = (otherTime * 1000.0f).ToString("F2");
                        }
                        if (fpsControl != null)
                        {
                            fpsControl.Text = (1.0f / otherTime).ToString("F1");
                        }
                    }
                }

                //cameras
                {
                    EListBox camerasListBox = (EListBox)PageControl.Controls["Cameras"];

                    //update cameras list
                    {
                        StatisticsInfoItem lastSelectedItem = camerasListBox.SelectedItem as
                                                              StatisticsInfoItem;

                        camerasListBox.Items.Clear();

                        foreach (RenderStatisticsInfo.CameraStatistics cameraStatistics in
                                 statistics.CamerasStatistics)
                        {
                            StatisticsInfoItem item = new StatisticsInfoItem();
                            item.cameraInformation     = cameraStatistics.CameraInformation;
                            item.ownerCameraIdentifier = cameraStatistics.OwnerCameraIdentifier;
                            camerasListBox.Items.Add(item);

                            if (lastSelectedItem != null)
                            {
                                if (item.cameraInformation == lastSelectedItem.cameraInformation &&
                                    item.ownerCameraIdentifier == lastSelectedItem.ownerCameraIdentifier)
                                {
                                    camerasListBox.SelectedIndex = camerasListBox.Items.Count - 1;
                                }
                            }
                        }

                        camerasListBox.Items.Add("Total");
                        if (lastSelectedItem != null && lastSelectedItem.cameraInformation == "Total")
                        {
                            camerasListBox.SelectedIndex = camerasListBox.Items.Count - 1;
                        }

                        if (camerasListBox.SelectedIndex == -1)
                        {
                            camerasListBox.SelectedIndex = camerasListBox.Items.Count - 1;
                        }
                    }

                    //update camera info
                    if (camerasListBox.SelectedIndex == camerasListBox.Items.Count - 1)
                    {
                        //total statistics

                        int staticMeshObjects = 0;
                        int sceneNodes        = 0;
                        int guiRenderers      = 0;
                        int guiBatches        = 0;
                        int triangles         = 0;
                        int batches           = 0;

                        foreach (RenderStatisticsInfo.CameraStatistics cameraStatistics in
                                 statistics.CamerasStatistics)
                        {
                            staticMeshObjects += cameraStatistics.StaticMeshObjects;
                            sceneNodes        += cameraStatistics.SceneNodes;
                            guiRenderers      += cameraStatistics.GuiRenderers;
                            guiBatches        += cameraStatistics.GuiBatches;
                            triangles         += cameraStatistics.Triangles;
                            batches           += cameraStatistics.Batches;
                        }

                        PageControl.Controls["CameraOutdoorWalks"].Text  = "No camera";
                        PageControl.Controls["CameraPortalsPassed"].Text = "No camera";
                        PageControl.Controls["CameraZonesPassed"].Text   = "No camera";

                        PageControl.Controls["CameraStaticMeshObjects"].Text =
                            staticMeshObjects.ToString("N0");
                        PageControl.Controls["CameraSceneNodes"].Text   = sceneNodes.ToString("N0");
                        PageControl.Controls["CameraGuiRenderers"].Text = guiRenderers.ToString("N0");
                        PageControl.Controls["CameraGuiBatches"].Text   = guiBatches.ToString("N0");
                        PageControl.Controls["CameraTriangles"].Text    = triangles.ToString("N0");
                        PageControl.Controls["CameraBatches"].Text      = batches.ToString("N0");
                    }
                    else if (camerasListBox.SelectedIndex != -1)
                    {
                        //selected camera statistics

                        RenderStatisticsInfo.CameraStatistics activeCameraStatistics =
                            statistics.CamerasStatistics[camerasListBox.SelectedIndex];

                        RenderStatisticsInfo.CameraStatistics.PortalSystemInfo portalSystemInfo =
                            activeCameraStatistics.PortalSystem;
                        if (portalSystemInfo != null)
                        {
                            PageControl.Controls["CameraOutdoorWalks"].Text =
                                portalSystemInfo.OutdoorWalks.ToString("N0");
                            PageControl.Controls["CameraPortalsPassed"].Text =
                                portalSystemInfo.PortalsPassed.ToString("N0");
                            PageControl.Controls["CameraZonesPassed"].Text =
                                portalSystemInfo.ZonesPassed.ToString("N0");
                        }
                        else
                        {
                            PageControl.Controls["CameraOutdoorWalks"].Text  = "No zones";
                            PageControl.Controls["CameraPortalsPassed"].Text = "No zones";
                            PageControl.Controls["CameraZonesPassed"].Text   = "No zones";
                        }

                        PageControl.Controls["CameraStaticMeshObjects"].Text =
                            activeCameraStatistics.StaticMeshObjects.ToString("N0");
                        PageControl.Controls["CameraSceneNodes"].Text =
                            activeCameraStatistics.SceneNodes.ToString("N0");
                        PageControl.Controls["CameraGuiRenderers"].Text =
                            activeCameraStatistics.GuiRenderers.ToString("N0");
                        PageControl.Controls["CameraGuiBatches"].Text =
                            activeCameraStatistics.GuiBatches.ToString("N0");
                        PageControl.Controls["CameraTriangles"].Text =
                            activeCameraStatistics.Triangles.ToString("N0");
                        PageControl.Controls["CameraBatches"].Text =
                            activeCameraStatistics.Batches.ToString("N0");
                    }
                    else
                    {
                        //no camera selected

                        PageControl.Controls["CameraOutdoorWalks"].Text  = "";
                        PageControl.Controls["CameraPortalsPassed"].Text = "";
                        PageControl.Controls["CameraZonesPassed"].Text   = "";

                        PageControl.Controls["CameraStaticMeshObjects"].Text = "";
                        PageControl.Controls["CameraSceneNodes"].Text        = "";
                        PageControl.Controls["CameraGuiRenderers"].Text      = "";
                        PageControl.Controls["CameraGuiBatches"].Text        = "";
                        PageControl.Controls["CameraTriangles"].Text         = "";
                        PageControl.Controls["CameraBatches"].Text           = "";
                    }
                }
            }
Exemple #8
0
        private void CryptButton_Click(object sender, EventArgs e)
        {
            try
            {
                InputText.Text = InputText.Text.ToLower();
                string alphabet = "abcdefghijklmnopqrstuvwxyz";
                string binary_block = "", binary_block_last = "", binary_letter = "", binary_text = "";
                int    n = 0, F = 0, k = 0;
                int    p = Convert.ToInt32(PTextBox.Text);
                int    q = Convert.ToInt32(QTextBox.Text);
                int    E = Convert.ToInt32(ETextBox.Text);
                OutputText.Clear();
                n = p * q;
                F = (p - 1) * (q - 1);

                //Проверка p и q на простоту
                int a = 0, b = 0;
                for (int i = 1; i <= p; i++)
                {
                    if (p % i == 0)
                    {
                        a++;
                    }
                }
                for (int i = 1; i <= q; i++)
                {
                    if (q % i == 0)
                    {
                        b++;
                    }
                }
                if (q == p)
                {
                    MessageBox.Show("p=q!", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    QTextBox.Clear(); PTextBox.Clear();
                }
                else
                {
                    //проверка e
                    int nod = 0;
                    for (int i = 1; i <= F; i++)
                    {
                        if ((E % i == 0) && (F % i == 0))
                        {
                            nod++;
                        }
                    }
                    if (nod != 1)
                    {
                        MessageBox.Show("Введена некорректная экспонента зашифрования", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); ETextBox.Clear(); E = 0;
                    }
                    else
                    {
                        int n1 = n;
                        // переведем n в двоичную, дабы определить необходимые размеры блоков
                        while (n1 != 0)
                        {
                            binary_letter = binary_letter + Convert.ToString(n1 % 2);
                            n1            = n1 / 2;
                        }
                        int length_of_block = binary_letter.Length - 1;

                        /* Теперь заменяем каждую букву соответствующим элементом
                         * кольца классов вычетов по модулю 26 и переводим получившееся число
                         * в двоичную `систему счисления*/
                        for (int i = 0; i <= InputText.Text.Length - 1; i++)
                        {
                            if (alphabet.IndexOf(InputText.Text[i]) != -1)
                            {
                                //если символ - буква - работаем
                                int j = alphabet.IndexOf(InputText.Text[k]) % 26;
                                binary_letter = "";

                                // Погнали переводить в двоичную систему
                                while (j != 0)
                                {
                                    binary_letter = binary_letter + Convert.ToString(j % 2);
                                    j             = j / 2;
                                }

                                /*предусматриваем случай, если длина битового слова < 5
                                 * добавляем незначащие нули, пока длина не станет равна 5 */
                                while (binary_letter.Length < 5)
                                {
                                    binary_letter = binary_letter + "0";
                                }

                                //инициализировали бинарный текст
                                binary_text = binary_text.Insert(0, binary_letter);
                                k++;
                            }
                            // Иначе просто пропускаем символ
                            else
                            {
                                k++;
                            }
                        }
                        //самое время побить бинарный текст на блоки длиной length_of block
                        for (int i = 0; i <= binary_text.Length - 1; i = i + length_of_block)
                        {
                            if (i + length_of_block <= binary_text.Length - 1)
                            {
                                double dec_block = 0, crypt_dec_block = 1;
                                binary_block = binary_text.Substring(i, length_of_block);
                                //сразу переводим блок в дек систему
                                for (int l = 0; l <= binary_block.Length - 1; l++)
                                {
                                    int arg = 2 * (Convert.ToInt32(binary_block[l]) - 48);
                                    if (arg != 0)
                                    {
                                        dec_block = dec_block + Math.Pow(arg, l);
                                    }
                                }
                                for (int h = 1; h <= E; h++)
                                {
                                    crypt_dec_block = (crypt_dec_block * dec_block) % n;
                                }
                                OutputText.Text = " " + OutputText.Text.Insert(0, Convert.ToString(crypt_dec_block));
                            }
                            else
                            {
                                // Последний блок
                                binary_block_last = binary_text.Substring(i, binary_text.Length - i);
                                double dec_block_last = 0, crypt_dec_block_last = 1;
                                //сразу переводим блок в дек систему
                                for (int l = 0; l <= binary_block_last.Length - 1; l++)
                                {
                                    int arg = 2 * (Convert.ToInt32(binary_block_last[l]) - 48);
                                    if (arg != 0)
                                    {
                                        dec_block_last = dec_block_last + Math.Pow(arg, l);
                                    }
                                }
                                for (int h = 1; h <= E; h++)
                                {
                                    crypt_dec_block_last = (crypt_dec_block_last * dec_block_last) % n;
                                }
                                OutputText.Text = OutputText.Text.Insert(0, Convert.ToString(crypt_dec_block_last));
                            }
                        }
                    }
                }
            }
            catch { MessageBox.Show("Ошибка!", "", MessageBoxButtons.OK, MessageBoxIcon.Error); }
        }
Exemple #9
0
 private void DButton_Click(object sender, EventArgs e)
 {
     try
     {
         int F = 0, d = 0, a = 0, b = 0;
         int p = Convert.ToInt32(PTextBox.Text);
         int q = Convert.ToInt32(QTextBox.Text);
         int E = Convert.ToInt32(ETextBox.Text);
         F = (p - 1) * (q - 1);
         //Проверка p и q на простоту
         for (int i = 1; i <= p; i++)
         {
             if (p % i == 0)
             {
                 a++;
             }
         }
         for (int i = 1; i <= q; i++)
         {
             if (q % i == 0)
             {
                 b++;
             }
         }
         if (p == q)
         {
             MessageBox.Show("Рассчитать экспоненту расшифрования невозможно. p=q!", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
             QTextBox.Clear(); PTextBox.Clear();
         }
         else
         {
             if ((a != 2) || (b != 2))
             {
                 MessageBox.Show("Рассчитать экспоненту расшифрования невозможно. Может быть, введенные числа не простые", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
                 QTextBox.Clear(); PTextBox.Clear();
             }
             else
             {
                 //проверка e
                 int nod = 0;
                 for (int i = 1; i <= F; i++)
                 {
                     if ((E % i == 0) && (F % i == 0))
                     {
                         nod++;
                     }
                 }
                 if (nod != 1)
                 {
                     MessageBox.Show("Рассчитать экспоненту расшифрования невозможно. Введена некорректная экспонента зашифрования", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); ETextBox.Clear(); E = 0;
                 }
                 else
                 {
                     // задаем экспоненту расшифрования
                     while (((E * d) % F) != 1)
                     {
                         d++;
                     }
                     DTextBox.Text = Convert.ToString(d);
                 }
             }
         }
     }
     catch { MessageBox.Show("Ошибка!", "", MessageBoxButtons.OK, MessageBoxIcon.Error); }
 }
 private void InitializeComponent()
 {
     System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Ch16Smp1Form));
     this.valueETextBox     = new LibETextBox.ETextBox();
     this.valueLabel        = new System.Windows.Forms.Label();
     this.factorialLabel    = new System.Windows.Forms.Label();
     this.calculateButton   = new System.Windows.Forms.Button();
     this.quitButton        = new System.Windows.Forms.Button();
     this.memorySizeLabel   = new System.Windows.Forms.Label();
     this.memorySizeDisplay = new System.Windows.Forms.Label();
     this.displayTextBox    = new System.Windows.Forms.TextBox();
     this.SuspendLayout();
     //
     // valueETextBox
     //
     this.valueETextBox.Location     = new System.Drawing.Point(146, 32);
     this.valueETextBox.Name         = "valueETextBox";
     this.valueETextBox.Size         = new System.Drawing.Size(40, 23);
     this.valueETextBox.TabIndex     = 0;
     this.valueETextBox.TextChanged += new System.EventHandler(this.valueETextBox_TextChanged);
     //
     // valueLabel
     //
     this.valueLabel.Location  = new System.Drawing.Point(146, 8);
     this.valueLabel.Name      = "valueLabel";
     this.valueLabel.Size      = new System.Drawing.Size(40, 20);
     this.valueLabel.TabIndex  = 1;
     this.valueLabel.Text      = "n";
     this.valueLabel.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
     //
     // factorialLabel
     //
     this.factorialLabel.Location  = new System.Drawing.Point(124, 64);
     this.factorialLabel.Name      = "factorialLabel";
     this.factorialLabel.Size      = new System.Drawing.Size(84, 20);
     this.factorialLabel.TabIndex  = 3;
     this.factorialLabel.Text      = "n!";
     this.factorialLabel.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
     //
     // calculateButton
     //
     this.calculateButton.Location = new System.Drawing.Point(85, 498);
     this.calculateButton.Name     = "calculateButton";
     this.calculateButton.Size     = new System.Drawing.Size(75, 22);
     this.calculateButton.TabIndex = 4;
     this.calculateButton.Text     = "Calculate";
     this.calculateButton.Click   += new System.EventHandler(this.calculateButton_Click);
     //
     // quitButton
     //
     this.quitButton.DialogResult = System.Windows.Forms.DialogResult.Cancel;
     this.quitButton.Location     = new System.Drawing.Point(173, 498);
     this.quitButton.Name         = "quitButton";
     this.quitButton.Size         = new System.Drawing.Size(75, 22);
     this.quitButton.TabIndex     = 5;
     this.quitButton.Text         = "Quit";
     this.quitButton.Click       += new System.EventHandler(this.quitButton_Click);
     //
     // memorySizeLabel
     //
     this.memorySizeLabel.AutoSize = true;
     this.memorySizeLabel.Location = new System.Drawing.Point(6, 523);
     this.memorySizeLabel.Name     = "memorySizeLabel";
     this.memorySizeLabel.Size     = new System.Drawing.Size(321, 15);
     this.memorySizeLabel.TabIndex = 6;
     this.memorySizeLabel.Text     = "Size of the array (Digits in number - Includes leading zeros)";
     //
     // memorySizeDisplay
     //
     this.memorySizeDisplay.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
     this.memorySizeDisplay.Location    = new System.Drawing.Point(12, 546);
     this.memorySizeDisplay.Name        = "memorySizeDisplay";
     this.memorySizeDisplay.Size        = new System.Drawing.Size(309, 22);
     this.memorySizeDisplay.TabIndex    = 7;
     this.memorySizeDisplay.TextAlign   = System.Drawing.ContentAlignment.MiddleCenter;
     //
     // displayTextBox
     //
     this.displayTextBox.Location   = new System.Drawing.Point(12, 87);
     this.displayTextBox.Multiline  = true;
     this.displayTextBox.Name       = "displayTextBox";
     this.displayTextBox.ReadOnly   = true;
     this.displayTextBox.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
     this.displayTextBox.Size       = new System.Drawing.Size(309, 405);
     this.displayTextBox.TabIndex   = 8;
     this.displayTextBox.TextAlign  = System.Windows.Forms.HorizontalAlignment.Center;
     //
     // Ch16Smp1Form
     //
     this.AcceptButton      = this.calculateButton;
     this.AutoScaleBaseSize = new System.Drawing.Size(6, 16);
     this.CancelButton      = this.quitButton;
     this.ClientSize        = new System.Drawing.Size(333, 579);
     this.Controls.Add(this.displayTextBox);
     this.Controls.Add(this.memorySizeDisplay);
     this.Controls.Add(this.memorySizeLabel);
     this.Controls.Add(this.quitButton);
     this.Controls.Add(this.calculateButton);
     this.Controls.Add(this.factorialLabel);
     this.Controls.Add(this.valueLabel);
     this.Controls.Add(this.valueETextBox);
     this.Font            = new System.Drawing.Font("Segoe UI Semibold", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
     this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
     this.Icon            = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
     this.MaximizeBox     = false;
     this.Name            = "Ch16Smp1Form";
     this.StartPosition   = System.Windows.Forms.FormStartPosition.CenterScreen;
     this.Text            = "Ch16Smp1 – Iterative Factorial";
     this.ResumeLayout(false);
     this.PerformLayout();
 }