コード例 #1
0
        public static job GetJob(ulong UserId)
        {
            if (StoreHandler.LoadData(UserId, $"JOB") != null)
            {
                var Job = new job()
                {
                    Name = StoreHandler.LoadData(UserId, $"JOB"),
                    Pay  = long.Parse(StoreHandler.LoadData(UserId, $"JOB-PAY")),
                };
                Job.StillAvailable = JobsList.ContainsKey(Job.Name);
                DateTime.TryParse(StoreHandler.LoadData(UserId, "JOB-TIMESTAMP"), out Job.Timestamp);

                return(Job);
            }
            else
            {
                return(null);
            }
        }
コード例 #2
0
        public static long GetCmdCountOfUser(ulong UserId)
        {
            string Key = $"CMD-COUNT";

            if (StoreHandler.LoadData(UserId, Key) == null)
            {
                StoreHandler.SaveData(UserId, Key, 0);
                return(0);
            }
            else if (long.TryParse(StoreHandler.LoadData(UserId, Key), out long IfSuccess))
            {
                return(IfSuccess);
            }
            else
            {
                StoreHandler.SaveData(UserId, Key, 0);
                return(0);
            }
        }
コード例 #3
0
 public static void SaveJob(ulong UserId, job arg)
 {
     StoreHandler.SaveData(UserId, "JOB", arg.Name);
     StoreHandler.SaveData(UserId, "JOB-PAY", arg.Pay);
     StoreHandler.SaveData(UserId, "JOB-TIMESTAMP", DateTime.UtcNow);
 }