Bugfixes
This commit is contained in:
1 parent
00e3729485
commit
d0ebe70ae4
6 files changed
+36
-13
No files matched your search
@@ -74,6 +74,10 @@ namespace ClientServerLib
|
|||||||
WebHttpBinding wb = new WebHttpBinding();
|
WebHttpBinding wb = new WebHttpBinding();
|
||||||
wb.MaxReceivedMessageSize = 10485760;
|
wb.MaxReceivedMessageSize = 10485760;
|
||||||
wb.MaxBufferSize = 10485760;
|
wb.MaxBufferSize = 10485760;
|
||||||
|
wb.MaxBufferPoolSize = 10485760;
|
||||||
|
wb.ReaderQuotas.MaxStringContentLength = 10485760;
|
||||||
|
wb.ReaderQuotas.MaxArrayLength = 10485760;
|
||||||
|
wb.ReaderQuotas.MaxBytesPerRead = 10485760;
|
||||||
host.AddServiceEndpoint(typeof(ICWebservice), wb, "");
|
host.AddServiceEndpoint(typeof(ICWebservice), wb, "");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -83,8 +87,8 @@ namespace ClientServerLib
|
|||||||
{
|
{
|
||||||
// Step 4 Enable metadata exchange.
|
// Step 4 Enable metadata exchange.
|
||||||
ServiceMetadataBehavior smb = new ServiceMetadataBehavior();
|
ServiceMetadataBehavior smb = new ServiceMetadataBehavior();
|
||||||
smb.MetadataExporter.PolicyVersion = PolicyVersion.Policy15;
|
//smb.MetadataExporter.PolicyVersion = PolicyVersion.Policy15;
|
||||||
smb.HttpGetEnabled = true;
|
//smb.HttpGetEnabled = true;
|
||||||
host.Description.Behaviors.Add(smb);
|
host.Description.Behaviors.Add(smb);
|
||||||
|
|
||||||
// Step 5 Start the service.
|
// Step 5 Start the service.
|
||||||
|
|||||||
@@ -44,6 +44,7 @@ namespace ClientServerLib
|
|||||||
|
|
||||||
[OperationContract]
|
[OperationContract]
|
||||||
[WebInvoke(Method = "POST",
|
[WebInvoke(Method = "POST",
|
||||||
|
RequestFormat = WebMessageFormat.Json,
|
||||||
ResponseFormat = WebMessageFormat.Json,
|
ResponseFormat = WebMessageFormat.Json,
|
||||||
UriTemplate = "/sendPhoto")]
|
UriTemplate = "/sendPhoto")]
|
||||||
bool sendPhoto(PhotoData photo);
|
bool sendPhoto(PhotoData photo);
|
||||||
|
|||||||
@@ -74,7 +74,8 @@ namespace ClientServerLib
|
|||||||
|
|
||||||
public Image getImage()
|
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);
|
MemoryStream ms = new MemoryStream(imageData, 0, imageData.Length);
|
||||||
ms.Write(imageData, 0, imageData.Length);
|
ms.Write(imageData, 0, imageData.Length);
|
||||||
Image image = Image.FromStream(ms, true);
|
Image image = Image.FromStream(ms, true);
|
||||||
@@ -84,7 +85,7 @@ namespace ClientServerLib
|
|||||||
public string getImageType()
|
public string getImageType()
|
||||||
{
|
{
|
||||||
Match match = Regex.Match(base64Data, "(?<=data:image/)[a-zA-Z]+(?=;base64)");
|
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 : "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -250,7 +250,7 @@ namespace Vocaluxe.Base.Server
|
|||||||
if (File.Exists(avatar.FileName))
|
if (File.Exists(avatar.FileName))
|
||||||
{
|
{
|
||||||
Image avatarImage = Image.FromFile(avatar.FileName);
|
Image avatarImage = Image.FromFile(avatar.FileName);
|
||||||
//TODO: Convert??? and Compress?
|
//TODO: Convert??? and Resize?
|
||||||
profileData.Avatar = new Base64Image(avatarImage, avatarImage.RawFormat);
|
profileData.Avatar = new Base64Image(avatarImage, avatarImage.RawFormat);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -292,7 +292,7 @@ namespace Vocaluxe.Base.Server
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
string name = DateTime.Now.ToString("yyyy-MM-DD-hh-mm-ss");
|
string name = DateTime.Now.ToString("yyyy-MM-dd_HH-mm-ss");
|
||||||
string filePath = _SaveImage(photoData.Photo, name, CSettings.FolderPhotos);
|
string filePath = _SaveImage(photoData.Photo, name, CSettings.FolderPhotos);
|
||||||
|
|
||||||
return (filePath != null && filePath != "");
|
return (filePath != null && filePath != "");
|
||||||
@@ -330,12 +330,20 @@ namespace Vocaluxe.Base.Server
|
|||||||
string extension = imageDate.getImageType();
|
string extension = imageDate.getImageType();
|
||||||
|
|
||||||
string filename = Path.Combine(folder, name);
|
string filename = Path.Combine(folder, name);
|
||||||
|
if (File.Exists(filename + "." + extension))
|
||||||
|
{
|
||||||
int i = 0;
|
int i = 0;
|
||||||
while (File.Exists(filename + "_" + i + "." + extension))
|
while (File.Exists(filename + "_" + i + "." + extension))
|
||||||
{
|
{
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
filename = filename + "_" + i + "." + extension;
|
filename = filename + "_" + i + "." + extension;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
filename = filename + "." + extension;
|
||||||
|
}
|
||||||
|
|
||||||
avatarImage.Save(filename);
|
avatarImage.Save(filename);
|
||||||
return filename;
|
return filename;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#playerAvatar {
|
#playerAvatar {
|
||||||
height: 75%;
|
height: 75%;
|
||||||
max-width: 250px;
|
max-height: 250px;
|
||||||
height: auto;
|
width: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
#playerName {
|
#playerName {
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
var ownProfileId = 1;
|
||||||
var profileIdRequest = 1;
|
var profileIdRequest = 1;
|
||||||
|
|
||||||
$(document).ready(function () {
|
$(document).ready(function () {
|
||||||
@@ -30,7 +31,7 @@ function initPageLoadHandler() {
|
|||||||
var promise = $.ajax({
|
var promise = $.ajax({
|
||||||
url: "getProfile?profileId=" + profileIdRequest
|
url: "getProfile?profileId=" + profileIdRequest
|
||||||
}).done(function (result) {
|
}).done(function (result) {
|
||||||
$('#playerName').text(result.PlayerName)
|
$('#playerName').attr("value", result.PlayerName);
|
||||||
if (result.Avatar && result.Avatar.base64Data) {
|
if (result.Avatar && result.Avatar.base64Data) {
|
||||||
$('#playerAvatar').attr("src", result.Avatar.base64Data);
|
$('#playerAvatar').attr("src", result.Avatar.base64Data);
|
||||||
}
|
}
|
||||||
@@ -79,12 +80,12 @@ function initPageLoadHandler() {
|
|||||||
$('#selectProfileList').children().remove();
|
$('#selectProfileList').children().remove();
|
||||||
|
|
||||||
function handleProfileSelectLineClick(e) {
|
function handleProfileSelectLineClick(e) {
|
||||||
profileIdRequest = parseInt(e.target.id.replace("ProfileSelectLine_", ""));
|
profileIdRequest = parseInt(e.currentTarget.id.replace("ProfileSelectLine_", ""));
|
||||||
$.mobile.changePage("#displayProfile", { transition: "slidefade" });
|
$.mobile.changePage("#displayProfile", { transition: "slidefade" });
|
||||||
}
|
}
|
||||||
|
|
||||||
for (var profile in data) {
|
for (var profile in data) {
|
||||||
$('<li id="ProfileSelectLine_' + data[profile].ProfileId + '"> <a href="#"> <img src="' + ((data[profile].Avatar & data[profile].Avatar.base64Data) ? data[profile].Avatar.base64Data : "img/profile.png") + '"> <h2>' + data[profile].PlayerName + '</h2> <p>Click here to show the profile of ' + data[profile].PlayerName + '</p> </a> </li>')
|
$('<li id="ProfileSelectLine_' + data[profile].ProfileId + '"> <a href="#"> <img src="' + ((data[profile].Avatar && data[profile].Avatar.base64Data) ? data[profile].Avatar.base64Data : "img/profile.png") + '"> <h2>' + data[profile].PlayerName + '</h2> <p>Click here to show the profile of ' + data[profile].PlayerName + '</p> </a> </li>')
|
||||||
.appendTo('#selectProfileList')
|
.appendTo('#selectProfileList')
|
||||||
.click(handleProfileSelectLineClick);
|
.click(handleProfileSelectLineClick);
|
||||||
}
|
}
|
||||||
@@ -176,8 +177,16 @@ function initMainPageHandler() {
|
|||||||
var reader = new FileReader();
|
var reader = new FileReader();
|
||||||
|
|
||||||
reader.onloadend = function (e) {
|
reader.onloadend = function (e) {
|
||||||
$.post("sendPhoto", { Photo: { base64Data: e.target.result } })
|
$.ajax({
|
||||||
.always(function () {
|
url: "sendPhoto",
|
||||||
|
dataType: "json",
|
||||||
|
contentType: "application/json;charset=utf-8",
|
||||||
|
type: "POST",
|
||||||
|
data: JSON.stringify({ Photo: { base64Data: e.target.result } }),
|
||||||
|
success: function (msg) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}).always(function () {
|
||||||
$.mobile.loading('hide');
|
$.mobile.loading('hide');
|
||||||
$('#content').unwrap();
|
$('#content').unwrap();
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in new issue
Block a user