Esempio n. 1
0
 private void BtnCopy_Click(object sender, EventArgs e)
 {
     try
     {
         fileManager.Copy(lvFileExplorerLeft, lvFileExplorerRight);
     }
     catch (Exception ex)
     {
         errorBoxHelper.Show(ex);
     }
 }
Esempio n. 2
0
 public void OpenInBrowser(string link)
 {
     try
     {
         System.Diagnostics.Process.Start(link);
     }
     catch (Exception ex)
     {
         errorBoxHelper.Show(ex);
     }
 }
Esempio n. 3
0
 private void TsmiSavePlaintTextIntoFile_Click(object sender, EventArgs e)
 {
     try
     {
         var dialogResult = saveFileDialog.ShowDialog();
         if (dialogResult == DialogResult.OK)
         {
             File.WriteAllText(saveFileDialog.FileName, rtb_PlainText.Text.Base64Encode());
         }
     }
     catch (Exception ex)
     {
         errorBoxHelper.Show(ex);
     }
 }
Esempio n. 4
0
 private void BtnSelectPicture_Click(object sender, EventArgs e)
 {
     if (openFileDialog.ShowDialog() == DialogResult.OK)
     {
         try
         {
             pbImage.Image = Image.FromFile(openFileDialog.FileName);
         }
         catch (Exception ex)
         {
             errorBoxHelper.Show(ex);
         }
     }
 }
Esempio n. 5
0
        public ListViewItemsResult Get(string workingDirectory)
        {
            var result = new ListViewItemsResult();
            var items  = new List <ListViewItem>();

            try
            {
                if (rootDrectories.All(rootDirectory => rootDirectory != workingDirectory))
                {
                    items.Add(new ListViewItem
                    {
                        ImageIndex = 4,
                        Text       = ParentDirectory
                    });
                }

                var directories            = Directory.GetDirectories(workingDirectory);
                var directoryListViewItems = directories.Select(
                    directory => new ListViewItem
                {
                    ImageIndex = 4,
                    Text       = Path.GetFileName(directory)
                });
                items.AddRange(directoryListViewItems.ToArray());

                var files             = Directory.GetFiles(workingDirectory);
                var fileListViewItems = new List <ListViewItem>();
                foreach (var file in files)
                {
                    var listViewItem = new ListViewItem
                    {
                        ImageIndex = GetImageIndex(file),
                        Text       = Path.GetFileName(file)
                    };
                    var fileInfo = new FileInfo(file);
                    listViewItem.SubItems.Add(new ListViewSubItem(listViewItem, fileInfo.Length.GetHumanReadableSize()));
                    fileListViewItems.Add(listViewItem);
                }
                items.AddRange(fileListViewItems.ToArray());
                result.Success = true;
                result.Items   = items.ToArray();
            }
            catch (Exception ex)
            {
                errorBoxHelper.Show(ex);
            }

            return(result);
        }
Esempio n. 6
0
 private void SendMail_SentChanged(object sender, SentChangedEventArgs e)
 {
     if (!e.Sent)
     {
         logger.Error(e.Exception);
         errorBoxHelper.Show(e.Exception);
     }
     else
     {
         if (showMessages)
         {
             InfoBox.Show(Lng.Elem("E-mail sent"), Lng.Elem("The e-mail successfully sent."));
         }
     }
 }
Esempio n. 7
0
 private void TbIpAddress_Leave(object sender, EventArgs e)
 {
     try
     {
         if (String.IsNullOrEmpty(tbName.Text))
         {
             tbName.Text = hostnameProvider.GetHostName(tbIpAddress.Text);
         }
         if (String.IsNullOrEmpty(tbMacAddress.Text))
         {
             tbMacAddress.Text = windowsMacAddressProvider.GetMacAddress(tbIpAddress.Text);
         }
     }
     catch (Exception ex)
     {
         errorBoxHelper.Show(ex);
     }
 }
Esempio n. 8
0
        public AboutBox(ErrorBoxHelper errorBoxHelper)
        {
            this.errorBoxHelper = errorBoxHelper;

            InitializeComponent();
            Text = $"{Lng.Elem("About")} {AssemblyTitle}";
            labelProductName.Text = AssemblyTitle;
            labelVersion.Text     = $"{Lng.Elem("Version")} {AssemblyVersion}";
            labelCopyright.Text   = AssemblyCopyright;
            labelCompanyName.Text = AssemblyCompany;
            try
            {
                textBoxDescription.Text = File.ReadAllText(".\\LICENSE.TXT");
            }
            catch (Exception ex)
            {
                errorBoxHelper.Show(ex);
            }
        }
Esempio n. 9
0
        private void ExceptionViewer_Shown(object sender, EventArgs e)
        {
            ClearInfo();

            try
            {
                rtb_ExceptionText.Text = rtb_ExceptionText.Text.Replace("\\r", "\r").Replace("\\n", "\n");
                if (String.IsNullOrWhiteSpace(rtb_ExceptionText.Text))
                {
                    return;
                }

                byte add;
                var  index = rtb_ExceptionText.Text.IndexOf("Type\":\"");
                if (index == -1)
                {
                    index = rtb_ExceptionText.Text.IndexOf("ClassName\":\"");
                    add   = 12;
                }
                else
                {
                    add = 7;
                }
                var startIndex = index + add;
                if (rtb_ExceptionText.Text.Length < startIndex)
                {
                    return;
                }
                var endIndex = rtb_ExceptionText.Text.IndexOf("\",", startIndex);
                if (SetTextBoxText(tb_ExceptionType, startIndex, endIndex))
                {
                    index = rtb_ExceptionText.Text.IndexOf("StringValue\":\"");
                    if (index == -1)
                    {
                        index = rtb_ExceptionText.Text.IndexOf("Message\":\"");
                        add   = 10;
                    }
                    else
                    {
                        add = 14;
                    }
                    startIndex = index + add;
                    endIndex   = rtb_ExceptionText.Text.IndexOf("\n", startIndex) + 1;
                    if (SetTextBoxText(tb_ExceptionMessage, startIndex, endIndex))
                    {
                        startIndex = rtb_ExceptionText.Text.IndexOf(" at ", endIndex) + 4;
                        //startIndex = endIndex + 3;
                        endIndex = rtb_ExceptionText.Text.IndexOf("\n", startIndex);
                        SetTextBoxText(tb_LastStackElement, startIndex, endIndex);

                        var parts = tb_LastStackElement.Text.Split(new[] { '.', '(' });
                        if (parts.Length > 3)
                        {
                            tb_FunctionName.Text = parts[parts.Length - 2];
                            var substract = tb_FunctionName.Text == "ctor" ? 4 : 3;
                            tb_Filename.Text = parts[parts.Length - substract];
                            if (tb_Filename.Text == "<>c")
                            {
                                tb_Filename.Text = parts[parts.Length - 4];
                            }
                            if (!String.IsNullOrWhiteSpace(tb_Filename.Text))
                            {
                                clipboardHelper.SetText(tb_Filename.Text);
                            }
                        }
                    }
                }
                else
                {
                    SetTextBoxText(tb_FunctionName, 0, rtb_ExceptionText.Text.IndexOf('('));
                    var classEndIndex = rtb_ExceptionText.Text.IndexOf('>');
                    if (classEndIndex != -1)
                    {
                        SetTextBoxText(tb_Filename, rtb_ExceptionText.Text.IndexOf('<'), classEndIndex);
                        SetTextBoxText(tb_LastStackElement, classEndIndex + 2, rtb_ExceptionText.Text.IndexOf('\n', classEndIndex + 2));
                    }
                    else
                    {
                        var start = rtb_ExceptionText.Text.IndexOf('\n') + 1;
                        SetTextBoxText(tb_LastStackElement, start, rtb_ExceptionText.Text.IndexOf('\n', start + 1));
                    }

                    var messageStart = rtb_ExceptionText.Text.IndexOf("\n\n");
                    SetTextBoxText(tb_ExceptionMessage, messageStart + 2, rtb_ExceptionText.Text.IndexOf('\n', messageStart + 2));

                    var hynphen = tb_ExceptionMessage.Text.IndexOf(" - ");
                    tb_ExceptionType.Text    = tb_ExceptionMessage.Text.Substring(0, hynphen);
                    tb_ExceptionMessage.Text = tb_ExceptionMessage.Text.Substring(hynphen + 3);
                }
                rtb_ExceptionText.Select(0, 0);
            }
            catch (Exception ex)
            {
                errorBoxHelper.Show(ex);
            }
        }