コード例 #1
0
 /// <summary>
 /// Formats the specified begin token.
 /// </summary>
 /// <param name="beginToken">The begin token.</param>
 /// <returns>The token in serialized form.</returns>
 protected override string Format(BeginToken beginToken) {
   var dict = new Dictionary<string, string> {
       {"name", beginToken.Name},
       {"id", beginToken.Id.ToString()}};
   return CreateNodeStart(typeCache[beginToken.TypeId], dict);
 }
コード例 #2
0
ファイル: Deserializer.cs プロジェクト: t-h-e/HeuristicLab
 private void CompositeStartHandler(BeginToken token) {
   InstantiateParent();
   Type type = typeIds[(int)token.TypeId];
   try {
     parentStack.Push(new Midwife(type, (ICompositeSerializer)serializerMapping[type], token.Id));
   } catch (Exception e) {
     if (e is InvalidCastException || e is KeyNotFoundException) {
       throw new PersistenceException(String.Format(
         "Invalid composite serializer configuration for type \"{0}\".",
         type.AssemblyQualifiedName), e);
     } else {
       throw new PersistenceException(String.Format(
         "Unexpected exception while trying to compose object of type \"{0}\".",
         type.AssemblyQualifiedName), e);
     }
   }
 }