Esempio n. 1
0
 public static void FromBytes(byte[] buf, int byteCount, bool replaceCache)
 {
     if (byteCount > 4)
     {
         int varsCount = Entry.BytesToInt(buf, 0);
         if (varsCount > 0)
         {
             int offset = 4;
             for (; ;)
             {
                 string key   = null;
                 string value = null;
                 offset += DGlobals.BytesToKeyValue(buf, offset, ref key, ref value);
                 DGlobals._add(key, value);
                 if (offset >= byteCount)
                 {
                     break;
                 }
             }
             if (replaceCache)
             {
                 sbuf = Convert.ToBase64String(buf, 0, byteCount);
             }
             return;
         }
     }
     if (replaceCache)
     {
         sbuf = null;
     }
 }
Esempio n. 2
0
        public static void FromBase64StringInDebugMode(string s)
        {
            if (StaticGlobals.ExecutionMode != ExecutionMode.DEBUG)
            {
                throw new Exception("DGlobalsM.LoadBased64String can only be executed in DEBUG mode.");
            }

            byte[] buf   = Convert.FromBase64String(s);
            string key   = null;
            string value = null;

            DGlobals.BytesToKeyValue(buf, 0, ref key, ref value);
            //DGlobals._add(key, value); //Don't want to call DGlobals._add(key, value), this will write to the console.
            DGlobals.vars[key] = value;
        }