Ejemplo n.º 1
0
        private void btnGameExeLocationBrowse_Click(object sender, EventArgs e)
        {
            try {
                using (OpenFileDialog openFile = new OpenFileDialog()) {
                    FileInfo currentExeLocation = new FileInfo(txtGameExeLocation.Text);
                    if (currentExeLocation.Directory.Exists)
                    {
                        openFile.InitialDirectory = currentExeLocation.Directory.FullName;
                    }

                    openFile.Filter   = "Exe files (*.exe)|*.exe";
                    openFile.FileName = "FallGuys_client_game.exe";
                    openFile.Title    = "Locate Fall Guys";

                    DialogResult result = openFile.ShowDialog(this);
                    if (result.Equals(DialogResult.OK))
                    {
                        if (openFile.FileName.IndexOf("FallGuys_client", StringComparison.OrdinalIgnoreCase) >= 0)
                        {
                            txtGameExeLocation.Text = openFile.FileName;
                        }
                        else
                        {
                            MessageBox.Show("Please select \"FallGuys_client_game.exe\" in the install folder.", "Wrong File Selected", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        }
                    }
                }
            } catch (Exception ex) {
                ControlErrors.HandleException(this, ex, false);
            }
        }
Ejemplo n.º 2
0
        private void exportItemMD_Click(object sender, EventArgs e)
        {
            try {
                List <DataGridViewColumn> columns = GetSortedColumns();

                StringBuilder sb = new StringBuilder();
                foreach (DataGridViewColumn col in columns)
                {
                    string header = string.IsNullOrEmpty(col.HeaderText) ? col.ToolTipText : col.HeaderText;
                    sb.Append($"|{header}");
                }
                sb.AppendLine();
                foreach (DataGridViewColumn col in columns)
                {
                    sb.Append($"|---");
                }
                sb.AppendLine();

                foreach (DataGridViewRow row in this.Rows)
                {
                    foreach (DataGridViewColumn col in columns)
                    {
                        string formattedValue = row.Cells[col.Name].FormattedValue?.ToString();
                        string tooltip        = row.Cells[col.Name].ToolTipText;

                        if (string.IsNullOrEmpty(tooltip) || row.Cells[col.Name].FormattedValueType == typeof(string))
                        {
                            sb.Append($"|{formattedValue}");
                        }
                        else
                        {
                            sb.Append($"|{tooltip}");
                        }
                    }
                    sb.AppendLine();
                }

                Clipboard.SetText(sb.ToString(), TextDataFormat.Text);

                MessageBox.Show(this, "Saved MarkDown to clipboard.", "Export", MessageBoxButtons.OK);
            } catch (Exception ex) {
                ControlErrors.HandleException(this, ex, false);
            }
        }
Ejemplo n.º 3
0
        public void ExportBbCode()
        {
            try {
                List <DataGridViewColumn> columns = GetSortedColumns();

                StringBuilder sb = new StringBuilder();
                sb.Append("[table][tr]");
                foreach (DataGridViewColumn col in columns)
                {
                    string header = string.IsNullOrEmpty(col.HeaderText) ? col.ToolTipText : col.HeaderText;
                    sb.Append($"[th]{header}[/th]");
                }
                sb.Append("[/tr]");

                foreach (DataGridViewRow row in this.Rows)
                {
                    sb.Append("[tr]");
                    foreach (DataGridViewColumn col in columns)
                    {
                        string formattedValue = row.Cells[col.Name].FormattedValue?.ToString();
                        string tooltip        = row.Cells[col.Name].ToolTipText;

                        if (string.IsNullOrEmpty(tooltip) || row.Cells[col.Name].FormattedValueType == typeof(string))
                        {
                            sb.Append($"[td]{formattedValue}[/td]");
                        }
                        else
                        {
                            sb.Append($"[td]{tooltip}[/td]");
                        }
                    }
                    sb.Append("[/tr]");
                }
                sb.Append("[/table]");
                Clipboard.SetText(sb.ToString(), TextDataFormat.Text);

                MessageBox.Show(this, "Saved BBCode to clipboard.", "Export", MessageBoxButtons.OK);
            } catch (Exception ex) {
                ControlErrors.HandleException(this, ex, false);
            }
        }
Ejemplo n.º 4
0
        private void exportItemCSV_Click(object sender, EventArgs e)
        {
            try {
                saveFile.Filter = "CSV files|*.csv";
                if (saveFile.ShowDialog() == DialogResult.OK)
                {
                    Encoding enc = Encoding.GetEncoding("windows-1252");
                    using (FileStream fs = new FileStream(saveFile.FileName, FileMode.Create)) {
                        List <DataGridViewColumn> columns = GetSortedColumns();

                        StringBuilder sb = new StringBuilder();
                        foreach (DataGridViewColumn col in columns)
                        {
                            string header = string.IsNullOrEmpty(col.HeaderText) ? col.ToolTipText : col.HeaderText;
                            sb.Append(EscapeQuotes(header)).Append(",");
                        }
                        if (sb.Length > 0)
                        {
                            sb.Length = sb.Length - 1;
                        }

                        sb.AppendLine();
                        byte[] bytes = enc.GetBytes(sb.ToString());
                        fs.Write(bytes, 0, bytes.Length);

                        foreach (DataGridViewRow row in this.Rows)
                        {
                            sb.Length = 0;
                            foreach (DataGridViewColumn col in columns)
                            {
                                string formattedValue = row.Cells[col.Name].FormattedValue?.ToString();
                                string tooltip        = row.Cells[col.Name].ToolTipText;

                                if (string.IsNullOrEmpty(tooltip) || row.Cells[col.Name].FormattedValueType == typeof(string))
                                {
                                    sb.Append($"{EscapeQuotes(formattedValue)},");
                                }
                                else
                                {
                                    sb.Append($"{EscapeQuotes(tooltip)},");
                                }
                            }
                            if (sb.Length > 0)
                            {
                                sb.Length = sb.Length - 1;
                            }

                            sb.AppendLine();
                            bytes = enc.GetBytes(sb.ToString());
                            fs.Write(bytes, 0, bytes.Length);
                        }
                        fs.Flush();
                        fs.Close();
                    }

                    MessageBox.Show(this, $"Saved CSV to {saveFile.FileName}", "Export", MessageBoxButtons.OK);
                }
            } catch (Exception ex) {
                ControlErrors.HandleException(this, ex, false);
            }
        }
Ejemplo n.º 5
0
 private void exportItem_Click(object sender, EventArgs e)
 {
     try {
         saveFile.Filter = "CSV files|*.csv";
         if (saveFile.ShowDialog() == DialogResult.OK)
         {
             Encoding enc = Encoding.GetEncoding("windows-1252");
             using (FileStream fs = new FileStream(saveFile.FileName, FileMode.Create)) {
                 StringBuilder sb = new StringBuilder();
                 foreach (DataGridViewColumn col in this.Columns)
                 {
                     if (col.ValueType != null && col.Visible)
                     {
                         sb.Append(col.Name).Append(",");
                     }
                 }
                 if (sb.Length > 0)
                 {
                     sb.Length = sb.Length - 1;
                 }
                 sb.AppendLine();
                 byte[] bytes = enc.GetBytes(sb.ToString());
                 fs.Write(bytes, 0, bytes.Length);
                 foreach (DataGridViewRow row in this.Rows)
                 {
                     sb.Length = 0;
                     foreach (DataGridViewColumn col in this.Columns)
                     {
                         if (!col.Visible)
                         {
                             continue;
                         }
                         if (col.ValueType == typeof(string))
                         {
                             sb.Append("\"").Append(row.Cells[col.Name].Value.ToString()).Append("\",");
                         }
                         else if (col.ValueType != null)
                         {
                             if (row.Cells[col.Name].Value == null)
                             {
                                 sb.Append(",");
                             }
                             else
                             {
                                 sb.Append(row.Cells[col.Name].Value.ToString()).Append(",");
                             }
                         }
                     }
                     if (sb.Length > 0)
                     {
                         sb.Length = sb.Length - 1;
                     }
                     sb.AppendLine();
                     bytes = enc.GetBytes(sb.ToString());
                     fs.Write(bytes, 0, bytes.Length);
                 }
                 fs.Flush();
                 fs.Close();
             }
         }
     } catch (Exception ex) {
         ControlErrors.HandleException(this, ex, false);
     }
 }