示例#1
0
        public RecordDataFile(PcanTrcFileInfo oTrcInfo, string VCLibCollectionPath) : base(oTrcInfo.TrcFileInfo.FullName)
        {
            bTrcConverted = false;
            Channels      = new List <RecordDataChannel>();

            oRecordEvent   = null;
            oRecordSession = null;

            if (bTrcLoaded)
            {
                if (!(oTrcInfo.TrcCanConfig == null))
                {
                    oCanConfig = oTrcInfo.TrcCanConfig;

                    VCLibraries = null;
                    if (!(VCLibCollectionPath.Equals("")))
                    {
                        VCLibraries = new CS_VCLibrariesCollection();
                        VCLibraries.LoadLibrariesList(VCLibCollectionPath);
                    }

                    bTrcConverted = DecodeTrcFile();

                    oRecordEvent   = oTrcInfo.TrcFileEvent;
                    oRecordSession = oTrcInfo.TrcFileSession;
                }
            }
        }
示例#2
0
        public Frm_DataViewer(string VCLibsFile)
        {
            //
            // The InitializeComponent() call is required for Windows Forms designer support.
            //
            InitializeComponent();

            DataFilePathes = null;
            LastFilePath   = "";
            oConcatData    = null;
            RecordEvents   = new List <CS_RecordEvent>();

            ViewerBook = new CS_DataViewerBook();

            VCLibCollectionPath = VCLibsFile;
            VCLibraries         = null;

            if (!(VCLibCollectionPath.Equals("")))
            {
                VCLibraries = new CS_VCLibrariesCollection();
                VCLibraries.LoadLibrariesList(VCLibCollectionPath);
            }

            NextViewerPageKeyId = 1;
            ContextTabPage      = null;

            Dlg_OpenViewerBook.InitialDirectory = CANStreamTools.MyDocumentPath + "\\CANStream\\Data Viewers";
            Dlg_OpenViewerPage.InitialDirectory = CANStreamTools.MyDocumentPath + "\\CANStream\\Data Viewers";
            Dlg_SaveViewerBook.InitialDirectory = CANStreamTools.MyDocumentPath + "\\CANStream\\Data Viewers";
            Dlg_SaveViewerPage.InitialDirectory = CANStreamTools.MyDocumentPath + "\\CANStream\\Data Viewers";
        }
        public Frm_CANConfiguration_VirtualChannelReference(Frm_CANConfiguration Caller)
        {
            //
            // The InitializeComponent() call is required for Windows Forms designer support.
            //
            InitializeComponent();

            FrmCaller = Caller;

            if (File.Exists(CANStreamTools.CsDataPath + "\\Libraries.xml"))
            {
                oVCLibCollection = new CS_VCLibrariesCollection();
                TV_VirtualChannels.Nodes.Clear();

                if (oVCLibCollection.LoadLibrariesList(CANStreamTools.CsDataPath + "\\Libraries.xml"))
                {
                    foreach (CS_VirtualChannelsLibrary oLib in oVCLibCollection.Libraries)
                    {
                        TreeNode nLib = TV_VirtualChannels.Nodes.Add(oLib.Name, oLib.Name, 0, 0);
                        nLib.Tag = "Library";

                        foreach (CS_VirtualChannel oChan in oLib.Channels)
                        {
                            TreeNode nChan = nLib.Nodes.Add(oChan.Name, oChan.Name, 1, 1);
                            nChan.Tag         = "Channel";
                            nChan.ToolTipText = oChan.Expression;
                        }
                    }

                    TV_VirtualChannels.ExpandAll();
                }
            }
        }
示例#4
0
        public void Reset_VirtualChannels()
        {
            if (!(VCLibCollectionPath.Equals("")))
            {
                VCLibraries = new CS_VCLibrariesCollection();

                if (VCLibraries.LoadLibrariesList(VCLibCollectionPath))
                {
                    Load_DataFiles();
                }
            }
        }
示例#5
0
        public CycleEditionConfiguration()
        {
            Parameters                  = new List <CycleParameter>();
            PreCycleProperties          = new CyclePartProperties();
            InCycleProperties           = new CyclePartProperties();
            PostCycleProperties         = new CyclePartProperties();
            CanConfiguration            = null;
            VirtualChannelLibCollection = null;
            BuiltInSignalLibCollection  = null;

            bModified = false;
            FilePath  = "";
        }
示例#6
0
        public Frm_VirtualChannelTest(Frm_VirtualChannel FrmParent, CS_VirtualChannel TestChannel)
        {
            //
            // The InitializeComponent() call is required for Windows Forms designer support.
            //
            InitializeComponent();

            FormParent    = FrmParent;
            bExprModified = false;

            if (!(TestChannel == null))
            {
                oChannel          = TestChannel;
                ChannelRefLibName = oChannel.ParentLibrary.Name;

                oTestLibrary           = new CS_VirtualChannelsLibrary();
                oChannel.ParentLibrary = oTestLibrary;
                oTestLibrary.Channels.Add(oChannel);

                oTestLibCollection = new CS_VCLibrariesCollection();
                oTestLibCollection.AddLibrary(oTestLibrary);
            }
        }
示例#7
0
        /// <summary>
        /// Read the cycle configuration in a XML file
        /// </summary>
        /// <param name="fPath">Path of the file to read</param>
        /// <returns>Reading error flag: True = No Error / False = Error</returns>
        public bool Read_CycleConfiguration(string fPath)
        {
            if (!(fPath.Equals("")))
            {
                XmlDocument oCycleConfig = new XmlDocument();
                oCycleConfig.Load(fPath);

                XmlNode xCycleCfg = oCycleConfig.SelectSingleNode("CycleConfiguration");

                if (!(xCycleCfg == null))
                {
                    //CAN Configuration
                    XmlNode xCanCfg = xCycleCfg.SelectSingleNode("CANConfiguration");

                    if (!(xCanCfg == null))
                    {
                        CanConfiguration = new CANMessagesConfiguration();

                        if (!(CanConfiguration.ReadCANConfigurationXmlNode(xCanCfg)))
                        {
                            return(false);
                        }
                    }
                    else
                    {
                        return(false);                         //Node CANConfiguration not found
                    }

                    //Virtual channels libraries
                    XmlNode xVirtualLib = xCanCfg.NextSibling;

                    if (xVirtualLib.Name.Equals("CS_VirtualChannelsLibrary"))
                    {
                        VirtualChannelLibCollection = new CS_VCLibrariesCollection();

                        while (xVirtualLib.Name.Equals("CS_VirtualChannelsLibrary"))
                        {
                            CS_VirtualChannelsLibrary oLib = new CS_VirtualChannelsLibrary();
                            oLib.ReadLibraryXmlNode(xVirtualLib);
                            VirtualChannelLibCollection.AddLibrary(oLib);

                            xVirtualLib = xVirtualLib.NextSibling;
                        }
                    }

                    //Built-In signals libraries
                    XmlNode xSignalLib = xVirtualLib;

                    if (xSignalLib.Name.Equals("CS_BuiltInSignalsLibrary"))
                    {
                        BuiltInSignalLibCollection = new CS_BuiltInSignalLibCollection();

                        while (xSignalLib.Name.Equals("CS_BuiltInSignalsLibrary"))
                        {
                            CS_BuiltInSignalLibrary oLib = new CS_BuiltInSignalLibrary();
                            oLib.ReadLibraryXmlNode(xSignalLib);
                            BuiltInSignalLibCollection.AddLibrary(oLib);

                            xSignalLib = xSignalLib.NextSibling;
                        }
                    }

                    //Cycle parts properties
                    XmlNode xPartProps = xCycleCfg.SelectSingleNode("CyclePartsProperties");
                    if (!(xPartProps == null))
                    {
                        //Pre-cycle
                        XmlNode xPreCycleProps = xPartProps.SelectSingleNode("PreCycleProperties");
                        if (!(xPreCycleProps == null))
                        {
                            XmlAttribute xAtr;

                            xAtr = xPreCycleProps.Attributes["TimeLength"];
                            if (!(xAtr == null))
                            {
                                double t = 0;
                                if (double.TryParse(xAtr.Value, out t))
                                {
                                    PreCycleProperties.TimeLength = t;
                                }
                                else
                                {
                                    return(false);                                     //Value of attribute TimeLength is not a number
                                }
                            }
                            else
                            {
                                return(false);                                 //Attribute TimeLength not found in node PreCycleProperties
                            }

                            xAtr = xPreCycleProps.Attributes["DataFile"];
                            if (!(xAtr == null))
                            {
                                PreCycleProperties.DataFile = xAtr.Value;
                            }
                            else
                            {
                                return(false);                                 //Attribute DataFile not found in node PreCycleProperties
                            }
                        }
                        else
                        {
                            return(false);                             //Node PreCycleProperties not found
                        }

                        //In-Cycle
                        XmlNode xInCycleProps = xPartProps.SelectSingleNode("InCycleProperties");
                        if (!(xInCycleProps == null))
                        {
                            XmlAttribute xAtr;

                            xAtr = xInCycleProps.Attributes["TimeLength"];
                            if (!(xAtr == null))
                            {
                                double t = 0;
                                if (double.TryParse(xAtr.Value, out t))
                                {
                                    InCycleProperties.TimeLength = t;
                                }
                                else
                                {
                                    return(false);                                     //Value of attribute TimeLength is not a number
                                }
                            }
                            else
                            {
                                return(false);                                 //Attribute TimeLength not found in node InCycleProperties
                            }

                            xAtr = xInCycleProps.Attributes["DataFile"];
                            if (!(xAtr == null))
                            {
                                InCycleProperties.DataFile = xAtr.Value;
                            }
                            else
                            {
                                return(false);                                 //Attribute DataFile not found in node InCycleProperties
                            }
                        }
                        else
                        {
                            return(false);                             //Node InCycleProperties not found
                        }

                        //Post-Cycle
                        XmlNode xPostCycleProps = xPartProps.SelectSingleNode("PostCycleProperties");
                        if (!(xPostCycleProps == null))
                        {
                            XmlAttribute xAtr;

                            xAtr = xPostCycleProps.Attributes["TimeLength"];
                            if (!(xAtr == null))
                            {
                                double t = 0;
                                if (double.TryParse(xAtr.Value, out t))
                                {
                                    PostCycleProperties.TimeLength = t;
                                }
                                else
                                {
                                    return(false);                                     //Value of attribute TimeLength is not a number
                                }
                            }
                            else
                            {
                                return(false);                                 //Attribute TimeLength not found in node PostCycleProperties
                            }

                            xAtr = xPostCycleProps.Attributes["DataFile"];
                            if (!(xAtr == null))
                            {
                                PostCycleProperties.DataFile = xAtr.Value;
                            }
                            else
                            {
                                return(false);                                 //Attribute DataFile not found in node PostCycleProperties
                            }
                        }
                        else
                        {
                            return(false);                             //Node PostCycleProperties not found
                        }
                    }
                    else
                    {
                        return(false);                         //Node CyclePartsProperties not found
                    }

                    //Cycle parameters
                    XmlNode xCycleParams = xCycleCfg.SelectSingleNode("CycleParameters");
                    if (!(xCycleParams == null))
                    {
                        Parameters = new List <CycleParameter>();

                        foreach (XmlNode xParam in xCycleParams.ChildNodes)
                        {
                            CycleParameter oParam = new CycleParameter();

                            XmlAttribute xAtr;
                            XmlNode      xData;

                            //Parameter Name
                            xAtr = xParam.Attributes["Name"];
                            if (!(xAtr == null))
                            {
                                if (!(xAtr.Value.Equals("")))
                                {
                                    oParam.Name = xAtr.Value;
                                }
                                else
                                {
                                    return(false);                                     //Value of attribute Name is empty
                                }
                            }
                            else
                            {
                                return(false);                                 //Attribute Name not found in node xParam
                            }

                            //Parameter Message Id
                            xAtr = xParam.Attributes["MessageId"];
                            if (!(xAtr == null))
                            {
                                if (!(xAtr.Value.Equals("")))
                                {
                                    oParam.MsgId = xAtr.Value;
                                }
                                else
                                {
                                    return(false);                                     //Value of attribute MessageId is empty
                                }
                            }
                            else
                            {
                                return(false);                                 //Attribute MessageId not found in node xParam
                            }

                            //Pre-Cycle data
                            xData = xParam.SelectSingleNode("PreCycleData");
                            if (!(xData == null))
                            {
                                //Source
                                xAtr = xData.Attributes["Source"];
                                if (!(xAtr == null))
                                {
                                    CycleDataSource Src = CycleDataSource.None;

                                    if (Enum.TryParse(xAtr.Value, out Src))
                                    {
                                        oParam.PreCycle.Source = Src;
                                    }
                                    else
                                    {
                                        return(false);                                         //Value of attribute Source is not part of enumeration
                                    }
                                }
                                else
                                {
                                    return(false);                                     //Attribute Source not found in node PreCycleData
                                }

                                //Data
                                xAtr = xData.Attributes["Data"];
                                if (!(xAtr == null))
                                {
                                    if (!(xAtr.Value.Equals("")))
                                    {
                                        oParam.PreCycle.Data = xAtr.Value;
                                    }
                                    else
                                    {
                                        return(false);                                         //Value of attribute Data is empty
                                    }
                                }
                                else
                                {
                                    return(false);                                     //Attribute Data not found in node PreCycleData
                                }

                                //Library
                                xAtr = xData.Attributes["Library"];
                                if (!(xAtr == null))
                                {
                                    if (!(xAtr.Value.Equals("")))
                                    {
                                        oParam.PreCycle.Library = xAtr.Value;
                                    }
                                    else
                                    {
                                        return(false);                                         //Value of attribute Library is empty
                                    }
                                }
                                else
                                {
                                    return(false);                                     //Attribute Library not found in node PreCycleData
                                }
                            }
                            else
                            {
                                return(false);                                 //Node PreCycleData not found
                            }

                            //In-cycle data
                            xData = xParam.SelectSingleNode("InCycleData");
                            if (!(xData == null))
                            {
                                //Source
                                xAtr = xData.Attributes["Source"];
                                if (!(xAtr == null))
                                {
                                    CycleDataSource Src = CycleDataSource.None;

                                    if (Enum.TryParse(xAtr.Value, out Src))
                                    {
                                        oParam.InCycle.Source = Src;
                                    }
                                    else
                                    {
                                        return(false);                                         //Value of attribute Source is not part of enumeration
                                    }
                                }
                                else
                                {
                                    return(false);                                     //Attribute Source not found in node InCycleData
                                }

                                //Data
                                xAtr = xData.Attributes["Data"];
                                if (!(xAtr == null))
                                {
                                    if (!(xAtr.Value.Equals("")))
                                    {
                                        oParam.InCycle.Data = xAtr.Value;
                                    }
                                    else
                                    {
                                        return(false);                                         //Value of attribute Data is empty
                                    }
                                }
                                else
                                {
                                    return(false);                                     //Attribute Data not found in node InCycleData
                                }

                                //Library
                                xAtr = xData.Attributes["Library"];
                                if (!(xAtr == null))
                                {
                                    if (!(xAtr.Value.Equals("")))
                                    {
                                        oParam.InCycle.Library = xAtr.Value;
                                    }
                                    else
                                    {
                                        return(false);                                         //Value of attribute Library is empty
                                    }
                                }
                                else
                                {
                                    return(false);                                     //Attribute Library not found in node InCycleData
                                }
                            }
                            else
                            {
                                return(false);                                 //Node InCycleData not found
                            }

                            xData = xParam.SelectSingleNode("PostCycleData");
                            if (!(xData == null))
                            {
                                //Source
                                xAtr = xData.Attributes["Source"];
                                if (!(xAtr == null))
                                {
                                    CycleDataSource Src = CycleDataSource.None;

                                    if (Enum.TryParse(xAtr.Value, out Src))
                                    {
                                        oParam.PostCycle.Source = Src;
                                    }
                                    else
                                    {
                                        return(false);                                         //Value of attribute Source is not part of enumeration
                                    }
                                }
                                else
                                {
                                    return(false);                                     //Attribute Source not found in node PostCycleData
                                }

                                //Data
                                xAtr = xData.Attributes["Data"];
                                if (!(xAtr == null))
                                {
                                    if (!(xAtr.Value.Equals("")))
                                    {
                                        oParam.PostCycle.Data = xAtr.Value;
                                    }
                                    else
                                    {
                                        return(false);                                         //Value of attribute Data is empty
                                    }
                                }
                                else
                                {
                                    return(false);                                     //Attribute Data not found in node PostCycleData
                                }

                                //Library
                                xAtr = xData.Attributes["Library"];
                                if (!(xAtr == null))
                                {
                                    if (!(xAtr.Value.Equals("")))
                                    {
                                        oParam.PostCycle.Library = xAtr.Value;
                                    }
                                    else
                                    {
                                        return(false);                                         //Value of attribute Library is empty
                                    }
                                }
                                else
                                {
                                    return(false);                                     //Attribute Library not found in node PostCycleData
                                }
                            }
                            else
                            {
                                return(false);                                 //Node PostCycleData not found
                            }

                            Parameters.Add(oParam);
                        }
                    }
                    else
                    {
                        return(false);                         //Node CycleParameters not found
                    }
                }
                else
                {
                    return(false);                     //Node CycleConfiguration not found
                }
            }
            else
            {
                return(false);                 //Path empty
            }

            FilePath  = fPath;
            bModified = false;
            return(true);             //No Error
        }