Пример #1
0
        public static void ClearPolicyTagForArchiveOnItem(StoreObject item)
        {
            if (item.GetValueOrDefault <object>(StoreObjectSchema.ArchiveTag) != null)
            {
                item.DeleteProperties(new PropertyDefinition[]
                {
                    StoreObjectSchema.ArchiveTag
                });
            }
            if (item.GetValueOrDefault <object>(StoreObjectSchema.ArchivePeriod) != null)
            {
                item.DeleteProperties(new PropertyDefinition[]
                {
                    StoreObjectSchema.ArchivePeriod
                });
            }
            if (item.GetValueOrDefault <object>(InternalSchema.ArchiveDate) != null)
            {
                item.DeleteProperties(new PropertyDefinition[]
                {
                    InternalSchema.ArchiveDate
                });
            }
            object valueOrDefault = item.GetValueOrDefault <object>(StoreObjectSchema.RetentionFlags);

            if (valueOrDefault != null && valueOrDefault is int)
            {
                RetentionAndArchiveFlags retentionAndArchiveFlags = (RetentionAndArchiveFlags)((int)valueOrDefault & -33);
                item[StoreObjectSchema.RetentionFlags] = (int)retentionAndArchiveFlags;
            }
        }
Пример #2
0
        public static void ClearPolicyTagForDeleteOnFolder(Folder folder)
        {
            if (folder.GetValueOrDefault <object>(StoreObjectSchema.PolicyTag) != null)
            {
                folder.DeleteProperties(new PropertyDefinition[]
                {
                    StoreObjectSchema.PolicyTag
                });
            }
            if (folder.GetValueOrDefault <object>(StoreObjectSchema.RetentionPeriod) != null)
            {
                folder.DeleteProperties(new PropertyDefinition[]
                {
                    StoreObjectSchema.RetentionPeriod
                });
            }
            object valueOrDefault = folder.GetValueOrDefault <object>(StoreObjectSchema.RetentionFlags);

            if (valueOrDefault != null && valueOrDefault is int)
            {
                RetentionAndArchiveFlags retentionAndArchiveFlags = (RetentionAndArchiveFlags)((int)valueOrDefault & -2);
                retentionAndArchiveFlags &= ~RetentionAndArchiveFlags.PersonalTag;
                folder[StoreObjectSchema.RetentionFlags] = (int)retentionAndArchiveFlags;
            }
        }
Пример #3
0
        public static bool IsAutoTagSet(object retentionFlagsObject)
        {
            if (!(retentionFlagsObject is int) && !(retentionFlagsObject is RetentionAndArchiveFlags))
            {
                return(false);
            }
            RetentionAndArchiveFlags retentionAndArchiveFlags = (RetentionAndArchiveFlags)retentionFlagsObject;

            EnumValidator.ThrowIfInvalid <RetentionAndArchiveFlags>(retentionAndArchiveFlags, "retentionFlags");
            return((retentionAndArchiveFlags & RetentionAndArchiveFlags.Autotag) != RetentionAndArchiveFlags.None);
        }
 // Token: 0x06000387 RID: 903 RVA: 0x000189FC File Offset: 0x00016BFC
 internal static RetentionAndArchiveFlags UpdatePersonalTagBit(AdTagData tag, RetentionAndArchiveFlags flags)
 {
     if (tag == null || tag.Tag.Type != ElcFolderType.Personal)
     {
         flags = (RetentionAndArchiveFlags)FlagsMan.ClearPersonalTag((int)flags);
     }
     else
     {
         flags = (RetentionAndArchiveFlags)FlagsMan.SetPersonalTag((int)flags);
     }
     return(flags);
 }
Пример #5
0
        // Token: 0x06000448 RID: 1096 RVA: 0x0001E678 File Offset: 0x0001C878
        private void UpdateRetentionFlags(Guid retentionTagToUpdateTo)
        {
            RetentionAndArchiveFlags retentionAndArchiveFlags = TagAssistantHelper.UpdatePersonalTagBit((!base.ElcUserTagInformation.ContainsTag(retentionTagToUpdateTo)) ? null : base.ElcUserTagInformation.GetTag(retentionTagToUpdateTo), this.originalRetentionFlags);

            if (retentionTagToUpdateTo.Equals(Guid.Empty))
            {
                retentionAndArchiveFlags = FlagsMan.ClearAllRetentionFlags(retentionAndArchiveFlags);
            }
            else if (this.explicitRetention)
            {
                retentionAndArchiveFlags = (RetentionAndArchiveFlags)FlagsMan.SetExplicit((int)retentionAndArchiveFlags);
            }
            else
            {
                retentionAndArchiveFlags = (RetentionAndArchiveFlags)FlagsMan.ClearExplicit((int)retentionAndArchiveFlags);
            }
            if (this.effectiveArchiveGuid == null || this.effectiveArchiveGuid.Equals(Guid.Empty))
            {
                retentionAndArchiveFlags = FlagsMan.ClearAllArchiveFlags(retentionAndArchiveFlags);
            }
            else if (this.explicitArchive)
            {
                retentionAndArchiveFlags = FlagsMan.SetExplicitArchiveFlag(retentionAndArchiveFlags);
            }
            else
            {
                retentionAndArchiveFlags = FlagsMan.ClearExplicitArchiveFlag(retentionAndArchiveFlags);
            }
            retentionAndArchiveFlags = FlagsMan.SetPendingRescan(retentionAndArchiveFlags);
            retentionAndArchiveFlags = FlagsMan.ClearNeedRescan(retentionAndArchiveFlags);
            if (retentionAndArchiveFlags != this.originalRetentionFlags)
            {
                if (retentionAndArchiveFlags == RetentionAndArchiveFlags.None)
                {
                    PropertySynchronizerBase.Tracer.TraceDebug <FolderPropertySynchronizer>((long)this.GetHashCode(), "{0}: The flags bit on the folder will be removed.", this);
                    base.PropertiesToBeDeleted.Add(StoreObjectSchema.RetentionFlags);
                    base.FolderProperties[3] = null;
                    return;
                }
                PropertySynchronizerBase.Tracer.TraceDebug <FolderPropertySynchronizer, RetentionAndArchiveFlags, RetentionAndArchiveFlags>((long)this.GetHashCode(), "{0}: The flags bit on the folder will be updated. ExpectedFlags: {1}. OriginalFlags: {2}. ", this, retentionAndArchiveFlags, this.originalRetentionFlags);
                base.PropertiesToBeUpdated.Add(StoreObjectSchema.RetentionFlags, (int)retentionAndArchiveFlags);
                base.FolderProperties[3] = (int)retentionAndArchiveFlags;
            }
        }
Пример #6
0
        public static void SetPolicyTagForArchiveOnItem(PolicyTag policyTag, StoreObject item)
        {
            item[StoreObjectSchema.ArchiveTag] = policyTag.PolicyGuid.ToByteArray();
            object valueOrDefault = item.GetValueOrDefault <object>(StoreObjectSchema.RetentionFlags);

            if (valueOrDefault != null && valueOrDefault is int)
            {
                RetentionAndArchiveFlags retentionAndArchiveFlags = (RetentionAndArchiveFlags)((int)valueOrDefault & -33);
                item[StoreObjectSchema.RetentionFlags] = (int)retentionAndArchiveFlags;
            }
            else
            {
                item[StoreObjectSchema.RetentionFlags] = 0;
            }
            CompositeRetentionProperty compositeRetentionProperty = null;

            byte[] valueOrDefault2 = item.GetValueOrDefault <byte[]>(ItemSchema.StartDateEtc);
            if (valueOrDefault2 != null)
            {
                try
                {
                    compositeRetentionProperty = CompositeRetentionProperty.Parse(valueOrDefault2, true);
                }
                catch (ArgumentException)
                {
                    compositeRetentionProperty = null;
                }
            }
            if (compositeRetentionProperty == null)
            {
                compositeRetentionProperty         = new CompositeRetentionProperty();
                compositeRetentionProperty.Integer = (int)policyTag.TimeSpanForRetention.TotalDays;
                valueOrDefault = item.GetValueOrDefault <object>(InternalSchema.ReceivedTime);
                if (valueOrDefault == null)
                {
                    valueOrDefault = item.GetValueOrDefault <object>(StoreObjectSchema.CreationTime);
                }
                if (valueOrDefault == null)
                {
                    compositeRetentionProperty.Date = new DateTime?((DateTime)ExDateTime.Now);
                }
                else
                {
                    compositeRetentionProperty.Date = new DateTime?((DateTime)((ExDateTime)valueOrDefault));
                }
                item[InternalSchema.StartDateEtc] = compositeRetentionProperty.GetBytes(true);
            }
            if (policyTag.TimeSpanForRetention.TotalDays > 0.0)
            {
                long fileTime = 0L;
                try
                {
                    fileTime = compositeRetentionProperty.Date.Value.AddDays(policyTag.TimeSpanForRetention.TotalDays).ToFileTimeUtc();
                }
                catch (ArgumentOutOfRangeException)
                {
                    fileTime = 0L;
                }
                item[InternalSchema.ArchivePeriod] = (int)policyTag.TimeSpanForRetention.TotalDays;
                DateTime dateTime = DateTime.FromFileTimeUtc(fileTime);
                item[InternalSchema.ArchiveDate] = dateTime;
            }
            else if (item.GetValueOrDefault <object>(InternalSchema.ArchiveDate) != null)
            {
                item.DeleteProperties(new PropertyDefinition[]
                {
                    InternalSchema.ArchiveDate
                });
            }
            if (item.GetValueOrDefault <object>(StoreObjectSchema.ExplicitArchiveTag) != null)
            {
                item.DeleteProperties(new PropertyDefinition[]
                {
                    StoreObjectSchema.ExplicitArchiveTag
                });
            }
        }
Пример #7
0
 public static RetentionAndArchiveFlags ClearNeedRescan(RetentionAndArchiveFlags flags)
 {
     EnumValidator.ThrowIfInvalid <RetentionAndArchiveFlags>(flags, "flags");
     return(flags & ~RetentionAndArchiveFlags.NeedsRescan);
 }
Пример #8
0
 public static RetentionAndArchiveFlags ClearExplicitArchiveFlag(RetentionAndArchiveFlags flags)
 {
     EnumValidator.ThrowIfInvalid <RetentionAndArchiveFlags>(flags, "flags");
     return(flags & ~RetentionAndArchiveFlags.ExplictArchiveTag);
 }
Пример #9
0
 public static RetentionAndArchiveFlags ClearAllArchiveFlags(RetentionAndArchiveFlags flags)
 {
     EnumValidator.ThrowIfInvalid <RetentionAndArchiveFlags>(flags, "flags");
     return(flags & ~(RetentionAndArchiveFlags.ExplictArchiveTag | RetentionAndArchiveFlags.KeepInPlace));
 }
Пример #10
0
 public static RetentionAndArchiveFlags ClearAllRetentionFlags(RetentionAndArchiveFlags flags)
 {
     EnumValidator.ThrowIfInvalid <RetentionAndArchiveFlags>(flags, "flags");
     return(flags & ~(RetentionAndArchiveFlags.ExplicitTag | RetentionAndArchiveFlags.UserOverride | RetentionAndArchiveFlags.Autotag | RetentionAndArchiveFlags.PersonalTag));
 }
Пример #11
0
 public static RetentionAndArchiveFlags SetPendingRescan(RetentionAndArchiveFlags flags)
 {
     EnumValidator.ThrowIfInvalid <RetentionAndArchiveFlags>(flags, "flags");
     return(flags | RetentionAndArchiveFlags.PendingRescan);
 }