Beispiel #1
0
 public void Run(DataGrid dataGrid)
 {
     if (Bat.IsBat(dataGrid, out Bat bat))
     {
         Process.Start(bat.Path);
     }
 }
Beispiel #2
0
        public List <Bat> ParseBats(List <string> batFiles, DataGrid dataGrid)
        {
            var bats         = new List <Bat>();
            var skippedFiles = new List <string>();

            foreach (var batFile in batFiles)
            {
                var bat = new Bat(batFile, dataGrid);

                if (!string.IsNullOrEmpty(bat.Shortcut) &&
                    !string.IsNullOrEmpty(bat.Command) &&
                    bat.Type != ShortcutType.Unknown)
                {
                    bats.Add(bat);
                }
                else
                {
                    skippedFiles.Add(batFile);
                }
            }

            if (skippedFiles.Any())
            {
                Console.WriteLine("*** Skipped files: ***");
                skippedFiles.ForEach(t => Console.WriteLine(t));
            }

            return(bats);
        }
Beispiel #3
0
 public void Edit(DataGrid dataGrid)
 {
     if (Bat.IsBat(dataGrid, out Bat bat))
     {
         Process.Start("notepad.exe", bat.Path);
     }
 }
Beispiel #4
0
 public void OpenDestinationLocation(DataGrid dataGrid)
 {
     if (Bat.IsBat(dataGrid, out Bat bat))
     {
         var location = Path.GetDirectoryName(bat?.Destination);
         if (location != "")
         {
             Process.Start(location);
         }
     }
 }
Beispiel #5
0
        public void Delete(DataGrid dataGrid)
        {
            if (Bat.IsBat(dataGrid, out Bat bat))
            {
                File.Delete(bat.Path);
                bats.Remove(bat);
                dataGrid.Items.Refresh();
            }

            PopulateDataGrid(dataGrid, _outputFolder);
        }