public static CLogTraceLineInformation_V2 ConvertFromV1(CLogTraceLineInformation v1)
        {
            CLogTraceLineInformation_V2 ret = new CLogTraceLineInformation_V2();

            ret.UniquenessHash = v1.UniquenessHash;
            ret.TraceID        = v1.TraceID;
            ret.EncodingString = "Unknown: in back compat mode, please rebuild sidecar using newer tools";
            return(ret);
        }
        public static CLogModuleUsageInformation_V2 ConvertFromV1(CLogModuleUsageInformation_V1 v1)
        {
            CLogModuleUsageInformation_V2 ret = new CLogModuleUsageInformation_V2();

            foreach (var trace in v1.TraceInformation)
            {
                ret.TraceInformation.Add(CLogTraceLineInformation_V2.ConvertFromV1(trace));
            }
            return(ret);
        }
        public void Insert(ICLogOutputModule module, CLogDecodedTraceLine traceLine)
        {
            string asString;
            Guid   hash = GenerateUniquenessHash(module, traceLine, out asString);
            CLogTraceLineInformation_V2 info = _me.TraceInformation
                                               .Where(x => x.TraceID.Equals(traceLine.UniqueId)).FirstOrDefault();

            if (null == info)
            {
                info                   = new CLogTraceLineInformation_V2();
                info.Unsaved           = true;
                info.PreviousFileMatch = traceLine;
                info.EncodingString    = traceLine.TraceString;

                info.TraceID        = traceLine.UniqueId;
                info.UniquenessHash = hash;
                _me.TraceInformation.Add(info);
            }

            if (info.UniquenessHash != hash)
            {
                throw new CLogEnterReadOnlyModeException("DuplicateID", CLogHandledException.ExceptionType.DuplicateId, traceLine.match);
            }
        }
        public bool IsUnique(ICLogOutputModule module, CLogDecodedTraceLine traceLine, out CLogTraceLineInformation_V2 existingTraceInformation)
        {
            existingTraceInformation = _me.TraceInformation
                                       .Where(x => x.TraceID.Equals(traceLine.UniqueId)).FirstOrDefault();

            if (null == existingTraceInformation)
            {
                return(true);
            }

            string asString;
            Guid   hash = GenerateUniquenessHash(module, traceLine, out asString);

            if (hash != existingTraceInformation.UniquenessHash)
            {
                return(false);
            }

            return(true);
        }
 public void Remove(CLogTraceLineInformation_V2 trace)
 {
     _me.TraceInformation.Remove(trace);
 }