private void Form1_Load(object sender, EventArgs e) { UpdateText(); var saved = ToolKits.String2Point(RegistryStorage.Load(@"Software\RPChecker", "location")); if (saved != new Point(-32000, -32000)) { Location = saved; } this.NormalizePosition(); RegistryStorage.RegistryAddCount(@"Software\RPChecker\Statistics", @"Count"); cbFPS.SelectedIndex = 0; cbVpyFile.SelectedIndex = 0; var current = new DirectoryInfo(AppDomain.CurrentDomain.BaseDirectory); cbVpyFile.Items.AddRange(current.GetFiles("*.vpy").ToArray <object>()); btnAnalyze.Enabled = false; Updater.Utils.CheckUpdateWeekly("RPChecker"); if (_rpcCollection.Any()) { LoadRPCFile(_rpcCollection); } }
public MatroskaData() { var mkvToolnixPath = RegistryStorage.Load(@"Software\ChapterTool", "mkvToolnixPath"); // saved path not found. if (string.IsNullOrEmpty(mkvToolnixPath)) { try { mkvToolnixPath = GetMkvToolnixPathViaRegistry(); RegistryStorage.Save(mkvToolnixPath, @"Software\ChapterTool", "mkvToolnixPath"); } catch (Exception exception) { // no valid path found in Registry OnLog?.Invoke($"Warning: {exception.Message}"); } // Installed path not found. if (string.IsNullOrEmpty(mkvToolnixPath)) { mkvToolnixPath = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location); } } if (mkvToolnixPath != null) { _mkvextractPath = Path.Combine(mkvToolnixPath, "mkvextract.exe"); } if (!File.Exists(_mkvextractPath)) { OnLog?.Invoke($"Mkvextract Path: {_mkvextractPath}"); throw new Exception("无可用 MkvExtract, 安装个呗~"); } }
public static string GetVsPipePath(this IProcess process, out Exception exception) { exception = null; string vspipePath; try { vspipePath = RegistryStorage.Load(); if (vspipePath == null || !File.Exists(Path.Combine(vspipePath, "vspipe.exe"))) { vspipePath = Path.GetDirectoryName(ToolKits.GetFullPathFromWindows("vspipe.exe")) ?? ToolKits.GetVapourSynthPathViaRegistry(); if (vspipePath != null) { RegistryStorage.Save(vspipePath); } } } catch (Exception ex) { Debug.WriteLine(ex.Message); vspipePath = string.Empty; exception = ex; } return(vspipePath); }
public static string GetFFmpegPath(this IProcess process, out Exception exception) { exception = null; var ffmpegInReg = RegistryStorage.Load(name: "FFmpegPath"); try { var ffmpegInPath = Path.GetDirectoryName(ToolKits.GetFullPathFromWindows("ffmpeg.exe")); if (!string.IsNullOrEmpty(ffmpegInPath)) { if (ffmpegInReg != ffmpegInPath) { RegistryStorage.Save(ffmpegInPath, name: "FFmpegPath"); } return(ffmpegInPath); } if (ffmpegInReg == null || !File.Exists(Path.Combine(ffmpegInReg, "ffmpeg.exe"))) { ffmpegInReg = Notification.InputBox("请输入FFmpeg的地址", "注意不要带上多余的引号", "C:\\FFmpeg\\ffmpeg.exe"); if (!string.IsNullOrEmpty(ffmpegInReg)) { RegistryStorage.Save(Path.GetDirectoryName(ffmpegInReg), name: "FFmpegPath"); } } } catch (Exception ex) { Debug.WriteLine(ex.Message); exception = ex; } return(ffmpegInReg); }
private void FrmLoadFiles_Load(object sender, EventArgs e) { Icon = Icon.ExtractAssociatedIcon(Application.ExecutablePath); var saved = ToolKits.String2Point(RegistryStorage.Load(@"Software\RPChecker", "LoadLocation")); if (saved != new Point(-32000, -32000)) { Location = saved; } this.NormalizePosition(); }
private void FrmChart_Load(object sender, EventArgs e) { Icon = Icon.ExtractAssociatedIcon(Application.ExecutablePath); Text = $"{_type} Chart"; var saved = ToolKits.String2Point(RegistryStorage.Load(@"Software\RPChecker", "ChartLocation")); if (saved != new Point(-32000, -32000)) { Location = saved; } DrawChart(); }
private static bool IsSupportedRuntimeVersion() { //https://msdn.microsoft.com/en-us/library/hh925568 const int minSupportedRelease = 460798; if (RegistryStorage.Load(name: "DoVersionCheck") == "False") { return(true); } using (var key = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full")) { if (key?.GetValue("Release") != null) { var releaseKey = (int)key.GetValue("Release"); if (releaseKey >= minSupportedRelease) { return(true); } } } return(false); }
public static async Task <KeyValuePair <string, BDMVGroup> > GetChapterAsync(string location) { var list = new BDMVGroup(); var bdmvTitle = string.Empty; var path = Path.Combine(location, "BDMV", "PLAYLIST"); if (!Directory.Exists(path)) { throw new FileNotFoundException("Blu-Ray disc structure not found."); } var metaPath = Path.Combine(location, "BDMV", "META", "DL"); if (Directory.Exists(metaPath)) { var xmlFile = Directory.GetFiles(metaPath).FirstOrDefault(file => file.ToLower().EndsWith(".xml")); if (xmlFile != null) { var xmlText = File.ReadAllText(xmlFile); var title = Regex.Match(xmlText, @"<di:name>(?<title>[^<]*)</di:name>"); if (title.Success) { bdmvTitle = title.Groups["title"].Value; OnLog?.Invoke($"Disc Title: {bdmvTitle}"); } } } var eac3toPath = RegistryStorage.Load(name: "eac3toPath"); if (string.IsNullOrEmpty(eac3toPath) || !File.Exists(eac3toPath)) { eac3toPath = Notification.InputBox("请输入eac3to的地址", "注意不要带上多余的引号", "C:\\eac3to\\eac3to.exe"); if (string.IsNullOrEmpty(eac3toPath)) { return(new KeyValuePair <string, BDMVGroup>(bdmvTitle, list)); } RegistryStorage.Save(name: "eac3toPath", value: eac3toPath); } var workingPath = Directory.GetParent(location).FullName; location = location.Substring(location.LastIndexOf('\\') + 1); var text = (await TaskAsync.RunProcessAsync(eac3toPath, $"\"{location}\"", workingPath)).ToString(); if (text.Contains("HD DVD / Blu-Ray disc structure not found.")) { OnLog?.Invoke(text); throw new Exception("May be the path is too complex or directory contains nonAscii characters"); } OnLog?.Invoke("\r\nDisc Info:\r\n" + text); foreach (Match match in RDiskInfo.Matches(text)) { var index = match.Groups["idx"].Value; var mpls = match.Groups["mpls"].Value; var time = match.Groups["dur"].Value; if (string.IsNullOrEmpty(time)) { time = match.Groups["dur2"].Value; } var file = match.Groups["fn"].Value; if (string.IsNullOrEmpty(file)) { file = match.Groups["fn2"].Value; } OnLog?.Invoke($"+ {index}) {mpls} -> [{file}] - [{time}]"); list.Add(new ChapterInfo { Duration = TimeSpan.Parse(time), SourceIndex = index, SourceName = file, }); } var toBeRemove = new List <ChapterInfo>(); var chapterPath = Path.Combine(workingPath, "chapters.txt"); var logPath = Path.Combine(workingPath, "chapters - Log.txt"); foreach (var current in list) { text = (await TaskAsync.RunProcessAsync(eac3toPath, $"\"{location}\" {current.SourceIndex})", workingPath)).ToString(); if (!text.Contains("Chapters")) { toBeRemove.Add(current); continue; } text = (await TaskAsync.RunProcessAsync(eac3toPath, $"\"{location}\" {current.SourceIndex}) chapters.txt", workingPath)).ToString(); if (!text.Contains("Creating file \"chapters.txt\"...") && !text.Contains("Done!")) { OnLog?.Invoke(text); throw new Exception("Error creating chapters file."); } current.Chapters = OgmData.GetChapterInfo(File.ReadAllBytes(chapterPath).GetUTFString()).Chapters; if (current.Chapters.First().Name != string.Empty) { continue; } var chapterName = ChapterName.GetChapterName(); current.Chapters.ForEach(chapter => chapter.Name = chapterName()); } toBeRemove.ForEach(item => list.Remove(item)); if (File.Exists(chapterPath)) { File.Delete(chapterPath); } if (File.Exists(logPath)) { File.Delete(logPath); } return(new KeyValuePair <string, BDMVGroup>(bdmvTitle, list)); }