Webserver: split CWebservice and ICWebservice into two files
This commit is contained in:
1 parent
944c1b0771
commit
dc54d05202
3 files changed
+141
-133
No files matched your search
@@ -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()
|
||||
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
@@ -51,6 +51,7 @@
|
||||
<Compile Include="CServer.cs" />
|
||||
<Compile Include="CWebservice.cs" />
|
||||
<Compile Include="DataStructs.cs" />
|
||||
<Compile Include="ICWebservice.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Session.cs" />
|
||||
<Compile Include="SessionControl.cs" />
|
||||
|
||||
Reference in new issue
Block a user