Skip to content

Commit

Permalink
refactor: Fix up namespaces
Browse files Browse the repository at this point in the history
  • Loading branch information
benaclejames committed Apr 3, 2024
1 parent 99ef640 commit d15f989
Show file tree
Hide file tree
Showing 33 changed files with 126 additions and 129 deletions.
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
using System;
using System.Collections.Generic;
using System.Collections.Generic;
using System.Threading.Tasks;
using Furality.SDK.Editor.DependencyResolving.Providers;
using Furality.SDK.Editor.DependencyResolving.Providers.External;
using Furality.SDK.Editor.DependencyResolving.Providers.Internal;
using Furality.SDK.Editor.External.AssetHandling;
using Furality.SDK.Editor.External.VCC;
using Furality.SDK.Editor.Helpers;
using UnityEngine;

namespace Furality.SDK.DependencyResolving
namespace Furality.SDK.Editor.DependencyResolving
{
public class DependencyResolver
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
using System;
using System.Threading.Tasks;
using System.Threading.Tasks;
using Furality.SDK.Editor.External.AssetHandling;
using Furality.SDK.Editor.External.VCC;
using UnityEngine;

namespace Furality.SDK.DependencyResolving
namespace Furality.SDK.Editor.DependencyResolving.Providers.External
{
public class ProjectPackage : IDependencyProvider
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using System;
using System.Threading.Tasks;
using System.Threading.Tasks;
using Furality.SDK.Editor.External.AssetHandling;

namespace Furality.SDK.DependencyResolving
namespace Furality.SDK.Editor.DependencyResolving.Providers
{
public interface IDependencyProvider
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
using System;
using System.Linq;
using System.Threading.Tasks;
using Furality.SDK.Editor;
using Furality.SDK.Editor.External.AssetHandling;
using Furality.SDK.Editor.Helpers;
using Furality.SDK.External.Assets;
using UnityEditor;
using UnityEngine;

namespace Furality.SDK.DependencyResolving
namespace Furality.SDK.Editor.DependencyResolving.Providers.Internal
{
/**
* Local dependency resolver is responsible for removing our requirement for the VCC.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
using UnityEditor;
using UnityEngine;

namespace Furality.SDK.External.Assets
namespace Furality.SDK.Editor.External.AssetHandling
{
public class AssetClass
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using System;
using Furality.SDK.External.Api;
using Furality.SDK.Editor.External.FoxApi;

namespace Furality.SDK.External.Assets
namespace Furality.SDK.Editor.External.AssetHandling
{
public class FuralityPackage : Package
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
using System.Collections.Generic;
using JetBrains.Annotations;

namespace Furality.SDK.External.Assets
namespace Furality.SDK.Editor.External.AssetHandling
{
public interface IPackageDataSource
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using System;
using System.Collections.Generic;

namespace Furality.SDK
namespace Furality.SDK.Editor.External.AssetHandling
{
public class Package
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
using System.Collections.Generic;
using System.Linq;
using Furality.SDK.Editor.External.FoxApi;
using Furality.SDK.Editor.Pages;
using Furality.SDK.External.Api;
using UnityEditor;
using UnityEngine;

namespace Furality.SDK.External.Assets
namespace Furality.SDK.Editor.External.AssetHandling
{
public class PrivilegeCategory
{
Expand Down
5 changes: 2 additions & 3 deletions Assets/Furality/FuralitySDK/Editor/External/Boop/BoopAuth.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
using System;
using Furality.SDK.Editor.External.Boop.Types;
using Furality.SDK.Editor.Helpers;
using Furality.SDK.External.Api;
using JetBrains.Annotations;
using UnityEngine;
using UnityEngine.Networking;

namespace Furality.SDK.External.Boop
namespace Furality.SDK.Editor.External.Boop
{
// AuthManager is our one port of call for authentication, be it initiating a login or logout, or monitoring our login state
public static class BoopAuth
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
using System.Net.Sockets;
using System.Threading;

namespace Furality.SDK.External.Boop
namespace Furality.SDK.Editor.External.Boop
{
// Probably violates some http spec requirements, but it doesn't need to that secure given that its only use is for
// handling the callback from the browser
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System;

namespace Furality.SDK.External.Boop
namespace Furality.SDK.Editor.External.Boop.Types
{
[Serializable]
public class TokenResponse
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using System;
using Furality.SDK.External.Api;

namespace Furality.SDK.External.Boop
namespace Furality.SDK.Editor.External.Boop.Types
{
[Serializable]
public class UserData
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace Furality.SDK.External.Api
namespace Furality.SDK.Editor.External.FoxApi
{
public enum AttendanceLevel
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,13 @@
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Furality.SDK.DependencyResolving;
using Furality.SDK.Editor.DependencyResolving.Providers;
using Furality.SDK.Editor.External.AssetHandling;
using Furality.SDK.Editor.External.FoxApi.Models.Files;
using Furality.SDK.Editor.Helpers;
using Furality.SDK.External.Api.Models.Files;
using Furality.SDK.External.Assets;
using JetBrains.Annotations;
using UnityEditor;
using UnityEngine;

namespace Furality.SDK.External.Api.Endpoints
namespace Furality.SDK.Editor.External.FoxApi.Endpoints
{
public class FoxFiles : FoxResource, IDependencyProvider, IPackageDataSource
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using Furality.SDK.External.Api.Models.User;
using Furality.SDK.Editor.External.FoxApi.Models.User;

namespace Furality.SDK.External.Api.Endpoints
namespace Furality.SDK.Editor.External.FoxApi.Endpoints
{
public class FoxUsers : FoxResource
{
Expand Down
7 changes: 4 additions & 3 deletions Assets/Furality/FuralitySDK/Editor/External/FoxApi/FoxApi.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
using System.Net.Http;
using System.Net.Http.Headers;
using System.Threading.Tasks;
using Furality.SDK.External.Api.Endpoints;
using Furality.SDK.External.Boop;
using Furality.SDK.Editor.External.Boop;
using Furality.SDK.Editor.External.Boop.Types;
using Furality.SDK.Editor.External.FoxApi.Endpoints;
using UnityEditor;
using UnityEngine;

namespace Furality.SDK.External.Api
namespace Furality.SDK.Editor.External.FoxApi
{
public class FoxApi
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System;

namespace Furality.SDK.External.Api
namespace Furality.SDK.Editor.External.FoxApi
{
public abstract class FoxResource : IDisposable
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace Furality.SDK.External.Api.Models.Files
namespace Furality.SDK.Editor.External.FoxApi.Models.Files
{
public class FileResponse
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
using System;
using System.Collections.Generic;
using Furality.SDK.External.Assets;
using Furality.SDK.Editor.External.AssetHandling;

namespace Furality.SDK.External.Api.Models.Files
namespace Furality.SDK.Editor.External.FoxApi.Models.Files
{
[Serializable]
public class FoxFileDto : FuralityPackage
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System;

namespace Furality.SDK.External.Api.Models.Files
namespace Furality.SDK.Editor.External.FoxApi.Models.Files
{
[Serializable]
public class FoxFilesDto
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System;

namespace Furality.SDK.External.Api.Models.User
namespace Furality.SDK.Editor.External.FoxApi.Models.User
{
[Serializable]
public class FoxPatreonDto
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System;

namespace Furality.SDK.External.Api.Models.User
namespace Furality.SDK.Editor.External.FoxApi.Models.User
{
[Serializable]
public class FoxProfileDto
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System;

namespace Furality.SDK.External.Api.Models.User
namespace Furality.SDK.Editor.External.FoxApi.Models.User
{
[Serializable]
public class FoxUserDto
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace Furality.SDK.External.Api
namespace Furality.SDK.Editor.External.FoxApi
{
public enum PatreonLevel
{
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
namespace Furality.SDK.Editor.External.VCC.Models
{
public class VccResponse<T>
{
public bool success;
public T data;
}
}
48 changes: 21 additions & 27 deletions Assets/Furality/FuralitySDK/Editor/External/VCC/VccComms.cs
Original file line number Diff line number Diff line change
@@ -1,49 +1,43 @@
using System;
using System.Net.Http;
using System.Threading.Tasks;
using Furality.SDK.Editor.External.VCC.Models;
using UnityEngine;

namespace Furality.SDK.Editor.External.VCC
{
public static class VccComms
{
public class VccResponse<T>
{
public bool success;
public T data;
}

private const string VccUrl = "http://localhost:5477/api/";

public static async Task<VccResponse<T>> Request<T>(string endpoint, string method, dynamic body = null)
{
// Send an HTTP request to the VCC
using (HttpClient client = new HttpClient())
{
client.DefaultRequestHeaders.Add("Origin", "http://localhost:5477/");
client.DefaultRequestHeaders.Host = "localhost";
using HttpClient client = new HttpClient();

client.DefaultRequestHeaders.Add("Origin", "http://localhost:5477/");
client.DefaultRequestHeaders.Host = "localhost";

client.Timeout = TimeSpan.FromSeconds(1);
client.Timeout = TimeSpan.FromSeconds(1);

var request = new HttpRequestMessage(new HttpMethod(method), VccUrl+endpoint);
if (body != null)
request.Content = new StringContent(JsonUtility.ToJson(body), System.Text.Encoding.UTF8, "application/json");
var request = new HttpRequestMessage(new HttpMethod(method), VccUrl+endpoint);
if (body != null)
request.Content = new StringContent(JsonUtility.ToJson(body), System.Text.Encoding.UTF8, "application/json");

HttpResponseMessage response;
try
{
response = await client.SendAsync(request);
}
catch (Exception e)
{
return null;
}
HttpResponseMessage response;
try
{
response = await client.SendAsync(request);
}
catch (Exception e)
{
return null;
}

string responseBody = await response.Content.ReadAsStringAsync();
string responseBody = await response.Content.ReadAsStringAsync();

// Deserialize the response content into VccResponse<T> and return
return JsonUtility.FromJson<VccResponse<T>>(responseBody);
}
// Deserialize the response content into VccResponse<T> and return
return JsonUtility.FromJson<VccResponse<T>>(responseBody);
}
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
using System;
using System.Threading.Tasks;
using Furality.SDK.DependencyResolving;
using Furality.SDK.Editor.DependencyResolving;
using Furality.SDK.Editor.DependencyResolving.Providers;
using Furality.SDK.Editor.External.AssetHandling;
using Furality.SDK.Editor.External.VCC;
using UnityEditor;
using UnityEngine;
Expand Down
2 changes: 1 addition & 1 deletion Assets/Furality/FuralitySDK/Editor/Pages/DownloadsPage.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System.Collections.Generic;
using System.Linq;
using Furality.SDK.External.Assets;
using Furality.SDK.Editor.External.AssetHandling;
using UnityEditor;
using UnityEngine;

Expand Down
8 changes: 3 additions & 5 deletions Assets/Furality/FuralitySDK/Editor/Pages/MainWindow.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
using System;
using System.Collections.Generic;
using System.Collections.Generic;
using System.Linq;
using Furality.SDK.Editor.External.Boop;
using Furality.SDK.Editor.External.FoxApi;
using Furality.SDK.Editor.Helpers;
using Furality.SDK.External.Api;
using Furality.SDK.External.Boop;
using UnityEditor;
using UnityEditor.PackageManager;
using UnityEngine;
Expand All @@ -13,7 +12,6 @@ namespace Furality.SDK.Editor.Pages
[InitializeOnLoad]
public class MainWindow : EditorWindow
{
private readonly Queue<Action> _dispatchQueue = new Queue<Action>();
private Dictionary<string, MenuPage> _pages = new Dictionary<string, MenuPage>();

private MenuPage _currentPage;
Expand Down
Loading

0 comments on commit d15f989

Please sign in to comment.