예제 #1
0
        private static async Task CheckValidityOfTtxExeDirectory(Config config, ConfigValidationResult result)
        {
            await Task.Run(() =>
            {
                if (config.TtxExeDirectory == null)
                {
                    result.TtxExeDirectoryStatus = DirectoryStatus.NotSpecified();
                    return;
                }

                if (!Directory.Exists(config.TtxExeDirectory))
                {
                    result.TtxExeDirectoryStatus = DirectoryStatus.Invalid();
                    return;
                }

                var filesNotExisting = new List <string>();
                if (!File.Exists(config.TtxExeDirectory + "/ttx.exe"))
                {
                    filesNotExisting.Add("ttx.exe");
                }
                if (!File.Exists(config.TtxExeDirectory + "/GaspHack.ttx"))
                {
                    filesNotExisting.Add("GaspHack.ttx");
                }

                if (filesNotExisting.Any())
                {
                    result.TtxExeDirectoryStatus = DirectoryStatus.FileNotFound(filesNotExisting.ToArray());
                    return;
                }

                result.TtxExeDirectoryStatus = DirectoryStatus.Ok();
            });
        }
예제 #2
0
        private static async Task CheckValidityOfAfdkoDirectory(Config config, ConfigValidationResult result)
        {
            await Task.Run(() =>
            {
                if (config.AfdkoDirectory == null)
                {
                    result.AfdkoDirectoryStatus = DirectoryStatus.NotSpecified();
                    return;
                }

                if (!Directory.Exists(config.AfdkoDirectory))
                {
                    result.AfdkoDirectoryStatus = DirectoryStatus.Invalid();
                    return;
                }

                var filesNotExisting = new List <string>();
                if (!File.Exists(config.AfdkoDirectory + "/otf2otc.cmd"))
                {
                    filesNotExisting.Add("otf2otc.cmd");
                }
                if (!File.Exists(config.AfdkoDirectory + "/otc2otf.cmd"))
                {
                    filesNotExisting.Add("otc2otf.cmd");
                }

                if (filesNotExisting.Any())
                {
                    result.AfdkoDirectoryStatus = DirectoryStatus.FileNotFound(filesNotExisting.ToArray());
                }
                else
                {
                    result.AfdkoDirectoryStatus = DirectoryStatus.Ok();
                }
            });
        }