public override ThingList Load(BinaryReader BR, ProgressCallback ProgressCallback) { ThingList TL = new ThingList(); if (ProgressCallback != null) { ProgressCallback(I18N.GetText("FTM:CheckingFile"), 0); } if ((BR.BaseStream.Length % 0x40) != 0 || BR.BaseStream.Position != 0) { return(TL); } long EntryCount = BR.BaseStream.Length / 0x40; if (ProgressCallback != null) { ProgressCallback(I18N.GetText("FTM:LoadingData"), 0); } for (int i = 0; i < EntryCount; ++i) { Things.SimpleStringTableEntry SSTE = new Things.SimpleStringTableEntry(); if (!SSTE.Read(BR)) { TL.Clear(); break; } if (ProgressCallback != null) { ProgressCallback(null, (double)(i + 1) / EntryCount); } TL.Add(SSTE); } return(TL); }
private void RefreshList() { this.lstNameChanges.Items.Clear(); this.lstNameChanges.Groups.Clear(); ListViewGroup lvgPending = new ListViewGroup("Pending", I18N.GetText("Group:PendingChanges")); this.lstNameChanges.Groups.Add(lvgPending); foreach (NameChange NC in NameChange.Pending) { ListViewItem LVI = this.lstNameChanges.Items.Add(NC.Area); LVI.Tag = NC; LVI.Group = lvgPending; LVI.SubItems.Add(NC.Old); LVI.SubItems.Add(NC.New); } ListViewGroup lvgApplied = new ListViewGroup("Applied", I18N.GetText("Group:AppliedChanges")); this.lstNameChanges.Groups.Add(lvgApplied); foreach (NameChange NC in NameChange.Applied) { ListViewItem LVI = this.lstNameChanges.Items.Add(NC.Area); LVI.Tag = NC; LVI.Group = lvgApplied; LVI.SubItems.Add(NC.Old); LVI.SubItems.Add(NC.New); } this.btnForgetAll.Enabled = this.btnRevertAll.Enabled = (this.lstNameChanges.Items.Count > 0); this.btnDiscardPending.Enabled = this.btnWritePending.Enabled = (lvgPending.Items.Count > 0); NameChange.SaveHistory(); }
public static void Apply(NameChange NC) { if (!NameChange.Pending.Contains(NC)) { return; } { string DATFileName = FFXI.GetFilePath(6720 + (ushort)((NC.ID_ >> 12) & 0xff)); if (DATFileName != null) { FileStream DATFile = new FileStream(DATFileName, FileMode.Open, FileAccess.ReadWrite); BinaryReader BR = new BinaryReader(DATFile, Encoding.ASCII); bool Found = false; while (DATFile.Position < DATFile.Length) { string Name = new string(BR.ReadChars(0x18)).TrimEnd('\0'); uint ID = BR.ReadUInt32(); if (ID == NC.ID_) { Found = true; if (Name != NC.Old_) { if (MessageBox.Show(String.Format(I18N.GetText("Message:OldNameMismatch"), NC.Old_, NC.New_, Name), I18N.GetText("Title:OldNameMismatch"), MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.No) { return; } } break; } } if (!Found) { MessageBox.Show(String.Format(I18N.GetText("Message:EntryNotFound"), NC.ID_, NC.Old_, NC.New_, DATFileName), I18N.GetText("Title:EntryNotFound"), MessageBoxButtons.OK, MessageBoxIcon.Error); return; } string NewName = NC.New_.PadRight(0x18, '\0'); DATFile.Position -= 0x1C; DATFile.Write(Encoding.ASCII.GetBytes(NewName), 0, 0x18); DATFile.Close(); } } NameChange.Pending.Remove(NC); foreach (NameChange ANC in NameChange.Applied) { if (ANC.ID == NC.ID) { if (ANC.Old_ == NC.New_) // Reverting existing applied change { NameChange.Applied.Remove(ANC); } else { ANC.New_ = NC.New_; } return; } } NameChange.Applied.Add(NC); }
public string GetName() { //GameDataFileAccessor access = new GameDataFileAccessor(); //BlueSheep.Common.Data.DataCenter.Fight.Spell spell = (BlueSheep.Common.Data.DataCenter.Fight.Spell)access.GetObject("Spells",Id); DataClass spell = GameData.GetDataObject(D2oFileEnum.Spells, Id); return(I18N.GetText((int)spell.Fields["nameId"])); }
private void btnTranslateDialogTables_Click(object sender, System.EventArgs e) { for (ushort i = 0; i < 0x100; ++i) { this.SwapFile(6120 + i, 6420 + i); } this.AddLogEntry(I18N.GetText("DialogTableTranslateDone")); }
private OpenFileDialog CreateLoadItemsDialog() { OpenFileDialog OFD = new OpenFileDialog(); OFD.Title = I18N.GetText("OpenDialog:Title"); OFD.Filter = I18N.GetText("OpenDialog:Filter"); return(OFD); }
private void btnRestoreDialogTables_Click(object sender, System.EventArgs e) { for (ushort i = 0; i < 0x100; ++i) { this.RestoreFile(6120 + i); } this.AddLogEntry(I18N.GetText("DialogTableRestoreDone")); }
public override ThingList Load(BinaryReader BR, ProgressCallback ProgressCallback) { ThingList TL = new ThingList(); if (ProgressCallback != null) { ProgressCallback(I18N.GetText("FTM:CheckingFile"), 0); } if ((BR.BaseStream.Length % 0x20) != 0 || BR.BaseStream.Position != 0) { return(TL); } long EntryCount = BR.BaseStream.Length / 0x20; if (ProgressCallback != null) { ProgressCallback(I18N.GetText("FTM:LoadingData"), 0); } try { int ZoneID = -1; for (int i = 0; i < EntryCount; ++i) { Things.MobListEntry MLE = new Things.MobListEntry(); if (!MLE.Read(BR)) { TL.Clear(); break; } uint ThisID = (uint)MLE.GetFieldValue("id"); if (i == 0 && (ThisID != 0 || MLE.GetFieldText("name") != "none")) { TL.Clear(); break; } else if (i > 0) // Entire file should be for 1 specific zone { int ThisZone = (int)(ThisID & 0x000FF000); if (ZoneID < 0) { ZoneID = ThisZone; } else if (ThisZone != ZoneID) { TL.Clear(); break; } } if (ProgressCallback != null) { ProgressCallback(null, (double)(i + 1) / EntryCount); } TL.Add(MLE); } } catch { TL.Clear(); } return(TL); }
private void Start() { actionText = actionButton.GetComponentInChildren <TextMeshProUGUI>(); harvestText = harvestButton.GetComponentInChildren <TextMeshProUGUI>(); moveText = moveButton.GetComponentInChildren <TextMeshProUGUI>(); skipText = skipButton.GetComponentInChildren <TextMeshProUGUI>(); actionText.text = I18N.GetText("selectAction"); }
private void TranslateAbilityFile(int JPFileNumber, int ENFileNumber) { if (!this.mnuTranslateAbilityNames.Checked && !this.mnuTranslateAbilityDescriptions.Checked) { return; } if (!this.BackupFile(JPFileNumber)) { return; } try { string JFileName = FFXI.GetFilePath(JPFileNumber); string EFileName = FFXI.GetFilePath(ENFileNumber); this.AddLogEntry(String.Format(I18N.GetText("TranslatingAbilities"), JFileName)); this.AddLogEntry(String.Format(I18N.GetText("UsingEnglishFile"), EFileName)); FileStream JFileStream = new FileStream(JFileName, FileMode.Open, FileAccess.ReadWrite, FileShare.None); FileStream EFileStream = new FileStream(EFileName, FileMode.Open, FileAccess.Read); if ((JFileStream.Length % 0x400) != 0 || (EFileStream.Length % 0x400) != 0) { this.AddLogEntry(I18N.GetText("AbilityFileSizeBad")); goto TranslationDone; } if (JFileStream.Length != EFileStream.Length) { this.AddLogEntry(I18N.GetText("FileSizeMismatch")); goto TranslationDone; } long AbilityCount = JFileStream.Length / 0x400; byte[] JTextBlock = new byte[0x120]; byte[] ETextBlock = new byte[0x120]; for (long i = 0; i < AbilityCount; ++i) { JFileStream.Seek(i * 0x400 + 0xa, SeekOrigin.Begin); JFileStream.Read(JTextBlock, 0, 0x120); EFileStream.Seek(i * 0x400 + 0xa, SeekOrigin.Begin); EFileStream.Read(ETextBlock, 0, 0x120); if (this.mnuTranslateAbilityNames.Checked) { Array.Copy(ETextBlock, 0x00, JTextBlock, 0x00, 0x020); } if (this.mnuTranslateAbilityDescriptions.Checked) { Array.Copy(ETextBlock, 0x20, JTextBlock, 0x20, 0x100); } JFileStream.Seek(i * 0x400 + 0xa, SeekOrigin.Begin); JFileStream.Write(JTextBlock, 0, 0x120); } TranslationDone: JFileStream.Close(); EFileStream.Close(); } catch { this.LogFailure("TranslateAbilityFile"); } }
private void btnTranslateItemData_Click(object sender, System.EventArgs e) { this.TranslateItemFile(4, 73); this.TranslateItemFile(5, 74); this.TranslateItemFile(6, 75); this.TranslateItemFile(7, 76); this.TranslateItemFile(8, 77); this.AddLogEntry(I18N.GetText("ItemTranslateDone")); }
private void btnForgetAll_Click(object sender, EventArgs e) { if (MessageBox.Show(this, I18N.GetText("Message:ForgetAll"), I18N.GetText("Title:ForgetAll"), MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button2) == DialogResult.Yes) { NameChange.Applied.Clear(); NameChange.Pending.Clear(); this.RefreshList(); } }
private void btnRestoreItemData_Click(object sender, System.EventArgs e) { this.RestoreFile(4); this.RestoreFile(5); this.RestoreFile(6); this.RestoreFile(7); this.RestoreFile(8); this.AddLogEntry(I18N.GetText("ItemRestoreDone")); }
public MainWindow() { this.InitializeComponent(); this.Icon = Icons.POLConfig; this.picWarning.Image = Icons.POLConfigWarn.ToBitmap(); this.lblWarning.Text = I18N.GetText("SettingsWarning"); this.cmbCharacters.Items.Clear(); foreach (Character C in Game.Characters) { CharacterConfig CC = new CharacterConfig(C); if (CC.Colors != null) { this.cmbCharacters.Items.Add(CC); } } if (this.cmbCharacters.Items.Count == 0) { this.grpCharConfig.Visible = false; this.Height -= this.grpCharConfig.Height + this.grpCharConfig.Top - (this.grpGlobalConfig.Top + this.grpGlobalConfig.Height); } else { this.ColorLabels = new Label[] { this.lblColor1, this.lblColor2, this.lblColor3, this.lblColor4, this.lblColor5, this.lblColor6, this.lblColor7, this.lblColor8, this.lblColor9, this.lblColor10, this.lblColor11, this.lblColor12, this.lblColor13, this.lblColor14, this.lblColor15, this.lblColor16, this.lblColor17, this.lblColor18, this.lblColor19, this.lblColor20, this.lblColor21, this.lblColor22, this.lblColor23 }; // TODO: Take these from the relevant string table (entries 32-54 (and/or 55-77) of E0-97-39/J0-97-21) this.lblColor1.Tag = "Say"; this.lblColor2.Tag = "Shout"; this.lblColor3.Tag = "Tell"; this.lblColor4.Tag = "Party"; this.lblColor5.Tag = "Linkshell"; this.lblColor6.Tag = "Message"; this.lblColor7.Tag = "Emote"; this.lblColor8.Tag = "NPC"; this.lblColor9.Tag = "(Self) HP/MP Recovered"; this.lblColor10.Tag = "(Self) HP/MP Lost"; this.lblColor11.Tag = "(Self) Beneficial Effects Received"; this.lblColor12.Tag = "(Self) Detrimental Effects Received"; this.lblColor13.Tag = "(Self) Resisted Effects"; this.lblColor14.Tag = "(Self) Evaded Effects"; this.lblColor15.Tag = "(Other) HP/MP Recovered"; this.lblColor16.Tag = "(Other) HP/MP Lost"; this.lblColor17.Tag = "(Other) Beneficial Effects Received"; this.lblColor18.Tag = "(Other) Detrimental Effects Received"; this.lblColor19.Tag = "(Other) Resisted Effects"; this.lblColor20.Tag = "(Self) Evaded Effects"; this.lblColor21.Tag = "Battle Message"; this.lblColor22.Tag = "Call For Help"; this.lblColor23.Tag = "System Message"; } this.LoadSettings(); }
/// <summary> /// Actualize and display the new location. /// </summary> public void ParseLocation(int mapId, int subAreaId) { Data = BlueSheep.Data.D2p.MapsManager.FromId(mapId); Data.SubAreaId = subAreaId; DataClass subArea = GameData.GetDataObject(D2oFileEnum.SubAreas, subAreaId); string mapName = I18N.GetText((int)GameData.GetDataObject(D2oFileEnum.Areas, (int)subArea.Fields["areaId"]).Fields["nameId"]); string subAreaName = I18N.GetText((int)subArea.Fields["nameId"]); m_Account.ModifBar(5, 0, 0, "[" + X + ";" + Y + "]" + " " + mapName + " (" + subAreaName + ")"); }
private Program() { // Prepare dialogs this._dlgOldFile.DefaultExt = "xml"; this._dlgOldFile.Filter = I18N.GetText("FileFilter"); this._dlgOldFile.Title = I18N.GetText("Title:OldFile"); this._dlgNewFile.DefaultExt = "xml"; this._dlgNewFile.Filter = I18N.GetText("FileFilter"); this._dlgNewFile.Title = I18N.GetText("Title:NewFile"); }
public void Reset(int Channels, int BlockSize) { if (Channels <= 0 || Channels > 6) { throw new ArgumentException(I18N.GetText("ADPCMBadChannelCount"), "Channels"); } this.Channels = Channels; this.BlockSize = BlockSize; this.DecoderState = new int[2 * Channels]; }
private void InitializeResultsPane() { this.lstItems.Items.Clear(); this.lstItems.HeaderStyle = ColumnHeaderStyle.Nonclickable; this.ilItemIcons.Images.Clear(); this.SearchResults_.Clear(); this.stbStatus.Visible = true; this.stbStatus.Text = String.Format(I18N.GetText("Status:ItemSearch"), this.lstItems.Items.Count); Application.DoEvents(); }
public override string GetFieldText(string Field) { switch (Field) { // Objects case "category": return(this.Category_); case "format": return(this.Format_); case "id": return(this.ID_); case "image": return(I18N.GetText("ImageText")); // Nullables case "bits": return(!this.BitCount_.HasValue ? String.Empty : this.BitCount_.Value.ToString()); case "compression": return(!this.Compression_.HasValue ? String.Empty : this.Compression_.Value.ToString()); case "flag": return(!this.Flag_.HasValue ? String.Empty : String.Format("{0:X2}", this.Flag_.Value)); case "height": return(!this.Height_.HasValue ? String.Empty : this.Height_.Value.ToString()); case "horizontal-resolution": return(!this.HorizontalResolution_.HasValue ? String.Empty : this.HorizontalResolution_.Value.ToString()); case "important-colors": return(!this.ImportantColors_.HasValue ? String.Empty : this.ImportantColors_.Value.ToString()); case "planes": return(!this.Planes_.HasValue ? String.Empty : this.Planes_.Value.ToString()); case "size": return(!this.ImageSize_.HasValue ? String.Empty : this.ImageSize_.Value.ToString()); case "used-colors": return(!this.UsedColors_.HasValue ? String.Empty : this.UsedColors_.Value.ToString()); case "vertical-resolution": return(!this.VerticalResolution_.HasValue ? String.Empty : this.VerticalResolution_.Value.ToString()); case "width": return(!this.Width_.HasValue ? String.Empty : this.Width_.Value.ToString()); default: return(null); } }
private void FinalizeResultsPane() { foreach (ColumnHeader CH in this.lstItems.Columns) { CH.Width = -1; CH.Width += 2; } this.lstItems.HeaderStyle = ColumnHeaderStyle.Clickable; this.mnuILCEResults.Enabled = (this.lstItems.Items.Count > 0); this.stbStatus.Text = String.Format(I18N.GetText("Status:ItemSearchDone"), this.lstItems.Items.Count, this.Items_.Count); }
/// <summary> /// Get the spellid from the spell's name using I18n. /// </summary> private int GetSpellIdFromName(string name) { DataClass[] datas = GameData.GetDataObjects(D2oFileEnum.Spells); foreach (DataClass d in datas) { if (I18N.GetText((int)d.Fields["nameId"]).ToUpper() == name.ToUpper()) { return((int)d.Fields["id"]); } } return(-1); }
protected void LoadThingField(XmlElement Node, IThing T) { XmlElement ThingRoot = Node.SelectSingleNode(String.Format("./child::thing[@type = '{0}']", T.GetType().Name)) as XmlElement; if (ThingRoot != null) { T.Load(ThingRoot); } else { throw new ArgumentException(String.Format(I18N.GetText("InvalidThingField"), T.TypeName)); } }
public static int Main(string[] Arguments) { AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(POLUtils.KaBOOM); Application.EnableVisualStyles(); if (POL.AvailableRegions == POL.Region.None) { MessageBox.Show(I18N.GetText("Text:NoPOL"), I18N.GetText("Caption:NoPOL"), MessageBoxButtons.OK, MessageBoxIcon.Stop); } else { POLUtils.AvailableCultures = new ArrayList(); string LastCulture = String.Empty; using (RegistryKey SettingsKey = POL.OpenPOLUtilsConfigKey()) { if (SettingsKey != null) { LastCulture = SettingsKey.GetValue("UI Culture", null) as string; if (LastCulture == null) { LastCulture = String.Empty; } } } // Detect Available Languages POLUtils.AvailableCultures.Add(new CultureChoice(CultureInfo.InvariantCulture)); foreach (CultureInfo CI in CultureInfo.GetCultures(CultureTypes.AllCultures)) { if (CI.Name != String.Empty && Directory.Exists(Path.Combine(Application.StartupPath, CI.Name))) { CultureChoice CC = new CultureChoice(CI); POLUtils.AvailableCultures.Add(CC); if (LastCulture != String.Empty && LastCulture == CC.Culture.Name) { CultureChoice.Current = CC; } } } if (CultureChoice.Current == null) // if none configured, default to invariant culture { CultureChoice.Current = POLUtils.AvailableCultures[0] as CultureChoice; } // The loop is for the benefit of language change POLUtils.KeepGoing = true; while (POLUtils.KeepGoing) { POLUtils.KeepGoing = false; Application.Run(new POLUtilsUI()); } } return(0); }
private void LoadItems(string FileName, ItemEditor IE) { this.PWD = new PleaseWaitDialog(I18N.GetText("Dialog:LoadItems")); Thread T = new Thread(new ThreadStart(delegate() { this.LoadItemsWorker(FileName, IE); })); T.CurrentUICulture = Thread.CurrentThread.CurrentUICulture; T.Start(); PWD.ShowDialog(this); this.Activate(); this.PWD.Dispose(); this.PWD = null; this.EnableNavigation(); this.MarkItemChanges(); }
private static void ExtractFile(int FileNumber, string OutputFile) { string ROMPath; ROMPath = FFXI.GetFilePath(FileNumber, TargetApp); if (ROMPath == null || !File.Exists(ROMPath)) { Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine(I18N.GetText("BadFileID"), FileNumber, OutputFile); Console.ForegroundColor = ConsoleColor.White; return; } Program.ExtractFile(ROMPath, OutputFile); }
private string BuildItemName(XmlNode XName) { if (XName == null) { return("???"); } string ItemName = String.Empty; foreach (XmlNode XN in XName.ChildNodes) { if (XN is XmlText) { ItemName += XN.InnerText; } else if (XN is XmlElement) { XmlElement XE = XN as XmlElement; if (XE.Name == "i18n-string" && XE.HasAttribute("id")) { ItemName += I18N.GetText(XE.Attributes["id"].InnerText); } else if (XE.Name == "area-name" && XE.HasAttribute("id")) { ushort ID = 0; try { ID = ushort.Parse(XE.Attributes["id"].InnerText); } catch {} ItemName += FFXIResourceManager.GetAreaName(ID); } else if (XE.Name == "region-name" && XE.HasAttribute("id")) { ushort ID = 0; try { ID = ushort.Parse(XE.Attributes["id"].InnerText); } catch {} ItemName += FFXIResourceManager.GetRegionName(ID); } else { ItemName += '?' + XE.Name + '?'; } } } return(ItemName); }
private void RemoveUnchangedItems() { this.btnRemoveUnchanged.Enabled = false; this.PWD = new PleaseWaitDialog(I18N.GetText("Dialog:RemoveUnchanged")); Thread T = new Thread(new ThreadStart(delegate() { this.RemoveUnchangedItemsWorker(); })); T.CurrentUICulture = Thread.CurrentThread.CurrentUICulture; T.Start(); PWD.ShowDialog(this); this.Activate(); this.PWD.Dispose(); this.PWD = null; this.EnableNavigation(); this.MarkItemChanges(); }
public static void AchievementFinishedTreatment(Message message, byte[] packetDatas, AccountUC account) { AchievementFinishedMessage msg = (AchievementFinishedMessage)message; using (BigEndianReader reader = new BigEndianReader(packetDatas)) { msg.Deserialize(reader); } DataClass d = GameData.GetDataObject(D2oFileEnum.Achievements, msg.id); account.Log(new ActionTextInformation("Succès débloqué : " + I18N.GetText((int)d.Fields["nameId"])), 3); AchievementRewardRequestMessage nmsg = new AchievementRewardRequestMessage(-1); account.SocketManager.Send(nmsg); }
private void SwapFile(int JPFileNumber, int ENFileNumber) { try { if (!this.BackupFile(JPFileNumber)) { return; } string SourceFile = FFXI.GetFilePath(ENFileNumber); string TargetFile = FFXI.GetFilePath(JPFileNumber); this.AddLogEntry(String.Format(I18N.GetText("ReplaceJPROM"), TargetFile)); this.AddLogEntry(String.Format(I18N.GetText("SourceENROM"), SourceFile)); File.Copy(SourceFile, TargetFile, true); } catch { this.LogFailure("SwapFile"); } }
private void btnRevertAll_Click(object sender, EventArgs e) { if (MessageBox.Show(this, I18N.GetText("Message:RevertAll"), I18N.GetText("Title:RevertAll"), MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button2) == DialogResult.Yes) { NameChange.Pending.Clear(); foreach (NameChange NC in NameChange.Applied) { NameChange.Revert(NC); } while (NameChange.Pending.Count > 0) { NameChange.Apply(NameChange.Pending[0]); } this.RefreshList(); } }