From a6cfe73d69f7196b728f7bc72e2f9d5d887befc3 Mon Sep 17 00:00:00 2001 From: Mygod Date: Sat, 10 May 2014 14:15:57 +0800 Subject: [PATCH] EdgeTool 9.1.46.245 (Various bugfixes) --- EdgeTool/AssemblyInfo.cs | 4 ++-- EdgeTool/MainWindow.xaml.cs | 29 +++++++++++++++++++---------- 2 files changed, 21 insertions(+), 12 deletions(-) diff --git a/EdgeTool/AssemblyInfo.cs b/EdgeTool/AssemblyInfo.cs index 4356966..1203e98 100644 --- a/EdgeTool/AssemblyInfo.cs +++ b/EdgeTool/AssemblyInfo.cs @@ -51,5 +51,5 @@ // 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值, // 方法是按如下所示使用“*”: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("9.1.46.244")] -[assembly: AssemblyFileVersion("9.1.46.244")] +[assembly: AssemblyVersion("9.1.46.245")] +[assembly: AssemblyFileVersion("9.1.46.245")] diff --git a/EdgeTool/MainWindow.xaml.cs b/EdgeTool/MainWindow.xaml.cs index c3b06a8..c04f1ae 100644 --- a/EdgeTool/MainWindow.xaml.cs +++ b/EdgeTool/MainWindow.xaml.cs @@ -351,6 +351,7 @@ private string SfxPath } } private Regex keepRegex; + private static readonly Regex VersionMatcher = new Regex("(?<=)\\d+(?=<\\/integer>)"); private bool KeepRegexCheck(string name) { return keepRegex != null && keepRegex.IsMatch(name); @@ -377,9 +378,10 @@ private static void Start(string path, string args = null) UseShellExecute = false, CreateNoWindow = true, WorkingDirectory = Path.GetDirectoryName(path) }).WaitForExit(); } - private void Ffmpeg(string input, string output) + private void Ffmpeg(string input, string output, bool caf = true) { - Start(ffmpeg, string.Format("-i \"{0}\"{2} \"{1}\" -y", input, output, ios ? string.Empty : " -f ogg")); + Start(ffmpeg, string.Format("-i \"{0}\"{2} \"{1}\" -y", input, output, + ios ? caf ? " -acodec adpcm_ima_qt" : string.Empty : " -f ogg")); } private string FallbackPath(string path, bool isSfx = false) { @@ -389,7 +391,7 @@ private string FallbackPath(string path, bool isSfx = false) return File.Exists(result) ? result : null; } private void GenerateMobileLevelFiles(int count, IReadOnlyList levelPack, - IList levelList, IList levelSoundList) + IList levelList, IList levelSoundList, bool easy = false) { for (var i = 0; i < count; ++i) { @@ -402,18 +404,18 @@ private void GenerateMobileLevelFiles(int count, IReadOnlyList lev if (KeepRegexCheck(name)) File.Copy(Path.Combine(orgDir, name), target, true); else { - Level level; - if (source == null) level = PlaceholderLevel.Value; + if (source == null) PlaceholderLevel.Value.EasyCompile(target); + else if (easy) File.Copy(source, target, true); else { - level = Level.CreateFromCompiled(source); + var level = Level.CreateFromCompiled(source); level.SPlusTime *= 100; level.STime *= 100; level.ATime *= 100; level.BTime *= 100; level.CTime *= 100; + level.EasyCompile(target); } - level.EasyCompile(target); } dialog.ReportProgress(0, null, name = levelSoundList[i] + ".caf"); if (KeepRegexCheck(name)) File.Copy(Path.Combine(orgDir, name), target, true); @@ -441,7 +443,7 @@ private void CompileMobileVersion(object sender, DoWorkEventArgs e) ffmpeg = Path.Combine(configDir, "ffmpeg.exe"); var root = XHelper.Load(e.Argument.ToString()).Root; outputDir = Path.Combine(configDir, (ios = root.GetAttributeValue("preset") == "ios") - ? @"Payload\Edge.app" : @"src\assets"); + ? @"Payload\EDGE Epic.app" : @"src\assets"); var regex = root.GetAttributeValue("keep"); keepRegex = regex == null ? null : new Regex(regex, RegexOptions.Compiled); List @@ -453,7 +455,7 @@ private void CompileMobileVersion(object sender, DoWorkEventArgs e) while (levelPackB.Count < 17) levelPackB.Add(new MappingLevel(LevelType.Bonus, levelPackB.Count)); sfxPath = null; GenerateMobileLevelFiles(48, levelPackA, MobileStandardLevels, MobileStandardLevelSounds); - GenerateMobileLevelFiles(17, levelPackB, MobileBonusLevels, MobileBonusLevelSounds); + GenerateMobileLevelFiles(17, levelPackB, MobileBonusLevels, MobileBonusLevelSounds, true); dialog.ReportProgress(0, null, "cos.bin"); File.Copy(KeepRegexCheck("cos.bin") ? Path.Combine(orgDir, "cos.bin") : FallbackPath("cos.bin"), Path.Combine(outputDir, "cos.bin"), true); @@ -467,7 +469,7 @@ private void CompileMobileVersion(object sender, DoWorkEventArgs e) string source = KeepRegexCheck(MobileMusics[i]) ? Path.Combine(orgDir, MobileMusics[i]) : FallbackPath(Path.Combine("music", Level.Musics[i] + ".ogg")), target = Path.Combine(outputDir, MobileMusics[i]); - if (ios) Ffmpeg(source, target); + if (ios) Ffmpeg(source, target, false); else File.Copy(source, target, true); } foreach (var sound in MobileSounds) @@ -484,6 +486,13 @@ private void CompileMobileVersion(object sender, DoWorkEventArgs e) File.Copy(KeepRegexCheck(name) ? Path.Combine(orgDir, name) : FallbackPath(Path.Combine("sprites", name)), Path.Combine(outputDir, name), true); } + if (ios) + { + dialog.ReportProgress(0, null, "iTunesMetadata.plist"); + var target = Path.Combine(configDir, "iTunesMetadata.plist"); + File.WriteAllText(target, VersionMatcher.Replace(File.ReadAllText(target), + m => (int.Parse(m.Value) + 1).ToString(CultureInfo.InvariantCulture))); + } dialog.ReportProgress(0, null, Localization.AlmostThere); Start(Path.Combine(configDir, "compile.bat")); dialog.ReportProgress(0, null, Localization.Done);