diff --git a/Kavenegar.v11.suo b/Kavenegar.v11.suo deleted file mode 100644 index 1f92cc7..0000000 Binary files a/Kavenegar.v11.suo and /dev/null differ diff --git a/Kavenegar/Json/JsonArray.cs b/Kavenegar/Json/JsonArray.cs deleted file mode 100644 index b947473..0000000 --- a/Kavenegar/Json/JsonArray.cs +++ /dev/null @@ -1,57 +0,0 @@ -using System; -using System.Collections.Generic; - -namespace Kavenegar.Json -{ - - public class JsonArray : JsonObject - { - public List Array { get; set; } - private List.Enumerator _e; - - public JsonArray() - { - Array = new List(); - } - - public void AddElementToArray(JsonObject arrayElement) - { - Array.Add(arrayElement); - } - - public JsonObject UpCast() - { - JsonObject objectJ = this; - return objectJ; - } - - public void AddList(List lista) - { - Array = lista; - } - - public Boolean NextObject(out JsonObject o) - { - - JsonObject outObject; - _e = Array.GetEnumerator(); - - if (_e.MoveNext()) - { - outObject = _e.Current; - o = outObject; - return true; - } - outObject = new JsonObject(); - o = outObject; - return false; - } - - public int Count - { - get { return Array.Count; } - } - - } - -} diff --git a/Kavenegar/Json/JsonBoolean.cs b/Kavenegar/Json/JsonBoolean.cs deleted file mode 100644 index 00a2e5e..0000000 --- a/Kavenegar/Json/JsonBoolean.cs +++ /dev/null @@ -1,21 +0,0 @@ -using System; - -namespace Kavenegar.Json -{ - - public class JsonBoolean : JsonObject - { - public Boolean BooleanValue { get; set; } - - public JsonBoolean(Boolean booleanValue) - { - BooleanValue = booleanValue; - } - - public JsonObject UpCast() - { - JsonObject objectJ = this; - return objectJ; - } - } -} diff --git a/Kavenegar/Json/JsonNullable.cs b/Kavenegar/Json/JsonNullable.cs deleted file mode 100644 index fe65031..0000000 --- a/Kavenegar/Json/JsonNullable.cs +++ /dev/null @@ -1,20 +0,0 @@ -using System; - -namespace Kavenegar.Json -{ - public class JsonNullable : JsonObject - { - public String Nullable { get; set; } - - public JsonNullable() - { - Nullable = "Null"; - } - - public JsonObject UpCast() - { - JsonObject objectJ = this; - return objectJ; - } - } -} diff --git a/Kavenegar/Json/JsonNumber.cs b/Kavenegar/Json/JsonNumber.cs deleted file mode 100644 index e9226b5..0000000 --- a/Kavenegar/Json/JsonNumber.cs +++ /dev/null @@ -1,19 +0,0 @@ -namespace Kavenegar.Json -{ - public class JsonNumber : JsonObject - { - public float Number { get; set; } - - public JsonNumber(float number) - { - Number = number; - } - - public JsonObject UpCast() - { - JsonObject objectJ = this; - return objectJ; - } - } - -} diff --git a/Kavenegar/Json/JsonObject.cs b/Kavenegar/Json/JsonObject.cs deleted file mode 100644 index 184f444..0000000 --- a/Kavenegar/Json/JsonObject.cs +++ /dev/null @@ -1,100 +0,0 @@ -using System; -using System.Collections.Generic; - -namespace Kavenegar.Json -{ - /// - /// JsonObject is the base class. - /// JsonString,JsonNumber,JsonBoolean,JsonNullable and JsonArray inherits from JsonObject. - /// A JsonArray object may contain objects of the base class - /// - - public class JsonObject - { - public Dictionary Values; - - public JsonObject() - { - Values = new Dictionary(); - } - - public void AddJsonValue(String textTag, JsonObject newObject) - { - if (!Values.ContainsKey(textTag)) - { - Values.Add(textTag, newObject); - } - } - - public JsonObject GetObject(String key) - { - JsonObject current = Values[key]; - return current; - } - - public int ElementsOfDictionary() - { - return Values.Count; - } - - - public Boolean IsJsonString() - { - if (this is JsonString) - { - return true; - } - return false; - } - - public Boolean IsJsonNumber() - { - if (this is JsonNumber) - { - return true; - } - return false; - } - - public Boolean IsJsonBoolean() - { - if (this is JsonBoolean) - { - return true; - } - return false; - } - - public Boolean IsJsonNullable() - { - if (this is JsonNullable) - { - return true; - } - return false; - } - - public Boolean IsJsonArray() - { - if (this is JsonArray) - { - return true; - } - return false; - } - - public JsonString GetAsString() - { - return (JsonString)this; - } - public JsonNumber GetAsNumber() - { - return (JsonNumber)this; - } - public JsonArray GetAsArray() - { - return (JsonArray)this; - } - } -} - diff --git a/Kavenegar/Json/JsonString.cs b/Kavenegar/Json/JsonString.cs deleted file mode 100644 index 1b7fcdd..0000000 --- a/Kavenegar/Json/JsonString.cs +++ /dev/null @@ -1,22 +0,0 @@ -using System; - -namespace Kavenegar.Json -{ - public class JsonString : JsonObject - { - public String Text { get; set; } - - public JsonString(String text) - { - Text = text; - } - - public JsonObject UpCast() - { - JsonObject objectJ = this; - return objectJ; - } - - - } -} diff --git a/Kavenegar/Json/Parser.cs b/Kavenegar/Json/Parser.cs deleted file mode 100644 index c13aab7..0000000 --- a/Kavenegar/Json/Parser.cs +++ /dev/null @@ -1,455 +0,0 @@ -// SharpYourJson -// (c) 2013 Felipe Herranz -// SharpYourJson may be freely distributed under the MIT license. - -using System; -using System.Collections.Generic; - -namespace Kavenegar.Json -{ - /// - /// Contains the façade-style class to perform Json operations - /// - - public class Parser - { - - public JsonObject DocumentJson; // The deserialized Json Object will be stored here - - private const char ObjectBegin = '{'; - private const char ObjectEnd = '}'; - private const char ArrayBegin = '['; - private const char ArrayEnd = ']'; - private const char DoubleQuotes = '"'; - private const char DoublePoint = ':'; - private const char Comma = ','; - private const char BackSlash = '\u005C'; - private const string NullValue = "null"; - private const string TrueValue = "true"; - private const string FalseValue = "false"; - - /// - /// Deserialize a JSON document. This method does not perform a syntax checking so It assumes a valid Json input - /// - /// - /// - /// A string which contains a valid Json array or object - /// - public JsonObject Parse(String json) - { - if (json[0] == ArrayBegin) - { - json = json.Substring(1, json.Length - 2); - JsonArray arrayJson = SerializeArray(json); - JsonObject o = arrayJson; - return o; - - } - else if (json[0] == ObjectBegin) - { - - return SerializeObject(json); - } - return null; - } - /// - /// This method performs deserialization of an object(except array) - /// - /// - /// JsonObject object as a deserialized JSON object - /// - /// - /// A string which contains a valid Json object - /// - private JsonObject SerializeObject(String json) - { - json = json.Replace(@"\", ""); - JsonObject document = new JsonObject(); - int n = 1; - int lengthJson = json.Length; - String keyString = ""; - - while (n <= lengthJson - 1) - { - if (json[n] == DoubleQuotes && json[n - 1] != DoublePoint) // (key-value Pair) key Name - { - int secondDoubleQuotes = FindNextQuote(json, n + 1); - keyString = json.Substring(n + 1, (secondDoubleQuotes - (n + 1))); - n = secondDoubleQuotes + 1; - - } - else if (json[n] == DoubleQuotes && json[n - 1] == DoublePoint) // (key-value Pair) value Name (if string) - { - if (json[n + 1] != DoubleQuotes) - { - int secondDoublesQuotes = FindNextQuote(json, n + 1); - String text = json.Substring(n + 1, (secondDoublesQuotes - (n + 1))); - JsonString stringValue = new JsonString(text); - JsonObject o = stringValue; - document.AddJsonValue(keyString, o); - n = secondDoublesQuotes + 1; - } - else - { - JsonObject o = new JsonString(""); - document.AddJsonValue(keyString, o); - } - - } - else if (json[n] == '-' || json[n] == '0' || json[n] == '1' || json[n] == '2' || json[n] == '3' || - json[n] == '4' || json[n] == '5' || json[n] == '6' || json[n] == '7' || json[n] == '8' || - json[n] == '9') // (key-value Pair) value (if number) - { - char[] arrayEndings = { ObjectEnd, Comma }; - int nextComma = json.IndexOfAny(arrayEndings, n); - String stringNumber = json.Substring(n, nextComma - n); - Double valueNumber = Convert.ToDouble(stringNumber); - float floatNumber = (float)valueNumber; - JsonNumber number = new JsonNumber(floatNumber); - JsonObject o = number; - document.AddJsonValue(keyString, o); - n = nextComma + 1; - - } - else if (json[n] == ArrayBegin) //(key-value Pair) value (if array) - { - if (json[n + 1] != ArrayEnd) - { - String subJson = json.Substring(n, json.Length - n); - int arrayClose = CloseBracketArray(subJson); - String arrayUnknown = json.Substring(n + 1, arrayClose - 2); - JsonArray arrayObjects = SerializeArray(arrayUnknown); - JsonObject o = arrayObjects; - document.AddJsonValue(keyString, o); - n = n + arrayClose; - } - else - { - if (!string.IsNullOrEmpty(keyString)) - { - JsonArray arrayTempEmpty = new JsonArray { Array = null }; - JsonObject emptyArray = arrayTempEmpty; - document.AddJsonValue(keyString, emptyArray); - keyString = ""; - - } - else - { - n++; - } - } - - } - else if (json[n] == ObjectBegin) // (key-value Pair) value (if object) - { - if (json[n + 1] != ObjectEnd) - { - String subJson = json.Substring(n, json.Length - n); - int objectClose = CloseBracketObject(subJson); - String objectUnknown = json.Substring(n, objectClose); - var o = SerializeObject(objectUnknown); - document.AddJsonValue(keyString, o); - n = n + objectClose + 1; - } - else - { - JsonObject o = new JsonObject { Values = null }; - document.AddJsonValue(keyString, o); - } - - } - else if (String.Compare(SafeSubString(json, n, 4), NullValue, StringComparison.Ordinal) == 0) // (key-value Pair) value (if NULL) - { - JsonObject o = new JsonNullable(); - document.AddJsonValue(keyString, o); - n = n + 5; - } - else if (String.Compare(SafeSubString(json, n, 4), TrueValue, StringComparison.Ordinal) == 0) // (key-value Pair) value (if TRUE) - { - JsonObject o = new JsonBoolean(true); - document.AddJsonValue(keyString, o); - n = n + 5; - } - else if (String.Compare(SafeSubString(json, n, 5), FalseValue, StringComparison.Ordinal) == 0) // (key-value Pair) value (if FALSE) - { - JsonObject o = new JsonBoolean(false); - document.AddJsonValue(keyString, o); - n = n + 6; - } - else - { - n++; - } - - } - - return document; - } - - /// - /// Search where is the ending of an object - /// - /// - /// the index of the '}' which closes an object - /// - /// - /// A valid json string ({........) - /// - - private int CloseBracketObject(String json) - { - int countObjectBegin = 0; - int countObjectEnd = 0; - int n = 0; - - do - { - if (json[n] == ObjectBegin) - { - countObjectBegin++; - - } - else if (json[n] == ObjectEnd) - { - countObjectEnd++; - } - - n++; - - } while (countObjectBegin != countObjectEnd); - - return n; - } - - /// - /// Search where is the ending of an array - /// - /// - /// he index of the ']' which closes an object - /// - /// - /// A valid Json string ([.....) - /// - - private int CloseBracketArray(String json) - { - int countArrayBegin = 0; - int countArrayEnd = 0; - int n = 0; - - do - { - if (json[n] == ArrayBegin) - { - countArrayBegin++; - - } - else if (json[n] == ArrayEnd) - { - countArrayEnd++; - } - - n++; - - } while (countArrayBegin != countArrayEnd); - - return n; - } - - /// - /// Deserialize a Json Array into an object JsonArray - /// - /// - /// JsonArray object as a deserialized JSON array - /// - /// - /// valid JSON array except the brackets - /// - - private JsonArray SerializeArray(String array) - { - JsonArray arrayObject = new JsonArray(); - var elements = SplitElements(array); - - foreach (String item in elements) - { - - if (item[0] == DoubleQuotes) - { - String withoutQuotes = item.Trim(DoubleQuotes); - JsonObject o = new JsonString(withoutQuotes); - arrayObject.AddElementToArray(o); - - } - else if (item[0] == ObjectBegin) - { - JsonObject o = SerializeObject(item); - arrayObject.AddElementToArray(o); - - } - else if (item[0] == ArrayBegin) - { - String itemArray = item.Substring(1, item.Length - 2); - JsonArray secondaryArray = SerializeArray(itemArray); - JsonObject o = secondaryArray; - arrayObject.AddElementToArray(o); - - } - else if (item[0] == '-' || item[0] == '0' || item[0] == '1' || item[0] == '2' || item[0] == '3' || - item[0] == '4' || item[0] == '5' || item[0] == '6' || item[0] == '7' || item[0] == '8' || item[0] == '9') - { - Double doubleValue = Convert.ToDouble(item); - float floatValue = (float)doubleValue; - JsonObject o = new JsonNumber(floatValue); - arrayObject.AddElementToArray(o); - } - else if (String.Compare(SafeSubString(item, 0, 4), TrueValue, StringComparison.Ordinal) == 0) - { - JsonObject o = new JsonBoolean(true); - arrayObject.AddElementToArray(o); - } - else if (String.Compare(SafeSubString(item, 0, 5), FalseValue, StringComparison.Ordinal) == 0) - { - JsonObject o = new JsonBoolean(false); - arrayObject.AddElementToArray(o); - } - else if (String.Compare(SafeSubString(item, 0, 4), NullValue, StringComparison.Ordinal) == 0) - { - JsonObject o = new JsonNullable(); - arrayObject.AddElementToArray(o); - } - - } - - return arrayObject; - - } - /// - /// Just a safe subString operation - /// - /// - /// A subString of the string input parameter text - /// - /// - /// A string - /// - /// - /// index of starting - /// - /// - /// Length of the subString - /// - - private String SafeSubString(String text, int start, int length) - { - var safeString = start + length < text.Length ? text.Substring(start, length) : text.Substring(start, text.Length - start); - - return safeString; - } - - /// - /// Finds the next '"' to close a String field - /// - /// - /// The next ' " ' - /// - /// - /// A valid JSON string - /// - /// - /// Index of starting - /// - - private int FindNextQuote(String text, int index) - { - int nextQuote = text.IndexOf(DoubleQuotes, index); - while (text[nextQuote - 1] == BackSlash) - { - nextQuote = text.IndexOf(DoubleQuotes, nextQuote + 1); - } - - return nextQuote; - - } - - /// - /// Splits the elements of an Array - /// - /// - /// The elements in an array of Strings - /// - /// - /// - /// - - private String[] SplitElements(String arrayText) - { - int n = 0; - int doubleQuotesCounter = 0; - int objectBeginCounter = 0; - int objectEndCounter = 0; - int arrayBeginCounter = 0; - int arrayEndCounter = 0; - int previousCommaIndex = 0; - Boolean oneElement = true; - List textSplit = new List(); - - while (n <= arrayText.Length - 1) - { - if (arrayText[n] == DoubleQuotes && arrayText[n - 1] != BackSlash) - { - doubleQuotesCounter++; - n++; - } - else if (arrayText[n] == ObjectBegin) - { - objectBeginCounter++; - n++; - - } - else if (arrayText[n] == ObjectEnd) - { - objectEndCounter++; - n++; - - } - else if (arrayText[n] == ArrayBegin) - { - arrayBeginCounter++; - n++; - - } - else if (arrayText[n] == ArrayEnd) - { - arrayEndCounter++; - n++; - - } - else if (arrayText[n] == Comma && doubleQuotesCounter % 2 == 0 && objectBeginCounter == objectEndCounter - && arrayBeginCounter == arrayEndCounter) - { - textSplit.Add(arrayText.Substring(previousCommaIndex, (n - previousCommaIndex))); - previousCommaIndex = n + 1; - n++; - oneElement = false; - - } - else - { - n++; - } - } - - textSplit.Add(oneElement - ? arrayText - : arrayText.Substring(previousCommaIndex, (arrayText.Length) - previousCommaIndex)); - - String[] textSplitArray = textSplit.ToArray(); - return textSplitArray; - } - - } -} - - - diff --git a/Kavenegar/Kavenegar.csproj b/Kavenegar/Kavenegar.csproj index 6a05b0f..1c226e1 100644 --- a/Kavenegar/Kavenegar.csproj +++ b/Kavenegar/Kavenegar.csproj @@ -1,84 +1,27 @@ - - - + + - Debug - AnyCPU - {28209ADB-60BA-4E6C-B802-B2CC0AB85181} + netstandard2.0;net35 + Kavenegar + Kavenegar Library - Properties - Kavenegar - Kavenegar - v3.5 - 512 - + Kavenegar API in .NET + Kavenegar Team, Bagher Sohrabi, Ardavan + REST; SMS; voice; TTS; OTP; API; Verification; kavenegar; Voicesms + false + https://github.com/kavenegar/kavenegar-dotnet + https://github.com/kavenegar/kavenegar-dotnet + 1.1.5-alpha.1 + Force SSL - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - AnyCPU - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - + + + - - - - False - - - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - + \ No newline at end of file diff --git a/Kavenegar/Kavenegar.v11.suo b/Kavenegar/Kavenegar.v11.suo deleted file mode 100644 index 1cec04b..0000000 Binary files a/Kavenegar/Kavenegar.v11.suo and /dev/null differ diff --git a/Kavenegar/KavenegarApi.cs b/Kavenegar/KavenegarApi.cs index 1e92726..d058ec6 100644 --- a/Kavenegar/KavenegarApi.cs +++ b/Kavenegar/KavenegarApi.cs @@ -2,7 +2,7 @@ using System.Collections.Generic; using System.IO; using System.Linq; -using System.Web.Script.Serialization; +using Newtonsoft.Json; using System.Net; using System.Text; using Kavenegar.Exceptions; @@ -85,7 +85,6 @@ public class KavenegarApi private int _returnCode = 200; private string _returnMessage = ""; private const string Apipath = "https://api.kavenegar.com/v1/{0}/{1}/{2}.{3}"; - private static readonly JavaScriptSerializer JsonSerialiser = new JavaScriptSerializer(); public KavenegarApi(string apikey) { _apikey = apikey; @@ -150,7 +149,7 @@ private static string Execute(string path, Dictionary _params) responseBody = reader.ReadToEnd(); } } - JsonSerialiser.Deserialize(responseBody); + JsonConvert.DeserializeObject(responseBody); return responseBody; } catch (WebException webException) @@ -162,7 +161,7 @@ private static string Execute(string path, Dictionary _params) } try { - var result = JsonSerialiser.Deserialize(responseBody); + var result = JsonConvert.DeserializeObject(responseBody); throw new ApiException(result.Return.message, result.Return.status); } catch (ApiException) @@ -228,8 +227,7 @@ public List Send(string sender, List receptor, string messag param.Add("localid", StringHelper.Join(",", localids.ToArray())); } var responseBody = Execute(path, param); - var jsonSerialiser = new JavaScriptSerializer(); - var l = jsonSerialiser.Deserialize(responseBody); + var l = JsonConvert.DeserializeObject(responseBody); return l.entries; } @@ -302,11 +300,10 @@ public List SendArray(List senders, List receptors, public List SendArray(List senders, List receptors, List messages, List types, DateTime date, List localmessageids) { String path = GetApiPath("sms", "sendarray", "json"); - var jsonSerialiser = new JavaScriptSerializer(); - var jsonSenders = jsonSerialiser.Serialize(senders); - var jsonReceptors = jsonSerialiser.Serialize(receptors); - var jsonMessages = jsonSerialiser.Serialize(messages); - var jsonTypes = jsonSerialiser.Serialize(types); + var jsonSenders = JsonConvert.SerializeObject(senders); + var jsonReceptors = JsonConvert.SerializeObject(receptors); + var jsonMessages = JsonConvert.SerializeObject(messages); + var jsonTypes = JsonConvert.SerializeObject(types); var param = new Dictionary { {"message", jsonMessages}, @@ -321,7 +318,7 @@ public List SendArray(List senders, List receptors, } var responsebody = Execute(path, param); - var l = jsonSerialiser.Deserialize(responsebody); + var l = JsonConvert.DeserializeObject(responsebody); if (l.entries == null) { return new List(); @@ -337,8 +334,7 @@ public List Status(List messageids) {"messageid", StringHelper.Join(",", messageids.ToArray())} }; var responsebody = Execute(path, param); - var jsonSerialiser = new JavaScriptSerializer(); - var l = jsonSerialiser.Deserialize(responsebody); + var l = JsonConvert.DeserializeObject(responsebody); if (l.entries == null) { return new List(); @@ -358,8 +354,7 @@ public List StatusLocalMessageId(List messag string path = GetApiPath("sms", "statuslocalmessageid", "json"); var param = new Dictionary { { "localid", StringHelper.Join(",", messageids.ToArray()) } }; var responsebody = Execute(path, param); - var jsonSerialiser = new JavaScriptSerializer(); - var l = jsonSerialiser.Deserialize(responsebody); + var l = JsonConvert.DeserializeObject(responsebody); return l.entries; } @@ -374,8 +369,7 @@ public List Select(List messageids) var path = GetApiPath("sms", "select", "json"); var param = new Dictionary { { "messageid", StringHelper.Join(",", messageids.ToArray()) } }; var responsebody = Execute(path, param); - var jsonSerialiser = new JavaScriptSerializer(); - var l = jsonSerialiser.Deserialize(responsebody); + var l = JsonConvert.DeserializeObject(responsebody); if (l.entries == null) { return new List(); @@ -410,8 +404,7 @@ public List SelectOutbox(DateTime startdate, DateTime enddate, Strin {"sender", sender} }; var responsebody = Execute(path, param); - var jsonSerialiser = new JavaScriptSerializer(); - var l = jsonSerialiser.Deserialize(responsebody); + var l = JsonConvert.DeserializeObject(responsebody); return l.entries; } @@ -425,8 +418,7 @@ public List LatestOutbox(long pagesize, String sender) var path = GetApiPath("sms", "latestoutbox", "json"); var param = new Dictionary { { "pagesize", pagesize }, { "sender", sender } }; var responsebody = Execute(path, param); - var jsonSerialiser = new JavaScriptSerializer(); - var l = jsonSerialiser.Deserialize(responsebody); + var l = JsonConvert.DeserializeObject(responsebody); return l.entries; } @@ -450,8 +442,7 @@ public CountOutboxResult CountOutbox(DateTime startdate, DateTime enddate, int s {"status", status} }; var responsebody = Execute(path, param); - var jsonSerialiser = new JavaScriptSerializer(); - var l = jsonSerialiser.Deserialize(responsebody); + var l = JsonConvert.DeserializeObject(responsebody); if (l.entries == null || l.entries[0] == null) { return new CountOutboxResult(); @@ -467,8 +458,7 @@ public List Cancel(List ids) {"messageid", StringHelper.Join(",", ids.ToArray())} }; var responsebody = Execute(path, param); - var jsonSerialiser = new JavaScriptSerializer(); - var l = jsonSerialiser.Deserialize(responsebody); + var l = JsonConvert.DeserializeObject(responsebody); return l.entries; } @@ -484,8 +474,7 @@ public List Receive(string line, int isread) String path = GetApiPath("sms", "receive", "json"); var param = new Dictionary { { "linenumber", line }, { "isread", isread } }; var responsebody = Execute(path, param); - var jsonSerialiser = new JavaScriptSerializer(); - var l = jsonSerialiser.Deserialize(responsebody); + var l = JsonConvert.DeserializeObject(responsebody); if (l.entries == null) { return new List(); @@ -514,8 +503,7 @@ public CountInboxResult CountInbox(DateTime startdate, DateTime enddate, String {"isread", isread} }; var responsebody = Execute(path, param); - var jsonSerialiser = new JavaScriptSerializer(); - var l = jsonSerialiser.Deserialize(responsebody); + var l = JsonConvert.DeserializeObject(responsebody); return l.entries[0]; } @@ -524,8 +512,7 @@ public List CountPostalCode(long postalcode) String path = GetApiPath("sms", "countpostalcode", "json"); var param = new Dictionary { { "postalcode", postalcode } }; var responsebody = Execute(path, param); - var jsonSerialiser = new JavaScriptSerializer(); - var l = jsonSerialiser.Deserialize(responsebody); + var l = JsonConvert.DeserializeObject(responsebody); return l.entries; } @@ -549,8 +536,7 @@ public List SendByPostalCode(long postalcode, String sender, String {"date", date == DateTime.MinValue ? 0 : DateHelper.DateTimeToUnixTimestamp(date)} }; var responsebody = Execute(path, param); - var jsonSerialiser = new JavaScriptSerializer(); - var l = jsonSerialiser.Deserialize(responsebody); + var l = JsonConvert.DeserializeObject(responsebody); return l.entries; } @@ -558,8 +544,7 @@ public AccountInfoResult AccountInfo() { var path = GetApiPath("account", "info", "json"); var responsebody = Execute(path, null); - var jsonSerialiser = new JavaScriptSerializer(); - var l = jsonSerialiser.Deserialize(responsebody); + var l = JsonConvert.DeserializeObject(responsebody); return l.entries; } @@ -576,8 +561,7 @@ public AccountConfigResult AccountConfig(string apilogs, string dailyreport, str {"resendfailed", resendfailed} }; var responsebody = Execute(path, param); - var jsonSerialiser = new JavaScriptSerializer(); - var l = jsonSerialiser.Deserialize(responsebody); + var l = JsonConvert.DeserializeObject(responsebody); return l.entries; } @@ -622,12 +606,11 @@ public SendResult VerifyLookup(string receptor, string token, string token2, str {"type", type}, }; var responsebody = Execute(path, param); - var jsonSerialiser = new JavaScriptSerializer(); - var l = jsonSerialiser.Deserialize(responsebody); + var l = JsonConvert.DeserializeObject(responsebody); return l.entries[0]; } - - + + #region << CallMakeTTS >> public SendResult CallMakeTTS(string message, string receptor) @@ -653,7 +636,7 @@ public List CallMakeTTS(string message, List receptor, DateT param.Add("localid", StringHelper.Join(",", localid.ToArray())); var responseBody = Execute(path, param); - return JsonSerialiser.Deserialize(responseBody).entries; + return JsonConvert.DeserializeObject(responseBody).entries; } #endregion << CallMakeTTS >> diff --git a/Kavenegar/Properties/AssemblyInfo.cs b/Kavenegar/Properties/AssemblyInfo.cs deleted file mode 100644 index 3216e3a..0000000 --- a/Kavenegar/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("Kavenegar")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("Microsoft")] -[assembly: AssemblyProduct("Kavenegar")] -[assembly: AssemblyCopyright("Copyright © Microsoft 2016")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("fb787285-7421-48fc-91d4-300034c6867a")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.1.3.0")] -[assembly: AssemblyFileVersion("1.1.3.0")]