Skip to content
This repository was archived by the owner on Jan 19, 2025. It is now read-only.

Commit 7a20c46

Browse files
authored
Merge pull request #22 from PikminGuts92/dev
Ark + midi enhancements
2 parents 019b92b + 5a34b99 commit 7a20c46

File tree

4 files changed

+20
-7
lines changed

4 files changed

+20
-7
lines changed

Src/Apps/ArkHelper/Apps/PatchCreatorApp.cs

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,21 @@ public void Parse(PatchCreatorOptions op)
4545
var hdrFileName = new FileInfo(op.InputPath).Name;
4646
var isUppercase = Path
4747
.GetFileNameWithoutExtension(hdrFileName)
48-
.All(c => char.IsUpper(c));
48+
.All(char.IsAsciiLetterUpper);
4949

5050
var genDirName = isUppercase
5151
? "GEN"
5252
: "gen";
5353

54+
// Use upper case if any file names do
55+
var genDirNameInternal = ark
56+
.Entries
57+
.Any(x => x.FileName
58+
.Where(char.IsAsciiLetter)
59+
.All(char.IsAsciiLetterUpper))
60+
? "GEN"
61+
: "gen";
62+
5463
var arkExt = isUppercase
5564
? ".ARK"
5665
: ".ark";
@@ -79,6 +88,10 @@ public void Parse(PatchCreatorOptions op)
7988
ark.AddAdditionalPart(fullPartPath);
8089
}
8190
}
91+
else
92+
{
93+
Log.Warning("Using inplace edit");
94+
}
8295

8396
var files = Directory.GetFiles(op.ArkFilesPath, "*", SearchOption.AllDirectories);
8497

@@ -114,7 +127,7 @@ public void Parse(PatchCreatorOptions op)
114127
internalPath = $"{internalPath.Substring(0, internalPath.Length - 1)}b";
115128

116129
if (!genPathedFile.IsMatch(internalPath))
117-
internalPath = internalPath.Insert(internalPath.LastIndexOf('/'), $"/{genDirName}");
130+
internalPath = internalPath.Insert(internalPath.LastIndexOf('/'), $"/{genDirNameInternal}");
118131

119132
// Creates temp dtb file
120133
inputFilePath = ScriptHelper.ConvertDtaToDtb(file, tempDir, ark.Encrypted, (int)ark.Version);

Src/Apps/P9SongTool/Helpers/MidiHelper.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ protected virtual MidiFile ParseBaseMidi(string midPath)
3131
}
3232

3333
Log.Information("Using \"{MidPath}\" as base .mid file", midPath);
34-
return new MidiFile(midPath);
34+
return new MidiFile(midPath, strictChecking: false);
3535
}
3636

3737
protected virtual List<(long tickPos, decimal framePos, int mpq)> CreateTempoMap()

Src/Core/Mackiloha/Ark/ArkEntry.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ private bool IsValidPath(string text, bool directory = false)
3131

3232
public string Extension => (!FileName.Contains('.')) ? "" : FileName.Remove(0, FileName.LastIndexOf('.') + 1);
3333

34-
public override bool Equals(object obj) => (obj is ArkEntry) && ((obj as ArkEntry).FullPath == this.FullPath);
35-
public override int GetHashCode() => FullPath.GetHashCode();
36-
public override string ToString() => $"{FullPath}";
34+
public override bool Equals(object obj) => (obj is ArkEntry arkEntry) && string.Equals(arkEntry.FullPath, FullPath, StringComparison.InvariantCultureIgnoreCase);
35+
public override int GetHashCode() => string.GetHashCode(FullPath, StringComparison.InvariantCultureIgnoreCase);
36+
public override string ToString() => FullPath;
3737
}

version.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.3.1
1+
1.3.2

0 commit comments

Comments
 (0)