Example #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)));
 }
Example #2
0
        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();
        }
Example #3
0
 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();
     }
 }
Example #4
0
 public static string LoadString(string filename)
 {
     d(); return(QuickStream.LoadString(filename));
 }