Exemplo n.º 1
0
        /// <summary>
        /// Reads the data. (allows faster custom serialization for better performance in TraceLab)
        /// </summary>
        /// <param name="reader">The reader.</param>
        public void ReadData(System.IO.BinaryReader reader)
        {
            int dataversion = reader.ReadInt32();

            if (dataversion != TLDataset.version)
            {
                throw new InvalidOperationException("Binary reader did not read correct data version. Data corrupted. Potentially IRawSerializable not implemented correctly");
            }
            else
            {
                this.m_name = reader.ReadString();

                bool isMemberPresent = reader.ReadBoolean();
                if (isMemberPresent)
                {
                    TLArtifactsCollection artifacts = new TLArtifactsCollection();
                    artifacts.ReadData(reader);
                    this.SourceArtifacts = artifacts;
                }

                isMemberPresent = reader.ReadBoolean();
                if (isMemberPresent)
                {
                    TLArtifactsCollection artifacts = new TLArtifactsCollection();
                    artifacts.ReadData(reader);
                    this.TargetArtifacts = artifacts;
                }

                isMemberPresent = reader.ReadBoolean();
                if (isMemberPresent)
                {
                    TLSimilarityMatrix matrix = new TLSimilarityMatrix();
                    matrix.ReadData(reader);
                    this.AnswerSet = matrix;
                }
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Reads the data. (allows faster custom serialization for better performance in TraceLab)
        /// </summary>
        /// <param name="reader">The reader.</param>
        public void ReadData(System.IO.BinaryReader reader)
        {
            int dataversion = reader.ReadInt32();
            if (dataversion != TLDataset.version)
            {
                throw new InvalidOperationException("Binary reader did not read correct data version. Data corrupted. Potentially IRawSerializable not implemented correctly");
            }
            else
            {
                this.m_name = reader.ReadString();

                bool isMemberPresent = reader.ReadBoolean();
                if (isMemberPresent)
                {
                    TLArtifactsCollection artifacts = new TLArtifactsCollection();
                    artifacts.ReadData(reader);
                    this.SourceArtifacts = artifacts;
                }

                isMemberPresent = reader.ReadBoolean();
                if (isMemberPresent)
                {
                    TLArtifactsCollection artifacts = new TLArtifactsCollection();
                    artifacts.ReadData(reader);
                    this.TargetArtifacts = artifacts;
                }

                isMemberPresent = reader.ReadBoolean();
                if (isMemberPresent)
                {
                    TLSimilarityMatrix matrix = new TLSimilarityMatrix();
                    matrix.ReadData(reader);
                    this.AnswerSet = matrix;
                }
            }
        }