public UIControls LoadFromFile(string FileName) { using (var FS = new FileStream(FileName, FileMode.Open)) { var NewUI = new UIControls(); var Xs = new XmlSerializer(typeof(UIControls)); NewUI = (UIControls)Xs.Deserialize(FS); return(NewUI); } }
public void UpdateUI(UIControls UI) { try { this.Text = UI.FormTile; this.HeadersTb.Text = UI.HeadersTab; this.HelpTb.Text = UI.HelpTab; this.OptionsTb.Text = UI.OptionsTab; this.LanguageTb.Text = UI.LanguageTab; this.SetHeadersBtn.Text = UI.SetHeadersBtn; this.ResetHeadersBtn.Text = UI.ResetHeadersBtn; this.LHFFBtn.Text = UI.LoadHeadersFromFileBtn; this.EHTFBtn.Text = UI.ExportHeadersToFileBtn; this.EHTFBtn.Text = UI.ExportHeadersToFileBtn; this.ClearBtn.Text = UI.ClearPlayersBtn; this.OMBtn.Text = UI.MimicBtn; this.SetLangBtn.Text = UI.SetLangBtn; this.LLFF.Text = UI.LoadLangFrmFileBtn; this.AddBlckLstBtn.Text = UI.AddBlckLstBtn; this.RemoveBlckLstBtn.Text = UI.RemoveBlckLstBtn; this.ResetBtn.Text = UI.ResetBlckLstBtn; this.InfoLbl.Text = UI.TMInfoLbl; //Players label is a format you also need some sht here u fgt btch ngga this.MOPLbl.Text = UI.MimicOtherPlayerLbl; this.BLLbl.Text = UI.BlckLstingLbl; this.ProgramingLbl.Text = UI.ProgrammingLbl; this.DesignerLbl.Text = UI.DesignerLbl; this.MPmChckBx.Text = UI.Message; this.MSignChckbx.Text = UI.Sign; this.MMottoChckbx.Text = UI.Motto; this.MClothesChckbx.Text = UI.Clothes; this.MSpeechChckbx.Text = UI.Speech; this.MGesturesChckbx.Text = UI.Gestures; this.MStanceChckbx.Text = UI.Stance; this.MDancingChckbx.Text = UI.Dance; } catch (Exception error) { MessageBox.Show(error.ToString()); } }
public UIControls LoadFromFile(string FileName) { using (var FS = new FileStream(FileName, FileMode.Open)) { var NewUI = new UIControls(); var Xs = new XmlSerializer(typeof(UIControls)); NewUI = (UIControls)Xs.Deserialize(FS); return NewUI; } }
private void LLFF_Click(object sender, EventArgs e) { DialogResult DR = LoadUIFromFile.ShowDialog(); if (DR == DialogResult.OK) { try { UIControls UI = new UIControls(); UI = UI.LoadFromFile(LoadUIFromFile.FileName); UpdateUI(UI); } catch (Exception error) { MessageBox.Show(error.ToString()); //MessageBox.Show("Error Loading UI/Language from the specified File", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }
private void LangCmbBx_DragDrop(object sender, DragEventArgs e) { if (e.Effect != DragDropEffects.Copy) return; string ourFile = ((string[])e.Data.GetData(DataFormats.FileDrop))[0]; try { UIControls UI = new UIControls(); UI = UI.LoadFromFile(ourFile); DialogResult DR = MessageBox.Show("Are you sure you want to load the UI from this file?", "Notice", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (DR == DialogResult.Yes) UpdateUI(UI); else return; } catch (Exception error) { MessageBox.Show(error.ToString()); MessageBox.Show("Error Loading the UI File", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }