Exemple #1
0
        public void UpdatePickAndBanAsync(PickAndBan pb)
        {
            string json_out = JsonConvert.SerializeObject(pb, Formatting.Indented);

            //byte[] buffer = Encoding.UTF8.GetBytes(json_out);

            //var buffer = Encoding.UTF8.GetBytes(json_out);
            while (IO_Related.IsFileLocked(new FileInfo(UserDataConstant.GetPickBanStylePerSessFilePath(pb.sessID)), FileMode.Open, FileAccess.Read))
            {
            }
            System.IO.File.WriteAllText(UserDataConstant.GetPickBanStylePerSessFilePath(pb.sessID), json_out);
            //using (var fs = System.IO.File.Open(UserDataConstant.GetPickBanStylePerSessFilePath(pb.sessID), FileMode.Open, FileAccess.Write))
            //{
            //    fs.Write(buffer);
            //}
        }
Exemple #2
0
        public void UpdateChampionStyleListAsync(ChampionStyle champStyle)
        {
            string json_out = JsonConvert.SerializeObject(champStyle, Formatting.Indented);

            //byte[] buffer = Encoding.UTF8.GetBytes(json_out);

            //var buffer = Encoding.UTF8.GetBytes(json_out);
            while (IO_Related.IsFileLocked(new FileInfo(UserDataConstant.GetChampionStylePerSessFilePath(champStyle.sessID)), FileMode.Open, FileAccess.Write))
            {
            }
            System.IO.File.WriteAllText(UserDataConstant.GetChampionStylePerSessFilePath(champStyle.sessID), json_out);
            //using (var fs = System.IO.File.Open(UserDataConstant.GetChampionStylePerSessFilePath(champStyle.sessID), FileMode.Open))
            //{
            //    await fs.WriteAsync(buffer);
            //}
        }
Exemple #3
0
        public PickAndBan GetPickAndBanAsync(string id)
        {
            byte[] buffer = new byte[20000];

            while (IO_Related.IsFileLocked(new FileInfo(UserDataConstant.GetPickBanStylePerSessFilePath(id)), FileMode.Open, FileAccess.Read))
            {
            }
            //using (var fs = System.IO.File.Open(UserDataConstant.GetPickBanStylePerSessFilePath(id), FileMode.Open, FileAccess.Read/*, FileShare.Read*/))
            //{
            //    await fs.ReadAsync(buffer);
            //}
            //string json_out = Encoding.UTF8.GetString(buffer);
            string     json_out = System.IO.File.ReadAllText(UserDataConstant.GetPickBanStylePerSessFilePath(id));
            PickAndBan result   = JsonConvert.DeserializeObject <PickAndBan>(json_out);

            return(result);
        }
Exemple #4
0
        public ChampionStyle GetChampionStyleListAsync(string id)
        {
            //byte[] buffer=new byte[20000];

            while (IO_Related.IsFileLocked(new FileInfo(UserDataConstant.GetChampionStylePerSessFilePath(id)), FileMode.Open, FileAccess.Read))
            {
            }
            //using (var fs = System.IO.File.Open(UserDataConstant.GetChampionStylePerSessFilePath(id), FileMode.Open, FileAccess.Read))
            //{
            //    await fs.ReadAsync(buffer);
            //}
            //string json_out = Encoding.UTF8.GetString(buffer);
            string        json_out = System.IO.File.ReadAllText(UserDataConstant.GetChampionStylePerSessFilePath(id));
            ChampionStyle result   = JsonConvert.DeserializeObject <ChampionStyle>(json_out);

            return(result);
        }