private bool ImportAnimationResource(TagInstance tagIndex, string cachePath, string dataPath) { ModelAnimationGraph animation; ResourceCache resourceCache; uint compressedSize = 0; var data = File.ReadAllBytes(dataPath); using (var cacheStream = _info.OpenCacheReadWrite()) { var tagContext = new TagSerializationContext(cacheStream, _info.Cache, _info.StringIDs, tagIndex); animation = _info.Deserializer.Deserialize <ModelAnimationGraph>(tagContext); } using (var stream = File.Open(_info.CacheFile.DirectoryName + "\\" + cachePath, FileMode.Open, FileAccess.ReadWrite)) { resourceCache = new ResourceCache(stream); animation.ResourceGroups[0].Resource.Index = resourceCache.Add(stream, data, out compressedSize); animation.ResourceGroups[0].Resource.CompressedSize = compressedSize; animation.ResourceGroups[0].Resource.OldLocationFlags = (OldResourceLocationFlags)2; } using (var cacheStream = _fileInfo.Open(FileMode.Open, FileAccess.ReadWrite)) { var context = new TagSerializationContext(cacheStream, _cache, _stringIds, tagIndex); _info.Serializer.Serialize(context, animation); } Console.WriteLine("{1}: Imported 0x{0}.", compressedSize, tagIndex); return(true); }
/// <summary> /// Limpa todas a linhas selecionadas /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void ButtonClearSelectedTags_Click(object sender, RoutedEventArgs e) { foreach (var productTag in TagInstance.GetProductServiceTag().GetTags()) { productTag.Print = false; } }
/// <summary> /// Reads a tag's data from the file. /// </summary> /// <param name="stream">The stream to read from.</param> /// <param name="tag">The tag to read.</param> /// <returns>The data that was read.</returns> public TagData ExtractTag(Stream stream, TagInstance tag) { if (tag == null) { throw new ArgumentNullException(nameof(tag)); } if (tag.HeaderOffset < 0) { throw new ArgumentException("The tag is not in the cache file"); } // Build the description info and get the data offset uint dataOffset; var data = BuildTagDescription(stream, tag, out dataOffset); // Read the tag data stream.Position = tag.HeaderOffset + dataOffset; data.Data = new byte[tag.TotalSize - dataOffset]; stream.Read(data.Data, 0, data.Data.Length); // Correct pointers using (var dataWriter = new BinaryWriter(new MemoryStream(data.Data))) { foreach (var fixup in data.PointerFixups) { dataWriter.BaseStream.Position = fixup.WriteOffset; dataWriter.Write(tag.OffsetToPointer(fixup.TargetOffset)); } } return(data); }
/// <summary> /// Fixes tag offsets after a resize operation. /// </summary> /// <param name="startOffset">The offset where the resize operation took place.</param> /// <param name="sizeDelta">The amount to add to each tag offset after the start offset.</param> /// <param name="ignore">A tag to ignore.</param> private void FixTagOffsets(long startOffset, long sizeDelta, TagInstance ignore) { foreach (var adjustTag in _tags.Where(t => t != null && t != ignore && t.HeaderOffset >= startOffset)) { adjustTag.HeaderOffset += sizeDelta; } }
public static TagInstance ConvertTag(TagInstance srcTag, OpenTagCache srcInfo, Stream srcStream, ResourceDataManager srcResources, OpenTagCache destInfo, Stream destStream, ResourceDataManager destResources, TagCacheMap tagMap) { TagPrinter.PrintTagShort(srcTag); // Deserialize the tag from the source cache var structureType = TagStructureTypes.FindByGroupTag(srcTag.Group.Tag); var srcContext = new TagSerializationContext(srcStream, srcInfo.Cache, srcInfo.StringIDs, srcTag); var tagData = srcInfo.Deserializer.Deserialize(srcContext, structureType); // Acquire the destination tag var destTag = destInfo.Cache.AllocateTag(srcTag.Group); tagMap.Add(srcInfo.CacheFile.FullName, srcTag.Index, destInfo.CacheFile.FullName, destTag.Index); if (srcTag.IsInGroup("decs") || srcTag.IsInGroup("rmd ")) { IsDecalShader = true; } // Convert the source tag tagData = Convert(tagData, srcInfo, srcStream, srcResources, destInfo, destStream, destResources, tagMap); if (srcTag.IsInGroup("decs") || srcTag.IsInGroup("rmd ")) { IsDecalShader = false; } // Re-serialize into the destination cache var destContext = new TagSerializationContext(destStream, destInfo.Cache, destInfo.StringIDs, destTag); destInfo.Serializer.Serialize(destContext, tagData); return(destTag); }
private static bool CheckTargetOffset(TagInstance tag, uint targetOffset) { if (targetOffset < tag.DataSize) return true; Console.Error.WriteLine("Invalid target offset: cannot point to something outside the tag."); return false; }
private bool ImportModelResource(TagInstance tagIndex, string cachePath, string dataPath) { RenderModel renderModel; ResourceCache resourceCache; uint compressedSize = 0; var data = File.ReadAllBytes(dataPath); using (var cacheStream = _info.OpenCacheReadWrite()) { var tagContext = new TagSerializationContext(cacheStream, _info.Cache, _info.StringIDs, tagIndex); renderModel = _info.Deserializer.Deserialize <RenderModel>(tagContext); } using (var stream = File.Open(_info.CacheFile.DirectoryName + "\\" + cachePath, FileMode.Open, FileAccess.ReadWrite)) { resourceCache = new ResourceCache(stream); renderModel.Geometry.Resource.Index = resourceCache.Add(stream, data, out compressedSize); renderModel.Geometry.Resource.CompressedSize = compressedSize; } using (var cacheStream = _fileInfo.Open(FileMode.Open, FileAccess.ReadWrite)) { var context = new TagSerializationContext(cacheStream, _cache, _stringIds, tagIndex); _info.Serializer.Serialize(context, renderModel); } Console.WriteLine("{1}: Imported 0x{0}.", compressedSize, tagIndex); return(true); }
/// <summary> /// Creates a tag serialization context which serializes data into a tag. /// </summary> /// <param name="stream">The stream to write to.</param> /// <param name="cache">The cache file to write to.</param> /// <param name="stringIds">The stringID source to use.</param> /// <param name="tag">The tag to overwrite.</param> public TagSerializationContext(Stream stream, TagCache cache, StringIdCache stringIds, TagInstance tag) { _stream = stream; _cache = cache; _stringIds = stringIds; Tag = tag; }
/// <summary> /// Creates a tag serialization context which serializes data into a tag. /// </summary> /// <param name="stream">The stream to write to.</param> /// <param name="cache">The cache file to write to.</param> /// <param name="stringIds">The stringID source to use.</param> /// <param name="tag">The tag to overwrite.</param> public TagSerializationContext(Stream stream, TagCache cache, StringIDCache stringIds, TagInstance tag) { _stream = stream; _cache = cache; _stringIds = stringIds; Tag = tag; }
private static int CompareTags(TagInstance lhs, TagInstance rhs) { var classCompare = lhs.Group.Tag.CompareTo(rhs.Group.Tag); if (classCompare != 0) return classCompare; return lhs.Index.CompareTo(rhs.Index); }
private bool ImportBitmapResource(TagInstance tagIndex, string cachePath, string dataPath) { Bitmap bitmap; ResourceCache resourceCache; uint compressedSize = 0; using (var cacheStream = _info.OpenCacheRead()) { var tagContext = new TagSerializationContext(cacheStream, _info.Cache, _info.StringIDs, tagIndex); bitmap = _info.Deserializer.Deserialize <Bitmap>(tagContext); } using (var stream = File.Open(_info.CacheFile.DirectoryName + "\\" + cachePath, FileMode.Open, FileAccess.ReadWrite)) { int imageIndex = 0; foreach (string file in Directory.EnumerateFiles(dataPath, "*.bitm")) { byte[] inBitmapData = File.ReadAllBytes(file); resourceCache = new ResourceCache(stream); bitmap.Resources[imageIndex].Resource.Index = resourceCache.Add(stream, inBitmapData, out compressedSize); bitmap.Resources[imageIndex].Resource.CompressedSize = compressedSize; imageIndex++; } } using (var cacheStream = _fileInfo.Open(FileMode.Open, FileAccess.ReadWrite)) { var context = new TagSerializationContext(cacheStream, _cache, _stringIds, tagIndex); _info.Serializer.Serialize(context, bitmap); } Console.WriteLine("{1}: Imported 0x{0}.", compressedSize, tagIndex); return(true); }
private static bool CheckWriteOffset(TagInstance tag, uint writeOffset) { if (writeOffset < tag.DataSize) return true; Console.Error.WriteLine("Invalid write offset: cannot write past the end of the tag."); return false; }
private bool ExecuteList(TagInstance tag, bool all) { if (tag.Dependencies.Count == 0) { Console.Error.WriteLine("Tag {0:X8} has no dependencies.", tag.Index); return(true); } IEnumerable <TagInstance> dependencies; if (all) { dependencies = Info.Cache.Tags.FindDependencies(tag); } else { dependencies = tag.Dependencies.Where(i => Info.Cache.Tags.Contains(i)).Select(i => Info.Cache.Tags[i]); } foreach (var dependency in dependencies) { var tagName = Info.TagNames.ContainsKey(dependency.Index) ? Info.TagNames[dependency.Index] : $"0x{dependency.Index:X4}"; Console.WriteLine($"[Index: 0x{dependency.Index:X4}, Offset: 0x{dependency.HeaderOffset:X8}, Size: 0x{dependency.TotalSize:X4}] {tagName}.{Info.StringIDs.GetString(dependency.Group.Name)}"); } return(true); }
private bool ExecuteListDependsOn(TagInstance tag) { var dependsOn = _cache.Tags.NonNull().Where(t => t.Dependencies.Contains(tag.Index)); TagPrinter.PrintTagsShort(dependsOn); return(true); }
private bool ExecuteAddRemove(TagInstance tag, List<string> args) { if (args.Count < 3) return false; var dependencies = args.Skip(2).Select(a => ArgumentParser.ParseTagIndex(_cache, a)).ToList(); if (dependencies.Count == 0 || dependencies.Any(d => d == null)) return false; if (args[0] == "add") { foreach (var dependency in dependencies) { if (tag.Dependencies.Add(dependency.Index)) Console.WriteLine("Added dependency on tag {0:X8}.", dependency.Index); else Console.Error.WriteLine("Tag {0:X8} already depends on tag {1:X8}.", tag.Index, dependency.Index); } } else { foreach (var dependency in dependencies) { if (tag.Dependencies.Remove(dependency.Index)) Console.WriteLine("Removed dependency on tag {0:X8}.", dependency.Index); else Console.Error.WriteLine("Tag {0:X8} does not depend on tag {1:X8}.", tag.Index, dependency.Index); } } using (var stream = _info.OpenCacheReadWrite()) _cache.UpdateTag(stream, tag); return true; }
public static void Populate(CommandContext context, OpenTagCache info, TagInstance tag) { RenderMethod renderMethod = null; using (var cacheStream = info.OpenCacheReadWrite()) { var tagContext = new TagSerializationContext(cacheStream, info.Cache, info.StringIDs, tag); switch (tag.Group.Tag.ToString()) { case "rm ": // render_method renderMethod = info.Deserializer.Deserialize <RenderMethod>(tagContext); break; case "rmsh": // shader renderMethod = info.Deserializer.Deserialize <Shader>(tagContext); break; case "rmd ": // shader_decal renderMethod = info.Deserializer.Deserialize <ShaderDecal>(tagContext); break; case "rmfl": // shader_foliage renderMethod = info.Deserializer.Deserialize <ShaderFoliage>(tagContext); break; case "rmhg": // shader_halogram renderMethod = info.Deserializer.Deserialize <ShaderHalogram>(tagContext); break; case "rmss": // shader_screen renderMethod = info.Deserializer.Deserialize <ShaderScreen>(tagContext); break; case "rmtr": // shader_terrain renderMethod = info.Deserializer.Deserialize <ShaderTerrain>(tagContext); break; case "rmw ": // shader_water renderMethod = info.Deserializer.Deserialize <ShaderWater>(tagContext); break; case "rmzo": // shader_zonly renderMethod = info.Deserializer.Deserialize <ShaderZonly>(tagContext); break; case "rmcs": // shader_custom renderMethod = info.Deserializer.Deserialize <ShaderCustom>(tagContext); break; default: throw new NotImplementedException(); } } context.AddCommand(new ListArgumentsCommand(info, tag, renderMethod)); context.AddCommand(new ListBitmapsCommand(info, tag, renderMethod)); context.AddCommand(new SpecifyBitmapsCommand(info, tag, renderMethod)); }
private TagInstance ConvertTag(TagInstance srcTag, OpenTagCache srcInfo, Stream srcStream, ResourceDataManager srcResources, OpenTagCache destInfo, Stream destStream, ResourceDataManager destResources, TagVersionMap tagMap) { TagPrinter.PrintTagShort(srcTag); // Uncomment this to use 0x101F for all shaders /*if (srcTag.IsClass("rm ")) * return destInfo.Cache.Tags[0x101F];*/ // Check if the tag is in the map, and just return the translated tag if so var destIndex = tagMap.Translate(srcInfo.Version, srcTag.Index, destInfo.Version); if (destIndex >= 0) { Console.WriteLine("- Using already-known index {0:X4}", destIndex); return(destInfo.Cache.Tags[destIndex]); } // Deserialize the tag from the source cache var structureType = TagStructureTypes.FindByGroupTag(srcTag.Group.Tag); var srcContext = new TagSerializationContext(srcStream, srcInfo.Cache, srcInfo.StringIDs, srcTag); var tagData = srcInfo.Deserializer.Deserialize(srcContext, structureType); // Uncomment this to use 0x101F in place of shaders that need conversion /*if (tagData is RenderMethod) * { * var rm = (RenderMethod)tagData; * foreach (var prop in rm.ShaderProperties) * { * if (tagMap.Translate(srcInfo.Version, prop.Template.Index, destInfo.Version) < 0) * return destInfo.Cache.Tags[0x101F]; * } * }*/ // Allocate a new tag and create a mapping for it var newTag = destInfo.Cache.AllocateTag(srcTag.Group); tagMap.Add(srcInfo.Version, srcTag.Index, destInfo.Version, newTag.Index); if (srcTag.IsInGroup("decs") || srcTag.IsInGroup("rmd ")) { _isDecalShader = true; } // Convert it tagData = Convert(tagData, srcInfo, srcStream, srcResources, destInfo, destStream, destResources, tagMap); if (srcTag.IsInGroup("decs") || srcTag.IsInGroup("rmd ")) { _isDecalShader = false; } // Re-serialize into the destination cache var destContext = new TagSerializationContext(destStream, destInfo.Cache, destInfo.StringIDs, newTag); destInfo.Serializer.Serialize(destContext, tagData); return(newTag); }
public static void Populate(CommandContext context, OpenTagCache info, TagInstance tag) { RenderMethod renderMethod = null; using (var cacheStream = info.OpenCacheReadWrite()) { var tagContext = new TagSerializationContext(cacheStream, info.Cache, info.StringIds, tag); switch (tag.Group.Tag.ToString()) { case "rm ": // render_method renderMethod = info.Deserializer.Deserialize<RenderMethod>(tagContext); break; case "rmsh": // shader renderMethod = info.Deserializer.Deserialize<Shader>(tagContext); break; case "rmd ": // shader_decal renderMethod = info.Deserializer.Deserialize<ShaderDecal>(tagContext); break; case "rmfl": // shader_foliage renderMethod = info.Deserializer.Deserialize<ShaderFoliage>(tagContext); break; case "rmhg": // shader_halogram renderMethod = info.Deserializer.Deserialize<ShaderHalogram>(tagContext); break; case "rmss": // shader_screen renderMethod = info.Deserializer.Deserialize<ShaderScreen>(tagContext); break; case "rmtr": // shader_terrain renderMethod = info.Deserializer.Deserialize<ShaderTerrain>(tagContext); break; case "rmw ": // shader_water renderMethod = info.Deserializer.Deserialize<ShaderWater>(tagContext); break; case "rmzo": // shader_zonly renderMethod = info.Deserializer.Deserialize<ShaderZonly>(tagContext); break; case "rmcs": // shader_custom renderMethod = info.Deserializer.Deserialize<ShaderCustom>(tagContext); break; default: throw new NotImplementedException(); } } context.AddCommand(new ListArgumentsCommand(info, tag, renderMethod)); context.AddCommand(new ListBitmapsCommand(info, tag, renderMethod)); context.AddCommand(new SpecifyBitmapsCommand(info, tag, renderMethod)); }
public static void Populate(CommandContext context, OpenTagCache info, TagInstance tag, VFilesList vfsl) { context.AddCommand(new ListCommand(vfsl)); context.AddCommand(new ExtractCommand(vfsl)); context.AddCommand(new ExtractAllCommand(vfsl)); context.AddCommand(new ImportCommand(info, tag, vfsl)); context.AddCommand(new ImportAllCommand(info, tag, vfsl)); }
/// <summary> /// Allocates a new tag at the end of the tag list without updating the file. /// You can give the tag data by using one of the overwrite functions. /// </summary> /// <param name="type">The tag's type information.</param> /// <returns>The allocated tag.</returns> public TagInstance AllocateTag(TagGroup type) { var tagIndex = _tags.Count; var tag = new TagInstance(tagIndex, type); _tags.Add(tag); return(tag); }
public static void Populate(CommandContext context, OpenTagCache info, TagInstance tag, MultilingualUnicodeStringList unic) { if (info.StringIds == null) return; context.AddCommand(new ListCommand(info, unic)); context.AddCommand(new SetCommand(info, tag, unic)); }
/// <summary> /// Builds a memory map for a tag. /// </summary> /// <param name="tag">The tag to build a memory map for.</param> /// <returns>The built map.</returns> private static MemoryMap BuildTagMap(TagInstance tag) { // Create a memory map with a boundary at each fixup target // and at the main structure var result = new MemoryMap(0, (uint)tag.DataSize); result.AddBoundary(tag.MainStructOffset); result.AddBoundaries(tag.DataFixups.Select(f => f.TargetOffset)); return result; }
private void SetRenderModelName(Stream stream, TagInstance tag, ref Dictionary<int, string> tagNames) { if (tagNames.ContainsKey(tag.Index)) return; var context = new TagSerializationContext(stream, Info.Cache, Info.StringIds, tag); var definition = Info.Deserializer.Deserialize<RenderModel>(context); tagNames[tag.Index] = $"{Info.StringIds.GetString(definition.Name)}"; }
public static CommandContext Create(CommandContext parent, OpenTagCache info, TagInstance tag, VFilesList vfsl) { var groupName = info.StringIds.GetString(tag.GroupName); var context = new CommandContext(parent, string.Format("{0:X8}.{1}", tag.Index, groupName)); return context; }
private static void EditModel(CommandContext context, OpenTagCache info, TagInstance tag) { Model model; using (var stream = info.OpenCacheRead()) model = info.Deserializer.Deserialize <Model>( new TagSerializationContext(stream, info.Cache, info.StringIDs, tag)); ModelContextFactory.Populate(context, info, tag, model); }
private static void EditVFilesList(CommandContext context, OpenTagCache info, TagInstance tag) { VFilesList vfsl; using (var stream = info.OpenCacheRead()) vfsl = info.Deserializer.Deserialize<VFilesList>( new TagSerializationContext(stream, info.Cache, info.StringIds, tag)); VFilesContextFactory.Populate(context, info, tag, vfsl); }
private static void EditBitmap(CommandContext context, OpenTagCache info, TagInstance tag) { Bitmap bitmap; using (var stream = info.OpenCacheRead()) bitmap = info.Deserializer.Deserialize<Bitmap>( new TagSerializationContext(stream, info.Cache, info.StringIds, tag)); BitmapContextFactory.Populate(context, info, tag, bitmap); }
private static int CompareTags(TagInstance lhs, TagInstance rhs) { var classCompare = lhs.Group.Tag.CompareTo(rhs.Group.Tag); if (classCompare != 0) { return(classCompare); } return(lhs.Index.CompareTo(rhs.Index)); }
private static void EditScenario(CommandContext context, OpenTagCache info, TagInstance tag) { Scenario scenario; using (var stream = info.OpenCacheRead()) scenario = info.Deserializer.Deserialize <Scenario>( new TagSerializationContext(stream, info.Cache, info.StringIDs, tag)); ScnrContextFactory.Populate(context, info, tag, scenario); }
public static void Populate(CommandContext context, OpenTagCache info, TagInstance tag, MultilingualUnicodeStringList unic) { if (info.StringIds == null) { return; } context.AddCommand(new ListCommand(info, unic)); context.AddCommand(new SetCommand(info, tag, unic)); }
private static void EditAnimation(CommandContext context, OpenTagCache info, TagInstance tag) { ModelAnimationGraph animation; using (var stream = info.OpenCacheRead()) animation = info.Deserializer.Deserialize <ModelAnimationGraph>( new TagSerializationContext(stream, info.Cache, info.StringIDs, tag)); AnimationContextFactory.Populate(context, info, tag, animation); }
private static void EditBitmap(CommandContext context, OpenTagCache info, TagInstance tag) { Bitmap bitmap; using (var stream = info.OpenCacheRead()) bitmap = info.Deserializer.Deserialize <Bitmap>( new TagSerializationContext(stream, info.Cache, info.StringIDs, tag)); BitmapContextFactory.Populate(context, info, tag, bitmap); }
public TagAnalyzer(TagCache cache, TagInstance tag) { _cache = cache; _tag = tag; _tagMap = BuildTagMap(tag); _dataFixupsByWriteOffset = _tag.DataFixups.ToDictionary(f => f.WriteOffset); _resourceFixupsByWriteOffset = _tag.ResourceFixups.ToDictionary(f => f.WriteOffset); foreach (var group in cache.Tags.NonNull().Select(t => t.GroupTag).Distinct()) _tagGroups.Add(group); }
public ListArgumentsCommand(OpenTagCache info, TagInstance tag, RenderMethod definition) : base(CommandFlags.Inherit, "ListArguments", "Lists the arguments of the render_method.", "ListArguments", "Lists the arguments of the render_method.") { Info = info; Tag = tag; Definition = definition; }
public ReplaceCommand(OpenTagCache info, TagInstance tag, RenderModel definition) : base(CommandFlags.None, "replace", "", "replace <dest tag index> <dest cache dir>", "") { Info = info; Tag = tag; Definition = definition; }
public ListBitmapsCommand(OpenTagCache info, TagInstance tag, RenderMethod definition) : base(CommandFlags.Inherit, "ListBitmaps", "Lists the bitmaps used by the render_method.", "ListBitmaps", "Lists the bitmaps used by the render_method.") { Info = info; Tag = tag; Definition = definition; }
public GetResourceCommand(OpenTagCache info, TagInstance tag, RenderModel definition) : base(CommandFlags.None, "getresource", "", "getresource", "") { Info = info; Tag = tag; Definition = definition; }
public ImportCommand(OpenTagCache info, TagInstance tag, VFilesList definition) : base(CommandFlags.None, "import", "Replace a file stored in the tag", "import <virtual path> [filename]", "Replaces a file stored in the tag. The tag will be resized as necessary.") { Info = info; Tag = tag; Definition = definition; }
public static CommandContext Create(CommandContext parent, OpenTagCache info, TagInstance tag, RenderModel renderModel) { var groupName = info.StringIds.GetString(tag.GroupName); var context = new CommandContext(parent, string.Format("{0:X8}.{1}", tag.Index, groupName)); Populate(context, info, tag, renderModel); return context; }
/// <summary> /// Serializes a tag reference. /// </summary> /// <param name="writer">The writer to write to.</param> /// <param name="referencedTag">The referenced tag.</param> /// <param name="valueInfo">Information about the value. Can be <c>null</c>.</param> private static void SerializeTagReference(BinaryWriter writer, TagInstance referencedTag, TagFieldAttribute valueInfo) { // Write the reference out if (valueInfo == null || (valueInfo.Flags & TagFieldFlags.Short) == 0) { writer.Write((referencedTag != null) ? referencedTag.Group.Tag.Value : -1); writer.Write(0); writer.Write(0); } writer.Write((referencedTag != null) ? referencedTag.Index : -1); }
public SaveChangesCommand(OpenTagCache info, TagInstance tag, object value) : base(CommandFlags.Inherit, "savechanges", $"Saves changes made to the current {info.StringIds.GetString(tag.GroupName)} definition.", "savechanges", $"Saves changes made to the current {info.StringIds.GetString(tag.GroupName)} definition.") { Info = info; Tag = tag; Value = value; }
public SpecifyShadersCommand(OpenTagCache info, TagInstance tag, RenderModel definition) : base(CommandFlags.Inherit, "SpecifyShaders", "Allows the shaders of a render_model to be respecified.", "SpecifyShaders", "Allows the shaders of a render_model to be respecified.") { Info = info; Tag = tag; Definition = definition; }
public ListBitmapsCommand(OpenTagCache info, TagInstance tag, RenderMethod definition) : base(CommandFlags.Inherit, "listbitmaps", "Lists the bitmaps used by the render_method.", "listbitmaps", "Lists the bitmaps used by the render_method.") { Info = info; Tag = tag; Definition = definition; }
public SpecifyBitmapsCommand(OpenTagCache info, TagInstance tag, RenderMethod definition) : base(CommandFlags.Inherit, "specifybitmaps", "Allows the bitmaps of the render_method to be respecified.", "specifybitmaps", "Allows the bitmaps of the render_method to be respecified.") { Info = info; Tag = tag; Definition = definition; }
public SpecifyBitmapsCommand(OpenTagCache info, TagInstance tag, RenderMethod definition) : base(CommandFlags.Inherit, "SpecifyBitmaps", "Allows the bitmaps of the render_method to be respecified.", "SpecifyBitmaps", "Allows the bitmaps of the render_method to be respecified.") { Info = info; Tag = tag; Definition = definition; }
public SaveChangesCommand(OpenTagCache info, TagInstance tag, object value) : base(CommandFlags.Inherit, "savechanges", $"Saves changes made to the current {info.StringIDs.GetString(tag.Group.Name)} definition.", "savechanges", $"Saves changes made to the current {info.StringIDs.GetString(tag.Group.Name)} definition.") { Info = info; Tag = tag; Value = value; }
public SpecifyShadersCommand(OpenTagCache info, TagInstance tag, RenderModel definition) : base(CommandFlags.Inherit, "specifyshaders", "Allows the shaders of a render_model to be respecified.", "specifyshaders", "Allows the shaders of a render_model to be respecified.") { Info = info; Tag = tag; Definition = definition; }
public static CommandContext Create(CommandContext parent, OpenTagCache info, TagInstance tag, MultilingualUnicodeStringList unic) { var groupName = info.StringIds.GetString(tag.Group.Name); var context = new CommandContext(parent, string.Format("{0:X8}.{1}", tag.Index, groupName)); Populate(context, info, tag, unic); return context; }
public GetResourcesCommand(OpenTagCache info, TagInstance tag, ModelAnimationGraph definition) : base(CommandFlags.None, "getresources", "", "getresources", "") { Info = info; Tag = tag; Definition = definition; }
public ListArgumentsCommand(OpenTagCache info, TagInstance tag, RenderMethod definition) : base(CommandFlags.Inherit, "listarguments", "Lists the arguments of the render_method.", "listarguments", "Lists the arguments of the render_method.") { Info = info; Tag = tag; Definition = definition; }
public EditBlockCommand(CommandContextStack stack, OpenTagCache info, TagInstance tag, object value) : base(CommandFlags.Inherit, "Edit", "Edit the fields of a particular block element.", "Edit <block name> [block index (if block)]", "Edit the fields of a particular block element.") { Info = info; Stack = stack; Tag = tag; Structure = new TagStructureInfo(value.GetType(), Info.Version); Owner = value; }
public AddToBlockCommand(CommandContextStack stack, OpenTagCache info, TagInstance tag, TagStructureInfo structure, object owner) : base(CommandFlags.Inherit, "AddTo", $"Adds block element(s) to the end of a specific tag block in the current {structure.Types[0].Name} definition.", "AddTo <tag block name> [amount = 1]", $"Adds block element(s) to the end of a specific tag block in the current {structure.Types[0].Name} definition.") { Stack = stack; Info = info; Tag = tag; Structure = structure; Owner = owner; }
public RemoveFromBlockCommand(CommandContextStack stack, OpenTagCache info, TagInstance tag, TagStructureInfo structure, object owner) : base(CommandFlags.Inherit, "RemoveFrom", $"Removes block element(s) from a specified index of a specific tag block in the current {structure.Types[0].Name} definition.", "RemoveFrom <tag block name> [* | <tag block index> [* | amount = 1]]", $"Removes block element(s) from a specified index of a specific tag block in the current {structure.Types[0].Name} definition.") { Stack = stack; Info = info; Tag = tag; Structure = structure; Owner = owner; }
public SetFieldCommand(CommandContextStack stack, OpenTagCache info, TagInstance tag, TagStructureInfo structure, object owner) : base(CommandFlags.Inherit, "SetField", $"Sets the value of a specific field in the current {structure.Types[0].Name} definition.", "SetField <field name> <field value>", $"Sets the value of a specific field in the current {structure.Types[0].Name} definition.") { Stack = stack; Info = info; Tag = tag; Structure = structure; Owner = owner; }
public PasteElementsCommand(CommandContextStack stack, OpenTagCache info, TagInstance tag, TagStructureInfo structure, object owner) : base(CommandFlags.Inherit, "PasteElements", $"Pastes block element(s) to a specific tag block in the current {structure.Types[0].Name} definition.", "PasteElements <tag block name> [index = *]", $"Pastes block element(s) to a specific tag block in the current {structure.Types[0].Name} definition.") { Stack = stack; Info = info; Tag = tag; Structure = structure; Owner = owner; }
public ImportCommand(OpenTagCache info, TagInstance tag, VFilesList definition) : base( CommandFlags.None, "import", "Replace a file stored in the tag", "import <virtual path> [filename]", "Replaces a file stored in the tag. The tag will be resized as necessary.") { Info = info; Tag = tag; Definition = definition; }
public ImportAllCommand(OpenTagCache info, TagInstance tag, VFilesList definition) : base( CommandFlags.None, "importall", "Replace all files stored in the tag", "importall [directory]", "Replaces all file stored in the tag. The tag will be resized as necessary.\n" + "If no directory is specified, files will be loaded from the current directory.") { Info = info; Tag = tag; Definition = definition; }
public ImportCommand(OpenTagCache info, TagInstance tag, Bitmap bitmap) : base( CommandFlags.None, "import", "Import an image from a DDS file", "import <image index> <path>", "The image index must be in hexadecimal.\n" + "No conversion will be done on the data in the DDS file.\n" + "The pixel format must be supported by the game.") { Info = info; Tag = tag; Definition = bitmap; }
public SetCommand(OpenTagCache info, TagInstance tag, MultilingualUnicodeStringList unic) : base( CommandFlags.None, "set", "Set the value of a string", "set <language> <stringid> <value>", "Sets the string associated with a stringID in a language.\n" + "Remember to put the string value in quotes if it contains spaces.\n" + "If the string does not exist, it will be added.") { Info = info; Tag = tag; Definition = unic; }