Skip to content
This repository has been archived by the owner on Jun 4, 2019. It is now read-only.

Commit

Permalink
EdgeTool 9.1.46.245 (Various bugfixes)
Browse files Browse the repository at this point in the history
  • Loading branch information
Mygod committed May 10, 2014
1 parent 560d18d commit a6cfe73
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 12 deletions.
4 changes: 2 additions & 2 deletions EdgeTool/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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")]
29 changes: 19 additions & 10 deletions EdgeTool/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,7 @@ private string SfxPath
}
}
private Regex keepRegex;
private static readonly Regex VersionMatcher = new Regex("(?<=<integer tag=\"version\">)\\d+(?=<\\/integer>)");
private bool KeepRegexCheck(string name)
{
return keepRegex != null && keepRegex.IsMatch(name);
Expand All @@ -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)
{
Expand All @@ -389,7 +391,7 @@ private string FallbackPath(string path, bool isSfx = false)
return File.Exists(result) ? result : null;
}
private void GenerateMobileLevelFiles(int count, IReadOnlyList<MappingLevel> levelPack,
IList<string> levelList, IList<string> levelSoundList)
IList<string> levelList, IList<string> levelSoundList, bool easy = false)
{
for (var i = 0; i < count; ++i)
{
Expand All @@ -402,18 +404,18 @@ private void GenerateMobileLevelFiles(int count, IReadOnlyList<MappingLevel> 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);
Expand Down Expand Up @@ -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<MappingLevel>
Expand All @@ -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);
Expand All @@ -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)
Expand All @@ -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);
Expand Down

0 comments on commit a6cfe73

Please sign in to comment.