コード例 #1
0
        private void btnOK_Click(object sender, EventArgs e)
        {
            //txtInfo.Text = String.Format("=== Started at {0} ===\r\n\r\n", DateTime.Now);
            //Application.DoEvents();

            this.AdditionalOptions = txtAdditional.Text;

            try
            {
                Utils.EnableUI(this.Controls, false);

                var options = GetOptions();
                new de4dot(options).Go();
            }
            catch (Exception ex)
            {
                SimpleTextbox.AppendText(txtInfo, String.Format("{0}\r\n\r\n", ex.Message));
            }
            finally
            {
                _host.ResetProgress();
                _host.SetStatusText(null);

                Utils.EnableUI(this.Controls, true);
            }

            //SimpleTextbox.AppendText(txtInfo, String.Format("\r\n=== Completed at {0} ===\r\n\r\n", DateTime.Now));
        }
コード例 #2
0
 public virtual void AppendTextInfo(string text)
 {
     if (TextInfoBox == null)
     {
         return;
     }
     SimpleTextbox.AppendText(TextInfoBox, text);
 }
コード例 #3
0
 public void ScrollTextInfoToBottom()
 {
     if (TextInfoBox == null)
     {
         return;
     }
     SimpleTextbox.ScrollToBottom(TextInfoBox);
 }
コード例 #4
0
        void menuOpt_Rename(object sender, RoutedEventArgs e)
        {
            var simpleTxt = new SimpleTextbox("Rename logset...", (string)this.Header);

            simpleTxt.Owner    = this.OwnerWindow;
            simpleTxt.Updated += (s, ev) =>
            {
                this.Header = ev.Text;
                this.Content.LogSetDataSource.Name = ev.Text;
            };
            simpleTxt.ShowDialog();
        }
コード例 #5
0
 public virtual void AppendTextInfoLine(string text, bool noDuplicate)
 {
     if (TextInfoBox == null)
     {
         return;
     }
     if (noDuplicate)
     {
         if (TextInfoBox.Text.Contains(text))
         {
             return;
         }
     }
     SimpleTextbox.AppendText(TextInfoBox, text);
     SimpleTextbox.AppendText(TextInfoBox, "\r\n");
 }
コード例 #6
0
        private void DoSearch()
        {
            try
            {
                _isCancelPending = false;
                btnOK.Text       = btnStopText;

                Utils.EnableUI(this.Controls, false);

                for (int i = 0; i < _rows.Length; i++)
                {
                    if (_isCancelPending)
                    {
                        break;
                    }

                    string fileName = _rows[i];

                    _host.SetStatusText(String.Format("Seaching {0} ...", fileName));
                    SimpleTextbox.AppendText(txtInfo, String.Format("File {0}: {1}\r\n", i + 1, fileName));

                    DoSearch(fileName);
                    Application.DoEvents();
                }

                if (_isCancelPending)
                {
                    SimpleTextbox.AppendText(txtInfo, "User breaked.\r\n");
                }
            }
            catch (Exception ex)
            {
                SimpleTextbox.AppendText(txtInfo, String.Format("{0}\r\n\r\n", ex.Message));
            }
            finally
            {
                _host.ResetProgress();
                _host.SetStatusText(null);
                btnOK.Text = btnOkText;

                Utils.EnableUI(this.Controls, true);
            }
        }
コード例 #7
0
        private void DoSearch(string fileName)
        {
            List <MethodDeclarationInfo> list = _reflector.FindMethods(new string[] { fileName },
                                                                       new string[] { cboSearchFor.Text.Trim() },
                                                                       null,
                                                                       _host,
                                                                       new SimpleReflector.IsCancelPendingDelegate(IsCancelPending));

            SimpleTextbox.AppendText(txtInfo, String.Format("Total {0} errors found.\r\n\r\n", list.Count));

            if (rbToScreen.Checked)
            {
                foreach (MethodDeclarationInfo info in list)
                {
                    SimpleTextbox.AppendText(txtInfo, info.Name);
                    SimpleTextbox.AppendText(txtInfo, "\r\n");
                    SimpleTextbox.AppendText(txtInfo, info.Body);
                    SimpleTextbox.AppendText(txtInfo, "\r\n\r\n\r\n");
                    Application.DoEvents();
                }
            }

            if (rbToFile.Checked)
            {
                string outputFile = GetLogFileName(fileName);
                using (StreamWriter sw = File.CreateText(outputFile))
                {
                    sw.WriteLine(String.Format("File {0}", fileName));
                    sw.WriteLine(String.Format("Total {0} errors found.\r\n\r\n", list.Count));

                    foreach (MethodDeclarationInfo info in list)
                    {
                        sw.WriteLine(info.Name);
                        sw.WriteLine(info.Body);
                        sw.WriteLine();
                        sw.WriteLine();
                        Application.DoEvents();
                    }
                }
            }
        }
コード例 #8
0
        private void btnOK_Click(object sender, EventArgs e)
        {
            switch (btnOK.Text)
            {
            case btnStopText:
                _isCancelPending = true;
                return;

            default:
                break;
            }

            if (String.IsNullOrEmpty(cboSearchFor.Text.Trim()))
            {
                SimpleMessage.ShowInfo("Please enter Search For.");
                return;
            }

            this.LastSearchFor = cboSearchFor.Text;
            if (rbToScreen.Checked)
            {
                this.LogTo = "Screen";
            }
            else if (rbToFile.Checked)
            {
                this.LogTo = "File";
            }

            _reflector.Language = cboLanguage.SelectedItem as string;

            txtInfo.Text = String.Format("=== Started at {0} ===\r\n\r\n", DateTime.Now);
            Application.DoEvents();

            DoSearch();

            SimpleTextbox.AppendText(txtInfo, String.Format("\r\n=== Completed at {0} ===\r\n\r\n", DateTime.Now));
            //this.Close();
        }
コード例 #9
0
        private void btnOK_Click(object sender, EventArgs e)
        {
            string keyFile = txtKeyFile.Text;

            if (!String.IsNullOrEmpty(keyFile) && !File.Exists(keyFile))
            {
                SimpleMessage.ShowInfo("Invalid key file");
                return;
            }
            string outputDir = txtOutputDir.Text;

            if (!Directory.Exists(outputDir))
            {
                SimpleMessage.ShowInfo("Please choose output directory");
                return;
            }

            if (_sourceDir != null && _sourceDir.Equals(outputDir))
            {
                OutputDir = String.Empty;
            }
            else
            {
                OutputDir = outputDir;
            }

            StrongKeyFile = keyFile;

            txtInfo.Text = String.Format("=== Started at {0} ===\r\n\r\n", DateTime.Now);
            Application.DoEvents();

            ILMerge();

            SimpleTextbox.AppendText(txtInfo, String.Format("=== Completed at {0} ===\r\n\r\n", DateTime.Now));
            //this.Close();
        }
コード例 #10
0
        private void btnOK_Click(object sender, EventArgs e)
        {
            MethodDefinition md = _frmClassView.SelectedMethod;

            if (md == null)
            {
                SimpleMessage.ShowInfo("Please choose a method");
                return;
            }

            bool resolveDirAdded = false;

            try
            {
                Utils.EnableUI(this.Controls, false);
                resolveDirAdded = _host.AddAssemblyResolveDir(_sourceDir);

                //string path = _rows[0];
                MethodBase mb = AssemblyUtils.ResolveMethod(md);

                object[] p = new object[_parameters.Rows.Count];

                for (int i = 0; i < _parameters.Rows.Count; i++)
                {
                    string s;
                    s = _parameters.Rows[i]["value"] == null ? String.Empty : _parameters.Rows[i]["value"].ToString();
                    if (!String.IsNullOrEmpty(s) && s.IndexOf("\\u") >= 0)
                    {
                        try
                        {
                            s = SimpleParse.ParseUnicodeString(s);
                        }
                        catch
                        {
                        }
                    }

                    string paramType = _parameters.Rows[i]["type"].ToString();
                    switch (paramType)
                    {
                    case "System.String":
                        p[i] = s;
                        break;

                    case "System.Int32":
                        if (s.StartsWith("0x"))
                        {
                            p[i] = Int32.Parse(s.Substring(2), NumberStyles.HexNumber);
                        }
                        else
                        {
                            p[i] = Int32.Parse(s, NumberStyles.Any);
                        }
                        break;

                    case "System.Int16":
                        if (s.StartsWith("0x"))
                        {
                            p[i] = Int16.Parse(s.Substring(2), NumberStyles.HexNumber);
                        }
                        else
                        {
                            p[i] = Int16.Parse(s, NumberStyles.Any);
                        }
                        break;

                    case "System.Int64":
                        if (s.StartsWith("0x"))
                        {
                            p[i] = Int64.Parse(s.Substring(2), NumberStyles.HexNumber);
                        }
                        else
                        {
                            p[i] = Int64.Parse(s, NumberStyles.Any);
                        }
                        break;

                    case "System.UInt32":
                        if (s.StartsWith("0x"))
                        {
                            p[i] = UInt32.Parse(s.Substring(2), NumberStyles.HexNumber);
                        }
                        else
                        {
                            p[i] = UInt32.Parse(s, NumberStyles.Any);
                        }
                        break;

                    case "System.UInt16":
                        if (s.StartsWith("0x"))
                        {
                            p[i] = UInt16.Parse(s.Substring(2), NumberStyles.HexNumber);
                        }
                        else
                        {
                            p[i] = UInt16.Parse(s, NumberStyles.Any);
                        }
                        break;

                    case "System.UInt64":
                        if (s.StartsWith("0x"))
                        {
                            p[i] = UInt64.Parse(s.Substring(2), NumberStyles.HexNumber);
                        }
                        else
                        {
                            p[i] = UInt64.Parse(s, NumberStyles.Any);
                        }
                        break;

                    case "System.Decimal":
                        if (s.StartsWith("0x"))
                        {
                            p[i] = Decimal.Parse(s.Substring(2), NumberStyles.HexNumber);
                        }
                        else
                        {
                            p[i] = Decimal.Parse(s, NumberStyles.Any);
                        }
                        break;

                    case "System.Double":
                        if (s.StartsWith("0x"))
                        {
                            p[i] = Double.Parse(s.Substring(2), NumberStyles.HexNumber);
                        }
                        else
                        {
                            p[i] = Double.Parse(s, NumberStyles.Any);
                        }
                        break;

                    case "System.Byte":
                        p[i] = Convert.ToByte(s);
                        break;

                    case "System.SByte":
                        p[i] = Convert.ToSByte(s);
                        break;

                    case "System.Boolean":
                        p[i] = Convert.ToBoolean(s);
                        break;

                    case "System.Char":
                        p[i] = Convert.ToChar(s);
                        break;

                    case "System.DateTime":
                        p[i] = DateTime.Parse(s);
                        break;

                    case "System.Byte[]":
                        string[] byteStrs = s.Replace(" ", "").Replace("\r", "").Replace("\n", "").Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
                        byte[]   bytes    = new byte[byteStrs.Length];
                        for (int j = 0; j < bytes.Length; j++)
                        {
                            string tmpStr = byteStrs[j];
                            if (tmpStr.StartsWith("0x"))
                            {
                                bytes[j] = Byte.Parse(tmpStr.Substring(2), NumberStyles.HexNumber);
                            }
                            else
                            {
                                bytes[j] = Byte.Parse(tmpStr, NumberStyles.Any);
                            }
                        }
                        p[i] = bytes;
                        break;

                    default:
                        p[i] = s;
                        break;
                    }
                }


                SimpleTextbox.AppendText(txtInfo, String.Format("=== Started at {0} ===\r\n", DateTime.Now));

                object o = mb.Invoke(null, p);
                if (o != null)
                {
                    SimpleTextbox.AppendText(txtInfo, String.Format("Return Value: {0}\r\n", o));
                    ParameterInfo[] pi = mb.GetParameters();
                    for (int i = 0; i < pi.Length; i++)
                    {
                        if (pi[i].IsOut || pi[i].ParameterType.IsByRef)
                        {
                            SimpleTextbox.AppendText(txtInfo, String.Format("{0}: {1}\r\n", pi[i].Name, p[i]));
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                SimpleMessage.ShowException(ex);
            }
            finally
            {
                Utils.EnableUI(this.Controls, true);
                if (resolveDirAdded)
                {
                    _host.RemoveAssemblyResolveDir(_sourceDir);
                }
                SimpleTextbox.AppendText(txtInfo, String.Format("=== Completed at {0} ===\r\n\r\n", DateTime.Now));
            }

            //this.Close();
        }
コード例 #11
0
 public void Log(string label, string content)
 {
     SimpleTextbox.AppendText(txtLog, String.Format("{0:yyyy-MM-dd hh:mm:ss}  {1}:  {2}\r\n", DateTime.Now, label, content));
 }
コード例 #12
0
 private void WriteLine(string text)
 {
     SimpleTextbox.AppendText(txtInfo, String.Format("{0}\r\n", text));
 }
コード例 #13
0
        private void ILMerge()
        {
            try
            {
                btnOK.Enabled = false;

                ILMerging.ILMerge ilm = new ILMerging.ILMerge();
                //ilm.Closed = true;

                if (!String.IsNullOrEmpty(txtKeyFile.Text))
                {
                    ilm.KeyFile = txtKeyFile.Text;
                }

                string[] assemblies = new string[lbAssemblies.Items.Count];
                for (int i = 0, j = 1; i < lbAssemblies.Items.Count; i++)
                {
                    if (i == lbAssemblies.SelectedIndex)
                    {
                        assemblies[0] = Path.Combine(_sourceDir, lbAssemblies.Items[i].ToString());
                    }
                    else
                    {
                        assemblies[j++] = Path.Combine(_sourceDir, lbAssemblies.Items[i].ToString());
                    }
                }
                ilm.SetInputAssemblies(assemblies);

                string outputFile = Path.GetFileName(assemblies[0]);
                outputFile = Path.Combine(txtOutputDir.Text, outputFile);
                if (File.Exists(outputFile))
                {
                    string ext = Path.GetExtension(outputFile);
                    outputFile = Path.ChangeExtension(outputFile, ".ILMerge" + ext);
                }
                ilm.OutputFile = outputFile;

                ilm.Closed    = chkClosed.Checked;
                ilm.DebugInfo = chkDebug.Checked;
                if (chkDuplicate.Checked)
                {
                    ilm.AllowDuplicateType(null);
                }

                //ilm.Log = true;
                ilm.Merge();
                ilm = null;

                SimpleTextbox.AppendText(txtInfo, String.Format("Output File: {0}\r\n\r\n", outputFile));
            }
            catch (Exception ex)
            {
                SimpleTextbox.AppendText(txtInfo, String.Format("{0}\r\n\r\n", ex.Message));
            }
            finally
            {
                btnOK.Enabled = true;
            }

            Application.DoEvents();
        }