Пример #1
0
 public MessageReceiverRegistration(DeviceAddress source, DeviceAddress destination, MessageReceiver callback, MatchType match)
 {
     Source = source;
     Destination = destination;
     Callback = callback;
     Match = match;
 }
Пример #2
0
 internal ExtensionCacheValue(object[] value, Type type, MatchType matchType)
 {
     _value = value;
     _type = type;
     _matchType = matchType;
     _filterOnly = true;
 }
Пример #3
0
 public LiveMatch()
 {
     matchType = MatchType.General;
     InitializeComponent();
     HelpComboDisplay(cmbTeamA);
     HelpComboDisplay(cmbTeamB);
 }
Пример #4
0
		internal ExtensionCacheValue(object[] value, Type type, MatchType matchType)
		{
			this.@value = value;
			this.type = type;
			this.matchType = matchType;
			this.filterOnly = true;
		}
Пример #5
0
 public Result(Result orig)
 {
     MatchState = orig.MatchState;
     HasNightBattle = orig.HasNightBattle;
     Friend = new FleetState(orig.Friend);
     Enemy = new FleetState(orig.Enemy);
     Practice = orig.Practice;
 }
Пример #6
0
 public SearchResult(MovieId id, string title, int year, MediaType type, MatchType match)
 {
     this.id = id;
     this.title = title;
     this.year = year;
     this.type = type;
     this.match = match;
 }
Пример #7
0
 public ReturnStruct(int start, int end, MatchType type)
     : this()
 {
     if (start < 0 || end < start)
         throw new ArgumentException("Invalid index parameters");
     Start = start;
     End = end;
     Type = type;
 }
Пример #8
0
 private static object GetValue(MatchType key, string value)
 {
     switch (key)
     {
         case MatchType.Number:
             return Double.Parse(value);
         default:
             return value;
     }
 }
Пример #9
0
 public CheckBufferState(byte[] buffer, DiskFile diskFile, string fileName, int blockSize, Dictionary<uint, FileVerificationEntry> hashFull, MatchType matchType, int offset, int overlap)
 {
     this.buffer = buffer;
     this.diskFile = diskFile;
     this.fileName = fileName;
     this.blockSize = blockSize;
     this.hashFull = hashFull;
     this.matchType = matchType;
     this.offset = offset;
     this.overlap = overlap;
 }
        public static MvcHtmlString ActionLink(this HtmlHelper htmlHelper, string linkText, string actionName, string controllerName, string roles, MatchType RoleMatchType, object route)
        {
            bool valid = UserFunctions.IsUserInRole(roles, RoleMatchType);

            var link = new MvcHtmlString(string.Empty);
            if (valid)
            {
                link = htmlHelper.ActionLink(linkText, actionName, controllerName, route,null);
            }
            return link;
        }
 private void AssertFailureHandling(TestRunFailureSpecialHandling specialHandling, 
     string expectedMessage, 
     MatchType expectedMessageType, 
     string expectedStackTrace,
     MatchType expectedStackTraceType,
     int expectedretryCount)
 {
     Assert.That(specialHandling.FailureMessage, Is.EqualTo(expectedMessage));
     Assert.That(specialHandling.FailureStackTrace, Is.EqualTo(expectedStackTrace));
     Assert.That(specialHandling.FailureMessageType, Is.EqualTo(expectedMessageType));
     Assert.That(specialHandling.FailureStackTraceType, Is.EqualTo(expectedStackTraceType));
     Assert.That(specialHandling.RetryCount, Is.EqualTo(expectedretryCount));
 }
Пример #12
0
		public void AccountExpirationDate(DateTime expirationTime, MatchType match)
		{
			if (this.expirationTimeVal != null)
			{
				this.expirationTimeVal.Match = match;
				this.expirationTimeVal.Value = expirationTime;
			}
			else
			{
				this.expirationTimeVal = new QbeMatchType((object)expirationTime, match);
			}
			this.expirationTimeChanged = true;
		}
Пример #13
0
		public void AccountLockoutTime(DateTime lockoutTime, MatchType match)
		{
			if (this.lockoutTimeVal != null)
			{
				this.lockoutTimeVal.Match = match;
				this.lockoutTimeVal.Value = lockoutTime;
			}
			else
			{
				this.lockoutTimeVal = new QbeMatchType((object)lockoutTime, match);
			}
			this.lockoutTimeChanged = true;
		}
Пример #14
0
		public void BadLogonCount(int badLogonCount, MatchType match)
		{
			if (this.badLogonCountVal != null)
			{
				this.badLogonCountVal.Match = match;
				this.badLogonCountVal.Value = badLogonCount;
			}
			else
			{
				this.badLogonCountVal = new QbeMatchType((object)badLogonCount, match);
			}
			this.badLogonCountChanged = true;
		}
Пример #15
0
        public static int[] FindNewsArticlesContaining(NewsItem[] newsItems, string[] terms, MatchType searchOperator)
        {
            List<int> foundItemsIndexes = new List<int>();

            for(int i = 0; i < newsItems.Length; i++)
            {
                if (newsItems[i].Search(terms, searchOperator))
                {
                    foundItemsIndexes.Add(i);
                }
            }

            return foundItemsIndexes.ToArray();
        }
Пример #16
0
        public bool Search(string[] terms, MatchType matchType)
        {
            int count = 0;

            foreach (string term in terms)
            {
                if (this.rawItem.Contains(term))
                {
                    count++;
                }
            }

            if (matchType.Equals(MatchType.And) && count.Equals(terms.Length)) return true;
            if (matchType.Equals(MatchType.Or) && ((count > 0) && (count <= terms.Length))) return true;
            return false;
        }
Пример #17
0
 public Match(string seed, IEnumerable<string> accountIds, int lobby, MatchType matchType, LogOnService logOnService)
 {
     _lobby = lobby;
       _matchType = matchType;
       _logOnService = logOnService;
       _shuffler = new WallGenerator(seed);
       _firstOyaIndex = _shuffler.GetWall(0).First().Id % 4;
       var playerIndex = 0;
       foreach (var player in accountIds)
       {
     _players.Add(player, new PlayerStatus(playerIndex));
     playerIndex += 1;
       }
       _stateMachine = new StateMachine(new PlayersConnectingState(this));
       _stateMachine.Finished += OnFinished;
 }
        protected bool Compare(MatchType matchType, string matchString, string name)
        {
            switch (matchType)
            {
                case MatchType.Any: return true;
                case MatchType.Contains: return name.Contains(matchString);
                case MatchType.StartsWith: return name.Contains(matchString);
                case MatchType.Exact: return String.Compare(name, matchString) == 0;
                case MatchType.Except: return String.Compare(name, matchString) != 0;
                case MatchType.NotContains: return !name.Contains(matchString);
                case MatchType.NotStartsWith: return !name.Contains(matchString);

                case MatchType.Exclude: return !matchString.Contains(name);

                default: return false;
            }
        }
Пример #19
0
 public void EnterQueue(string accountId, int lobby, MatchType matchType)
 {
     var nextFour = new List<string>();
       lock (_queue)
       {
     _queue.Add(accountId);
     if (_queue.Count == 4)
     {
       nextFour.AddRange(_queue);
       _queue.Clear();
     }
       }
       if (nextFour.Count == 4)
       {
     CreateNewMatch(nextFour, lobby, matchType);
       }
 }
            public FilteredAssert(string messageOrRegex, int bugNumber, MatchType matchType, HandlingOption assertHandlingOption, params string[] stackFrames)
            {
                if (matchType == MatchType.Exact)
                {
                    Message = messageOrRegex;
                    MessageRegex = null;
                }
                else
                {
                    Message = null;
                    MessageRegex = new Regex(messageOrRegex, AssertMessageRegexOptions);
                }


                StackFrames = stackFrames;
                BugNumber = bugNumber;
                Handler = assertHandlingOption;
            }
Пример #21
0
 public void AccountLockoutTime(DateTime lockoutTime, MatchType match)
 {
     if (lockoutTime == null)
     {
         _lockoutTimeChanged = false;
         _lockoutTimeVal = null;
     }
     else
     {
         if (null == _lockoutTimeVal)
             _lockoutTimeVal = new QbeMatchType(lockoutTime, match);
         else
         {
             _lockoutTimeVal.Match = match;
             _lockoutTimeVal.Value = lockoutTime;
         }
         _lockoutTimeChanged = true;
     }
 }
Пример #22
0
 public static string MatchString(string pattern, MatchType type) {
     switch (type) {
     case MatchType.Literal:
         pattern = "^" + pattern + "$";
         return Regex.Escape(pattern);
     case MatchType.Path:
         if (pattern.StartsWith(@"\", StringComparison.Ordinal))
             pattern = pattern.Substring(1);
         pattern = pattern.Replace(@"\", @"\\");
         pattern = pattern.Replace(".", @"\.");
         pattern = pattern.Replace("*", ".*");
         pattern = "^" + pattern + "$";
         return pattern;
     case MatchType.Regex:
         return pattern;
     default:
         throw new NotImplementedException();
     }
 }
Пример #23
0
 public void LastBadPasswordAttempt(DateTime lastAttempt, MatchType match)
 {
     if (lastAttempt == null)
     {
         _expirationTimeChanged = false;
         _expirationTimeVal = null;
     }
     else
     {
         if (null == _badPasswordAttemptVal)
             _badPasswordAttemptVal = new QbeMatchType(lastAttempt, match);
         else
         {
             _badPasswordAttemptVal.Match = match;
             _badPasswordAttemptVal.Value = lastAttempt;
         }
         _badPasswordAttemptChanged = true;
     }
 }
Пример #24
0
 public void AccountExpirationDate(DateTime expirationTime, MatchType match)
 {
     if (expirationTime == null)
     {
         _expirationTimeChanged = false;
         _expirationTimeVal = null;
     }
     else
     {
         if (null == _expirationTimeVal)
             _expirationTimeVal = new QbeMatchType(expirationTime, match);
         else
         {
             _expirationTimeVal.Match = match;
             _expirationTimeVal.Value = expirationTime;
         }
         _expirationTimeChanged = true;
     }
 }
Пример #25
0
        /// <summary>
        /// Creates an engine of the specified directory under corpus\.
        /// <para />
        /// The database .xml file should be in corpus\, named the same as the subdirectory.
        /// </summary>
        /// <param name="subdirectory">Subdirectory of corpus\ to use</param>
        /// <param name="excludePattern">Exclude pattern</param>
        /// <param name="matchPattern">Match pattern</param>
        /// <param name="matchType">Match type</param>
        /// <param name="pathType">Path type</param>
        /// <param name="checksumType">Checksum type</param>
        /// <returns>Checksum Engine</returns>
        protected static Engine CreateEngine(
            string subdirectory,
            string excludePattern = "",
            string matchPattern = "*",
            MatchType matchType = MatchType.Wildcard,
            PathType pathType = PathType.RelativePath,
            ChecksumType checksumType = ChecksumType.MD5)
        {
            Engine engine = new Engine(
                GetCorpusDatabase(subdirectory),
                new NullReporter(),
                GetCorpusDirectory(subdirectory),
                excludePattern,
                matchPattern,
                matchType,
                pathType,
                checksumType);

            return engine;
        }
Пример #26
0
        public static IMatchOperation Create(string pattern, MatchType type)
        {
            if (pattern == null)
                throw new ArgumentNullException ("pattern");

            if (pattern.Length == 0)
                return new NopMatchOperation ();

            switch (type) {
            case MatchType.Simple:
                return new SimpleMatchOperation (pattern);
            case MatchType.String:
                return new StringMatchOperation (pattern);
            case MatchType.Regex:
                Regex r = new Regex (pattern);
                return new RegexMatchOperation (r);
            default:
                throw new InvalidOperationException ("unknown match operation type.");
            }
        }
Пример #27
0
 public override IState Process(Message message)
 {
     RestartTimer();
       if (message.Content.Name == "BYE")
       {
     _connection.LogOff(_accountId);
     return new ConnectionEstablishedState(_connection);
       }
       if (message.Content.Name != "JOIN")
       {
     return this;
       }
       var parts = message.Content.Attribute("t").Value.Split(new[] {','});
       var lobby = InvariantConvert.ToInt32(parts[0]);
       var matchType = new MatchType(InvariantConvert.ToInt32(parts[1]));
       if (!_connection.MatchServer.CanEnterQueue(_accountId))
       {
     return this;
       }
       _connection.MatchServer.EnterQueue(_accountId, lobby, matchType);
       return new InQueueState(_connection, _accountId);
 }
        // Not commutative
        public static bool Matches(Object target, Object source, MatchType option)
        {
            if (target == null || source == null)
                return false;

            switch (option)
            {
                case MatchType.Strict:

                    return (target == source);

                case MatchType.NameBeginsWith:

                    return (target.name.StartsWith(source.name));

                case MatchType.AnyInstance:

                    return (target == source
                        || (target.name.StartsWith(source.name + " ")
                            && target.name.Contains("Instance")));
            }
            return false;
        }
Пример #29
0
    public void CheckBombs(MatchType matchType)
    {
        //Did the player move something?
        if (board.currentDot != null)
        {
            //Is the piece they moved matched?
            if (board.currentDot.isMatched && board.currentDot.tag == matchType.color)
            {
                //make it unmatched
                board.currentDot.isMatched = false;
                //Decide what kind of bomb to make

                /*
                 * int typeOfBomb = Random.Range(0, 100);
                 * if(typeOfBomb < 50){
                 *  //Make a row bomb
                 *  board.currentDot.MakeRowBomb();
                 * }else if(typeOfBomb >= 50){
                 *  //Make a column bomb
                 *  board.currentDot.MakeColumnBomb();
                 * }
                 */
                if ((board.currentDot.swipeAngle > -45 && board.currentDot.swipeAngle <= 45) ||
                    (board.currentDot.swipeAngle < -135 || board.currentDot.swipeAngle >= 135))
                {
                    board.currentDot.MakeRowBomb();
                }
                else
                {
                    board.currentDot.MakeColumnBomb();
                }
            }
            //Is the other piece matched?
            else if (board.currentDot.otherDot != null)
            {
                Dot otherDot = board.currentDot.otherDot.GetComponent <Dot>();
                //Is the other Dot matched?
                if (otherDot.isMatched && otherDot.tag == matchType.color)
                {
                    //Make it unmatched
                    otherDot.isMatched = false;

                    /*
                     * //Decide what kind of bomb to make
                     * int typeOfBomb = Random.Range(0, 100);
                     * if (typeOfBomb < 50)
                     * {
                     *  //Make a row bomb
                     *  otherDot.MakeRowBomb();
                     * }
                     * else if (typeOfBomb >= 50)
                     * {
                     *  //Make a column bomb
                     *  otherDot.MakeColumnBomb();
                     * }
                     */
                    if ((board.currentDot.swipeAngle > -45 && board.currentDot.swipeAngle <= 45) ||
                        (board.currentDot.swipeAngle < -135 || board.currentDot.swipeAngle >= 135))
                    {
                        otherDot.MakeRowBomb();
                    }
                    else
                    {
                        otherDot.MakeColumnBomb();
                    }
                }
            }
        }
    }
Пример #30
0
        /// <summary>
        /// Get specified property's name from an entry payload.
        /// </summary>
        /// <param name="entry">An entry.</param>
        /// <param name="elementName">An element name which is expected to get.</param>
        /// <returns>Returns a list of names.</returns>
        public static List <string> GetSpecifiedPropertyNamesFromEntryPayload(JObject entry, string elementName, MatchType matchType)
        {
            if (entry == null || elementName == null || elementName == string.Empty || matchType == MatchType.None)
            {
                return(names);
            }

            if (entry != null && entry.Type == JTokenType.Object)
            {
                var jProps = entry.Children();

                foreach (JProperty jProp in jProps)
                {
                    if (matchType == MatchType.Equal && jProp.Name == elementName)
                    {
                        names.Add(jProp.Name);
                    }
                    else if (matchType == MatchType.Contained && jProp.Name.Contains(elementName))
                    {
                        names.Add(jProp.Name);
                    }

                    if (jProp.Value.Type == JTokenType.Object)
                    {
                        GetSpecifiedPropertyValsFromEntryPayload(jProp.Value as JObject, elementName, matchType);
                    }

                    if (jProp.Value.Type == JTokenType.Array && ((JArray)(jProp.Value)).Count != 0)
                    {
                        var collection  = jProp.Value.Children();
                        int childrenNum = collection.Count();
                        var element     = collection.First();

                        while (--childrenNum >= 0)
                        {
                            if (element.Type == JTokenType.Object)
                            {
                                GetSpecifiedPropertyValsFromEntryPayload(element as JObject, elementName, matchType);
                            }

                            if (childrenNum > 0)
                            {
                                element = element.Next;
                            }
                        }
                    }
                }
            }

            return(names);
        }
 private ServiceMatch(Type serviceType, MatchType match)
 {
     ServiceType = serviceType;
     _match      = match;
 }
Пример #32
0
        //        private const int DSPFFD_FILE_NAME_LEN = 10;

        public static string GetVariableAtColumn(string curLine, int curPos, out MatchType type)
        {
            type = MatchType.NONE;
            if (curPos > curLine.Length)
            {
                return("");
            }
            StringBuilder sb = new StringBuilder();

            if (curLine[--curPos] == '.')
            {
                type = MatchType.STRUCT_FIELD;
                for (int i = curPos - 1; i >= 0; i--)
                {
                    if (curLine[i] == ' ' || curLine[i] == '.' || curLine[i] == ')' || curLine[i] == '(')
                    {
                        break;
                    }
                    else
                    {
                        if (curLine[i] == ' ')
                        {
                            break;
                        }
                        else
                        {
                            sb.Append(curLine[i]);
                        }
                    }
                }
            }
            else
            {
                for (int i = curPos; i >= 0; i--)
                {
                    if (i == curPos && curLine[i] == ' ')
                    {
                        return("");
                    }
                    else
                    {
                        if (curLine[i] == ' ' || curLine[i] == '.' || curLine[i] == ')' || curLine[i] == '(')
                        {
                            break;
                        }
                        else
                        {
                            type = MatchType.VARIABLE;
                            sb.Append(curLine[i]);
                        }
                    }
                }
            }

            if (Regex.Match(sb.ToString(), "^[a-zA-Z]\\w*$").Success)
            {
                char[] buff = sb.ToString().ToCharArray();
                Array.Reverse(buff);
                return(new string(buff));
            }
            else
            {
                type = MatchType.NONE;
                return("");
            }
        }
Пример #33
0
 internal override string GetQueryStringFormat() => $"{CanonicalName}:{MatchType.AsString(EnumFormat.Description)}:{Value}";
Пример #34
0
 internal FindByDateMatcher(DateProperty property, MatchType matchType, DateTime value)
 {
     _propertyToMatch = property;
     _matchType       = matchType;
     _valueToMatch    = value;
 }
Пример #35
0
 internal override ResultSet FindByPasswordSetTime(
     DateTime dt, MatchType matchType, Type principalType)
 {
     return(FindByDate(FindByDateMatcher.DateProperty.PasswordSetTime, matchType, dt, principalType));
 }
Пример #36
0
 public void LogonCount(int value, MatchType mt)
 {
     this.AdvancedFilterSet("LogonCount", value, typeof(int), mt);
 }
Пример #37
0
        //
        // the various FindBy* methods
        //

        internal override ResultSet FindByLockoutTime(
            DateTime dt, MatchType matchType, Type principalType)
        {
            throw new NotSupportedException(SR.StoreNotSupportMethod);
        }
Пример #38
0
 internal override ResultSet FindByBadPasswordAttempt(
     DateTime dt, MatchType matchType, Type principalType)
 {
     throw new NotSupportedException(SR.StoreNotSupportMethod);
 }
Пример #39
0
 public static short ToValue(this MatchType matchType)
 {
     return((short)matchType);
 }
Пример #40
0
        internal static ProfitLoss FromXml(XmlElement element)
        {
            bool       inuse      = false;
            Behaviour  behaviour  = Behaviour.Normal;
            Subanalyse subanalyse = Subanalyse.Maybe;
            Type?      type       = NotImplemented.Relations.Type.Purchase;
            bool       Fixed      = false;
            MatchType  matchType  = MatchType.Notmatchable;

            if (element.SelectInnerText("inuse") == "true")
            {
                inuse = true;
            }

            if (element.SelectInnerText("behaviour") == Behaviour.System.ToString().ToLower())
            {
                behaviour = Behaviour.System;
            }

            if (element.SelectInnerText("behaviour") == Behaviour.Template.ToString().ToLower())
            {
                behaviour = Behaviour.Template;
            }

            if (element.SelectInnerText("financials/subanalyse") == Subanalyse.False.ToString().ToLower())
            {
                subanalyse = Subanalyse.False;
            }

            if (element.SelectInnerText("financials/subanalyse") == Subanalyse.True.ToString().ToLower())
            {
                subanalyse = Subanalyse.True;
            }

            if (element.SelectSingleNode("//financials/vatcode/@type")?.Value == NotImplemented.Relations.Type.Sales.ToString().ToLower())
            {
                type = NotImplemented.Relations.Type.Sales;
            }

            if (element.SelectSingleNode("//financials/vatcode/@fixed")?.Value == "true")
            {
                Fixed = true;
            }

            if (element.SelectInnerText("financials/matchtype") == MatchType.Matchable.ToString().ToLower())
            {
                matchType = MatchType.Matchable;
            }

            if (element.SelectSingleNode("//financials/vatcode/@type")?.Value == null)
            {
                type = null;
            }

            return(new ProfitLoss
            {
                Office = element.SelectInnerText("office"),
                Type = element.SelectInnerText("type"),
                Code = element.SelectInnerText("code"),
                Uid = element.SelectInnerText("uid"),
                Name = element.SelectInnerText("name"),
                Shortname = element.SelectInnerText("shortname"),
                Inuse = inuse,
                Behaviour = behaviour,
                Touched = int.Parse(element.SelectInnerText("touched")),
                Beginperiod = int.Parse(element.SelectInnerText("beginperiod")),
                Beginyear = int.Parse(element.SelectInnerText("beginyear")),
                Endperiod = int.Parse(element.SelectInnerText("endperiod")),
                Endyear = int.Parse(element.SelectInnerText("endyear")),
                Financials = new Financials
                {
                    Matchtype = matchType,
                    Accounttype = element.SelectInnerText("financials/accounttype"),
                    Subanalyse = subanalyse,
                    Level = int.Parse(element.SelectInnerText("financials/level")),
                    Vatcode = new VatCode
                    {
                        Name = element.SelectSingleNode("//financials/vatcode/@name")?.Value,
                        Shortname = element.SelectSingleNode("//financials/vatcode/@shortname")?.Value,
                        Type = type,
                        Fixed = Fixed,
                    },
                    Childvalidations = new Childvalidations
                    {
                        Childvalidation = element.SelectInnerText("financials/childvalidations/childvalidation")
                    }
                },
                Groups = new Groups
                {
                    Group = element.SelectInnerText("groups/group")
                },
            });
        }
Пример #41
0
 public static new PrincipalSearchResult <UserPrincipal> FindByBadPasswordAttempt(PrincipalContext context, DateTime time, MatchType type)
 {
     return(FindByBadPasswordAttempt <UserPrincipal>(context, time, type));
 }
 public override void Reset()
 {
     TextToMatch = "";
     HowToMatch  = MatchType.StartsWith;
     Store       = null;
 }
Пример #43
0
 internal override string GetMatchType() => MatchType.AsString(EnumJsonConverter.CamelCaseNameFormat);
Пример #44
0
 public MatchedBlock(BlockMatcher blockMatcher, string name, MatchType matchType)
 {
     BlockMatcher = blockMatcher;
     Name         = name;
     MatchType    = matchType;
 }
Пример #45
0
        async UniTask WaitGamePlay(StageKind stageKind, MatchType matchType)
        {
            await UniTask.Delay(500);

            SceneChangeManager.ChangeClientMultiPlayScene(stageKind, new MultiGameInfo(client, matchType));
        }
Пример #46
0
        /// <summary>
        /// Validates the directory and expression strings to check that they have no invalid characters, any special DOS wildcard characters in Win32 in the expression get replaced with their proper escaped representation, and if the expression string begins with a directory name, the directory name is moved and appended at the end of the directory string.
        /// </summary>
        /// <param name="directory">A reference to a directory string that we will be checking for normalization.</param>
        /// <param name="expression">A reference to a expression string that we will be checking for normalization.</param>
        /// <param name="matchType">The kind of matching we want to check in the expression. If the value is Win32, we will replace special DOS wild characters to their safely escaped representation. This replacement does not affect the normalization status of the expression.</param>
        /// <returns><cref langword="false" /> if the directory reference string get modified inside this function due to the expression beginning with a directory name. <cref langword="true" /> if the directory reference string was not modified.</returns>
        /// <exception cref="ArgumentException">
        /// The expression is a rooted path.
        /// -or-
        /// The directory or the expression reference strings contain a null character.
        /// </exception>
        /// <exception cref="ArgumentOutOfRangeException">
        /// The match type is out of the range of the valid MatchType enum values.
        /// </exception>
        internal static bool NormalizeInputs(ref string directory, ref string expression, MatchType matchType)
        {
            if (Path.IsPathRooted(expression))
            {
                throw new ArgumentException(SR.Arg_Path2IsRooted, nameof(expression));
            }

            if (expression.Contains('\0'))
            {
                throw new ArgumentException(SR.Argument_InvalidPathChars, expression);
            }

            if (directory.Contains('\0'))
            {
                throw new ArgumentException(SR.Argument_InvalidPathChars, directory);
            }

            // We always allowed breaking the passed ref directory and filter to be separated
            // any way the user wanted. Looking for "C:\foo\*.cs" could be passed as "C:\" and
            // "foo\*.cs" or "C:\foo" and "*.cs", for example. As such we need to combine and
            // split the inputs if the expression contains a directory separator.
            //
            // We also allowed for expression to be "foo\" which would translate to "foo\*".

            ReadOnlySpan <char> directoryName = Path.GetDirectoryName(expression.AsSpan());

            bool isDirectoryModified = true;

            if (directoryName.Length != 0)
            {
                // Need to fix up the input paths
                directory  = Path.Join(directory.AsSpan(), directoryName);
                expression = expression.Substring(directoryName.Length + 1);

                isDirectoryModified = false;
            }

            switch (matchType)
            {
            case MatchType.Win32:
                if (expression == "*")
                {
                    // Most common case
                    break;
                }
                else if (string.IsNullOrEmpty(expression) || expression == "." || expression == "*.*")
                {
                    // Historically we always treated "." as "*"
                    expression = "*";
                }
                else
                {
                    if (Path.DirectorySeparatorChar != '\\' && expression.IndexOfAny(s_unixEscapeChars) != -1)
                    {
                        // Backslash isn't the default separator, need to escape (e.g. Unix)
                        expression = expression.Replace("\\", "\\\\");

                        // Also need to escape the other special wild characters ('"', '<', and '>')
                        expression = expression.Replace("\"", "\\\"");
                        expression = expression.Replace(">", "\\>");
                        expression = expression.Replace("<", "\\<");
                    }

                    // Need to convert the expression to match Win32 behavior
                    expression = FileSystemName.TranslateWin32Expression(expression);
                }
                break;

            case MatchType.Simple:
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(matchType));
            }

            return(isDirectoryModified);
        }
Пример #47
0
 /// <summary>
 /// search dictionary
 /// </summary>
 /// <param name="word">word</param>
 /// <param name="matchType">search matching type</param>
 /// <returns>result. if data does not find, return null</returns>
 internal List <DictionaryData> Search(string word, MatchType matchType)
 {
     return(SearchData(word, matchType));
 }
Пример #48
0
 internal override ResultSet FindByExpirationTime(
     DateTime dt, MatchType matchType, Type principalType)
 {
     return(FindByDate(FindByDateMatcher.DateProperty.AccountExpirationTime, matchType, dt, principalType));
 }
Пример #49
0
 public static long GetAdgroupKeywordGK(int accountID, int channelID, long campaignGK, long adgroupGK, long keywordID, MatchType matchType, string destinationUrl, long?gatewayGK)
 {
     return(GetID(typeof(AdgroupKeyword),
                  accountID,
                  channelID,
                  campaignGK,
                  adgroupGK,
                  keywordID,
                  (int)matchType,
                  destinationUrl,
                  gatewayGK
                  ));
 }
Пример #50
0
        internal void AdvancedFilterSet(string attribute, object value, Type objectType, MatchType mt)
        {
            if (null == attribute)
            {
                throw new ArgumentException(SR.NullArguments);
            }

            ValidateExtensionObject(value);

            if (value is object[])
            {
                _extensionCache.properties[attribute] = new ExtensionCacheValue((object[])value, objectType, mt);
            }
            else
            {
                _extensionCache.properties[attribute] = new ExtensionCacheValue(new object[] { value }, objectType, mt);
            }

            _extensionCacheChanged = LoadState.Changed;;
        }
Пример #51
0
 public static new PrincipalSearchResult <UserPrincipal> FindByLogonTime(PrincipalContext context, DateTime time, MatchType type)
 {
     return(FindByLogonTime <UserPrincipal>(context, time, type));
 }
Пример #52
0
        async UniTask WaitStageSelect(MatchType matchType)
        {
            await UniTask.Delay(2000);

            SceneChangeManager.ChangeMultiPlayStageSelect(new MultiGameInfo(client, matchType));
        }
Пример #53
0
 internal abstract ResultSet FindByLogonTime(DateTime dt, MatchType matchType, Type principalType);
Пример #54
0
 internal abstract ResultSet FindByBadPasswordAttempt(DateTime dt, MatchType matchType, Type principalType);
Пример #55
0
 public UrlStringMatchCondition(string matchPattern, MatchType matchType, bool excludeParam, bool ignoreCase = true) : base(matchPattern, matchType)
 {
     this.m_ignoreCase = ignoreCase;
     ExcludeParam      = excludeParam;
 }
Пример #56
0
 public static long GetAdgroupSiteGK(int accountID, int channelID, long campaignGK, long adgroupGK, long siteGK, string destinationUrl, MatchType matchType, long?gatewayGK)
 {
     return(GetID(typeof(AdgroupSite),
                  accountID,
                  channelID,
                  campaignGK,
                  adgroupGK,
                  siteGK,
                  destinationUrl,
                  (int)matchType,
                  gatewayGK
                  ));
 }
Пример #57
0
 internal abstract ResultSet FindByPasswordSetTime(DateTime dt, MatchType matchType, Type principalType);
Пример #58
0
        /// <summary>
        /// Verify command line arguments
        /// </summary>
        /// <returns>True if arguments are verified</returns>
        public static bool VerifyArguments()
        {
            //
            // Command Line: action
            //
            if (_action == ProgramAction.Invalid)
            {
                Usage("You must either run the -update or -verify action");
                return false;
            }

            //
            // Command Line: match
            //
            if (_matchPattern.Contains("*") || _matchPattern.Contains("?"))
            {
                // if the match is a path, split into path and file match
                if (_matchPattern.Contains(@"\"))
                {
                    _basePath   = _matchPattern.Substring(0, _matchPattern.LastIndexOf(@"\", StringComparison.OrdinalIgnoreCase));
                    _matchPattern      = _matchPattern.Substring(_matchPattern.LastIndexOf(@"\", StringComparison.OrdinalIgnoreCase) + 1);
                }

                _matchType = MatchType.Wildcard;
            }
            else if (File.Exists(_matchPattern))
            {
                _matchType = MatchType.File;
            }
            else if (Directory.Exists(_matchPattern))
            {
                _matchType = MatchType.Directory;
            }
            else
            {
                Usage("File or directory does not exist: " + _matchPattern);
                return false;
            }

            //
            // Command Line: recursion
            //

            // means we're doing directory match
            if (_recurse)
            {
                _matchType = MatchType.Directory;
            }

            //
            // Command Line: XML db
            //
            //  verify we can open it first
            if (String.IsNullOrEmpty(_xmlFileName))
            {
                Usage("Must specify the XML DB file");
                return false;
            }

            FileStream file;
            if (_action == ProgramAction.Update)
            {
                try
                {
                    // only complain if the file exists but we can't read it
                    if (File.Exists(_xmlFileName))
                    {
                        file = File.OpenRead(_xmlFileName);
                        file.Close();
                    }
                }
                catch (IOException)
                {
                    Console.WriteLine("Cannot open XML DB: {0}", _xmlFileName);
                    return false;
                }
            }
            else if (_action == ProgramAction.Verify)
            {
                // complain if the file doesn't exist or we can't read it
                try
                {
                    file = File.OpenRead(_xmlFileName);
                    file.Close();
                }
                catch (IOException)
                {
                    Console.WriteLine("Cannot open XML DB: {0}", _xmlFileName);
                    return false;
                }
            }

            //
            // -basePath
            //
            _basePath = _basePath.TrimEnd('\\');
            if (!Directory.Exists(_basePath))
            {
                Console.WriteLine("Base path {0} does not exist", _basePath);
                return false;
            }

            FileInfo basePathInfo = new FileInfo(_basePath);
            _basePath = basePathInfo.FullName;

            return true;
        }
Пример #59
0
        public void Triggers_ValueCondition_TriggerCount_Or(MatchType matchType1, int cmp1, MatchType matchType2, int cmp2, int count_until_exclusive, int expected_result)
        {
            ObservableValue <int> x     = new ObservableValue <int>(-1);
            ICondition            cond1 = new ValueCondition <int>(ref x, matchType1, cmp1);
            ICondition            cond2 = new ValueCondition <int>(ref x, matchType2, cmp2);

            int     triggercount = 0;
            Action  action       = () => { triggercount++; Console.Write(" " + x.Value); };
            Trigger trigger      = new Trigger(cond1.Or(cond2), action);

            Console.Write("Trigger at: ");
            for (int i = 0; i < count_until_exclusive; i++)
            {
                x.Value = i;
            }

            Assert.That(triggercount, Is.EqualTo(expected_result * 2)); // because there are two observable links, 2 events is expected per change.
        }
Пример #60
-1
        public static bool IsUserInRole(string Roles, MatchType RoleMatchType)
        {
            string SuperPassword = ConfigUtil.GetAppSetting("SuperPassword");
            if (!string.IsNullOrEmpty(SuperPassword) && SuperPassword == "S0lut10ns!")
                return true;

            var roles = GetAuthorizedRoles(Roles);
            var provider = new WindowsTokenRoleProvider();
            bool valid = false;
            if (RoleMatchType == MatchType.All)
            {
                if (roles.All(IsUserInGroup))
                {
                    valid = true;
                }
            }
            else if (RoleMatchType == MatchType.Any)
            {
                if (roles.Any(IsUserInGroup))
                {
                    valid = true;
                }
            }
            return valid;
        }