/// <summary> /// Create intersection with another option /// </summary> /// <param name="option"></param> /// <returns>this if <paramref name="option"/> is null or new instance with intersection</returns> public virtual AllOptions Intersection(IOption option) { if (option == null) { return(this); } AllOptions result = new AllOptions(); result.CanBrowse = this.CanBrowse | option.CanBrowse(); result.CanGetEntry = this.CanGetEntry | option.CanGetEntry(); result.CanObserve = this.CanObserve | option.CanObserve(); result.CanOpen = this.CanOpen | option.CanOpen(); result.CanRead = this.CanRead | option.CanRead(); result.CanWrite = this.CanWrite | option.CanWrite(); result.CanCreateFile = this.CanCreateFile | option.CanCreateFile(); result.CanDelete = this.CanDelete | option.CanDelete(); result.CanSetFileAttribute = this.CanSetFileAttribute | option.CanSetFileAttribute(); result.CanMount = this.CanMount | option.CanMount(); result.CanCreateFile = this.CanCreateFile | option.CanCreateFile(); result.CanDelete = this.CanDelete | option.CanDelete(); result.CanMove = this.CanMove | option.CanMove(); result.CanCreateDirectory = this.CanCreateDirectory | option.CanCreateDirectory(); result.CanMount = this.CanMount | option.CanMount(); result.CanUnmount = this.CanUnmount | option.CanUnmount(); result.CanListMountPoints = this.CanListMountPoints | option.CanListMountPoints(); result.SubPath = this.SubPath ?? option.SubPath(); return(result); }
/// <summary> /// Read options from <paramref name="option"/> and return flattened object. /// </summary> /// <param name="option"></param> /// <returns></returns> public virtual void ReadFrom(IOption option) { this.CanBrowse = option.CanBrowse(); this.CanGetEntry = option.CanGetEntry(); this.CanObserve = option.CanObserve(); this.CanOpen = option.CanOpen(); this.CanRead = option.CanRead(); this.CanWrite = option.CanWrite(); this.CanCreateFile = option.CanCreateFile(); this.CanDelete = option.CanDelete(); this.CanMove = option.CanMove(); this.CanCreateDirectory = option.CanCreateDirectory(); this.CanMount = option.CanMount(); this.CanUnmount = option.CanUnmount(); this.CanListMountPoints = option.CanListMountPoints(); this.SubPath = option.SubPath(); this.CanSetFileAttribute = option.CanSetFileAttribute(); }