Serialize() public method

Builds a dictionary of name/value pairs.
Invalid type;obj
public Serialize ( GameInfo info ) : object>.IDictionary
info GameInfo
return object>.IDictionary
コード例 #1
0
ファイル: GameInfo.cs プロジェクト: kabili207/zora-sharp
 /// <summary>
 /// Writes the game info to the specified stream
 /// </summary>
 /// <param name="stream">The stream to write to</param>
 /// <example>
 /// This example demonstrates creating a .zora save file from a<see cref="GameInfo"/>
 /// object. If you have access to the file name you will be saving to, as in this
 /// example, you should consider using the <see cref="Write(string)"/> method instead.
 /// <code language="C#">
 /// GameInfo info = new GameInfo();
 /// string file = @"C:\Users\Link\Documents\my_game.zora";
 /// using (FileStream outFile = File.Create(file))
 /// {
 ///     info.Write(fileStream);
 /// }
 /// </code>
 /// </example>
 public void Write(Stream stream)
 {
     using (var swriter = new StreamWriter(stream))
     {
         GameInfoJsonConverter converter = new GameInfoJsonConverter();
         IDictionary<string, object> dict = converter.Serialize(this);
         string json = SimpleJson.SimpleJson.SerializeObject(dict);
         swriter.WriteLine(json);
     }
 }