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); } }
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()); }
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); }