public override bool ItemExists(string path) { try { var r = AzureQueuePathResolver.ResolvePath(this.Client, path); var exists = r.Exists(); return(exists); } catch (Exception) { return(false); } }
internal IEnumerable <object> ListItems(string path) { var result = AzureQueuePathResolver.ResolvePath(this.Client, path); switch (result.PathType) { case PathType.AzureQueueRoot: return(ListQueues()); case PathType.AzureQueueQuery: return(ListMessages(result.Queue)); default: return(null); } }
public override void GetChildNames(string path, ReturnContainers returnContainers) { var r = AzureQueuePathResolver.ResolvePath(this.Client, path); switch (r.PathType) { case PathType.AzureQueueRoot: var Queues = ListQueues(); foreach (var Queue in Queues) { this.RootProvider.WriteItemObject(Queue.Name, path, true); } break; default: break; } }
public override void RemoveItem(string path, bool recurse) { var r = AzureQueuePathResolver.ResolvePath(this.Client, path); if (r.Parts.Count == 1) { var q = this.Client.GetQueueReference(r.Parts[0]); q.DeleteIfExists(); } else if (r.Parts.Count == 2) { var id = r.Parts[1]; var stack = new Stack <CloudQueueMessage>(); while (true) { var m = r.Queue.GetMessage(); if (m == null) { break; } stack.Push(m); r.Queue.DeleteMessage(m); if (m.Id == id) { stack.Pop(); break; } } while (stack.Count > 0) { var m = stack.Pop(); if (m == null) { break;; } r.Queue.AddMessage(m); } } }
public override bool IsItemContainer(string path) { var parts = PathResolver.SplitPath(path); if (parts.Count == 0) { return(true); } try { var r = AzureQueuePathResolver.ResolvePath(this.Client, path); return(r.Exists()); } catch (Exception) { return(false); } }
public override void NewItem( string path, string type, object newItemValue) { var r = AzureQueuePathResolver.ResolvePath(this.Client, path); if (r.Parts.Count == 1) { var q = this.Client.GetQueueReference(r.Parts[0]); q.CreateIfNotExists(); } else if (r.Parts.Count == 2) { var content = r.Parts[1]; if (newItemValue != null) { content = newItemValue as string; } r.Queue.AddMessage(new CloudQueueMessage(content)); } }
public override bool HasChildItems(string path) { var r = AzureQueuePathResolver.ResolvePath(this.Client, path); return(r.Exists()); }