예제 #1
0
        private void OnShowExplorer(object sender, RoutedEventArgs e)
        {
            string filename;

            if (GetSelectedFileName(out filename))
            {
                ProcessInfoTools.ShowExplorer(System.IO.Path.GetDirectoryName(filename));
            }
        }
예제 #2
0
        private void OnShowProperties(object sender, RoutedEventArgs e)
        {
            string filename;

            if (GetSelectedFileName(out filename))
            {
                ProcessInfoTools.ShowFileProperties(filename);
            }
        }
예제 #3
0
 public void ShowSystemProperties(object sender, RoutedEventArgs e)
 {
     if (HasFilenames)
     {
         foreach (DataObject o in MainListView.SelectedItems)
         {
             ProcessInfoTools.ShowFileProperties(o.FileName);
         }
     }
 }
예제 #4
0
        private void OnShowDependencies(object sender, RoutedEventArgs e)
        {
            string dependencyViewer;

            if (ProcessInfoTools.FindExecutable("depends.exe", out dependencyViewer))
            {
                string filename;
                if (GetSelectedFileName(out filename))
                {
                    Process.Start(dependencyViewer, string.Format("\"{0}\"", filename));
                }
            }
            else
            {
                MessageBox.Show("Unable to find DEPENDS.EXE", "ERROR", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
예제 #5
0
파일: su.cs 프로젝트: jwg4/gtools
        /// <summary>
        /// This program finds an executable on the PATH. It can also find other stuff on the path, but
        /// mostly it finds the executable.s
        /// </summary>
        /// <param name="args"></param>
        private void Run(string[] args)
        {
            Console.OutputEncoding = Encoding.GetEncoding(Encoding.Default.CodePage);

            Args = new InputArgs("su", string.Format(resource.IDS_TITLE, AppVersion.Get()) + "\r\n" + resource.IDS_COPYRIGHT);

            Args.Add(InputArgType.Parameter, "cmd", "cmd.exe", Presence.Optional, resource.IDS_DOC_cmd_param);

            if (Args.Process(args))
            {
                string command = Args.GetString("cmd");
                if (command.Equals("cmd.exe", StringComparison.OrdinalIgnoreCase))
                {
                    if (!IsAdministrator())
                    {
                        ProcessStartInfo startInfo = new ProcessStartInfo(Path.Combine(Environment.SystemDirectory, "cmd.exe"));
                        startInfo.Verb             = "runas";
                        startInfo.WorkingDirectory = Environment.CurrentDirectory;
                        startInfo.Arguments        = string.Format("/K \"cd /d {0}\"", startInfo.WorkingDirectory);

                        System.Diagnostics.Process.Start(startInfo);
                    }
                    else
                    {
                        Console.WriteLine(resource.IDS_ERR_AlreadyRunningAsAdministrator);
                    }
                }
                else
                {
                    string exe;
                    if (ProcessInfoTools.FindExecutable(command, out exe))
                    {
                        ProcessStartInfo startInfo = new ProcessStartInfo(exe);
                        startInfo.Verb             = "runas";
                        startInfo.WorkingDirectory = Environment.CurrentDirectory;

                        System.Diagnostics.Process.Start(startInfo);
                    }
                    else
                    {
                        Console.WriteLine(resource.IDS_ERR_UnableToFindFile, command);
                    }
                }
            }
        }
예제 #6
0
 public bool BringUpTerminalInInstallLocation()
 {
     return(ProcessInfoTools.ShowTerminal(InstallLocation));
 }
예제 #7
0
 public bool BringUpExplorerInInstallLocation()
 {
     return(ProcessInfoTools.ShowExplorer(InstallLocation));
 }
예제 #8
0
 private void OnBrowseFilename(object sender, RoutedEventArgs e)
 {
     ProcessInfoTools.ShowExplorer(TbInstallLocation.Text);
 }
예제 #9
0
 public bool ShowRegistryEditor()
 {
     return(ProcessInfoTools.ShowRegistryEditor(RegistryKey));
 }
예제 #10
0
 public bool ShowRegistryEditor()
 {
     return(ProcessInfoTools.ShowRegistryEditor(string.Format("HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Services\\{0}",
                                                              InternalID)));
 }