/// <summary>
 /// Gets the hash code
 /// </summary>
 /// <returns>Hash code</returns>
 public override int GetHashCode()
 {
     unchecked // Overflow is fine, just wrap
     {
         var hashCode = 41;
         // Suitable nullity checks etc, of course :)
         if (Enable != null)
         {
             hashCode = hashCode * 59 + Enable.GetHashCode();
         }
         if (AgentConfiguration != null)
         {
             hashCode = hashCode * 59 + AgentConfiguration.GetHashCode();
         }
         if (ContextPath != null)
         {
             hashCode = hashCode * 59 + ContextPath.GetHashCode();
         }
         if (DisabledCipherSuites != null)
         {
             hashCode = hashCode * 59 + DisabledCipherSuites.GetHashCode();
         }
         if (EnabledCipherSuites != null)
         {
             hashCode = hashCode * 59 + EnabledCipherSuites.GetHashCode();
         }
         return(hashCode);
     }
 }
 public void SetIncludeContext(ContextPath contextPath)
 {
     this._contextPath = new ContextPath(contextPath);
     //if (extraIncludeInfo != null)
     //{
     //    this.contextPath.push(extraIncludeInfo);
     //    extraIncludeInfo = null;
     //}
 }
        /// <summary>
        /// Returns true if ComAdobeCqSocialUserImplTransportHttpToPublisherProperties instances are equal
        /// </summary>
        /// <param name="other">Instance of ComAdobeCqSocialUserImplTransportHttpToPublisherProperties to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(ComAdobeCqSocialUserImplTransportHttpToPublisherProperties other)
        {
            if (other is null)
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     Enable == other.Enable ||
                     Enable != null &&
                     Enable.Equals(other.Enable)
                     ) &&
                 (
                     AgentConfiguration == other.AgentConfiguration ||
                     AgentConfiguration != null &&
                     AgentConfiguration.Equals(other.AgentConfiguration)
                 ) &&
                 (
                     ContextPath == other.ContextPath ||
                     ContextPath != null &&
                     ContextPath.Equals(other.ContextPath)
                 ) &&
                 (
                     DisabledCipherSuites == other.DisabledCipherSuites ||
                     DisabledCipherSuites != null &&
                     DisabledCipherSuites.Equals(other.DisabledCipherSuites)
                 ) &&
                 (
                     EnabledCipherSuites == other.EnabledCipherSuites ||
                     EnabledCipherSuites != null &&
                     EnabledCipherSuites.Equals(other.EnabledCipherSuites)
                 ));
        }
 /// <summary>
 /// Wandelt die Uri in einen String um
 /// </summary>
 /// <returns>Die Stringrepräsentation der Uri</returns>
 public override string ToString()
 {
     return("/" + string.Join("/", ContextPath.ToString().Trim('/'), Uri.ToString().Trim('/')).Trim('/'));
 }
        public AbstractFolder GetFileSystemInfo(string path, int depth, IPrincipalItem principalItem)
        {
            // the request is for a file
            string file          = null;
            string fileextension = ".ics";

            //00000000-0000-0000-0000-000000000000
            Guid fileGuid = new Guid();

            if (path.EndsWith(fileextension))
            {
                var temp = path.Split("/");

                file = temp.Last();
                path = path.Remove(path.Length - file.Length, file.Length);

                if (!Guid.TryParse(file.Remove(file.Length - fileextension.Length, fileextension.Length), out fileGuid))
                {
                    return(null);
                }
            }

            if (!path.Contains("well-known") && path.Last() != '/')
            {
                path += "/";
            }

            var userFolderAccess = principalItem.TestAccess(path, Server);

            // check that a folder was found and that the user has read access
            if (userFolderAccess == null || userFolderAccess.Folder == null || !userFolderAccess.Read)
            {
                return(null);
            }

            var fileinfo = userFolderAccess.Folder;

            // if the url has a file but is not a path to a calendar then the url is not valid
            if (fileinfo.FolderType != (int)FileSystem.FolderType.CalendarFolder && file != null)
            {
                return(null);
            }


            // we are now at a safe place to physically ensure the folder exists
            var dir = System.IO.Path.Combine(Directory.GetCurrentDirectory(), $"{CalDavSettings.SERVERFILEPATH}\\{CleanPath(path)}");

            if (!Directory.Exists(dir))
            {
                Directory.CreateDirectory(dir);
            }

            if (fileinfo.FolderType == (int)FileSystem.FolderType.WellKnown)
            {
                return(new WellKnownFolder(userFolderAccess, fileinfo, Server));
            }

            AbstractFolder result = null;

            switch (fileinfo.FolderType)
            {
            case (int)FileSystem.FolderType.CalendarFolder:
                result = new CalendarRepository(mDb, userFolderAccess, fileinfo, Server, fileGuid);
                break;

            case (int)FileSystem.FolderType.CalendarHomeset:
                result = new CalendarHomeSet(userFolderAccess, fileinfo, Server);
                break;

            case (int)FileSystem.FolderType.ContextPath:
                result = new ContextPath(principalItem, userFolderAccess, fileinfo, Server);
                break;

            case (int)FileSystem.FolderType.AclFolder:
                result = new PrincipalFolder(principalItem, userFolderAccess, fileinfo, Server);
                break;

            default:
                return(null);
            }

            // Add Children
            if (depth > 0)
            {
                depth--;
                var childPaths = mDb.FolderInfo.Where(a => a.ParentFolderId.Equals(fileinfo.FolderId)).Select(a => a.Path).ToList();
                result.ChildFolders = new List <AbstractFolder>();
                foreach (var childpath in childPaths)
                {
                    var childFileInfo = GetFileSystemInfo(childpath, depth, principalItem);
                    if (childFileInfo != null)
                    {
                        result.ChildFolders.Add(childFileInfo);
                    }
                }
            }

            return(result);
        }