feat: now pulls platform information and stores it in the database

This commit is contained in:
Michael Green
2023-04-09 01:19:50 +10:00
parent 1ad840750e
commit b36b3a8f57
14 changed files with 686 additions and 15 deletions

View File

@@ -22,6 +22,13 @@ namespace gaseous_tools
}
}
static public DateTime ConvertUnixToDateTime(double UnixTimeStamp)
{
DateTime dateTime = new DateTime(1970, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc);
dateTime = dateTime.AddSeconds(UnixTimeStamp).ToLocalTime();
return dateTime;
}
public class hashObject
{
public hashObject(string FileName)
@@ -31,12 +38,12 @@ namespace gaseous_tools
var md5 = MD5.Create();
byte[] md5HashByte = md5.ComputeHash(xmlStream);
string md5Hash = BitConverter.ToString(md5HashByte).Replace("-", "").ToLowerInvariant();
_md5hash = md5hash;
_md5hash = md5Hash;
var sha1 = SHA1.Create();
byte[] sha1HashByte = sha1.ComputeHash(xmlStream);
string sha1Hash = BitConverter.ToString(sha1HashByte).Replace("-", "").ToLowerInvariant();
_sha1hash = sha1hash;
_sha1hash = sha1Hash;
}
string _md5hash = "";

View File

@@ -49,6 +49,14 @@ namespace gaseous_tools
}
}
public static ConfigFile.IGDB IGDB
{
get
{
return _config.IGDBConfiguration;
}
}
public static string LogPath
{
get
@@ -185,6 +193,8 @@ namespace gaseous_tools
[JsonIgnore]
public Library LibraryConfiguration = new Library();
public IGDB IGDBConfiguration = new IGDB();
public Logging LoggingConfiguration = new Logging();
public class Database
@@ -220,14 +230,6 @@ namespace gaseous_tools
}
}
public string LibraryUploadDirectory
{
get
{
return Path.Combine(LibraryRootDirectory, "Upload");
}
}
public string LibraryImportDirectory
{
get
@@ -263,7 +265,6 @@ namespace gaseous_tools
public void InitLibrary()
{
if (!Directory.Exists(LibraryRootDirectory)) { Directory.CreateDirectory(LibraryRootDirectory); }
if (!Directory.Exists(LibraryUploadDirectory)) { Directory.CreateDirectory(LibraryUploadDirectory); }
if (!Directory.Exists(LibraryImportDirectory)) { Directory.CreateDirectory(LibraryImportDirectory); }
if (!Directory.Exists(LibraryDataDirectory)) { Directory.CreateDirectory(LibraryDataDirectory); }
if (!Directory.Exists(LibrarySignatureImportDirectory)) { Directory.CreateDirectory(LibrarySignatureImportDirectory); }
@@ -271,6 +272,12 @@ namespace gaseous_tools
}
}
public class IGDB
{
public string ClientId = "";
public string Secret = "";
}
public class Logging
{
public bool DebugLogging = false;

View File

@@ -0,0 +1,24 @@

CREATE TABLE `platforms` (
`id` bigint unsigned NOT NULL,
`abbreviation` varchar(45) DEFAULT NULL,
`alternative_name` varchar(45) DEFAULT NULL,
`category` int DEFAULT NULL,
`checksum` varchar(45) DEFAULT NULL,
`created_at` datetime DEFAULT NULL,
`generation` int DEFAULT NULL,
`name` varchar(45) DEFAULT NULL,
`platform_family` int DEFAULT NULL,
`platform_logo` int DEFAULT NULL,
`slug` varchar(45) DEFAULT NULL,
`summary` varchar(255) DEFAULT NULL,
`updated_at` datetime DEFAULT NULL,
`url` varchar(255) DEFAULT NULL,
`versions` json DEFAULT NULL,
`websites` json DEFAULT NULL,
`dateAdded` datetime DEFAULT NULL,
`lastUpdated` datetime DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `id_UNIQUE` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
SELECT * FROM gaseous.platforms;

View File

@@ -17,6 +17,7 @@
<None Remove="Database\MySQL\gaseous-1000.sql" />
<None Remove="Database\MySQL\gaseous-1001.sql" />
<None Remove="Database\MySQL\gaseous-1002.sql" />
<None Remove="Database\MySQL\gaseous-1003.sql" />
</ItemGroup>
<ItemGroup>
<Folder Include="Database\" />
@@ -26,5 +27,6 @@
<EmbeddedResource Include="Database\MySQL\gaseous-1000.sql" />
<EmbeddedResource Include="Database\MySQL\gaseous-1001.sql" />
<EmbeddedResource Include="Database\MySQL\gaseous-1002.sql" />
<EmbeddedResource Include="Database\MySQL\gaseous-1003.sql" />
</ItemGroup>
</Project>