SpringModEdit.Mod.GetChanges C# (CSharp) Method

GetChanges() public method

public GetChanges ( Mod against, System.Windows.Forms.RichTextBox rb ) : void
against Mod
rb System.Windows.Forms.RichTextBox
return void
        public void GetChanges(Mod against, RichTextBox rb)
        {
            foreach (DictionaryEntry de in Units) {
                var ag = against.Units[de.Key] as LuaTable;
                if (ag != null) new TableProxy((LuaTable)de.Value, lua).Changes(rb, de.Key.ToString(), ag, against.lua);
                else {
                    rb.SelectionColor = Color.Green;
                    rb.SelectedText = "\r\n=== " + de.Key + "  added ===\r\n";
                }
            }

            foreach (DictionaryEntry de in against.Units) {
                var ag = Units[de.Key] as LuaTable;
                if (ag == null) {
                    rb.SelectionColor = Color.Red;
                    rb.SelectedText = "\r\n=== " + de.Key + "  deleted ===\r\n";
                }
            }
        }

Usage Example

示例#1
0
        private void viewChangesToolStripMenuItem_Click(object sender, EventArgs e)
        {
            var fc = new FormChanges();

            mod.GetChanges(new Mod(mod.Folder), fc.TextBox);
            if (fc.TextBox.TextLength > 0)
            {
                fc.TopLevel = true;
                fc.TopMost  = true;
                fc.Show();
            }
            else
            {
                MessageBox.Show("No changes detected", "Change detection", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }