public ChangeShipWindow(AppServiceInterface appServices, FLGameData gameData, FLDataFile charFile) { this.appServices = appServices; this.charFile = charFile; InitializeComponent(); hashListBindingSource.DataSource = gameData.DataStore; FilterUpdate(); }
void _bgWorker_DoWork(object sender, DoWorkEventArgs e) { var rows = _mainWindow.charListDataGridView.Rows; Action <int> act = SetMaxBar; progressBar1.Invoke(act, rows.Count); var accDt = new DamDataSet.CharacterListDataTable(); var stringToCompare = textBox1.Text.ToLowerInvariant(); foreach (DataGridViewRow row in rows) { var obj = (DamDataSet.CharacterListRow)((DataRowView)row.DataBoundItem).Row; if (_bgWorker.CancellationPending) { break; } if (!File.Exists(AppSettings.Default.setAccountDir + "\\" + row.Cells[8].Value)) { continue; } var loadedCharFile = new FLDataFile(AppSettings.Default.setAccountDir + "\\" + row.Cells[8].Value, true); bool isAdded = false; foreach (var set in loadedCharFile.GetSettings("Player", "cargo")) { if (_mainWindow.gameData.GetItemDescByHash(set.UInt(0)).ToLowerInvariant() != stringToCompare) { continue; } accDt.ImportRow(obj); isAdded = true; break; } if (!isAdded) { foreach (FLDataFile.Setting set in loadedCharFile.GetSettings("Player", "base_equip")) { if (_mainWindow.gameData.GetItemDescByHash(set.UInt(0)).ToLowerInvariant() != stringToCompare) { continue; } accDt.ImportRow(obj); break; } } _bgWorker.ReportProgress(0); } e.Result = accDt; }
private void buttonOpen_Click(object sender, EventArgs e) { openFileDialog1.Multiselect = false; DialogResult result = openFileDialog1.ShowDialog(); if (result == DialogResult.OK) { try { FLDataFile file = new FLDataFile(openFileDialog1.FileName, false); // Build the ini file in a string, section by section StringBuilder strToSave = new StringBuilder(); foreach (FLDataFile.Section section in file.sections) { strToSave.AppendLine("[" + section.sectionName + "]"); foreach (FLDataFile.Setting entry in section.settings) { string line = entry.settingName; if (entry.NumValues() > 0) { line += " = "; for (int i = 0; i < entry.NumValues(); i++) { if (i != 0) { line += ", "; } line += entry.Str(i); } } strToSave.AppendLine(line); } strToSave.AppendLine(""); } richTextBoxFileView.Text = strToSave.ToString(); this.Text = "INI File View: " + openFileDialog1.FileName; } catch (Exception ex) { richTextBoxFileView.Text = ex.ToString(); this.Text = "INI File View"; } } }
private void buttonSave_Click(object sender, EventArgs e) { saveFileDialog1.FileName = openFileDialog1.FileName; DialogResult result = saveFileDialog1.ShowDialog(); if (result == DialogResult.OK) { try { FLDataFile editedFile = new FLDataFile(Encoding.ASCII.GetBytes(richTextBoxFileView.Text), saveFileDialog1.FileName, false); editedFile.SaveSettings(saveFileDialog1.FileName, false); } catch (Exception ex) { richTextBoxFileView.Text = ex.ToString(); } } }