Example #1
0
 public string LoadPoll(string pollname)
 {
     try {
         string path = pathToTheFile + pollname + ".json";
         var    json = File.ReadAllText(path);
         var    poll = JsonConvert.DeserializeObject <GachaPoll>(json);
         CurrentPoll = poll;
         return(pollname + "成功读取!");
     } catch (Exception e) {
         return("错误 " + e.ToString());
     }
 }
Example #2
0
        public void makeJSON()
        {
            string warPath = pathToTheFile + "镜华池.json";
            var    json    = File.ReadAllText(warPath);

            CurrentPoll           = new GachaPoll();
            CurrentPoll.upProb    = 7;
            CurrentPoll.upProbSSR = 50;
            CurrentPoll.upProbSR  = 180;
            CurrentPoll.upSSRChar = new List <string>();
            CurrentPoll.upSSRChar.Add("初音");

            CurrentPoll.SSRChar = new List <string>();
            CurrentPoll.SRChar  = new List <string>();
            CurrentPoll.RChar   = new List <string>();

            string[] temp = new string[] { "杏奈", "真步", "璃乃", "伊绪",
                                           "咲恋", "望", "妮诺", "秋乃", "真琴",
                                           "纯", "静流", "莫妮卡", "吉塔", "亚里莎", "镜华" };
            foreach (string str in temp)
            {
                CurrentPoll.SSRChar.Add(str);
            }

            temp = new string[] { "茜里", "宫子", "雪", "铃奈", "香织", "美美", "绫音", "铃", "惠理子",
                                  "忍", "真阳", "栞", "千歌", "空花", "珠希", "美冬", "深月" };
            foreach (string str in temp)
            {
                CurrentPoll.SRChar.Add(str);
            }

            temp = new string[] { "日和", "怜", "胡桃", "依里", "铃莓",
                                  "优花梨", "碧", "美咲", "莉玛" };
            foreach (string str in temp)
            {
                CurrentPoll.RChar.Add(str);
            }

            File.WriteAllText(warPath, JsonConvert.SerializeObject(CurrentPoll));
        }