private void ClickOpen(object sender, EventArgs e) { var eLoad = new OpenFileDialog(); eLoad.Filter = "Elements File (*.data)|*.data|All Files (*.*)|*.*"; if (eLoad.ShowDialog() != DialogResult.OK || !File.Exists(eLoad.FileName)) return; try { Cursor = Cursors.AppStarting; _elc = new EListCollection(eLoad.FileName); if (_elc.ConversationListIndex > -1 && _elc.Lists.Length > _elc.ConversationListIndex) _conversationList = new EListConversation((byte[]) _elc.Lists[_elc.ConversationListIndex].elementValues[0][0]); dataGridView_item.Rows.Clear(); listBox_items.Items.Clear(); comboBox_lists.Items.Clear(); for (var l = 0; l < _elc.Lists.Length; l++) comboBox_lists.Items.Add("[" + l + "]: " + _elc.Lists[l].listName + " (" + _elc.Lists[l].elementValues.Length + ")"); Cursor = Cursors.Default; } catch { MessageBox.Show("LOADING ERROR!\nThis error mostly occurs of configuration and elements.data mismatch"); Cursor = Cursors.Default; } }
private void ClickJoinEL(object sender, EventArgs e) { var eJoin = new Join(); if (eJoin.ShowDialog() != DialogResult.OK) return; if (!File.Exists(eJoin.FileName)) return; if (eJoin.LogDirectory == "" || !Directory.Exists(eJoin.LogDirectory)) { eJoin.LogDirectory = eJoin.FileName + ".JOIN"; Directory.CreateDirectory(eJoin.LogDirectory); } if (eJoin.BackupNew) Directory.CreateDirectory(eJoin.LogDirectory + @"\Plugins\Elements.PW\added.backup"); if (eJoin.BackupChanged) Directory.CreateDirectory(eJoin.LogDirectory + @"\Plugins\Elements.PW\replaced.backup"); if (eJoin.BackupMissing) Directory.CreateDirectory(eJoin.LogDirectory + @"\Plugins\Elements.PW\removed.backup"); try { Cursor = Cursors.WaitCursor; var nelc = new EListCollection(eJoin.FileName); if (_elc.ConfigFile != nelc.ConfigFile) MessageBox.Show( "You're going to join two different element.data versions. The merged file will become invalid!", " WARNING"); if (_elc.ConversationListIndex > -1 && nelc.Lists.Length > _elc.ConversationListIndex) _conversationList = new EListConversation((byte[]) nelc.Lists[_elc.ConversationListIndex].elementValues[0][0]); var sw = new StreamWriter(eJoin.LogDirectory + @"\Plugins\Elements.PW\LOG.TXT", false, Encoding.Unicode); for (var l = 0; l < _elc.Lists.Length; l++) { if (l == _elc.ConversationListIndex) continue; var report = _elc.Lists[l].JoinElements(nelc.Lists[l], l, eJoin.AddNew, eJoin.BackupNew, eJoin.ReplaceChanged, eJoin.BackupChanged, eJoin.RemoveMissing, eJoin.BackupMissing, eJoin.LogDirectory + @"\Plugins\Elements.PW\added.backup", eJoin.LogDirectory + @"\Plugins\Elements.PW\replaced.backup", eJoin.LogDirectory + @"\Plugins\Elements.PW\removed.backup"); report.Sort(); if (report.Count > 0) { sw.WriteLine("List " + l + ": " + report.Count + " Item(s) Affected"); sw.WriteLine(); foreach (var t in report) sw.WriteLine((string) t); sw.WriteLine(); } comboBox_lists.Items[l] = "[" + l + "]: " + _elc.Lists[l].listName + " (" + _elc.Lists[l].elementValues.Length + ")"; } sw.Close(); if (comboBox_lists.SelectedIndex > -1) ChangeList(null, null); Cursor = Cursors.Default; } catch { MessageBox.Show("LOADING ERROR!\nThis error mostly occurs of configuration and elements.data mismatch"); Cursor = Cursors.Default; } }