public RenderModel(BinaryReader binaryReader) { this.name = binaryReader.ReadStringID(); this.flags = (Flags)binaryReader.ReadInt16(); this.padding = binaryReader.ReadBytes(2); this.padding0 = binaryReader.ReadBytes(4); this.importInfo = ReadImportinfo(binaryReader); this.compressionInfo = ReadCompressioninfo(binaryReader); this.regions = ReadRegions(binaryReader); this.sections = ReadSections(binaryReader); this.invalidSectionPairBits = ReadInvalidsectionpairbits(binaryReader); this.sectionGroups = ReadSectiongroups(binaryReader); this.l1SectionGroupIndexSuperLow = binaryReader.ReadByte(); this.l2SectionGroupIndexLow = binaryReader.ReadByte(); this.l3SectionGroupIndexMedium = binaryReader.ReadByte(); this.l4SectionGroupIndexHigh = binaryReader.ReadByte(); this.l5SectionGroupIndexSuperHigh = binaryReader.ReadByte(); this.l6SectionGroupIndexHollywood = binaryReader.ReadByte(); this.padding1 = binaryReader.ReadBytes(2); this.nodeListChecksum = binaryReader.ReadInt32(); this.nodes = ReadNodes(binaryReader); this.nodeMapOLD = ReadNodemapold(binaryReader); this.markerGroups = ReadMarkergroups(binaryReader); this.materials = ReadMaterials(binaryReader); this.errors = ReadErrors(binaryReader); this.dontDrawOverCameraCosineAngleDontDrawFpModelWhenCameraThisAngleCosine11Sugg020Disables = binaryReader.ReadSingle(); this.pRTInfo = ReadPrtinfo(binaryReader); this.sectionRenderLeaves = ReadSectionrenderleaves(binaryReader); }
public int GetIndex(StringID strID) { var stringId = (int)strID.Value; // Get the set and index var set = stringId >> 16; // Set = upper 16 bits var index = stringId & 0xFFFF; // Index = lower 16 bits int strIndex; if (set == 0 && (index < SetMin || index > SetMax)) { // Value does not go into a set, so the index is the same as the ID strIndex = index; } else { if (set < 0 || set >= _setOffsets.Length) return -1; // Invalid set number // Convert the index part of the ID into a string index based on its set if (set == 0) index -= SetMin; strIndex = index + _setOffsets[set]; } if (strIndex < 0 || strIndex >= _strings.Count) return -1; return strIndex; }
/// <summary> /// Gets the string corresponding to a stringID. /// </summary> /// <param name="stringId">The stringID.</param> /// <returns>The string corresponding to the stringID, or <c>null</c> if not found.</returns> public string GetString(StringID stringId) { var strIndex = Resolver.StringIDToIndex(stringId); if (strIndex < 0 || strIndex >= _strings.Count) return null; return _strings[strIndex]; }
/// <summary> /// Translates a string index into a stringID which can be written to the file. /// </summary> /// <param name="index">The index of the string in the RawStrings list.</param> /// <returns>The stringID associated with the index.</returns> public int StringIDToIndex(StringID id) { if (_buildInfo.StringIDResolver != null) return _buildInfo.StringIDResolver.StringIDToIndex(id); else return id.Value; }
/// <summary> /// Returns the string that corresponds with the specified StringID. /// </summary> /// <param name="id">The StringID of the string to retrieve.</param> /// <returns>The string if it exists, or null otherwise.</returns> public string GetString(StringID id) { int index = StringIDToIndex(id); if (index > 0 && index < RawStrings.Count) return RawStrings[index]; return null; }
private void Load(StructureValueCollection values, IReader reader, FileSegmentGroup metaArea, EngineDescription buildInfo) { Name = new StringID(values.GetInteger("name stringid")); LoadPermutations(values, reader, metaArea, buildInfo); }
private void Load(StructureValueCollection values) { Magic = (int)values.GetNumber("magic"); ParentMagic = (int)values.GetNumber("parent magic"); GrandparentMagic = (int)values.GetNumber("grandparent magic"); Description = new StringID((int)values.GetNumberOrDefault("stringid", 0)); }
private static string SafeGetString(StringID id) { if (strings.ContainsKey(id)) { return strings[id]; } return id.ToString(); }
public LocalizedString() { StringID = StringID.Null; StringIDStr = ""; Offsets = new int[12]; for (var i = 0; i < Offsets.Length; i++) Offsets[i] = -1; }
private void Load(StructureValueCollection values, StringID[] stringIds) { SoundName = stringIds[values.GetInteger("sound name index")]; ParametersIndex = (int)values.GetInteger("parameters index"); FirstRuntimePermutationFlagIndex = (int)values.GetInteger("first runtime permutation flag index"); EncodedPermutationCount = ((int)values.GetInteger("encoded permutation count") >> 4) & 63; FirstPermutationIndex = (int)values.GetInteger("first permutation index"); }
private void Load(StructureValueCollection values, IReader reader, IPointerExpander expander) { Name = new StringID(values.GetInteger("name stringid")); _activeResources = LoadBitArray(values, "number of raw pool flags", "raw pool flag table address", reader, expander); _unknownResources = LoadBitArray(values, "number of raw pool 2 flags", "raw pool 2 flag table address", reader, expander); _unknownResources2 = LoadBitArray(values, "number of raw pool 3 flags", "raw pool 3 flag table address", reader, expander); _activeTags = LoadBitArray(values, "number of tag flags", "tag flag table address", reader, expander); _unknownTags = LoadBitArray(values, "number of tag 2 flags", "tag 2 flag table address", reader, expander); }
private void Load(StructureValueCollection values, IReader reader) { Name = new StringID(values.GetInteger("name stringid")); _activeResources = LoadBitArray(values, "number of raw pool bitfields", "raw pool bitfield table address", reader); _unknownResources = LoadBitArray(values, "number of raw pool 2 bitfields", "raw pool 2 bitfield table address", reader); _unknownResources2 = LoadBitArray(values, "number of raw pool 3 bitfields", "raw pool 3 bitfield table address", reader); _activeTags = LoadBitArray(values, "number of tag bitfields", "tag bitfield table address", reader); _unknownTags = LoadBitArray(values, "number of tag 2 bitfields", "tag 2 bitfield table address", reader); }
private void FixStringIdReferences(DataBlock block, IWriter buffer) { foreach (DataBlockStringIDFixup fixup in block.StringIDFixups) { StringID newSID = InjectStringID(fixup.OriginalString); buffer.SeekTo(fixup.WriteOffset); buffer.WriteUInt32(newSID.Value); } }
/// <summary> /// Gets a localized string for Arabic culture, for specified <see cref="StringID"/>. /// </summary> /// <param name="id"></param> /// <returns></returns> public override string GetLocalizedString(StringID id) { switch (id) { case StringID.FAMonthView_None: return "امح"; case StringID.FAMonthView_Today: return "اليوم"; } return base.GetLocalizedString(id); }
/// <summary> /// Gets the string corresponding to a stringID. /// </summary> /// <param name="stringId">The stringID.</param> /// <returns>The string corresponding to the stringID, or <c>null</c> if not found.</returns> public string GetString(StringID stringId) { var strIndex = Resolver.StringIDToIndex(stringId); if (strIndex < 0 || strIndex >= _strings.Count) { return(null); } return(_strings[strIndex]); }
public override int StringIDToIndex(StringID id) { return(GetIndex(id)); //if (_resolver != null) // return _resolver.StringIDToIndex(id); //return -1; }
/// <summary> /// Gets a localized string for Arabic culture, for specified <see cref="StringID"/>. /// </summary> /// <param name="id"></param> /// <returns></returns> public override string GetLocalizedString(StringID id) { switch (id) { case StringID.FAMonthView_None: return("امح"); case StringID.FAMonthView_Today: return("اليوم"); } return(base.GetLocalizedString(id)); }
public override string GetLocalizedString(StringID id) { switch(id) { case StringID.Validation_NullText: return "<Ningun fecha esta seleccionada>"; case StringID.FAMonthView_None : return "Nada"; case StringID.FAMonthView_Today: return "¡Hoy!"; } return base.GetLocalizedString(id); }
public override bool Equals(object other) { var sID = other as SerializableId; if (sID == null) { return(false); } return(IntID.Equals(sID.IntID) && StringID.Equals(sID.StringID)); }
private void Load(StructureValueCollection values, StringID[] stringIds) { SoundName = stringIds[values.GetInteger("sound name index")]; EncodedSkipFraction = (int)values.GetInteger("encoded skip fraction"); EncodedGain = (int)values.GetInteger("encoded gain"); PermutationInfoIndex = (int)values.GetInteger("permutation info index"); LanguageNeutralTime = (int)values.GetInteger("language neutral time"); PermutationChunkIndex = (int)values.GetInteger("raw chunk index"); ChunkCount = (int)values.GetInteger("chunk count"); EncodedPermutationIndex = (int)values.GetInteger("encoded permutation index"); }
private StringID InjectStringID(string str) { // Try to find the string, and if it's not found, inject it StringID newSID = _cacheFile.StringIDs.FindStringID(str); if (newSID == StringID.Null) { newSID = _cacheFile.StringIDs.AddString(str); _injectedStrings.Add(newSID); } return(newSID); }
/// <summary> /// Creates an ID object /// </summary> /// <param name="Expression">Expression</param> /// <returns>ID object</returns> public IID <ClassType, string> ID(Expression <Func <ClassType, string> > Expression) { if (IDProperty != null) { throw new NotSupportedException("Multiple IDs are not currently supported"); } Setup(); StringID <ClassType> Return = new StringID <ClassType>(Expression, this); IDProperty = Return; return(Return); }
public static string GetString(StringID id) { switch (id) { case StringID.OpenSlashDocFileCaption: return "&Open SlashDoc File"; case StringID.OpenSlashDocFileToolTip: return "&Opens the external SlashDoc documentation file for the current method."; default: Diagnostics.DiagnosticService.TraceError("String resource with id '{0}' was not found.", id); return ""; } }
private string GetObjectName(StructureValueCollection values, StringIDSource stringIDs) { if (values.HasString("name")) { return(values.GetString("name")); } if (values.HasInteger("name stringid")) { var sid = new StringID(values.GetInteger("name stringid")); return(stringIDs.GetString(sid)); } throw new InvalidOperationException("Unable to determine the name of objects in the \"" + _layoutName + "\" layout"); }
/// <summary> /// Begins building a new model region. /// </summary> /// <param name="name">The name stringID.</param> /// <exception cref="System.InvalidOperationException">Cannot begin a new region while another is active</exception> public void BeginRegion(StringID name) { if (_currentRegion != null) { throw new InvalidOperationException("Cannot begin a new region while another is active"); } _currentRegion = new RenderModel.Region { Name = name, Permutations = new List <RenderModel.Region.Permutation>(), }; }
private string GetObjectName(StructureValueCollection values, StringIDSource stringIDs) { if (values.HasString("name")) { return values.GetString("name"); } if (values.HasInteger("name stringid")) { var sid = new StringID(values.GetInteger("name stringid")); return stringIDs.GetString(sid); } throw new InvalidOperationException("Unable to determine the name of objects in the \"" + _layoutName + "\" layout"); }
public override string GetLocalizedString(StringID id) { switch (id) { case StringID.Validation_NullText: return("<Ningun fecha esta seleccionada>"); case StringID.FAMonthView_None: return("Nada"); case StringID.FAMonthView_Today: return("¡Hoy!"); } return(base.GetLocalizedString(id)); }
public override string GetLocalizedString(StringID id) { switch (id) { case StringID.Empty: return string.Empty; case StringID.Numbers_0: return "0"; case StringID.Numbers_1: return "1"; case StringID.Numbers_2: return "2"; case StringID.Numbers_3: return "3"; case StringID.Numbers_4: return "4"; case StringID.Numbers_5: return "5"; case StringID.Numbers_6: return "6"; case StringID.Numbers_7: return "7"; case StringID.Numbers_8: return "8"; case StringID.Numbers_9: return "9"; case StringID.FADateTextBox_Required: return "Mandatory field"; case StringID.FAMonthView_None: return "Empty"; case StringID.FAMonthView_Today: return "Today"; case StringID.PersianDate_InvalidDateFormat: return "Invalid date format"; case StringID.PersianDate_InvalidDateTime: return "Invalid date/time value"; case StringID.PersianDate_InvalidDateTimeLength: return "Invalid date time format"; case StringID.PersianDate_InvalidDay: return "Invalid Day value"; case StringID.PersianDate_InvalidEra: return "Invalid Era value"; case StringID.PersianDate_InvalidFourDigitYear: return "Invalid four digit Year value"; case StringID.PersianDate_InvalidHour: return "Invalid Hour value"; case StringID.PersianDate_InvalidLeapYear: return "Not a leap year. Correct the day value."; case StringID.PersianDate_InvalidMinute: return "Invalid Minute value"; case StringID.PersianDate_InvalidMonth: return "Invalid Month value"; case StringID.PersianDate_InvalidMonthDay: return "Invalid Month/Day value"; case StringID.PersianDate_InvalidSecond: return "Invalid Second value"; case StringID.PersianDate_InvalidTimeFormat: return "Invalid Time format"; case StringID.PersianDate_InvalidYear: return "Invalid Year value."; case StringID.Validation_Cancel: return "Cancel"; case StringID.Validation_NotValid: return "Entered value is not in valid range."; case StringID.Validation_Required: return "This is a mandatory field. Please fill it in."; case StringID.Validation_NullText: return "[Empty Value]"; case StringID.MessageBox_Ok: return "Ok"; case StringID.MessageBox_Abort: return "Abort"; case StringID.MessageBox_Cancel: return "Cancel"; case StringID.MessageBox_Ignore: return "Ignore"; case StringID.MessageBox_No: return "No"; case StringID.MessageBox_Retry: return "Retry"; case StringID.MessageBox_Yes: return "Yes"; } return string.Empty; }
public override string GetLocalizedString(StringID id) { switch (id) { case StringID.Empty: return string.Empty; case StringID.Numbers_0: return "۰"; case StringID.Numbers_1: return "۱"; case StringID.Numbers_2: return "۲"; case StringID.Numbers_3: return "۳"; case StringID.Numbers_4: return "۴"; case StringID.Numbers_5: return "۵"; case StringID.Numbers_6: return "۶"; case StringID.Numbers_7: return "۷"; case StringID.Numbers_8: return "۸"; case StringID.Numbers_9: return "۹"; case StringID.FADateTextBox_Required: return "فيلد اجباری میباشد"; case StringID.FAMonthView_None: return "خالی"; case StringID.FAMonthView_Today: return "امروز"; case StringID.PersianDate_InvalidDateFormat: return "ساختار تاریخ مجاز نمیباشد."; case StringID.PersianDate_InvalidDateTime: return "مقدار زمان/ساعت صحیح نمیباشد."; case StringID.PersianDate_InvalidDateTimeLength: return "متن وارد شده برای زمان/ساعت صحیح نمیباشد."; case StringID.PersianDate_InvalidDay: return "مقدار روز صحیح نمیباشد."; case StringID.PersianDate_InvalidEra: return "محدوده وارد شده صحیح نمیباشد."; case StringID.PersianDate_InvalidFourDigitYear: return "مقدار وارد شده را نمیتوان به سال تبدیل کرد."; case StringID.PersianDate_InvalidHour: return "مقدار ساعت صحیح نمیباشد."; case StringID.PersianDate_InvalidLeapYear: return "این سال ، سال کبیسه نیست. مقدار روز صحیح نمیباشد."; case StringID.PersianDate_InvalidMinute: return "مقدار دقیقه صحیح نمیباشد."; case StringID.PersianDate_InvalidMonth: return "مقدار ماه صحیح نمیباشد."; case StringID.PersianDate_InvalidMonthDay: return "مقدار ماه/روز صحیح نمیباشد."; case StringID.PersianDate_InvalidSecond: return "مقدار ثانیه صحیح نمیباشد."; case StringID.PersianDate_InvalidTimeFormat: return "ساختار زمان صحیح نمیباشد."; case StringID.PersianDate_InvalidYear: return "مقدار سال صحیح نمیباشد."; case StringID.Validation_Cancel: return "مقدار انتخاب شده مجاز نمیباشد."; case StringID.Validation_NotValid: return "مقدار انتخاب شده در محدوده مجاز نمیباشد."; case StringID.Validation_Required: return "انتخاب اجباری. لطفا مقداری برای این فیلد وارد کنید."; case StringID.Validation_NullText: return "[هیج مقداری انتخاب نشده]"; case StringID.MessageBox_Ok: return "قبول"; case StringID.MessageBox_Cancel: return "لغو"; case StringID.MessageBox_Abort: return "لغو"; case StringID.MessageBox_Ignore: return "ادامه عملیات"; case StringID.MessageBox_Retry: return "سعی مجدد"; case StringID.MessageBox_No: return "خیر"; case StringID.MessageBox_Yes: return "بله"; } return ""; }
public TagInstance GetTagByIndex(int index) { var tag = _tag.Cache.IndexItems.GetItemByID(index); if (tag == null) return null; var groupTag1 = tag.ClassCode == null ? Tag.Null : new Tag(tag.ClassCode); var groupTag2 = tag.ParentClass == null ? Tag.Null : new Tag(tag.ParentClass); var groupTag3 = tag.ParentClass2 == null ? Tag.Null : new Tag(tag.ParentClass2); var groupName = new StringID((uint)_tag.Cache.IndexItems.ClassList[_tag.ClassIndex].StringID); return new TagInstance(index, new TagGroup(groupTag1, groupTag2, groupTag3, groupName)); }
/// <summary> /// Constructs a new tag group description. /// </summary> /// <param name="tag">The group's tag.</param> /// <param name="parentTag">The parent group's tag. Can be -1.</param> /// <param name="grandparentTag">The grandparent group's tag. Can be -1.</param> /// <param name="name">The group's name stringID.</param> public TagGroup(Tag tag, Tag parentTag, Tag grandparentTag, StringID name) { Tag = tag; ParentTag = parentTag; GrandparentTag = grandparentTag; Name = name; if (Instances == null) { Instances = new Dictionary <Tag, TagGroup>(); } Instances[Tag] = this; }
public Unicode(int Position, string Unicode, int TextLength, int Offset, StringID StringID) { this.position = Position; this.unicode = Unicode; this.textLength = TextLength; this.offset = Offset; this.stringID = StringID; byte[] tempbytes = System.Text.Encoding.UTF8.GetBytes(this.unicode); int change = tempbytes.Length; tempbytes = replaceCodes(tempbytes, true); change = tempbytes.Length - change; // Account for string length changes this.text = System.Text.Encoding.ASCII.GetString(tempbytes).Substring(0, Math.Min(this.textLength + change, tempbytes.Length)); }
// Returns true if the loaded translation file contains all expected // string IDs, or false if not. public bool IsComplete() { bool retval = true; for (StringID sid = (StringID)0; sid < StringID.TOTAL_COUNT; sid++) { if (translationFile.getValue(sid.ToString(), (String)null) == null) { retval = false; break; } } return(retval); }
private void ReadStringID(DataBlock block, uint offset) { SeekToOffset(block, offset); var sid = new StringID(_reader.ReadUInt32()); if (sid != StringID.Null) { string str = _cacheFile.StringIDs.GetString(sid); if (str != null) { var fixup = new DataBlockStringIDFixup(str, (int)offset); block.StringIDFixups.Add(fixup); } } }
private void FixStringIDReferences(DataBlock block, IWriter buffer) { foreach (DataBlockStringIDFixup fixup in block.StringIDFixups) { // Try to find the string, and if it's not found, inject it StringID newSID = _cacheFile.StringIDs.FindStringID(fixup.OriginalString); if (newSID == StringID.Null) { newSID = _cacheFile.StringIDs.AddString(fixup.OriginalString); _injectedStrings.Add(newSID); } buffer.SeekTo(fixup.WriteOffset); buffer.WriteUInt32(newSID.Value); } }
private void filterBox_TextChanged(object sender, EventArgs e) { //Check if (string.IsNullOrEmpty(filterBox.Text) && !isWorking) { //Add to list stringList.BeginUpdate(); stringList.Items.Clear(); foreach (StringID sid in strings) { stringList.Items.Add(sid); } stringList.EndUpdate(); } else if (!isWorking) { ThreadPool.QueueUserWorkItem(state => { //Get Pattern string pattern = (string)state; //Working... isWorking = true; //Match (try/catch) StringID[] matchedIds = new StringID[0]; try { matchedIds = strings.Where(sid => Regex.IsMatch(sid.Text, pattern)).ToArray(); } catch { } Invoke(new MethodInvoker(delegate { //Add to list stringList.BeginUpdate(); stringList.Items.Clear(); foreach (StringID sid in matchedIds) { stringList.Items.Add(sid); } stringList.EndUpdate(); })); //Done isWorking = false; }, filterBox.Text); } }
/// <summary> /// Begins building a new model permutation in the current region. /// </summary> /// <param name="name">The name stringID.</param> /// <exception cref="System.InvalidOperationException"> /// Cannot begin a new permutation if a region is not active /// or /// Cannot begin a new permutation while another is active /// </exception> public void BeginPermutation(StringID name) { if (_currentRegion == null) { throw new InvalidOperationException("Cannot begin a new permutation if a region is not active"); } if (_currentPermutation != null) { throw new InvalidOperationException("Cannot begin a new permutation while another is active"); } _currentPermutation = new RenderModel.Region.Permutation { Name = name, MeshIndex = (short)Meshes.Count, }; }
private void updateUnicodeFromStringID() { StringID SID = (StringID)lbStringIDs.SelectedItem; if (SID == null) { return; } lbUnicodes.Enabled = false; if (cbShowAllUnicodes.Checked) { lbUnicodes.DataSource = unicodes; if (SID.unicodes.Count > 0) { lbUnicodes.SelectedItem = SID.unicodes[0]; } } else { lbUnicodes.DataSource = SID.unicodes; // Sometimes it doesn't properly select a default item and throws errors, so refresh to fix ((CurrencyManager)lbUnicodes.BindingContext[lbUnicodes.DataSource]).Refresh(); #if DEBUG /* * This is for debugging of unknown unicode codes only */ if (SID.unicodes.Count > 0 && SID.unicodes[0].ToString().Contains("???")) { string s = SID.unicodes[0].unicode.ToString(); byte[] tempbytes = System.Text.Encoding.Unicode.GetBytes(s); string temps = "Unknown Codes:\n"; for (int i = 0; i < tempbytes.Length; i++) { if (tempbytes[i] == 238) { temps += tempbytes[i].ToString() + " " + tempbytes[i + 1].ToString() + " " + tempbytes[i + 2].ToString() + "\n"; } } MessageBox.Show(temps); } #endif } lbUnicodes.Enabled = true; }
public void VisitStringID(StringIDData field) { SeekToOffset(field.Offset); if (_stringIdTrie.Contains(field.Value)) { StringID sid = _cache.StringIDs.FindStringID(field.Value); _writer.WriteUInt32(sid.Value); } else if (_type == SaveType.File) { StringID sid = _cache.StringIDs.AddString(field.Value); _stringIdTrie.Add(field.Value); _writer.WriteUInt32(sid.Value); } else { _writer.WriteUInt32(StringID.Null.Value); } }
// Returns the translated string, or a string representation of the // string ID if the translation isn't available. public String GetTranslatedString(StringID sid) { string retval; retval = translationFile.getValue(sid.ToString(), ""); // Check the default translation if string is not found in the loaded translation if (String.IsNullOrEmpty(retval)) { retval = defaultFile.getValue(sid.ToString(), ""); } // If it's not found in the default, return a placeholder string if (String.IsNullOrEmpty(retval)) { retval = "%" + sid.ToString() + "%"; } return(retval); }
public static StringID ConvertStringID(StringID stringId, OpenTagCache srcInfo, OpenTagCache destInfo) { if (stringId == StringID.Null) { return(stringId); } var srcString = srcInfo.StringIDs.GetString(stringId); if (srcString == null) { return(StringID.Null); } var destStringID = destInfo.StringIDs.GetStringID(srcString); if (destStringID == StringID.Null) { destStringID = destInfo.StringIDs.Add(srcString); } return(destStringID); }
/// <summary> /// Converts a stringID value to a string list index. /// </summary> /// <param name="stringId">The stringID.</param> /// <returns>The string list index, or -1 if none.</returns> public int StringIDToIndex(StringID stringId) { var setMin = GetMinSetStringIndex(); var setMax = GetMaxSetStringIndex(); var setOffsets = GetSetOffsets(); var set = stringId.Set; var index = stringId.Index; if (set == 0 && (index < setMin || index > setMax)) { // Value does not go into a set, so the index is the same as the ID return index; } if (set < 0 || set >= setOffsets.Length) return -1; // Invalid set number // Convert the index part of the ID into a string index based on its set if (set == 0) index -= setMin; return index + setOffsets[set]; }
private void cbShowAllUnicodes_CheckedChanged(object sender, EventArgs e) { object o = lbUnicodes.SelectedItem; if (cbShowAllUnicodes.Checked) { lbUnicodes.DataSource = unicodes; } else { StringID SID = (StringID)lbStringIDs.SelectedItem; lbUnicodes.DataSource = SID.unicodes; } try { lbUnicodes.SelectedItem = o; } catch { } sortUnicodeLists(); }
/// <summary> /// Reads the header for the tag instance from a stream. /// </summary> /// <param name="reader">The stream to read from.</param> internal void ReadHeader(BinaryReader reader) { Checksum = reader.ReadUInt32(); // 0x00 uint32 checksum TotalSize = reader.ReadUInt32(); // 0x04 uint32 total size var numDependencies = reader.ReadInt16(); // 0x08 int16 dependencies count var numDataFixups = reader.ReadInt16(); // 0x0A int16 data fixup count var numResourceFixups = reader.ReadInt16(); // 0x0C int16 resource fixup count reader.BaseStream.Position += 2; // 0x0E int16 (padding) MainStructOffset = reader.ReadUInt32(); // 0x10 uint32 main struct offset var groupTag = new Tag(reader.ReadInt32()); // 0x14 int32 group tag var parentGroupTag = new Tag(reader.ReadInt32()); // 0x18 int32 parent group tag var grandparentGroupTag = new Tag(reader.ReadInt32()); // 0x1C int32 grandparent group tag var groupName = new StringID(reader.ReadUInt32()); // 0x20 uint32 group name stringid Group = new TagGroup(groupTag, parentGroupTag, grandparentGroupTag, groupName); // Read dependencies var dependencies = new HashSet <int>(); for (var j = 0; j < numDependencies; j++) { dependencies.Add(reader.ReadInt32()); } Dependencies = new ReadOnlySet <int>(dependencies); // Read offsets _pointerOffsets = new List <uint>(numDataFixups); for (var j = 0; j < numDataFixups; j++) { _pointerOffsets.Add(PointerToOffset(reader.ReadUInt32())); } _resourceOffsets = new List <uint>(numResourceFixups); for (var j = 0; j < numResourceFixups; j++) { _resourceOffsets.Add(PointerToOffset(reader.ReadUInt32())); } }
public LongExpressionValue(StringID sid) { value = sid.Value; }
void IDefinition.FromArray(byte[] buffer) { BinaryReader bin = new BinaryReader(new MemoryStream(buffer)); Name = bin.ReadStringID(); Parent_NodeIndex = bin.ReadInt16(); FirstChild_NodeIndex = bin.ReadInt16(); NextSibling_NodeIndex = bin.ReadInt16(); bin.BaseStream.Seek(sizeof(short), SeekOrigin.Current); Position = bin.ReadVector3(); Rotation = bin.ReadQuaternion(); Scale = bin.ReadSingle(); Right = bin.ReadVector3(); Forward = bin.ReadVector3(); Up = bin.ReadVector3(); AbsolutePosition = bin.ReadVector3(); }
private void ReadLocalePointer(IReader reader, out StringID id, out int offset) { StructureValueCollection values = StructureReader.ReadStructure(reader, _pointerLayout); id = new StringID(values.GetInteger("stringid")); offset = (int) values.GetInteger("offset"); }
/// <summary> /// Returns localizer string for the specified key /// </summary> public override object ProvideValue(IServiceProvider provider) { StringID selectedID = (StringID)Enum.Parse(typeof(StringID), Key, true); return(FALocalizeManager.Instance.GetLocalizer().GetLocalizedString(selectedID)); }
void IDefinition.FromArray(byte[] buffer) { BinaryReader bin = new BinaryReader(new MemoryStream(buffer)); Name = bin.ReadStringID(); NodeMapOffset = bin.ReadInt16(); NodeMapSize = bin.ReadInt16(); }
internal UsageAfterAPIShutdownException(StringID code, params object[] args) : base(code, args) { }
public abstract string GetLocalizedString(StringID id);
void IDefinition.FromArray(byte[] buffer) { this.Name = (StringID)BitConverter.ToInt32(buffer, 0); this.Index = BitConverter.ToInt16(buffer, 4); this.HighLOD = BitConverter.ToInt16(buffer, 14); }
private void WriteLocalePointer(IWriter writer, StringID id, int offset) { var values = new StructureValueCollection(); values.SetInteger("stringid", id.Value); values.SetInteger("offset", (uint) offset); StructureWriter.WriteStructure(values, _pointerLayout, writer); }
public ThirdGenSoundPlayback(StructureValueCollection values, StringID[] stringIds) { Load(values, stringIds); }
public override string GetLocalizedString(StringID id) { switch (id) { case StringID.Empty: return(string.Empty); case StringID.Numbers_0: return("۰"); case StringID.Numbers_1: return("۱"); case StringID.Numbers_2: return("۲"); case StringID.Numbers_3: return("۳"); case StringID.Numbers_4: return("۴"); case StringID.Numbers_5: return("۵"); case StringID.Numbers_6: return("۶"); case StringID.Numbers_7: return("۷"); case StringID.Numbers_8: return("۸"); case StringID.Numbers_9: return("۹"); case StringID.FADateTextBox_Required: return("فيلد اجباری میباشد"); case StringID.FAMonthView_None: return("خالی"); case StringID.FAMonthView_Today: return("امروز"); case StringID.PersianDate_InvalidDateFormat: return("ساختار تاریخ مجاز نمیباشد."); case StringID.PersianDate_InvalidDateTime: return("مقدار زمان/ساعت صحیح نمیباشد."); case StringID.PersianDate_InvalidDateTimeLength: return("متن وارد شده برای زمان/ساعت صحیح نمیباشد."); case StringID.PersianDate_InvalidDay: return("مقدار روز صحیح نمیباشد."); case StringID.PersianDate_InvalidEra: return("محدوده وارد شده صحیح نمیباشد."); case StringID.PersianDate_InvalidFourDigitYear: return("مقدار وارد شده را نمیتوان به سال تبدیل کرد."); case StringID.PersianDate_InvalidHour: return("مقدار ساعت صحیح نمیباشد."); case StringID.PersianDate_InvalidLeapYear: return("این سال ، سال کبیسه نیست. مقدار روز صحیح نمیباشد."); case StringID.PersianDate_InvalidMinute: return("مقدار دقیقه صحیح نمیباشد."); case StringID.PersianDate_InvalidMonth: return("مقدار ماه صحیح نمیباشد."); case StringID.PersianDate_InvalidMonthDay: return("مقدار ماه/روز صحیح نمیباشد."); case StringID.PersianDate_InvalidSecond: return("مقدار ثانیه صحیح نمیباشد."); case StringID.PersianDate_InvalidTimeFormat: return("ساختار زمان صحیح نمیباشد."); case StringID.PersianDate_InvalidYear: return("مقدار سال صحیح نمیباشد."); case StringID.Validation_Cancel: return("مقدار انتخاب شده مجاز نمیباشد."); case StringID.Validation_NotValid: return("مقدار انتخاب شده در محدوده مجاز نمیباشد."); case StringID.Validation_Required: return("انتخاب اجباری. لطفا مقداری برای این فیلد وارد کنید."); case StringID.Validation_NullText: return("[هیج مقداری انتخاب نشده]"); case StringID.MessageBox_Ok: return("قبول"); case StringID.MessageBox_Cancel: return("لغو"); case StringID.MessageBox_Abort: return("لغو"); case StringID.MessageBox_Ignore: return("ادامه عملیات"); case StringID.MessageBox_Retry: return("سعی مجدد"); case StringID.MessageBox_No: return("خیر"); case StringID.MessageBox_Yes: return("بله"); } return(""); }
public void ReadControls() { Reader.ReadStartElement(); List<Control> Controls = new List<Control>(); while (Reader.Read()) { switch (Reader.NodeType) { case XmlNodeType.Element: { switch (Reader.Name.ToLower()) { case "byte": { string Description = Reader.GetAttribute("name"); int Offset = Convert.ToInt32(Reader.GetAttribute("offset")); Value b; if (Count > 0) b = new Value(Description, typeof(byte), 0,RawTranslation, Offset,Map); else b = new Value(Description, typeof(byte), -1,RawTranslation, Offset,Map); Controls.Add(b); b.Dock = DockStyle.Top; b.BringToFront(); break; } case "short": { string Description = Reader.GetAttribute("name"); int Offset = Convert.ToInt32(Reader.GetAttribute("offset")); Value b; if (Count > 0) b = new Value(Description, typeof(short), 0, RawTranslation, Offset,Map); else b = new Value(Description, typeof(short), -1, RawTranslation, Offset,Map); Controls.Add(b); b.Dock = DockStyle.Top; b.BringToFront(); break; } case "ushort": { string Description = Reader.GetAttribute("name"); int Offset = Convert.ToInt32(Reader.GetAttribute("offset")); Value b; if (Count > 0) b = new Value(Description, typeof(ushort), 0, RawTranslation, Offset,Map); else b = new Value(Description, typeof(ushort), -1, RawTranslation, Offset,Map); Controls.Add(b); b.Dock = DockStyle.Top; b.BringToFront(); break; } case "int": { string Description = Reader.GetAttribute("name"); int Offset = Convert.ToInt32(Reader.GetAttribute("offset")); Value b; if (Count > 0) b = new Value(Description, typeof(int), 0, RawTranslation, Offset,Map); else b = new Value(Description, typeof(int), -1, RawTranslation, Offset,Map); Controls.Add(b); b.Dock = DockStyle.Top; b.BringToFront(); break; } case "uint": { string Description = Reader.GetAttribute("name"); int Offset = Convert.ToInt32(Reader.GetAttribute("offset")); Value b; if (Count > 0) b = new Value(Description, typeof(uint), 0, RawTranslation, Offset,Map); else b = new Value(Description, typeof(uint), -1, RawTranslation, Offset,Map); Controls.Add(b); b.Dock = DockStyle.Top; b.BringToFront(); break; } case "float": { string Description = Reader.GetAttribute("name"); int Offset = Convert.ToInt32(Reader.GetAttribute("offset")); Value b; if (Count > 0) b = new Value(Description, typeof(float), 0, RawTranslation, Offset,Map); else b = new Value(Description, typeof(float), -1, RawTranslation, Offset,Map); Controls.Add(b); b.Dock = DockStyle.Top; b.BringToFront(); break; } case "string": { string Description = Reader.GetAttribute("name"); int Offset = Convert.ToInt32(Reader.GetAttribute("offset")); int Length = Convert.ToInt32(Reader.GetAttribute("length")); Value b; if (Count > 0) b = new Value(Description, typeof(string), "",Length,RawTranslation, Offset,Map); else b = new Value(Description, typeof(string), "Null",0,RawTranslation, Offset,Map); Controls.Add(b); b.Dock = DockStyle.Top; b.BringToFront(); break; } case "unknown": { string Description = Reader.GetAttribute("name"); int Offset = Convert.ToInt32(Reader.GetAttribute("offset")); Value b; if (Count > 0) b = new Value(Description, typeof(int), 0, RawTranslation, Offset,Map); else b = new Value(Description, typeof(int), -1, RawTranslation, Offset,Map); Controls.Add(b); b.Dock = DockStyle.Top; b.BringToFront(); break; } case "long": { string Description = Reader.GetAttribute("name"); int Offset = Convert.ToInt32(Reader.GetAttribute("offset")); Value b; if (Count > 0) b = new Value(Description, typeof(long), 0, RawTranslation, Offset,Map); else b = new Value(Description, typeof(long), -1, RawTranslation, Offset,Map); Controls.Add(b); b.Dock = DockStyle.Top; b.BringToFront(); break; } case "ident": { string Description = Reader.GetAttribute("name"); int Offset = Convert.ToInt32(Reader.GetAttribute("offset")); Ident i; if (Count > 0) { try { i = new Ident("", 0,RawTranslation,Offset, Description, Map); } catch (Exception) { i = new Ident("Null", -1,RawTranslation, Offset, Description, Map); } } else i = new Ident("Null", -1,RawTranslation, Offset, Description, Map); Controls.Add(i); i.Dock = DockStyle.Top; i.BringToFront(); break; } case "reflexive": { string Description = Reader.GetAttribute("name"); int Offset = Convert.ToInt32(Reader.GetAttribute("offset")); int Size = Convert.ToInt32(Reader.GetAttribute("size")); Reflexive b; if (Count > 0) { Map.Reader.BaseStream.Position = ((Offset+RawTranslation) - Map.Index.SecondaryMagic); b = new Reflexive(Map, Description, Map.Reader.ReadInt32(),RawTranslation, Offset, Size, Reader.ReadSubtree()); } else b = new Reflexive(Map, Description, 0,RawTranslation, Offset, Size, Reader.ReadSubtree()); Controls.Add(b); b.Dock = DockStyle.Top; b.BringToFront(); break; } case "stringid": { string Description = Reader.GetAttribute("name"); int Offset = Convert.ToInt32(Reader.GetAttribute("offset")); StringID b; if (Count > 0) b = new StringID(Description,RawTranslation, Offset, 0, Map); else b = new StringID(Description,RawTranslation, Offset, -1, Map); Controls.Add(b); b.Dock = DockStyle.Top; b.BringToFront(); break; } case "enum8": { string Description = Reader.GetAttribute("name"); int Offset = Convert.ToInt32(Reader.GetAttribute("offset")); List<string> Items = new List<string>(); List<int> Values = new List<int>(); XmlReader x = Reader.ReadSubtree(); while (x.Read()) { switch (x.Name.ToLower()) { case "option": { Items.Add(Reader.GetAttribute("name")); Values.Add(Convert.ToInt32(Reader.GetAttribute("value"))); break; } } } Enum e; if (Count > 0) e = new Enum(Description,RawTranslation, Offset, typeof(byte), Items, Values, 0,Map); else e = new Enum(Description,RawTranslation, Offset, typeof(byte), new List<string>(), new List<int>(), -1,Map); Controls.Add(e); e.Dock = DockStyle.Top; e.BringToFront(); break; } case "enum16": { string Description = Reader.GetAttribute("name"); int Offset = Convert.ToInt32(Reader.GetAttribute("offset")); List<string> Items = new List<string>(); List<int> Values = new List<int>(); XmlReader x = Reader.ReadSubtree(); while (x.Read()) { switch (x.Name.ToLower()) { case "option": { Items.Add(Reader.GetAttribute("name")); Values.Add(Convert.ToInt32(Reader.GetAttribute("value"))); break; } } } Enum e; if (Count > 0) e = new Enum(Description, RawTranslation, Offset, typeof(int), Items, Values, 0,Map); else e = new Enum(Description, RawTranslation, Offset, typeof(int), new List<string>(), new List<int>(), -1,Map); Controls.Add(e); e.Dock = DockStyle.Top; e.BringToFront(); break; } case "enum32": { string Description = Reader.GetAttribute("name"); int Offset = Convert.ToInt32(Reader.GetAttribute("offset")); List<string> Items = new List<string>(); List<int> Values = new List<int>(); XmlReader x = Reader.ReadSubtree(); while (x.Read()) { switch (x.Name.ToLower()) { case "option": { Items.Add(Reader.GetAttribute("name")); Values.Add(Convert.ToInt32(Reader.GetAttribute("value"))); break; } } } Enum e; if (Count > 0) e = new Enum(Description, RawTranslation, Offset, typeof(int), Items, Values, 0,Map); else e = new Enum(Description, RawTranslation, Offset, typeof(int), new List<string>(), new List<int>(), -1,Map); Controls.Add(e); e.Dock = DockStyle.Top; e.BringToFront(); break; } case "bitmask8": { string Description = Reader.GetAttribute("name"); int Offset = Convert.ToInt32(Reader.GetAttribute("offset")); List<string> Items = new List<string>(); List<int> Values = new List<int>(); XmlReader x = Reader.ReadSubtree(); while (x.Read()) { switch (x.Name.ToLower()) { case "option": { Items.Add(Reader.GetAttribute("name")); Values.Add(Convert.ToInt32(Reader.GetAttribute("value"))); break; } } } Bitmask b; if (Count > 0) b = new Bitmask(Description, typeof(byte), Items, Values, RawTranslation, Offset, Map); else b = new Bitmask(Description, -1, typeof(byte), Items, Values, RawTranslation, Offset, Map); Controls.Add(b); b.Dock = DockStyle.Top; b.BringToFront(); break; } case "bitmask16": { string Description = Reader.GetAttribute("name"); int Offset = Convert.ToInt32(Reader.GetAttribute("offset")); List<string> Items = new List<string>(); List<int> Values = new List<int>(); XmlReader x = Reader.ReadSubtree(); while (x.Read()) { switch (x.Name.ToLower()) { case "option": { Items.Add(Reader.GetAttribute("name")); Values.Add(Convert.ToInt32(Reader.GetAttribute("value"))); break; } } } Bitmask b; if (Count > 0) b = new Bitmask(Description, typeof(short), Items, Values, RawTranslation, Offset, Map); else b = new Bitmask(Description,-1, typeof(short), Items, Values, RawTranslation, Offset, Map); Controls.Add(b); b.Dock = DockStyle.Top; b.BringToFront(); break; } case "bitmask32": { string Description = Reader.GetAttribute("name"); int Offset = Convert.ToInt32(Reader.GetAttribute("offset")); List<string> Items = new List<string>(); List<int> Values = new List<int>(); XmlReader x = Reader.ReadSubtree(); while (x.Read()) { switch (x.Name.ToLower()) { case "option": { Items.Add(Reader.GetAttribute("name")); Values.Add(Convert.ToInt32(Reader.GetAttribute("value"))); break; } } } Bitmask b; if (Count > 0) b = new Bitmask(Description, typeof(int), Items, Values, RawTranslation, Offset, Map); else b = new Bitmask(Description, -1, typeof(int), Items, Values, RawTranslation, Offset, Map); Controls.Add(b); b.Dock = DockStyle.Top; b.BringToFront(); break; } case "string32": { //string Description = Reader.GetAttribute("name"); //int Offset = Convert.ToInt32(Reader.GetAttribute("offset")) + Map.SelectedTag.MetaOffset; //Map.br.BaseStream.Position = Offset; //string Value = new string(Map.br.ReadChars(32)); //String s = new String(Description, Offset, Value, StringType.String32); //Controls.Add(s); //s.Dock = DockStyle.Top; //s.BringToFront(); break; } case "string64": { //string Description = Reader.GetAttribute("name"); //int Offset = Convert.ToInt32(Reader.GetAttribute("offset")) + Map.SelectedTag.MetaOffset; //Map.br.BaseStream.Position = Offset; //string Value = new string(Map.br.ReadChars(64)); //String s = new String(Description, Offset, Value, StringType.String64); //Controls.Add(s); //s.Dock = DockStyle.Top; //s.BringToFront(); break; } case "unicode64": { //string Description = Reader.GetAttribute("name"); //int Offset = Convert.ToInt32(Reader.GetAttribute("offset")) + Map.SelectedTag.MetaOffset; //Map.br.BaseStream.Position = Offset; //string Value = ""; //for (int i = 0; i < 32; i++) //{ // Value += Convert.ToChar(Map.br.ReadByte()); // Map.br.BaseStream.Position++; //} //String s = new String(Description, Offset, Value, StringType.Unicode64); //Controls.Add(s); //s.Dock = DockStyle.Top; //s.BringToFront(); break; } case "unicode256": { //string Description = Reader.GetAttribute("name"); //int Offset = Convert.ToInt32(Reader.GetAttribute("offset")) + Map.SelectedTag.MetaOffset; //Map.br.BaseStream.Position = Offset; //string Value = ""; //for (int i = 0; i < 128; i++) //{ // Value += Convert.ToChar(Map.br.ReadByte()); // Map.br.BaseStream.Position++; //} //String s = new String(Description, Offset, Value, StringType.Unicode256); //Controls.Add(s); //s.Dock = DockStyle.Top; //s.BringToFront(); break; } } break; } } } Reader.Close(); for (int i = Controls.Count - 1; i > -1; i--) this.panel1.Controls.Add(Controls[i]); }
/// <summary> /// Copy Constructor /// </summary> /// <param name="copy"></param> public DNode(DNode copy) { this.Name = copy.Name; this.Parent_NodeIndex = copy.Parent_NodeIndex; this.FirstChild_NodeIndex = copy.FirstChild_NodeIndex; this.NextSibling_NodeIndex = copy.NextSibling_NodeIndex; this.Rotation = copy.Rotation; this.Position = copy.Position; this.Scale = copy.Scale; this.Right = copy.Right; this.Up = copy.Up; this.Forward = copy.Forward; this.AbsolutePosition = copy.AbsolutePosition; }
internal UnexpectedException(StringID code, params object[] args) : base(StringMap.GetString(code, args)) { }
public FourthGenSoundPermutation(StructureValueCollection values, StringID[] stringIds) { Load(values, stringIds); }