public object Deserialize(global::MongoDB.Bson.IO.BsonReader bsonReader, Type nominalType, Type actualType, IBsonSerializationOptions options) { if (nominalType != typeof(TriggerKey) || actualType != typeof(TriggerKey)) { var message = string.Format("Can't deserialize a {0} from {1}.", nominalType.FullName, this.GetType().Name); throw new BsonSerializationException(message); } var bsonType = bsonReader.CurrentBsonType; if (bsonType == BsonType.Document) { TriggerKey item; bsonReader.ReadStartDocument(); item = new TriggerKey( bsonReader.ReadString("Name"), bsonReader.ReadString("Group")); bsonReader.ReadEndDocument(); return item; } else if (bsonType == BsonType.Null) { bsonReader.ReadNull(); return null; } else { var message = string.Format("Can't deserialize a {0} from BsonType {1}.", nominalType.FullName, bsonType); throw new BsonSerializationException(message); } }
public object Deserialize(global::MongoDB.Bson.IO.BsonReader bsonReader, Type nominalType, Type actualType, IBsonSerializationOptions options) { if (!nominalType.IsAssignableFrom(typeof(JobDetailImpl)) || actualType != typeof(JobDetailImpl)) { var message = string.Format("Can't deserialize a {0} with {1}.", nominalType.FullName, this.GetType().Name); throw new BsonSerializationException(message); } var bsonType = bsonReader.GetCurrentBsonType(); if (bsonType == BsonType.Document) { bsonReader.ReadStartDocument(); BsonSerializer.Deserialize(bsonReader, typeof(JobKey)); bsonReader.ReadString("_t"); Assembly assembly = Assembly.Load(bsonReader.ReadString("_assembly")); Type jobType = assembly.GetType(bsonReader.ReadString("_class")); IJobDetail jobDetail = new JobDetailImpl( bsonReader.ReadString("Name"), bsonReader.ReadString("Group"), jobType, bsonReader.ReadBoolean("RequestRecovery"), bsonReader.ReadBoolean("Durable")); bsonReader.ReadBsonType(); JobDataMap map = (JobDataMap)BsonSerializer.Deserialize(bsonReader, typeof(JobDataMap)); /*bsonReader.ReadBsonType(); string description = (string)BsonSerializer.Deserialize(bsonReader, typeof(string));*/ jobDetail = jobDetail.GetJobBuilder() .UsingJobData(map) /*.WithDescription(description)*/ .Build(); bsonReader.ReadEndDocument(); return jobDetail; } else if (bsonType == BsonType.Null) { bsonReader.ReadNull(); return null; } else { var message = string.Format("Can't deserialize a {0} from BsonType {1}.", nominalType.FullName, bsonType); throw new BsonSerializationException(message); } }
public object Deserialize(global::MongoDB.Bson.IO.BsonReader bsonReader, Type nominalType, IBsonSerializationOptions options) { CalendarWrapper item = new CalendarWrapper(); bsonReader.ReadStartDocument(); item.Name = bsonReader.ReadString("_id"); var binaryData = bsonReader.ReadBinaryData("ContentStream"); item.Calendar = (ICalendar)new BinaryFormatter().Deserialize(new MemoryStream(binaryData.Bytes)); bsonReader.ReadEndDocument(); return item; }
protected override bool OnTransact(int code, global::Android.OS.Parcel data, global::Android.OS.Parcel reply, int flags) { switch (code) { case global::Android.OS.BinderConsts.InterfaceTransaction: reply.WriteString (descriptor); return true; case TransactionIsBillingSupported: { data.EnforceInterface (descriptor); int arg0 = default (int); arg0 = data.ReadInt (); String arg1 = default (String); arg1 = data.ReadString (); String arg2 = default (String); arg2 = data.ReadString (); var result = this.IsBillingSupported (arg0, arg1, arg2); reply.WriteNoException (); reply.WriteInt (result); data.WriteInt (arg0); data.WriteString (arg1); data.WriteString (arg2); return true; } case TransactionGetSkuDetails: { data.EnforceInterface (descriptor); int arg0 = default (int); arg0 = data.ReadInt (); String arg1 = default (String); arg1 = data.ReadString (); String arg2 = default (String); arg2 = data.ReadString (); global::Android.OS.Bundle arg3 = default (global::Android.OS.Bundle); arg3 = data.ReadInt () != 0 ? (global::Android.OS.Bundle) global::Android.OS.Bundle.Creator.CreateFromParcel (data) : null; var result = this.GetSkuDetails (arg0, arg1, arg2, arg3); reply.WriteNoException (); if (result != null) { reply.WriteInt (1); result.WriteToParcel (reply, global::Android.OS.ParcelableWriteFlags.ReturnValue); } else reply.WriteInt (0); data.WriteInt (arg0); data.WriteString (arg1); data.WriteString (arg2); return true; } case TransactionGetBuyIntent: { data.EnforceInterface (descriptor); int arg0 = default (int); arg0 = data.ReadInt (); String arg1 = default (String); arg1 = data.ReadString (); String arg2 = default (String); arg2 = data.ReadString (); String arg3 = default (String); arg3 = data.ReadString (); String arg4 = default (String); arg4 = data.ReadString (); var result = this.GetBuyIntent (arg0, arg1, arg2, arg3, arg4); reply.WriteNoException (); if (result != null) { reply.WriteInt (1); result.WriteToParcel (reply, global::Android.OS.ParcelableWriteFlags.ReturnValue); } else reply.WriteInt (0); data.WriteInt (arg0); data.WriteString (arg1); data.WriteString (arg2); data.WriteString (arg3); data.WriteString (arg4); return true; } case TransactionGetPurchases: { data.EnforceInterface (descriptor); int arg0 = default (int); arg0 = data.ReadInt (); String arg1 = default (String); arg1 = data.ReadString (); String arg2 = default (String); arg2 = data.ReadString (); String arg3 = default (String); arg3 = data.ReadString (); var result = this.GetPurchases (arg0, arg1, arg2, arg3); reply.WriteNoException (); if (result != null) { reply.WriteInt (1); result.WriteToParcel (reply, global::Android.OS.ParcelableWriteFlags.ReturnValue); } else reply.WriteInt (0); data.WriteInt (arg0); data.WriteString (arg1); data.WriteString (arg2); data.WriteString (arg3); return true; } case TransactionConsumePurchase: { data.EnforceInterface (descriptor); int arg0 = default (int); arg0 = data.ReadInt (); String arg1 = default (String); arg1 = data.ReadString (); String arg2 = default (String); arg2 = data.ReadString (); var result = this.ConsumePurchase (arg0, arg1, arg2); reply.WriteNoException (); reply.WriteInt (result); data.WriteInt (arg0); data.WriteString (arg1); data.WriteString (arg2); return true; } } return base.OnTransact (code, data, reply, flags); }