Exemple #1
0
 static public GINIE FromFile(string file, bool allownonexistent = true)
 {
     if (!File.Exists(file))
     {
         if (allownonexistent)
         {
             return(new GINIE());
         }
         else
         {
             return(null);
         }
     }
     // TODO: Auto-detect binary form if existent
     return(FromSource(QuickStream.LoadString(file)));
 }
        public void App(string key, string v)
        {
            var tag = SafeTag(key);
            var fil = TagFile(tag);
            var SW  = Map[tag];

            if (SW == null)
            {
                if (File.Exists(fil))
                {
                    SW = new SwapData(QuickStream.LoadString(fil));
                }
                else
                {
                    SW = new SwapData("");
                }
                Map[tag] = SW;
            }
            SW.App(v);
            Update();
        }
 public string this[string key] {
     get {
         var tag = SafeTag(key);
         var fil = TagFile(tag);
         var SW  = Map[tag];
         MD();
         if (SW == null)
         {
             if (!File.Exists(fil))
             {
                 return("");
             }
             SW       = new SwapData(QuickStream.LoadString(fil));
             Map[tag] = SW;
         }
         Update();
         return(SW.ToString());
     }
     set {
         var tag = SafeTag(key);
         var fil = TagFile(tag);
         var SW  = Map[tag];
         MD();
         if (SW == null)
         {
             Chat($"Creating new entry: {tag}");
             Map[tag] = new SwapData(value, true);
         }
         else
         {
             Chat($"Rewrite existing entry: {tag}");
             SW.Def(value);
         }
         Update();
     }
 }
 public static string LoadString(string filename)
 {
     d(); return(QuickStream.LoadString(filename));
 }