public override void Update(MessageEventArgs_410420 message) { base.Update(message); Size = message.Size; if(Updated!=null){ Updated(this); } }
public void Adding_2_childrens_with_the_same_path_should_only_add_1() { List<MessageEventArgs_410420> list = getListWith1Children(); var message2 = new MessageEventArgs_410420(messageid, messageName, fullPath1, fileType, fileSize, created, modified); list.Add(message2); parentFolder.AddChildren(list); var childrens = parentFolder.Children; Assert.That(childrens.Count, Is.EqualTo(1), "Added 2 nodes with the same path should only return 1? Not sure about this..."); }
public void Adding_3_childrens_with_different_paths_should_add_3() { List<MessageEventArgs_410420> list = getListWith1Children(); var message2 = new MessageEventArgs_410420(messageid, messageName, fullPath2, fileType, fileSize, created, modified); var message3 = new MessageEventArgs_410420(messageid, messageName, fullPath3, fileType, fileSize, created, modified); list.Add(message2); list.Add(message3); parentFolder.AddChildren(list); var childrens = parentFolder.Children; Assert.That(childrens.Count, Is.EqualTo(3)); }
private void OnFileListingEvent(MessageEventArgs_410420 message) { var p = message.FullPath; // message.Path = "/f1" // message.Path = "/f1/sub" var name = p.Substring(p.LastIndexOf('/') + 1); var folder = "/"; if (p.LastIndexOf('/') != 0) // Path is not in root (e.g. "/folder/file") { folder = p.Substring(0, p.LastIndexOf('/')); } if (Listings.ContainsKey(folder)) { Listings[folder].Add(message); } else { var children = new List<MessageEventArgs_410420>(); children.Add(message); Listings.Add(folder, children); } }
private void Add(MessageEventArgs_410420 message) { switch (message.FileType) { case FileType.FILE: Children.Add(new File(message.FullPath, message.Created, message.Modified, message.Size)); break; case FileType.FOLDER: Children.Add(new Folder(message.FullPath, message.Created, message.Modified, message.Size)); break; case FileType.UPLOADS: //TODO: Why does this never get called? Even if we have an update folder on the server Children.Add(new Folder(message.FullPath, message.Created, message.Modified, message.Size)); Debug.WriteLine("MODEL:Folder -> WARNING! Adding Upload as Folder."); break; case FileType.DROPBOX: //TODO: Create DropBox Children.Add(new Folder(message.FullPath, message.Created, message.Modified, message.Size)); Debug.WriteLine("MODEL:Folder -> WARNING! Adding DropBox as Folder."); break; } }
public virtual void Update(MessageEventArgs_410420 message) { if (FullPath != message.FullPath) throw new ArgumentException("Update only allowed on node with same path. [this.FullPath]: " + FullPath + ", [message.FullPath]: " + message.FullPath, "message"); Created = message.Created; Modified = message.Modified; LastRefreshed = DateTime.Now; }
private MessageEventArgs_410420 ParseListingMessage(int messageId, string messageName, string message) { var w = SplitMessage(message); var path = w[0]; var fileType = StringToFileType(w[1]); var size = long.Parse(w[2]); var created = DateTime.Parse(w[3]); var modified = DateTime.Parse(w[4]); var m = new MessageEventArgs_410420(messageId, messageName, path, fileType, size, created, modified); return m; }
private List<MessageEventArgs_410420> getListWith1Children() { var message = new MessageEventArgs_410420(messageid, messageName, fullPath1, fileType, fileSize, created, modified); List<MessageEventArgs_410420> list = new List<MessageEventArgs_410420>(); list.Add(message); return list; }