This commit is contained in:
lukeIam committed 2013-12-13 17:35:03 +01:00
1 parent 00e3729485
commit d0ebe70ae4
6 files changed
+47 -24

No files matched your search

+6 -2
View File
@@ -74,6 +74,10 @@ namespace ClientServerLib
WebHttpBinding wb = new WebHttpBinding();
wb.MaxReceivedMessageSize = 10485760;
wb.MaxBufferSize = 10485760;
wb.MaxBufferPoolSize = 10485760;
wb.ReaderQuotas.MaxStringContentLength = 10485760;
wb.ReaderQuotas.MaxArrayLength = 10485760;
wb.ReaderQuotas.MaxBytesPerRead = 10485760;
host.AddServiceEndpoint(typeof(ICWebservice), wb, "");
}
@@ -83,8 +87,8 @@ namespace ClientServerLib
{
// Step 4 Enable metadata exchange.
ServiceMetadataBehavior smb = new ServiceMetadataBehavior();
smb.MetadataExporter.PolicyVersion = PolicyVersion.Policy15;
smb.HttpGetEnabled = true;
//smb.MetadataExporter.PolicyVersion = PolicyVersion.Policy15;
//smb.HttpGetEnabled = true;
host.Description.Behaviors.Add(smb);
// Step 5 Start the service.
@@ -44,6 +44,7 @@ namespace ClientServerLib
[OperationContract]
[WebInvoke(Method = "POST",
RequestFormat = WebMessageFormat.Json,
ResponseFormat = WebMessageFormat.Json,
UriTemplate = "/sendPhoto")]
bool sendPhoto(PhotoData photo);
@@ -124,7 +125,7 @@ namespace ClientServerLib
{
if (CServer.GetProfileList == null)
{
return new ProfileData[]{};
return new ProfileData[] { };
}
return CServer.GetProfileList();
}
@@ -134,7 +135,7 @@ namespace ClientServerLib
#region photo
public bool sendPhoto(PhotoData photo)
{
{
return CServer.SendPhoto(photo);
}
@@ -234,6 +235,6 @@ namespace ClientServerLib
}
}
#endregion
#endregion
}
}
@@ -74,7 +74,8 @@ namespace ClientServerLib
public Image getImage()
{
byte[] imageData = Convert.FromBase64String(base64Data);
string onlyBase64Data = base64Data.Substring(base64Data.IndexOf(";base64,") + (";base64,").Length);
byte[] imageData = Convert.FromBase64String(onlyBase64Data);
MemoryStream ms = new MemoryStream(imageData, 0, imageData.Length);
ms.Write(imageData, 0, imageData.Length);
Image image = Image.FromStream(ms, true);
@@ -84,7 +85,7 @@ namespace ClientServerLib
public string getImageType()
{
Match match = Regex.Match(base64Data, "(?<=data:image/)[a-zA-Z]+(?=;base64)");
return match.Success ? match.Groups[1].Value : "";
return match.Success ? match.Groups[0].Value : "";
}