Пример #1
0
        public static void ClearAll()
        {
            AllItems.Clear();

            AllSchemas.Clear();
            ListByFieldName.Clear();
            ItemListBySchema.Clear();
            FilterSchemaKeyArray = null;
            SchemaKeyArray       = null;

            ItemsNeedSave   = true;
            SchemasNeedSave = true;
        }
Пример #2
0
        private static void LoadSchemas()
        {
            try
            {
                string json = File.ReadAllText(DataFilePath);
                _dataFileMD5 = json.Md5Sum();

                Dictionary <string, object> data = Json.Deserialize(json) as Dictionary <string, object>;

                // Clear all schema related lists
                AllSchemas.Clear();
                ListByFieldName.Clear();
                ItemListBySchema.Clear();
                FilterSchemaKeyArray = null;
                SchemaKeyArray       = null;

                string error;
                string schemaName;
                foreach (KeyValuePair <string, object> pair in data)
                {
                    if (!pair.Key.StartsWith(GDEConstants.SchemaPrefix))
                    {
                        continue;
                    }

                    Dictionary <string, object> schemaData = pair.Value as Dictionary <string, object>;
                    schemaName = pair.Key.Replace(GDEConstants.SchemaPrefix, "");
                    AddSchema(schemaName, schemaData, out error, false);
                }

                SchemaKeyArray       = BuildSchemaKeyArray();
                FilterSchemaKeyArray = BuildSchemaFilterKeyArray();

                SchemasNeedSave = false;
            }
            catch (Exception ex)
            {
                Debug.LogException(ex);
            }
        }