Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
MrKev312 committed Dec 21, 2019
1 parent 0a110c3 commit ba9aeca
Show file tree
Hide file tree
Showing 17 changed files with 1,097 additions and 1 deletion.
25 changes: 25 additions & 0 deletions CEMU Mod Importer.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.29609.76
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CEMU Mod Importer", "CEMU Mod Importer\CEMU Mod Importer.csproj", "{C26CBCF1-9205-45EE-A555-1353E92AEF27}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{C26CBCF1-9205-45EE-A555-1353E92AEF27}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C26CBCF1-9205-45EE-A555-1353E92AEF27}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C26CBCF1-9205-45EE-A555-1353E92AEF27}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C26CBCF1-9205-45EE-A555-1353E92AEF27}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {301C8A62-DF9C-4A1F-A600-0E4CD227C02F}
EndGlobalSection
EndGlobal
6 changes: 6 additions & 0 deletions CEMU Mod Importer/App.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
</startup>
</configuration>
91 changes: 91 additions & 0 deletions CEMU Mod Importer/CEMU Mod Importer.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{C26CBCF1-9205-45EE-A555-1353E92AEF27}</ProjectGuid>
<OutputType>WinExe</OutputType>
<RootNamespace>CEMU_Mod_Importer</RootNamespace>
<AssemblyName>CEMU Mod Importer</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Deterministic>true</Deterministic>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.12.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="PresentationCore" />
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Deployment" />
<Reference Include="System.Drawing" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="GameInfo.cs" />
<Compile Include="JSON_importer.cs" />
<Compile Include="Main.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Main.Designer.cs">
<DependentUpon>Main.cs</DependentUpon>
</Compile>
<Compile Include="Mod.cs" />
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<EmbeddedResource Include="Main.resx">
<DependentUpon>Main.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
<SubType>Designer</SubType>
</EmbeddedResource>
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<None Include="packages.config" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
25 changes: 25 additions & 0 deletions CEMU Mod Importer/GameInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
using System;
using System.Collections.Generic;

namespace CEMU_Mod_Importer
{
class GameInfo : IComparable<GameInfo>
{
public string Name;
public List<string> Ids = new List<string>();

public override string ToString()
{
return Name;
}
public int CompareTo(GameInfo that)
{
if (Name == that.Name) return 0;
List<string> names = new List<string>{ Name, that.Name };
names.Sort();
if (names[0] == Name)
return -1;
return 1;
}
}
}
70 changes: 70 additions & 0 deletions CEMU Mod Importer/JSON_importer.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Globalization;

namespace CEMU_Mod_Importer
{
class GameInfoJSON
{
public string titleID;
public string titleKey;
public string name;
public string region;
public string ticket;
}
class JSON_importer
{
private static JSON_importer instance = null;
private static readonly object padlock = new object();

public static JSON_importer Instance
{
get
{
lock (padlock)
{
if (instance == null)
{
instance = new JSON_importer();
}
return instance;
}
}
}
public List<GameInfo> gameInfos = new List<GameInfo>();
public void Import(string JSONfile)
{
GameInfoJSON[] infoJSON = JsonConvert.DeserializeObject<GameInfoJSON[]>(JSONfile);

foreach (GameInfoJSON gameInfoJSON in infoJSON)
{
if (gameInfoJSON.name == null)
continue;
gameInfoJSON.name = CultureInfo.CurrentCulture.TextInfo.ToTitleCase(gameInfoJSON.name.ToLower());
bool added = false;
if(gameInfoJSON.titleID[7] == '0')
{
foreach (GameInfo info in gameInfos)
{
if(info.Name == gameInfoJSON.name)
{
info.Ids.Add(gameInfoJSON.titleID + " [" + gameInfoJSON.region + "]");
added = true;
break;
}
}
if (added == false)
{
GameInfo gameInfo = new GameInfo();
gameInfo.Name = gameInfoJSON.name;
gameInfo.Ids.Add(gameInfoJSON.titleID + " [" + gameInfoJSON.region + "]");
gameInfos.Add(gameInfo);
}
}
}
gameInfos.Sort();
}
}
}
Loading

0 comments on commit ba9aeca

Please sign in to comment.