forked from Neodymium146/gta-toolkit
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Changed how program worked to fix licence issue with converter.
- Loading branch information
1 parent
4b9c1b9
commit ed0a239
Showing
18 changed files
with
481 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
using System; | ||
using TextureTool; | ||
using TextureTool.Utill; | ||
using TextureTool.Utill.Config; | ||
|
||
|
||
namespace RDR2TextureTool | ||
{ | ||
public class Program | ||
{ | ||
[STAThread] | ||
static void Main(string[] args) | ||
{ | ||
FileSystem.Init(); | ||
XMLWriter.Init(); | ||
XMLReader.Init(); | ||
|
||
App app = new App(); | ||
app.InitializeComponent(); | ||
app.Run(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
/* | ||
Copyright(c) 2021 WesternGamer | ||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
The above copyright notice and this permission notice shall be included in | ||
all copies or substantial portions of the Software. | ||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
THE SOFTWARE. | ||
*/ | ||
using System.Xml; | ||
|
||
namespace TextureTool.Utill.Config | ||
{ | ||
internal class XMLReader | ||
{ | ||
public static bool IsFirstStartUp; | ||
public static string ConverterDirectory; | ||
|
||
public static void Init() | ||
{ | ||
using (XmlReader reader = XmlReader.Create(FileSystem.RootFolderPath + "\\config.xml")) | ||
{ | ||
while (reader.Read()) | ||
{ | ||
if (reader.IsStartElement()) | ||
{ | ||
//return only when you have START tag | ||
switch (reader.Name.ToString()) | ||
{ | ||
case "IsFirstStartUp": | ||
IsFirstStartUp = ConvertStringToBool(reader.ReadString()); | ||
break; | ||
case "ConverterDirectory": | ||
ConverterDirectory = reader.ReadString(); | ||
break; | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
private static bool ConvertStringToBool(string str) | ||
{ | ||
if (str == "true") | ||
{ | ||
return true; | ||
} | ||
if (str == "false") | ||
{ | ||
return false; | ||
} | ||
return false; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
/* | ||
Copyright(c) 2021 WesternGamer | ||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
The above copyright notice and this permission notice shall be included in | ||
all copies or substantial portions of the Software. | ||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
THE SOFTWARE. | ||
*/ | ||
using System.IO; | ||
using System.Xml; | ||
|
||
namespace TextureTool.Utill.Config | ||
{ | ||
internal class XMLWriter | ||
{ | ||
public static void Init() | ||
{ | ||
if (Directory.GetFiles(FileSystem.RootFolderPath, "config.xml").Length == 0) | ||
{ | ||
XmlWriterSettings settings = new XmlWriterSettings(); | ||
settings.Indent = true; | ||
settings.IndentChars = (" "); | ||
settings.CloseOutput = true; | ||
settings.OmitXmlDeclaration = true; | ||
using (XmlWriter writer = XmlWriter.Create(FileSystem.RootFolderPath + "\\config.xml", settings)) | ||
{ | ||
writer.WriteStartElement("Config"); | ||
writer.WriteElementString("IsFirstStartUp", "true"); | ||
writer.WriteElementString("ConverterDirectory", ""); | ||
writer.WriteEndElement(); | ||
writer.Flush(); | ||
} | ||
} | ||
} | ||
|
||
public static void WriteXMLEntry(string IsFirstStartUpData, string ConverterDirectoryData) | ||
{ | ||
XmlTextWriter textWriter = new XmlTextWriter(FileSystem.RootFolderPath + "\\config.xml", null); | ||
textWriter.WriteStartDocument(); | ||
textWriter.WriteStartElement("Config"); | ||
textWriter.WriteElementString("IsFirstStartUp", IsFirstStartUpData); | ||
textWriter.WriteElementString("ConverterDirectory", ConverterDirectoryData); | ||
textWriter.WriteEndElement(); | ||
textWriter.WriteEndDocument(); | ||
textWriter.Close(); | ||
|
||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/* | ||
Copyright(c) 2021 WesternGamer | ||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
The above copyright notice and this permission notice shall be included in | ||
all copies or substantial portions of the Software. | ||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
THE SOFTWARE. | ||
*/ | ||
using System; | ||
using System.IO; | ||
|
||
namespace TextureTool.Utill | ||
{ | ||
internal class FileSystem | ||
{ | ||
public static string RootFolderPath; | ||
public static readonly string UserDataPath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData); | ||
|
||
public static void Init() | ||
{ | ||
RootFolderPath = Path.Combine(UserDataPath, "RDR2TextureToolKit"); | ||
if (!Directory.Exists(RootFolderPath)) | ||
Directory.CreateDirectory(RootFolderPath); | ||
} | ||
} | ||
} |
Oops, something went wrong.