当前位置: 首页>>代码示例>>C#>>正文


C# CommandContext.AddCommand方法代码示例

本文整理汇总了C#中CommandContext.AddCommand方法的典型用法代码示例。如果您正苦于以下问题:C# CommandContext.AddCommand方法的具体用法?C# CommandContext.AddCommand怎么用?C# CommandContext.AddCommand使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CommandContext的用法示例。


在下文中一共展示了CommandContext.AddCommand方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Create

 public static CommandContext Create(CommandContext parent, OpenTagCache info, HaloTag tag, Model model)
 {
     var context = new CommandContext(parent, string.Format("{0:X8}.hlmt", tag.Index));
     context.AddCommand(new HlmtListVariantsCommand(info, model));
     context.AddCommand(new HlmtExtractModeCommand(info, model));
     return context;
 }
开发者ID:Gurten,项目名称:HaloOnlineTagTool,代码行数:7,代码来源:HlmtContextFactory.cs

示例2: Create

 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;
 }
开发者ID:theTwist84,项目名称:DarkConvert,代码行数:7,代码来源:HlmtContextFactory.cs

示例3: Populate

        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));
        }
开发者ID:karijuana,项目名称:HaloOnlineTagTool,代码行数:59,代码来源:RenderMethodContextFactory.cs

示例4: Populate

        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));
        }
开发者ID:medsouz,项目名称:HaloOnlineTagTool,代码行数:8,代码来源:UnicodeContextFactory.cs

示例5: Create

 public static CommandContext Create(CommandContext parent, OpenTagCache info, CacheBase blamCache)
 {
     var context = new CommandContext(parent, blamCache.Build);
     context.AddCommand(new PortShaderCommand(info, blamCache));
     context.AddCommand(new PortModelCommand(info, blamCache));
     context.AddCommand(new ListBitmapsCommand(info, blamCache));
     return context;
 }
开发者ID:XeCREATURE,项目名称:TagTool,代码行数:8,代码来源:CacheContextFactory.cs

示例6: Populate

 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));
 }
开发者ID:Shad0wShayd3,项目名称:HaloOnlineTagTool,代码行数:8,代码来源:VFilesContextFactory.cs

示例7: Create

 public static CommandContext Create(CommandContext parent, FileInfo fileInfo, TagCache cache, HaloTag tag, VFilesList vfsl)
 {
     var context = new CommandContext(parent, string.Format("{0:X8}.vfsl", tag.Index));
     context.AddCommand(new VfslListCommand(vfsl));
     context.AddCommand(new VfslExtractCommand(vfsl));
     context.AddCommand(new VfslExtractAllCommand(vfsl));
     context.AddCommand(new VfslImportCommand(fileInfo, cache, tag, vfsl));
     context.AddCommand(new VfslImportAllCommand(fileInfo, cache, tag, vfsl));
     return context;
 }
开发者ID:theTwist84,项目名称:DarkConvert,代码行数:10,代码来源:VfslContextFactory.cs

示例8: Create

 public static CommandContext Create(CommandContext parent, OpenTagCache info, HaloTag tag, MultilingualUnicodeStringList unic)
 {
     var context = new CommandContext(parent, string.Format("{0:X8}.unic", tag.Index));
     if (info.StringIds != null)
     {
         context.AddCommand(new UnicListCommand(info, unic));
         context.AddCommand(new UnicSetCommand(info, tag, unic));
     }
     return context;
 }
开发者ID:Gurten,项目名称:HaloOnlineTagTool,代码行数:10,代码来源:UnicContextFactory.cs

示例9: Create

        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;
        }
开发者ID:theTwist84,项目名称:DarkConvert,代码行数:11,代码来源:UnicContextFactory.cs

示例10: Populate

 public static void Populate(CommandContext context, OpenTagCache info, TagInstance tag, RenderModel renderModel)
 {
     context.AddCommand(new SpecifyShadersCommand(info, tag, renderModel));
 }
开发者ID:Shad0wShayd3,项目名称:HaloOnlineTagTool,代码行数:4,代码来源:RenderModelContextFactory.cs

示例11: Execute

        public override bool Execute(List<string> args)
        {
            if (args.Count < 1 || args.Count > 2)
                return false;

            var blockName = args[0];
            var ownerType = Owner.GetType();

            var enumerator = new TagFieldEnumerator(Structure);

            var deferredNames = new List<string>();
            var deferredArgs = new List<string>();

            if (blockName.Contains("."))
            {
                deferredNames.AddRange(blockName.Split('.'));
                blockName = deferredNames[0];
                deferredNames = deferredNames.Skip(1).ToList();
                deferredArgs.AddRange(args.Skip(1));
                args = new List<string> { blockName };
            }

            if (blockName.Contains("]"))
            {
                var openBracketIndex = blockName.IndexOf('[');
                var closeBracketIndex = blockName.IndexOf(']');
                var name = blockName.Substring(0, openBracketIndex);
                var index = blockName.Substring(openBracketIndex + 1, (closeBracketIndex - openBracketIndex) - 1);

                blockName = name;
                args = new List<string> { name, index };
            }

            var blockNameLow = blockName.ToLower();
            var field = enumerator.Find(f => f.Name == blockName || f.Name.ToLower() == blockNameLow);

            if (field == null)
            {
                Console.WriteLine("{0} does not contain a block named \"{1}\"", ownerType.Name, blockName);
                return false;
            }

            var contextName = "";
            object blockValue = null;

            var structureAttribute = field.FieldType.CustomAttributes.ToList().Find(a => a.AttributeType == typeof(TagStructureAttribute));

            if (structureAttribute != null)
            {
                if (args.Count != 1)
                    return false;

                blockValue = field.GetValue(Owner);
                contextName = $"{blockName}";
            }
            else
            {
                if (args.Count != 2)
                    return false;

                IList fieldValue = null;

                if (field.FieldType.GetInterface("IList") == null || (fieldValue = (IList)field.GetValue(Owner)) == null)
                {
                    Console.WriteLine("{0} does not contain a block named \"{1}\"", ownerType.Name, blockName);
                    return false;
                }

                int blockIndex = 0;

                if (args[1] == "*")
                    blockIndex = fieldValue.Count - 1;
                else if (!int.TryParse(args[1], out blockIndex))
                {
                    Console.WriteLine("Invalid index requested from block {0}: {1}", blockName, blockIndex);
                    return false;
                }

                if (blockIndex >= fieldValue.Count || blockIndex < 0)
                {
                    Console.WriteLine("Invalid index requested from block {0}: {1}", blockName, blockIndex);
                    return false;
                }

                blockValue = fieldValue[blockIndex];
                contextName = $"{blockName}[{blockIndex}]";
            }

            var blockStructure = new TagStructureInfo(blockValue.GetType());

            var blockContext = new CommandContext(Stack.Context, contextName);
            blockContext.AddCommand(new ListFieldsCommand(Info, blockStructure, blockValue));
            blockContext.AddCommand(new SetFieldCommand(Stack, Info, Tag, blockStructure, blockValue));
            blockContext.AddCommand(new EditBlockCommand(Stack, Info, Tag, blockValue));
            blockContext.AddCommand(new AddToCommand(Stack, Info, Tag, blockStructure, blockValue));
            blockContext.AddCommand(new RemoveFromCommand(Stack, Info, Tag, blockStructure, blockValue));
            blockContext.AddCommand(new CopyElementsCommand(Stack, Info, Tag, blockStructure, blockValue));
            blockContext.AddCommand(new PasteElementsCommand(Stack, Info, Tag, blockStructure, blockValue));
            blockContext.AddCommand(new ExitToCommand(Stack));
            Stack.Push(blockContext);
//.........这里部分代码省略.........
开发者ID:TheGuardians,项目名称:TagTool,代码行数:101,代码来源:EditBlockCommand.cs

示例12: Populate

 public static void Populate(CommandContext context, OpenTagCache info, TagInstance tag, Bitmap bitmap)
 {
     context.AddCommand(new ImportCommand(info, tag, bitmap));
 }
开发者ID:medsouz,项目名称:HaloOnlineTagTool,代码行数:4,代码来源:BitmapContextFactory.cs

示例13: Populate

 public static void Populate(CommandContext context, OpenTagCache info, TagInstance tag, RenderMethod renderMethod)
 {
     context.AddCommand(new ListArgumentsCommand(info, tag, renderMethod));
     context.AddCommand(new ListBitmapsCommand(info, tag, renderMethod));
     context.AddCommand(new SpecifyBitmapsCommand(info, tag, renderMethod));
 }
开发者ID:TheGuardians,项目名称:TagTool,代码行数:6,代码来源:RenderMethodContextFactory.cs

示例14: Create

 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;
 }
开发者ID:PersonalityPi,项目名称:HaloOnlineTagTool,代码行数:34,代码来源:TagCacheContextFactory.cs

示例15: Populate

 public static void Populate(CommandContext context, OpenTagCache info, TagInstance tag, ScenarioStructureBsp bsp)
 {
     context.AddCommand(new LoadResourcesCommand(info, tag, bsp));
 }
开发者ID:TheGuardians,项目名称:TagTool,代码行数:4,代码来源:BSPContextFactory.cs


注:本文中的CommandContext.AddCommand方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。