private async void MyOnSaveUpload(object sender, Character input) { try { input.OnSaveCompleted -= MyOnSaveUpload; CharacterExtended ce = new CharacterExtended(input, null); var found = await StaticUtils.Client.GetByIdWithHttpMessagesAsync(ce.MySINnerFile.Id.Value); if (found.Response.StatusCode == System.Net.HttpStatusCode.OK) { var sinjson = await found.Response.Content.ReadAsStringAsync(); var foundobj = Newtonsoft.Json.JsonConvert.DeserializeObject <SINner>(sinjson); SINner foundsin = foundobj as SINner; if (foundsin.LastChange >= ce.MyCharacter.FileLastWriteTime) { //is already up to date! return; } } ce.MySINnerFile.SiNnerMetaData.Tags = ce.PopulateTags(); ce.PrepareModel(); await ChummerHub.Client.Backend.Utils.PostSINnerAsync(ce); await ChummerHub.Client.Backend.Utils.UploadChummerFileAsync(ce); } catch (Exception e) { System.Diagnostics.Trace.TraceError(e.ToString()); } finally { IsSaving = false; } }
public CharacterExtended SetCharacterFrom(CharacterShared mySINner) { InitializeComponent(); _mySINner = mySINner; MyCE = new CharacterExtended(mySINner.CharacterObject, null, PluginHandler.MySINnerLoading); MyCE.MySINnerFile.SiNnerMetaData.Tags = MyCE.PopulateTags(); MyCE.ZipFilePath = MyCE.PrepareModel(); TabSINnersBasic = new SINnersBasic(this) { Visible = true }; TabSINnersAdvanced = new SINnersAdvanced(this); #if DEBUG TabSINnersAdvanced.Visible = true; #else TabSINnersAdvanced.Visible = false; #endif this.tabPageBasic.Controls.Add(TabSINnersBasic); this.tabPageAdvanced.Controls.Add(TabSINnersAdvanced); this.AutoSize = true; return(MyCE); }
public CharacterExtended SetCharacterFrom(CharacterShared mySINner) { _mySINner = mySINner; TabSINnersBasic = new SINnersBasic(this); TabSINnersBasic.Visible = true; TabSINnersAdvanced = new SINnersAdvanced(this); TabSINnersAdvanced.Visible = true; MyCE = new CharacterExtended(mySINner.CharacterObject, null); MyCE.MySINnerFile.SiNnerMetaData.Tags = MyCE.PopulateTags(); MyCE.ZipFilePath = MyCE.PrepareModel(); InitializeComponent(); this.tabPageBasic.Controls.Add(TabSINnersBasic); this.tabPageAdvanced.Controls.Add(TabSINnersAdvanced); this.AutoSize = true; return(MyCE); }
public CharacterExtended SetCharacterFrom(CharacterShared mySINner) { InitializeComponent(); _mySINner = mySINner; if (PluginHandler.MyCharExtendedDic.ContainsKey(mySINner.CharacterObject.FileName)) { CharacterExtended outce; if (!PluginHandler.MyCharExtendedDic.TryGetValue(mySINner.CharacterObject.FileName, out outce)) { throw new ArgumentException("Could not get character from MyCharExtendedDic", nameof(mySINner)); } MyCE = outce; } else { MyCE = new CharacterExtended(mySINner.CharacterObject, null, PluginHandler.MySINnerLoading); MyCE.MySINnerFile.SiNnerMetaData.Tags = MyCE.PopulateTags(); MyCE.ZipFilePath = MyCE.PrepareModel(); } TabSINnersBasic = new SINnersBasic(this) { Visible = true }; TabSINnersAdvanced = new SINnersAdvanced(this); #if DEBUG TabSINnersAdvanced.Visible = true; #else TabSINnersAdvanced.Visible = false; #endif this.tabPageBasic.Controls.Add(TabSINnersBasic); this.tabPageAdvanced.Controls.Add(TabSINnersAdvanced); this.AutoSize = true; return(MyCE); }
public async Task <CharacterExtended> SetCharacterFrom(CharacterShared mySINner) { InitializeComponent(); _mySINner = mySINner; //if (PluginHandler.MyCharExtendedDic.ContainsKey(mySINner.CharacterObject.FileName)) //{ // CharacterExtended outce; // if (!PluginHandler.MyCharExtendedDic.TryGetValue(mySINner.CharacterObject.FileName, out outce)) // { // throw new ArgumentException("Could not get character from MyCharExtendedDic", nameof(mySINner)); // } // MyCE = outce; //} //else //{ MyCE = new CharacterExtended(mySINner.CharacterObject, null, PluginHandler.MySINnerLoading); MyCE.ZipFilePath = await MyCE.PrepareModel(); //} MyCE.MySINnerFile.SiNnerMetaData.Tags = MyCE.PopulateTags(); TabSINnersBasic = new ucSINnersBasic(this) { Visible = true }; TabSINnersAdvanced = new ucSINnersAdvanced(this) { Visible = true }; this.tabPageBasic.Controls.Add(TabSINnersBasic); this.tabPageAdvanced.Controls.Add(TabSINnersAdvanced); this.AutoSize = true; return(MyCE); }
public async Task <CharacterExtended> SetCharacterFrom(CharacterShared mySINner) { InitializeComponent(); _mySINner = mySINner; MyCE = new CharacterExtended(mySINner.CharacterObject, null, PluginHandler.MySINnerLoading); MyCE.ZipFilePath = await MyCE.PrepareModel(); MyCE.MySINnerFile.SiNnerMetaData.Tags = MyCE.PopulateTags(); TabSINnersBasic = new ucSINnersBasic(this) { Visible = true }; TabSINnersAdvanced = new ucSINnersAdvanced(this) { Visible = true }; this.tabPageBasic.Controls.Add(TabSINnersBasic); this.tabPageAdvanced.Controls.Add(TabSINnersAdvanced); this.AutoSize = true; if ((ucSINnersOptions.UploadOnSave == true)) { try { mySINner.CharacterObject.OnSaveCompleted = null; mySINner.CharacterObject.OnSaveCompleted += PluginHandler.MyOnSaveUpload; } catch (Exception e) { System.Diagnostics.Trace.TraceInformation(e.ToString()); } } return(MyCE); }