Code Cleanup :D

This commit is contained in:
Alan Moon 2025-12-14 13:50:14 -08:00
parent 7899e1b091
commit f154e937d8
37 changed files with 112 additions and 295 deletions

View File

@ -1,10 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace QtCNETAPI.Dtos.User
namespace QtCNETAPI.Dtos.User
{
public class UserPasswordResetDto
{

View File

@ -1,10 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace QtCNETAPI.Enums
namespace QtCNETAPI.Enums
{
public enum NumberGuessResult
{

View File

@ -1,10 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace QtCNETAPI.Events
namespace QtCNETAPI.Events
{
public class ClientFunctionEventArgs : EventArgs
{

View File

@ -1,10 +1,5 @@
using QtCNETAPI.Dtos.User;
using QtCNETAPI.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace QtCNETAPI.Events
{

View File

@ -1,10 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace QtCNETAPI.Events
namespace QtCNETAPI.Events
{
public class GuestUserJoinEventArgs : EventArgs
{

View File

@ -1,9 +1,4 @@
using QtCNETAPI.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace QtCNETAPI.Events
{

View File

@ -1,9 +1,4 @@
using QtCNETAPI.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace QtCNETAPI.Events
{

View File

@ -1,10 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace QtCNETAPI.Events
namespace QtCNETAPI.Events
{
public class ServerConnectionClosedEventArgs : EventArgs
{

View File

@ -1,10 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace QtCNETAPI.Events
namespace QtCNETAPI.Events
{
public class ServerConnectionReconnectingEventArgs : EventArgs
{

View File

@ -1,9 +1,4 @@
using QtCNETAPI.Dtos.User;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace QtCNETAPI.Events
{

View File

@ -4,7 +4,6 @@ using QtCNETAPI.Enums;
using QtCNETAPI.Models;
using QtCNETAPI.Schema;
using RestSharp;
using System.Diagnostics;
using System.IdentityModel.Tokens.Jwt;
using System.Text.Json;
@ -59,7 +58,8 @@ namespace QtCNETAPI.Services.ApiService
else serviceResponse.Success = true;
}
else serviceResponse.Success = false;
} catch (HttpRequestException ex)
}
catch (HttpRequestException ex)
{
serviceResponse.Success = false;
serviceResponse.Message = ex.Message;
@ -110,7 +110,8 @@ namespace QtCNETAPI.Services.ApiService
{
serviceResponse.Success = true;
serviceResponse.Data = response.Data;
} else
}
else
{
serviceResponse.Success = false;
serviceResponse.Message = "API didn't respond with online users.";
@ -136,7 +137,8 @@ namespace QtCNETAPI.Services.ApiService
{
serviceResponse.Success = true;
serviceResponse.Data = response.Data;
} else
}
else
{
serviceResponse.Success = false;
serviceResponse.Message = "API did not return user information.";
@ -160,7 +162,8 @@ namespace QtCNETAPI.Services.ApiService
{
serviceResponse.Success = true;
serviceResponse.Data = response.Data;
} else
}
else
{
serviceResponse.Success = false;
serviceResponse.Message = "API never responded.";
@ -191,11 +194,13 @@ namespace QtCNETAPI.Services.ApiService
serviceResponse.Success = false;
serviceResponse.Data = "Upload Failed.";
}
} catch (JsonException)
}
catch (JsonException)
{
serviceResponse.Success = false;
serviceResponse.Message = "Profile Pictures Can Only Be Less Then 3 MB In Size.";
} catch (HttpRequestException ex)
}
catch (HttpRequestException ex)
{
serviceResponse.Success = false;
serviceResponse.Data = ex.Message;
@ -225,7 +230,8 @@ namespace QtCNETAPI.Services.ApiService
}
return serviceResponse;
} catch (HttpRequestException ex)
}
catch (HttpRequestException ex)
{
serviceResponse.Success = false;
serviceResponse.Message = ex.Message;
@ -297,7 +303,8 @@ namespace QtCNETAPI.Services.ApiService
serviceResponse.Message = response.Message;
}
}
} catch (Exception ex)
}
catch (Exception ex)
{
serviceResponse.Success = false;
serviceResponse.Message = ex.Message;
@ -395,7 +402,8 @@ namespace QtCNETAPI.Services.ApiService
OnCurrentUserUpdate?.Invoke(this, EventArgs.Empty);
return userResponse.Data;
} else
}
else
{
throw new NullReferenceException("Current User could not be set.");
}
@ -437,7 +445,8 @@ namespace QtCNETAPI.Services.ApiService
serviceResponse.Success = false;
serviceResponse.Message = "API didn't respond with a session token.";
}
} catch (Exception ex)
}
catch (Exception ex)
{
serviceResponse.Success = false;
serviceResponse.Message = ex.Message;
@ -466,8 +475,10 @@ namespace QtCNETAPI.Services.ApiService
if (result == null || result.Success == false)
{
return new ServiceResponse<string> { Success = false, Message = "Session Expired." }; // logging in again should overwrite old token
} else return new ServiceResponse<string> { Success = true, Data = refToken };
} else return new ServiceResponse<string> { Success = true, Data = refToken };
}
else return new ServiceResponse<string> { Success = true, Data = refToken };
}
else return new ServiceResponse<string> { Success = true, Data = refToken };
}
public async Task<ServiceResponse<User>> RegisterAsync(UserDto userDto)
@ -488,7 +499,8 @@ namespace QtCNETAPI.Services.ApiService
{
serviceResponse.Success = true;
serviceResponse.Data = response.Data;
} else
}
else
{
serviceResponse.Success = false;
serviceResponse.Message = "API never responded with created user.";
@ -514,7 +526,8 @@ namespace QtCNETAPI.Services.ApiService
{
serviceResponse.Success = true;
serviceResponse.Data = response.Data;
} else
}
else
{
serviceResponse.Success = false;
serviceResponse.Message = "API never responded with created room.";
@ -565,7 +578,8 @@ namespace QtCNETAPI.Services.ApiService
{
serviceResponse.Success = true;
serviceResponse.Data = response.Data;
} else
}
else
{
serviceResponse.Success = false;
serviceResponse.Message = "API never responded.";

View File

@ -1,13 +1,7 @@
using Microsoft.AspNetCore.Mvc;
using QtCNETAPI.Dtos.Room;
using QtCNETAPI.Dtos.User;
using QtCNETAPI.Dtos.Room;
using QtCNETAPI.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using QtCNETAPI.Enums;
using QtCNETAPI.Models;
using QtCNETAPI.Schema;
namespace QtCNETAPI.Services.ApiService

View File

@ -1,12 +1,6 @@
using Microsoft.AspNetCore.SignalR.Client;
using QtCNETAPI.Dtos.User;
using QtCNETAPI.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
namespace QtCNETAPI.Services.GatewayService
{

View File

@ -1,12 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Extensions.Logging;
using System.Diagnostics;
using System.Text.Json;
using Microsoft.Extensions.Logging;
using Microsoft.IdentityModel.Abstractions;
namespace QtCNETAPI.Services
{
@ -34,7 +28,8 @@ namespace QtCNETAPI.Services
{
Debug.WriteLine($"({DateTime.Now.ToLocalTime():hh:mm}) {message}");
LogFile.WriteLine($"({DateTime.Now.ToLocalTime():hh:mm}) {message}");
} catch (ObjectDisposedException)
}
catch (ObjectDisposedException)
{
}
}
@ -49,7 +44,8 @@ namespace QtCNETAPI.Services
// log it
Debug.WriteLine($"({DateTime.Now.ToLocalTime():hh:mm}) {modelSerialized}");
LogFile.WriteLine($"({DateTime.Now.ToLocalTime():hh:mm}) {modelSerialized}");
} catch (ObjectDisposedException)
}
catch (ObjectDisposedException)
{
}
}
@ -71,7 +67,8 @@ namespace QtCNETAPI.Services
// log it
Debug.WriteLine(message);
LogFile.WriteLine(message);
} catch (ObjectDisposedException)
}
catch (ObjectDisposedException)
{
}
}

View File

@ -1,12 +1,4 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace qtcnet_client.Controls
namespace qtcnet_client.Controls
{
public partial class BrandingControl : UserControl
{

View File

@ -1,12 +1,6 @@
using qtcnet_client.Properties;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Text;
using System.Windows.Forms;
namespace qtcnet_client.Controls
{

View File

@ -1,11 +1,5 @@
using qtcnet_client.Properties;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace qtcnet_client.Controls
{
@ -46,7 +40,8 @@ namespace qtcnet_client.Controls
lblCurrencyAmount.Text = CurrencyCount.ToString();
pbCurrentProfilePic.Image = ProfileImage;
});
} else
}
else
{
lblUsername.Text = $"Welcome, {Username}!";
lblCurrencyAmount.Text = CurrencyCount.ToString();

View File

@ -1,12 +1,4 @@
using Krypton.Toolkit;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Reflection.Metadata.Ecma335;
using System.Text;
using System.Windows.Forms;
namespace qtcnet_client.Controls
{

View File

@ -1,14 +1,6 @@
using Krypton.Toolkit;
using qtcnet_client.Factories;
using qtcnet_client.Forms.Games;
using qtcnet_client.Factories;
using QtCNETAPI.Schema;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace qtcnet_client.Controls
{

View File

@ -1,12 +1,4 @@
using Krypton.Toolkit;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Formats.Cbor;
using System.Text;
using System.Windows.Forms;
namespace qtcnet_client.Controls
{

View File

@ -1,11 +1,4 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.ComponentModel;
namespace qtcnet_client.Controls
{

View File

@ -1,6 +1,4 @@
using qtcnet_client.Properties;
using QtCNETAPI.Models;
using QtCNETAPI.Schema;
using QtCNETAPI.Services.ApiService;
using System.Drawing.Drawing2D;

View File

@ -1,12 +1,4 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace qtcnet_client.Forms
namespace qtcnet_client.Forms
{
public partial class AddRoomForm : Form
{

View File

@ -1,14 +1,5 @@
using Krypton.Toolkit;
using QtCNETAPI.Models;
using QtCNETAPI.Services.ApiService;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace qtcnet_client.Forms
{

View File

@ -1,14 +1,10 @@
using qtcnet_client.Controls;
using qtcnet_client.Factories;
using QtCNETAPI.Dtos.User;
using QtCNETAPI.Events;
using QtCNETAPI.Models;
using QtCNETAPI.Services.ApiService;
using QtCNETAPI.Services.GatewayService;
using System.ComponentModel;
using System.Reflection.Metadata.Ecma335;
using System.Runtime.CompilerServices;
using System.Threading.Tasks;
namespace qtcnet_client.Forms
{
public partial class ChatRoomForm : Form
@ -178,7 +174,8 @@ namespace qtcnet_client.Forms
flpMessages.Controls.Add(messageCtrl);
flpMessages.ScrollControlIntoView(messageCtrl);
});
} else
}
else
{
flpMessages.Controls.Add(messageCtrl);
flpMessages.ScrollControlIntoView(messageCtrl);

View File

@ -2,14 +2,7 @@
using qtcnet_client.Factories;
using qtcnet_client.Properties;
using QtCNETAPI.Dtos.User;
using QtCNETAPI.Models;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace qtcnet_client.Forms
{

View File

@ -1,15 +1,5 @@
using qtcnet_client.Services;
using QtCNETAPI.Services.ApiService;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace qtcnet_client.Forms.Games
{

View File

@ -1,13 +1,4 @@
using QtCNETAPI.Services.ApiService;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace qtcnet_client.Forms.Games
{
@ -86,7 +77,8 @@ namespace qtcnet_client.Forms.Games
btnBuy.Enabled = true;
btnSell.Enabled = true;
btnRefresh.Enabled = true;
} else
}
else
{
MessageBox.Show("Sell Failed. Either You Don't Have Enough Stock Or A Server Side Error Occured.", "Oops.", MessageBoxButtons.OK, MessageBoxIcon.Error);
nudStockBuySellAmount.Enabled = true;

View File

@ -1,12 +1,9 @@
using Microsoft.AspNetCore.SignalR.Client;
using qtcnet_client.Forms;
using qtcnet_client.Model;
using qtcnet_client.Services;
using QtCNETAPI.Enums;
using QtCNETAPI.Models;
using QtCNETAPI.Schema;
using QtCNETAPI.Services.ApiService;
using System.Threading.Tasks;
using qtcnet_client.Model;
namespace qtcnet_client.Forms.Games
{

View File

@ -1,7 +1,5 @@
using qtcnet_client.Services;
using System;
using System.ComponentModel;
using System.Windows.Forms;
namespace qtcnet_client.Forms
{

View File

@ -12,7 +12,6 @@ using QtCNETAPI.Services;
using QtCNETAPI.Services.ApiService;
using QtCNETAPI.Services.GatewayService;
using System.Drawing.Drawing2D;
using System.Threading.Tasks;
namespace qtcnet_client
{

View File

@ -3,14 +3,7 @@ using qtcnet_client.Factories;
using qtcnet_client.Properties;
using QtCNETAPI.Models;
using QtCNETAPI.Services.ApiService;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace qtcnet_client.Forms
{

View File

@ -1,13 +1,6 @@
using qtcnet_client.Properties;
using QtCNETAPI.Services.ApiService;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace qtcnet_client.Forms
{

View File

@ -1,7 +1,4 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Text.Json.Serialization;
using System.Text.Json.Serialization;
namespace qtcnet_client.Model
{

View File

@ -1,7 +1,4 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Text.Json.Serialization;
using System.Text.Json.Serialization;
namespace qtcnet_client.Model
{

View File

@ -1,10 +1,7 @@
using qtcnet_client.Properties;
using qtcnet_client.Model;
using System;
using System.Collections.Generic;
using qtcnet_client.Model;
using qtcnet_client.Properties;
using System.Diagnostics;
using System.Net.Http.Json;
using System.Text;
using System.Text.Json;
namespace qtcnet_client.Services