本文整理汇总了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;
}
示例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;
}
示例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));
}
示例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));
}
示例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;
}
示例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));
}
示例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;
}
示例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;
}
示例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;
}
示例10: Populate
public static void Populate(CommandContext context, OpenTagCache info, TagInstance tag, RenderModel renderModel)
{
context.AddCommand(new SpecifyShadersCommand(info, tag, renderModel));
}
示例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);
//.........这里部分代码省略.........
示例12: Populate
public static void Populate(CommandContext context, OpenTagCache info, TagInstance tag, Bitmap bitmap)
{
context.AddCommand(new ImportCommand(info, tag, bitmap));
}
示例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));
}
示例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;
}
示例15: Populate
public static void Populate(CommandContext context, OpenTagCache info, TagInstance tag, ScenarioStructureBsp bsp)
{
context.AddCommand(new LoadResourcesCommand(info, tag, bsp));
}