From dc54d0520271b272aaa9733568fecb3e669071ff Mon Sep 17 00:00:00 2001 From: lukeIam Date: Sat, 26 Oct 2013 11:33:11 +0200 Subject: [PATCH] Webserver: split CWebservice and ICWebservice into two files --- .../ClientServerLib/CWebservice.cs | 133 ----------------- .../ClientServerLib/ICWebservice.cs | 140 ++++++++++++++++++ .../ClientServerLib/ServerLib.csproj | 1 + 3 files changed, 141 insertions(+), 133 deletions(-) create mode 100644 ClientServerLib/ClientServerLib/ICWebservice.cs diff --git a/ClientServerLib/ClientServerLib/CWebservice.cs b/ClientServerLib/ClientServerLib/CWebservice.cs index 5e3db8cb..15b3dc8b 100644 --- a/ClientServerLib/ClientServerLib/CWebservice.cs +++ b/ClientServerLib/ClientServerLib/CWebservice.cs @@ -6,139 +6,6 @@ using System.ServiceModel.Channels; namespace ServerLib { - [ServiceContract] - public interface ICWebservice - { - [OperationContract] - [WebInvoke(Method = "GET", - ResponseFormat = WebMessageFormat.Json, - UriTemplate = "/sendKeyEvent?key={key}")] - void SendKeyEvent(string key); - - #region profile - - [OperationContract] - [WebInvoke(Method = "GET", - ResponseFormat = WebMessageFormat.Json, - UriTemplate = "/getOwnProfileId")] - int GetOwnProfileId(); - - [OperationContract] - [WebInvoke(Method = "POST", - ResponseFormat = WebMessageFormat.Json, - UriTemplate = "/sendProfile")] - void SendProfile(SProfileData profile); - - [OperationContract] - [WebInvoke(Method = "GET", - ResponseFormat = WebMessageFormat.Json, - UriTemplate = "/getProfile?profileId={profileId}")] - SProfileData GetProfile(int profileId); - - [OperationContract] - [WebInvoke(Method = "GET", - ResponseFormat = WebMessageFormat.Json, - UriTemplate = "/getProfileList")] - SProfileData[] GetProfileList(); - - #endregion - - #region photo - - [OperationContract] - [WebInvoke(Method = "POST", - RequestFormat = WebMessageFormat.Json, - ResponseFormat = WebMessageFormat.Json, - UriTemplate = "/sendPhoto")] - void SendPhoto(SPhotoData photo); - - #endregion - - #region website - - [OperationContract] - [WebInvoke(Method = "GET", - ResponseFormat = WebMessageFormat.Json, - UriTemplate = "/login?username={username}&password={password}")] - Guid Login(string username, string password); - - [OperationContract] - [WebInvoke(Method = "GET", - ResponseFormat = WebMessageFormat.Json, - UriTemplate = "")] - Stream Index(); - - [OperationContract] - [WebInvoke(Method = "GET", - ResponseFormat = WebMessageFormat.Json, - UriTemplate = "/js/{filename}")] - Stream GetJsFile(String filename); - - [OperationContract] - [WebInvoke(Method = "GET", - ResponseFormat = WebMessageFormat.Json, - UriTemplate = "/css/{filename}")] - Stream GetCssFile(String filename); - - [OperationContract] - [WebInvoke(Method = "GET", - ResponseFormat = WebMessageFormat.Json, - UriTemplate = "/css/images/{filename}")] - Stream GetCssImageFile(String filename); - - [OperationContract] - [WebInvoke(Method = "GET", - ResponseFormat = WebMessageFormat.Json, - UriTemplate = "/img/{filename}")] - Stream GetImgFile(String filename); - - [OperationContract] - [WebInvoke(Method = "GET", - ResponseFormat = WebMessageFormat.Json, - UriTemplate = "/delayedImage?id={id}")] - CBase64Image GetDelayedImage(String id); - - #endregion - - #region songs - - [OperationContract] - [WebInvoke(Method = "GET", - ResponseFormat = WebMessageFormat.Json, - UriTemplate = "/getSong?songId={songId}")] - SOngInfo GetSong(int songId); - - [OperationContract] - [WebInvoke(Method = "GET", - ResponseFormat = WebMessageFormat.Json, - UriTemplate = "/getCurrentSongId")] - int GetCurrentSongId(); - - [OperationContract] - [WebInvoke(Method = "GET", - ResponseFormat = WebMessageFormat.Json, - UriTemplate = "/getAllSongs")] - SOngInfo[] GetAllSongs(); - - #endregion - - #region user management - - [OperationContract] - [WebInvoke(Method = "GET", - ResponseFormat = WebMessageFormat.Json, - UriTemplate = "/getUserRole?profileId={profileId}")] - int GetUserRole(int profileId); - - [OperationContract] - [WebInvoke(Method = "GET", - ResponseFormat = WebMessageFormat.Json, - UriTemplate = "/setUserRole?profileId={profileId}&userRole={userRole}")] - void SetUserRole(int profileId, int userRole); - - #endregion - } - class CWebservice : ICWebservice { private static Guid _GetSession() diff --git a/ClientServerLib/ClientServerLib/ICWebservice.cs b/ClientServerLib/ClientServerLib/ICWebservice.cs new file mode 100644 index 00000000..f1e8b398 --- /dev/null +++ b/ClientServerLib/ClientServerLib/ICWebservice.cs @@ -0,0 +1,140 @@ +using System; +using System.IO; +using System.ServiceModel; +using System.ServiceModel.Web; + +namespace ServerLib +{ + [ServiceContract] + public interface ICWebservice + { + [OperationContract] + [WebInvoke(Method = "GET", + ResponseFormat = WebMessageFormat.Json, + UriTemplate = "/sendKeyEvent?key={key}")] + void SendKeyEvent(string key); + + #region profile + + [OperationContract] + [WebInvoke(Method = "GET", + ResponseFormat = WebMessageFormat.Json, + UriTemplate = "/getOwnProfileId")] + int GetOwnProfileId(); + + [OperationContract] + [WebInvoke(Method = "POST", + ResponseFormat = WebMessageFormat.Json, + UriTemplate = "/sendProfile")] + void SendProfile(SProfileData profile); + + [OperationContract] + [WebInvoke(Method = "GET", + ResponseFormat = WebMessageFormat.Json, + UriTemplate = "/getProfile?profileId={profileId}")] + SProfileData GetProfile(int profileId); + + [OperationContract] + [WebInvoke(Method = "GET", + ResponseFormat = WebMessageFormat.Json, + UriTemplate = "/getProfileList")] + SProfileData[] GetProfileList(); + + #endregion + + #region photo + + [OperationContract] + [WebInvoke(Method = "POST", + RequestFormat = WebMessageFormat.Json, + ResponseFormat = WebMessageFormat.Json, + UriTemplate = "/sendPhoto")] + void SendPhoto(SPhotoData photo); + + #endregion + + #region website + + [OperationContract] + [WebInvoke(Method = "GET", + ResponseFormat = WebMessageFormat.Json, + UriTemplate = "/login?username={username}&password={password}")] + Guid Login(string username, string password); + + [OperationContract] + [WebInvoke(Method = "GET", + ResponseFormat = WebMessageFormat.Json, + UriTemplate = "")] + Stream Index(); + + [OperationContract] + [WebInvoke(Method = "GET", + ResponseFormat = WebMessageFormat.Json, + UriTemplate = "/js/{filename}")] + Stream GetJsFile(String filename); + + [OperationContract] + [WebInvoke(Method = "GET", + ResponseFormat = WebMessageFormat.Json, + UriTemplate = "/css/{filename}")] + Stream GetCssFile(String filename); + + [OperationContract] + [WebInvoke(Method = "GET", + ResponseFormat = WebMessageFormat.Json, + UriTemplate = "/css/images/{filename}")] + Stream GetCssImageFile(String filename); + + [OperationContract] + [WebInvoke(Method = "GET", + ResponseFormat = WebMessageFormat.Json, + UriTemplate = "/img/{filename}")] + Stream GetImgFile(String filename); + + [OperationContract] + [WebInvoke(Method = "GET", + ResponseFormat = WebMessageFormat.Json, + UriTemplate = "/delayedImage?id={id}")] + CBase64Image GetDelayedImage(String id); + + #endregion + + #region songs + + [OperationContract] + [WebInvoke(Method = "GET", + ResponseFormat = WebMessageFormat.Json, + UriTemplate = "/getSong?songId={songId}")] + SOngInfo GetSong(int songId); + + [OperationContract] + [WebInvoke(Method = "GET", + ResponseFormat = WebMessageFormat.Json, + UriTemplate = "/getCurrentSongId")] + int GetCurrentSongId(); + + [OperationContract] + [WebInvoke(Method = "GET", + ResponseFormat = WebMessageFormat.Json, + UriTemplate = "/getAllSongs")] + SOngInfo[] GetAllSongs(); + + #endregion + + #region user management + + [OperationContract] + [WebInvoke(Method = "GET", + ResponseFormat = WebMessageFormat.Json, + UriTemplate = "/getUserRole?profileId={profileId}")] + int GetUserRole(int profileId); + + [OperationContract] + [WebInvoke(Method = "GET", + ResponseFormat = WebMessageFormat.Json, + UriTemplate = "/setUserRole?profileId={profileId}&userRole={userRole}")] + void SetUserRole(int profileId, int userRole); + + #endregion + } +} \ No newline at end of file diff --git a/ClientServerLib/ClientServerLib/ServerLib.csproj b/ClientServerLib/ClientServerLib/ServerLib.csproj index 417c9063..3a00f689 100644 --- a/ClientServerLib/ClientServerLib/ServerLib.csproj +++ b/ClientServerLib/ClientServerLib/ServerLib.csproj @@ -51,6 +51,7 @@ +