BetterExplorer.Utilities.AppDirectoryItem C# (CSharp) Method

AppDirectoryItem() public static method

public static AppDirectoryItem ( string FileName ) : string
FileName string
return string
		public static string AppDirectoryItem(string FileName) {
			var currentexePath = System.Reflection.Assembly.GetExecutingAssembly().GetModules()[0].FullyQualifiedName;
			var dir = System.IO.Path.GetDirectoryName(currentexePath);
			return System.IO.Path.Combine(dir, FileName);
		}

Usage Example

Esempio n. 1
0
        private void wizardControl1_Finished(object sender, EventArgs e)
        {
            string ExePath = Utilities.AppDirectoryItem("Updater.exe");

            string filesForExtract = String.Empty;

            foreach (string item in this.UpdateLocalPaths)
            {
                filesForExtract += $"{item};";
            }
            using (Process proc = new Process())
            {
                var psi = new ProcessStartInfo
                {
                    FileName        = ExePath,
                    Verb            = "runas",
                    UseShellExecute = true,
                    Arguments       = $"/env /user:Administrator \"{ExePath}\" UP:{filesForExtract}"
                };

                proc.StartInfo = psi;
                proc.Start();

                //if (proc.ExitCode == -1)
                //  System.Windows.MessageBox.Show("Error in Update!", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
            }
            System.Windows.Application.Current.Shutdown();
        }