private static void CreateFold(string fullFileName) { if (!File.Exists(fullFileName)) { string directoryname = LocalFilesOperation.GetParentDirectory(fullFileName); if (!Directory.Exists(directoryname)) { Directory.CreateDirectory(directoryname); } } }
private AutoUpdater() { dataAccesser = new HttpDataAccess(); //获取主程序信息 RegistryKey key = Registry.LocalMachine; RegistryKey temp; if (Environment.Is64BitOperatingSystem) { temp = key.OpenSubKey("SOFTWARE\\WOW6432Node\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\Mofanghr"); } else { temp = key.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\Mofanghr"); } string tempName = ConfigSetting.GetConfigValue("UpdateApplicationEntryAssembly"); Console.WriteLine(tempName); mainProcessInfo.UpdateApplicationEntryAssembly = temp.GetValue(tempName).ToString(); mainProcessInfo.UpdateApplicationStartupFolder = LocalFilesOperation.GetParentDirectory(mainProcessInfo.UpdateApplicationEntryAssembly); string exeName = Path.GetFileName(mainProcessInfo.UpdateApplicationEntryAssembly); mainProcessInfo.MainProcessName = exeName.Remove(exeName.LastIndexOf(".exe")); }