private bool ReadLine(string line)
        {
            if (line != null)
            {
                if (this.DataRead != null)
                {
                    this.DataRead(line);
                }

                if (string.IsNullOrEmpty(logConfigFile))
                {
                    logConfigFile = line;
                }
                else if (string.IsNullOrEmpty(ecuCharacteristicsFile))
                {
                    ecuCharacteristicsFile = line;
                }
                else if (string.IsNullOrEmpty(ecuDef))
                {
                    ecuDef = line;
                }
                else if (CommunicationInfo == null && line == "[Communication]")
                {
                    //[Communication]
                    CommunicationInfo = new CommunicationInfo();
                }
                else if (CommunicationInfo != null && !CommunicationInfo.Complete)
                {
                    CommunicationInfo.ReadLine(line);
                }
                else if (IdentificationInfo == null && line == "[Identification]")
                {
                    //[Identification]
                    IdentificationInfo = new IdentificationInfo();
                }
                else if (IdentificationInfo != null && !IdentificationInfo.Complete)
                {
                    IdentificationInfo.ReadLine(line);
                }
                else if (Variables == null && line == "Logged variables are:")
                {
                    //logged variables are:
                    Variables = new SessionVariables();
                }
                else if (Variables != null && !Variables.Complete)
                {
                    Variables.ReadLine(line);
                }
                else if (line.StartsWith("-> Start logging"))
                {
                    SamplesPerSecond = short.Parse(line.Substring(line.IndexOf(",") + 2,
                                                                  line.IndexOf("samples/second") - line.IndexOf(",") - 3));
                    return(true);
                }
            }
            return(false);
        }
Esempio n. 2
0
        internal void InitializeSession(IdentificationInfo identificationInfo, CommunicationInfo communicationInfo, SessionVariables variables)
        {
            bool idinfostarted    = false,
                 commInfoStarted  = false,
                 variablesStarted = false;

            using (StreamReader sr = new StreamReader(logFilePath, Encoding.UTF7))
            {
                string line = null;
                while ((line = sr.ReadLine()) != null)
                {
                    if (!identificationInfo.Complete)
                    {
                        if (!idinfostarted)
                        {
                            idinfostarted = line.StartsWith("ECU identified with following data:");
                        }
                        else
                        {
                            identificationInfo.ReadLine(line, true);
                        }
                    }
                    else if (!communicationInfo.Complete)
                    {
                        if (!commInfoStarted)
                        {
                            commInfoStarted = line == "";
                        }
                        else
                        {
                            communicationInfo.ReadLine(line, true);
                        }
                    }
                    else if (!variables.Complete)
                    {
                        if (!variablesStarted)
                        {
                            variablesStarted = line == "";
                        }
                        else
                        {
                            variables.ReadLine(line, true);
                        }

                        if (variables.Complete)
                        {
                            break;
                        }
                    }
                }
            }
        }
Esempio n. 3
0
        public void Open()
        {
            VersionInfo        = null;
            CommunicationInfo  = null;
            IdentificationInfo = null;
            Measurements       = null;

            try
            {
                using (StreamReader sr = new StreamReader(this.FilePath, Encoding.UTF7))
                {
                    string line;
                    while ((line = sr.ReadLine()) != null)
                    {
                        if (VersionInfo == null && line == "[Version]")
                        {
                            VersionInfo = new VersionInfo();
                        }
                        else if (VersionInfo != null && !VersionInfo.Complete)
                        {
                            VersionInfo.ReadLine(line);
                        }
                        else if (CommunicationInfo == null && line == "[Communication]")
                        {
                            CommunicationInfo = new CommunicationInfo();
                        }
                        else if (CommunicationInfo != null && !CommunicationInfo.Complete)
                        {
                            CommunicationInfo.ReadLine(line);
                        }
                        else if (IdentificationInfo == null && line == "[Identification]")
                        {
                            IdentificationInfo = new IdentificationInfo();
                        }
                        else if (IdentificationInfo != null && !IdentificationInfo.Complete)
                        {
                            IdentificationInfo.ReadLine(line);
                        }
                        else if (Measurements == null && line == "[Measurements]")
                        {
                            Measurements = new Measurements();
                        }
                        else if (Measurements != null && !Measurements.Complete)
                        {
                            Measurements.ReadLine(line);
                        }
                    }
                }
            }
            catch { }

            if (VersionInfo == null)
            {
                VersionInfo = new VersionInfo();
            }
            if (CommunicationInfo == null)
            {
                CommunicationInfo = new CommunicationInfo();
            }
            if (IdentificationInfo == null)
            {
                IdentificationInfo = new IdentificationInfo();
            }
            if (Measurements == null)
            {
                Measurements = new Measurements();
            }
        }
Esempio n. 4
0
        internal void InitializeSession(IdentificationInfo identificationInfo, CommunicationInfo communicationInfo, SessionVariables variables)
        {
            bool idinfostarted    = false,
                 commInfoStarted  = false,
                 variablesStarted = false;

            using (StreamReader sr = new StreamReader(LogFilePath, Encoding.UTF7))
            {
                string line = null;

                while ((line = sr.ReadLine()) != null)
                {
                    if (this.LogType == LogTypes.Unknown)
                    {
                        if (line.Contains("VCDS") || line.Contains("VAG-COM"))
                        {
                            this.LogType = LogTypes.VCDS;
                        }
                        else if (line.StartsWith("Time,"))
                        {
                            this.LogType = LogTypes.Eurodyne;
                        }
                        else if (line.StartsWith("Time (sec),"))
                        {
                            this.LogType = LogTypes.Normal;
                        }
                    }

                    if (this.LogType == LogTypes.VCDS)
                    {
                        if (!variables.Complete)
                        {
                            if (!variablesStarted)
                            {
                                variablesStarted = line.StartsWith(",Group A:") || line.StartsWith("Marker,");
                                NewVCDSFormat    = line.StartsWith("Marker,");
                            }

                            if (variablesStarted)
                            {
                                variables.ReadLine(line, this.LogType);
                            }

                            if (variables.Complete)
                            {
                                break;
                            }
                        }
                    }
                    else if (this.LogType == LogTypes.Eurodyne)
                    {
                        if (!variables.Complete)
                        {
                            if (!variablesStarted)
                            {
                                variablesStarted = line.StartsWith("Time,");
                            }

                            if (variablesStarted)
                            {
                                variables.ReadLine(line, this.LogType);
                            }

                            if (variables.Complete)
                            {
                                break;
                            }
                        }
                    }
                    else if (this.LogType == LogTypes.Normal)
                    {
                        if (!variablesStarted)
                        {
                            variablesStarted = line.StartsWith("Time (sec),");
                        }

                        if (variablesStarted)
                        {
                            variables.ReadLine(line, this.LogType);
                        }

                        if (variables.Complete)
                        {
                            break;
                        }
                    }

                    if (!identificationInfo.Complete)
                    {
                        if (!idinfostarted)
                        {
                            idinfostarted = line.StartsWith("ECU identified with following data:");
                        }
                        else
                        {
                            this.LogType = LogTypes.ME7Logger;
                            identificationInfo.ReadLine(line, true);
                        }
                    }
                    else if (!communicationInfo.Complete)
                    {
                        if (!commInfoStarted)
                        {
                            commInfoStarted = line == "" || line.All(c => c == ',');
                        }
                        else
                        {
                            communicationInfo.ReadLine(line, true);
                        }
                    }
                    else if (!variables.Complete)
                    {
                        if (!variablesStarted)
                        {
                            variablesStarted = line == "" || line.All(c => c == ',');
                        }
                        else
                        {
                            variables.ReadLine(line, this.LogType);
                        }

                        if (variables.Complete)
                        {
                            break;
                        }
                    }
                }
            }
        }