diff --git a/src/libnpsharp/ClientEventArgs.cs b/src/libnpsharp/Events/ClientEventArgs.cs similarity index 84% rename from src/libnpsharp/ClientEventArgs.cs rename to src/libnpsharp/Events/ClientEventArgs.cs index 0ed969d..7abadbc 100644 --- a/src/libnpsharp/ClientEventArgs.cs +++ b/src/libnpsharp/Events/ClientEventArgs.cs @@ -1,6 +1,7 @@ using System; +using NPSharp.NP; -namespace NPSharp +namespace NPSharp.Events { public class ClientEventArgs : EventArgs { diff --git a/src/libnpsharp/ClientEventHandler.cs b/src/libnpsharp/Events/ClientEventHandler.cs similarity index 87% rename from src/libnpsharp/ClientEventHandler.cs rename to src/libnpsharp/Events/ClientEventHandler.cs index 21d81a5..f46d5f5 100644 --- a/src/libnpsharp/ClientEventHandler.cs +++ b/src/libnpsharp/Events/ClientEventHandler.cs @@ -1,4 +1,6 @@ -namespace NPSharp +using NPSharp.NP; + +namespace NPSharp.Events { /// /// A delegate for all general client-related events. diff --git a/src/libnpsharp/IAuthenticationHandler.cs b/src/libnpsharp/Handlers/IAuthenticationHandler.cs similarity index 71% rename from src/libnpsharp/IAuthenticationHandler.cs rename to src/libnpsharp/Handlers/IAuthenticationHandler.cs index 6f1136e..865e2f1 100644 --- a/src/libnpsharp/IAuthenticationHandler.cs +++ b/src/libnpsharp/Handlers/IAuthenticationHandler.cs @@ -1,4 +1,7 @@ -namespace NPSharp +using NPSharp.NP; +using NPSharp.RPC.Messages.Data; + +namespace NPSharp.Handlers { /// /// Represents a handler for all authentication-related requests. @@ -11,24 +14,24 @@ namespace NPSharp /// The NP server client to authenticate /// The username to use for authentication /// The password to use for authentication - /// An instance of - AuthenticationResult AuthenticateUser(NPServerClient client, string username, string password); + /// An instance of + NPAuthenticationResult AuthenticateUser(NPServerClient client, string username, string password); /// /// Authenticates a user based on a session token. /// /// The NP server client to authenticate /// The session token to use for authentication - /// An instance of - AuthenticationResult AuthenticateUser(NPServerClient client, string token); + /// An instance of + NPAuthenticationResult AuthenticateUser(NPServerClient client, string token); /// /// Authenticates a dedicated server based on its license key. /// /// The NP server client of the dedicated server to authenticate /// The license key to use for authentication - /// An instance of - AuthenticationResult AuthenticateServer(NPServerClient client, string licenseKey); + /// An instance of + NPAuthenticationResult AuthenticateServer(NPServerClient client, string licenseKey); /// /// Validates a ticket. diff --git a/src/libnpsharp/IFileServingHandler.cs b/src/libnpsharp/Handlers/IFileServingHandler.cs similarity index 96% rename from src/libnpsharp/IFileServingHandler.cs rename to src/libnpsharp/Handlers/IFileServingHandler.cs index 7fecba9..4de4e9c 100644 --- a/src/libnpsharp/IFileServingHandler.cs +++ b/src/libnpsharp/Handlers/IFileServingHandler.cs @@ -1,4 +1,6 @@ -namespace NPSharp +using NPSharp.NP; + +namespace NPSharp.Handlers { /// /// Represents a handler for all file-related requests. diff --git a/src/libnpsharp/IFriendsHandler.cs b/src/libnpsharp/Handlers/IFriendsHandler.cs similarity index 85% rename from src/libnpsharp/IFriendsHandler.cs rename to src/libnpsharp/Handlers/IFriendsHandler.cs index 957a44d..73694a5 100644 --- a/src/libnpsharp/IFriendsHandler.cs +++ b/src/libnpsharp/Handlers/IFriendsHandler.cs @@ -1,8 +1,8 @@ using System.Collections.Generic; -using NPSharp.RPC.Messages; -using NPSharp.RPC.Messages.Structs; +using NPSharp.NP; +using NPSharp.RPC.Messages.Data; -namespace NPSharp +namespace NPSharp.Handlers { /// /// Represents a handler for all friends-related requests. diff --git a/src/libnpsharp/IUserAvatarHandler.cs b/src/libnpsharp/Handlers/IUserAvatarHandler.cs similarity index 90% rename from src/libnpsharp/IUserAvatarHandler.cs rename to src/libnpsharp/Handlers/IUserAvatarHandler.cs index 24bfd69..cfd0f4a 100644 --- a/src/libnpsharp/IUserAvatarHandler.cs +++ b/src/libnpsharp/Handlers/IUserAvatarHandler.cs @@ -1,6 +1,6 @@ using NPSharp.Steam; -namespace NPSharp +namespace NPSharp.Handlers { /// /// Represents a handler for all user avatar-related requests. diff --git a/src/libnpsharp/AuthenticationResult.cs b/src/libnpsharp/NP/NPAuthenticationResult.cs similarity index 88% rename from src/libnpsharp/AuthenticationResult.cs rename to src/libnpsharp/NP/NPAuthenticationResult.cs index 2b9ba13..66657eb 100644 --- a/src/libnpsharp/AuthenticationResult.cs +++ b/src/libnpsharp/NP/NPAuthenticationResult.cs @@ -1,11 +1,11 @@ using NPSharp.Steam; -namespace NPSharp +namespace NPSharp.NP { /// /// Represents details about the outcome of an authentication attempt. /// - public class AuthenticationResult + public class NPAuthenticationResult { /// /// Constructs an authentication result instance. @@ -14,7 +14,7 @@ namespace NPSharp /// Set this to null if authentication should fail, otherwise use an instance of a steam ID which is /// unique to the user. /// - public AuthenticationResult(CSteamID npid = null) + public NPAuthenticationResult(CSteamID npid = null) { UserID = npid; } diff --git a/src/libnpsharp/NPClient.cs b/src/libnpsharp/NP/NPClient.cs similarity index 99% rename from src/libnpsharp/NPClient.cs rename to src/libnpsharp/NP/NPClient.cs index 2303fc0..af15bc2 100644 --- a/src/libnpsharp/NPClient.cs +++ b/src/libnpsharp/NP/NPClient.cs @@ -5,11 +5,10 @@ using System.Threading; using System.Threading.Tasks; using log4net; using NPSharp.RPC; -using NPSharp.RPC.Messages; using NPSharp.RPC.Messages.Client; using NPSharp.RPC.Messages.Server; -namespace NPSharp +namespace NPSharp.NP { /// /// Represents a high-level network platform client. diff --git a/src/libnpsharp/NPFileException.cs b/src/libnpsharp/NP/NPFileException.cs similarity index 94% rename from src/libnpsharp/NPFileException.cs rename to src/libnpsharp/NP/NPFileException.cs index cfbf03d..f19ce75 100644 --- a/src/libnpsharp/NPFileException.cs +++ b/src/libnpsharp/NP/NPFileException.cs @@ -1,6 +1,6 @@ using System; -namespace NPSharp +namespace NPSharp.NP { internal class NpFileException : Exception { diff --git a/src/libnpsharp/NPServer.cs b/src/libnpsharp/NP/NPServer.cs similarity index 98% rename from src/libnpsharp/NPServer.cs rename to src/libnpsharp/NP/NPServer.cs index 967b9e8..751e61e 100644 --- a/src/libnpsharp/NPServer.cs +++ b/src/libnpsharp/NP/NPServer.cs @@ -6,13 +6,15 @@ using System.Net.Sockets; using System.Threading; using System.Threading.Tasks; using log4net; +using NPSharp.Events; +using NPSharp.Handlers; using NPSharp.RPC; -using NPSharp.RPC.Messages; using NPSharp.RPC.Messages.Client; +using NPSharp.RPC.Messages.Data; using NPSharp.RPC.Messages.Server; using NPSharp.Steam; -namespace NPSharp +namespace NPSharp.NP { public class NPServer { @@ -127,7 +129,7 @@ namespace NPSharp client.RPC.AttachHandlerForMessageType(msg => { - var result = new AuthenticationResult(); + var result = new NPAuthenticationResult(); if (AuthenticationHandler != null) { try @@ -164,7 +166,7 @@ namespace NPSharp client.RPC.AttachHandlerForMessageType(msg => { - var result = new AuthenticationResult(); + var result = new NPAuthenticationResult(); if (AuthenticationHandler != null) { try @@ -174,7 +176,7 @@ namespace NPSharp catch (Exception error) { _log.Error("Error occurred in authentication handler", error); - result = new AuthenticationResult(); + result = new NPAuthenticationResult(); } } @@ -219,7 +221,7 @@ namespace NPSharp client.RPC.AttachHandlerForMessageType(msg => { - var result = new AuthenticationResult(); + var result = new NPAuthenticationResult(); if (AuthenticationHandler != null) { try diff --git a/src/libnpsharp/NPServerClient.cs b/src/libnpsharp/NP/NPServerClient.cs similarity index 95% rename from src/libnpsharp/NPServerClient.cs rename to src/libnpsharp/NP/NPServerClient.cs index c7f9b57..e569d8a 100644 --- a/src/libnpsharp/NPServerClient.cs +++ b/src/libnpsharp/NP/NPServerClient.cs @@ -1,11 +1,10 @@ using System.Collections.Generic; using System.Linq; using NPSharp.RPC; -using NPSharp.RPC.Messages; -using NPSharp.RPC.Messages.Structs; +using NPSharp.RPC.Messages.Data; using NPSharp.Steam; -namespace NPSharp +namespace NPSharp.NP { /// /// Represents a remote client connection to an NP server. diff --git a/src/libnpsharp/RPC/Messages/Client/FriendsSetPresenceMessage.cs b/src/libnpsharp/RPC/Messages/Client/FriendsSetPresenceMessage.cs index e62581a..4b82927 100644 --- a/src/libnpsharp/RPC/Messages/Client/FriendsSetPresenceMessage.cs +++ b/src/libnpsharp/RPC/Messages/Client/FriendsSetPresenceMessage.cs @@ -1,4 +1,4 @@ -using NPSharp.RPC.Messages.Structs; +using NPSharp.RPC.Messages.Data; using ProtoBuf; namespace NPSharp.RPC.Messages.Client diff --git a/src/libnpsharp/RPC/Messages/Structs/FriendDetails.cs b/src/libnpsharp/RPC/Messages/Data/FriendDetails.cs similarity index 87% rename from src/libnpsharp/RPC/Messages/Structs/FriendDetails.cs rename to src/libnpsharp/RPC/Messages/Data/FriendDetails.cs index c56df14..4067fb9 100644 --- a/src/libnpsharp/RPC/Messages/Structs/FriendDetails.cs +++ b/src/libnpsharp/RPC/Messages/Data/FriendDetails.cs @@ -1,7 +1,7 @@ using System; using ProtoBuf; -namespace NPSharp.RPC.Messages.Structs +namespace NPSharp.RPC.Messages.Data { [ProtoContract] public sealed class FriendDetails diff --git a/src/libnpsharp/RPC/Messages/Structs/FriendsPresence.cs b/src/libnpsharp/RPC/Messages/Data/FriendsPresence.cs similarity index 87% rename from src/libnpsharp/RPC/Messages/Structs/FriendsPresence.cs rename to src/libnpsharp/RPC/Messages/Data/FriendsPresence.cs index b57ca9d..cc23eec 100644 --- a/src/libnpsharp/RPC/Messages/Structs/FriendsPresence.cs +++ b/src/libnpsharp/RPC/Messages/Data/FriendsPresence.cs @@ -1,6 +1,6 @@ using ProtoBuf; -namespace NPSharp.RPC.Messages.Structs +namespace NPSharp.RPC.Messages.Data { [ProtoContract] public sealed class FriendsPresence diff --git a/src/libnpsharp/PresenceState.cs b/src/libnpsharp/RPC/Messages/Data/PresenceState.cs similarity index 84% rename from src/libnpsharp/PresenceState.cs rename to src/libnpsharp/RPC/Messages/Data/PresenceState.cs index 74f19a0..c16bf56 100644 --- a/src/libnpsharp/PresenceState.cs +++ b/src/libnpsharp/RPC/Messages/Data/PresenceState.cs @@ -1,4 +1,4 @@ -namespace NPSharp +namespace NPSharp.RPC.Messages.Data { /// /// Represents the friend's current presence activity. diff --git a/src/libnpsharp/RPC/Messages/Structs/ProfileData.cs b/src/libnpsharp/RPC/Messages/Data/ProfileData.cs similarity index 87% rename from src/libnpsharp/RPC/Messages/Structs/ProfileData.cs rename to src/libnpsharp/RPC/Messages/Data/ProfileData.cs index c532c68..bfb17dd 100644 --- a/src/libnpsharp/RPC/Messages/Structs/ProfileData.cs +++ b/src/libnpsharp/RPC/Messages/Data/ProfileData.cs @@ -1,7 +1,7 @@ using System; using ProtoBuf; -namespace NPSharp.RPC.Messages.Structs +namespace NPSharp.RPC.Messages.Data { [ProtoContract] public sealed class ProfileData diff --git a/src/libnpsharp/TicketValidationResult.cs b/src/libnpsharp/RPC/Messages/Data/TicketValidationResult.cs similarity index 84% rename from src/libnpsharp/TicketValidationResult.cs rename to src/libnpsharp/RPC/Messages/Data/TicketValidationResult.cs index 015fc04..87056fd 100644 --- a/src/libnpsharp/TicketValidationResult.cs +++ b/src/libnpsharp/RPC/Messages/Data/TicketValidationResult.cs @@ -1,4 +1,4 @@ -namespace NPSharp +namespace NPSharp.RPC.Messages.Data { /// /// Represents the outcome of a ticket validation attempt. diff --git a/src/libnpsharp/RPC/Messages/Server/FriendsGetProfileDataResultMessage.cs b/src/libnpsharp/RPC/Messages/Server/FriendsGetProfileDataResultMessage.cs index bf7abaf..b7d51ea 100644 --- a/src/libnpsharp/RPC/Messages/Server/FriendsGetProfileDataResultMessage.cs +++ b/src/libnpsharp/RPC/Messages/Server/FriendsGetProfileDataResultMessage.cs @@ -1,4 +1,4 @@ -using NPSharp.RPC.Messages.Structs; +using NPSharp.RPC.Messages.Data; using ProtoBuf; namespace NPSharp.RPC.Messages.Server diff --git a/src/libnpsharp/RPC/Messages/Server/FriendsPresenceMessage.cs b/src/libnpsharp/RPC/Messages/Server/FriendsPresenceMessage.cs index e861723..0a14f28 100644 --- a/src/libnpsharp/RPC/Messages/Server/FriendsPresenceMessage.cs +++ b/src/libnpsharp/RPC/Messages/Server/FriendsPresenceMessage.cs @@ -1,5 +1,5 @@ using System; -using NPSharp.RPC.Messages.Structs; +using NPSharp.RPC.Messages.Data; using ProtoBuf; namespace NPSharp.RPC.Messages.Server diff --git a/src/libnpsharp/RPC/Messages/Server/FriendsRosterMessage.cs b/src/libnpsharp/RPC/Messages/Server/FriendsRosterMessage.cs index 89df5a0..220ef1c 100644 --- a/src/libnpsharp/RPC/Messages/Server/FriendsRosterMessage.cs +++ b/src/libnpsharp/RPC/Messages/Server/FriendsRosterMessage.cs @@ -1,4 +1,4 @@ -using NPSharp.RPC.Messages.Structs; +using NPSharp.RPC.Messages.Data; using ProtoBuf; namespace NPSharp.RPC.Messages.Server diff --git a/src/libnpsharp/libnpsharp.csproj b/src/libnpsharp/libnpsharp.csproj index 9c5b638..e760539 100644 --- a/src/libnpsharp/libnpsharp.csproj +++ b/src/libnpsharp/libnpsharp.csproj @@ -63,20 +63,20 @@ - + - - - - - - - - - - - + + + + + + + + + + + @@ -84,17 +84,17 @@ - + - + - + @@ -122,8 +122,8 @@ - - + + diff --git a/src/npfile/NP2HTTPPublisherFileHandler.cs b/src/npfile/NP2HTTPPublisherFileHandler.cs index 03778d3..ecadea5 100644 --- a/src/npfile/NP2HTTPPublisherFileHandler.cs +++ b/src/npfile/NP2HTTPPublisherFileHandler.cs @@ -4,6 +4,7 @@ using System.Linq; using System.Threading.Tasks; using System.Web; using log4net; +using NPSharp.NP; using uhttpsharp; using uhttpsharp.Headers; using HttpResponse = uhttpsharp.HttpResponse; diff --git a/src/npfile/NP2HTTPUserFileHandler.cs b/src/npfile/NP2HTTPUserFileHandler.cs index 1c57e60..6f355d2 100644 --- a/src/npfile/NP2HTTPUserFileHandler.cs +++ b/src/npfile/NP2HTTPUserFileHandler.cs @@ -4,6 +4,7 @@ using System.Linq; using System.Threading.Tasks; using System.Web; using log4net; +using NPSharp.NP; using uhttpsharp; using uhttpsharp.Headers; using HttpResponse = uhttpsharp.HttpResponse; diff --git a/src/npfile/Program.cs b/src/npfile/Program.cs index f01d1b6..278167f 100644 --- a/src/npfile/Program.cs +++ b/src/npfile/Program.cs @@ -9,6 +9,7 @@ using log4net.Config; using log4net.Core; using log4net.Layout; using NPSharp.Authentication; +using NPSharp.NP; using uhttpsharp; using uhttpsharp.Handlers; using uhttpsharp.Headers; diff --git a/src/npmotd/Program.cs b/src/npmotd/Program.cs index f8f8588..93d1475 100644 --- a/src/npmotd/Program.cs +++ b/src/npmotd/Program.cs @@ -6,6 +6,7 @@ using log4net.Config; using log4net.Core; using log4net.Layout; using NPSharp.Authentication; +using NPSharp.NP; namespace NPSharp.CommandLine.MOTD { diff --git a/src/npserv/BrightstarDatabaseAuthenticationHandler.cs b/src/npserv/BrightstarDatabaseAuthenticationHandler.cs index 0f3d437..1957757 100644 --- a/src/npserv/BrightstarDatabaseAuthenticationHandler.cs +++ b/src/npserv/BrightstarDatabaseAuthenticationHandler.cs @@ -4,6 +4,9 @@ using System.Globalization; using System.Linq; using log4net; using NPSharp.CommandLine.Server.Database; +using NPSharp.Handlers; +using NPSharp.NP; +using NPSharp.RPC.Messages.Data; using NPSharp.Steam; namespace NPSharp.CommandLine.Server @@ -19,15 +22,15 @@ namespace NPSharp.CommandLine.Server _db = database; } - public AuthenticationResult AuthenticateUser(NPServerClient client, string username, string password) + public NPAuthenticationResult AuthenticateUser(NPServerClient client, string username, string password) { // Nah, authenticating this way is deprecated as fuck. - return new AuthenticationResult(); + return new NPAuthenticationResult(); } - public AuthenticationResult AuthenticateUser(NPServerClient client, string token) + public NPAuthenticationResult AuthenticateUser(NPServerClient client, string token) { - var ar = new AuthenticationResult(); + var ar = new NPAuthenticationResult(); // Check if token is valid _db.ValidateSession(token, session => @@ -38,7 +41,7 @@ namespace NPSharp.CommandLine.Server } ar = - new AuthenticationResult(new CSteamID + new NPAuthenticationResult(new CSteamID { AccountID = session.User.UserNumber, AccountInstance = 1, @@ -53,7 +56,7 @@ namespace NPSharp.CommandLine.Server return ar; } - public AuthenticationResult AuthenticateServer(NPServerClient client, string licenseKey) + public NPAuthenticationResult AuthenticateServer(NPServerClient client, string licenseKey) { // TODO: AuthenticateServer throw new NotImplementedException(); diff --git a/src/npserv/BrightstarDatabaseFileServingHandler.cs b/src/npserv/BrightstarDatabaseFileServingHandler.cs index d73c7c3..35792dc 100644 --- a/src/npserv/BrightstarDatabaseFileServingHandler.cs +++ b/src/npserv/BrightstarDatabaseFileServingHandler.cs @@ -2,6 +2,8 @@ using System.Linq; using System.Text; using NPSharp.CommandLine.Server.Database; +using NPSharp.Handlers; +using NPSharp.NP; namespace NPSharp.CommandLine.Server { diff --git a/src/npserv/Program.cs b/src/npserv/Program.cs index 92f4fc4..48cde44 100644 --- a/src/npserv/Program.cs +++ b/src/npserv/Program.cs @@ -9,6 +9,7 @@ using log4net.Core; using log4net.Layout; using NPSharp.Authentication; using NPSharp.CommandLine.Server.Database; +using NPSharp.NP; namespace NPSharp.CommandLine.Server {