diff --git a/Yavsc.Client/Helpers/SimpleJsonPostMethod.cs b/Yavsc.Client/Helpers/SimpleJsonPostMethod.cs deleted file mode 100644 index 0917d6f4..00000000 --- a/Yavsc.Client/Helpers/SimpleJsonPostMethod.cs +++ /dev/null @@ -1,128 +0,0 @@ -// -// PostJson.cs -// -// Author: -// Paul Schneider -// -// Copyright (c) 2015 Paul Schneider -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Lesser General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public License -// along with this program. If not, see . -using System.Net; -using System.IO; -using System.Threading.Tasks; -using Newtonsoft.Json; -using System; -using System.Diagnostics; - -namespace Yavsc.Helpers -{ - /// - /// Simple json post method. - /// - public class NotSoSimpleJsonPostMethod : IDisposable - { - private HttpWebRequest request = null; - - /// - /// Initializes a new instance of the Yavsc.Helpers.SimpleJsonPostMethod class. - /// - /// Path to method. - public NotSoSimpleJsonPostMethod(string pathToMethod, string authorizationHeader = null) - { - request = (HttpWebRequest)WebRequest.Create(pathToMethod); - request.Method = "POST"; - request.Accept = "application/json"; - request.ContentType = "application/json"; - // request.SendChunked = true; - // request.TransferEncoding = "UTF-8"; - request.Headers = new WebHeaderCollection(); - if (authorizationHeader != null) - request.Headers["Authorization"] = "Bearer " + authorizationHeader; - - } - - public void Dispose() - { - request.Abort(); - } - - /// - /// Invoke the specified query. - /// - /// Query. - public async Task Invoke(object query) - { - - using (Stream streamQuery = await request.GetRequestStreamAsync()) - { - using (StreamWriter writer = new StreamWriter(streamQuery)) - { - writer.Write(JsonConvert.SerializeObject(query)); - } - } - TAnswer ans = default(TAnswer); - using (WebResponse response = await request.GetResponseAsync()) - { - using (Stream responseStream = response.GetResponseStream()) - { - using (StreamReader rdr = new StreamReader(responseStream)) - { - ans = (TAnswer)JsonConvert.DeserializeObject(rdr.ReadToEnd()); - } - } - } - return ans; - } - - public async Task InvokeAnonymous(object query) - { - object result = null; - using (Stream streamQuery = await request.GetRequestStreamAsync()) - { - using (StreamWriter writer = new StreamWriter(streamQuery)) - { - var json = JsonConvert.SerializeObject(query); - - writer.Write(json); - - } - } - try - { - using (WebResponse response = await request.GetResponseAsync()) - { - using (Stream stream = response.GetResponseStream()) - { - if (stream.Length > 0) - { - using (var sr = new StreamReader(stream)) - { - var json = await sr.ReadToEndAsync(); - result = JsonConvert.DeserializeObject(json); - - } - } - - } - } - } - catch (Exception ex) - { - Debug.WriteLine(ex.Message.ToString()); - } - return result; - } - } -} - diff --git a/Yavsc.Client/IGoogleCloudMobileDeclaration.cs b/Yavsc.Client/IGoogleCloudMobileDeclaration.cs index 9ea3033c..90f82c6b 100644 --- a/Yavsc.Client/IGoogleCloudMobileDeclaration.cs +++ b/Yavsc.Client/IGoogleCloudMobileDeclaration.cs @@ -1,4 +1,22 @@ -namespace Yavsc.Models.Identity +// Copyright (C) 2016 Paul Schneider +// +// This file is part of yavsc. +// +// yavsc is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 2 of the License, or +// (at your option) any later version. +// +// yavsc is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with yavsc. If not, see . +// + +namespace Yavsc.Models.Identity { public interface IGCMDeclaration { diff --git a/Yavsc.Client/Yavsc.Client.csproj b/Yavsc.Client/Yavsc.Client.csproj index b21ce6f0..89b9462b 100644 --- a/Yavsc.Client/Yavsc.Client.csproj +++ b/Yavsc.Client/Yavsc.Client.csproj @@ -35,7 +35,6 @@ 4 - @@ -53,22 +52,13 @@ - - ..\packages\Json.NET.Web.1.0.49\lib\portable45-net45+win8+wpa81\Json.NET.Web.dll - True - - - ..\packages\Newtonsoft.Json.8.0.3\lib\portable-net40+sl5+wp80+win8+wpa81\Newtonsoft.Json.dll - True - + - Ce projet fait référence à des packages NuGet qui sont manquants sur cet ordinateur. Utilisez l'option de restauration des packages NuGet pour les télécharger. Pour plus d'informations, consultez http://go.microsoft.com/fwlink/?LinkID=322105. Le fichier manquant est : {0}. -