title: Creating a unity3d plugin for reading/writing save games on Windows store/phone
body: <p>I'm trying to create the plugin described in the title. But I cant seem to get it to work with unity. Following the instructions I created the real plugin and placed it in the WSA folder in the Plugins folder. Then I created a fake plugin for the editor to use. I'm getting a <code>Internal compiler error.</code>. Here is the code I have so far if it helps. </p>
  
  <pre><code>using System;
  using System.IO;
  using System.Collections.Generic;
  using System.Xml.Serialization;
  using System.Linq;
  using System.Text;
  using System.Threading.Tasks;
  using PCLStorage;
  namespace MyIO
  {
      public static class Serializer
      {
          private static string fileText;
          public static string FileText
          {
              get { return fileText; }
              set
              {
                  if (FileText == value) return;
                  fileText = value;
  
              }
          }
          public static async Task WriteData(GameData data)
          {
              XmlSerializer serializer = new XmlSerializer(typeof(GameData));
              IFolder rootFolder = FileSystem.Current.LocalStorage;
  
              IFolder folder = await rootFolder.CreateFolderAsync("ArabianHeroesSaveGames",CreationCollisionOption.OpenIfExists);
              IFile file = await folder.CreateFileAsync("SaveGame.dat",CreationCollisionOption.ReplaceExisting);
              await file.WriteAllTextAsync(SerializeObject&lt;GameData&gt;(data));
  
          }
          public static async Task&lt;GameData&gt; LoadData()
          {
              IFolder rootFolder = FileSystem.Current.LocalStorage;
              IFolder folder = await rootFolder.CreateFolderAsync("ArabianHeroesSaveGames", CreationCollisionOption.OpenIfExists);
              IFile file = await folder.GetFileAsync("SaveGame.dat");
              using (var stream = await file.OpenAsync(FileAccess.Read))
              {
                  using (var reader = new StreamReader(stream))
                  {
                      FileText = await reader.ReadToEndAsync();
                      return DeserializeObject&lt;GameData&gt;(FileText);
                  }
              }
  
          }
          public static T DeserializeObject&lt;T&gt;(string s)
          {
              XmlSerializer xmlSerializer = new XmlSerializer(typeof(T));
              using (StringReader textReader = new StringReader(s))
              {
                 return  (T)xmlSerializer.Deserialize(textReader);
              }
          }
          public static string SerializeObject&lt;T&gt;(this T toSerialize)
          {
              XmlSerializer xmlSerializer = new XmlSerializer(toSerialize.GetType());
  
              using (StringWriter textWriter = new StringWriter())
              {
                  xmlSerializer.Serialize(textWriter, toSerialize);
                  return textWriter.ToString();
              }
          }
      }
  }
  </code></pre>
  
  <p>the fake plugin has the same method names but they dont return the same type since the fake plugin has to be a .Net 3.5 project. I'm using the <code>#if NETFX_CORE</code> to call the different methods.</p>