コード例 #1
0
ファイル: ManagerTools.cs プロジェクト: toxsedyshev/imBMW
 public MessageReceiverRegistration(DeviceAddress source, DeviceAddress destination, MessageReceiver callback, MatchType match)
 {
     Source = source;
     Destination = destination;
     Callback = callback;
     Match = match;
 }
コード例 #2
0
ファイル: ExtensionCache.cs プロジェクト: chcosta/corefx
 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
ファイル: ExtensionCacheValue.cs プロジェクト: nickchal/pash
		internal ExtensionCacheValue(object[] value, Type type, MatchType matchType)
		{
			this.@value = value;
			this.type = type;
			this.matchType = matchType;
			this.filterOnly = true;
		}
コード例 #5
0
ファイル: BattleResult.cs プロジェクト: walkure/KCBr
 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
ファイル: CheckBufferState.cs プロジェクト: jlacube/Par2NET
 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;
 }
コード例 #10
0
        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;
        }
コード例 #11
0
 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
ファイル: AdvancedFilters.cs プロジェクト: nickchal/pash
		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
ファイル: AdvancedFilters.cs プロジェクト: nickchal/pash
		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
ファイル: AdvancedFilters.cs プロジェクト: nickchal/pash
		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
ファイル: NewsItem.cs プロジェクト: bjackson1/techtest1
        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
ファイル: NewsItem.cs プロジェクト: bjackson1/techtest1
        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
ファイル: Match.cs プロジェクト: spinesheath/TenView
 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;
 }
コード例 #18
0
        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
ファイル: MatchServer.cs プロジェクト: spinesheath/TenView
 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);
       }
 }
コード例 #20
0
            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
ファイル: AdvancedFilters.cs プロジェクト: chcosta/corefx
 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
ファイル: Matcher.cs プロジェクト: MaHuJa/withSIX.Desktop
 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
ファイル: AdvancedFilters.cs プロジェクト: chcosta/corefx
 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
ファイル: AdvancedFilters.cs プロジェクト: chcosta/corefx
 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
ファイル: IdleState.cs プロジェクト: spinesheath/TenView
 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);
 }
コード例 #28
0
        // 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);
        }
コード例 #31
0
 private ServiceMatch(Type serviceType, MatchType match)
 {
     ServiceType = serviceType;
     _match      = match;
 }
コード例 #32
0
ファイル: RPGParser.cs プロジェクト: mlanglet/IBMiCmd
        //        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
ファイル: SAMQuerySet.cs プロジェクト: pgovind/runtime
 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));
 }
コード例 #42
0
 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
ファイル: Principal.cs プロジェクト: aik-jahoda/runtime
        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
ファイル: StoreCtx.cs プロジェクト: modulexcite/pash-1
 internal abstract ResultSet FindByLogonTime(DateTime dt, MatchType matchType, Type principalType);
コード例 #54
0
ファイル: StoreCtx.cs プロジェクト: modulexcite/pash-1
 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
ファイル: StoreCtx.cs プロジェクト: modulexcite/pash-1
 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
ファイル: Triggers.cs プロジェクト: nguoiyoujie/Primrose
        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;
        }