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); //} }
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); //} }
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); }
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); }