public UserTileBinaryReader(Stream stream, UserTileBinary userTile) { if (stream == null) throw new ArgumentNullException("stream"); if (userTile == null) throw new ArgumentNullException("userTile"); this.stream = stream; this.userTile = userTile; }
public static UserTileBinary LoadFrom(Stream stream) { if (stream == null) throw new ArgumentNullException("stream"); var result = new UserTileBinary(); var reader = new UserTileBinaryReader(stream, result); reader.Read(); return result; }
static void SetUserTile(string userName, string path) { var userTile = new UserTileBinary { Format = "bmp", SourcePath = path }; userTile.SetImageData(Image.FromFile(path)); var userTileData = new MemoryStream(); userTile.SaveTo(userTileData); SetUserTileData(userName, userTileData.ToArray()); }