コード例 #1
0
 private MapiFolderPath(MapiFolderPath parentFolderPath, string subFolderName, bool autoDetectRoot)
 {
     if (null == parentFolderPath)
     {
         throw new ArgumentNullException("parentFolderPath");
     }
     if (string.IsNullOrEmpty(subFolderName))
     {
         throw new ArgumentNullException("subFolderName");
     }
     if (autoDetectRoot && parentFolderPath.IsSubtreeRoot)
     {
         if (string.Equals("IPM_SUBTREE", subFolderName))
         {
             this.isNonIpmPath   = false;
             this.levelHierarchy = parentFolderPath.levelHierarchy;
             return;
         }
         if (string.Equals("NON_IPM_SUBTREE", subFolderName))
         {
             this.isNonIpmPath   = true;
             this.levelHierarchy = parentFolderPath.levelHierarchy;
             return;
         }
     }
     this.isNonIpmPath   = parentFolderPath.isNonIpmPath;
     this.levelHierarchy = new string[1 + parentFolderPath.levelHierarchy.Length];
     Array.Copy(parentFolderPath.levelHierarchy, this.levelHierarchy, parentFolderPath.levelHierarchy.Length);
     this.levelHierarchy[this.levelHierarchy.Length - 1] = subFolderName;
 }
コード例 #2
0
        public static MapiFolderPath GenerateFolderPath(string parentFolderName, MapiFolderPath subFolderPath, bool autoDetectRoot)
        {
            MapiFolderPath mapiFolderPath = subFolderPath ?? MapiFolderPath.IpmSubtreeRoot;

            if (!string.IsNullOrEmpty(parentFolderName))
            {
                return(new MapiFolderPath(parentFolderName, mapiFolderPath, autoDetectRoot));
            }
            return(mapiFolderPath);
        }
コード例 #3
0
        private MapiFolderPath(string parentFolderName, MapiFolderPath subFolderPath, bool autoDetectRoot)
        {
            if (string.IsNullOrEmpty(parentFolderName))
            {
                throw new ArgumentNullException("parentFolderName");
            }
            if (null == subFolderPath)
            {
                throw new ArgumentNullException("subFolderPath");
            }
            this.isNonIpmPath = subFolderPath.isNonIpmPath;
            string text = parentFolderName;

            if (autoDetectRoot)
            {
                if ("IPM_SUBTREE".Equals(parentFolderName, StringComparison.OrdinalIgnoreCase))
                {
                    this.isNonIpmPath = false;
                    if (!subFolderPath.isNonIpmPath)
                    {
                        this.levelHierarchy = subFolderPath.levelHierarchy;
                        return;
                    }
                    text = "NON_IPM_SUBTREE";
                }
                else if ("NON_IPM_SUBTREE".Equals(parentFolderName, StringComparison.OrdinalIgnoreCase))
                {
                    this.isNonIpmPath = true;
                    if (!subFolderPath.isNonIpmPath)
                    {
                        this.levelHierarchy = subFolderPath.levelHierarchy;
                        return;
                    }
                    text = "NON_IPM_SUBTREE";
                }
            }
            this.levelHierarchy = new string[1 + subFolderPath.levelHierarchy.Length];
            Array.Copy(subFolderPath.levelHierarchy, 0, this.levelHierarchy, 1, subFolderPath.levelHierarchy.Length);
            this.levelHierarchy[0] = text;
        }
コード例 #4
0
        public bool Equals(MapiFolderPath other)
        {
            if (object.ReferenceEquals(null, other) || (this.isNonIpmPath ^ other.isNonIpmPath) || this.levelHierarchy.Length != other.levelHierarchy.Length)
            {
                return(false);
            }
            if (this.levelHierarchy == other.levelHierarchy)
            {
                return(true);
            }
            int num = 0;

            while (this.levelHierarchy.Length > num)
            {
                if (!this.levelHierarchy[num].Equals(other.levelHierarchy[num], StringComparison.OrdinalIgnoreCase))
                {
                    return(false);
                }
                num++;
            }
            return(true);
        }
コード例 #5
0
 private MapiFolderPath(MapiFolderPath source, int ascendedLevel, bool stopAscendingIfRoot)
 {
     if (0 > ascendedLevel)
     {
         throw new ArgumentException("ascendedLevel");
     }
     if (source.levelHierarchy.Length < ascendedLevel)
     {
         if (!stopAscendingIfRoot)
         {
             throw new ArgumentOutOfRangeException("ascendedLevel");
         }
         ascendedLevel = source.levelHierarchy.Length;
     }
     if (source.IsSubtreeRoot)
     {
         this.isNonIpmPath   = source.isNonIpmPath;
         this.levelHierarchy = source.levelHierarchy;
         return;
     }
     this.isNonIpmPath   = source.isNonIpmPath;
     this.levelHierarchy = new string[source.levelHierarchy.Length - ascendedLevel];
     Array.Copy(source.levelHierarchy, this.levelHierarchy, this.levelHierarchy.Length);
 }
コード例 #6
0
 public LevelHierarchyEnumerator(MapiFolderPath folderPath)
 {
     this.currentIndex   = -1;
     this.levelHierarchy = folderPath.levelHierarchy;
     this.count          = folderPath.levelHierarchy.Length;
 }
コード例 #7
0
 public static MapiFolderPath GenerateFolderPath(string parentFolderName, MapiFolderPath subFolderPath)
 {
     return(MapiFolderPath.GenerateFolderPath(parentFolderName, subFolderPath, true));
 }
コード例 #8
0
 public static MapiFolderPath GenerateFolderPath(MapiFolderPath parentFolerPath, string subFolderName)
 {
     return(MapiFolderPath.GenerateFolderPath(parentFolerPath, subFolderName, true));
 }