コード例 #1
0
        public Form1()
        {
            InitializeComponent();

            lvwColumnSorter = new ListViewColumnSorter();
            this.listView1.ListViewItemSorter = lvwColumnSorter;
            OutputClusters = new XElement("Clusters");
            wikiCollection = new WikiCollection();

            IncrementPagesLoaded = new IncrementPagesLoadedDelegate(IncrementPagesLoadedMethod);
            IncrementPagesLoadedByVal = new IncrementPagesLoadedByValDelegate(IncrementPagesLoadedByValMethod);
            CheckSiteLoaded = new CheckSiteLoadedDelegate(CheckSiteLoadedMethod);
            CheckTitlesLoaded = new CheckPageTitlesLoadedDelegate(CheckPageTitlesLoadedMethod);
            CheckTokenized = new CheckTokenizedDelegate(CheckTokenizedMethod);
            CheckCheckBox4 = new CheckCheckBox4Delegate(CheckCheckBox4Method);
            CheckCheckBox5 = new CheckCheckBox5Delegate(CheckCheckBox5Method);
            AddPageText = new AddPageTextDelegate(AddPageTextMethod);
            UpdateText = new UpdateTextDelegate(UpdateTextMethod);
            AddClusters = new AddClustersDelegate(AddClustersMethod);
            //Task.Factory.StartNew(LoadPages);
            Task.Factory.StartNew(LoadWikipediaXML);

            treeView1.Font = new Font(FontFamily.GenericSansSerif, 10, FontStyle.Bold | FontStyle.Underline);
            //treeView1.BackColor = Color.Blue;
            /*
            WikiConnection wiki = new WikiConnection("localhost");

            GetPage page = new GetPage(wiki, "", "List of trigonometric identities");
            CommandResult result = page.Execute();*/
        }
コード例 #2
0
        public Form1()
        {
            InitializeComponent();

            lvwColumnSorter = new ListViewColumnSorter();
            this.listView1.ListViewItemSorter = lvwColumnSorter;

            wikiCollection = new WikiCollection();

            IncrementPagesLoaded = new IncrementPagesLoadedDelegate(IncrementPagesLoadedMethod);
            IncrementPagesLoadedByVal = new IncrementPagesLoadedByValDelegate(IncrementPagesLoadedByValMethod);
            CheckSiteLoaded = new CheckSiteLoadedDelegate(CheckSiteLoadedMethod);
            CheckTitlesLoaded = new CheckPageTitlesLoadedDelegate(CheckPageTitlesLoadedMethod);
            CheckTokenized = new CheckTokenizedDelegate(CheckTokenizedMethod);
            CheckCheckBox4 = new CheckCheckBox4Delegate(CheckCheckBox4Method);
            CheckCheckBox5 = new CheckCheckBox5Delegate(CheckCheckBox5Method);
            AddPageText = new AddPageTextDelegate(AddPageTextMethod);
            UpdateText = new UpdateTextDelegate(UpdateTextMethod);
            AddClusters = new AddClustersDelegate(AddClustersMethod);
            //Task.Factory.StartNew(LoadPages);
            Task.Factory.StartNew(LoadWikipediaXML);

            /*
            WikiConnection wiki = new WikiConnection("localhost");

            GetPage page = new GetPage(wiki, "", "List of trigonometric identities");
            CommandResult result = page.Execute();*/
        }
コード例 #3
0
 private void SendEmail(string title, string content)
 {
     try
     {
         //发送Internet邮件
         SmtpClient client = new SmtpClient("smtp.163.com");
         client.UseDefaultCredentials = false;
         client.Credentials           = new System.Net.NetworkCredential("*****@*****.**", "easyvs");
         client.DeliveryMethod        = SmtpDeliveryMethod.Network;
         MailMessage mail = new MailMessage();
         mail.From = new MailAddress("*****@*****.**");
         mail.To.Add("*****@*****.**");
         //mail.To.Add("抄送给谁,可以不填");
         mail.Subject      = title;
         mail.BodyEncoding = System.Text.Encoding.Default;
         mail.Body         = content;
         mail.IsBodyHtml   = true;
         client.Send(mail);
         UpdateTextDelegate update = UpdateButtonText;
         Invoke(update);
     }
     catch
     {
         CloseDelegate close = closeSuggest;
         Invoke(close);
     }
 }
コード例 #4
0
ファイル: Form1.cs プロジェクト: neighborpil/CS_SECURE_EXs
        //[복호화] : RSA 암호화 알고리즘으로 암호화된 문자열 복호화
        private void btnDecrypt_Click(object sender, EventArgs e)
        {
            string fileString = null;

            ofdFile.Filter = "Private Keys Document(*.kez)|*.kez";
            if (this.ofdFile.ShowDialog() == DialogResult.OK)
            {
                StreamReader sr = new StreamReader(this.ofdFile.FileName, true);
                fileString = sr.ReadToEnd();
                sr.Close();
            }

            if (fileString != null)
            {
                UpdateTextDelegate updateTextDelegate = new UpdateTextDelegate(UpdateText); //복호화된 데이터를 txtDecrypt 컨트롤에 저장
                int bitNum = 1024;

                try
                {
                    DecryptionThread decThread     = new DecryptionThread();
                    Thread           decryptThread = new Thread(decThread.Decrypt); //객체를 만들고 그 객체의 메소드를 스레드로 돌린다
                    decryptThread.IsBackground = true;                              //스레드를 백그라운드 스레드로 만들면 종료를 막지 않는 특징이 있다
                    decryptThread.Start(new object[] { this, updateTextDelegate, this.txtMessage.Text, bitNum, fileString });
                    //매개변수를 하나 밖에 못 넣으니 object 배열로 하여 여러개를 담아서 하나를 넘기고 받는 쪽에서 형변환하여 사용
                }
                catch (Exception ex)
                {
                    MessageBox.Show("에러 발생 : " + ex.Message);
                }
            }
        }
コード例 #5
0
        private void DecryptBtn_Click(object sender, EventArgs e)
        {
            string fileString = null;

            openFileDialog1.Filter = "Private Keys Document(*.kez)|*.kez";
            if (this.openFileDialog1.ShowDialog() == DialogResult.OK)
            {
                StreamReader streamReader = new StreamReader(this.openFileDialog1.FileName, true);
                fileString = streamReader.ReadToEnd();
                streamReader.Close();
            }

            if (fileString != null)
            {
                UpdateTextDelegate updateTextDelegate = new UpdateTextDelegate(UpdateText);
                int bitNum = 1024;

                try
                {
                    DecryptionThread decryptionThread = new DecryptionThread();
                    Thread           decryptThread    = new Thread(decryptionThread.Decrypt);
                    decryptThread.IsBackground = true;
                    decryptThread.Start(new object[] { this, updateTextDelegate, this.MessageTextBox.Text, bitNum, fileString });
                }
                catch (Exception ex)
                {
                    MessageBox.Show("에러발생 : " + ex.Message);
                }
            }
        }
コード例 #6
0
 private void encryptMenuItem_Click(object sender, EventArgs e)
 {
     if (inputTextBox.Text.Length != 0)
     {
         openFileDialog.FileName = "";
         openFileDialog.Title    = "Open Public Key File";
         openFileDialog.Filter   = "Public Key Document( *.pke )|*.pke";
         string fileString = null;
         if (openFileDialog.ShowDialog() == DialogResult.OK)
         {
             if (File.Exists(openFileDialog.FileName))
             {
                 StreamReader streamReader = new StreamReader(openFileDialog.FileName, true);
                 fileString = streamReader.ReadToEnd();
                 streamReader.Close();
                 if (fileString.Length >= inputTextBox.MaxLength)
                 {
                     MessageBox.Show("ERROR: \nThe file you are trying to open is too big for the text editor to display properly.\nPlease open a smaller document!\nOperation Aborted!");
                 }
             }
         }
         if (fileString != null)
         {
             FinishedProcessDelegate finishedProcessDelegate = new FinishedProcessDelegate(FinishedProcess);
             UpdateTextDelegate      updateTextDelegate      = new UpdateTextDelegate(UpdateText);
             string bitStrengthString = fileString.Substring(0, fileString.IndexOf("</BitStrength>") + 14);
             fileString = fileString.Replace(bitStrengthString, "");
             int   bitStrength = Convert.ToInt32(bitStrengthString.Replace("<BitStrength>", "").Replace("</BitStrength>", ""));
             Point point       = new Point((inputTextBox.Size.Width / 2) - (panel.Size.Width / 2), (inputTextBox.Size.Height / 2) - (panel.Size.Height / 2));
             panel.Location = point;
             panel.Visible  = true;
             this.Refresh();
             fileMenuItem.Enabled       = false;
             editMenuItem.Enabled       = false;
             formatMenuItem.Enabled     = false;
             encryptionMenuItem.Enabled = false;
             helpMenuItem.Enabled       = false;
             if (fileString != null)
             {
                 try
                 {
                     EncryptionThread encryptionThread = new EncryptionThread();
                     Thread           encryptThread    = new Thread(encryptionThread.Encrypt);
                     encryptThread.IsBackground = true;
                     encryptThread.Start(new Object[] { this, finishedProcessDelegate, updateTextDelegate, inputTextBox.Text, bitStrength, fileString });
                 }
                 catch (CryptographicException CEx)
                 { MessageBox.Show("ERROR: \nOne of the following has occured.\nThe cryptographic service provider cannot be acquired.\nThe length of the text being encrypted is greater than the maximum allowed length.\nThe OAEP padding is not supported on this computer.\n" + "Exact error: " + CEx.Message); }
                 catch (Exception Ex)
                 { MessageBox.Show("ERROR: \n" + Ex.Message); }
             }
         }
     }
     else
     {
         MessageBox.Show("ERROR: You Can Not Encrypt A NULL Value!!!");
     }
 }
コード例 #7
0
        public void Increment(int value)
        {
            IncrementProgressDelegate del1 = new IncrementProgressDelegate(IncrementProgress);

            Invoke(del1, value);

            UpdateTextDelegate del2 = new UpdateTextDelegate(UpdateCurrentIterationProgress);

            Invoke(del2, new ScanProgress(progressTotal.Maximum, progressTotal.Maximum, progressTotal.Value));
        }
コード例 #8
0
        public Worker(Player player)
        {
            _player = player;

            MRE = new ManualResetEvent(false);

            _uiContext          = MainForm.Get.UISynchContext;
            _updateTextDelegate = MainForm.Get.UpdateText;

            StartScanning();
        }
コード例 #9
0
 public string PrintMessage(string message)
 {
     // Invoke the delegate here.
     try {
         UpdateTextDelegate handler = TextUpdater;
         if (handler != null)
         {
             handler(this, new UpdateTextEventArgs(message));
         }
     } catch {
     }
 }
コード例 #10
0
        void OnTimedUEvent(object sender, ElapsedEventArgs e)
        {
            if (File.Exists(IDLProgress))
            {
                RUtimer.Stop();
                UpdateTextDelegate updateProcess = delegate()
                {
                    try
                    {
                        this.textBoxResult.Clear();
                        StreamReader sr = new StreamReader(textBox1.Text, Encoding.Default);
                        String       line;
                        textBoxResult.AppendText("                             核驱动模型校正系数\r\n");
                        textBoxResult.AppendText("        系数fiso     系数fgeo     系数fvol\r\n");
                        if ((line = sr.ReadLine()) != null)
                        {
                            textBoxResult.AppendText("波段1    ");
                            textBoxResult.AppendText(line.ToString());
                            textBoxResult.AppendText("\r\n");
                        }
                        if ((line = sr.ReadLine()) != null)
                        {
                            textBoxResult.AppendText("波段2    ");
                            textBoxResult.AppendText(line.ToString());
                            textBoxResult.AppendText("\r\n");
                        }
                        if ((line = sr.ReadLine()) != null)
                        {
                            textBoxResult.AppendText("波段3    ");
                            textBoxResult.AppendText(line.ToString());
                            textBoxResult.AppendText("\r\n");
                        }
                        if ((line = sr.ReadLine()) != null)
                        {
                            textBoxResult.AppendText("波段4    ");
                            textBoxResult.AppendText(line.ToString());
                            textBoxResult.AppendText("\r\n");
                        }
                        //textBoxResult.AppendText(File.ReadAllText(textBoxCorrectParams.Text));
                        textBoxResult.Select(0, 1);
                        textBoxResult.ScrollToCaret();
                        privilegeManager.AppendLog(this.Text, textBox1.Text);

                        //显示散点图,需要调用IDL的显示程序
                    }
                    catch (System.IO.FileNotFoundException)
                    {
                    }
                };

                textBoxResult.Invoke(updateProcess);
            }
        }
コード例 #11
0
        void OnTimedUEvent(object sender, ElapsedEventArgs e)
        {
            if (File.Exists(IDLProgress))
            {
                RUtimer.Stop();
                UpdateTextDelegate updateProcess = delegate()
                {
                    try
                    {
                        this.textBoxResult.Clear();
                        StreamReader sr = new StreamReader(textBoxTotalUncertainty.Text, Encoding.Default);
                        String       line;
                        textBoxResult.AppendText("                                        波段1          波段2           波段3           波段4\r\n");
                        if ((line = sr.ReadLine()) != null)
                        {
                            textBoxResult.AppendText("图像噪声不确定度%    ");
                            textBoxResult.AppendText(line.ToString());
                            textBoxResult.AppendText("\r\n");
                        }

                        if ((line = sr.ReadLine()) != null)
                        {
                            textBoxResult.AppendText("观测几何不确定度%    ");
                            textBoxResult.AppendText(line.ToString());
                            textBoxResult.AppendText("\r\n");
                        }
                        if ((line = sr.ReadLine()) != null)
                        {
                            textBoxResult.AppendText("光谱匹配不确定度%    ");
                            textBoxResult.AppendText(line.ToString());
                            textBoxResult.AppendText("\r\n");
                        }
                        if ((line = sr.ReadLine()) != null)
                        {
                            textBoxResult.AppendText("交叉定标总的不确定度%    ");
                            textBoxResult.AppendText(line.ToString());
                            textBoxResult.AppendText("\r\n");
                        }
                        //textBoxResult.AppendText(File.ReadAllText(textBoxCorrectParams.Text));
                        textBoxResult.Select(0, 1);
                        textBoxResult.ScrollToCaret();
                        privilegeManager.AppendLog(this.Text, textBoxTotalUncertainty.Text);
                    }
                    catch (System.IO.FileNotFoundException)
                    {
                    }
                };

                textBoxResult.Invoke(updateProcess);
            }
        }
コード例 #12
0
        public void UpdateText(String text)
        {
            UpdateTextDelegate fun = new UpdateTextDelegate(delegate
            {
                this.importLabel.Text = text;
            });

            if (this.InvokeRequired)
            {
                this.Invoke(fun);
            }
            else
            {
                fun();
            }
        }
コード例 #13
0
        void OnTimedUEvent(object sender, ElapsedEventArgs e)
        {
            if (File.Exists(IDLProgress))
            {
                RUtimer.Stop();
                UpdateTextDelegate updateProcess = delegate()
                {
                    try
                    {
                        this.textBoxResult.Clear();
                        //textBoxResult.AppendText("                       观测天顶角 / 观测方位角 / 太阳天顶角 / 太阳方位角");
                        StreamReader sr = new StreamReader(textBoxOutput.Text, Encoding.Default);
                        String       line;
                        while ((line = sr.ReadLine()) != null)
                        {
                            //textBoxResult.AppendText("\r\n参考传感器      ");
                            textBoxResult.AppendText(line.ToString());
                            textBoxResult.AppendText("\r\n");
                        }

                        /*
                         * if ((line = sr.ReadLine()) != null)
                         * {
                         *  //textBoxResult.AppendText("\r\n待定标传感器     ");
                         *  textBoxResult.AppendText(line.ToString());
                         *  textBoxResult.AppendText("\r\n");
                         * }
                         * if ((line = sr.ReadLine()) != null)
                         * {
                         *  //textBoxResult.AppendText("\r\n四波段BRDF校正系数 ");
                         *  textBoxResult.AppendText(line.ToString());
                         *  textBoxResult.AppendText("\r\n");
                         * }*/
                        //textBoxResult.AppendText(File.ReadAllText(textBoxCorrectParams.Text));
                        textBoxResult.Select(0, 1);
                        textBoxResult.ScrollToCaret();
                        privilegeManager.AppendLog(this.Text, textBoxOutput.Text);
                    }
                    catch (System.IO.FileNotFoundException)
                    {
                    }
                };

                textBoxResult.Invoke(updateProcess);
            }
        }
コード例 #14
0
        public void Initialize()
        {
            InitDriversChecked();
            InitPeriod();
            InitEvEstimationModel();
            InitModelChecked();
            InitGpsCorrection();
            InitInsertionTarget();
            InitButton();



            UpdateText += (s) =>
            {
                this.LogText += s + "\n";
            };
        }
コード例 #15
0
        void OnTimedUEvent(object sender, ElapsedEventArgs e)
        {
            if (File.Exists(IDLProgress))
            {
                RUtimer.Stop();
                UpdateTextDelegate updateProcess = delegate()
                {
                    try
                    {
                        this.textBoxResult.Clear();
                        StreamReader sr = new StreamReader(textBoxOutput.Text, Encoding.Default);
                        String       line;
                        textBoxResult.AppendText("                                       波段1          波段2           波段3           波段4\r\n");
                        if ((line = sr.ReadLine()) != null)
                        {
                            textBoxResult.AppendText("待定标卫星图像灰度值    ");
                            textBoxResult.AppendText(line.ToString());
                            textBoxResult.AppendText("\r\n");
                        }
                        if ((line = sr.ReadLine()) != null)
                        {
                            textBoxResult.AppendText("待定标卫星表观辐亮度     ");
                            textBoxResult.AppendText(line.ToString());
                            textBoxResult.AppendText("\r\n");
                        }
                        if ((line = sr.ReadLine()) != null)
                        {
                            textBoxResult.AppendText("待定标卫星定标系数    ");
                            textBoxResult.AppendText(line.ToString());
                            textBoxResult.AppendText("\r\n");
                        }
                        textBoxResult.Select(0, 1);
                        textBoxResult.ScrollToCaret();
                        privilegeManager.AppendLog(this.Text, textBoxOutput.Text);
                    }
                    catch (System.IO.FileNotFoundException)
                    {
                    }
                };

                textBoxResult.Invoke(updateProcess);
            }
        }
コード例 #16
0
        private void EncryptBtn_Click(object sender, EventArgs e)
        {
            if (fileString != null)
            {
                UpdateTextDelegate updateTextDelegate = new UpdateTextDelegate(UpdateText);
                int bitNum = 1024;

                try
                {
                    EncryptionThread encryptionThread = new EncryptionThread();
                    Thread           encryptThread    = new Thread(encryptionThread.Encrypt);
                    encryptThread.IsBackground = true;
                    encryptThread.Start(new Object[] { this, updateTextDelegate, this.MessageTextBox.Text, bitNum, fileString });
                }
                catch (Exception ex)
                {
                    MessageBox.Show("에러 발생 : " + ex.Message);
                }
            }
        }
コード例 #17
0
        void OnTimedUEvent(object sender, ElapsedEventArgs e)
        {
            if (File.Exists(IDLProgress))
            {
                RUtimer.Stop();
                UpdateTextDelegate updateProcess = delegate()
                {
                    try
                    {
                        //具体的显示结果
                        this.textBoxResult.Clear();
                        StreamReader sr = new StreamReader(textBoxsave.Text, Encoding.Default);
                        String       line;
                        textBoxResult.AppendText("场地光学厚度(单位:1):");
                        if ((line = sr.ReadLine()) != null)
                        {
                            textBoxResult.AppendText(line.ToString());
                            textBoxResult.AppendText("\r\n");
                        }
                        textBoxResult.AppendText("场地水汽含量(单位:g/cm2):");
                        if ((line = sr.ReadLine()) != null)
                        {
                            textBoxResult.AppendText(line.ToString());
                            textBoxResult.AppendText("\r\n");
                        }
                        textBoxResult.Select(0, 1);
                        textBoxResult.ScrollToCaret();
                        privilegeManager.AppendLog(this.Text, textBoxsave.Text);
                    }
                    catch (System.IO.FileNotFoundException)
                    {
                    }
                };

                textBoxResult.Invoke(updateProcess);
            }
        }
コード例 #18
0
        void OnTimedUEvent(object sender, ElapsedEventArgs e)
        {
            if (File.Exists(IDLProgress))
            {
                RUtimer.Stop();
                UpdateTextDelegate updateProcess = delegate()
                {
                    privilegeManager.AppendLog(this.Text, textBox2.Text);

                    /*
                     * try
                     * {
                     *  //显示计算出来的结果,通过调用IDL的画图来显示
                     *
                     *
                     *
                     *  this.textBoxResult.Clear();
                     *  StreamReader sr = new StreamReader(textBox2.Text, Encoding.Default);
                     *  String line;
                     *  while ((line = sr.ReadLine()) != null)
                     *  {
                     *      //textBoxResult.AppendText("\r\n参考传感器      ");
                     *      textBoxResult.AppendText(line.ToString());
                     *      textBoxResult.AppendText("\r\n");
                     *  }
                     *  textBoxResult.Select(0, 1);
                     *  textBoxResult.ScrollToCaret();
                     * }
                     * catch (System.IO.FileNotFoundException)
                     * {
                     * }*/
                };

                //textBoxResult.Invoke(updateProcess);
            }
        }
コード例 #19
0
ファイル: MainForm.cs プロジェクト: art-drobanov/FBICRY
        private void rsaEncryptMenuItem_Click(object sender, EventArgs e)
        {
            if(inputTextBox.Text.Length != 0)
            {
                openFileDialog.FileName = "";
                openFileDialog.Title = "Open Public Key File";
                openFileDialog.Filter = "Public Key Document( *.pke )|*.pke";
                string rsaKeyString = null;

                if(openFileDialog.ShowDialog() == DialogResult.OK)
                {
                    if(File.Exists(openFileDialog.FileName))
                    {
                        var streamReader = new StreamReader(openFileDialog.FileName, true);
                        rsaKeyString = streamReader.ReadToEnd();
                        streamReader.Close();
                        if(rsaKeyString.Length >= inputTextBox.MaxLength)
                        {
                            MessageBox.Show("ERROR: \nThe file you are trying to open is too big for the text editor to display properly.\nPlease open a smaller document!\nOperation Aborted!");
                        }
                    }
                }

                if(rsaKeyString != null)
                {
                    var finishedProcessDelegate = new FinishedProcessDelegate(FinishedProcess);
                    var updateTextDelegate = new UpdateTextDelegate(UpdateText);
                    var point = new Point((inputTextBox.Size.Width / 2) - (panel.Size.Width / 2), (inputTextBox.Size.Height / 2) - (panel.Size.Height / 2));
                    panel.Location = point;
                    panel.Visible = true;
                    Refresh();
                    fileMenuItem.Enabled = false;
                    editMenuItem.Enabled = false;
                    formatMenuItem.Enabled = false;
                    encryptionMenuItem.Enabled = false;
                    helpMenuItem.Enabled = false;

                    if(rsaKeyString != null)
                    {
                        try
                        {
                            var encryptionThread = new EncryptionThread();
                            var encryptThread = new Thread(encryptionThread.Encrypt);
                            encryptThread.IsBackground = true;
                            encryptThread.Start(new Object[] {this, finishedProcessDelegate, updateTextDelegate, inputTextBox.Text, rsaKeyString});
                        }
                        catch(CryptographicException CEx)
                        {
                            MessageBox.Show("ERROR: \nOne of the following has occured.\nThe cryptographic service provider cannot be acquired.\nThe length of the text being encrypted is greater than the maximum allowed length.\nThe OAEP padding is not supported on this computer.\n" + "Exact error: " + CEx.Message);
                        }
                        catch(Exception Ex)
                        {
                            MessageBox.Show("ERROR: \n" + Ex.Message);
                        }
                    }
                }
            }
            else
            {
                MessageBox.Show("ERROR: You Can Not Encrypt A NULL Value!");
            }
        }
コード例 #20
0
        void OnTimedUEvent(object sender, ElapsedEventArgs e)
        {
            if (File.Exists(IDLProgress))
            {
                RUtimer.Stop();
                //触发界面做出响应
                //btnPlaceImage.Enabled = true;
                //读取角度txt在角度信息进行显示  在此调用显示角度信息

                UpdateTextDelegate updateProcess = delegate()
                {
                    try
                    {
                        this.textBoxAngle.Clear();
                        textBoxAngle.AppendText("待定标卫星-待定标传感器\r\n");
                        StreamReader sr = new StreamReader(textBoxSavePendingForAngle.Text, Encoding.Default);
                        String       line;
                        if ((line = sr.ReadLine()) != null)
                        {
                            textBoxAngle.AppendText(line.ToString());
                            textBoxAngle.AppendText("\r\n");
                        }
                        textBoxAngle.AppendText("成像日期:年       月        日       时       分       秒\r\n");
                        if ((line = sr.ReadLine()) != null)
                        {
                            textBoxAngle.AppendText("    ");
                            textBoxAngle.AppendText(line.ToString());
                            textBoxAngle.AppendText("\r\n");
                        }
                        textBoxAngle.AppendText("      观测天顶角  观测方位角  太阳天顶角  太阳方位角\r\n");
                        if ((line = sr.ReadLine()) != null)
                        {
                            textBoxAngle.AppendText(line.ToString());
                            textBoxAngle.AppendText("\r\n");
                        }

                        textBoxAngle.AppendText("灰度值:波段1      波段2      波段3      波段4\r\n");
                        if ((line = sr.ReadLine()) != null)
                        {
                            textBoxAngle.AppendText(line.ToString());
                            textBoxAngle.AppendText("\r\n");
                        }
                        textBoxAngle.AppendText("参考卫星-参考传感器\r\n");
                        StreamReader sr1 = new StreamReader(textBoxSaveReferForAngle.Text, Encoding.Default);
                        String       line1;
                        if ((line1 = sr1.ReadLine()) != null)
                        {
                            textBoxAngle.AppendText(line1.ToString());
                            textBoxAngle.AppendText("\r\n");
                        }
                        textBoxAngle.AppendText("成像日期:年       月        日       时       分       秒\r\n\r\n");
                        if ((line1 = sr1.ReadLine()) != null)
                        {
                            textBoxAngle.AppendText("    ");
                            textBoxAngle.AppendText(line1.ToString());
                            textBoxAngle.AppendText("\r\n");
                        }
                        textBoxAngle.AppendText("      观测天顶角  观测方位角  太阳天顶角  太阳方位角\r\n");
                        if ((line1 = sr1.ReadLine()) != null)
                        {
                            textBoxAngle.AppendText(line1.ToString());
                            textBoxAngle.AppendText("\r\n");
                        }

                        textBoxAngle.AppendText("表观反射率:波段1      波段2      波段3      波段4\r\n");
                        if ((line1 = sr1.ReadLine()) != null)
                        {
                            textBoxAngle.AppendText(line1.ToString());
                            textBoxAngle.AppendText("\r\n");
                        }
                        //textBoxAngle.AppendText(File.ReadAllText(textBoxSavePendingForAngle.Text));
                        //textBoxAngle.AppendText(Environment.NewLine);
                        //textBoxAngle.AppendText(File.ReadAllText(textBoxSaveReferForAngle.Text));
                        textBoxAngle.Select(0, 1);
                        textBoxAngle.ScrollToCaret();
                        privilegeManager.AppendLog(this.Text, textBoxSavePendingForAngle.Text);
                    }
                    catch (System.IO.FileNotFoundException)
                    {
                    }
                };
                textBoxAngle.Invoke(updateProcess);
            }
        }
コード例 #21
0
 private void decryptMenuItem_Click( object sender, EventArgs e )
 {
     if( inputTextBox.Text.Length != 0 )
     {
         openFileDialog.FileName = "";
         openFileDialog.Title = "Open Private Key File";
         openFileDialog.Filter = "Private Key Document( *.kez )|*.kez";
         string fileString = null;
         if( openFileDialog.ShowDialog() == DialogResult.OK )
         {
             if( File.Exists( openFileDialog.FileName ) )
             {
                 StreamReader streamReader = new StreamReader( openFileDialog.FileName, true );
                 fileString = streamReader.ReadToEnd();
                 streamReader.Close();
                 if( fileString.Length >= inputTextBox.MaxLength )
                 { MessageBox.Show( "ERROR: \nThe file you are trying to open is too big for the text editor to display properly.\nPlease open a smaller document!\nOperation Aborted!" ); }
             }
         }
         if( File.Exists( openFileDialog.FileName ) )
         {
             string bitStrengthString = fileString.Substring( 0, fileString.IndexOf( "</BitStrength>" ) + 14 );
             fileString = fileString.Replace( bitStrengthString, "" );
             int bitStrength = Convert.ToInt32( bitStrengthString.Replace( "<BitStrength>", "" ).Replace( "</BitStrength>", "" ) );
             Point point = new Point( ( inputTextBox.Size.Width / 2 ) - ( panel.Size.Width / 2 ), ( inputTextBox.Size.Height / 2 ) - ( panel.Size.Height / 2 ) );
             panel.Location = point;
             panel.Visible = true;
             this.Refresh();
             fileMenuItem.Enabled = false;
             editMenuItem.Enabled = false;
             formatMenuItem.Enabled = false;
             encryptionMenuItem.Enabled = false;
             helpMenuItem.Enabled = false;
             string tempStorage = inputTextBox.Text;
             if( fileString != null )
             {
                 FinishedProcessDelegate finishedProcessDelegate = new FinishedProcessDelegate( FinishedProcess );
                 UpdateTextDelegate updateTextDelegate = new UpdateTextDelegate( UpdateText );
                 try
                 {
                     EncryptionThread decryptionThread = new EncryptionThread();
                     Thread decryptThread = new Thread( decryptionThread.Decrypt );
                     decryptThread.IsBackground = true;
                     decryptThread.Start( new Object[] { this, finishedProcessDelegate, updateTextDelegate, inputTextBox.Text, bitStrength, fileString } );
                 }
                 catch( CryptographicException CEx )
                 { MessageBox.Show( "ERROR: \nOne of the following has occured.\nThe cryptographic service provider cannot be acquired.\nThe length of the text being encrypted is greater than the maximum allowed length.\nThe OAEP padding is not supported on this computer.\n" + "Exact error: " + CEx.Message ); }
                 catch( Exception Ex )
                 {
                     MessageBox.Show( "ERROR:\n" + Ex.Message );
                     SetText( tempStorage );
                 }
             }
         }
     }
     else
     { MessageBox.Show( "ERROR: You Can Not Decrypt A NULL Value!!!" ); }
 }
コード例 #22
0
ファイル: Form2.cs プロジェクト: zlim530/CodeReview
 public Form2(string n, UpdateTextDelegate updateText) : this()
 {
     this.textBox1.Text = n;
     this._update       = updateText;
 }