Skip to content

Commit

Permalink
Added support for PS4
Browse files Browse the repository at this point in the history
  • Loading branch information
pavledev committed Mar 18, 2021
1 parent 539f8cb commit 3760e49
Show file tree
Hide file tree
Showing 9 changed files with 439 additions and 103 deletions.
2 changes: 1 addition & 1 deletion GlacierTEXEditor/About.resx
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@
</resheader>
<data name="label4.Text" xml:space="preserve">
<value>Me - For creating tool
kiwidog, AdrienTD and DislikeMan - For helping me with textures and code
kiwidog, AdrienTD, DislikeMan and B3LYP - For helping me with textures and code
HHCHunter - For helping me with textures
deng0 - DirectXTexNet
MonoGame - DxtUtil
Expand Down
89 changes: 89 additions & 0 deletions GlacierTEXEditor/Configuration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -359,5 +359,94 @@ public void SetAutoUpdateZIP(bool autoUpdateZIP)
MessageBox.Show(ex.Message, "Glacier TEX Editor", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}

public GameVersion GetGameVersion()
{
GameVersion gameVersion = GameVersion.PC;

try
{
List<string> lines = File.ReadAllLines("GlacierTEXEditor.ini").ToList();
string line = lines.Where(l => l.StartsWith("GameVersion")).FirstOrDefault();

if (line != null)
{
string version = line.Substring(line.IndexOf('=') + 1);

if (version.Equals("PC"))
{
gameVersion = GameVersion.PC;
}
else if (version.Equals("PS2"))
{
gameVersion = GameVersion.PS2;
}
else if (version.Equals("PS3"))
{
gameVersion = GameVersion.PS3;
}
else if (version.Equals("PS4"))
{
gameVersion = GameVersion.PS4;
}
else if (version.Equals("XBOX"))
{
gameVersion = GameVersion.XBOX;
}

return gameVersion;
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Glacier TEX Editor", MessageBoxButtons.OK, MessageBoxIcon.Error);
}

return gameVersion;
}

public void WriteGameVersion(string gameVersion)
{
try
{
List<string> lines = File.ReadAllLines("GlacierTEXEditor.ini").ToList();
string line = lines.Where(l => l.StartsWith("GameVersion")).FirstOrDefault();

if (line != null)
{
string newGameVersion = line.Replace(line.Substring(line.IndexOf('=') + 1), gameVersion);

int index = lines.FindIndex(l => l.StartsWith("GameVersion"));
lines[index] = newGameVersion;
}
else
{
lines.Add("GameVersion=" + gameVersion);
}

File.WriteAllLines("GlacierTEXEditor.ini", lines);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Glacier TEX Editor", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}

public bool CheckIfGameVersionExists()
{
try
{
List<string> lines = File.ReadAllLines("GlacierTEXEditor.ini").ToList();
string line = lines.Where(l => l.StartsWith("GameVersion")).FirstOrDefault();

return line != null;
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Glacier TEX Editor", MessageBoxButtons.OK, MessageBoxIcon.Error);
}

return false;
}
}
}
107 changes: 89 additions & 18 deletions GlacierTEXEditor/Form1.Designer.cs

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

Loading

0 comments on commit 3760e49

Please sign in to comment.