string ICustomerSerializable.ToSerializableString(eCustomerSerializableType type) { if (type == eCustomerSerializableType.FullStruct) { throw new NotImplementedException(); } var sb = new StringBuilder(GUID); sb.Append(CustomerSerializableProvider.ProcessMessageSplitString); sb.Append(CustomerSerializableProvider.ChkString_ProcessAttribute(ProcessID)); sb.Append(CustomerSerializableProvider.ProcessMessageSplitString); sb.Append(CustomerSerializableProvider.ChkString_ProcessAttribute(ProcessType)); sb.Append(CustomerSerializableProvider.ProcessMessageSplitString); sb.Append(CustomerSerializableProvider.ChkString_ProcessAttribute(Source)); sb.Append(CustomerSerializableProvider.ProcessMessageSplitString); sb.Append(CustomerSerializableProvider.ChkString_ProcessAttribute(Destination)); sb.Append(CustomerSerializableProvider.ProcessMessageSplitString); sb.Append(priority.ToString()); sb.Append(CustomerSerializableProvider.ProcessMessageSplitString); sb.Append(CustomerSerializableProvider.ChkString_ProcessAttribute(ProcessVertexID)); sb.Append(CustomerSerializableProvider.ProcessMessageSplitString); sb.Append(ActivityContractString); sb.Append(CustomerSerializableProvider.ProcessMessageSplitString); sb.Append(((int)_status).ToString()); if (DataObject != null) { sb.Append(CustomerSerializableProvider.ProcessMessageSplitString); ((ICustomerSerializable)DataObject).ToSerializableString(type); } return sb.ToString(); }
void ICustomerSerializable.LoadObjectFromSerializableString(eCustomerSerializableType type, string serializableString) { var msg = serializableString.Split(new[] { CustomerSerializableProvider.ProcessMessageSplitString }, StringSplitOptions.RemoveEmptyEntries); GUID = msg[0]; ProcessID = msg[1]; ProcessType = msg[2]; Source = msg[3]; Destination = msg[4]; int.TryParse(msg[5], out priority); ProcessVertexID = msg[6]; ActivityContractString = msg[7]; Enum.TryParse(msg[8], out _status); if (msg.Length > 9) { var dataObj = msg[9]; var wdo = new WAPDataObject(); ((ICustomerSerializable)wdo).LoadObjectFromSerializableString(type, dataObj); DataObject = wdo; } }