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;
		}
Example #2
0
        public static CommandContext Create(CommandContextStack stack, OpenTagCache info)
        {
            var context = new CommandContext(null, info.CacheFile.Name);

            context.AddCommand(new HelpCommand(stack));
            context.AddCommand(new ClearCommand());
            context.AddCommand(new DumpLogCommand());
            context.AddCommand(new EchoCommand());
            context.AddCommand(new DependencyCommand(info));
            context.AddCommand(new ExtractCommand(info));
            context.AddCommand(new ImportCommand(info));
            context.AddCommand(new InfoCommand(info));
            context.AddCommand(new ListCommand(info));
            context.AddCommand(new MapCommand());
            context.AddCommand(new DuplicateTagCommand(info));
            context.AddCommand(new AddressCommand());
            context.AddCommand(new ResourceDataCommand());
            if (info.StringIds != null)
            {
                context.AddCommand(new EditCommand(stack, info));
                context.AddCommand(new ExtractBitmapsCommand(info));
                context.AddCommand(new ImportBitmapCommand(info));
                context.AddCommand(new CollisionGeometryTestCommand(info));
                context.AddCommand(new PhysicsModelTestCommand(info));
                context.AddCommand(new StringIdCommand(info));
                context.AddCommand(new ListStringsCommand(info));
                context.AddCommand(new GenerateLayoutsCommand(info));
                context.AddCommand(new ModelTestCommand(info));
                context.AddCommand(new ConvertPluginsCommand(info));
                context.AddCommand(new GenerateTagNamesCommand(info));
                context.AddCommand(new MatchTagsCommand(info));
                context.AddCommand(new ConvertCommand(info));
            }
            return(context);
        }
Example #3
0
 public RavenProjectionEventListener(IRavenProjectionSubSystem projectionSubSystem,
                                     IUnitOfWorkFactory unitOfWorkFactory, CommandContextStack commandContextStack,
                                     RavenProjectionEventSequencer eventSequencer) :
     base(projectionSubSystem, unitOfWorkFactory, commandContextStack)
 {
     EventSequencer = eventSequencer;
 }
        public ProjectionEventListenerTests()
        {
            myEntity1Projector = Substitute.For <IEntityEventProjector>();

            myEntity2Projector = Substitute.For <IEntityEventProjector>();

            sequencer = Substitute.For <IAsyncEventSequencer <DomainAggregateEvent> >();
            sequencer.GetEventSequencing(null).ReturnsForAnyArgs(new[]
            {
                new EventSequencing()
                {
                    SequenceName        = "MyProjectionEventListener",
                    EventSequenceNumber = 1
                }
            });
            sequencer.ShouldAttemptSynchronousDispatch(null).ReturnsForAnyArgs(true);

            projectionSubSystem = Substitute.For <IProjectionSubSystem>();

            unitOfWorkFactory = Substitute.For <IUnitOfWorkFactory>();
            unitOfWork        = Substitute.For <IUnitOfWork>();
            unitOfWorkFactory.CreateUnitOfWork().Returns(unitOfWork);

            commandContextStack = new CommandContextStack();

            sut = Substitute.ForPartsOf <ProjectionEventListener>(projectionSubSystem, unitOfWorkFactory, commandContextStack);
            sut.EventSequencer.Returns(sequencer);
        }
 public static CommandContext Create(CommandContextStack stack, OpenTagCache info)
 {
     var context = new CommandContext(null, info.CacheFile.Name);
     context.AddCommand(new HelpCommand(stack));
     context.AddCommand(new DependencyCommand(info));
     context.AddCommand(new FixupCommand(info));
     context.AddCommand(new ExtractCommand(info));
     context.AddCommand(new ImportCommand(info));
     context.AddCommand(new InfoCommand(info));
     context.AddCommand(new InsertCommand(info));
     context.AddCommand(new ListCommand(info));
     context.AddCommand(new MapCommand());
     context.AddCommand(new EditCommand(stack, info));
     context.AddCommand(new DuplicateTagCommand(info));
     context.AddCommand(new AddressCommand());
     context.AddCommand(new ExtractBitmapsCommand(info));
     context.AddCommand(new ResourceDataCommand());
     context.AddCommand(new TagBlockCommand(info));
     if (info.StringIds != null)
     {
         context.AddCommand(new StringIdCommand(info));
         context.AddCommand(new ListStringsCommand(info));
         context.AddCommand(new GenerateLayoutsCommand(info));
         context.AddCommand(new ModelTestCommand(info));
     }
     return context;
 }
        public static CommandContext Create(CommandContextStack contextStack, GameCache cache)
        {
            var context = new CommandContext(contextStack.Context, "tags");

            Populate(contextStack, context, cache);
            return(context);
        }
 public static CommandContext Create(CommandContextStack stack, OpenTagCache info)
 {
     var context = new CommandContext(null, info.CacheFile.Name);
     context.AddCommand(new HelpCommand(stack));
     context.AddCommand(new ClearCommand());
     context.AddCommand(new DumpLogCommand());
     context.AddCommand(new EchoCommand());
     context.AddCommand(new DependencyCommand(info));
     context.AddCommand(new ExtractCommand(info));
     context.AddCommand(new ImportCommand(info));
     context.AddCommand(new InfoCommand(info));
     context.AddCommand(new ListCommand(info));
     context.AddCommand(new MapCommand());
     context.AddCommand(new DuplicateTagCommand(info));
     context.AddCommand(new AddressCommand());
     context.AddCommand(new ResourceDataCommand());
     if (info.StringIds != null)
     {
         context.AddCommand(new EditCommand(stack, info));
         context.AddCommand(new ExtractBitmapsCommand(info));
         context.AddCommand(new ImportBitmapCommand(info));
         context.AddCommand(new CollisionGeometryTestCommand(info));
         context.AddCommand(new PhysicsModelTestCommand(info));
         context.AddCommand(new StringIdCommand(info));
         context.AddCommand(new ListStringsCommand(info));
         context.AddCommand(new GenerateLayoutsCommand(info));
         context.AddCommand(new ModelTestCommand(info));
         context.AddCommand(new ConvertPluginsCommand(info));
         context.AddCommand(new GenerateTagNamesCommand(info));
         context.AddCommand(new MatchTagsCommand(info));
         context.AddCommand(new ConvertCommand(info));
     }
     return context;
 }
Example #8
0
 public ProjectionEventListener(IProjectionSubSystem projectionSubSystem,
                                IUnitOfWorkFactory unitOfWorkFactory, CommandContextStack commandContextStack)
 {
     this.projectionSubSystem = projectionSubSystem;
     this.unitOfWorkFactory   = unitOfWorkFactory;
     this.commandContextStack = commandContextStack;
 }
Example #9
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 static void Populate(CommandContextStack contextStack, CommandContext context, GameCache cache)
        {
            context.AddCommand(new TestCommand(cache));

            context.AddCommand(new DumpLogCommand());
            context.AddCommand(new RunCommands(contextStack));
            context.AddCommand(new ClearCommand());
            context.AddCommand(new EchoCommand());
            context.AddCommand(new HelpCommand(contextStack));
            context.AddCommand(new SetLocaleCommand());
            context.AddCommand(new StopwatchCommand());
            context.AddCommand(new ConvertPluginsCommand(cache));
            context.AddCommand(new ListTagsCommand(cache));
            context.AddCommand(new EditTagCommand(contextStack, cache));
            context.AddCommand(new GenerateCampaignFileCommand(cache));
            context.AddCommand(new NameTagCommand(cache));
            context.AddCommand(new ForEachCommand(contextStack, cache));
            context.AddCommand(new ListAllStringsCommand(cache));
            context.AddCommand(new StringIdCommand(cache));
            context.AddCommand(new GenerateAssemblyPluginsCommand());
            context.AddCommand(new DuplicateTagCommand(cache));
            context.AddCommand(new DeleteTagCommand(cache));
            context.AddCommand(new ListNullTagsCommand(cache));
            context.AddCommand(new ListUnnamedTagsCommand(cache));
            context.AddCommand(new ExtractBitmapsCommand(cache));

            // Halo Online Specific Commands
            if (cache is GameCacheHaloOnlineBase)
            {
                var hoCache = cache as GameCacheHaloOnlineBase;
                context.AddCommand(new SaveTagNamesCommand(hoCache));
                context.AddCommand(new SaveModdedTagsCommand(hoCache));
                context.AddCommand(new CreateTagCommand(hoCache));
                context.AddCommand(new ImportTagCommand(hoCache));
                context.AddCommand(new TagDependencyCommand(hoCache));
                context.AddCommand(new TagResourceCommand(hoCache));
                context.AddCommand(new ListUnusedTagsCommand(hoCache));
                context.AddCommand(new GetTagInfoCommand(hoCache));
                context.AddCommand(new GetTagAddressCommand());
                context.AddCommand(new ExtractTagCommand(hoCache));
                context.AddCommand(new ExtractAllTagsCommand(hoCache));
                context.AddCommand(new ExportTagModCommand(hoCache));

                // modding commands
                context.AddCommand(new ApplyModPackageCommand(hoCache));
                context.AddCommand(new CreateCharacterType(cache));
                context.AddCommand(new ExportModPackageCommand(hoCache));

                context.AddCommand(new UpdateMapFilesCommand(cache));

                context.AddCommand(new PhysicsModelTestCommand(cache));
                context.AddCommand(new CollisionModelTestCommand(hoCache));
            }

            // porting related
            context.AddCommand(new UseXSDCommand());
            context.AddCommand(new UseAudioCacheCommand());
            context.AddCommand(new OpenCacheFileCommand(contextStack, cache));
        }
        public static CommandContext Create(CommandContextStack contextStack, HaloOnlineCacheContext cacheContext, CacheFile blamCache)
        {
            var context = new CommandContext(contextStack.Context, blamCache.Header.ScenarioPath);

            Populate(contextStack, context, cacheContext, blamCache);

            return(context);
        }
 public ExitToCommand(CommandContextStack stack)
     : base( CommandFlags.Inherit,
           "ExitTo",
           "Exits each context on the stack until the specified one is found.",
           "ExitTo <context name>",
           "Exits each context on the stack until the specified one is found.")
 {
     Stack = stack;
 }
Example #13
0
 public ExitToCommand(CommandContextStack stack)
     : base(CommandFlags.Inherit,
            "ExitTo",
            "Exits each context on the stack until the specified one is found.",
            "ExitTo <context name>",
            "Exits each context on the stack until the specified one is found.")
 {
     Stack = stack;
 }
Example #14
0
 public SagaEventListener(SagaEventSequencer sagaEventSequencer,
                          Func <ISagaEventDispatcher> sagaEventDispatcherFunc, CommandContextStack commandContextStack,
                          IUnitOfWorkFactory unitOfWorkFactory)
 {
     this.sagaEventDispatcherFunc = sagaEventDispatcherFunc;
     this.commandContextStack     = commandContextStack;
     this.unitOfWorkFactory       = unitOfWorkFactory;
     EventSequencer = sagaEventSequencer;
 }
Example #15
0
 public HelpCommand(CommandContextStack contextStack)
     : base(CommandFlags.Inherit,
            "help",
            "Display help",
            "help [command]",
            "Displays help on how to use a command.\n" +
            "If no command is given, help will list all available commands.")
 {
     ContextStack = contextStack;
 }
Example #16
0
 public HelpCommand(CommandContextStack contextStack)
     : base(CommandFlags.Inherit,
           "help",
           "Display help",
           "help [command]",
           "Displays help on how to use a command.\n" +
           "If no command is given, help will list all available commands.")
 {
     ContextStack = contextStack;
 }
Example #17
0
 public OpenCacheCommand(CommandContextStack stack, OpenTagCache info)
     : base(CommandFlags.Inherit,
           "opencache",
           "Opens a cache file format comparison and porting",
           "opencache <cache file>",
           "Opens a cache file format comparison and porting")
 {
     Stack = stack;
     Info = info;
 }
Example #18
0
 public OpenCacheCommand(CommandContextStack stack, OpenTagCache info)
     : base(CommandFlags.Inherit,
            "opencache",
            "Opens a cache file format comparison and porting",
            "opencache <cache file>",
            "Opens a cache file format comparison and porting")
 {
     Stack = stack;
     Info  = info;
 }
        public static CommandContext Create(CommandContextStack contextStack, HaloOnlineCacheContext cacheContext)
        {
            var context = new CommandContext(contextStack.Context, "tags");

            context.AddCommand(new HelpCommand(contextStack));
            context.AddCommand(new ClearCommand());
            context.AddCommand(new DumpLogCommand());
            context.AddCommand(new EchoCommand());
            context.AddCommand(new SetLocaleCommand());
            context.AddCommand(new StopwatchCommand());
            context.AddCommand(new CleanCsvFileCommand(cacheContext));
            context.AddCommand(new TagDependencyCommand(cacheContext));
            context.AddCommand(new ExtractTagCommand(cacheContext));
            context.AddCommand(new ImportTagCommand(cacheContext));
            context.AddCommand(new GetTagInfoCommand(cacheContext));
            context.AddCommand(new ListTagsCommand(cacheContext));
            context.AddCommand(new GetMapInfoCommand());
            context.AddCommand(new DuplicateTagCommand(cacheContext));
            context.AddCommand(new GetTagAddressCommand());
            context.AddCommand(new TagResourceCommand(cacheContext));
            context.AddCommand(new DeleteTagCommand(cacheContext));
            context.AddCommand(new CleanCacheFilesCommand(cacheContext));
            context.AddCommand(new RebuildCacheFilesCommand(cacheContext));
            context.AddCommand(new ListUnusedTagsCommand(cacheContext));
            context.AddCommand(new ListNullTagsCommand(cacheContext));
            context.AddCommand(new CreateTagCommand(cacheContext));
            context.AddCommand(new ExtractAllTagsCommand(cacheContext));
            context.AddCommand(new Editing.EditTagCommand(contextStack, cacheContext));
            context.AddCommand(new CollisionModelTestCommand(cacheContext));
            context.AddCommand(new PhysicsModelTestCommand(cacheContext));
            context.AddCommand(new StringIdCommand(cacheContext));
            context.AddCommand(new ListAllStringsCommand(cacheContext));
            context.AddCommand(new GenerateTagStructuresCommand(cacheContext));
            context.AddCommand(new RenderModelTestCommand(cacheContext));
            context.AddCommand(new ConvertPluginsCommand(cacheContext));
            context.AddCommand(new GenerateTagNamesCommand(cacheContext));
            context.AddCommand(new NameTagCommand(cacheContext));
            context.AddCommand(new SaveTagNamesCommand(cacheContext));
            context.AddCommand(new MatchTagsCommand(cacheContext));
            context.AddCommand(new ConvertTagCommand(cacheContext));
            context.AddCommand(new UpdateMapFilesCommand(cacheContext));
            context.AddCommand(new Bitmaps.ExtractBitmapsCommand(cacheContext));
            context.AddCommand(new GenerateAssemblyPluginsCommand());
            context.AddCommand(new RelocateResourcesCommand(cacheContext));
            context.AddCommand(new RebuildStringIdsCommand(cacheContext));
            context.AddCommand(new OpenCacheFileCommand(contextStack, cacheContext));
            context.AddCommand(new ExportTagModCommand(cacheContext));
            context.AddCommand(new Shaders.RegenerateShaders(cacheContext));
            context.AddCommand(new UseAudioCacheCommand());
            context.AddCommand(new ForEachCommand(contextStack, cacheContext));
            context.AddCommand(new ExportModPackageCommand(cacheContext));

            return(context);
        }
Example #20
0
        public ExitToCommand(CommandContextStack contextStack)
            : base(true,

                   "ExitTo",
                   "Exits each context on the stack until the specified one is found.",

                   "ExitTo <context name>",

                   "Exits each context on the stack until the specified one is found.")
        {
            ContextStack = contextStack;
        }
Example #21
0
        public RunCommands(CommandContextStack contextStack)
            : base(true,

                   "RunCommands",
                   "Run commands from a file.",

                   "RunCommands <file> [print]",

                   "Run commands from a file.")
        {
            ContextStack = contextStack;
        }
Example #22
0
 public AddToCommand(CommandContextStack stack, OpenTagCache info, TagInstance tag, TagStructureInfo structure, object owner)
     : base(CommandFlags.Inherit,
            "addto",
            $"Adds/inserts block element(s) to a specific tag block in the current {structure.Types[0].Name} definition.",
            "addto <tag block name> [amount = 1] [index = *]",
            $"Adds/inserts 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 OpenCacheFileCommand(CommandContextStack contextStack, HaloOnlineCacheContext cacheContext)
            : base(false,

                   "OpenCacheFile",
                   "Opens a porting context on a cache file from H3B/H3/ODST.",

                   "OpenCacheFile <Cache File>",

                   "Opens a porting context on a cache file from H3B/H3/ODST.")
        {
            ContextStack = contextStack;
            CacheContext = cacheContext;
        }
 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;
 }
Example #25
0
        public OpenCacheFileCommand(CommandContextStack contextStack, GameCache cache)
            : base(false,

                   "OpenCacheFile",
                   "Opens a porting context with the specified cache file.",

                   "OpenCacheFile <Cache File>",

                   "Opens a porting context with the specified cache file.")
        {
            ContextStack = contextStack;
            Cache        = cache;
        }
        public OpenCacheFileCommand(CommandContextStack contextStack, HaloOnlineCacheContext cacheContext)
            : base(false,

                   "OpenCacheFile",
                   "Opens a porting context with the specified cache file.",

                   "OpenCacheFile <Cache File>",

                   "Opens a porting context with the specified cache file.")
        {
            ContextStack = contextStack;
            CacheContext = cacheContext;
        }
 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 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 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 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;
 }
Example #31
0
 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;
 }
Example #32
0
        public ForEachCommand(CommandContextStack contextStack, HaloOnlineCacheContext cacheContext) :
            base(false,

                 "ForEach",
                 "Executes a command on every instance of the specified tag group.",

                 "ForEach [Const] <Tag Group> [Named: <Regex>] <Command...>",

                 "Executes a command on every instance of the specified tag group.")
        {
            ContextStack = contextStack;
            CacheContext = cacheContext;
        }
Example #33
0
 public CopyElementsCommand(CommandContextStack stack, OpenTagCache info, TagInstance tag, TagStructureInfo structure, object owner)
     : base(CommandFlags.None,
            "copyelements",
            "Copies block elements from one tag to another.",
            "copyelements <block name> [count = *] [index = 0]",
            "Copies block elements from one tag to another.")
 {
     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 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 UnitOfWorkCommandFilterTests()
        {
            unitOfWorkFactory = Substitute.For <IUnitOfWorkFactory>();
            unitOfWorkFactory.CreateUnitOfWork().Returns(ci =>
            {
                unitOfWork = Substitute.For <IUnitOfWork>();
                return(unitOfWork);
            });

            commandContextStack = new CommandContextStack();

            sut = new UnitOfWorkCommandFilter(unitOfWorkFactory, commandContextStack);
        }
Example #37
0
 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;
 }
Example #38
0
 public static void Populate(CommandContextStack contextStack, CommandContext context, GameCache currentCache, GameCache portingCache)
 {
     if (currentCache is GameCacheHaloOnlineBase hoCache)
     {
         var portTagCommand = new PortTagCommand(hoCache, portingCache);
         context.AddCommand(portTagCommand);
         context.AddCommand(new MergeAnimationGraphsCommand(hoCache, portingCache, portTagCommand));
         context.AddCommand(new PortMultiplayerEventsCommand(hoCache, portingCache));
         context.AddCommand(new PortMultiplayerScenarioCommand(hoCache, portingCache, portTagCommand));
         context.AddCommand(new MatchTemplateCommand(hoCache, portingCache));
         context.AddCommand(new PortInstancedGeometryObjectCommand(hoCache, portingCache));
         context.AddCommand(new PortClusterGeometryObjectCommand(hoCache, portingCache));
     }
 }
        public RemoveBlockElementsCommand(CommandContextStack contextStack, HaloOnlineCacheContext cacheContext, CachedTagInstance tag, TagStructureInfo structure, object owner)
            : base(true,

                   "RemoveBlockElements",
                   $"Removes block element(s) from a specified index of a specific tag block in the current {structure.Types[0].Name} definition.",

                   "RemoveBlockElements <block name> [* | <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.")
        {
            ContextStack = contextStack;
            CacheContext = cacheContext;
            Tag          = tag;
            Structure    = structure;
            Owner        = owner;
        }
Example #40
0
        public EditTagCommand(CommandContextStack contextStack, CacheFile blamCache) : base(
                false,

                "EditTag",
                "Edit tag-specific data",

                "EditTag <tag>",

                "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.")
        {
            ContextStack = contextStack;
            BlamCache    = blamCache;
        }
        public static void Populate(CommandContextStack contextStack, CommandContext context, HaloOnlineCacheContext cacheContext, CacheFile blamCache)
        {
            var portTagCommand = new PortTagCommand(cacheContext, blamCache);

            context.AddCommand(portTagCommand);
            context.AddCommand(new ExtractXMACommand(cacheContext, blamCache));
            context.AddCommand(new ExtractSoundCommand(cacheContext, blamCache));
            context.AddCommand(new ExtractBitmapCommand(blamCache));
            context.AddCommand(new EditTagCommand(contextStack, blamCache));
            context.AddCommand(new ListBlamTagsCommand(cacheContext, blamCache));
            context.AddCommand(new PortArmorVariantCommand(cacheContext, blamCache));
            context.AddCommand(new PortMultiplayerEventsCommand(cacheContext, blamCache));
            context.AddCommand(new NameBlamTagCommand(cacheContext, blamCache));
            context.AddCommand(new MergeAnimationGraphsCommand(cacheContext, blamCache, portTagCommand));
        }
Example #42
0
        public EditCommand(CommandContextStack stack, OpenTagCache info)
            : 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 = info.Cache;
            _info = info;
        }
        public static CommandContext Create(CommandContextStack stack, OpenTagCache info, TagInstance tag)
        {
            var groupName = info.StringIDs.GetString(tag.Group.Name);

            var tagName = $"0x{tag.Index:X4}";

            if (info.TagNames.ContainsKey(tag.Index))
            {
                tagName = info.TagNames[tag.Index];
                tagName = $"(0x{tag.Index:X4}) {tagName.Substring(tagName.LastIndexOf('\\') + 1)}";
            }

            var context = new CommandContext(stack.Context,
                string.Format("{0}.{1}", tagName, groupName));

            object value = null;

            using (var stream = info.OpenCacheRead())
                value = info.Deserializer.Deserialize(
                    new TagSerializationContext(stream, info.Cache, info.StringIDs, tag),
                    TagStructureTypes.FindByGroupTag(tag.Group.Tag));

            switch (tag.Group.Tag.ToString())
            {
                case "vfsl": // vfiles_list
                    VFilesContextFactory.Populate(context, info, tag, (VFilesList)value);
                    break;

                case "unic": // multilingual_unicode_string_list
                    UnicodeContextFactory.Populate(context, info, tag, (MultilingualUnicodeStringList)value);
                    break;

                case "bitm": // bitmap
                    BitmapContextFactory.Populate(context, info, tag, (Bitmap)value);
                    break;

                case "hlmt": // model
                    ModelContextFactory.Populate(context, info, tag, (Model)value);
                    break;

                case "mode": // render_model
                    RenderModelContextFactory.Populate(context, info, tag, (RenderModel)value);
                    break;

                case "jmad":
                    AnimationContextFactory.Populate(context, info, tag, (ModelAnimationGraph)value);
                    break;

                case "rm  ": // render_method
                case "rmsh": // shader
                case "rmd ": // shader_decal
                case "rmfl": // shader_foliage
                case "rmhg": // shader_halogram
                case "rmss": // shader_screen
                case "rmtr": // shader_terrain
                case "rmw ": // shader_water
                case "rmzo": // shader_zonly
                case "rmcs": // shader_custom
                    RenderMethodContextFactory.Populate(context, info, tag, (RenderMethod)value);
                    break;

                case "scnr":
                    ScnrContextFactory.Populate(context, info, tag, (Scenario)value);
                    break;

                case "sbsp":
                    BSPContextFactory.Populate(context, info, tag, (ScenarioStructureBsp)value);
                    break;
            }

            var structure = new TagStructureInfo(
                TagStructureTypes.FindByGroupTag(tag.Group.Tag));

            context.AddCommand(new ListFieldsCommand(info, structure, value));
            context.AddCommand(new SetFieldCommand(stack, info, tag, structure, value));
            context.AddCommand(new EditBlockCommand(stack, info, tag, value));
            context.AddCommand(new AddToCommand(stack, info, tag, structure, value));
            context.AddCommand(new RemoveFromCommand(stack, info, tag, structure, value));
            context.AddCommand(new CopyElementsCommand(stack, info, tag, structure, value));
            context.AddCommand(new PasteElementsCommand(stack, info, tag, structure, value));
            context.AddCommand(new SaveChangesCommand(info, tag, value));
            context.AddCommand(new ExitToCommand(stack));

            return context;
        }
        public static CommandContext Create(CommandContextStack stack, OpenTagCache info, TagInstance tag)
        {
            var groupName = info.StringIds.GetString(tag.Group.Name);

            var context = new CommandContext(stack.Context,
                string.Format("0x{0:X4}.{1}", tag.Index, groupName));

            switch (tag.Group.Tag.ToString())
            {
                case "vfsl": // vfiles_list
                    EditVFilesList(context, info, tag);
                    break;

                case "unic": // multilingual_unicode_string_list
                    EditMultilingualUnicodeStringList(context, info, tag);
                    break;

                case "bitm": // bitmap
                    EditBitmap(context, info, tag);
                    break;

                case "hlmt": // model
                    EditModel(context, info, tag);
                    break;

                case "mode": // render_model
                    EditRenderModel(context, info, tag);
                    break;

                case "rm  ": // render_method
                case "rmsh": // shader
                case "rmd ": // shader_decal
                case "rmfl": // shader_foliage
                case "rmhg": // shader_halogram
                case "rmss": // shader_screen
                case "rmtr": // shader_terrain
                case "rmw ": // shader_water
                case "rmzo": // shader_zonly
                case "rmcs": // shader_custom
                    EditRenderMethod(context, info, tag);
                    break;

                case "scnr":
                    EditScenario(context, info, tag);
                    break;
            }

            object value = null;

            using (var stream = info.OpenCacheRead())
                value = info.Deserializer.Deserialize(
                    new TagSerializationContext(stream, info.Cache, info.StringIds, tag),
                    TagStructureTypes.FindByGroupTag(tag.Group.Tag));

            var structure = new TagStructureInfo(
                TagStructureTypes.FindByGroupTag(tag.Group.Tag));

            context.AddCommand(new ListFieldsCommand(info, structure, value));
            context.AddCommand(new SetFieldCommand(stack, info, tag, structure, value));
            context.AddCommand(new EditBlockCommand(stack, info, tag, value));
            context.AddCommand(new AddToBlockCommand(stack, info, tag, structure, value));
            context.AddCommand(new RemoveFromBlockCommand(stack, info, tag, structure, value));
            context.AddCommand(new SaveChangesCommand(info, tag, value));
            context.AddCommand(new ExitToCommand(stack));

            return context;
        }