public async Task <Tuple <bool, string> > ProcessQueueMessage(Message message, CancellationToken token) { bool success = true; string result = ""; if (message != null) { try { var body = message.GetBody <string>(); if (!String.IsNullOrWhiteSpace(body)) { DistributionListQueueItem dlqi = null; try { dlqi = ObjectSerialization.Deserialize <DistributionListQueueItem>(body); } catch (Exception ex) { success = false; result = "Unable to parse message body Exception: " + ex.ToString(); //message.Complete(); await _client.CompleteAsync(message.SystemProperties.LockToken); } await ProcessDistributionListQueueItem(dlqi); } try { if (success) { await _client.CompleteAsync(message.SystemProperties.LockToken); } //message.Complete(); } catch (MessageLockLostException) { } } catch (Exception ex) { result = ex.ToString(); Logging.LogException(ex); //message.Abandon(); await _client.DeadLetterAsync(message.SystemProperties.LockToken); } } return(new Tuple <bool, string>(success, result)); }
public static Tuple <bool, string> ProcessQueueMessage(BrokeredMessage message) { bool success = true; string result = ""; if (message != null) { try { var body = message.GetBody <string>(); if (!String.IsNullOrWhiteSpace(body)) { CqrsEvent qi = null; try { qi = ObjectSerialization.Deserialize <CqrsEvent>(body); } catch (Exception ex) { success = false; result = "Unable to parse message body Exception: " + ex.ToString(); message.Complete(); } success = ProcessPaymentQueueItem(qi); } try { if (success) { message.Complete(); } } catch (MessageLockLostException) { } } catch (Exception ex) { Logging.LogException(ex); Logging.SendExceptionEmail(ex, "PaymentQueueLogic"); message.Abandon(); success = false; result = ex.ToString(); } } return(new Tuple <bool, string>(success, result)); }
public void EnqueueMessage(MessageQueueItem messageQueue) { if (SystemBehaviorConfig.ServiceBusType == ServiceBusTypes.Rabbit) { _rabbitOutboundQueueProvider.EnqueueMessage(messageQueue); return; } VerifyAndCreateClients(); string serializedObject = String.Empty; if (messageQueue != null && messageQueue.Message != null && messageQueue.MessageId == 0 && messageQueue.Message.MessageId != 0) { messageQueue.MessageId = messageQueue.Message.MessageId; } try { serializedObject = ObjectSerialization.Serialize(messageQueue); // We are limited to 256KB in azure queue messages var size = ASCIIEncoding.Unicode.GetByteCount(serializedObject); if (size > 220000) { messageQueue.Profiles = null; serializedObject = ObjectSerialization.Serialize(messageQueue); } if (ASCIIEncoding.Unicode.GetByteCount(serializedObject) > 220000) { messageQueue.Message.MessageRecipients = null; serializedObject = ObjectSerialization.Serialize(messageQueue); } } catch { } // If we get an Exception, i.e. OutOfMemmory, lets just strip out the heavy data and try. if (String.IsNullOrWhiteSpace(serializedObject)) { messageQueue.Profiles = null; messageQueue.Message.MessageRecipients = null; serializedObject = ObjectSerialization.Serialize(messageQueue); } BrokeredMessage message = new BrokeredMessage(serializedObject); message.MessageId = string.Format("{0}|{1}", messageQueue.Message.MessageId, messageQueue.Message.ReceivingUserId); SendMessage(_messageClient, message); }
//[Test] public void TestSerialization() { TestObject testObj = new TestObject() { Id = 500, Data = "This is just a test object. TestStringToSearchOn" }; var test = ObjectSerialization.Serialize(testObj); test.Should().NotBeNullOrWhiteSpace(); test.Should().Contain("500"); test.Should().Contain("TestStringToSearchOn"); }
/// <summary> /// Sends the message. /// </summary> /// <param name="channel">Channel socket to use.</param> /// <param name="subchannel">Subchannel v-socket to use.</param> /// <param name="message">Message to send.</param> /// <param name="method">Method to use for socket transport.</param> public static void SendMessage(int channel, int subchannel, object message, NetDeliveryMethod method) { NetOutgoingMessage msg = Connection.CreateMessage(); msg.WriteRangedInteger(0, TOTAL_CHANNELS, channel * CHANNEL_SIZE + subchannel); msg.WritePadBits(); byte[] serialized = ObjectSerialization.ObjectToByteArray(message); msg.Write(serialized.Length); msg.WritePadBits(); msg.Write(serialized); Connection.SendMessage(msg, method); }
public static Tuple <bool, string> ProcessQueueMessage(BrokeredMessage message) { bool success = true; string result = ""; if (message != null) { try { var body = message.GetBody <string>(); if (!String.IsNullOrWhiteSpace(body)) { DistributionListQueueItem dlqi = null; try { dlqi = ObjectSerialization.Deserialize <DistributionListQueueItem>(body); } catch (Exception ex) { success = false; result = "Unable to parse message body Exception: " + ex.ToString(); message.Complete(); } ProcessDistributionListQueueItem(dlqi); } try { if (success) { message.Complete(); } } catch (MessageLockLostException) { } } catch (Exception ex) { result = ex.ToString(); Logging.LogException(ex); message.Abandon(); } } return(new Tuple <bool, string>(success, result)); }
public bool EnqueuePaymentEvent(CqrsEvent cqrsEvent) { if (Config.SystemBehaviorConfig.ServiceBusType == Config.ServiceBusTypes.Rabbit) { _rabbitOutboundQueueProvider.EnqueuePaymentEvent(cqrsEvent); return(true); } var serializedObject = ObjectSerialization.Serialize(cqrsEvent); BrokeredMessage message = new BrokeredMessage(serializedObject); message.MessageId = string.Format("{0}", cqrsEvent.EventId); return(SendMessage(_systemClient, message)); }
public async Task <bool> EnqueuePaymentEventAsync(CqrsEvent cqrsEvent) { if (Config.SystemBehaviorConfig.ServiceBusType == Config.ServiceBusTypes.Rabbit) { _rabbitOutboundQueueProvider.EnqueuePaymentEvent(cqrsEvent); return(true); } var serializedObject = ObjectSerialization.Serialize(cqrsEvent); Message message = new Message(Encoding.UTF8.GetBytes(serializedObject)); message.MessageId = string.Format("{0}", cqrsEvent.EventId); return(await SendMessageAsync(_systemClient, message)); }
public async Task <List <PersonnelListStatusOrder> > GetDepartmentPersonnelListStatusSortOrderAsync(int departmentId) { var settingValue = await GetSettingByDepartmentIdType(departmentId, DepartmentSettingTypes.PersonnelListStatusSortOrder); if (settingValue != null) { var setting = ObjectSerialization.Deserialize <PersonnelListStatusOrderSetting>(settingValue.Setting); if (setting != null) { return(setting.Orders); } } return(null); }
public async Task <bool> EnqueueNotification(NotificationItem notificationQueue) { if (SystemBehaviorConfig.ServiceBusType == ServiceBusTypes.Rabbit) { return(_rabbitOutboundQueueProvider.EnqueueNotification(notificationQueue)); } VerifyAndCreateClients(); Message message = new Message(Encoding.UTF8.GetBytes(ObjectSerialization.Serialize(notificationQueue))); message.MessageId = string.Format("{0}", notificationQueue.GetHashCode()); return(await SendMessage(_notificationClient, message)); }
public async Task <bool> EnqueueShiftNotification(ShiftQueueItem shiftQueueItem) { if (SystemBehaviorConfig.ServiceBusType == ServiceBusTypes.Rabbit) { return(_rabbitOutboundQueueProvider.EnqueueShiftNotification(shiftQueueItem)); } VerifyAndCreateClients(); Message message = new Message(Encoding.UTF8.GetBytes(ObjectSerialization.Serialize(shiftQueueItem))); message.MessageId = Guid.NewGuid().ToString(); return(await SendMessage(_shiftsClient, message)); }
public void EnqueueNotification(NotificationItem notificationQueue) { if (SystemBehaviorConfig.ServiceBusType == ServiceBusTypes.Rabbit) { _rabbitOutboundQueueProvider.EnqueueNotification(notificationQueue); return; } VerifyAndCreateClients(); BrokeredMessage message = new BrokeredMessage(ObjectSerialization.Serialize(notificationQueue)); message.MessageId = string.Format("{0}", notificationQueue.GetHashCode()); SendMessage(_notificationClient, message); }
public void EnqueueShiftNotification(ShiftQueueItem shiftQueueItem) { if (SystemBehaviorConfig.ServiceBusType == ServiceBusTypes.Rabbit) { _rabbitOutboundQueueProvider.EnqueueShiftNotification(shiftQueueItem); return; } VerifyAndCreateClients(); BrokeredMessage message = new BrokeredMessage(ObjectSerialization.Serialize(shiftQueueItem)); message.MessageId = Guid.NewGuid().ToString(); SendMessage(_shiftsClient, message); }
/// <summary> /// Gets the TMDb API configuration from the TMdbEasy client. /// </summary> /// <param name="easy">An instance to a TMdbEasy client.</param> /// <param name="configFileName">A name of the configuration file.</param> /// <returns>A Configurations class instance from the TMdbEasy client class instance.</returns> private static Configurations GetApiConfig(EasyClient easy, string configFileName) { configApi = easy.GetApi <IConfigApi>().Value; // get the API.. // get the Configurations class instance synchronously.. Configurations configurations = configApi.GetConfigurationAsync().Result; // serialize the Configurations class instance to a XML document.. XmlDocument xmlDocument = ObjectSerialization.ToXmlDocument(configurations); // save the XML document.. xmlDocument.Save(configFileName); // return the Configurations class instance.. return(configurations); }
public void EnqueueDistributionList(DistributionListQueueItem distributionListQueue) { if (SystemBehaviorConfig.ServiceBusType == ServiceBusTypes.Rabbit) { _rabbitOutboundQueueProvider.EnqueueDistributionList(distributionListQueue); return; } VerifyAndCreateClients(); string serializedObject = String.Empty; try { serializedObject = ObjectSerialization.Serialize(distributionListQueue); // We are limited to 256KB in azure queue messages var size = ASCIIEncoding.Unicode.GetByteCount(serializedObject); if (size > 220000) { distributionListQueue.Users = null; serializedObject = ObjectSerialization.Serialize(distributionListQueue); } // If were still too big, strip out some attachments if (size > 220000) { distributionListQueue.Message.Attachments = null; serializedObject = ObjectSerialization.Serialize(distributionListQueue); } } catch { } // If we get an Exception, i.e. OutOfMemmory, lets just strip out the heavy data and try. if (String.IsNullOrWhiteSpace(serializedObject)) { distributionListQueue.Users = null; distributionListQueue.Message.Attachments = null; serializedObject = ObjectSerialization.Serialize(distributionListQueue); } BrokeredMessage message = new BrokeredMessage(serializedObject); message.MessageId = string.Format("{0}|{1}", distributionListQueue.Message.MessageID, distributionListQueue.List.DistributionListId); SendMessage(_distributionListClient, message); }
/// <summary> /// AOT向けにシリアライザを生成する /// </summary> public static void GenerateCode() { var info = new ObjectSerialization(typeof(glTF_VRM_extensions), "vrm", "Serialize_"); Debug.Log(info); using (var s = File.Open(OutPath, FileMode.Create)) using (var w = new StreamWriter(s, new UTF8Encoding(false))) { w.Write(Begin); info.GenerateSerializer(w, "Serialize"); w.Write(End); } Debug.LogFormat("write: {0}", OutPath); UnityPath.FromFullpath(OutPath).ImportAsset(); }
public static void WriteDeserializationForMethods(this CodeWriter writer, ObjectSerialization serialization, bool async, Action <CodeWriter, CodeWriterDelegate> valueCallback, string responseVariable) { switch (serialization) { case JsonSerialization jsonSerialization: writer.WriteDeserializationForMethods(jsonSerialization, async, valueCallback, responseVariable); break; case XmlElementSerialization xmlSerialization: writer.WriteDeserializationForMethods(xmlSerialization, valueCallback, responseVariable); break; default: throw new NotImplementedException(serialization.ToString()); } }
static void GenerateSerializerTypes(System.Type type) { var info = new ObjectSerialization(type, "vci", "Serialize_"); Debug.Log(info); var name = string.Format("{0}_Serialize", type.Name); using (var s = File.Open(GetPath(name), FileMode.Create)) using (var w = new StreamWriter(s, new UTF8Encoding(false))) { w.NewLine = "\n"; w.Write(@" using System; using System.Collections.Generic; using UniJSON; using UnityEngine; using UniGLTF; using VCI; using Object = System.Object; namespace VCI { public static class "); w.Write(@" " + type.Name + "_Serializer"); w.Write(@" { "); info.GenerateSerializer(w, "Serialize"); // footer w.Write(@" } // VciSerializer } // VCI "); } // CRLF を LF に変換して再保存 File.WriteAllText(GetPath(name), File.ReadAllText(GetPath(name), Encoding.UTF8).Replace("\r\n", "\n"), Encoding.UTF8); Debug.LogFormat("write: {0}", GetPath(name)); UnityPath.FromFullpath(GetPath(name)).ImportAsset(); }
private void start() { byte[] binary = null; MemoryStream stream = null; ISubscriber sub = connection.GetSubscriber(); Feed feed = null; sub.Subscribe(((Exchange)Enum.Parse(typeof(Exchange), SelectedExchange)).ToString(), (channel, message) => { string str = message; binary = Convert.FromBase64String(message); stream = new MemoryStream(binary); feed = (Feed)ObjectSerialization.DeserializeFromStream(stream); double[] stockData = new double[2]; stockData[0] = feed.TimeStamp; stockData[1] = feed.LTP; if (stockData != null && stockData.Length != 0) { Clients.Group(feed.SymbolId.ToString() + "_" + SelectedExchange).updatePoints(stockData[0], stockData[1]); } }); sub.Subscribe(Constants.REDIS_MVA_ROOM_PREFIX + SelectedSymbolId, (channel, message) => { string str = message; double[] stockData = new double[2]; stockData[0] = Convert.ToInt64((DateTime.Now - new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc)).TotalMilliseconds); stockData[1] = Convert.ToDouble(message); if (stockData != null && stockData.Length != 0) { Clients.Group(SelectedSymbolId + "_" + SelectedExchange).updatePointsMVA(stockData[0], stockData[1]); } }); while (true) { Thread.Sleep(600000); } }
private void ExecuteHostCommand() { var openFileDialog = new OpenFileDialog(); openFileDialog.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments); openFileDialog.DefaultExt = ".bin"; var viewModel = new HostExamViewModel(); if (openFileDialog.ShowDialog() == true) { var fileName = openFileDialog.FileName; var serializer = new ObjectSerialization <Exam>(null, fileName); var exam = serializer.DeSerialize(); viewModel.Exam = exam; CurrentViewModel = viewModel; } }
private ResponseBody?BuildResponseBody(ServiceResponse response) { ResponseBody?responseBody = null; if (response is SchemaResponse schemaResponse) { Schema schema = schemaResponse.Schema is ConstantSchema constantSchema ? constantSchema.ValueType : schemaResponse.Schema; CSharpType responseType = TypeFactory.GetOutputType(_context.TypeFactory.CreateType(schema, isNullable: false)); ObjectSerialization serialization = _serializationBuilder.Build(response.HttpResponse.KnownMediaType, schema, responseType); responseBody = new ObjectResponseBody(responseType, serialization); } else if (response is BinaryResponse) { responseBody = new StreamResponseBody(); } return(responseBody); }
private void ExecuteSaveCommand() { var saveFileDialog = new SaveFileDialog(); saveFileDialog.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments); saveFileDialog.FileName = ExamName; saveFileDialog.DefaultExt = ".bin"; if (saveFileDialog.ShowDialog() == true) { var fileName = saveFileDialog.FileName; if (ExamGuid.Equals(new Guid("00000000-0000-0000-0000-000000000000"))) { ExamGuid = Guid.NewGuid(); } var exam = new Exam(ExamName, ExamGuid, Questions.ToList()); var serializer = new ObjectSerialization <Exam>(exam, fileName); serializer.Serialize(); } }
private static void SubscribeRedis() { ConnectionMultiplexer connection = null; connection = GetRedisConnection(); ISubscriber sub = connection.GetSubscriber(); sub.Subscribe(_exchange, (channel, message) => { lock (_lockQueue) { byte[] binary = Convert.FromBase64String(message); MemoryStream stream = new MemoryStream(binary); Feed feed = (Feed)ObjectSerialization.DeserializeFromStream(stream); //send to NEsper _runtime.SendEvent(feed); } }); sender = SenderFactory.GetSender(FeederQueueSystem.REDIS_CACHE); }
public HttpResponseMessage NotifyNewChat([FromBody] NotifyChatInput notifyChatInput) { if (notifyChatInput != null && notifyChatInput.RecipientUserIds != null && notifyChatInput.RecipientUserIds.Count > 0) { var newChatEvent = new NewChatNotificationEvent(); newChatEvent.Id = notifyChatInput.Id; newChatEvent.GroupName = notifyChatInput.GroupName; newChatEvent.Message = notifyChatInput.Message; newChatEvent.RecipientUserIds = notifyChatInput.RecipientUserIds; newChatEvent.SendingUserId = notifyChatInput.SendingUserId; newChatEvent.Type = notifyChatInput.Type; CqrsEvent registerUnitPushEvent = new CqrsEvent(); registerUnitPushEvent.Type = (int)CqrsEventTypes.NewChatMessage; registerUnitPushEvent.Timestamp = DateTime.UtcNow; registerUnitPushEvent.Data = ObjectSerialization.Serialize(newChatEvent); _cqrsProvider.EnqueueCqrsEvent(registerUnitPushEvent); } return(Request.CreateResponse(HttpStatusCode.OK)); }
//public static void SetLeader(string username) //{ // SendMessage(Channels.Lobby, LobbyChannel., username, NetDeliveryMethod.ReliableOrdered); //} #endregion public static void HandleRequest(NetIncomingMessage message) { int channel = message.SequenceChannel; int subChannel = message.ReadRangedInteger(0, TOTAL_CHANNELS); int key = channel * CHANNEL_SIZE + subChannel; Hooks.TryGetValue(key, out List <Tuple <Action <object>, bool> > hooks); if (hooks != null) { int numberOfBytes = message.ReadInt32(); message.SkipPadBits(); byte[] data = message.ReadBytes(numberOfBytes); for (int i = 0; i < hooks.Count; i++) { hooks[i]?.Item1?.Invoke(ObjectSerialization.ByteArrayToObject(data)); } } else { Console.WriteLine("Channel not handeled: {0}, {1}", channel, subChannel); } }
public void EnqueueMessage(MessageQueueItem messageQueue) { string serializedObject = String.Empty; if (messageQueue != null && messageQueue.Message != null && messageQueue.MessageId == 0 && messageQueue.Message.MessageId != 0) { messageQueue.MessageId = messageQueue.Message.MessageId; } try { serializedObject = ObjectSerialization.Serialize(messageQueue); // We are limited to 256KB in azure queue messages var size = ASCIIEncoding.Unicode.GetByteCount(serializedObject); if (size > 220000) { messageQueue.Profiles = null; serializedObject = ObjectSerialization.Serialize(messageQueue); } if (ASCIIEncoding.Unicode.GetByteCount(serializedObject) > 220000) { messageQueue.Message.MessageRecipients = null; serializedObject = ObjectSerialization.Serialize(messageQueue); } } catch { } // If we get an Exception, i.e. OutOfMemmory, lets just strip out the heavy data and try. if (String.IsNullOrWhiteSpace(serializedObject)) { messageQueue.Profiles = null; messageQueue.Message.MessageRecipients = null; serializedObject = ObjectSerialization.Serialize(messageQueue); } SendMessage(ServiceBusConfig.MessageBroadcastQueueName, serializedObject); }
public async Task <ActionResult> NotifyNewChat([FromBody] NotifyChatInput notifyChatInput) { if (notifyChatInput != null && notifyChatInput.RecipientUserIds != null && notifyChatInput.RecipientUserIds.Count > 0) { var newChatEvent = new NewChatNotificationEvent(); newChatEvent.Id = notifyChatInput.Id; newChatEvent.GroupName = notifyChatInput.GroupName; newChatEvent.Message = notifyChatInput.Message; newChatEvent.RecipientUserIds = notifyChatInput.RecipientUserIds; newChatEvent.SendingUserId = notifyChatInput.SendingUserId; newChatEvent.Type = notifyChatInput.Type; CqrsEvent registerUnitPushEvent = new CqrsEvent(); registerUnitPushEvent.Type = (int)CqrsEventTypes.NewChatMessage; registerUnitPushEvent.Timestamp = DateTime.UtcNow; registerUnitPushEvent.Data = ObjectSerialization.Serialize(newChatEvent); await _cqrsProvider.EnqueueCqrsEventAsync(registerUnitPushEvent); } return(Ok()); }
private void ExecuteEditExamCommand() { var openFileDialog = new OpenFileDialog(); openFileDialog.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments); openFileDialog.DefaultExt = ".bin"; var viewModel = new CreateExamViewModel(); if (openFileDialog.ShowDialog() == true) { var fileName = openFileDialog.FileName; var serializer = new ObjectSerialization <Exam>(null, fileName); var exam = serializer.DeSerialize(); viewModel.ExamName = exam.ExamTitle; viewModel.Questions = new ObservableCollection <BaseQuestion>(exam.QuestionList); viewModel.ExamGuid = exam.ExamId; CurrentViewModel = viewModel; } }
public async Task <bool> EnqueueCall(CallQueueItem callQueue) { if (SystemBehaviorConfig.ServiceBusType == ServiceBusTypes.Rabbit) { return(_rabbitOutboundQueueProvider.EnqueueCall(callQueue)); } VerifyAndCreateClients(); string serializedObject = String.Empty; try { serializedObject = ObjectSerialization.Serialize(callQueue); // We are limited to 256KB in azure queue messages var size = ASCIIEncoding.Unicode.GetByteCount(serializedObject); if (size > 220000) { callQueue.Profiles = null; serializedObject = ObjectSerialization.Serialize(callQueue); } } catch { } // If we get an Exception, i.e. OutOfMemmory, lets just strip out the heavy data and try. if (String.IsNullOrWhiteSpace(serializedObject)) { callQueue.Profiles = null; serializedObject = ObjectSerialization.Serialize(callQueue); } Message message = new Message(Encoding.UTF8.GetBytes(serializedObject)); message.MessageId = string.Format("{0}|{1}", callQueue.Call.CallId, callQueue.Call.DispatchCount); return(await SendMessage(_callClient, message)); }
/// <summary> /// Initializes the object based on the serialized data. /// </summary> /// <param name="info">The SerializationInfo that holds the serialized object data.</param> /// <param name="context">The StreamingContext that contains contextual /// information about the source.</param> public ModelParameterDateSequence(SerializationInfo info, StreamingContext context) : base(info, context) { // Set the default for GenerateSequenceFromStartDate and FollowFrequency GenerateSequenceFromStartDate = true; FollowFrequency = true; int serialializedVersion; try { serialializedVersion = info.GetInt32("_VersionDateSequence"); } catch { serialializedVersion = 0; } if (serialializedVersion < 2) { #region No expressions try { this.StartDate = new DateTime(info.GetInt64("_StartDate")); this.EndDate = new DateTime(info.GetInt64("_EndDate")); } catch (Exception) { // In case the calibration time was serialized in a different way. this.StartDate = info.GetDateTime("_StartDate"); this.EndDate = info.GetDateTime("_EndDate"); } int frequency = info.GetInt32("_Frequency"); Array enumValues = Enum.GetValues(typeof(DateFrequency)); foreach (DateFrequency value in enumValues) { if ((int)value == frequency) { Frequency = value; break; } } if (serialializedVersion >= 1) { // Introduction of ExcludeStartDate bool exclude = info.GetBoolean("_ExcludeStartDate"); SkipPeriods = exclude ? new ModelParameter(1) : new ModelParameter((double)0); } else { SkipPeriods = new ModelParameter((double)0); } #endregion // No expressions } else { if (serialializedVersion < 4) { string tmpS = info.GetString("_StartDateExpression"); DateTime tmpD; if (DateTime.TryParseExact(tmpS, "yyyy-MM-dd", CultureInfo.CurrentCulture, DateTimeStyles.None, out tmpD)) { StartDate = tmpD; } else { StartDateExpression = new ModelParameter(tmpS); } tmpS = info.GetString("_EndDateExpression"); if (DateTime.TryParseExact(tmpS, "yyyy-MM-dd", CultureInfo.CurrentCulture, DateTimeStyles.None, out tmpD)) { EndDate = tmpD; } else { EndDateExpression = new ModelParameter(tmpS); } } else { StartDateExpression = (ModelParameter)info.GetValue("_StartDateExpression", typeof(ModelParameter)); EndDateExpression = (ModelParameter)info.GetValue("_EndDateExpression", typeof(ModelParameter)); SetupExportedIDs(); } FrequencyExpression = info.GetString("_FrequencyExpression"); if (serialializedVersion >= 3) { // FollowFrequency and GenerateSequenceFromStartDate in version 3 FollowFrequency = info.GetBoolean("_FollowFrequency"); GenerateSequenceFromStartDate = info.GetBoolean("_GenerateSequenceFromStartDate"); } // Skip Periods introduced in version 5 if (serialializedVersion < 5) { bool exclude = info.GetBoolean("_ExcludeStartDate"); SkipPeriods = exclude ? new ModelParameter(1) : new ModelParameter((double)0); } else { SkipPeriods = (ModelParameter)info.GetValue("_SkipPeriods", typeof(ModelParameter)); } if (serialializedVersion < 6) { VectorReferenceExpr = string.Empty; } else { VectorReferenceExpr = info.GetString("_VectorReferenceExpr"); SkipPeriodsArray = ObjectSerialization.GetValue <ModelParameter>(info, "_SkipPeriodsArray", new ModelParameter(0.0)); } } }