Beispiel #1
0
        public static void SerializeFastlyUser(FastlyUser f)
        {
            string path = Common.GetFolderUnchained("CPK") + "\\" + f.CPK + "_balance.json";
            String json = Newtonsoft.Json.JsonConvert.SerializeObject(f);

            Unchained.WriteToFile(path, json);
        }
Beispiel #2
0
        public static void SyncFastlyNicknames()
        {
            try
            {
                string   path      = GetFolderUnchained("nicknames.dat");
                DateTime diMod     = System.IO.File.GetLastWriteTime(path);
                TimeSpan tsElapsed = System.DateTime.Now - diMod;
                if (dicNicknames.Count() == 0)
                {
                    MemorizeNickNames();
                }

                if (tsElapsed.TotalSeconds < (60 * 30))
                {
                    return;
                }

                NBitcoin.RPC.RPCClient c = WebRPC.GetLocalRPCClient();
                object[] oParams         = new object[2];
                oParams[0] = "cpk";
                oParams[1] = "9999999";

                dynamic j    = c.SendCommand("datalist", oParams);
                JObject j1   = j.Result;
                JArray  ja   = (JArray)j.Result.ChildrenTokens;
                string  data = "";

                foreach (var jcpk in j1)
                {
                    string skey    = jcpk.Key;
                    string sValue  = jcpk.Value.ToString();
                    string sType   = GetEle(skey, "[-]", 0);
                    string sPriKey = GetEle(skey, "[-]", 1);
                    string sCPK    = GetEle(sValue, "|", 0);
                    string sNN     = GetEle(sValue, "|", 1);
                    if (sType == "CPK" && sCPK != "" && sNN != "")
                    {
                        string sRow = sType + "|" + sCPK + "|" + sNN + "\r\n";
                        data += sRow;
                    }
                }

                Unchained.WriteToFile(path, data);
                MemorizeNickNames();
            }
            catch (Exception ex)
            {
                Log("SyncFastlyNicknames " + ex.Message);
            }
        }