public FileI(string name, DirectoryI parent) { _name = name; _parent = parent; _destroyed = false; _id = new Identity(); _id.name = Guid.NewGuid().ToString(); }
// DirectoryI constructor. parent == null indicates root directory. public DirectoryI(string name, DirectoryI parent) { _name = name; _parent = parent; _id = new Identity(); _destroyed = false; _contents = new Dictionary <string, NodeI>(); if (parent == null) { _id.name = "RootDir"; } else { _id.name = Guid.NewGuid().ToString(); } }
// DirectoryI constructor. parent == null indicates root directory. public DirectoryI(string name, DirectoryI parent) { _name = name; _parent = parent; _id = new Identity(); _destroyed = false; _contents = new Dictionary<string, NodeI>(); if(parent == null) { _id.name = "RootDir"; } else { _id.name = Guid.NewGuid().ToString(); } }
// Slice createDirectory() operation. public override DirectoryPrx createDirectory(string name, Current c) { lock (this) { if (_destroyed) { throw new ObjectNotExistException(); } if (name.Length == 0 || _contents.ContainsKey(name)) { throw new NameInUse(name); } var d = new DirectoryI(name, this); var node = c.adapter.add(d, d.id()); _contents.Add(name, d); return(DirectoryPrxHelper.uncheckedCast(node)); } }
// Slice createDirectory() operation. public override DirectoryPrx createDirectory(string name, Current c) { lock(this) { if(_destroyed) { throw new ObjectNotExistException(); } if(name.Length == 0 || _contents.ContainsKey(name)) { throw new NameInUse(name); } var d = new DirectoryI(name, this); var node = c.adapter.add(d, d.id()); _contents.Add(name, d); return DirectoryPrxHelper.uncheckedCast(node); } }