I am implementing a city search so I want a Autofill with the functionality where when I select a city I want the ID to be sent back to the API. to populate some other fields.
private async void AutoSuggestBox_TextChanged(AutoSuggestBox sender, AutoSuggestBoxTextChangedEventArgs args)
{
if (args.Reason == AutoSuggestionBoxTextChangeReason.UserInput)
{
string text = sender.Text;
if (text.Length >= 3)
{
GetCities(text);
sender.ItemsSource = await Task<string[]>.Run(() => { return this.GetSuggestions(text); });
}
else
{
sender.ItemsSource = new string[] { "No suggestions..." };
}
}
}
My Get response class
private async void GetCities(string city)
{
try
{
string baseAddress = Url.url + "searchCities?q="+city+"&access_token=" + tcm;
HttpClient httpClient = new HttpClient();
string co = "";
var content = await httpClient.GetAsync(new Uri(baseAddress));
if (!content.IsSuccessStatusCode)
{
TokenGenerator tc = new TokenGenerator();
tc.GetToken();
tcm = TokenManager.accessT.access_tocken;
HttpClient client = new HttpClient();
content = await client.GetAsync(new Uri(baseAddress));
}
co = await content.Content.ReadAsStringAsync();
AutofillHelper result = JsonConvert.DeserializeObject<AutofillHelper>(co);
foreach (var item in result.data)
{
suggestions = new string [] {item.city} ;
}
}
catch (Exception ex)
{
dispatcherTimer.Stop();
throw new Exception(ex.ToString());
}
}
private string[] GetSuggestions(string text)
{
string[] result = null;
result = suggestions.Where(x => x.StartsWith(text)).ToArray();
return result;
}
My Get Set
class Autofill
{
public string city_id { get; set; }
public string city { get; set; }
}
class AutofillHelper
{
public List<Autofill> data { get; set; }
}
I want it to display the response from the API for the person to select it. A Run time error is thrown. Can someone please guide me what has gone wrong.
Any kind of help is appreciated...
Related
I am triying to create an Excel file and then send by email using my microsft email adress using Microsft Graph.
If the only thing that i do is send an email works fine, but if create the excel and then try send email using the same code stops working, no errors, simply stop working.
This is my code:
class Solds
{
public string Empres { get; set; }
public string NClient { get; set; }
public string Name { get; set; }
public string PurchaseNumber { get; set; }
public DateTime Date { get; set; }
public string Codart { get; set; }
public string Description { get; set; }
public string Fampro { get; set; }
public string Serpro { get; set; }
public string Group { get; set; }
public decimal Price { get; set; }
public decimal Cost { get; set; }
public string Seller { get; set; }
public string Quarter { get; set; }
}
static void Main(string[] args)
{
List<String> Destinations = new List<string>() { "myemail#mycompany.com" };
List<string> Cc = new List<string>();
List<System.IO.FileInfo> Filess = new List<System.IO.FileInfo>();
List<Solds> lstSolds = GetData();
SenMailUsingMicrosoftGraph(Destinations, Cc, "", "Text of the Body", "title of the mail", Filess);
// GenerateExcel creates a Excel File (i use ClosedXML) and retuns a FileInfo
Files.Add(GenerateExcel(lstSolds));
SenMailUsingMicrosoftGraph(Destinations, Cc, "", "Text of the Body", "title of the mail", Filess);
}
private static async void SenMailUsingMicrosoftGraph(List<String>Destinations, List<String>Cc, string HidenCopy, string Body, string Title, List<FileInfo>Filess);
{
ClientSecretCredential credential = new ClientSecretCredential("MyTenantID", "MyClientId", "MyClientSecret");
List<Recipient> recipientsDestinatarios = new List<Recipient>();
List<Recipient> recipientsCopias = new List<Recipient>();
foreach (var c in Destinations)
{
recipientsDestinatarios.Add(
new Recipient
{
EmailAddress = new EmailAddress
{
Address = c
}
});
}
foreach (var mail in Cc)
{
recipientsCopias.Add(
new Recipient
{
EmailAddress = new EmailAddress
{
Address = mail
}
});
}
#endregion
var message = new Microsoft.Graph.Message
{
Subject = Title,
Body = new ItemBody
{
ContentType = BodyType.Html,
Content = Body
},
ToRecipients = recipientsDestinatarios
,
CcRecipients = recipientsCopias
,
BccRecipients = new List<Recipient>()
{
new Recipient
{
EmailAddress=new EmailAddress{Address=Hiden}
}
}
};
GraphServiceClient graphClient = new GraphServiceClient(credential);
#endregion
#region adjuntar ficheros
var msgResult = await graphClient.Users["myemail#mycompany.com"].MailFolders.Drafts.Messages
.Request()
.WithMaxRetry(9)
.AddAsync(message);
foreach (var Archivo in Filess)
{
var attachmentContentSize = Archivo.Length;
var attachmentItem = new AttachmentItem
{
AttachmentType = AttachmentType.File,
Name = Archivo.Name,
Size = attachmentContentSize,
};
//initiate the upload session for large files
var uploadSession = await graphClient.Users["myemail#mycompany.com"].Messages[msgResult.Id].Attachments
.CreateUploadSession(attachmentItem)
.Request()
.PostAsync();
var maxChunkSize = 1024 * 320;
var allBytes = System.IO.File.ReadAllBytes(Archivo.FullName);
using (var stream = new MemoryStream(allBytes))
{
stream.Position = 0;
LargeFileUploadTask<FileAttachment> largeFileUploadTask = new LargeFileUploadTask<FileAttachment>(uploadSession, stream, maxChunkSize);
await largeFileUploadTask.UploadAsync();
}
}
await graphClient.Users["myemail#mycompany.com"].Messages[msgResult.Id].Send().Request().PostAsync();
}
private static FileInfo GenerateExcel(List<Solds> lstSolds)
{
System.IO.FileInfo file= new System.IO.FileInfo(#"E:\MyFolder\MyFile.xlsx");
if (file.Exists) file.Delete();
using (var wb = new XLWorkbook())
{
var ws = wb.Worksheets.Add("Example");
ws.Cell(2, 1).InsertTable(lstSolds);
wb.SaveAs(file.FullName);
}
return file;
}
private static List<ventas> ObtenerDatos()
{
List<ventas> lstSolds = new List<Solds>();
string connString = #"Data Source=MyServer\SQLExpress; Initial Catalog=MyDataBAse;User Id=User;Password=password;";
string sentenciaSQL = "QuarterSolds";
using (System.Data.SqlClient.SqlConnection conn = new System.Data.SqlClient.SqlConnection(connString))
{
using (SqlCommand comm = new SqlCommand(sentenciaSQL, conn))
{
DateTime t = DateTime.Now;
conn.Open();
comm.CommandType = System.Data.CommandType.StoredProcedure;
comm.CommandTimeout = 240;
using (SqlDataReader reader = comm.ExecuteReader())
{
if (reader.HasRows)
{
while (reader.Read())
{
Solds v = new Solds();
decimal d = 0;
v.Empres = reader.GetValue(0).ToString();
v.NClient = reader.GetValue(1).ToString();
v.Name = reader.GetValue(2).ToString();
v.PurchaseNumber = reader.GetValue(3).ToString();
v.Date = DateTime.TryParse(reader.GetValue(4).ToString(), out t) ? t : t;
v.Codart = reader.GetValue(5).ToString();
v.Description = reader.GetValue(6).ToString();
v.Fampro = reader.GetValue(7).ToString();
v.Serpro = reader.GetValue(8).ToString();
v.Group = reader.GetValue(9).ToString();
v.Price = decimal.TryParse(reader.GetValue(10).ToString(), out d) ? d : 0;
v.Cost = decimal.TryParse(reader.GetValue(11).ToString(), out d) ? d : 0;
v.Seller = reader.GetValue(12).ToString();
v.Quarter = reader.GetValue(13).ToString();
lstSolds.Add(v);
}
}
else Console.WriteLine("No lines");
}
}
}
If i execute this first call to my method SenMailUsingMicrosoftGraph works fine and sends an email. But if i call again to SenMailUsingMicrosoftGraph after creating the Excel, the program stops when arrives to:
var msgResult = await graphClient.Users["myemail#mycompany.com"].MailFolders.Drafts.Messages
.Request()
.WithMaxRetry(9)
.AddAsync(message);
Any suggestions?
Make your code really async. Now your program doesn't wait for the response from Graph API and ends immediately after the second call of SenMailUsingMicrosoftGraph.
Use static async Task Main(string[] args), private static async Task SenMailUsingMicrosoftGraph and await before SenMailUsingMicrosoftGraph.
static async Task Main(string[] args)
{
List<String> Destinations = new List<string>() { "myemail#mycompany.com" };
List<string> Cc = new List<string>();
List<System.IO.FileInfo> Filess = new List<System.IO.FileInfo>();
List<Solds> lstSolds = GetData();
await SenMailUsingMicrosoftGraph(Destinations, Cc, "", "Text of the Body", "title of the mail", Filess);
// GenerateExcel creates a Excel File (i use ClosedXML) and retuns a FileInfo
Files.Add(GenerateExcel(lstSolds));
await SenMailUsingMicrosoftGraph(Destinations, Cc, "", "Text of the Body", "title of the mail", Filess);
}
private static async Task SenMailUsingMicrosoftGraph
{
...
}
Whilst debugging, go to 'Exception settings' and click on the box 'Common Language Runtime Exception' so that it turns into a checkmark.
You've probably disabled the specific error being thrown.
After this you'll need to restart debugging.
I am trying to send a post request to an Api called Paycell Api.
I dont need to authenticate for testing the request.
When I send the request with PostMan, it returns 200 OK.
Here is the exact request.
{
"msisdn": "5380521479",
"requestHeader": {
"applicationName": "PAYCELLTEST",
"applicationPwd": "PaycellTestPassword",
"clientIPAddress": "10.252.187.81",
"transactionDateTime": "20160309084056197",
"transactionId": "12345678901234567893"
}
}
When ı try to implement it to C# it returns 406 Not Acceptable.
Here is how it looks
using Newtonsoft.Json;
using System.Collections;
using TMPro;
using UnityEngine;
using UnityEngine.Networking;
public class GetCardsRequest : MonoBehaviour
{
private string url = "https://tpay-test.turkcell.com.tr:443/tpay/provision/services/restful/getCardToken/getCards/";
public void GetCards()
{
StartCoroutine(MakeCardRequest());
}
IEnumerator MakeCardRequest()
{
var bodyRequest = new GetCardRequest() {
requestHeader = new RequestHeader()
{
applicationName = "PORTALTEST",
applicationPwd = "ZDyXmMLWE2z7OzJU",
clientIPAddress = "10.252.187.81",
transactionDateTime = "20160309084056197",
transactionId = "12345678901234567893"
},
msisdn = "5380521479"
};
bodyRequest.requestHeader = new RequestHeader();
var body = JsonConvert.SerializeObject(bodyRequest);
UnityWebRequest request = UnityWebRequest.Post(url, body);
request.SetRequestHeader("Content-Type", "application/json");
request.SetRequestHeader("Accept", "text/csv");
yield return request.SendWebRequest();
if (request.result == UnityWebRequest.Result.ConnectionError || request.result == UnityWebRequest.Result.ProtocolError)
{
Debug.Log(request.error);
}
else
{
//var cardName = JsonConvert.DeserializeObject<GetCardResponse>(request.downloadHandler.text);
}
}
}
İf I delete the part
request.SetRequestHeader("Content-Type", "application/json");
request.SetRequestHeader("Accept", "text/csv");
It returns 415 Unsupported Media Type Error.
How can I send this request, please help me.
Here's the documentation of the API, it shows an example request.
Paycell API
And here is how I implemented GetCardRequest
// Root myDeserializedClass = JsonConvert.DeserializeObject<Root>(myJsonResponse);
public class RequestHeader
{
public string applicationName { get; set; }
public string applicationPwd { get; set; }
public string clientIPAddress { get; set; }
public string transactionDateTime { get; set; }
public string transactionId { get; set; }
}
public class GetCardRequest
{
public string msisdn { get; set; }
public RequestHeader requestHeader { get; set; }
}
Now with your code the first main issue is mot probably that your JSON is always empty fields.
you are doing
bodyRequest.requestHeader = new RequestHeader();
which erases all the previously filled in values
and then as mentioned before another thing to try might be rather using
IEnumerator MakeCardRequest()
{
var bodyRequest = new GetCardRequest()
{
requestHeader = new RequestHeader()
{
applicationName = "PORTALTEST",
applicationPwd = "ZDyXmMLWE2z7OzJU",
clientIPAddress = "10.252.187.81",
transactionDateTime = "20160309084056197",
transactionId = "12345678901234567893"
},
msisdn = "5380521479"
};
var body = JsonConvert.SerializeObject(bodyRequest);
var bytes = Encoding.UTF8.GetBytes(body);
using(var request = new UnityWebRequest(url, "POST"))
{
request.uploadHandler = (UploadHandler) new UploadHandlerRaw(data);
request.downloadHandler = (DownloadHandler) new DownloadHandlerBuffer();
request.SetRequestHeader("Content-Type", "application/json");
yield return request.SendWebRequest();
if (request.result != UnityWebRequest.Result.Success)
{
Debug.Log(request.error);
}
else
{
var cardName = JsonConvert.DeserializeObject<GetCardResponse>(request.downloadHandler.text);
Debug.Log(cardName);
}
}
}
I am working in Exception Logging, I have created API for that, API taking exception as parameter and few more thing.
[HttpPost]
[Route("/Log")]
public IEnumerable<string> Post([FromBody] WP2Exceptions wp2Exceptions)
{
ExceptionsModel exceptionsModel = new ExceptionsModel();
exceptionsModel = _exceptions.GetExceptionsByType(wp2Exceptions.exception.GetType().ToString());
ExceptionsLogModel exceptionLogModel = new ExceptionsLogModel();
exceptionLogModel.ExceptionID = exceptionsModel.ExceptionID;
exceptionLogModel.ModuleName = System.Reflection.Assembly.GetEntryAssembly().GetName().Name;
exceptionLogModel.ExceptionMessage = wp2Exceptions.exception.Message;
exceptionLogModel.ExceptionType = wp2Exceptions.exception.GetType().ToString();
exceptionLogModel.ExceptionSource = wp2Exceptions.exception.Source.ToString();
exceptionLogModel.ExceptionUrl = wp2Exceptions.exception.StackTrace;
_exceptionsLog.AddExceptionsLog(exceptionLogModel);
return new string[] { exceptionsModel.ExceptionType, exceptionsModel.Message };
}
public class WP2Exceptions
{
public string moduleName { get; set; }
public Exception exception { get; set; }
}
While i am passing exception in parameter i am getting "Bad Request" error
Test Code
public async void callAPI()
{
HttpClient client = new HttpClient();
client.BaseAddress = new Uri("http://localhost:50558/");
try
{
string s = null;
string sp = s.ToString();
}
catch (Exception ex)
{
var mydata = "{'exception':'" + JsonConvert.SerializeObject(ex) + "','moduleName':'WEBAPI'}";
var response = await client.PostAsync("Log", new StringContent(mydata, Encoding.UTF8, "application/json"));
if (response != null)
{
Console.WriteLine("Log ID - " + response.ToString());
}
}
}
Please correct me where i am doing wrong or is it possible can we pass exception object as a WEB API parameter?
I resolve the problem,
In remove below code.
var mydata = "{'exception':'" + JsonConvert.SerializeObject(ex) + "','moduleName':'WEBAPI'}";
Created new class and pass the data .
public class paramObject
{
public string modulename { get; set; }
public Exception exception { get; set; }
}
Inside callAPI method i implement following code.
pramObject po = new pramObject()
{
modulename="Webapi",
exception=ex,
};
var response = await client.PostAsync("Log", new StringContent(JsonConvert.SerializeObject(po), Encoding.UTF8, "application/json"));
I have a simple ASP.NET Core 2.2 Controller action that returns incomplete JSON even when sent a request from POSTMAN.
The code runs fine until I include the navigation property for related entity "Books". The results are returned correctly from the ToList() method on the IQueryable object, as I can see when debugging. But, for some reason, when the ReadAsStringAsync() runs, it returns only part of the expected JSON result.
Below is the code for the API:
[HttpPost]
[Route("api/TestEntity/ListTest")]
public async Task<ActionResult<IEnumerable<TestEntityPerson>>> ListTest()
{
var query = _context.Persons
.Include(p => p.Books)
.AsQueryable().Take(5);
var results = await Task.FromResult(Json(query.ToList()));
return results;
}
And the result I receive (which is only a part of the expected result) in the client is:
[{"$type":"Identica.My.Bonus.Entities.TestEntityPerson, Identica.My.Bonus","name":"Susan","balance":240749.08345506949,"age":56,"books":[{"$type":"Identica.My.Bonus.Entities.TestEntityBook, Identica.My.Bonus","title":"SRWZLSRKQNYKPY","author":"VEJZP","price":13.334878714911119,"personId":"f24dbe36-1f99-4a59-3cb7-08d6c4048ace"
Any pointers on what I could try to solve this problem? I couldn't find any relevant questions on stack overflow.
EDIT: This happens only when there is a navigational property on the related entity pointing back at the original entity. When I removed this property, the problem was gone.
And this is the client code:
class Program
{
static async Task Main(string[] args)
{
Console.WriteLine("Press any key to run query...");
Console.Read();
MediaTypeWithQualityHeaderValue mediaTypeJson = new MediaTypeWithQualityHeaderValue("application/json");
List<MediaTypeFormatter> formatters = new List<MediaTypeFormatter> {
new JsonMediaTypeFormatter {
SerializerSettings = new JsonSerializerSettings
{
TypeNameHandling = TypeNameHandling.Objects
}
}
};
using (HttpClient httpClient = new HttpClient() { BaseAddress = new Uri("https://localhost:44359/") })
{
httpClient.DefaultRequestHeaders.Accept.Clear();
httpClient.DefaultRequestHeaders.Accept.Add(mediaTypeJson);
Expression<Func<TestEntityPerson, bool>> expressionFilter =
t => (t.Balance > 240000 || t.Age < 25) &&
(t.Books == null || t.Books.Any(b => b.Price < 7 || b.Title.StartsWith('A')));
var filterNode = expressionFilter.ToExpressionNode();
Expression<Func<IQueryable<TestEntityPerson>, IOrderedQueryable<TestEntityPerson>>> expressionOrderBy = t => t.OrderByDescending(x => x.Balance);
var orderByNode = expressionOrderBy.ToExpressionNode();
Pagination pagination = new Pagination() { Start = 0, Limit = 10 };
QueryOptionsNodes queryOptions = new QueryOptionsNodes()
{
FilterExpressionNode = filterNode,
SortingExpressionNode = orderByNode,
Pagination = pagination
};
try
{
Console.WriteLine("Sending request...");
var response = await httpClient.PostAsync("api/TestEntity/List", queryOptions, formatters[0], mediaTypeJson, CancellationToken.None);
response.EnsureSuccessStatusCode();
Console.WriteLine("Reading Response request...");
var result = await response.Content.ReadAsAsync<IEnumerable<TestEntityPerson>>(formatters, CancellationToken.None);
ShowEntities(result);
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
try
{
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
}
Console.WriteLine("Press any key to exit...");
Console.ReadLine();
Console.ReadLine();
}
private static void ShowEntities(IEnumerable<TestEntityPerson> testEntities)
{
foreach (var entity in testEntities)
{
Console.WriteLine("{0}) {1} Age = {2} Balance = {3}", entity.Id, entity.Name, entity.Age, entity.Balance);
if (entity.Books != null)
{
Console.WriteLine("Books:");
foreach (var book in entity.Books)
{
Console.WriteLine("-- {0}) {1} Price = {2}", book.Id, book.Title, book.Price);
}
}
Console.WriteLine();
}
}
}
The problem that there was an unnecessary navigational property on the "related entity" pointing back at the "original entity".
public class TestEntityPerson : BaseEntity<int>
{
public string Name { get; set; }
public double Balance { get; set; }
public int Age { get; set; }
public List<TestEntityBook> Books { get; set; }
}
And the related entity:
public class TestEntityBook : BaseEntity<int>
{
public string Title { get; set; }
public string Author { get; set; }
public double Price { get; set; }
public Guid TestEntityPersonId { get; set; }
// The problematic property
public TestEntityPerson TestEntityPerson { get; set; }
}
When I removed the TestEntityPerson property from the Book entity, the problem was solved.
EDIT: I suppose this is not a real solution, since it should be OK to have inverse navigation properties, but in this case it was causing a problem.
referring to this link : http://www.objc.io/issue-5/multitasking.html i can now send a silent push notification on ios by setting content-available=1
i'm using moon apns on c# to send the push notification but i can not find this property to send a silent push (i'm using a development certificate)
below is my code :
string p12File = "test.p12";
string p12FilePassword = "1234";
bool sandbox = false;
var push = new PushNotification(sandbox, p12File, p12FilePassword);
NotificationPayload payload1;
payload1 = new NotificationPayload(testDeviceToken, message, 0, "Silence.m4R");
payload1.AddCustom("message", "HIDDEN");
var notificationList = new List<NotificationPayload>() { payload1 };
var rejected = push.SendToApple(notificationList);
foreach (var item in rejected)
{
return false;
}
any idea how can send this using moon apns :
{
"aps" : {
"content-available" : 1
},
"content-id" : 42
}
System;
using System.Collections.Generic;
using System.Text;
using Newtonsoft.Json.Linq;
namespace MoonAPNS
{
public class NotificationPayload
{
public NotificationAlert Alert { get; set; }
public string DeviceToken { get; set; }
public int? Badge { get; set; }
public string Sound { get; set; }
internal int PayloadId { get; set; }
public int Content_available { get; set; }
public Dictionary<string, object[]> CustomItems
{
get;
private set;
}
public NotificationPayload(string deviceToken)
{
DeviceToken = deviceToken;
Alert = new NotificationAlert();
CustomItems = new Dictionary<string, object[]>();
}
public NotificationPayload(string deviceToken, string alert)
{
DeviceToken = deviceToken;
Alert = new NotificationAlert() { Body = alert };
CustomItems = new Dictionary<string, object[]>();
}
public NotificationPayload(string deviceToken, string alert, int badge)
{
DeviceToken = deviceToken;
Alert = new NotificationAlert() { Body = alert };
Badge = badge;
CustomItems = new Dictionary<string, object[]>();
}
public NotificationPayload(string deviceToken, string alert, int badge, string sound)
{
DeviceToken = deviceToken;
Alert = new NotificationAlert() { Body = alert };
Badge = badge;
Sound = sound;
CustomItems = new Dictionary<string, object[]>();
}
public NotificationPayload(string deviceToken, string alert, int badge, string sound,int content_available)
{
DeviceToken = deviceToken;
Alert = new NotificationAlert() { Body = alert };
Badge = badge;
Sound = sound;
Content_available = content_available;
CustomItems = new Dictionary();
}
public void AddCustom(string key, params object[] values)
{
if (values != null)
this.CustomItems.Add(key, values);
}
public string ToJson()
{
JObject json = new JObject();
JObject aps = new JObject();
if (!this.Alert.IsEmpty)
{
if (!string.IsNullOrEmpty(this.Alert.Body)
&& string.IsNullOrEmpty(this.Alert.LocalizedKey)
&& string.IsNullOrEmpty(this.Alert.ActionLocalizedKey)
&& (this.Alert.LocalizedArgs == null || this.Alert.LocalizedArgs.Count <= 0))
{
aps["alert"] = new JValue(this.Alert.Body);
}
else
{
JObject jsonAlert = new JObject();
if (!string.IsNullOrEmpty(this.Alert.LocalizedKey))
jsonAlert["loc-key"] = new JValue(this.Alert.LocalizedKey);
if (this.Alert.LocalizedArgs != null && this.Alert.LocalizedArgs.Count > 0)
jsonAlert["loc-args"] = new JArray(this.Alert.LocalizedArgs.ToArray());
if (!string.IsNullOrEmpty(this.Alert.Body))
jsonAlert["body"] = new JValue(this.Alert.Body);
if (!string.IsNullOrEmpty(this.Alert.ActionLocalizedKey))
jsonAlert["action-loc-key"] = new JValue(this.Alert.ActionLocalizedKey);
aps["alert"] = jsonAlert;
}
}
if (this.Badge.HasValue)
aps["badge"] = new JValue(this.Badge.Value);
if (!string.IsNullOrEmpty(this.Sound))
aps["sound"] = new JValue(this.Sound);
if (this.Content_available == 1)
aps["content-available"] = new JValue(this.Content_available);
json["aps"] = aps;
foreach (string key in this.CustomItems.Keys)
{
if (this.CustomItems[key].Length == 1)
json[key] = new JValue(this.CustomItems[key][0]);
else if (this.CustomItems[key].Length > 1)
json[key] = new JArray(this.CustomItems[key]);
}
string rawString = json.ToString(Newtonsoft.Json.Formatting.None, null);
StringBuilder encodedString = new StringBuilder();
foreach (char c in rawString)
{
if ((int)c < 32 || (int)c > 127)
encodedString.Append("\\u" + String.Format("{0:x4}", Convert.ToUInt32(c)));
else
encodedString.Append(c);
}
return rawString;// encodedString.ToString();
}
public override string ToString()
{
return ToJson();
}
}