Beispiel #1
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;
                        }
                    }
                }
            }
        }
Beispiel #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 (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;
                        }
                    }
                }
            }
        }