Beispiel #1
0
 public override void Parse(string arg)
 {
     if (arg.StartsWith("--find:case", StringComparison.InvariantCultureIgnoreCase))
     {
         this.findOptions = Wildcard.WildcardOptions.None;
     }
     else if (arg.StartsWith("--find:nocase", StringComparison.InvariantCultureIgnoreCase))
     {
         this.findOptions = Wildcard.WildcardOptions.IgnoreCase;
     }
     else if (arg.StartsWith("--find:container=", StringComparison.InvariantCultureIgnoreCase))
     {
         string argValue = arg.Substring("--find:container=".Length);
         if (argValue.IsEmpty())
         {
             FatalError(String.Format("Invalid name ({0}); use 'APPDATA {1} --help' for usage", arg, GetCommandName()));
         }
         this.findContainerName = argValue;
     }
     else if (arg.StartsWith("--find:value=", StringComparison.InvariantCultureIgnoreCase))
     {
         string argValue = arg.Substring("--find:value=".Length);
         if (argValue.IsEmpty())
         {
             FatalError(String.Format("Invalid key ({0}); use 'APPDATA {1} --help' for usage", arg, GetCommandName()));
         }
         this.findValueKey = argValue;
     }
     else if (arg.Equals("-r", StringComparison.InvariantCultureIgnoreCase) || arg.Equals("--recurse", StringComparison.InvariantCultureIgnoreCase))
     {
         this.recurse = true;
     }
     else if (arg.StartsWith("--type=", StringComparison.InvariantCultureIgnoreCase))
     {
         string argValue = arg.Substring("--type=".Length);
         try
         {
             this.matchType = AppDataType.ToAppDataType(argValue);
         }
         catch (NotSupportedException)
         {
             FatalError(String.Format("Unknown type ({0}); use 'APPDATA {1} --help' for usage", arg, GetCommandName()));
         }
     }
     else if (arg.StartsWith("--value=", StringComparison.InvariantCultureIgnoreCase))
     {
         string argValue = arg.Substring("--value=".Length);
         if (argValue.IsEmpty())
         {
             FatalError(String.Format("Invalid key ({0}); use 'APPDATA {1} --help' for usage", arg, GetCommandName()));
         }
         this.matchValueKey = argValue;
     }
     else
     {
         base.Parse(arg);
     }
 }
Beispiel #2
0
        public CommandSet(string[] options)
        {
            Parse(options);
            System.Diagnostics.Debug.Assert(this.requiredArguments.Length == GetRequiredArgumentsCount());
            this.packageFamilyName = this.requiredArguments[0];
            ParsePathParameter();

            try
            {
                this.data = AppDataType.Parse(this.dataType, this.dataAsString);
            }
            catch (FormatException)
            {
                FatalError(String.Format("Invalid data ({0}) for the type ({1}); use 'APPDATA {2} --help' for usage", this.dataAsString, AppDataType.ToString(this.dataType), GetCommandName()));
            }
        }
Beispiel #3
0
 public override void Parse(string arg)
 {
     if (arg.StartsWith("--data=", StringComparison.InvariantCultureIgnoreCase))
     {
         this.dataAsString = arg.Substring("--data=".Length);
     }
     else if (arg.Equals("--overwrite:no", StringComparison.InvariantCultureIgnoreCase))
     {
         this.overwrite = Overwrite.No;
     }
     else if (arg.Equals("--overwrite:prompt", StringComparison.InvariantCultureIgnoreCase))
     {
         this.overwrite = Overwrite.Prompt;
     }
     else if (arg.Equals("--overwrite:yes", StringComparison.InvariantCultureIgnoreCase))
     {
         this.overwrite = Overwrite.Yes;
     }
     else if (arg.StartsWith("--type=", StringComparison.InvariantCultureIgnoreCase))
     {
         string argValue = arg.Substring("--type=".Length);
         try
         {
             this.dataType = AppDataType.ToAppDataType(argValue, supportedAppDataTypes);
         }
         catch (NotSupportedException)
         {
             FatalError(String.Format("Unknown type ({0}); use 'APPDATA {1} --help' for usage", arg, GetCommandName()));
         }
     }
     else if (arg.StartsWith("--value=", StringComparison.InvariantCultureIgnoreCase))
     {
         string argValue = arg.Substring("--value=".Length);
         if (argValue.IsEmpty())
         {
             FatalError(String.Format("Invalid key ({0}); use 'APPDATA {1} --help' for usage", arg, GetCommandName()));
         }
         this.valueKey = argValue;
     }
     else
     {
         base.Parse(arg);
     }
 }
Beispiel #4
0
 public TypeXref(System.Type objectType, AppDataType.Type appdataType)
 {
     this.objectType        = objectType;
     this.appdataType       = appdataType;
     this.appdataTypeString = AppDataType.ToString(appdataType);
 }