Пример #1
0
 public void Load(JObject file)
 {
     JArray sheetsElem = file.Property("sheets").Value as JArray;
     for (int i = 0; i < sheetsElem.Count; ++i) {
     JObject sheet = sheetsElem[i] as JObject;
     string sheetName = sheet.Property("name").Value.ToString();
     if (sheetName.Equals("Test")) {
         JArray linesElem = sheet.Property("lines").Value as JArray;
         for (int j = 0; j < linesElem.Count; ++j) {
             Test val = new Test();
             val.Load(linesElem[j] as JObject);
             TestList.Add(val);
         }
     }
     else if (sheetName.Equals("SecondSheet")) {
         JArray linesElem = sheet.Property("lines").Value as JArray;
         for (int j = 0; j < linesElem.Count; ++j) {
             SecondSheet val = new SecondSheet();
             val.Load(linesElem[j] as JObject);
             SecondSheetList.Add(val);
         }
     }
     }
     for (int i = 0; i < TestList.Count; ++i)
     TestList[i].ResolveReferences(this);
     for (int i = 0; i < SecondSheetList.Count; ++i)
     SecondSheetList[i].ResolveReferences(this);
 }
Пример #2
0
 public void ResolveReferences(MyDB db)
 {
     for (int i = 0; i < db.SecondSheetList.Count; ++i)
     {
         if (db.SecondSheetList[i].ID.Equals(NewRefTestKey))
         {
             NewRefTest = db.SecondSheetList[i];
             break;
         }
     }
 }
Пример #3
0
        public void Load(JObject file)
        {
            JArray sheetsElem = file.Property("sheets").Value as JArray;

            for (int i = 0; i < sheetsElem.Count; ++i)
            {
                JObject sheet     = sheetsElem[i] as JObject;
                string  sheetName = sheet.Property("name").Value.ToString();
                if (sheetName.Equals("Test"))
                {
                    JArray linesElem = sheet.Property("lines").Value as JArray;
                    for (int j = 0; j < linesElem.Count; ++j)
                    {
                        Test val = new Test();
                        val.Load(linesElem[j] as JObject);
                        TestList.Add(val);
                    }
                }
                else if (sheetName.Equals("SecondSheet"))
                {
                    JArray linesElem = sheet.Property("lines").Value as JArray;
                    for (int j = 0; j < linesElem.Count; ++j)
                    {
                        SecondSheet val = new SecondSheet();
                        val.Load(linesElem[j] as JObject);
                        SecondSheetList.Add(val);
                    }
                }
            }
            for (int i = 0; i < TestList.Count; ++i)
            {
                TestList[i].ResolveReferences(this);
            }
            for (int i = 0; i < SecondSheetList.Count; ++i)
            {
                SecondSheetList[i].ResolveReferences(this);
            }
        }
Пример #4
0
 public void ResolveReferences(MyDB db)
 {
     for (int i = 0; i < db.SecondSheetList.Count; ++i) {
     if (db.SecondSheetList[i].ID.Equals(NewRefTestKey)) {
         NewRefTest = db.SecondSheetList[i];
         break;
     }
     }
 }