public FileListNode( FileListNode parent, string name, bool isDirectory, long length, DateTime creationTimeUtc, DateTime lastWriteTimeUtc) { Id = Guid.NewGuid(); Parent = parent; Name = name; IsDirectory = isDirectory; Length = length; CreationTimeUtc = creationTimeUtc; LastWriteTimeUtc = lastWriteTimeUtc; }
private static void RecursiveReadStream(System.IO.BinaryReader br, FileListNode parent) { var count = br.ReadInt32(); for (int i = 0; i < count; i++) { var name = br.ReadString(); var isDirectory = br.ReadBoolean(); var length = br.ReadInt64(); var creationTimeUtc = DateTime.SpecifyKind(new DateTime(br.ReadInt64()), DateTimeKind.Utc); var lastWriteTimeUtc = DateTime.SpecifyKind(new DateTime(br.ReadInt64()), DateTimeKind.Utc); var node = new FileListNode(parent, name, isDirectory, length, creationTimeUtc, lastWriteTimeUtc); parent.AddChild(node); if (node.IsDirectory) { RecursiveReadStream(br, node); } } }
// static private static void RecursiveReadFolder(FileListNode parent, string path) { foreach (var folder in System.IO.Directory.GetDirectories(path)) { var node = new FileListNode(parent, System.IO.Path.GetFileName(folder), true, 0, new DateTime(0), new DateTime(0)); parent.AddChild(node); RecursiveReadFolder(node, folder); } foreach (var filename in System.IO.Directory.GetFiles(path)) { var fi = new System.IO.FileInfo(filename); parent.AddChild(new FileListNode( parent, System.IO.Path.GetFileName(filename), false, fi.Length, fi.CreationTimeUtc, fi.LastWriteTimeUtc)); } }
public void AddChild(FileListNode node) { if (node.IsDirectory) { ++SubfolderCount; } else { ++FileCount; } if (FirstChild == null) { FirstChild = node; LastChild = node; return; } LastChild.Next = node; node.Previous = LastChild; LastChild = node; }
public FileListNode Pop() { FileListNode ret = new FileListNode(RakNetPINVOKE.RakNetListFileListNode_Pop(swigCPtr), false); return(ret); }
public FileListNode Get(uint position) { FileListNode ret = new FileListNode(RakNetPINVOKE.RakNetListFileListNode_Get(swigCPtr, position), false); return(ret); }
public void Replace(FileListNode input, FileListNode filler, uint position, string file, uint line) { RakNetPINVOKE.RakNetListFileListNode_Replace__SWIG_0(swigCPtr, FileListNode.getCPtr(input), FileListNode.getCPtr(filler), position, file, line); if (RakNetPINVOKE.SWIGPendingException.Pending) { throw RakNetPINVOKE.SWIGPendingException.Retrieve(); } }
internal static global::System.Runtime.InteropServices.HandleRef getCPtr(FileListNode obj) { return((obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr); }
public void Replace(FileListNode input) { RakNetPINVOKE.CSharp_RakNet_RakNetListFileListNode_Replace__SWIG_1(swigCPtr, FileListNode.getCPtr(input)); if (RakNetPINVOKE.SWIGPendingException.Pending) { throw RakNetPINVOKE.SWIGPendingException.Retrieve(); } }
public void Insert(FileListNode input, string file, uint line) { RakNetPINVOKE.CSharp_RakNet_RakNetListFileListNode_Insert__SWIG_1(swigCPtr, FileListNode.getCPtr(input), file, line); if (RakNetPINVOKE.SWIGPendingException.Pending) { throw RakNetPINVOKE.SWIGPendingException.Retrieve(); } }
private void RecursiveCompareTo(List <FileListDifference> differences, FileListNode left, FileListNode right) { // check to make sure we're not comparing two objects twice var check = new HashSet <Guid>(); for (var node = left.FirstChild; node != null; node = node.Next) { check.Clear(); var find = right.FindChild(node.Name); if (find != null) { check.Add(find.Id); if (node.IsDirectory) { RecursiveCompareTo(differences, node, find); } else if (!CompareDifferences(node, find, out FileListDifference diff)) { differences.Add(diff); } } else { differences.Add(new FileListDifference() { Difference = FileListDifferences.RightMissing, Left = node }); continue; } } for (var node = right.FirstChild; node != null; node = node.Next) { if (check.Contains(node.Id)) { continue; } var find = left.FindChild(node.Name); if (find != null) { if (node.IsDirectory) { RecursiveCompareTo(differences, find, node); } else if (!CompareDifferences(find, node, out FileListDifference diff)) { differences.Add(diff); } } else { differences.Add(new FileListDifference() { Difference = FileListDifferences.LeftMissing, Right = node }); continue; } } }