Remove IGDB and update version

This commit is contained in:
Aurélie Delhaie
2022-07-20 23:17:18 +02:00
parent 397085e335
commit 0ed95d81dd
10 changed files with 67 additions and 79 deletions

View File

@@ -28,7 +28,6 @@
/// </summary> /// </summary>
private void InitializeComponent() private void InitializeComponent()
{ {
this.components = new System.ComponentModel.Container();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(AddGameForm)); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(AddGameForm));
this.label1 = new System.Windows.Forms.Label(); this.label1 = new System.Windows.Forms.Label();
this.groupBox1 = new System.Windows.Forms.GroupBox(); this.groupBox1 = new System.Windows.Forms.GroupBox();
@@ -42,7 +41,6 @@
this.NoCoverLabel = new System.Windows.Forms.Label(); this.NoCoverLabel = new System.Windows.Forms.Label();
this.CoverPicture = new System.Windows.Forms.PictureBox(); this.CoverPicture = new System.Windows.Forms.PictureBox();
this.AddButton = new System.Windows.Forms.Button(); this.AddButton = new System.Windows.Forms.Button();
this.timer1 = new System.Windows.Forms.Timer(this.components);
this.PathErrorLabel = new System.Windows.Forms.Label(); this.PathErrorLabel = new System.Windows.Forms.Label();
this.groupBox1.SuspendLayout(); this.groupBox1.SuspendLayout();
this.groupBox2.SuspendLayout(); this.groupBox2.SuspendLayout();
@@ -201,11 +199,6 @@
this.AddButton.UseVisualStyleBackColor = true; this.AddButton.UseVisualStyleBackColor = true;
this.AddButton.Click += new System.EventHandler(this.button1_Click); this.AddButton.Click += new System.EventHandler(this.button1_Click);
// //
// timer1
//
this.timer1.Interval = 350;
this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
//
// PathErrorLabel // PathErrorLabel
// //
this.PathErrorLabel.AutoSize = true; this.PathErrorLabel.AutoSize = true;
@@ -259,7 +252,6 @@
private Label label2; private Label label2;
private Label NoCoverLabel; private Label NoCoverLabel;
private PictureBox CoverPicture; private PictureBox CoverPicture;
private System.Windows.Forms.Timer timer1;
private Label NameWarningLabel; private Label NameWarningLabel;
private Label PathErrorLabel; private Label PathErrorLabel;
} }

View File

@@ -1,6 +1,4 @@
using IGDB; using OpenSaveCloudClient.Core;
using IGDB.Models;
using OpenSaveCloudClient.Core;
using OpenSaveCloudClient.Models; using OpenSaveCloudClient.Models;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
@@ -16,72 +14,21 @@ namespace OpenSaveCloudClient
{ {
public partial class AddGameForm : Form public partial class AddGameForm : Form
{ {
private readonly IGDBClient? _client;
private GameSave result; private GameSave result;
private SaveManager saveManager; private SaveManager saveManager;
public GameSave Result { get { return result; } } public GameSave Result { get { return result; } }
public AddGameForm(IGDBClient? iGDBClient) public AddGameForm()
{ {
InitializeComponent(); InitializeComponent();
_client = iGDBClient;
saveManager = SaveManager.GetInstance(); saveManager = SaveManager.GetInstance();
if (_client == null) NoCoverLabel.Text = "IGDB is not configured";
{
NoCoverLabel.Text = "IGDB is not configured";
}
else
{
NoCoverLabel.Visible = false;
}
}
private async void timer1_Tick(object sender, EventArgs e)
{
timer1.Stop();
if (_client != null)
{
NoCoverLabel.Visible = false;
CoverPicture.Visible = true;
if (!string.IsNullOrWhiteSpace(NameBox.Text))
{
try
{
string query = string.Format("fields *; search \"{0}\";", NameBox.Text.Replace("\"", ""));
Game[] games = await _client.QueryAsync<Game>(IGDBClient.Endpoints.Games, query: query);
games = games.Where(g => g.Cover != null && g.Cover.Value != null).ToArray();
if (games.Length > 0)
{
Game game = games.First();
CoverPicture.LoadAsync(game.Cover.Value.Url);
}
else
{
CoverPicture.Visible = false;
NoCoverLabel.Text = "No cover found";
NoCoverLabel.Visible = true;
}
}
catch (Exception ex)
{
CoverPicture.Visible = false;
NoCoverLabel.Text = ex.Message;
NoCoverLabel.Visible = true;
}
}
}
} }
private void NameBox_TextChanged(object sender, EventArgs e) private void NameBox_TextChanged(object sender, EventArgs e)
{ {
NameWarningLabel.Visible = saveManager.Saves.Exists(g => g.Name == NameBox.Text); NameWarningLabel.Visible = saveManager.Saves.Exists(g => g.Name == NameBox.Text);
if (_client != null)
{
timer1.Stop();
timer1.Start();
}
} }
private void pathButton_Click(object sender, EventArgs e) private void pathButton_Click(object sender, EventArgs e)

View File

@@ -57,9 +57,6 @@
<resheader name="writer"> <resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader> </resheader>
<metadata name="timer1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /> <assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> <data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value> <value>

View File

@@ -1,6 +1,5 @@
using OpenSaveCloudClient.Models; using OpenSaveCloudClient.Models;
using OpenSaveCloudClient.Core; using OpenSaveCloudClient.Core;
using IGDB;
using OpenSaveCloudClient.Models.Remote; using OpenSaveCloudClient.Models.Remote;
namespace OpenSaveCloudClient namespace OpenSaveCloudClient
@@ -9,7 +8,6 @@ namespace OpenSaveCloudClient
{ {
private readonly Configuration _configuration; private readonly Configuration _configuration;
//private readonly IGDBClient? _client;
private readonly SaveManager saveManager; private readonly SaveManager saveManager;
private readonly TaskManager taskManager; private readonly TaskManager taskManager;
private readonly ServerConnector serverConnector; private readonly ServerConnector serverConnector;
@@ -28,12 +26,6 @@ namespace OpenSaveCloudClient
listViewContextMenu = new ContextMenuStrip(); listViewContextMenu = new ContextMenuStrip();
listViewContextMenu.Items.Add("Delete from server").Click += contextMenuDeleteFromServer_Click; listViewContextMenu.Items.Add("Delete from server").Click += contextMenuDeleteFromServer_Click;
listViewContextMenu.Items.Add("Remove from local library").Click += contextMenuRemoveFromLocalLibrary_Click; listViewContextMenu.Items.Add("Remove from local library").Click += contextMenuRemoveFromLocalLibrary_Click;
/*if (_configuration.GetBoolean("igdb.enabled", false))
{
string clientId = _configuration.GetString("igdb.client_id", "");
string clientSecret = _configuration.GetString("igdb.client_secret", "");
_client = new IGDBClient(clientId, clientSecret);
}*/
} }
private void GameLibrary_Load(object sender, EventArgs e) private void GameLibrary_Load(object sender, EventArgs e)
@@ -172,7 +164,7 @@ namespace OpenSaveCloudClient
private void AddButton_Click(object sender, EventArgs e) private void AddButton_Click(object sender, EventArgs e)
{ {
AddGameForm form = new(/*_client*/ null); AddGameForm form = new();
if (form.ShowDialog() == DialogResult.OK) { if (form.ShowDialog() == DialogResult.OK) {
GameSave newGame = form.Result; GameSave newGame = form.Result;
ThreadPool.QueueUserWorkItem(delegate { AddGameToLibrary(newGame); }); ThreadPool.QueueUserWorkItem(delegate { AddGameToLibrary(newGame); });

View File

@@ -2,15 +2,35 @@
<PropertyGroup> <PropertyGroup>
<OutputType>WinExe</OutputType> <OutputType>WinExe</OutputType>
<TargetFramework>net6.0-windows10.0.22000.0</TargetFramework> <TargetFramework>net6.0-windows10.0.22621.0</TargetFramework>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
<UseWindowsForms>true</UseWindowsForms> <UseWindowsForms>true</UseWindowsForms>
<ImplicitUsings>enable</ImplicitUsings> <ImplicitUsings>enable</ImplicitUsings>
<SupportedOSPlatformVersion>8.0</SupportedOSPlatformVersion> <SupportedOSPlatformVersion>10.0.17763.0</SupportedOSPlatformVersion>
<PlatformTarget>x64</PlatformTarget> <PlatformTarget>x64</PlatformTarget>
<PackageIcon>logo.png</PackageIcon> <PackageIcon>logo.png</PackageIcon>
<ApplicationIcon>logo.ico</ApplicationIcon> <ApplicationIcon>logo.ico</ApplicationIcon>
<Platforms>AnyCPU;x64</Platforms> <Platforms>AnyCPU;x64</Platforms>
<SignAssembly>True</SignAssembly>
<AssemblyOriginatorKeyFile>D:\keyPair.snk</AssemblyOriginatorKeyFile>
<AnalysisLevel>6.0-all</AnalysisLevel>
<Version>1.0.1</Version>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<DebugType>none</DebugType>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<DebugType>none</DebugType>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<DebugType>none</DebugType>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<DebugType>none</DebugType>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
@@ -18,7 +38,6 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="IGDB" Version="2.3.1" />
<PackageReference Include="PasswordGenerator" Version="2.1.0" /> <PackageReference Include="PasswordGenerator" Version="2.1.0" />
</ItemGroup> </ItemGroup>
@@ -28,6 +47,11 @@
<AutoGen>True</AutoGen> <AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon> <DependentUpon>Resources.resx</DependentUpon>
</Compile> </Compile>
<Compile Update="Properties\Settings.Designer.cs">
<DesignTimeSharedInput>True</DesignTimeSharedInput>
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
</Compile>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
@@ -42,6 +66,10 @@
<Pack>True</Pack> <Pack>True</Pack>
<PackagePath>\</PackagePath> <PackagePath>\</PackagePath>
</None> </None>
<None Update="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
</ItemGroup> </ItemGroup>
</Project> </Project>

View File

@@ -0,0 +1,26 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace OpenSaveCloudClient.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.2.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default {
get {
return defaultInstance;
}
}
}
}

View File

@@ -0,0 +1,6 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
<Profiles>
<Profile Name="(Default)" />
</Profiles>
</SettingsFile>