[longomatch] Make Image serilzable for all backends
- From: Andoni Morales Alastruey <amorales src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [longomatch] Make Image serilzable for all backends
- Date: Sat, 1 Jun 2013 10:45:05 +0000 (UTC)
commit 122fce3bc216c56f110e115c5780a070d51f5f79
Author: Andoni Morales Alastruey <ylatuya gmail com>
Date: Thu May 30 19:46:35 2013 +0200
Make Image serilzable for all backends
LongoMatch.Core/Common/Image.cs | 13 ++++++++++++-
1 files changed, 12 insertions(+), 1 deletions(-)
---
diff --git a/LongoMatch.Core/Common/Image.cs b/LongoMatch.Core/Common/Image.cs
index 9b993ed..3f5c4ad 100644
--- a/LongoMatch.Core/Common/Image.cs
+++ b/LongoMatch.Core/Common/Image.cs
@@ -15,6 +15,7 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
//
+using System.Runtime.Serialization;
namespace LongoMatch.Common
{
@@ -28,7 +29,7 @@ namespace LongoMatch.Common
#endif
[Serializable]
- public class Image
+ public class Image: ISerializable
{
SImage image;
@@ -51,6 +52,16 @@ namespace LongoMatch.Common
Scale (Constants.THUMBNAIL_MAX_WIDTH, Constants.THUMBNAIL_MAX_HEIGHT);
}
+ // this constructor is automatically called during deserialization
+ public Image (SerializationInfo info, StreamingContext context) {
+ image = Deserialize ((byte[]) info.GetValue ("pngbuf", typeof (byte[]))).Value;
+ }
+
+ // this method is automatically called during serialization
+ public void GetObjectData(SerializationInfo info, StreamingContext context) {
+ info.AddValue("pngbuf", Serialize());
+ }
+
#if HAVE_GTK
public byte[] Serialize () {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]