Example #1
0
 public PcanTrcFileInfo()
 {
     TrcFileInfo    = null;
     TrcFileEvent   = null;
     TrcFileSession = null;
     TrcCanConfig   = null;
 }
Example #2
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;
                }
            }
        }
Example #3
0
        public void Set_DataFilePath(string fPath, int Index, CS_RecordSession oSession, CS_RecordEvent oEvent)
        {
            if (!(fPath.Equals("") || Index < 0 || Index >= DataFilePathes.Length))
            {
                DataFilePathes[Index] = fPath;

                if (!(oEvent == null || oSession == null))
                {
                    CS_RecordEvent CurrentEvent = null;

                    if (EventExists(oEvent.Name))
                    {
                        CurrentEvent = GetEvent(oEvent.Name);
                    }
                    else
                    {
                        AddEvent(oEvent);
                        CurrentEvent = GetEvent(oEvent.Name);
                    }

                    if (!(CurrentEvent.RecordSessionExists(oSession.Name)))
                    {
                        CurrentEvent.Sessions.Add(oSession.Clone());
                    }
                }
            }
        }
Example #4
0
        private void Create_NewSession()
        {
            CS_RecordSession oSession = new CS_RecordSession();

            Frm_RecordSessionEdition FrmSession = new Frm_RecordSessionEdition(oRecordEvent,
                                                                               oSession,
                                                                               this as Form, true);

            FrmSession.Show();
        }
Example #5
0
        private void Edit_RecordSession()
        {
            if (!(LV_Sessions.SelectedItems == null))
            {
                CS_RecordSession oSession = oRecordEvent.Get_RecordSession(LV_Sessions.SelectedItems[0].Text);

                if (!(oSession == null))
                {
                    Frm_RecordSessionEdition FrmSession = new Frm_RecordSessionEdition(oRecordEvent, oSession, this as Form, false);
                    FrmSession.Show();
                }
            }
        }
Example #6
0
        public Frm_RecordSessionEdition(CS_RecordEvent ParentEvt, CS_RecordSession RecSession, Form Caller, bool bNew)
        {
            //
            // The InitializeComponent() call is required for Windows Forms designer support.
            //
            InitializeComponent();

            oRecordSession = RecSession;
            oEventParent   = ParentEvt;
            FrmParent      = Caller;
            bNewSession    = bNew;
            Show_SessionProperties();
        }
Example #7
0
        public CS_RecordEvent()
        {
            Name         = "New event";
            StartingDate = DateTime.Now;
            Comment      = "";
            Sessions     = new List <CS_RecordSession>();
            UserInfos    = new CS_RecordUserInfoCollection();

            //Creation of the first session of the event
            CS_RecordSession oSession = new CS_RecordSession();

            Sessions.Add(oSession);
            CurrentSession = Sessions[0];
        }
Example #8
0
        public Frm_EventDetails(object DetailObject)
        {
            //
            // The InitializeComponent() call is required for Windows Forms designer support.
            //
            InitializeComponent();

            CS_RecordEvent   oEvent   = null;
            CS_RecordSession oSession = null;

            if (DetailObject.GetType().Equals(typeof(CS_RecordEvent)))
            {
                oEvent = (CS_RecordEvent)DetailObject;

                this.Text = "Event details";

                Txt_Name.Text     = oEvent.Name;
                Txt_Date.Text     = oEvent.StartingDate.ToLongDateString();
                rTxt_Comment.Text = oEvent.Comment;

                LV_Info.Items.Clear();
                foreach (CS_RecordUserInfo sInfo in oEvent.UserInfos.Informations)
                {
                    ListViewItem It = LV_Info.Items.Add(sInfo.Title);
                    It.SubItems.Add(sInfo.Value);
                }
            }
            else if (DetailObject.GetType().Equals(typeof(CS_RecordSession)))
            {
                oSession = (CS_RecordSession)DetailObject;

                this.Text = "Session details";

                Txt_Name.Text     = oSession.Name;
                Txt_Date.Text     = oSession.SessionDate.ToLongDateString();
                rTxt_Comment.Text = oSession.Comment;

                LV_Info.Items.Clear();
                foreach (CS_RecordUserInfo sInfo in oSession.UserInfos.Informations)
                {
                    ListViewItem It = LV_Info.Items.Add(sInfo.Title);
                    It.SubItems.Add(sInfo.Value);
                }
            }
            else
            {
                this.Close();
            }
        }
Example #9
0
        /// <summary>
        /// Read the record event collection into an XML file
        /// </summary>
        /// <param name="fPath">Path of file to read</param>
        /// <returns>File reading error flag: True = No Error / False = Error</returns>
        public bool Read_EventsCollectionFile(string fPath)
        {
            try
            {
                XmlDocument oXEventsCollection = new XmlDocument();
                oXEventsCollection.Load(fPath);

                Events = new List <CS_RecordEvent>();
                XmlNode xCollection = oXEventsCollection.SelectSingleNode("RecordEventsCollection");

                foreach (XmlNode xEvent in xCollection.ChildNodes)
                {
                    if (xEvent.Name.Equals("RecordEvent"))
                    {
                        CS_RecordEvent oEvent = new CS_RecordEvent();

                        if (oEvent.Read_RecordEventInfoXmlNode(xEvent))
                        {
                            XmlNode xSessionsList = xEvent.SelectSingleNode("Sessions");
                            oEvent.Sessions = new List <CS_RecordSession>();

                            foreach (XmlNode xSession in xSessionsList.ChildNodes)
                            {
                                if (xSession.Name.Equals("RecordSession"))
                                {
                                    CS_RecordSession oSession = new CS_RecordSession();

                                    if (oSession.Read_RecordSessionInfoXmlNode(xSession))
                                    {
                                        oEvent.Sessions.Add(oSession);
                                    }
                                }
                            }

                            XmlNode xActiveSession = xEvent.SelectSingleNode("ActiveSession");
                            oEvent.CurrentSession = oEvent.Get_RecordSession(xActiveSession.InnerText);

                            Events.Add(oEvent);
                        }
                    }
                }
            }
            catch
            {
                return(false);
            }

            return(true);
        }
Example #10
0
        private void Add_EventToSessionListView(string FolderPath)
        {
            CS_RecordEvent oEvent = new CS_RecordEvent();

            if (oEvent.Load_RecordEventInformationFile(FolderPath + "\\EventDetails.xml"))
            {
                ListViewGroup oEventGrp = new ListViewGroup(oEvent.Name + ": " + oEvent.StartingDate.ToShortDateString());
                LV_Sessions.Groups.Add(oEventGrp);

                DirectoryInfo   oEventDir     = new DirectoryInfo(FolderPath);
                DirectoryInfo[] oEventSubDirs = oEventDir.GetDirectories();

                foreach (DirectoryInfo oSessionDir in oEventSubDirs)
                {
                    if (File.Exists(oSessionDir.FullName + "\\SessionDetails.xml"))
                    {
                        CS_RecordSession oSession = new CS_RecordSession();
                        oSession.Load_RecordSessionInformationFile(oSessionDir.FullName + "\\SessionDetails.xml");

                        ListViewItem oSessionItem = LV_Sessions.Items.Add(oSession.Name);

                        foreach (CS_RecordUserInfo sInfo in oSession.UserInfos.Informations)
                        {
                            if (LV_Sessions.Columns.Count == oSessionItem.SubItems.Count)
                            {
                                LV_Sessions.Columns.Add("User info #" + oSessionItem.SubItems.Count.ToString());
                            }

                            oSessionItem.SubItems.Add(sInfo.Title + ": " + sInfo.Value);
                        }

                        object[] SessionTag = new object[3];
                        SessionTag[0] = oSessionDir.FullName;
                        SessionTag[1] = oSession;
                        SessionTag[2] = oEvent;

                        oSessionItem.Tag   = SessionTag;
                        oSessionItem.Group = oEventGrp;

                        UpDate_FileList(oSessionDir.FullName, oSession, oEvent);
                    }
                }

                LV_Sessions.AutoResizeColumns(ColumnHeaderAutoResizeStyle.ColumnContent);
            }
        }
Example #11
0
        /// <summary>
        /// Return a clone of the current object
        /// </summary>
        /// <returns>Clone of the current object</returns>
        public CS_RecordSession Clone()
        {
            CS_RecordSession oClone = new CS_RecordSession();

            oClone.Name        = Name;
            oClone.SessionDate = SessionDate;
            oClone.Comment     = Comment;

            foreach (CS_RecordUserInfo sInfo in UserInfos.Informations)
            {
                CS_RecordUserInfo rui = new CS_RecordUserInfo();
                rui.Title = sInfo.Title;
                rui.Value = sInfo.Value;

                oClone.UserInfos.Informations.Add(rui);
            }

            return(oClone);
        }
Example #12
0
        private void Set_ActiveSession()
        {
            if (!(LV_Sessions.SelectedItems.Count == 0))
            {
                CS_RecordSession oActiveSession = oEvent.Get_RecordSession(LV_Sessions.SelectedItems[0].Text);

                if (!(oActiveSession == null))
                {
                    oEvent.CurrentSession = oActiveSession;
                    ((MainForm)FrmCaller).Set_ActiveRecordEvent(oEvent);
                }

                this.Close();
            }
            else
            {
                MessageBox.Show("No record session selected !", Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Example #13
0
        public Ctrl_RecordSessionInfo(CS_RecordSession oSession)
        {
            //
            // The InitializeComponent() call is required for Windows Forms designer support.
            //
            InitializeComponent();

            if (!(oSession == null))
            {
                Txt_SessionName.Text    = oSession.Name;
                Txt_SessionDate.Text    = oSession.SessionDate.ToLongDateString() + " " + oSession.SessionDate.ToShortTimeString();
                Txt_SessionComment.Text = oSession.Comment;

                LV_SessionUserInfo.Items.Clear();
                foreach (CS_RecordUserInfo sInfo in oSession.UserInfos.Informations)
                {
                    ListViewItem It = LV_SessionUserInfo.Items.Add(sInfo.Title);
                    It.SubItems.Add(sInfo.Value);
                }
            }
        }
Example #14
0
        public static PcanTrcFileInfo[] GetTrcFileInfoList(string FolderPath)
        {
            List <PcanTrcFileInfo> FolderTrcFilesInfo = new List <PcanTrcFileInfo>();

            DirectoryInfo FolderInfo = new DirectoryInfo(FolderPath);

            DirectoryInfo[] SubDirsInfo = FolderInfo.GetDirectories();
            FileInfo[]      TrcFiles    = FolderInfo.GetFiles("*.trc");

            //Update event
            if (File.Exists(FolderPath + "\\EventDetails.xml"))
            {
                oEventCurrent = new CS_RecordEvent();

                if (!(oEventCurrent.Load_RecordEventInformationFile(FolderPath + "\\EventDetails.xml")))
                {
                    oEventCurrent = null;
                }
            }

            //Update session
            if (File.Exists(FolderPath + "\\SessionDetails.xml"))
            {
                oSessionCurrent = new CS_RecordSession();

                if (!(oSessionCurrent.Load_RecordSessionInformationFile(FolderPath + "\\SessionDetails.xml")))
                {
                    oSessionCurrent = null;
                }
            }

            //Look for trc files
            if (TrcFiles.Length > 0)
            {
                foreach (FileInfo oTrc in TrcFiles)
                {
                    PcanTrcFileInfo oTrcInfo = new PcanTrcFileInfo();

                    oTrcInfo.TrcFileInfo = oTrc;

                    if (!(oEventCurrent == null || oSessionCurrent == null))
                    {
                        oTrcInfo.TrcFileEvent   = oEventCurrent;
                        oTrcInfo.TrcFileSession = oSessionCurrent;
                    }

                    FolderTrcFilesInfo.Add(oTrcInfo);
                }
            }

            //Look in sub-directories
            if (SubDirsInfo.Length > 0)
            {
                foreach (DirectoryInfo oSubDir in SubDirsInfo)
                {
                    FolderTrcFilesInfo.AddRange(GetTrcFileInfoList(oSubDir.FullName));
                }
            }

            return(FolderTrcFilesInfo.ToArray());
        }
Example #15
0
 public static void ResetTrcFileInfoEventSession()
 {
     oEventCurrent   = null;
     oSessionCurrent = null;
 }
Example #16
0
        private void Refresh_Browser(string InitPath)
        {
            string ActivePath = InitPath;

            if (ActivePath.Equals(""))
            {
                ActivePath = LV_Files.Tag.ToString();
            }

            string[] ActivePathFolders = ActivePath.Split('\\');
            int      iFolder           = Cmb_RootFolder.Text.Split('\\').Length;

            UpDate_FolderTree(RootPath);

            if (iFolder < ActivePathFolders.Length - 1)
            {
                TreeNode nFolder = TV_Folders.Nodes[ActivePathFolders[iFolder]];

                if (!(nFolder == null))
                {
                    while (iFolder < ActivePathFolders.Length)
                    {
                        Extend_FolderNode(nFolder);
                        iFolder++;

                        if (iFolder < ActivePathFolders.Length)
                        {
                            nFolder = nFolder.Nodes[ActivePathFolders[iFolder]];
                        }
                    }
                }
            }

            CS_RecordEvent   oEvent   = null;
            CS_RecordSession oSession = null;

            if (File.Exists(ActivePath + "\\SessionDetails.xml"))
            {
                oSession = new CS_RecordSession();
                if (oSession.Load_RecordSessionInformationFile(ActivePath + "\\SessionDetails.xml"))
                {
                    if (File.Exists(Path.GetDirectoryName(ActivePath) + "\\EventDetails.xml"))
                    {
                        oEvent = new CS_RecordEvent();
                        if (!(oEvent.Load_RecordEventInformationFile(Path.GetDirectoryName(ActivePath) + "\\EventDetails.xml")))
                        {
                            oEvent   = null;
                            oSession = null;
                        }
                    }
                }
                else
                {
                    oSession = null;
                }
            }

            if (!(oEvent == null))
            {
                TreeNode nEvent = FindEventNode(Path.GetDirectoryName(ActivePath));

                if (!(nEvent == null))
                {
                    Set_CurrentEvent(nEvent);
                }
            }

            LV_Files.Items.Clear();
            UpDate_FileList(ActivePath, oSession, oEvent);
        }
Example #17
0
        private void UpDate_FileList(string fPath, CS_RecordSession oSession, CS_RecordEvent oEvent)
        {
            ListViewGroup oSessionGrp = null;

            if (!(fPath.Equals("")))
            {
                DirectoryInfo oDirInfo = new DirectoryInfo(fPath);

                if (!(oSession == null))
                {
                    oSessionGrp = new ListViewGroup("Session: " + oSession.Name);
                    LV_Files.Groups.Add(oSessionGrp);
                }

                if (!(oDirInfo == null))
                {
                    FileInfo[] oDirFiles = oDirInfo.GetFiles();
                    LV_Files.Tag = fPath;

                    if (!(oDirFiles == null))
                    {
                        foreach (FileInfo oFile in oDirFiles)
                        {
                            int iIcone = 0;

                            if (oFile.Extension.Equals(".csv"))                             //Converted record file
                            {
                                iIcone = 2;
                            }
                            else if (oFile.Extension.Equals(".xrdf")) //XML Converted record file
                            {
                                iIcone = 4;
                            }
                            else if (oFile.Extension.Equals(".trc")) //Raw record file
                            {
                                iIcone = 3;
                            }

                            if (!(iIcone == 0))
                            {
                                ListViewItem ItFile = LV_Files.Items.Add(oFile.Name, iIcone);
                                ItFile.SubItems.Add(oFile.LastWriteTime.ToShortDateString() + " " + oFile.LastWriteTime.ToShortTimeString());
                                ItFile.SubItems.Add(CANStreamTools.GetScaledFileSize(oFile.Length));

                                object[] FileTag = new object[3];
                                FileTag[0] = oFile.FullName;
                                FileTag[1] = oSession;
                                FileTag[2] = oEvent;

                                ItFile.Tag = FileTag;

                                if (!(oSessionGrp == null))
                                {
                                    ItFile.Group = oSessionGrp;
                                }
                            }
                        }

                        Color_FileItems();

                        LV_Files.AutoResizeColumns(ColumnHeaderAutoResizeStyle.ColumnContent);
                    }
                }
            }
        }