/// <summary> /// load the change log and the snapshot and creates them if they dont exist /// </summary> /// <param name="pro"></param> public ModificationRecorder(Project pro) { try { this.pro = pro; logDirectory = new DirectoryInfo(pro.Location + @"\" + SettingsStore.Default.logFolderName); if (!logDirectory.Exists) { logDirectory.Create(); logDirectory.Refresh(); logDirectory.Attributes = logDirectory.Attributes | FileAttributes.Hidden; } root = new RootFolder("", pro.Location, File.GetLastWriteTime(pro.Location)); xmlPath = Path.Combine(logDirectory.FullName, "fileList.xml"); if (File.Exists(xmlPath)) { try { using (XmlReader reader = XmlReader.Create(xmlPath)) { root.load(reader); } System.Diagnostics.Debug.WriteLine(root.print()); } catch { } } log = new changeLog(Path.Combine(logDirectory.FullName, "filelog.list")); pro.LastDate = log.getLastModTime(); } catch { } }
/// <summary> /// create a files using values /// </summary> /// <param name="name"></param> /// <param name="parent"></param> /// <param name="checksum"></param> /// <param name="snapshot"></param> /// <param name="lastUpdate"></param> public TrackedFile(string name, TrackedFolder parent, string checksum, string snapshot, DateTime lastUpdate) { if(parent!=null) this.root = parent.getRoot(); this.name = name; this.parent = parent; this.checksum = checksum; this.snapshot = snapshot; this.directory = false; this.lastUpdate = lastUpdate; }