Exemple #1
0
        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;
            }
        }
Exemple #2
0
        private void ClickBrowse(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;

            Cursor = Cursors.AppStarting;

            dataGridView_fields.Rows.Clear();
            dataGridView_values.Rows.Clear();
            comboBox_lists.Items.Clear();

            if (sender == button_browseBase)
            {
                _elcBase = new EListCollection(eLoad.FileName);
                textBox_baseFile.Text = eLoad.FileName;
                textBox_baseVersion.Text = _elcBase.Version.ToString(CultureInfo.InvariantCulture);
            }

            if (sender == button_browseRecent)
            {
                _elcRecent = new EListCollection(eLoad.FileName);
                textBox_recentFile.Text = eLoad.FileName;
                textBox_recentVersion.Text = _elcRecent.Version.ToString(CultureInfo.InvariantCulture);
            }

            if (_elcBase != null && _elcRecent != null && _elcBase.Lists.Length > 0 && _elcRecent.Lists.Length > 0)
            {
                // add list names from recent file
                _eRules = new RuleConfig[_elcRecent.Lists.Length];

                for (var l = 0; l < _elcRecent.Lists.Length; l++)
                {
                    comboBox_lists.Items.Add("[" + l + "]: " + _elcRecent.Lists[l].listName + " (" + _elcRecent.Lists[l].elementValues.Length + ")");
                    _eRules[l] = new RuleConfig();
                    _eRules[l].RemoveList = false;
                    _eRules[l].ReplaceOffset = false;
                    _eRules[l].Offset = "";
                    _eRules[l].RemoveValues = new bool[_elcRecent.Lists[l].elementFields.Length];

                    for (var f = 0; f < _eRules[l].RemoveValues.Length; f++)
                        _eRules[l].RemoveValues[f] = false;
                }
            }

            Cursor = Cursors.Default;
        }
Exemple #3
0
        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;
            }
        }
Exemple #4
0
 public LogicReplace(EListCollection listCollection)
 {
     _elc = listCollection;
     InitializeComponent();
     comboBox_operation.SelectedIndex = 0;
 }