private void ResignExternalBankToolStripMenuItem_Click(object sender, EventArgs e) { openFileDialog1.Title = "Locate bank to sign"; openFileDialog1.Filter = "Starcraft 2 Bank File (*.SC2Bank)|*.SC2Bank|XML file (*.xml)|*.xml|All files (*.*)|*.*"; if (openFileDialog1.ShowDialog() == DialogResult.OK) { //Read the bank BankReader reader = new BankReader(); BankInfo bankInfo; BankInfoCache bankInfoCache = new BankInfoCache(); if (!BankPathParser.IsValidBankPath(openFileDialog1.FileName)) { PlayerNumberForm numberForm = new PlayerNumberForm(); if (numberForm.ShowDialog() != DialogResult.OK) { return; } bankInfo = bankInfoCache.GetOrAddBankInfo(openFileDialog1.FileName, numberForm.PlayerNumber, numberForm.AuthorNumber); } else { bankInfo = bankInfoCache.GetOrAddBankInfo(openFileDialog1.FileName); } Bank bank = reader.LoadBankFromPath(bankInfo); //Write the bank back; automatically re-signs BankWriter bankWriter = new BankWriter(); bankWriter.WriteBank(bank, openFileDialog1.FileName); } }
/// <summary> /// /// </summary> /// <param name="file"></param> /// <returns></returns> public virtual IEnumerable <Tone> ImportToneFile(string file) { string ext = System.IO.Path.GetExtension(file); var Option = new Option(); IEnumerable <Tone> tones = null; try { string[] importFile = { file.ToLower(CultureInfo.InvariantCulture) }; switch (ext.ToUpper(CultureInfo.InvariantCulture)) { case ".MUC": tones = Muc.Reader(importFile, Option); break; case ".DAT": tones = Dat.Reader(importFile, Option); break; case ".MWI": tones = Fmp.Reader(importFile, Option); break; case ".MML": tones = Pmd.Reader(importFile, Option); break; case ".FXB": tones = Vopm.Reader(importFile, Option); break; case ".GWI": tones = Gwi.Reader(importFile, Option); break; case ".BNK": tones = BankReader.Read(file); break; case ".SYX": tones = SyxReaderTX81Z.Read(file); break; } } catch (Exception ex) { if (ex.GetType() == typeof(Exception)) { throw; } else if (ex.GetType() == typeof(SystemException)) { throw; } MessageBox.Show(Resources.FailedLoadFile + "\r\n" + ex.Message); } return(tones); }
private void RefreshBankListView() { if (_selectedMap == null) { _selectedMapBank = null; bankEditor1.Bank = null; return; } if (_selectedMapBank == null || cmbBankFile.SelectedItem != _selectedMapBank.BankInfo) { //Refresh the bank also BankReader bankReader = new BankReader(); _selectedMapBank = (GetApplicableBankInfos(_selectedMap).Any() ? bankReader.LoadBankFromPath((BankInfo)cmbBankFile.SelectedItem) : null); bankEditor1.Bank = _selectedMapBank; } }
public void Initialize() { _target = new BankReader(); }