Ejemplo n.º 1
0
 private void run_show(WrCommand _command)
 {
     if (_command.HasArgs)
     {
         List <string> to_display = new List <string>();
         foreach (string argument in _command.Arguments)
         {
             string   current_search_pattern = argument;
             string[] files = Directory.GetFiles(Program.RepoName, current_search_pattern);
             foreach (string file in files)
             {
                 if (!(to_display.Contains(Path.GetFileName(file))))
                 {
                     to_display.Add(Path.GetFileName(file));
                 }
             }
         }
         foreach (string disp in to_display)
         {
             Info.WriteLine(disp);
         }
     }
     else
     {
         string[] allfiles = Directory.GetFiles(Program.RepoName);
         Info.WriteLine();
         foreach (string i in allfiles)
         {
             Info.WriteLine(Path.GetFileName(i));
         }
     }
 }
Ejemplo n.º 2
0
 private void run_delete(WrCommand _command)
 {
     _command.RequireFilesExistInRepo();
     foreach (string argument in _command.Arguments)
     {
         File.Delete(Path.Combine(Program.RepoName, argument));
     }
 }
Ejemplo n.º 3
0
 private void run_push(WrCommand _command)
 {
     _command.RequireFilesExistLocally();
     _command.RequireFilesNotExistInRepo();
     foreach (string argument in _command.Arguments)
     {
         File.Copy(argument, Path.Combine(Program.RepoName, argument));
     }
 }
Ejemplo n.º 4
0
 public static int Main(string[] args)
 {
     verbose = args.Length > 0 ? args[0] == "-debug" : false;
     string[] wr_input_args = args;
     try
     {
         string repo = GetInstallDir();
         if (args.Length == 0)
         {
             Info.Kill("Main", "not enough input arguments given.");
         }
         if (args[0] == "-debug")
         {
             wr_input_args = shift_up <string>(args);
             if (wr_input_args.Length == 0)
             {
                 Info.Kill("Main", "not enough input arguments given.");
             }
         }
         if (verbose)
         {
             Info.WriteLine("Reading from " + repo);
         }
         WrCommand  com = new WrCommand(wr_input_args[0]);
         WrInstance current_instance = new WrInstance(com);
         current_instance.Run();
         if (verbose)
         {
             com.Summarize();
         }
         if (verbose)
         {
             Console.WriteLine(System.Environment.OSVersion);
         }
         return(0);
     }
     catch (Exception e)
     {
         string ermsg = e.Message;
         if (ermsg.Contains("registry access"))
         {
             ermsg += "You may need administrative permissions.";
         }
         error(ermsg);
         return(1);
     }
 }
Ejemplo n.º 5
0
 private void run_open(WrCommand _command)
 {
     Process.Start(Program.RepoName);
 }
Ejemplo n.º 6
0
 public WrInstance(WrCommand input)
 {
     command = input;
 }