/// <summary> /// This is implemented to handle properties as they are parsed from the data stream /// </summary> /// <param name="propertyName">The name of the property.</param> /// <param name="parameters">A string collection containing the parameters and their values. If empty, /// there are no parameters.</param> /// <param name="propertyValue">The value of the property.</param> /// <remarks><para>There may be a mixture of name/value pairs or values alone in the parameters string /// collection. It is up to the derived class to process the parameter list based on the specification /// to which it conforms. For entries that are parameter names, the entry immediately following it in /// the collection is its associated parameter value. The property name, parameter names, and their /// values may be in upper, lower, or mixed case.</para> /// /// <para>The value may be an encoded string. The properties are responsible for any decoding that may /// need to occur (i.e. base 64 encoded image data).</para></remarks> /// <exception cref="PDIParserException">This is thrown if an error is encountered while parsing the data /// stream. Refer to the and inner exceptions for information on the cause of the problem.</exception> protected override void PropertyParser(string propertyName, StringCollection parameters, string propertyValue) { string temp; int idx; // The last entry is always CustomProperty so scan for length minus one for (idx = 0; idx < ntv.Length - 1; idx++) { if (ntv[idx].IsMatch(propertyName)) { break; } } // An opening BEGIN:VNOTE property must have been seen if (currentNote == null && ntv[idx].EnumValue != PropertyType.Begin) { throw new PDIParserException(this.LineNumber, LR.GetString("ExParseNoBeginProp", "BEGIN:VNOTE", propertyName)); } // Handle or create the property switch (ntv[idx].EnumValue) { case PropertyType.Begin: // The value must be VNOTE if (String.Compare(propertyValue.Trim(), "VNOTE", StringComparison.OrdinalIgnoreCase) != 0) { throw new PDIParserException(this.LineNumber, LR.GetString("ExParseUnrecognizedTagValue", ntv[idx].Name, propertyValue)); } // NOTE: If serializing into an existing instance, this may not be null. If so, it is // ignored. if (currentNote == null) { currentNote = new VNote(); vNotes.Add(currentNote); } break; case PropertyType.End: // The value must be VNOTE if (String.Compare(propertyValue.Trim(), "VNOTE", StringComparison.OrdinalIgnoreCase) != 0) { throw new PDIParserException(this.LineNumber, LR.GetString("ExParseUnrecognizedTagValue", ntv[idx].Name, propertyValue)); } // When done, we'll propagate the version number to all objects to make it consistent currentNote.PropagateVersion(); // The vNote is added to the collection when created so we don't have to rely on an END:VNOTE // to add it. currentNote = null; break; case PropertyType.Version: // Version must be 1.1 temp = propertyValue.Trim(); if (temp != "1.1") { throw new PDIParserException(this.LineNumber, LR.GetString("ExParseUnrecognizedVersion", "vNote", temp)); } currentNote.Version = SpecificationVersions.IrMC11; break; case PropertyType.UniqueId: currentNote.UniqueId.EncodedValue = propertyValue; break; case PropertyType.Summary: currentNote.Summary.DeserializeParameters(parameters); currentNote.Summary.EncodedValue = propertyValue; break; case PropertyType.Body: currentNote.Body.DeserializeParameters(parameters); currentNote.Body.EncodedValue = propertyValue; break; case PropertyType.Class: currentNote.Classification.EncodedValue = propertyValue; break; case PropertyType.Categories: currentNote.Categories.DeserializeParameters(parameters); currentNote.Categories.EncodedValue = propertyValue; break; case PropertyType.DateCreated: currentNote.DateCreated.DeserializeParameters(parameters); currentNote.DateCreated.EncodedValue = propertyValue; break; case PropertyType.LastModified: currentNote.LastModified.DeserializeParameters(parameters); currentNote.LastModified.EncodedValue = propertyValue; break; default: // Anything else is a custom property CustomProperty c = new CustomProperty(propertyName); c.DeserializeParameters(parameters); c.EncodedValue = propertyValue; currentNote.CustomProperties.Add(c); break; } }