public PcanTrcFileInfo() { TrcFileInfo = null; TrcFileEvent = null; TrcFileSession = null; TrcCanConfig = null; }
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; } } }
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(); }
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(); } }
/// <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); }
public Frm_RecordEventEdition(CS_RecordEvent RecEvent, Form Caller, bool NewEvent) { // // The InitializeComponent() call is required for Windows Forms designer support. // InitializeComponent(); oRecordEvent = RecEvent; FrmParent = Caller; bNewEvent = NewEvent; OriginalEventName = oRecordEvent.Name; OriginalEventDate = oRecordEvent.StartingDate; Show_EventProperties(); }
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); } }
private void AddEvent(CS_RecordEvent Evt) { CS_RecordEvent oEvent = new CS_RecordEvent(); oEvent.Sessions.Clear(); oEvent.Name = Evt.Name; oEvent.StartingDate = Evt.StartingDate; oEvent.Comment = Evt.Comment; foreach (CS_RecordUserInfo sInfo in Evt.UserInfos.Informations) { CS_RecordUserInfo rui = new CS_RecordUserInfo(); rui.Title = sInfo.Title; rui.Value = sInfo.Value; oEvent.UserInfos.Informations.Add(rui); } RecordEvents.Add(oEvent); }
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()); } } } }
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()); }
public static void ResetTrcFileInfoEventSession() { oEventCurrent = null; oSessionCurrent = null; }
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); }
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); } } } }