/// <summary> /// DO NOT CALL FROM UI-LAYER. Call between managed adapter and manages layers. /// </summary> public void EndSerializationTarget() { if (this.m_SerializationStatus == SerializationStatus.Stopped) { // // Avoid re-entry. // throw new System.ApplicationException( "Trying to stop a serialization target that is already stopped."); } // // Set to ended state. // this.m_SerializationStatus = SerializationStatus.Stopped; // // Precondition: Check that childs have been closed. // foreach (Serializer childSerializer in this.m_childSerializers) { if (childSerializer.m_SerializationStatus != SerializationStatus.Stopped) { throw new System.ApplicationException( "Parent SerializationTarget node is being ended while Child SerializationTarget node has ended yet."); } } // // Write sub results index reference in parent of this child. // if (this.m_parentSerializer != null) { DvtkData.Results.SubResultsLink subResultsLink = new DvtkData.Results.SubResultsLink(); int index = this.m_parentSerializer.m_childSerializers.IndexOf(this); switch (this.m_serializerNodeType) { case Wrappers.WrappedSerializerNodeType.DirectoryRecord: case Wrappers.WrappedSerializerNodeType.Thread: { subResultsLink.SubResultsIndex = (uint)index; subResultsLink.NrOfErrors = this.m_endCounters.NrOfErrors; subResultsLink.NrOfWarnings = this.m_endCounters.NrOfWarnings; // // Write sub results link to parent document. // if (this.m_serializerNodeType == Wrappers.WrappedSerializerNodeType.Thread) { subResultsLink.DvtDetailToXml( this.m_parentSerializer.m_serializationWriter.DetailStreamWriter, 0); subResultsLink.DvtSummaryToXml( this.m_parentSerializer.m_serializationWriter.SummaryStreamWriter, 0); } } break; case Wrappers.WrappedSerializerNodeType.TopParent: default: throw new System.ApplicationException( System.String.Format( "child serializer can not be of type:{0}", this.m_serializerNodeType.ToString())); } } // // Add counters at the end of the output file of each parent. // this.SerializeCounts(); this.m_serializationWriter.WriteEndElement(); this.m_serializationWriter.WriteEndDocument(); m_serializationWriter = null; }
private void Init( int indexOfChildInParentCollection, Wrappers.WrappedSerializerNodeType reason) { // // Use same settings for detailed and summary validation as in the parent serializer. // bool detailedValidationResultsEnabled = this.m_parentSession.DetailedValidationResults; bool detailedSummaryValidationResultsEnabled = this.m_parentSession.SummaryValidationResults; // // Create a output writer based on the same targetname as the parent serializer. // this.m_serializationWriter = new SerializationWriter( this.m_targetFileName, this.m_bIsTopSerializer, (uint)indexOfChildInParentCollection, detailedValidationResultsEnabled, detailedSummaryValidationResultsEnabled); // // TODO: Determine specific processing tasks for Thread and DirectoryRecord child-nodes. // switch (reason) { case Wrappers.WrappedSerializerNodeType.Thread: break; case Wrappers.WrappedSerializerNodeType.DirectoryRecord: break; case Wrappers.WrappedSerializerNodeType.TopParent: break; default: // Unknown WrappedSerializerNodeType throw new System.NotImplementedException(); } // // Start the serializer // this.m_serializationWriter.WriteStartDocument(); this.m_serializationWriter.WriteStartElement(); this.m_SerializationStatus = SerializationStatus.Running; }