protected virtual string[] GetScrapeArguments(IPythonInterpreter interpreter) { var args = new List <string> { "-W", "ignore", "-B", "-E" }; var mp = Interpreter.ModuleResolution.FindModule(FilePath); if (string.IsNullOrEmpty(mp.FullName)) { return(null); } if (!InstallPath.TryGetFile("scrape_module.py", out var sm)) { return(null); } args.Add(sm); args.Add("-u8"); args.Add(mp.ModuleName); args.Add(mp.LibraryPath); return(args.ToArray()); }
public AstPythonInterpreterFactory( InterpreterConfiguration config, InterpreterFactoryCreationOptions options ) { Configuration = config ?? throw new ArgumentNullException(nameof(config)); CreationOptions = options ?? new InterpreterFactoryCreationOptions(); try { LanguageVersion = Configuration.Version.ToLanguageVersion(); } catch (InvalidOperationException ex) { throw new ArgumentException(ex.Message, ex); } _databasePath = CreationOptions.DatabasePath; if (!string.IsNullOrEmpty(_databasePath)) { _searchPathCachePath = Path.Combine(_databasePath, "database.path"); _log = new AnalysisLogWriter(Path.Combine(_databasePath, "AnalysisLog.txt"), false, LogToConsole, LogCacheSize); _log.Rotate(LogRotationSize); _log.MinimumLevel = CreationOptions.TraceLevel; } else { if (InstallPath.TryGetFile($"DefaultDB\\v{Configuration.Version.Major}\\python.pyi", out string biPath)) { CreationOptions.DatabasePath = _databasePath = Path.GetDirectoryName(biPath); _skipWriteToCache = true; } } _skipCache = !CreationOptions.UseExistingCache; }
/// <summary> /// Gets the set of search paths by running the interpreter. /// </summary> /// <param name="interpreter">Path to the interpreter.</param> /// <returns>A list of search paths for the interpreter.</returns> /// <remarks>Added in 2.2, moved in 3.3</remarks> public static async Task <List <PythonLibraryPath> > GetUncachedDatabaseSearchPathsAsync(string interpreter) { // sys.path will include the working directory, so we make an empty // path that we can filter out later var tempWorkingDir = IOPath.Combine(IOPath.GetTempPath(), IOPath.GetRandomFileName()); Directory.CreateDirectory(tempWorkingDir); if (!InstallPath.TryGetFile("get_search_paths.py", out var srcGetSearchPaths)) { return(new List <PythonLibraryPath>()); } var getSearchPaths = IOPath.Combine(tempWorkingDir, PathUtils.GetFileName(srcGetSearchPaths)); File.Copy(srcGetSearchPaths, getSearchPaths); var lines = new List <string>(); var errorLines = new List <string> { "Cannot obtain list of paths" }; try { using (var proc = new ProcessHelper(interpreter, new[] { "-S", "-E", getSearchPaths }, tempWorkingDir)) { proc.OnOutputLine = lines.Add; proc.OnErrorLine = errorLines.Add; proc.Start(); using (var cts = new CancellationTokenSource(30000)) { int exitCode; try { exitCode = await proc.WaitAsync(cts.Token).ConfigureAwait(false); } catch (OperationCanceledException) { proc.Kill(); exitCode = -1; } if (exitCode != 0) { throw new InvalidOperationException(string.Join(Environment.NewLine, errorLines)); } } } } finally { PathUtils.DeleteDirectory(tempWorkingDir); } return(lines.Select(s => { if (s.StartsWithOrdinal(tempWorkingDir, ignoreCase: true)) { return null; } try { return Parse(s); } catch (ArgumentException) { Debug.Fail("Invalid search path: " + (s ?? "<null>")); return null; } catch (FormatException) { Debug.Fail("Invalid format for search path: " + s); return null; } }).Where(p => p != null).ToList()); }
public AstModuleCache(InterpreterConfiguration configuration, string databasePath, bool useDefaultDatabase, bool useExistingCache, AnalysisLogWriter log) { _configuration = configuration ?? throw new ArgumentNullException(nameof(configuration)); DatabasePath = databasePath; _useDefaultDatabase = useDefaultDatabase; _log = log; if (_useDefaultDatabase) { var dbPath = Path.Combine("DefaultDB", $"v{_configuration.Version.Major}", "python.pyi"); if (InstallPath.TryGetFile(dbPath, out string biPath)) { DatabasePath = Path.GetDirectoryName(biPath); } else { _skipCache = true; } } else { SearchPathCachePath = Path.Combine(DatabasePath, "database.path"); } _skipCache = !useExistingCache; }
protected virtual List <string> GetScrapeArguments(IPythonInterpreterFactory factory) { var args = new List <string> { "-B", "-E" }; ModulePath mp = AstPythonInterpreterFactory.FindModuleAsync(factory, _filePath) .WaitAndUnwrapExceptions(); if (string.IsNullOrEmpty(mp.FullName)) { return(null); } if (!InstallPath.TryGetFile("scrape_module.py", out string sm)) { return(null); } args.Add(sm); args.Add("-u8"); args.Add(mp.ModuleName); args.Add(mp.LibraryPath); return(args); }
private static string FindTypingStub() { if (InstallPath.TryGetFile("typing-stub.pyi", out var fullPath)) { return(fullPath); } throw new FileNotFoundException("typing-stub.pyi"); }
protected override List <string> GetScrapeArguments(AstPythonInterpreter interpreter) { if (!InstallPath.TryGetFile("scrape_module.py", out string sm)) { return(null); } return(new List <string> { "-B", "-E", sm, "-u8", Name }); }
protected override List <string> GetScrapeArguments(IPythonInterpreterFactory factory) { if (!InstallPath.TryGetFile("scrape_module.py", out string sb)) { return(null); } return(new List <string> { "-B", "-E", sb }); }
private JsonRpc CreateJsonRpc() { if (!InstallPath.TryGetFile("inspector.py", out var scriptPath)) { return(null); // Throw? } var procServices = _services.GetService <IProcessServices>(); var interpreter = _services.GetService <IPythonInterpreter>(); return(PythonRpc.Create(procServices, interpreter.Configuration.InterpreterPath, scriptPath)); }
/// <summary> /// Gets the set of search paths by running the interpreter. /// </summary> /// <param name="interpreter">Path to the interpreter.</param> /// <param name="fs">File system services.</param> /// <param name="ps">Process services.</param> /// <param name="cancellationToken">Cancellation token.</param> /// <returns>A list of search paths for the interpreter.</returns> public static async Task <List <PythonLibraryPath> > GetSearchPathsFromInterpreterAsync(string interpreter, IFileSystem fs, IProcessServices ps, CancellationToken cancellationToken = default) { // sys.path will include the working directory, so we make an empty // path that we can filter out later var tempWorkingDir = IOPath.Combine(IOPath.GetTempPath(), IOPath.GetRandomFileName()); fs.CreateDirectory(tempWorkingDir); if (!InstallPath.TryGetFile("get_search_paths.py", out var srcGetSearchPaths)) { return(new List <PythonLibraryPath>()); } var getSearchPaths = IOPath.Combine(tempWorkingDir, PathUtils.GetFileName(srcGetSearchPaths)); File.Copy(srcGetSearchPaths, getSearchPaths); var startInfo = new ProcessStartInfo( interpreter, new[] { "-S", "-E", getSearchPaths }.AsQuotedArguments() ) { WorkingDirectory = tempWorkingDir, UseShellExecute = false, ErrorDialog = false, CreateNoWindow = true, RedirectStandardInput = true, RedirectStandardOutput = true }; try { var output = await ps.ExecuteAndCaptureOutputAsync(startInfo, cancellationToken); return(output.Split(new[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries).Select(s => { try { var p = Parse(s); if (PathUtils.PathStartsWith(p.Path, tempWorkingDir)) { return null; } return p; } catch (ArgumentException) { Debug.Fail("Invalid search path: " + (s ?? "<null>")); return null; } catch (FormatException) { Debug.Fail("Invalid format for search path: " + s); return null; } }).Where(p => p != null).ToList()); } finally { fs.DeleteDirectory(tempWorkingDir, true); } }
public bool IsGameLocatedInSystemFolders() { if (!Directory.Exists(InstallPath)) { return(false); } List <string> protectedFolders = new List <string>() { Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles), Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86), Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), Environment.GetFolderPath(Environment.SpecialFolder.Windows) }; return(protectedFolders.Any(s => InstallPath.Contains(s))); }
private void ChildWindow_Loaded(object sender, RoutedEventArgs e) { CurrentSetupState = SetupState.Default; LocalInstallTesting.Version = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString(); long size = LocalInstallTesting.GetHardDiskFreeSpace(InstallPath.Substring(0, 1)); double gbSize = Convert.ToDouble(Convert.ToDouble(size) / 1024 / 1024 / 1024); if (gbSize >= 10) { ColorDisk = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#FF888888")); DiskSize = InstallPath.Substring(0, 1).ToUpper() + "盘可用空间:" + gbSize.ToString("f2") + "G"; } else { ColorDisk = new SolidColorBrush(Colors.Red); DiskSize = InstallPath.Substring(0, 1).ToUpper() + "盘可用空间:" + gbSize.ToString("f2") + "G(尽量选择剩余空间10G以上的盘符)"; } }
private void btnSelectFolder_Click(object sender, RoutedEventArgs e) { System.Windows.Forms.FolderBrowserDialog dialog = new System.Windows.Forms.FolderBrowserDialog(); dialog.SelectedPath = InstallPath; var result = dialog.ShowDialog(); string selectedPath = ""; if (dialog.SelectedPath.EndsWith("\\")) { selectedPath = dialog.SelectedPath.Substring(dialog.SelectedPath.Length - 3, 2); } else { selectedPath = dialog.SelectedPath; } if (result == System.Windows.Forms.DialogResult.OK) { if (!selectedPath.Contains("MusicTeachingWindow")) { InstallPath = selectedPath + @"\MusicTeachingWindow"; } } else { InstallPath = selectedPath; } long size = LocalInstallTesting.GetHardDiskFreeSpace(InstallPath.Substring(0, 1)); double gbSize = Convert.ToDouble(Convert.ToDouble(size) / 1024 / 1024 / 1024); if (gbSize >= 10) { ColorDisk = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#FF888888")); DiskSize = InstallPath.Substring(0, 1).ToUpper() + "盘可用空间:" + gbSize.ToString("f2") + "G"; } else { ColorDisk = new SolidColorBrush(Colors.Red); DiskSize = InstallPath.Substring(0, 1).ToUpper() + "盘可用空间:" + gbSize.ToString("f2") + "G(尽量选择剩余空间10G以上的盘符)"; } }
bool InstallToProgramFiles(IAbsoluteFilePath exeFile) { var shortcutPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.CommonStartMenu), CompanyName, ProgramName).ToAbsoluteDirectoryPath(); var installExe = InstallPath.GetChildFileWithName(PlayExecutable); if (Tools.FileUtil.ComparePathsOsCaseSensitive(exeFile.ToString(), installExe.ToString())) { return(false); } InstallPath.MakeSurePathExists(); Tools.FileUtil.Ops.CopyWithRetry(exeFile, installExe); shortcutPath.MakeSurePathExists(); CreateShortcut(shortcutPath, installExe); CreateShortcut( Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory).ToAbsoluteDirectoryPath(), installExe); RegisterLocalAppKeys(installExe); return(true); }
private AstPythonInterpreterFactory( InterpreterConfiguration config, InterpreterFactoryCreationOptions options, bool useDefaultDatabase ) { Configuration = config ?? throw new ArgumentNullException(nameof(config)); CreationOptions = options ?? new InterpreterFactoryCreationOptions(); try { LanguageVersion = Configuration.Version.ToLanguageVersion(); } catch (InvalidOperationException ex) { throw new ArgumentException(ex.Message, ex); } BuiltinModuleName = BuiltinTypeId.Unknown.GetModuleName(LanguageVersion); _databasePath = CreationOptions.DatabasePath; _useDefaultDatabase = useDefaultDatabase; if (_useDefaultDatabase) { var dbPath = Path.Combine("DefaultDB", $"v{Configuration.Version.Major}", "python.pyi"); if (InstallPath.TryGetFile(dbPath, out string biPath)) { CreationOptions.DatabasePath = _databasePath = Path.GetDirectoryName(biPath); } else { _skipCache = true; } } else { _searchPathCachePath = Path.Combine(_databasePath, "database.path"); _log = new AnalysisLogWriter(Path.Combine(_databasePath, "AnalysisLog.txt"), false, LogToConsole, LogCacheSize); _log.Rotate(LogRotationSize); _log.MinimumLevel = CreationOptions.TraceLevel; } _skipCache = !CreationOptions.UseExistingCache; }
/// <summary> /// Gets the set of search paths by running the interpreter. /// </summary> /// <param name="interpreter">Path to the interpreter.</param> /// <param name="fs">File system services.</param> /// <param name="ps">Process services.</param> /// <param name="cancellationToken">Cancellation token.</param> /// <returns>A list of search paths for the interpreter.</returns> public static async Task <ImmutableArray <PythonLibraryPath> > GetSearchPathsFromInterpreterAsync(string interpreter, IFileSystem fs, IProcessServices ps, CancellationToken cancellationToken = default) { // sys.path will include the working directory, so we make an empty // path that we can filter out later if (!InstallPath.TryGetFile("get_search_paths.py", out var getSearchPathScript)) { return(new ImmutableArray <PythonLibraryPath>()); } var startInfo = new ProcessStartInfo( interpreter, new[] { "-S", "-E", getSearchPathScript }.AsQuotedArguments() ) { WorkingDirectory = IOPath.GetDirectoryName(getSearchPathScript), UseShellExecute = false, ErrorDialog = false, CreateNoWindow = true, RedirectStandardInput = true, RedirectStandardOutput = true }; var output = await ps.ExecuteAndCaptureOutputAsync(startInfo, cancellationToken); return(output.Split(new[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries) .Skip(1).Select(s => { try { return Parse(s); } catch (ArgumentException) { Debug.Fail("Invalid search path: " + (s ?? "<null>")); return null; } catch (FormatException) { Debug.Fail("Invalid format for search path: " + s); return null; } }).Where(p => p != null).ToImmutableArray()); }
/// <summary> /// Initialize NugetStore using <paramref name="rootDirectory"/> as location of the local copies, /// and a configuration file <paramref name="configFile"/> as well as an override configuration /// file <paramref name="overrideFile"/> where all settings of <paramref name="overrideFile"/> also /// presents in <paramref name="configFile"/> take precedence. /// </summary> /// <param name="rootDirectory">The location of the Nuget store.</param> /// <param name="configFile">The configuration file name for the Nuget store, or <see cref="DefaultConfig"/> if not specified.</param> /// <param name="overrideFile">The override configuration file name for the Nuget store, or <see cref="OverrideConfig"/> if not specified.</param> public NugetStore(string rootDirectory, string configFile = DefaultConfig, string overrideFile = OverrideConfig) { if (rootDirectory == null) { throw new ArgumentNullException(nameof(rootDirectory)); } if (configFile == null) { throw new ArgumentNullException(nameof(configFile)); } if (overrideFile == null) { throw new ArgumentNullException(nameof(overrideFile)); } // First try the override file with custom settings var configFileName = overrideFile; var configFilePath = Path.Combine(rootDirectory, configFileName); if (!File.Exists(configFilePath)) { // Override file does not exist, fallback to default config file configFileName = configFile; configFilePath = Path.Combine(rootDirectory, configFileName); if (!File.Exists(configFilePath)) { throw new ArgumentException($"Invalid installation. Configuration file [{configFile}] not found", nameof(configFile)); } } var rootFileSystem = new PhysicalFileSystem(rootDirectory); RootDirectory = rootFileSystem.Root; settings = new Settings(rootFileSystem, configFileName, false); InstallPath = settings.GetValue(ConfigurationConstants.Config, RepositoryPathKey, true); if (!string.IsNullOrEmpty(InstallPath)) { InstallPath = InstallPath.Replace('/', Path.DirectorySeparatorChar); } var mainPackageList = settings.GetValue(ConfigurationConstants.Config, MainPackagesKey, false); if (string.IsNullOrWhiteSpace(mainPackageList)) { throw new InvalidOperationException($"Invalid configuration. Expecting [{MainPackagesKey}] in config"); } MainPackageIds = mainPackageList.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries); VsixPluginId = settings.GetValue(ConfigurationConstants.Config, VsixPluginKey, false); if (string.IsNullOrWhiteSpace(VsixPluginId)) { throw new InvalidOperationException($"Invalid configuration. Expecting [{VsixPluginKey}] in config"); } RepositoryPath = settings.GetValue(ConfigurationConstants.Config, RepositoryPathKey, false); if (string.IsNullOrWhiteSpace(RepositoryPath)) { RepositoryPath = DefaultGamePackagesDirectory; } // Setup NugetCachePath in the cache folder CacheDirectory = Path.Combine(rootDirectory, "Cache"); Environment.SetEnvironmentVariable("NuGetCachePath", CacheDirectory); var packagesFileSystem = new PhysicalFileSystem(InstallPath); PathResolver = new PackagePathResolver(packagesFileSystem); var packageSourceProvider = new PackageSourceProvider(settings); SourceRepository = packageSourceProvider.CreateAggregateRepository(new PackageRepositoryFactory(), true); var localRepo = new SharedPackageRepository(PathResolver, packagesFileSystem, rootFileSystem); manager = new NuGet.PackageManager(SourceRepository, PathResolver, packagesFileSystem, localRepo); manager.PackageInstalling += OnPackageInstalling; manager.PackageInstalled += OnPackageInstalled; manager.PackageUninstalling += OnPackageUninstalling; manager.PackageUninstalled += OnPackageUninstalled; }
private void Worker_DoWork(object sender, DoWorkEventArgs e) { worker.ReportProgress(2); string unzipPath = InstallPath.Replace('\\', '/'); try { if (!LocalInstallTesting.GetDotNetRelease()) { //LocalInstallTesting.CopyFile(unzipPath, @"Environmental/NDP452-KB2901907-x86-x64-AllOS-ENU.exe"); //Process.Start(unzipPath + @"/Environmental/NDP452-KB2901907-x86-x64-AllOS-ENU.exe").WaitForExit(); } } catch (Exception ex) { MessageBox.Show("检测并安装.Net版本错误:" + ex.Message); } worker.ReportProgress(10); try { if (!LocalInstallTesting.IsInstallVC1() && !LocalInstallTesting.IsInstallVC2()) { if (LocalInstallTesting.Is64Bit()) { //LocalInstallTesting.CopyFile(unzipPath, @"Environmental/vc_redist.x64.exe"); //Process.Start(unzipPath + @"/Environmental/vc_redist.x64.exe").WaitForExit(); } else { //LocalInstallTesting.CopyFile(unzipPath, @"Environmental/vc_redist.x86.exe"); //Process.Start(unzipPath + @"/Environmental/vc_redist.x86.exe").WaitForExit(); } } } catch (Exception ex) { MessageBox.Show("检测并安装VC运行环境错误:" + ex.Message); } worker.ReportProgress(15); Process[] ExeList = Process.GetProcessesByName("MusicTeachingWindow"); for (int i = 0; i < ExeList.Length; i++) { ExeList[i].Kill(); } worker.ReportProgress(20); LocalInstallTesting.CopyAllFile(unzipPath, new Action <int>((p) => { worker.ReportProgress(p); })); try { LocalInstallTesting.CreateShortcut(InstallPath); LocalInstallTesting.CreateProgramsShortcut(InstallPath, "音乐教学云平台"); LocalInstallTesting.CreateProgramsUninstallShortcut(InstallPath, "音乐教学云平台"); } catch (Exception ex) { MessageBox.Show("生成快捷方式错误:" + ex.Message); } worker.ReportProgress(95); try { LocalInstallTesting.AddRegedit(InstallPath); } catch (Exception ex) { MessageBox.Show(ex.Message); } worker.ReportProgress(100); CurrentSetupState = SetupState.SetupComplete; }
protected override string[] GetScrapeArguments(IPythonInterpreter interpreter) => !InstallPath.TryGetFile("scrape_module.py", out var sb) ? null : new [] { "-W", "ignore", "-B", "-E", sb };
protected override IEnumerable <string> GetScrapeArguments(IPythonInterpreter interpreter) => !InstallPath.TryGetFile("scrape_module.py", out var sb) ? null : new List <string> { "-B", "-E", sb };
private void ProcessFilesByMediaDisk(ICollection<string> fileKeys, ProcessFilesOnOneMediaDiskHandler diskHandler) { if(this.IsMergeModule()) { InstallPathMap files = new InstallPathMap(); foreach(string fileKey in this.Files.Keys) { if(fileKeys == null || fileKeys.Contains(fileKey)) { files[fileKey] = this.Files[fileKey]; } } diskHandler("#MergeModule.CABinet", files, new InstallPathMap()); } else { bool defaultCompressed = ((this.SummaryInfo.WordCount & 0x2) != 0); View fileView = null, mediaView = null; Record fileRec = null; try { fileView = this.OpenView("SELECT `File`, `Attributes`, `Sequence` " + "FROM `File` ORDER BY `Sequence`"); mediaView = this.OpenView("SELECT `DiskId`, `LastSequence`, `Cabinet` " + "FROM `Media` ORDER BY `DiskId`"); fileView.Execute(); mediaView.Execute(); int currentMediaDiskId = -1; int currentMediaMaxSequence = -1; string currentMediaCab = null; InstallPathMap compressedFileMap = new InstallPathMap(); InstallPathMap uncompressedFileMap = new InstallPathMap(); while((fileRec = fileView.Fetch()) != null) { string fileKey = (string) fileRec[1]; if(fileKeys == null || fileKeys.Contains(fileKey)) { int fileAttributes = fileRec.GetInteger(2); int fileSequence = fileRec.GetInteger(3); InstallPath fileInstallPath = this.Files[fileKey]; if(fileInstallPath == null) { this.LogMessage("Could not get install path for source file: {0}", fileKey); throw new InstallerException("Could not get install path for source file: " + fileKey); } if(fileSequence > currentMediaMaxSequence) { if(currentMediaDiskId != -1) { diskHandler(currentMediaCab, compressedFileMap, uncompressedFileMap); compressedFileMap.Clear(); uncompressedFileMap.Clear(); } while(fileSequence > currentMediaMaxSequence) { Record mediaRec = mediaView.Fetch(); if(mediaRec == null) { currentMediaDiskId = -1; break; } using(mediaRec) { currentMediaDiskId = mediaRec.GetInteger(1); currentMediaMaxSequence = mediaRec.GetInteger(2); currentMediaCab = (string) mediaRec[3]; } } if(fileSequence > currentMediaMaxSequence) break; } if((fileAttributes & (int) Microsoft.Deployment.WindowsInstaller.FileAttributes.Compressed) != 0) { compressedFileMap[fileKey] = fileInstallPath; } else if ((fileAttributes & (int) Microsoft.Deployment.WindowsInstaller.FileAttributes.NonCompressed) != 0) { // Non-compressed files are located // in the same directory as the MSI, without any path. uncompressedFileMap[fileKey] = new InstallPath(fileInstallPath.SourceName); } else if(defaultCompressed) { compressedFileMap[fileKey] = fileInstallPath; } else { uncompressedFileMap[fileKey] = fileInstallPath; } } fileRec.Close(); fileRec = null; } if(currentMediaDiskId != -1) { diskHandler(currentMediaCab, compressedFileMap, uncompressedFileMap); } } finally { if (fileRec != null) fileRec.Close(); if (fileView != null) fileView.Close(); if (mediaView != null) mediaView.Close(); } } }
private void UpdateFileStats(string fileKey, InstallPath fileInstallPath) { string filePath = Path.Combine(this.WorkingDirectory, fileInstallPath.SourcePath); if(!File.Exists(filePath)) { this.LogMessage("Updated source file not found: {0}", filePath); throw new FileNotFoundException("Updated source file not found: " + filePath); } this.LogMessage("updatestats {0}", fileKey); string version = Installer.GetFileVersion(filePath); string language = Installer.GetFileLanguage(filePath); long size = new FileInfo(filePath).Length; this.Execute("UPDATE `File` SET `Version` = '{0}', `Language` = '{1}', " + "`FileSize` = {2} WHERE `File` = '{3}'", version, language, size, fileKey); if ((version == null || version.Length == 0) && this.Tables.Contains("MsiFileHash")) { int[] hash = new int[4]; Installer.GetFileHash(filePath, hash); this.Execute("DELETE FROM `MsiFileHash` WHERE `File_` = '{0}'", fileKey); this.Execute("INSERT INTO `MsiFileHash` (`File_`, `Options`, `HashPart1`, `HashPart2`, " + "`HashPart3`, `HashPart4`) VALUES ('" + fileKey + "', 0, {0}, {1}, {2}, {3})", hash[0], hash[1], hash[2], hash[3]); } }