Esempio n. 1
0
        private void ShowTrcFiles()
        {
            LV_TrcFiles.Items.Clear();
            CANStreamTools.ResetTrcFileInfoEventSession();

            if (Directory.Exists(RecordsFolder))
            {
                DirectoryInfo RecDirInfo = new DirectoryInfo(RecordsFolder);

                TrcFilesInfos = CANStreamTools.GetTrcFileInfoList(RecDirInfo.FullName);

                if (!(TrcFilesInfos == null))
                {
                    for (int iTrc = 0; iTrc < TrcFilesInfos.Length; iTrc++)
                    {
                        PcanTrcFileInfo TrcInfo = TrcFilesInfos[iTrc];

                        ListViewItem TrcIt = LV_TrcFiles.Items.Add(TrcInfo.TrcFileInfo.Name);
                        TrcIt.Tag = iTrc;

                        if (!(TrcInfo.TrcFileEvent == null || TrcInfo.TrcFileSession == null))
                        {
                            ListViewGroup oEventSessionGroup = Get_EventSessionGroup(TrcInfo.TrcFileEvent.Name, TrcInfo.TrcFileSession.Name);

                            if (oEventSessionGroup == null)
                            {
                                oEventSessionGroup = LV_TrcFiles.Groups.Add(LV_TrcFiles.Groups.Count.ToString(), TrcInfo.TrcFileEvent.Name + " :: " + TrcInfo.TrcFileSession.Name);
                            }

                            TrcIt.Group = oEventSessionGroup;
                        }

                        TrcIt.SubItems.Add(TrcInfo.TrcFileInfo.LastWriteTime.ToShortDateString() + " " + TrcInfo.TrcFileInfo.LastWriteTime.ToShortTimeString());
                        TrcIt.SubItems.Add(CANStreamTools.GetScaledFileSize(TrcInfo.TrcFileInfo.Length));
                    }

                    LV_TrcFiles.Sort();
                }
            }
            else
            {
                MessageBox.Show("Records folder doesn't exist or is not available !", Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        }
Esempio n. 2
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);
                    }
                }
            }
        }