Example #1
0
        public virtual void Changes(RichTextBox rb, string tblName, LuaTable againstTable, Lua againstLua)
        {
            ListDictionary against = againstLua.GetTableDict(againstTable);
              List<DictionaryEntry> items = new List<DictionaryEntry>();
              int maxlen = 0;
              bool allNumber = true;
              int cnt = 1;
              foreach (DictionaryEntry de in table) {
            items.Add(de);
            int len = de.Key.ToString().Length;
            if (len > maxlen) maxlen = len;
            if (!(de.Key is Double) || (int)(double)de.Key != cnt) allNumber = false;
            cnt++;
              }
              bool firstLine  = true;

              foreach (DictionaryEntry de in items) {
            if (against[de.Key] == null) {

              StringBuilder sb = new StringBuilder();
              if (firstLine) {
            rb.SelectionColor = Color.Black;
            rb.AppendText("\r\n=============================\r\n" + tblName + "\r\n=============================\r\n");
            firstLine = false;
              }
              rb.SelectionColor = Color.Green;
              FormatEntry(sb, maxlen, allNumber, 0, de);
              sb.AppendLine();
              rb.SelectedText = sb.ToString();
            }  else if (de.Value != null && against[de.Key].ToString() != de.Value.ToString() && !(de.Value is LuaTable)) {
              if (firstLine) {
            rb.SelectionColor = Color.Black;
            rb.AppendText("\r\n=============================\r\n" + tblName + "\r\n=============================\r\n");
            firstLine = false;
              }

              rb.SelectionColor = Color.Blue;
              StringBuilder sb = new StringBuilder();
              FormatEntry(sb, maxlen, allNumber, 0, de);
              sb.Append("  <- ");
              sb.AppendFormat("{0}", against[de.Key]);
              sb.AppendLine();
              rb.SelectedText = sb.ToString();
            }
              }

              foreach (DictionaryEntry de in against) {
            if (table[de.Key] == null) {
              if (firstLine) {
            rb.SelectionColor = Color.Black;
            rb.AppendText("\r\n=============================\r\n" + tblName + "\r\n=============================\r\n");
            firstLine = false;
              }
              rb.SelectionColor = Color.Red;
              StringBuilder sb = new StringBuilder();
              FormatEntry(sb, maxlen, allNumber, 0, de);
              sb.AppendLine();
              rb.SelectedText = sb.ToString();
            }
              }

              foreach (DictionaryEntry de in table) {
            if (against[de.Key] != null && de.Value is LuaTable) {
              new TableProxy((LuaTable)de.Value, lua).Changes(rb, tblName + "/" + de.Key, (LuaTable)against[de.Key], againstLua);
            }

              }
        }
Example #2
0
 public System.Collections.IEnumerator GetEnumerator()
 {
     return(interpreter.GetTableDict(this).GetEnumerator());
 }
Example #3
0
 public TableProxy(LuaTable table, TableType tableType, Lua lua)
 {
     this.table = lua.GetTableDict(table);
     this.tableType = tableType;
     this.lua = lua;
 }