Exemple #1
0
 public override int Run(string[] remainingArguments)
 {
     if (CLevel.ToLower() == "default")
     {
         if (Operation.ToLower() == "get")
         {
             if (String.IsNullOrEmpty(Service))
             {
                 Console.WriteLine("Showing results for -> default:all\n\n{0}", DefaultConfig.GetSettings("all"));
             }
             else
             {
                 if (String.IsNullOrEmpty(Field))
                 {
                     Console.WriteLine("Showing results for -> defaults:{0}\n\n{1}", Service, DefaultConfig.GetSettings(Service));
                 }
                 else
                 {
                     Console.WriteLine("Showing results for -> default:{0}= {1}", Field, DefaultConfig.GetSettings(Service, Field));
                 }
             }
         }
         else if (Operation.ToLower() == "set")
         {
             Helper.DisplayError("Unable to set values in the default config");
         }
     }
     //TODO: Need to process Set operation.
     else if (CLevel.ToLower() == "user")
     {
         if (Operation.ToLower() == "get")
         {
             if (String.IsNullOrEmpty(Service))
             {
                 Console.WriteLine("Showing results for -> user:all\n\n{0}", CustomConfig.GetSettings("all"));
             }
             else
             {
                 if (String.IsNullOrEmpty(Field))
                 {
                     Console.WriteLine("Showing results for -> user:{0}\n\n{1}", Service, CustomConfig.GetSettings(Service));
                 }
                 else
                 {
                     Console.WriteLine("Showing results for -> user:{0}= {1}", Field, CustomConfig.GetSettings(Service, Field));
                 }
             }
         }
         else if (Operation.ToLower() == "set")
         {
             if (string.IsNullOrEmpty(Service))
             {
                 Helper.DisplayError("Service name required.");
             }
             else
             {
                 if (string.IsNullOrEmpty(Field))
                 {
                     Helper.DisplayError("Field Name required.");
                 }
                 else
                 {
                     if (!CustomConfig.SetSetting(Service, Field, remainingArguments[2]))
                     {
                         Helper.DisplayError("Failed to make changes.");
                     }
                     Console.WriteLine("{0}:{1} has been updated.", Service, Field);
                 }
             }
         }
     }
     return(0);
 }