private void InitializeSoftwareData(string fileName) { if (_softwareData == null || !_softwareData.initialized) { // get the project name String projectName = "Untitled"; String directoryName = "Unknown"; if (ObjDte.Solution != null && ObjDte.Solution.FullName != null && !ObjDte.Solution.FullName.Equals("")) { projectName = Path.GetFileNameWithoutExtension(ObjDte.Solution.FullName); string solutionFile = ObjDte.Solution.FullName; directoryName = Path.GetDirectoryName(solutionFile); } else { directoryName = Path.GetDirectoryName(fileName); } if (_softwareData == null) { ProjectInfo projectInfo = new ProjectInfo(projectName, directoryName); _softwareData = new SoftwareData(projectInfo); } else { _softwareData.project.name = projectName; _softwareData.project.directory = directoryName; } _softwareData.initialized = true; } _softwareData.EnsureFileInfoDataIsPresent(fileName); }
private void StorePayload(SoftwareData _softwareData) { if (_softwareData != null) { long keystrokes = _softwareData.keystrokes; incrementSessionSummaryData(1 /*minutes*/, keystrokes); saveSessionSummaryToDisk(_sessionSummary); string softwareDataContent = _softwareData.GetAsJson(); string datastoreFile = SoftwareCoUtil.getSoftwareDataStoreFile(); // append to the file File.AppendAllText(datastoreFile, softwareDataContent + Environment.NewLine); //// update the statusbar fetchSessionSummaryInfoAsync(); } }