Saving Object to IsolatedStorage in WP7 with XNA 4.0 - windows-phone-7

How can I go about saving an object of type GameSettings to IsolatedStorage on a Windows Phone 7 application made with XNA 4.0?
From what I can tell, you can't flag a class as serializable and ByteFormatter isn't available. I haven't come across a good way to convert an object to a byte array and write the array to the storage. And going beyond that, I have no idea how to go about converting said byte array back into an object.
Any help would be greatly appreciated!

There is no built in binary formatter on the platform but it does support XML and JSON serialization using the DataContractSerializer and DataContractJsonSerializer classes.
You can configure what is serialized via the DataContract and DataMember attributes.

Related

How To Store Data On Icloud in xamarin form.ios

enter image description hereThis Below my data I want to store on IClouds IOS, How Can I do that ,is it possible to store on iClouds ,please give me a code for that
enter image description here
This Below my data I want to store on IClouds IOS, How Can I do that ,is it possible to store on iClouds ,please give me a code for that
To save the "MyFun item" data, it is recommended to serialize the data and save it to a json file or an xml file.
For JSON serialization, you can install the Nuget package Newtonsoft.Json. For more info, you can refer to this document.
Or XML serialization, you can create an instance of XmlSerializer Class to serializes and deserializes objects into and from XML document.
Here are some related SO threads you can refer to.
How to write a JSON file in C#?
Serialize an object to XML
If you have got the serialized data, as mentioned in the comment, you can download official demo Xamarin.iOS - Introduction to iCloud, then pass it to MonkeyDocument.DocumentString.

Is there any solution to map CSV data to object at runtime in Xamarin?

I tried using CSVHelper GetRecords. Its not working for iOS.Kindly anyone help on this.I need to map csv data to any object at runtime,without parsing for seperate object each and every time. Always CSVHelper fails in iOS.
ServiceStack.Text has a Xamarin component that includes CSV support

Get resources in converter?

What is the best way to get resource string or drawable in convert method of MvxConverter?
Can I access to current context or I have to manage static tracking?
Thanks
What is the best way to get resource string or drawable in convert method of MvxConverter?
There are some standard bindings that get access to resources, e.g.
MvxImageViewDrawableTargetBinding.cs
MvxImageViewImageTargetBinding.cs
There's also at least one example of using resources in a custom binding:
FavoritesButtonBinding.cs
You could do similar code in an MvxValueConverter rather than in a custom binding if you would prefer it (but that converter would not then be usable across multiple platforms).
Can I access to current context?
You can normally get access to Android Context objects using Mvx.Resolve<T> on:
IMvxAndroidGlobals.cs
IMvxAndroidCurrentTopActivity.cs
For i18n text cross-platform alternatives to Android strings are also available - from Vernacular and from Mvx - see http://slodge.blogspot.co.uk/2013/05/n21-internationalisation-i18n-n1-days.html
I have to manage static tracking?
No idea what this is. Sorry

Archiving an object in Dot Net and unarchiving in Cocoa

I have a web service which is written in DotNet and returns a archived class object which I need to unarchive in a Cocoa app.
Is this possible?
I tried to use the information in How to encode/decode a long long property with NSCoder?, but I don't know the key to decode it, and my attempts caused a crash.
Should I be using NSCoder, or something else?
I would serialize and deserialze in a well known interchange format, like YAML, XML(XML::RPC, SOAP) or JSON, I would probably go with JSON. if you are on iOS and able to target only iOS 5.0 and later; then there is a built in class NSJSONSerialization, otherwise you should investigate SBJSON.

Soap Serialization/Deserialization on Windows Phone 7

Please help me..I wanna serialize/deserialize an object on WP7 on visual studio 2010 with c#. Why I can not use soapformatter? How can I do soap serialization/deserialization on wp7?
Is there a reason you need to use the Soap serializer?
If not (if you just need to do serialization to file for example), you can just use the XmlSerializer (which is very close to the Soap one iirc) and the DataContract one. My recommendation is to use the DataContract one with an empty namespace.
XmlSerializer:
http://msdn.microsoft.com/en-us/library/system.xml.serialization.xmlserializer(v=vs.95).aspx
DataContract:
http://msdn.microsoft.com/en-us/library/system.runtime.serialization.datacontractserializer(v=vs.95).aspx

Resources