private async Task <bool> TitleData(string parsedFile, CancellationToken token) { var titleDataDict = JsonWrapper.DeserializeObject <Dictionary <string, string> >(parsedFile); foreach (var kvp in titleDataDict) { if (IsCancellationRequest(token)) { return(false); } LogToFile("\tUploading: " + kvp.Key); var request = new SetTitleDataRequest() { Key = kvp.Key, Value = kvp.Value }; var setTitleDataTask = await PlayFabAdminAPI.SetTitleDataAsync(request); if (setTitleDataTask.Error != null) { OutputPlayFabError("\t\tTitleData Upload: " + kvp.Key, setTitleDataTask.Error); } else { LogToFile("\t\t" + kvp.Key + " Uploaded."); } } return(true); }
public async Task SetTitleData(string key, string value) { var reqSetTitleData = new SetTitleDataRequest { Key = key, Value = value }; var result = await PlayFabAdminAPI.SetTitleDataAsync(reqSetTitleData); if (result.Error != null) { throw new Exception(result.Error.ErrorMessage); } }
public async Task <bool> UploadTitleData() { if (string.IsNullOrEmpty(titleDataPath)) { LogToFile("Title Data Keys & Values File Path is Null "); return(true); } LogToFile("Uploading Title Data Keys & Values..."); var parsedFile = ParseFile(titleDataPath); var titleDataDict = JsonWrapper.DeserializeObject <Dictionary <string, string> >(parsedFile); foreach (var kvp in titleDataDict) { LogToFile("\tUploading: " + kvp.Key); var request = new SetTitleDataRequest() { Key = kvp.Key, Value = kvp.Value }; if (token.IsCancellationRequested) { return(true); } var setTitleDataTask = await PlayFabAdminAPI.SetTitleDataAsync(request); //setTitleDataTask.Wait(); if (setTitleDataTask.Error != null) { OutputPlayFabError("\t\tTitleData Upload: " + kvp.Key, setTitleDataTask.Error); } else { LogToFile("\t\t" + kvp.Key + " Uploaded.", ConsoleColor.Green); } } return(true); }
private static bool UploadTitleData() { if (string.IsNullOrEmpty(titleDataPath)) { return(false); } LogToFile("Uploading Title Data Keys & Values..."); var parsedFile = ParseFile(titleDataPath); var titleDataDict = JsonWrapper.DeserializeObject <Dictionary <string, string> >(parsedFile); foreach (var kvp in titleDataDict) { LogToFile(string.Format("\tUploading: {0}", kvp.Key)); var request = new SetTitleDataRequest() { Key = kvp.Key, Value = kvp.Value }; var setTitleDataTask = PlayFabAdminAPI.SetTitleDataAsync(request); setTitleDataTask.Wait(); if (setTitleDataTask.Result.Error != null) { OutputPlayFabError("\t\tTitleData Upload: " + kvp.Key, setTitleDataTask.Result.Error); } else { LogToFile(string.Format("\t\t{0} Uploaded.", kvp.Key), ConsoleColor.Green); } } return(true); }