Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
ZeromusXYZ committed Mar 11, 2021
2 parents 2bcad47 + b3f29ec commit f2a6cfe
Show file tree
Hide file tree
Showing 10 changed files with 191 additions and 47 deletions.
6 changes: 3 additions & 3 deletions AAMod/ModMainForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ private void BtnInstall_Click(object sender, EventArgs e)
var fileBackupStream = gamepak.ExportFileAsStream(fi.name);
fileBackupStream.Position = 0;
AAPakFileInfo restoreFileInfo = restorepak.nullAAPakFileInfo;
if (!restorepak.AddFileFromStream(fi.name, fileBackupStream, DateTime.FromFileTime(gamefi.createTime), DateTime.FromFileTime(gamefi.modifyTime), false, out restoreFileInfo))
if (!restorepak.AddFileFromStream(fi.name, fileBackupStream, DateTime.FromFileTimeUtc(gamefi.createTime), DateTime.FromFileTimeUtc(gamefi.modifyTime), false, out restoreFileInfo))
{
MessageBox.Show("Error making backup of " + fi.name);
}
Expand All @@ -363,7 +363,7 @@ private void BtnInstall_Click(object sender, EventArgs e)
var fileModStream = modpak.ExportFileAsStream(fi.name);
fileModStream.Position = 0;
AAPakFileInfo newModFile = gamepak.nullAAPakFileInfo;
if (!gamepak.AddFileFromStream(fi.name, fileModStream, DateTime.FromFileTime(fi.createTime), DateTime.FromFileTime(fi.modifyTime), false, out newModFile))
if (!gamepak.AddFileFromStream(fi.name, fileModStream, DateTime.FromFileTimeUtc(fi.createTime), DateTime.FromFileTimeUtc(fi.modifyTime), false, out newModFile))
{
MessageBox.Show("Error modding file " + fi.name);
}
Expand Down Expand Up @@ -417,7 +417,7 @@ private void BtnUninstall_Click(object sender, EventArgs e)
var fileRestoreStream = restorepak.ExportFileAsStream(fi.name);
fileRestoreStream.Position = 0;
AAPakFileInfo restoreFileInfo = gamepak.nullAAPakFileInfo;
if (!gamepak.AddFileFromStream(fi.name, fileRestoreStream, DateTime.FromFileTime(rfi.createTime), DateTime.FromFileTime(rfi.modifyTime), false, out restoreFileInfo))
if (!gamepak.AddFileFromStream(fi.name, fileRestoreStream, DateTime.FromFileTimeUtc(rfi.createTime), DateTime.FromFileTimeUtc(rfi.modifyTime), false, out restoreFileInfo))
{
MessageBox.Show("Error restoring file " + fi.name);
}
Expand Down
4 changes: 2 additions & 2 deletions AAPakCLI/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -118,15 +118,15 @@ static private void CreateCSVFile(ref AAPak pak, string filename = "")
sl.Add(s);
foreach (AAPakFileInfo pfi in pak.files)
{
DateTime modTime = DateTime.FromFileTime(pfi.modifyTime);
DateTime modTime = DateTime.FromFileTimeUtc(pfi.modifyTime);
if (modTime > newest)
newest = modTime;

s = pfi.name;
s += ";" + pfi.size.ToString();
s += ";" + pfi.offset.ToString();
s += ";" + BitConverter.ToString(pfi.md5).Replace("-", "").ToUpper();
s += ";" + AAPak.DateTimeToDateTimeStr(DateTime.FromFileTime(pfi.createTime));// DateTimeToDateTimeStr DateTime.FromFileTime(pfi.createTime).ToString("yyyy-MM-dd HH:mm:ss");
s += ";" + AAPak.DateTimeToDateTimeStr(DateTime.FromFileTimeUtc(pfi.createTime));// DateTimeToDateTimeStr DateTime.FromFileTimeUtc(pfi.createTime).ToString("yyyy-MM-dd HH:mm:ss");
s += ";" + AAPak.DateTimeToDateTimeStr(modTime); // .ToString("yyyy-MM-dd HH:mm:ss");
s += ";" + pfi.sizeDuplicate.ToString();
s += ";" + pfi.paddingSize.ToString();
Expand Down
4 changes: 2 additions & 2 deletions AAPakEditor/ExportAllDlg.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ public bool ExportFile(AAPakFileInfo pfi, string destName)
fs.Dispose();

// Update file details
File.SetCreationTime(destName, DateTime.FromFileTime(pfi.createTime));
File.SetLastWriteTime(destName, DateTime.FromFileTime(pfi.modifyTime));
File.SetCreationTime(destName, DateTime.FromFileTimeUtc(pfi.createTime));
File.SetLastWriteTime(destName, DateTime.FromFileTimeUtc(pfi.modifyTime));
}
catch
{
Expand Down
54 changes: 52 additions & 2 deletions AAPakEditor/FilePropForm.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

71 changes: 65 additions & 6 deletions AAPakEditor/FilePropForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -250,10 +250,27 @@ public void ResetFileInfo()

tHash.Text = BitConverter.ToString(pfi.md5).ToUpper().Replace("-", "");

dtCreate.Value = DateTime.FromFileTime(pfi.createTime);
if (pfi.modifyTime != 0)
dtModified.Value = DateTime.FromFileTime(pfi.modifyTime);
dtModified.Value = DateTime.UtcNow ;
dtCreate.Value = DateTime.UtcNow;
dtModified.Value = DateTime.UtcNow;
try
{
dtCreate.Value = DateTime.FromFileTimeUtc(pfi.createTime);
}
catch
{
dtCreate.Enabled = false;
tCreateAsNumber.Text = pfi.createTime.ToString();
}

try
{
dtModified.Value = DateTime.FromFileTimeUtc(pfi.modifyTime);
}
catch
{
dtModified.Enabled = false;
tModifyAsNumber.Text = pfi.modifyTime.ToString();
}

tOffset.Text = "0x" + pfi.offset.ToString("X");

Expand Down Expand Up @@ -368,7 +385,22 @@ private bool ValidateFields()

try
{
newInfo.createTime = dtCreate.Value.ToFileTime();
dtCreate.Enabled = string.IsNullOrWhiteSpace(tCreateAsNumber.Text);
if (dtCreate.Enabled)
newInfo.createTime = dtCreate.Value.ToFileTimeUtc();
else
{
if (TryFieldParse(tCreateAsNumber.Text, out long nCreateTime))
{
newInfo.createTime = nCreateTime;
}
else
{
warnings += "Create Time is not a valid number\r\n";
res = false;
}

}
}
catch
{
Expand All @@ -378,7 +410,22 @@ private bool ValidateFields()

try
{
newInfo.modifyTime = dtModified.Value.ToFileTime();
dtModified.Enabled = string.IsNullOrWhiteSpace(tModifyAsNumber.Text);
if (dtModified.Enabled)
newInfo.modifyTime = dtModified.Value.ToFileTimeUtc();
else
{
if (TryFieldParse(tModifyAsNumber.Text, out long nModifiedTime))
{
newInfo.modifyTime = nModifiedTime;
}
else
{
warnings += "Modified Time is not a valid number\r\n";
res = false;
}

}
}
catch
{
Expand Down Expand Up @@ -443,5 +490,17 @@ private void tFieldsChanged(object sender, EventArgs e)
{
btnSave.Enabled = ValidateFields() && hasChanged();
}

private void lCTtoR_Click(object sender, EventArgs e)
{
if (string.IsNullOrWhiteSpace(tCreateAsNumber.Text))
tCreateAsNumber.Text = newInfo.createTime.ToString();
}

private void lDTToR_Click(object sender, EventArgs e)
{
if (string.IsNullOrWhiteSpace(tModifyAsNumber.Text))
tModifyAsNumber.Text = newInfo.modifyTime.ToString();
}
}
}
Loading

0 comments on commit f2a6cfe

Please sign in to comment.