/// <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;
 }
예제 #3
0
 public static CommandContext Create(CommandContext parent, FileInfo fileInfo, TagCache cache, StringIdCache stringIds, HaloTag tag, Model model)
 {
     var context = new CommandContext(parent, string.Format("{0:X8}.hlmt", tag.Index));
     context.AddCommand(new HlmtListVariantsCommand(model, stringIds));
     context.AddCommand(new HlmtExtractModeCommand(cache, fileInfo, model, stringIds));
     return context;
 }
		public static CommandContext Create(CommandContextStack stack, TagCache cache, FileInfo fileInfo, StringIdCache stringIds)
		{
			var context = new CommandContext(null, fileInfo.Name);
			context.AddCommand(new HelpCommand(stack));
			context.AddCommand(new DependencyCommand(cache, fileInfo));
			context.AddCommand(new FixupCommand(cache, fileInfo));
			context.AddCommand(new ExtractCommand(cache, fileInfo));
			context.AddCommand(new ImportCommand(cache, fileInfo));
			context.AddCommand(new InfoCommand(cache));
			context.AddCommand(new InsertCommand(cache, fileInfo));
			context.AddCommand(new ListCommand(cache));
			context.AddCommand(new MapCommand());
			context.AddCommand(new EditCommand(stack, cache, fileInfo, stringIds));
			context.AddCommand(new DuplicateTagCommand(cache, fileInfo));
			context.AddCommand(new AddressCommand());
			context.AddCommand(new ExtractBitmapsCommand(cache, fileInfo));
			context.AddCommand(new ResourceDataCommand());
            context.AddCommand(new CompareCommand(cache, fileInfo));
			if (stringIds != null)
			{
				context.AddCommand(new StringIdCommand(stringIds));
				context.AddCommand(new ListStringsCommand(cache, fileInfo, stringIds));
				context.AddCommand(new GenerateLayoutsCommand(cache, fileInfo, stringIds));
			}
			return context;
		}
예제 #5
0
        public static CommandContext Create(CommandContext parent, FileInfo fileInfo, TagCache cache, HaloTag tag,
			MultilingualUnicodeStringList unic, StringIdCache stringIds)
        {
            var context = new CommandContext(parent, string.Format("{0:X8}.unic", tag.Index));
            if (stringIds != null)
            {
                context.AddCommand(new UnicListCommand(unic, stringIds));
                context.AddCommand(new UnicSetCommand(fileInfo, cache, tag, unic, stringIds));
            }
            return context;
        }
        public static CommandContext Create(CommandContext parent, FileInfo fileInfo, TagCache cache, HaloTag tag,
                                            MultilingualUnicodeStringList unic, StringIdCache stringIds)
        {
            var context = new CommandContext(parent, string.Format("{0:X8}.unic", tag.Index));

            if (stringIds != null)
            {
                context.AddCommand(new UnicListCommand(unic, stringIds));
                context.AddCommand(new UnicSetCommand(fileInfo, cache, tag, unic, stringIds));
            }
            return(context);
        }
        public HlmtListVariantsCommand(Model model, StringIdCache stringIds)
            : base(CommandFlags.Inherit,

			"listvariants",
			"List available variants",

			"listvariants",

			"Lists variant names which can be used with \"extractmode\".")
        {
            _model = model;
            _stringIds = stringIds;
        }
        public HlmtListVariantsCommand(Model model, StringIdCache stringIds) : base(
                CommandFlags.Inherit,

                "listvariants",
                "List available variants",

                "listvariants",

                "Lists variant names which can be used with \"extractmode\".")
        {
            _model     = model;
            _stringIds = stringIds;
        }
        public StringIdCommand(StringIdCache stringIds) : base(
                CommandFlags.Inherit,

                "stringid",
                "Look up or find stringID values",

                "stringid get <id>\n" +
                "stringid list [filter]",

                "\"stringid get\" will display the string corresponding to an ID value.\n" +
                "\"stringid list\" will list string IDs, optionally filtering them.")
        {
            _stringIds = stringIds;
        }
예제 #10
0
        public StringIdCommand(StringIdCache stringIds)
            : base(CommandFlags.Inherit,

			"stringid",
			"Look up or find stringID values",

			"stringid get <id>\n" +
			"stringid list [filter]",

			"\"stringid get\" will display the string corresponding to an ID value.\n" +
			"\"stringid list\" will list string IDs, optionally filtering them.")
        {
            _stringIds = stringIds;
        }
        public ModelTestCommand(OpenTagCache info)
            : base(CommandFlags.Inherit,

            "modeltest",
            "Model injection test",

            "modeltest <model file>",

            "Injects the model over the traffic cone.\n" +
            "The model must only have a single material and no nodes.")
        {
            _info = info;
            _cache = info.Cache;
            _fileInfo = info.CacheFile;
            _stringIds = info.StringIds;
        }
예제 #12
0
        public ModelTestCommand(OpenTagCache info) : base(
                CommandFlags.Inherit,

                "modeltest",
                "Model injection test",

                "modeltest [tag index] <model file>",

                "Injects the model over the traffic cone.\n" +
                "The model must only have a single material and no nodes.")
        {
            _info      = info;
            _cache     = info.Cache;
            _fileInfo  = info.CacheFile;
            _stringIds = info.StringIds;
        }
        public GenerateLayoutsCommand(TagCache cache, FileInfo fileInfo, StringIdCache stringIds) : base(
                CommandFlags.Inherit,

                "genlayouts",
                "Generate tag layouts",

                "genlayouts <type> <output dir>",

                "Scans all tags in the file to guess tag layouts.\n" +
                "Layouts will be written to the output directory in the chosen format.\n" +
                "\n" +
                "Supported types: csharp, cpp")
        {
            _cache     = cache;
            _fileInfo  = fileInfo;
            _stringIds = stringIds;
        }
예제 #14
0
        public StringIdCommand(OpenTagCache info) : base(
                CommandFlags.Inherit,

                "stringid",
                "Add, look up, or find stringID values",

                "stringid add <string>\n" +
                "stringid get <id>\n" +
                "stringid list [filter]",

                "\"stringid add\" will add a new stringID.\n" +
                "\"stringid get\" will display the string corresponding to an ID value.\n" +
                "\"stringid list\" will list stringIDs, optionally filtering them.")
        {
            _info      = info;
            _stringIds = info.StringIds;
        }
        public GenerateLayoutsCommand(TagCache cache, FileInfo fileInfo, StringIdCache stringIds)
            : base(CommandFlags.Inherit,

			"genlayouts",
			"Generate tag layouts",

			"genlayouts <type> <output dir>",

			"Scans all tags in the file to guess tag layouts.\n" +
			"Layouts will be written to the output directory in the chosen format.\n" +
			"\n" +
			"Supported types: csharp, cpp")
        {
            _cache = cache;
            _fileInfo = fileInfo;
            _stringIds = stringIds;
        }
예제 #16
0
        public StringIdCommand(OpenTagCache info)
            : base(CommandFlags.Inherit,

			"stringid",
			"Add, look up, or find stringID values",

			"stringid add <string>\n" +
			"stringid get <id>\n" +
			"stringid list [filter]",

			"\"stringid add\" will add a new stringID.\n" +
			"\"stringid get\" will display the string corresponding to an ID value.\n" +
			"\"stringid list\" will list stringIDs, optionally filtering them.")
        {
            _info = info;
            _stringIds = info.StringIds;
        }
예제 #17
0
        public UnicSetCommand(FileInfo fileInfo, TagCache cache, HaloTag tag, MultilingualUnicodeStringList unic, StringIdCache stringIds) : 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.")
        {
            _fileInfo  = fileInfo;
            _cache     = cache;
            _tag       = tag;
            _unic      = unic;
            _stringIds = stringIds;
        }
예제 #18
0
        public UnicSetCommand(FileInfo fileInfo, TagCache cache, HaloTag tag, MultilingualUnicodeStringList unic, StringIdCache stringIds)
            : 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.")
        {
            _fileInfo = fileInfo;
            _cache = cache;
            _tag = tag;
            _unic = unic;
            _stringIds = stringIds;
        }
예제 #19
0
        public HlmtExtractModeCommand(TagCache cache, FileInfo fileInfo, Model model, StringIdCache stringIds) : base(
                CommandFlags.Inherit,

                "extractmode",
                "Extract the render model",

                "extractmode <variant> <filetype> <filename>",

                "Extracts a variant of the render model to a file.\n" +
                "Use the \"listvariants\" command to list available variants.\n" +
                "If the model does not have any variants, just use \"default\"." +
                "\n" +
                "Supported file types: obj")
        {
            _cache     = cache;
            _fileInfo  = fileInfo;
            _model     = model;
            _stringIds = stringIds;
        }
예제 #20
0
        public EditCommand(CommandContextStack stack, TagCache cache, FileInfo fileInfo, StringIdCache stringIds)
            : base(CommandFlags.None,

			"edit",
			"Edit tag-specific data",

			"edit <tag index>",

			"If the tag contains data which is supported by this program,\n" +
			"this command will make special tag-specific commands available\n" +
			"which can be used to edit or view the data in the tag.\n" +
			"\n" +
			"Currently-supported tag types: bitm, hlmt, unic, vfsl")
        {
            _stack = stack;
            _cache = cache;
            _fileInfo = fileInfo;
            _stringIds = stringIds;
        }
        public HlmtExtractModeCommand(TagCache cache, FileInfo fileInfo, Model model, StringIdCache stringIds)
            : base(CommandFlags.Inherit,

			"extractmode",
			"Extract the render model",

			"extractmode <variant> <filetype> <filename>",

			"Extracts a variant of the render model to a file.\n" +
			"Use the \"listvariants\" command to list available variants.\n" +
			"If the model does not have any variants, just use \"default\"." +
			"\n" +
			"Supported file types: obj")
        {
            _cache = cache;
            _fileInfo = fileInfo;
            _model = model;
            _stringIds = stringIds;
        }
예제 #22
0
        public EditCommand(CommandContextStack stack, TagCache cache, FileInfo fileInfo, StringIdCache stringIds) : base(
                CommandFlags.None,

                "edit",
                "Edit tag-specific data",

                "edit <tag index>",

                "If the tag contains data which is supported by this program,\n" +
                "this command will make special tag-specific commands available\n" +
                "which can be used to edit or view the data in the tag.\n" +
                "\n" +
                "Currently-supported tag types: bitm, hlmt, unic, vfsl")
        {
            _stack     = stack;
            _cache     = cache;
            _fileInfo  = fileInfo;
            _stringIds = stringIds;
        }
예제 #23
0
        public UnicListCommand(MultilingualUnicodeStringList unic, StringIdCache stringIds)
            : base(CommandFlags.Inherit,

			"list",
			"List strings",

			"list <language> [filter]",

			"Lists the strings belonging to a language.\n" +
			"If a filter is specified, only strings containing the filter will be listed.\n" +
			"\n" +
			"Available languages:\n" +
			"\n" +
			"english, japanese, german, french, spanish, mexican, italian, korean,\n" +
			"chinese-trad, chinese-simp, portuguese, russian")
        {
            // TODO: Can we dynamically generate the language list from the dictionary in ArgumentParser?
            _unic = unic;
            _stringIds = stringIds;
        }
예제 #24
0
        public ListStringsCommand(TagCache cache, FileInfo fileInfo, StringIdCache stringIds) : base(
                CommandFlags.Inherit,

                "liststrings",
                "Scan unic tags to find a localized string",

                "liststrings <language> [filter]",

                "Scans all unic tags to find the strings belonging to a language.\n" +
                "If a filter is specified, only strings containing the filter will be listed.\n" +
                "\n" +
                "Available languages:\n" +
                "\n" +
                "english, japanese, german, french, spanish, mexican, italian, korean,\n" +
                "chinese-trad, chinese-simp, portuguese, russian")
        {
            _cache     = cache;
            _fileInfo  = fileInfo;
            _stringIds = stringIds;
        }
예제 #25
0
        public ListStringsCommand(TagCache cache, FileInfo fileInfo, StringIdCache stringIds)
            : base(CommandFlags.Inherit,

			"liststrings",
			"Scan unic tags to find a localized string",

			"liststrings <language> [filter]",

			"Scans all unic tags to find the strings belonging to a language.\n" +
			"If a filter is specified, only strings containing the filter will be listed.\n" +
			"\n" +
			"Available languages:\n" +
			"\n" +
			"english, japanese, german, french, spanish, mexican, italian, korean,\n" +
			"chinese-trad, chinese-simp, portuguese, russian")
        {
            _cache = cache;
            _fileInfo = fileInfo;
            _stringIds = stringIds;
        }
        public UnicListCommand(MultilingualUnicodeStringList unic, StringIdCache stringIds) : base(
                CommandFlags.Inherit,

                "list",
                "List strings",

                "list <language> [filter]",

                "Lists the strings belonging to a language.\n" +
                "If a filter is specified, only strings containing the filter will be listed.\n" +
                "\n" +
                "Available languages:\n" +
                "\n" +
                "english, japanese, german, french, spanish, mexican, italian, korean,\n" +
                "chinese-trad, chinese-simp, portuguese, russian")
        {
            // TODO: Can we dynamically generate the language list from the dictionary in ArgumentParser?
            _unic      = unic;
            _stringIds = stringIds;
        }
 /// <summary>
 /// Filters a set of localized strings and prepares them for display.
 /// </summary>
 /// <param name="unic">The string list.</param>
 /// <param name="stringIds">The string ID cache to use.</param>
 /// <param name="strings">The strings to display.</param>
 /// <param name="language">The language to display strings from.</param>
 /// <param name="filter">The filter to match strings and stringIDs against. Can be <c>null</c> to display everything.</param>
 /// <returns>The strings to print.</returns>
 public static List<DisplayString> PrepareForDisplay(MultilingualUnicodeStringList unic, StringIdCache stringIds, IEnumerable<LocalizedString> strings, GameLanguage language, string filter)
 {
     // Filter the input strings
     var display = new List<DisplayString>();
     foreach (var localizedString in strings)
     {
         var str = unic.GetString(localizedString, language);
         if (str == null)
             continue;
         var stringId = stringIds.GetString(localizedString.StringId);
         if (filter != null && !str.Contains(filter) && !stringId.Contains(filter))
             continue;
         display.Add(new DisplayString
         {
             StringId = stringId,
             String = str
         });
     }
     display.Sort((a, b) => String.Compare(a.StringId, b.StringId, StringComparison.Ordinal));
     return display;
 }
예제 #28
0
        public static CommandContext Create(CommandContextStack stack, TagCache cache, FileInfo fileInfo, StringIdCache stringIds)
        {
            var context = new CommandContext(null, fileInfo.Name);

            context.AddCommand(new HelpCommand(stack));
            context.AddCommand(new DependencyCommand(cache, fileInfo));
            context.AddCommand(new FixupCommand(cache, fileInfo));
            context.AddCommand(new ExtractCommand(cache, fileInfo));
            context.AddCommand(new ImportCommand(cache, fileInfo));
            context.AddCommand(new InfoCommand(cache));
            context.AddCommand(new InsertCommand(cache, fileInfo));
            context.AddCommand(new ListCommand(cache));
            context.AddCommand(new MapCommand());
            context.AddCommand(new EditCommand(stack, cache, fileInfo, stringIds));
            context.AddCommand(new DuplicateTagCommand(cache, fileInfo));
            context.AddCommand(new AddressCommand());
            context.AddCommand(new ExtractBitmapsCommand(cache, fileInfo));
            context.AddCommand(new ResourceDataCommand());
            if (stringIds != null)
            {
                context.AddCommand(new StringIdCommand(stringIds));
                context.AddCommand(new ListStringsCommand(cache, fileInfo, stringIds));
                context.AddCommand(new GenerateLayoutsCommand(cache, fileInfo, stringIds));
            }
            return(context);
        }
 public TagStructureClassWriter(StringIdCache stringIds, string outDir)
 {
     _stringIds = stringIds;
     _outDir = outDir;
 }
예제 #30
0
        /// <summary>
        /// Filters a set of localized strings and prepares them for display.
        /// </summary>
        /// <param name="unic">The string list.</param>
        /// <param name="stringIds">The string ID cache to use.</param>
        /// <param name="strings">The strings to display.</param>
        /// <param name="language">The language to display strings from.</param>
        /// <param name="filter">The filter to match strings and stringIDs against. Can be <c>null</c> to display everything.</param>
        /// <returns>The strings to print.</returns>
        public static List <DisplayString> PrepareForDisplay(MultilingualUnicodeStringList unic, StringIdCache stringIds, IEnumerable <LocalizedString> strings, GameLanguage language, string filter)
        {
            // Filter the input strings
            var display = new List <DisplayString>();

            foreach (var localizedString in strings)
            {
                var str = unic.GetString(localizedString, language);
                if (str == null)
                {
                    continue;
                }
                var stringId = stringIds.GetString(localizedString.StringID);
                if (filter != null && !str.Contains(filter) && !stringId.Contains(filter))
                {
                    continue;
                }
                display.Add(new DisplayString
                {
                    StringID = stringId,
                    String   = str
                });
            }
            display.Sort((a, b) => String.Compare(a.StringID, b.StringID, StringComparison.Ordinal));
            return(display);
        }
        public static CommandContext Create(CommandContext parent, FileInfo fileInfo, TagCache cache, StringIdCache stringIds, HaloTag tag, Model model)
        {
            var context = new CommandContext(parent, string.Format("{0:X8}.hlmt", tag.Index));

            context.AddCommand(new HlmtListVariantsCommand(model, stringIds));
            context.AddCommand(new HlmtExtractModeCommand(cache, fileInfo, model, stringIds));
            return(context);
        }
예제 #32
0
 public CSharpClassWriter(StringIdCache stringIds, string outDir)
 {
     _stringIds = stringIds;
     _outDir = outDir;
 }
 public CppStructWriter(StringIdCache stringIds, string outDir)
 {
     _stringIds = stringIds;
     _outDir    = outDir;
 }
예제 #34
0
 public CppStructWriter(StringIdCache stringIds, string outDir)
 {
     _stringIds = stringIds;
     _outDir = outDir;
 }
 public CSharpClassWriter(StringIdCache stringIds, string outDir)
 {
     _stringIds = stringIds;
     _outDir    = outDir;
 }