Beispiel #1
0
        /// <summary>
        /// Replace a type containing IGeneric arguments by specified types.
        /// </summary>
        /// <param name="type"></param>
        /// <param name="associations"></param>
        /// <returns></returns>
        public static Type ReplaceGenerics(this Type type, ReplacementType replacementType, Dictionary <Type, GenericAssociation> associations)
        {
            GenericAssociation association;

            if (associations.TryGetValue(type, out association))
            {
                return(replacementType == ReplacementType.Source ? association.SourceType : association.TargetType);
            }

            if (type.IsArray)
            {
                return(ReplaceGenerics(type.GetElementType(), replacementType, associations).MakeArrayType());
            }

            if (!type.GetTypeInfo().IsGenericType)
            {
                return(type);
            }

            Type[] args = type.GetGenericArguments();

            for (int i = 0; i < args.Length; i++)
            {
                args[i] = ReplaceGenerics(args[i], replacementType, associations);
            }

            return(type.GetGenericTypeDefinition().MakeGenericType(args));
        }
Beispiel #2
0
        public override string ToString()
        {
            StringBuilder sb = new StringBuilder();

            sb.AppendLine("Replace=" + Replace.ToString());
            sb.AppendLine("ReplacementType=" + ReplacementType.ToString());
            sb.AppendLine("Search=" + Search.ToString());

            return(sb.ToString());
        }
Beispiel #3
0
 public ReplacementRule(ReplacementRule copyFrom) : this()
 {
     type            = copyFrom.type;
     key             = copyFrom.key;
     keys            = copyFrom.keys;
     objectKey       = copyFrom.objectKey;
     randomMaterials = copyFrom.randomMaterials;
     randomObjects   = copyFrom.randomObjects;
     validZones      = copyFrom.validZones;
     orientation     = copyFrom.orientation;
     properties      = SDKUtil.CopyProperties(copyFrom.properties);
 }
Beispiel #4
0
        /// <summary>
        /// Replaces a text (tag) by another inside the slide.
        /// </summary>
        /// <param name="tag">The tag to replace by newText, if null or empty do nothing; tag is a regex string.</param>
        /// <param name="newText">The new text to replace the tag with, if null replaced by empty string.</param>
        /// <param name="replacementType">The type of replacement to perform.</param>
        public void ReplaceTagWithHtml(string tag, string newText, ReplacementType replacementType, string fontName = null, int fontSize = 0)
        {
            // Adjust ASCII characters
            //newText = newText.Replace("\n \n", "<br>");
            //newText = newText.Replace("\n", "");

            // Prepare hyperlinks for the slide
            var hyperlinks = ParseHttpUrls(newText);

            foreach (var item in hyperlinks)
            {
                bool   isExternal;
                Uri    uri;
                string relId;
                if (item.Value.Contains("http"))
                {
                    isExternal = true;
                    uri        = new Uri(item.Value, UriKind.Absolute);
                    relId      = item.Key;
                }
                else
                {
                    isExternal = false;
                    uri        = new Uri(item.Value, UriKind.Relative);
                    relId      = item.Key;
                }
                AddHyperlinkRelationship(uri, isExternal, relId);
            }

            // Process paragraphs
            foreach (A.Paragraph p in this.slidePart.Slide.Descendants <A.Paragraph>())
            {
                switch (replacementType)
                {
                case ReplacementType.Global:
                    PptxParagraph.ReplaceTagWithHtml(p, tag, newText, fontName, fontSize, hyperlinks);
                    break;

                case ReplacementType.NoTable:
                    var tables = p.Ancestors <A.Table>();
                    if (!tables.Any())
                    {
                        // If the paragraph has no table ancestor
                        PptxParagraph.ReplaceTagWithHtml(p, tag, newText, fontName, fontSize, hyperlinks);
                    }
                    break;
                }
            }

            this.Save();
        }
        public override bool Equals(object o)
        {
            if (!(o is TitleReplacement))
            {
                return(false);
            }
            TitleReplacement v = o as TitleReplacement;

            if (!Replace.Equals(v.Replace))
            {
                return(false);
            }
            if (!ReplacementType.Equals(v.ReplacementType))
            {
                return(false);
            }
            if (!Search.Equals(v.Search))
            {
                return(false);
            }
            return(true);
        }
Beispiel #6
0
        /// <summary>
        /// Replaces a text (tag) by another inside the slide.
        /// </summary>
        /// <param name="tag">The tag to replace by newText, if null or empty do nothing; tag is a regex string.</param>
        /// <param name="newText">The new text to replace the tag with, if null replaced by empty string.</param>
        /// <param name="replacementType">The type of replacement to perform.</param>
        public void ReplaceTagWithHyperlink(string tag, string newText, ReplacementType replacementType, string relationshipId, string fontName = "Calibri", int fontSize = 800)
        {
            foreach (A.Paragraph p in this.slidePart.Slide.Descendants <A.Paragraph>())
            {
                switch (replacementType)
                {
                case ReplacementType.Global:
                    PptxParagraph.ReplaceTagWithHyperlink(p, tag, newText, relationshipId, fontName, fontSize);
                    break;

                case ReplacementType.NoTable:
                    var tables = p.Ancestors <A.Table>();
                    if (!tables.Any())
                    {
                        // If the paragraph has no table ancestor
                        PptxParagraph.ReplaceTagWithHyperlink(p, tag, newText, relationshipId, fontName, fontSize);
                    }
                    break;
                }
            }

            this.Save();
        }
        /// <summary>
        /// Replaces a text (tag) by another inside the slide.
        /// </summary>
        /// <param name="tag">The tag to replace by newText, if null or empty do nothing; tag is a regex string.</param>
        /// <param name="newText">The new text to replace the tag with, if null replaced by empty string.</param>
        /// <param name="replacementType">The type of replacement to perform.</param>
        public void ReplaceTag(string tag, string newText, ReplacementType replacementType)
        {
            foreach (A.Paragraph p in this.slidePart.Slide.Descendants <A.Paragraph>())
            {
                switch (replacementType)
                {
                case ReplacementType.Global:
                    PowerpointParagraph.ReplaceTag(p, tag, newText);
                    break;

                case ReplacementType.NoTable:
                    var tables = p.Ancestors <A.Table>();
                    if (!tables.Any())
                    {
                        // If the paragraph has no table ancestor
                        PowerpointParagraph.ReplaceTag(p, tag, newText);
                    }
                    break;
                }
            }

            this.Save();
        }
Beispiel #8
0
        public static string MethodReplacementObjectiveName(string template, bool result, ReplacementType type)
        {
            if (template == null || !template.StartsWith(METHOD_REPLACEMENT))
            {
                throw new ArgumentException("Invalid template for bool method replacement: " + template);
            }

            var name = template + "_" + type + "_" + result;

            return(name); //.intern();
        }
        public void TitleReplacement_WithEmptySearch_IsNotValid(ReplacementType type)
        {
            var replacement = new TitleReplacement(type, "", "");

            Assert.IsFalse(replacement.IsValid());
        }
Beispiel #10
0
 public ReplacementCommand(ReplacementType type, int index, string value)
 {
     Type  = type;
     Index = index;
     Value = value;
 }
        public void HaveOldInteractionValue_ChangeInteractionObject_ChangedValue(bool isAll, bool isStart, bool isEnd, bool isRegex, string search, string replace, ReplacementType replacementType)
        {
            var viewModel = BuildViewModel();

            var titleReplacement = viewModel.Interaction.Replacement.Copy();

            titleReplacement.ReplacementType = replacementType;
            titleReplacement.Search          = search;
            titleReplacement.Replace         = replace;

            var newInteraction = new TitleReplacementEditInteraction(titleReplacement);

            viewModel.SetInteraction(newInteraction);
            Assert.AreEqual(viewModel.IsRemoveAll, isAll);
            Assert.AreEqual(viewModel.IsRemoveAtBeginning, isStart);
            Assert.AreEqual(viewModel.IsRemoveAtEnd, isEnd);
            Assert.AreEqual(viewModel.IsReplaceByRegex, isRegex);
            Assert.AreEqual(viewModel.SearchForInput, search);
            Assert.AreEqual(viewModel.ReplaceWithInput, replace);
        }
Beispiel #12
0
 /// <summary>
 /// Replaces a text (tag) by another inside the slide given a PptxTable.Cell.
 /// This is a convenient method that overloads the original ReplaceTag() method.
 /// </summary>
 /// <param name="tagPair">The tag/new text, BackgroundPicture is ignored.</param>
 /// <param name="replacementType">The type of replacement to perform.</param>
 public void ReplaceTagWithHyperlink(PptxTable.Cell tagPair, ReplacementType replacementType, string relationshipId, string fontName = "Calibri", int fontSize = 800)
 {
     this.ReplaceTagWithHyperlink(tagPair.Tag, tagPair.NewText, replacementType, relationshipId, fontName, fontSize);
 }
 /// <summary>
 ///     Create a TitleReplacement with search and replace fields set
 /// </summary>
 /// <param name="replacementType">Defines how the replacement will be processed</param>
 /// <param name="search">The text to search for</param>
 /// <param name="replace">The text that will be inserted instead</param>
 public TitleReplacement(ReplacementType replacementType, string search, string replace)
 {
     ReplacementType = replacementType;
     Search          = search;
     Replace         = replace;
 }
Beispiel #14
0
 public void StoreValues(Data data, string path)
 {
     data.SetValue(@"" + path + @"Replace", Data.EscapeString(Replace));
     data.SetValue(@"" + path + @"ReplacementType", ReplacementType.ToString());
     data.SetValue(@"" + path + @"Search", Data.EscapeString(Search));
 }
 public Replacement(ReplacementType type, object value)
 {
     this.Type  = type;
     this.Value = value;
 }
Beispiel #16
0
 public Replacement(string from, string to, ReplacementType type)
 {
     _from = from;
     _to = to;
     _type = type;
 }
Beispiel #17
0
 /// <summary>
 /// Replaces a text (tag) by another inside the slide given a PptxTable.Cell.
 /// This is a convenient method that overloads the original ReplaceTag() method.
 /// </summary>
 /// <param name="tagPair">The tag/new text, BackgroundPicture is ignored.</param>
 /// <param name="replacementType">The type of replacement to perform.</param>
 public void ReplaceTag(PptxTable.Cell tagPair, ReplacementType replacementType)
 {
     this.ReplaceTag(tagPair.Tag, tagPair.NewText, replacementType);
 }
Beispiel #18
0
        /// <summary>
        /// Replaces a text (tag) by another inside the slide.
        /// </summary>
        /// <param name="tag">The tag to replace by newText, if null or empty do nothing; tag is a regex string.</param>
        /// <param name="newText">The new text to replace the tag with, if null replaced by empty string.</param>
        /// <param name="replacementType">The type of replacement to perform.</param>
        public void ReplaceTag(string tag, string newText, ReplacementType replacementType)
        {
            foreach (A.Paragraph p in this.slidePart.Slide.Descendants<A.Paragraph>())
            {
                switch (replacementType)
                {
                    case ReplacementType.Global:
                        PptxParagraph.ReplaceTag(p, tag, newText);
                        break;

                    case ReplacementType.NoTable:
                        var tables = p.Ancestors<A.Table>();
                        if (!tables.Any())
                        {
                            // If the paragraph has no table ancestor
                            PptxParagraph.ReplaceTag(p, tag, newText);
                        }
                        break;
                }
            }

            this.Save();
        }
Beispiel #19
0
// Custom Code starts here
// START_CUSTOM_SECTION:GENERAL
        /// <summary>
        /// Create a TitleReplacement with search and replace fields set
        /// </summary>
        /// <param name="search">The text to search for</param>
        /// <param name="replace">The text that will be inserted instead</param>
        public TitleReplacement(ReplacementType replacementType, string search, string replace)
        {
            this.ReplacementType = replacementType;
            this.Search          = search;
            this.Replace         = replace;
        }
 /// <summary>
 /// Replaces a text (tag) by another inside the slide given a PowerpointTable.Cell.
 /// This is a convenient method that overloads the original ReplaceTag() method.
 /// </summary>
 /// <param name="tagPair">The tag/new text, BackgroundPicture is ignored.</param>
 /// <param name="replacementType">The type of replacement to perform.</param>
 public void ReplaceTag(PowerpointTable.Cell tagPair, ReplacementType replacementType)
 {
     this.ReplaceTag(tagPair.Tag, tagPair.NewText, replacementType);
 }
        public static MessageStatus StreamRename(
            InputBufferFileName newStreamNameFormat,
            InputBufferFileName streamTypeNameFormat,
            ReplacementType replacementType)
        {
            if (!IsStreamRenameSupported)
            {
                Requirement.Capture("[TestInfo] If stream rename is not supported by the object store, it SHOULD return STATUS_NOT_SUPPORTED.");
                return MessageStatus.NOT_SUPPORTED;
            }

            if (newStreamNameFormat == InputBufferFileName.EndWithColon)
            {
                Helper.CaptureRequirement(3136, @"[In Algorithm for Performing Stream Rename,Pseudocode for the algorithm is as follows:]
                    The operation MUST be failed with STATUS_INVALID_PARAMETER under any of the following conditions:The last character of NewStreamName is \"":"".");
                return MessageStatus.INVALID_PARAMETER;
            }

            if (newStreamNameFormat == InputBufferFileName.ColonOccurMoreThanThreeTimes)
            {
                Helper.CaptureRequirement(3137, @"[In Algorithm for Performing Stream Rename,Pseudocode for the algorithm is as follows:]
                    The operation MUST be failed with STATUS_INVALID_PARAMETER under any of the following conditions:
                    The character \"":"" occurs more than three times in NewStreamName.");
                return MessageStatus.INVALID_PARAMETER;
            }

            if (newStreamNameFormat == InputBufferFileName.ContainsInvalid)
            {
                Helper.CaptureRequirement(3265, @"[In Algorithm for Performing Stream Rename,Pseudocode for the algorithm is as follows:]The operation MUST be failed with STATUS_INVALID_PARAMETER under any of the following conditions:If StreamName contains any characters invalid for a streamname as specified in [MS-FSCC] section 2.1.5  .");
                return MessageStatus.INVALID_PARAMETER;
            }

            if (newStreamNameFormat == InputBufferFileName.ContainsWildcard)
            {
                Helper.CaptureRequirement(3266, @"[In Algorithm for Performing Stream Rename]The operation MUST be failed with STATUS_INVALID_PARAMETER
                    under any of the following conditions:If StreamName contains  any wildcard characters as defined in section 3.1.4.3  .");
                return MessageStatus.INVALID_PARAMETER;
            }

            //if (streamNameZeroLength && StreamTypeNameZeroLength)
            if ((newStreamNameFormat == InputBufferFileName.LengthZero) && (streamTypeNameFormat == InputBufferFileName.LengthZero))
            {
                Helper.CaptureRequirement(3140, @"[In Algorithm for Performing Stream Rename,Pseudocode for the algorithm is as follows:]
                    The operation MUST be failed with STATUS_INVALID_PARAMETER under any of the following conditions:Both StreamName and StreamTypeName are zero-length.");
                return MessageStatus.INVALID_PARAMETER;
            }

            //if (streamNameIsMore255Unicode)
            if (newStreamNameFormat == InputBufferFileName.IsMore255Unicode)
            {
                Helper.CaptureRequirement(3141, @"[In Algorithm for Performing Stream Rename,Pseudocode for the algorithm is as follows:]
                    The operation MUST be failed with STATUS_INVALID_PARAMETER under any of the following conditions:StreamName is more than 255 Unicode characters in length.");
                return MessageStatus.INVALID_PARAMETER;
            }

            //if (streamType == StreamType.DataStream && StreamTypeNameisData)
            if ((gStreamType == StreamType.DataStream && streamTypeNameFormat == InputBufferFileName.isData) ||
                (newStreamNameFormat == InputBufferFileName.LengthZero && streamTypeNameFormat == InputBufferFileName.isIndexAllocation))
            {
                Helper.CaptureRequirement(3143, @"[In Algorithm for Performing Stream Rename,Pseudocode for the algorithm is as follows:]
                    The operation MUST be failed with STATUS_OBJECT_TYPE_MISMATCH if either of the following conditions are true:
                    Open.Stream.StreamType is DataStream and StreamTypeName is not the Unicode string \""$DATA"".");
                return MessageStatus.OBJECT_TYPE_MISMATCH;
            }

            //if (streamType == StreamType.DirectoryStream && StreamTypeNameisIndexAllocation)
            if ((gStreamType == StreamType.DirectoryStream) && (streamTypeNameFormat == InputBufferFileName.isIndexAllocation))
            {
                Helper.CaptureRequirement(3144, @"[In Algorithm for Performing Stream Rename,Pseudocode for the algorithm is as follows:]
                    The operation MUST be failed with STATUS_OBJECT_TYPE_MISMATCH if either of the following conditions are true:Open.Stream.StreamType
                    is DirectoryStream and StreamTypeName is not the Unicode string \""$INDEX_ALLOCATION"".");
                return MessageStatus.OBJECT_TYPE_MISMATCH;
            }

            //If Open.Stream.StreamType is DirectoryStream
            if (gStreamType == StreamType.DirectoryStream)
            {
                Helper.CaptureRequirement(3145, @"[In Algorithm for Performing Stream Rename,Pseudocode for the algorithm is as follows:]
                    If Open.Stream.StreamType is DirectoryStream, the operation MUST be failed with STATUS_INVALID_PARAMETER.");
                return MessageStatus.INVALID_PARAMETER;
            }

            //If StreamName is a case-insensitive match with Open.Stream.Name
            if (newStreamNameFormat == InputBufferFileName.IsCaseInsensitiveMatch && streamTypeNameFormat == InputBufferFileName.isData)
            {
                Helper.CaptureRequirement(3146, @"[In Algorithm for Performing Stream Rename,Pseudocode for the algorithm is as follows:]
                    If StreamName is a case-insensitive match with Open.Stream.Name, the operation MUST immediately return STATUS_SUCCESS.");
                return MessageStatus.SUCCESS;
            }

            //If TargetStream is found
            if (gIsTargetStreamFound)
            {
                if (replacementType != ReplacementType.ReplaceIfExists)
                {
                    Helper.CaptureRequirement(3148, @"[In Algorithm for Performing Stream Rename,Pseudocode for the algorithm is as follows:]
                        If TargetStream is found:If ReplaceIfExists is FALSE, the operation MUST be failed with STATUS_OBJECT_NAME_COLLISION.");
                    return MessageStatus.OBJECT_NAME_COLLISION;
                }
                //If TargetStream.File.OpenList contains any Opens to TargetStream
                if (gIsOpenListContains)
                {
                    Helper.CaptureRequirement(3149, @"[In Algorithm for Performing Stream Rename,Pseudocode for the algorithm is as follows:
                        If TargetStream is found:]If TargetStream.File.OpenList contains any Opens to TargetStream,
                        the operation MUST be failed with STATUS_INVALID_PARAMETER.");
                    return MessageStatus.INVALID_PARAMETER;
                }
                //if (TargetStreamSizeNotZero)
                if (gIsTargetStreamSizeNotZero)
                {
                    Helper.CaptureRequirement(3150, @"[In Algorithm for Performing Stream Rename,Pseudocode for the algorithm is as follows:
                        If TargetStream is found:]If TargetStream.Size is not 0, the operation MUST be failed with STATUS_INVALID_PARAMETER.");
                    return MessageStatus.INVALID_PARAMETER;
                }
            }
            return MessageStatus.SUCCESS;
        }
        public void ChangeOuputFromInput_ExecuteOkCommand_ChangedInteractionValues(bool isAll, bool isStart, bool isEnd, bool isRegex, string search, string replace, ReplacementType replacementType)
        {
            var viewModel = BuildViewModel();

            viewModel.IsReplaceByRegex    = isRegex;
            viewModel.IsRemoveAll         = isAll;
            viewModel.IsRemoveAtBeginning = isStart;
            viewModel.IsRemoveAtEnd       = isEnd;
            viewModel.SearchForInput      = search;
            viewModel.ReplaceWithInput    = replace;

            viewModel.OkCommand.Execute(null);

            Assert.IsTrue(viewModel.Interaction.Success);
            Assert.AreEqual(viewModel.Interaction.Replacement.ReplacementType, replacementType);
            Assert.AreEqual(viewModel.Interaction.Replacement.Search, search);
            Assert.AreEqual(viewModel.Interaction.Replacement.Replace, replace);
        }
        public void SetupFilter_SetSearchText_ProperlyFiltered(string search, string replace, ReplacementType type, string sample, string result)
        {
            _titleReplacementsSettingsProvider.Settings.Add(new TitleReplacement(type, search, replace));
            var viewModel = BuildViewModel();

            viewModel.SampleText = sample;
            Assert.AreEqual(result, viewModel.ReplacedSampleText);
        }
Beispiel #24
0
 /// <summary>
 /// Replaces a text (tag) by another inside the slide given a PptxTable.Cell.
 /// This is a convenient method that overloads the original ReplaceTag() method.
 /// </summary>
 /// <param name="tagPair">The tag/new text, BackgroundPicture is ignored.</param>
 /// <param name="replacementType">The type of replacement to perform.</param>
 public void ReplaceTagWithHtml(PptxTable.Cell tagPair, ReplacementType replacementType, string fontName = null, int fontSize = 0)
 {
     this.ReplaceTagWithHtml(tagPair.Tag, tagPair.NewText, replacementType, fontName, fontSize);
 }
Beispiel #25
0
 public ReplacementRule WithType(ReplacementType type)
 {
     this.type = type;
     return(this);
 }
        public static MessageStatus SetFileRenameInfo(
            InputBufferFileNameLength inputBufferFileNameLength,
            InputBufferFileName inputBufferFileName,
            DirectoryVolumeType directoryVolumeType,
            DestinationDirectoryType destinationDirectoryType,
            NewLinkNameFormatType newLinkNameFormatType,
            NewLinkNameMatchType newLinkNameMatchType,
            ReplacementType replacementType,
            TargetLinkDeleteType targetLinkDeleteType,
            OplockBreakStatusType oplockBreakStatusType,
            TargetLinkFileOpenListType targetLinkFileOpenListType
            )
        {
            bool RemoveTargetLink = false;
            bool TargetExistsSameFile = false;

            //Boolean values (initialized to true): ActivelyRemoveSourceLink, RemoveSourceLink, AddTargetLink
            bool AddTargetLink = true;
            //If InputBuffer.FileNameLength is equal to zero.
            if (inputBufferFileNameLength == InputBufferFileNameLength.EqualTo_Zero)
            {
                Helper.CaptureRequirement(3023, @"[In FileRenameInformation,Pseudocode for the operation is as follows:]
                    The operation MUST be failed with STATUS_INVALID_PARAMETER under any of the following conditions:
                    If InputBuffer.FileNameLength is equal to zero.");
                return MessageStatus.INVALID_PARAMETER;
            }

            // inputNameLengthValidate == 1:If InputBuffer.FileNameLength is an odd number
            if (inputBufferFileNameLength == InputBufferFileNameLength.OddNumber)
            {
                Helper.CaptureRequirement(3024, @"[In FileRenameInformation,Pseudocode for the operation is as follows:]
                    The operation MUST be failed with STATUS_INVALID_PARAMETER under any of the following conditions:
                    If InputBuffer.FileNameLength is an odd number.");
                return MessageStatus.INVALID_PARAMETER;
            }

            //If InputBuffer.FileNameLength is greater than
            //InputBufferLength minus the byte offset into the FILE_RENAME_INFORMATION InputBuffer
            //of the InputBuffer.FileName field (that is, the total length of InputBuffer as given
            //in InputBufferLength is insufficient to contain the fixed-size fields of InputBuffer
            //plus the length of InputBuffer.FileName)
            if (inputBufferFileNameLength == InputBufferFileNameLength.Greater)
            {
                Helper.CaptureRequirement(3025, @"[In FileRenameInformation,Pseudocode for the operation is as follows:]
                    The operation MUST be failed with STATUS_INVALID_PARAMETER under any of the following conditions:
                    If InputBuffer.FileNameLength is greater than InputBufferLength minus the byte offset into the FILE_RENAME_INFORMATION InputBuffer
                    of the InputBuffer.FileName field (that is, the total length of InputBuffer as given in InputBufferLength
            is insufficient to contain the fixed-size fields of InputBuffer plus the length of InputBuffer.FileName).");
                return MessageStatus.MEDIA_WRITE_PROTECTED;
            }

            //If Open.GrantedAccess does not contain DELETE, as defined in [MS-SMB2] section 2.2.13.1
            if ((gOpenGrantedAccess != FileAccess.None) && (gOpenGrantedAccess & FileAccess.DELETE) == 0)
            {
                Helper.CaptureRequirement(3026, @"[In FileRenameInformation,Pseudocode for the operation is as follows:]
                    If Open.GrantedAccess does not contain DELETE, as defined in [MS-SMB2] section 2.2.13.1,
                    the operation MUST be failed with STATUS_ACCESS_DENIED.");
                return MessageStatus.ACCESS_DENIED;
            }

            // If the first character of InputBuffer.FileName is '\'
            if (inputBufferFileName == InputBufferFileName.StartWithBackSlash)
            {

                //if DestinationDirectory.Volume is not equal to Open.File.Volume
                if (directoryVolumeType == DirectoryVolumeType.DestDirVolumeNotEqualToOpenFileVolume)
                {
                    Helper.CaptureRequirement(3034, @"[In FileRenameInformation,Pseudocode for the operation is as follows:
                        If the first character of InputBuffer.FileName is '\']Else if DestinationDirectory.Volume is not equal
                        to Open.File.Volume:The operation MUST be failed with STATUS_NOT_SAME_DEVICE.");
                    return MessageStatus.NOT_SAME_DEVICE;
                }
            }

            // If the first character of InputBuffer.FileName is ':'
            if (inputBufferFileName == InputBufferFileName.StartWithColon)
            {
                Helper.CaptureRequirement(3042, @"[In FileRenameInformation,Pseudocode for the operation is as follows:
                    If the first character of InputBuffer.FileName is ':']The operation immediately returns STATUS_SUCCESS.");
                return MessageStatus.SUCCESS;
            }

            //If Open.File contains open files, the operation MUST be failed with STATUS_ACCESS_DENIED
            //if (isOpenFileContain)
            if (gIsOpenListContains)
            {
                Helper.CaptureRequirement(3044, @"[In FileRenameInformation,Pseudocode for the operation is as follows:]
                    If Open.File contains open files, the operation MUST be failed with STATUS_ACCESS_DENIED.");
                return MessageStatus.ACCESS_DENIED;
            }

            //If InputBuffer.FileName is not valid as specified in [MS-FSCC] section 2.1.5
            if (inputBufferFileName == InputBufferFileName.NotValid)
            {
                Helper.CaptureRequirement(3045, @"[In FileRenameInformation,Pseudocode for the operation is as follows:]
                    If InputBuffer.FileName is not valid as specified in [MS-FSCC] section 2.1.5,
                    the operation MUST be failed with STATUS_OBJECT_NAME_INVALID.");
                return MessageStatus.OBJECT_NAME_INVALID;
            }

            //If DestinationDirectory is the same as Open.Link.ParentFile:
            if (destinationDirectoryType == DestinationDirectoryType.DestDirIsSameAsOpenLinkParentFile)
            {
                //If NewLinkName is a case-sensitive exact match with Open.Link.Name
                if (newLinkNameFormatType == NewLinkNameFormatType.NewLinkNameIsCaseSensitive)
                {
                    Helper.CaptureRequirement(3046, @"[In FileRenameInformation,Pseudocode for the operation is as follows:]
                        If DestinationDirectory is the same as Open.Link.ParentFile:If NewLinkName is a case-sensitive exact match with Open.Link.Name,
                        the operation MUST immediately return STATUS_SUCCESS.");
                    return MessageStatus.SUCCESS;
                }
            }

            //If NewLinkName matches the Name or ShortName of any Link in DestinationDirectory.
            //DirectoryList using case-sensitivity according to Open.IsCaseInsensitive:
            if (newLinkNameMatchType == NewLinkNameMatchType.NewLinkNameMatchTargetLinkShortName)
            {
                //Set FoundLink to true.
                //Set TargetLink to the existing Link found in DestinationDirectory.DirectoryList. Because the name may have been found using a case-insensitive search (if Open.IsCaseInsensitive is true), this preserves the case of the found name.
                //If NewLinkName matched TargetLink.ShortName, set MatchedShortName to true.
                //Set RemoveTargetLink to true.
                RemoveTargetLink = true;
                //If TargetLink.File.FileID equals Open.File.FileID, set TargetExistsSameFile to true. This detects a rename to another existing link to the same file.

                //If (TargetLink.Name is a case-sensitive exact match with NewLinkName) or MatchedShortName is true and TargetLink.ShortName is a case-sensitive exact match with NewLinkName):
                //Set ExactCaseMatch to true.

                //If RemoveTargetLink is true:
                if (RemoveTargetLink)
                {
                    //If TargetExistsSameFile is FALSE and InputBuffer.ReplaceIfExists is FALSE
                    if (!TargetExistsSameFile && replacementType == ReplacementType.NotReplaceIfExists)
                    {
                        Helper.CaptureRequirement(3067, @"[In FileRenameInformation,Pseudocode for the operation is as follows:]
                            If RemoveTargetLink is TRUE:If TargetExistsSameFile is FALSE and InputBuffer.ReplaceIfExists is FALSE,
                            the operation MUST be failed with STATUS_OBJECT_NAME_COLLISION.");
                        return MessageStatus.OBJECT_NAME_COLLISION;
                    }

                    //If TargetExistsSameFile is FALSE
                    if (!TargetExistsSameFile)
                    {
                        if (gfileTypeToOpen == FileType.DirectoryFile)
                        {
                            Helper.CaptureRequirement(3069, @"[In FileRenameInformation,Pseudocode for the operation is as follows:
                                If RemoveTargetLink is TRUE:] If TargetExistsSameFile is FALSE:The operation MUST be failed with TATUS_ACCESS_DENIED
                                under any of the following conditions: If TargetLink.File.FileType is DirectoryFile.");
                            return MessageStatus.ACCESS_DENIED;
                        }

                        if ((gFileAttribute & FileAttribute.READONLY) != 0)
                        {
                            Helper.CaptureRequirement(3071, @"[In FileRenameInformation,Pseudocode for the operation is as follows:
                                If RemoveTargetLink is TRUE: If TargetExistsSameFile is FALSE:The operation MUST be failed with TATUS_ACCESS_DENIED
                                under any of the following conditions:]If TargetLink.File.FileAttributes.FILE_ATTRIBUTE_READONLY is TRUE.");
                            return MessageStatus.ACCESS_DENIED;
                        }

                        //If TargetLink.IsDeleted is true
                        if (targetLinkDeleteType == TargetLinkDeleteType.TargetLinkIsDeleted)
                        {
                            Helper.CaptureRequirement(3072, @"[In FileRenameInformation,Pseudocode for the operation is as follows:If RemoveTargetLink is TRUE:
                                If TargetExistsSameFile is FALSE: ]If TargetLink.IsDeleted is TRUE, the operation MUST be failed with STATUS_DELETE_PENDING.");
                            return MessageStatus.DELETE_PENDING;
                        }

                        //If the caller does not have DELETE access to TargetLink.File
                        if ((gOpenGrantedAccess != FileAccess.None) && (gOpenGrantedAccess & FileAccess.DELETE) == 0)
                        {
                            //If the caller does not have FILE_DELETE_CHILD access to DestinationDirectory
                            if ((gOpenGrantedAccess != FileAccess.None) && (gOpenGrantedAccess & FileAccess.FILE_DELETE_CHILD) == 0)
                            {
                                Helper.CaptureRequirement(3073, @"[In FileRenameInformation,Pseudocode for the operation is as follows:
                                    If RemoveTargetLink is TRUE: If TargetExistsSameFile is FALSE:] If the caller does not have DELETE access to
                                    TargetLink.File:If the caller does not have FILE_DELETE_CHILD access to DestinationDirectory:
                                    The operation MUST be failed with STATUS_ACCESS_DENIED.");
                                return MessageStatus.ACCESS_DENIED;
                            }
                        }

                        //If there was not an oplock to be broken and TargetLink.File.OpenList contains
                        //an Open with a Stream matching the current Stream
                        if (oplockBreakStatusType == OplockBreakStatusType.HasNoOplockBreak &&
                            targetLinkFileOpenListType == TargetLinkFileOpenListType.TargetLinkFileOpenListContainMatchedOpen)
                        {
                            Helper.CaptureRequirement(3075, @"[In FileRenameInformation,Pseudocode for the operation is as follows:
                                If RemoveTargetLink is TRUE: If TargetExistsSameFile is FALSE: For each Stream on TargetLink.File ]
                                If there was not an oplock to be broken and TargetLink.File.OpenList contains an Open with a Stream matching the current Stream,
                                the operation MUST be failed with STATUS_ACCESS_DENIED.");
                            return MessageStatus.ACCESS_DENIED;
                        }
                    }
                }
            }

            //If AddTargetLink is true:
            if (AddTargetLink)
            {
                //The operation must be failed with STATUS_ACCESS_DENIED
                //if either of the following conditions are true: Open.File.FileType is DirectoryFile
                //and the caller does not have FILE_ADD_SUBDIRECTORY access on DestinationDirectory.
                if ((gfileTypeToOpen == FileType.DirectoryFile) && ((gOpenGrantedAccess != FileAccess.None) && (gOpenGrantedAccess & FileAccess.FILE_ADD_SUBDIRECTORY) == 0))
                {
                    Helper.CaptureRequirement(3086, @"[In FileRenameInformation,Pseudocode for the operation is as follows:] If AddTargetLink is TRUE:
                        The operation must be failed with STATUS_ACCESS_DENIED if either of the following conditions are true:
                        Open.File.FileType is DirectoryFile and the caller does not have FILE_ADD_SUBDIRECTORY access on DestinationDirectory.");
                    return MessageStatus.ACCESS_DENIED;
                }

                //The operation MUST be failed with STATUS_ACCESS_DENIED if either of the following conditions are true: ]
                //Open.File.FileType is DataFile and the caller does not have FILE_ADD_FILE access on DestinationDirectory.
                if (gfileTypeToOpen == FileType.DataFile && ((gOpenGrantedAccess & FileAccess.FILE_ADD_FILE) == 0))
                {
                    Helper.CaptureRequirement(3087, @"[In FileRenameInformation,Pseudocode for the operation is as follows: If AddTargetLink is TRUE:
                        The operation MUST be failed with STATUS_ACCESS_DENIED if either of the following conditions are true: ]Open.File.FileType is DataFile
                        and the caller does not have FILE_ADD_FILE access on DestinationDirectory.");
                    return MessageStatus.ACCESS_DENIED;
                }
            }
            Helper.CaptureRequirement(3126, @"[In FileRenameInformation,Pseudocode for the operation is as follows:] The operation returns STATUS_SUCCESS.");
            return MessageStatus.SUCCESS;
        }