Example #1
0
 public Database(string fileName)
 {
     FileName = fileName;
     Engine   = new Engine();
     Engine.Restart();
     Engine.LoadAssembly(Assembly.GetExecutingAssembly());
     FunctionTable = new FunctionTable {
         Database = this
     };
     ImagePartTable = new ImagePartTable {
         Database = this
     };
     ConfigDictionary = new ConfigDictionary {
         Database = this
     };
     Root = new PartFolder {
         Database = this
     };
     if (File.Exists(FileName))
     {
         Root.FromX(ZipUtils.Extract(FileName, "Root"));
     }
     else
     {
         Root.Name = "所有元件";
     }
 }
Example #2
0
        private SymbolDictionary <T> Load(string key)
        {
            XElement xe   = ZipUtils.Extract(Database.FileName, GetDictRealName(key));
            var      dict = new SymbolDictionary <T> {
                Name = key, Database = Database
            };

            foreach (var e in xe.Elements())
            {
                dict.Add(FromX(e));
            }
            Add(key, dict);
            return(dict);
        }
Example #3
0
 private IEnumerator <KeyValuePair <string, XElement> > GetXDicts()
 {
     foreach (var name in _dictNames)
     {
         var      dname = GetDictRealName(name);
         XElement xe;
         if (IsLoad(name))
         {
             xe = new XElement("Dict");
             foreach (var value in this[name])
             {
                 xe.Add(value.ToX());
             }
         }
         else
         {
             xe      = ZipUtils.Extract(Database.FileName, dname);
             xe.Name = "Dict";
         }
         yield return(new KeyValuePair <string, XElement>(dname, xe));
     }
 }