Ejemplo n.º 1
0
    public Subcommand(SubcommandType type)
    {
        // Write header
        this.PackByte((byte)CommandType.SUBCOMMAND);
        this.PackByte(GlobalCount);

        this.PackBytes(DefaultBytes);
        this.PackByte((byte)type);
    }
Ejemplo n.º 2
0
        private static string GetSubcommandSyntax(string wholeCommandLineText, SubcommandType subcommandType)
        {
            ResourceManager syntaxResource = null;

            switch (subcommandType)
            {
            case SubcommandType.Cust:
                syntaxResource = new ResourceManager(typeof(CustSyntaxes));
                break;

            case SubcommandType.Param:
                syntaxResource = new ResourceManager(typeof(ParamSyntaxes));
                break;
            }

            ResourceSet resourceSet = syntaxResource.GetResourceSet(CultureInfo.CurrentUICulture, true, true);

            string key = wholeCommandLineText.Split('=')[1].Split(',')[0].Trim();

            string custParamSyntax = FindCustParamSyntaxByKey(resourceSet, key);

            if (string.IsNullOrEmpty(custParamSyntax))
            {
                foreach (DictionaryEntry entry in GetCommandSyntaxResources())
                {
                    switch (subcommandType)
                    {
                    case SubcommandType.Cust:
                        if (entry.Key.ToString().Equals("Customize", StringComparison.OrdinalIgnoreCase))
                        {
                            return(entry.Value.ToString());
                        }
                        break;

                    case SubcommandType.Param:
                        if (entry.Key.ToString().Equals("Parameters", StringComparison.OrdinalIgnoreCase))
                        {
                            return(entry.Value.ToString());
                        }
                        break;
                    }
                }
            }

            return(custParamSyntax);
        }