Beispiel #1
0
        public ProteinMatch(ProteinMatchSettings proteinMatchSettings, Protein protein)
        {
            Settings   = proteinMatchSettings;
            Protein    = protein;
            MatchTypes = ProteinMatchTypes.EMPTY;
            String ltext = proteinMatchSettings.SearchText.ToLower();

            foreach (ProteinMatchType matchType in ProteinMatchTypes.ALL) // name, accession, gene, etc - case insenstive
            {
                if (proteinMatchSettings.MatchTypes.Contains(matchType) &&
                    !proteinMatchSettings.MatchTypes.Contains(ProteinMatchType.sequence) &&
                    !proteinMatchSettings.MatchTypes.Contains(ProteinMatchType.description))     // handle sequence and description below
                {
                    if (Matches(protein.ProteinMetadata, matchType, ltext))
                    {
                        MatchTypes = MatchTypes.Union(matchType);
                    }
                    else
                    {
                        foreach (ProteinMetadata alternative in Protein.AlternativeNames)
                        {
                            if (Matches(alternative, matchType, ltext))
                            {
                                MatchTypes      = MatchTypes.Union(matchType);
                                AlternativeName = alternative;
                                break;
                            }
                        }
                    }
                }
            }
            if (MatchTypes.IsEmpty && // Don't bother declaring a description match if we already have a more specific one (name, accession etc)
                proteinMatchSettings.MatchTypes.Contains(ProteinMatchType.description))
            {
                if (ContainsLowerCase(protein.Description, ltext) ||
                    ContainsLowerCase(protein.Name, ltext))
                {
                    MatchTypes = MatchTypes.Union(ProteinMatchType.description);
                }
                else
                {
                    foreach (ProteinMetadata alternative in Protein.AlternativeNames)
                    {
                        if (ContainsLowerCase(alternative.Name, ltext) ||
                            ContainsLowerCase(alternative.Description, ltext))
                        {
                            MatchTypes             = MatchTypes.Union(ProteinMatchType.description);
                            AlternativeDescription = alternative;
                        }
                    }
                }
            }
            if (proteinMatchSettings.MatchTypes.Contains(ProteinMatchType.sequence))
            {
                if (protein.Sequence.IndexOf(proteinMatchSettings.SearchText, StringComparison.Ordinal) >= 0)
                {
                    MatchTypes = MatchTypes.Union(ProteinMatchType.sequence);
                }
            }
        }
Beispiel #2
0
 public bMatchData(MatchTypes matchType, MatchScoringTypes matchScoringType,
                   MatchTeamTypes matchTeamType, PlayModes playMode, string gameName, string gamePassword, int maxSlots,
                   string beatmapName, string beatmapChecksum, int beatmapId, Mods activeMods, int hostId, MultiSpecialModes multiSpecialMode,
                   int Seed)
 {
     this.matchType        = matchType;
     this.playMode         = playMode;
     this.matchScoringType = matchScoringType;
     this.matchTeamType    = matchTeamType;
     this.gameName         = gameName;
     this.gamePassword     = gamePassword;
     this.beatmapName      = beatmapName;
     this.beatmapChecksum  = beatmapChecksum;
     this.beatmapId        = beatmapId;
     this.activeMods       = activeMods;
     this.hostId           = hostId;
     this.specialModes     = multiSpecialMode;
     this.Seed             = Seed;
     this.SendPassword     = true;
     for (var i = 0; i < MaxRoomPlayers; i++)
     {
         slotStatus[i] = ((i < maxSlots) ? SlotStatus.Open : SlotStatus.Locked);
         slotId[i]     = -1;
     }
     if (gameName.Length > 50)
     {
         this.gameName = gameName.Remove(50);
     }
 }
Beispiel #3
0
        public IActionResult PutMatchTypes(int id, MatchTypes matchTypes)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != matchTypes.Id)
            {
                return(BadRequest());
            }

            db.Entry(matchTypes).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!MatchTypesExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(StatusCodes.Status204NoContent));
        }
Beispiel #4
0
        public bMatch(MatchTypes matchType, MatchScoringTypes matchScoringType, MatchTeamTypes matchTeamType, PlayModes playMode, string gameName,
                      string gamePassword, int initialSlotCount, string beatmapName, string beatmapChecksum, int beatmapId, Mods activeMods, int hostId,
                      MultiSpecialModes specialModes = MultiSpecialModes.None, int seed = 0)
        {
            this.matchType        = matchType;
            this.playMode         = playMode;
            this.matchScoringType = matchScoringType;
            this.matchTeamType    = matchTeamType;
            this.gameName         = gameName;
            this.gamePassword     = gamePassword;
            this.beatmapName      = beatmapName;
            this.beatmapChecksum  = beatmapChecksum;
            this.beatmapId        = beatmapId;
            this.activeMods       = activeMods;
            this.hostId           = hostId;
            this.specialModes     = specialModes;
            this.Seed             = seed;

            SendPassword = true;

            for (int i = 0; i < MAX_PLAYERS; i++)
            {
                slotStatus[i] = i < initialSlotCount ? SlotStatus.Open : SlotStatus.Locked;
                slotId[i]     = -1;
            }

            if (gameName.Length > 50)
            {
                gameName = gameName.Remove(50);
            }
        }
 internal ClientSideMatch(MatchTypes matchType, MatchScoringTypes matchScoringType, MatchTeamTypes matchTeamType,
                          PlayModes playMode, string gameName, string gamePassword, int initialSlotCount,
                          string beatmapName, string beatmapChecksum, int beatmapId, Mods activeMods, int hostId, MultiSpecialModes specialModes, int seed)
     : base(
         matchType, matchScoringType, matchTeamType, playMode, gameName, gamePassword, initialSlotCount,
         beatmapName, beatmapChecksum, beatmapId, activeMods, hostId, specialModes, seed)
 {
     SendPassword = true;
 }
Beispiel #6
0
        public new MatchTypes Match(char input)
        {
            MatchTypes match = MatchTypes.none;

            switch (_character)
            {
            case 't':
                if (!char.IsWhiteSpace(input) && !IsExcludedCharacter(input))
                {
                    match = MatchTypes.text;
                }
                break;

            case 's':
                if (!char.IsWhiteSpace(input) && !IsExcludedCharacter(input))
                {
                    return(MatchTypes.text);
                }
                if (char.IsWhiteSpace(input) && !IsExcludedCharacter(input))
                {
                    match = MatchTypes.whitespace;
                }
                break;

            case 'w':
                if (char.IsWhiteSpace(input) && !IsExcludedCharacter(input))
                {
                    match = MatchTypes.whitespace;
                }
                break;

            case 'r':
                if (input == '\r' && !IsExcludedCharacter(input))
                {
                    return(MatchTypes.carriagereturn);
                }
                if (input == '\n' && !IsExcludedCharacter(input))
                {
                    match = MatchTypes.newline;
                }
                break;
            }

            if (match != MatchTypes.none)
            {
                _currentReps++;
                if (_currentReps >= _requiredReps)
                {
                    Satisfy();
                }

                return(match);
            }

            Reset();
            return(match);
        }
 public StringFinderMatch(string match, string originalTarget, string[] possible, MatchTypes type, int indexOfFirstCharInSourceString, StringFinderCompMatch?previousComplemento, bool wordContainedInDictionary) : this()
 {
     Match          = match;
     OriginalTarget = originalTarget;
     _PossibleWords = possible;
     Type           = type;
     IndexOfFirstCharInSourceString = indexOfFirstCharInSourceString;
     PreviousComplemento            = previousComplemento;
     WordContainedInDictionary      = wordContainedInDictionary;
 }
Beispiel #8
0
        public bool MatchFile(string fileFullName)
        {
            if (MatchTypes == null)
            {
                return(true);
            }

            string extend = Path.GetExtension(fileFullName).Trim('.').ToLower();

            return(MatchTypes.Contains(extend));
        }
Beispiel #9
0
        public IActionResult GetMatchTypes(int id)
        {
            MatchTypes matchTypes = db.MatchTypes.Find(id);

            if (matchTypes == null)
            {
                return(NotFound());
            }

            return(Ok(matchTypes));
        }
Beispiel #10
0
        public IActionResult PostMatchTypes(MatchTypes matchTypes)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.MatchTypes.Add(matchTypes);
            db.SaveChanges();

            return(CreatedAtRoute("DefaultApi", new { id = matchTypes.Id }, matchTypes));
        }
Beispiel #11
0
        public bMatch(SerializationReader sr)
        {
            SendPassword = false;

            matchId         = sr.ReadUInt16();
            inProgress      = sr.ReadBoolean();
            matchType       = (MatchTypes)sr.ReadByte();
            activeMods      = (Mods)sr.ReadUInt32();
            gameName        = sr.ReadString();
            gamePassword    = sr.ReadString();
            beatmapName     = sr.ReadString();
            beatmapId       = sr.ReadInt32();
            beatmapChecksum = sr.ReadString();

            for (int i = 0; i < MAX_PLAYERS; i++)
            {
                slotStatus[i] = (SlotStatus)sr.ReadByte();
            }

            for (int i = 0; i < MAX_PLAYERS; i++)
            {
                slotTeam[i] = (SlotTeams)sr.ReadByte();
            }

            for (int i = 0; i < MAX_PLAYERS; i++)
            {
                slotId[i] = (slotStatus[i] & SlotStatus.HasPlayer) > 0 ? sr.ReadInt32() : -1;
            }

            hostId = sr.ReadInt32();

            playMode = (PlayModes)sr.ReadByte();

            matchScoringType = (MatchScoringTypes)sr.ReadByte();
            matchTeamType    = (MatchTeamTypes)sr.ReadByte();

            specialModes = (MultiSpecialModes)sr.ReadByte();

            if (gameName.Length > 50)
            {
                gameName = gameName.Remove(50);
            }

            if ((specialModes & MultiSpecialModes.FreeMod) > 0)
            {
                for (int i = 0; i < MAX_PLAYERS; i++)
                {
                    slotMods[i] = (Mods)sr.ReadInt32();
                }
            }
            Seed = sr.ReadInt32();
        }
Beispiel #12
0
        public IActionResult DeleteMatchTypes(int id)
        {
            MatchTypes matchTypes = _dystirDBContext.MatchTypes.Find(id);

            if (matchTypes == null)
            {
                return(NotFound());
            }

            _dystirDBContext.MatchTypes.Remove(matchTypes);
            _dystirDBContext.SaveChanges();

            return(Ok(matchTypes));
        }
Beispiel #13
0
        public IActionResult DeleteMatchTypes(int id)
        {
            MatchTypes matchTypes = db.MatchTypes.Find(id);

            if (matchTypes == null)
            {
                return(NotFound());
            }

            db.MatchTypes.Remove(matchTypes);
            db.SaveChanges();

            return(Ok(matchTypes));
        }
Beispiel #14
0
        public void Digest(char input)
        {
            // Digest does the following
            // Checks provided input against failure conditions
            // Checks if input matches current milestone
            // If input matches
            //   Adds input to charCache
            //   Determines if complete
            //   Determines if changes to milestones are required
            // If input !matches
            //   Checks if repeating pattern is found
            //   Fails markup and resets

            if (_currentMilestone > 0)
            {
                if (CheckFailures(input))
                {
                    Reset();
                    return;
                }
            }

            Milestone  current = _milestones[_currentMilestone];
            MatchTypes matched = current.Match(input);

            if (matched != MatchTypes.none && current.Satisfied)
            {
                if (!current.Repeating || (current.Repeating && current.RequiredReps > 0))
                {
                    AdvanceMilestone();
                }
            }
            else if (current.Satisfied && current.Repeating)
            {
                MatchTypes nextMatched = CheckMilestone(_currentMilestone + 1, input);
                if (nextMatched != MatchTypes.none)
                {
                    AdvanceMilestone();
                    if (!Successful)
                    {
                        AdvanceMilestone();
                    }
                }
            }
            else
            {
                Reset();
            }
        }
Beispiel #15
0
    ///minimum y is inclusive while maximum y is exclusive
    ///Used for coordinates in grid
    private void CheckForNewMatches(int aMaximumY, int aMinimumY)
    {
        for (int y = aMinimumY; y < aMaximumY; y++)
        {
            for (int x = 1; x <= this.gridManager.GetNumberOfDisplayedColumns(); x++)
            {
                MatchTypes match = this.matchManager.GetCompleteMatchInfo(new Vector2(x, y)).Item1;

                if (matchTypesByPriority.Contains(match) == true)
                {
                    detectedMatches[match].Add(new Vector2(x, y));
                }
            }
        }
    }
Beispiel #16
0
        protected bool CheckFailures(char input)
        {
            bool result = false;

            foreach (Failure trigger in _failTriggers)
            {
                MatchTypes match = trigger.Match(input);
                if (match != MatchTypes.none)
                {
                    if (trigger.Satisfied)
                    {
                        result = true;
                    }
                }
            }

            return(result);
        }
Beispiel #17
0
 public bMatchData(SerializationReader reader)
 {
     SendPassword    = false;
     matchId         = reader.ReadUInt16();
     inProgress      = reader.ReadBoolean();
     matchType       = (MatchTypes)reader.ReadByte();
     activeMods      = (Mods)reader.ReadUInt32();
     gameName        = reader.ReadString();
     gamePassword    = reader.ReadString();
     beatmapName     = reader.ReadString();
     beatmapId       = reader.ReadInt32();
     beatmapChecksum = reader.ReadString();
     for (var i = 0; i < MaxRoomPlayers; i++)
     {
         slotStatus[i] = (SlotStatus)reader.ReadByte();
     }
     for (var j = 0; j < MaxRoomPlayers; j++)
     {
         slotTeam[j] = (SlotTeams)reader.ReadByte();
     }
     for (var k = 0; k < MaxRoomPlayers; k++)
     {
         slotId[k] = (((slotStatus[k] & SlotStatus.Occupied) > (SlotStatus)0)
             ? reader.ReadInt32()
             : -1);
     }
     hostId           = reader.ReadInt32();
     playMode         = (PlayModes)reader.ReadByte();
     matchScoringType = (MatchScoringTypes)reader.ReadByte();
     matchTeamType    = (MatchTeamTypes)reader.ReadByte();
     specialModes     = (MultiSpecialModes)reader.ReadByte();
     if (gameName.Length > 50)
     {
         gameName = gameName.Remove(50);
     }
     if ((specialModes & MultiSpecialModes.FreeMod) > MultiSpecialModes.None)
     {
         for (var l = 0; l < MaxRoomPlayers; l++)
         {
             slotMods[l] = (Mods)reader.ReadInt32();
         }
     }
     Seed = reader.ReadInt32();
 }
Beispiel #18
0
 // Token: 0x06000DFF RID: 3583
 // RVA: 0x0004D394 File Offset: 0x0004B594
 public bMatch(Class32 class32_0)
 {
     this.SendPassword = false;
     this.matchId = (int)class32_0.ReadUInt16();
     this.inProgress = class32_0.ReadBoolean();
     this.matchType = (MatchTypes)class32_0.ReadByte();
     this.activeMods = (Mods)class32_0.ReadUInt32();
     this.gameName = class32_0.ReadString();
     this.gamePassword = class32_0.ReadString();
     this.beatmapName = class32_0.ReadString();
     this.beatmapId = class32_0.ReadInt32();
     this.beatmapChecksum = class32_0.ReadString();
     for (int i = 0; i < bMatch.smethod_0(); i++)
     {
         this.slotStatus[i] = (SlotStatus)class32_0.ReadByte();
     }
     for (int j = 0; j < bMatch.smethod_0(); j++)
     {
         this.slotTeam[j] = (SlotTeams)class32_0.ReadByte();
     }
     for (int k = 0; k < bMatch.smethod_0(); k++)
     {
         this.slotId[k] = (((this.slotStatus[k] & SlotStatus.flag_7) > (SlotStatus)0) ? class32_0.ReadInt32() : -1);
     }
     this.hostId = class32_0.ReadInt32();
     this.playMode = (PlayModes)class32_0.ReadByte();
     this.matchScoringType = (MatchScoringTypes)class32_0.ReadByte();
     this.matchTeamType = (MatchTeamTypes)class32_0.ReadByte();
     this.specialModes = (MultiSpecialModes)class32_0.ReadByte();
     if (this.gameName.Length > 50)
     {
         this.gameName = this.gameName.Remove(50);
     }
     if ((this.specialModes & MultiSpecialModes.FreeMod) > MultiSpecialModes.None)
     {
         for (int l = 0; l < bMatch.smethod_0(); l++)
         {
             this.slotMods[l] = (Mods)class32_0.ReadInt32();
         }
     }
     this.Seed = class32_0.ReadInt32();
 }
Beispiel #19
0
        /// <summary>
        /// Tries to match the message with a MessageType, using the pattern passed.
        /// If the message matches the pattern, and the pattern contains the ?&lt;data&gt; placeholder,
        /// any strings in that placeholder are stored into mData.
        /// </summary>
        /// <param name="rule">The regex to look for</param>
        /// <param name="matchType">The type of match to perform, i.e. Regex or EndsWith</param>
        /// <param name="type">The type to set this object to if a match is found</param>
        /// <returns>True if the message matches, else False.</returns>
        private bool ProcessMatch(MatchTypes matchType, string rule, MessageTypes type)
        {
            bool retval = false;

            Data = new Dictionary <string, string>();

            switch (matchType)
            {
            case (MatchTypes.EndsWith):
                if (Message.EndsWith(rule))
                {
                    Type   = type;
                    retval = true;
                }
                break;

            case (MatchTypes.Regex):
                Regex RE = new Regex(rule);
                if (RE.IsMatch(Message))
                {
                    Type = type;
                    MatchCollection matches = Regex.Matches(Message, rule);
                    foreach (Match match in matches)
                    {
                        for (int i = 1; i < match.Groups.Count; i++)
                        {
                            Data.Add(RE.GroupNameFromNumber(i), match.Groups[i].Value);
                        }
                    }

                    retval = true;
                }
                break;
            }

            if (Data.ContainsKey("username"))
            {
                SetUser(Data["username"]);
            }

            return(retval);
        }
Beispiel #20
0
        public List <MatchedCustomer> MatchCustomers(CustomerMatchParameter customerMatchParameter)
        {
            List <MatchedCustomer> customerIds = null;

            // Known specific match type which is not listed in the list of MatchTypes for which default
            // matching rules should be applied
            if (MatchTypes.Contains(customerMatchParameter.MatchType)
                &&
                !MatchTypesOverrideMatchRules.Contains(customerMatchParameter.MatchType)
                )
            {
                customerIds = MatchWithSpecifiedMatchType(customerMatchParameter);
            }
            else  // Unknown match type - let the Db routines decide
            {
                customerIds = MatchWithDefaultMatchTypeRules(customerMatchParameter);
            }

            return(customerIds);
        }
Beispiel #21
0
        static Array MatchShapes(VectorOfPoint[] First, VectorOfPoint[] Second, [InField] MatchTypes matchType)
        {
            Array outp    = default(Array);
            var   matches = new List <IndexedValue>();

            switch (matchType)
            {
            case MatchTypes.Symmetry:
                int max = First.Length > Second.Length ? Second.Length : First.Length;
                for (int i = 0; i < max; i++)
                {
                    var match = CvInvoke.MatchShapes(First[i], Second[i], ContoursMatchType.I1);
                    matches.Add(new IndexedValue()
                    {
                        i = i, k = 0, info = matches.Count.ToString(), value = match
                    });
                }
                outp = matches.ToArray();
                break;

            case MatchTypes.OneToMany:
                for (int i = 0; i < First.Length; i++)
                {
                    for (int k = 0; k < Second.Length; k++)
                    {
                        var match = CvInvoke.MatchShapes(First[i], Second[k], ContoursMatchType.I1);
                        matches.Add(new IndexedValue()
                        {
                            i = i, k = k, info = matches.Count.ToString(), value = match
                        });
                    }
                }
                outp = matches.ToArray();
                break;

            default:
                break;
            }
            return(outp);
        }
Beispiel #22
0
            public MessagePattern(string type, string matchType, string matchPattern)
            {
                if (Enum.IsDefined(typeof(MessageTypes), type))
                {
                    MessageType = (MessageTypes)Enum.Parse(typeof(MessageTypes), type);
                }
                else
                {
                    MessageType = MessageTypes.Other;
                }

                if (Enum.IsDefined(typeof(MatchTypes), matchType))
                {
                    MatchType = (MatchTypes)Enum.Parse(typeof(MatchTypes), matchType);
                }
                else
                {
                    MatchType = MatchTypes.EndsWith;
                }

                Pattern = matchPattern;
            }
Beispiel #23
0
    //************************Clean Dictionary of matches*******************************
    private Dictionary <SideTypes, int> GetCleanDictionary(Vector2 cellCoordinates, MatchTypes aTypeOfMatch, Dictionary <SideTypes, int> aDictionary)
    {
        switch (aTypeOfMatch)
        {
        case MatchTypes.bomb:
            CleanBombMatch(aDictionary);
            break;

        case MatchTypes.columnWipe:
            CleanColumnWipe(aDictionary);
            break;

        case MatchTypes.lineWipe:
            CleanLineWipe(aDictionary);
            break;

        case MatchTypes.normal:
            CleanNormalMatch(aDictionary);
            break;

        case MatchTypes.scissors:
            CleanScissors(aDictionary);
            break;

        case MatchTypes.totalWipe:
            CleanTotalWipe(aDictionary);
            break;

        case MatchTypes.tripleColumnWipe:
            CleanTripleColumnWipe(aDictionary);
            break;

        case MatchTypes.tripleLineWipe:
            CleanTripleLineWipe(aDictionary);
            break;
        }

        return(aDictionary);
    }
Beispiel #24
0
        public void SetMatched(MatchTypes mt = MatchTypes.Empty)
        {
            Matched = mt;
            switch (mt)
            {
            case MatchTypes.NotMatched:
                MatchedIcon = Properties.Resources.bullet_red;
                break;

            case MatchTypes.MatchedWithoutQty:
                MatchedIcon = Properties.Resources.bullet_yellow;
                break;

            case MatchTypes.Matched:
                MatchedIcon = Properties.Resources.bullet_green;
                break;

            default:
                MatchedIcon = Properties.Resources.transparent_small;
                break;
            }
        }
Beispiel #25
0
 private void Awake()
 {
     Instance = this;
     DontDestroyOnLoad(this.gameObject);
     MatchType = MatchTypes.None;
 }
Beispiel #26
0
 public MatchOn(MatchTypes type) => this.Type = type;
Beispiel #27
0
        private byte[] MatchValueOtherToByteArray( string match, MatchTypes matchType )
        {
            byte[] retval = null;

            // hex
            if ( match.StartsWith( "0x" ) )
            {
                retval = HexStringToByteArray( match );
            }
            else
            {
                if ( matchType == MatchTypes.TypeByte )
                {
                    retval = new byte[ 1 ];

                    retval[ 0 ] = System.Convert.ToByte( match );
                }
                else
                if ( matchType == MatchTypes.TypeHost16 || matchType == MatchTypes.TypeLittle16 )
                {
                    retval = new byte[ 2 ];

                 	UInt16 i16 = System.Convert.ToUInt16( OctalStringToInt( match ) );

                    retval[ 0 ] = System.Convert.ToByte( i16 & 0x00FF );
                    retval[ 1 ] = System.Convert.ToByte( i16 >> 8 );
                }
                if ( matchType == MatchTypes.TypeBig16 )
                {
                    retval = new byte[ 2 ];

                 	UInt16 i16 = System.Convert.ToUInt16( OctalStringToInt( match ) );

                    retval[ 0 ] = System.Convert.ToByte( i16 >> 8 );
                    retval[ 1 ] = System.Convert.ToByte( i16 & 0x00FF );
                }
                else
                if ( matchType == MatchTypes.TypeHost32 || matchType == MatchTypes.TypeLittle32 )
                {
                    retval = new byte[ 4 ];

                 	UInt32 i32 = OctalStringToInt( match );

                    retval[ 0 ] = System.Convert.ToByte( i32 & 0x000000FF );
                    retval[ 1 ] = System.Convert.ToByte( ( i32 & 0x0000FF00 ) >> 8 );
                    retval[ 2 ] = System.Convert.ToByte( ( i32 & 0x00FF0000 ) >> 16 );
                    retval[ 3 ] = System.Convert.ToByte( ( i32 & 0xFF000000 ) >> 24 );
                }
                else
                if ( matchType == MatchTypes.TypeBig32 )
                {
                    retval = new byte[ 4 ];

                 	UInt32 i32 = OctalStringToInt( match );

                    retval[ 0 ] = System.Convert.ToByte( ( i32 & 0xFF000000 ) >> 24 );
                    retval[ 1 ] = System.Convert.ToByte( ( i32 & 0x00FF0000 ) >> 16 );
                    retval[ 2 ] = System.Convert.ToByte( ( i32 & 0x0000FF00 ) >> 8 );
                    retval[ 3 ] = System.Convert.ToByte( i32 & 0x000000FF );
                }
            }

            return retval;
        }
Beispiel #28
0
        private byte[] MatchValueOtherToByteArray(string match, MatchTypes matchType)
        {
            byte[] retval = null;

            // hex
            if (match.StartsWith("0x"))
            {
                retval = HexStringToByteArray(match);
            }
            else
            {
                if (matchType == MatchTypes.TypeByte)
                {
                    retval = new byte[1];

                    retval[0] = System.Convert.ToByte(match);
                }
                else
                if (matchType == MatchTypes.TypeHost16 || matchType == MatchTypes.TypeLittle16)
                {
                    retval = new byte[2];

                    UInt16 i16 = System.Convert.ToUInt16(OctalStringToInt(match));

                    retval[0] = System.Convert.ToByte(i16 & 0x00FF);
                    retval[1] = System.Convert.ToByte(i16 >> 8);
                }
                if (matchType == MatchTypes.TypeBig16)
                {
                    retval = new byte[2];

                    UInt16 i16 = System.Convert.ToUInt16(OctalStringToInt(match));

                    retval[0] = System.Convert.ToByte(i16 >> 8);
                    retval[1] = System.Convert.ToByte(i16 & 0x00FF);
                }
                else
                if (matchType == MatchTypes.TypeHost32 || matchType == MatchTypes.TypeLittle32)
                {
                    retval = new byte[4];

                    UInt32 i32 = OctalStringToInt(match);

                    retval[0] = System.Convert.ToByte(i32 & 0x000000FF);
                    retval[1] = System.Convert.ToByte((i32 & 0x0000FF00) >> 8);
                    retval[2] = System.Convert.ToByte((i32 & 0x00FF0000) >> 16);
                    retval[3] = System.Convert.ToByte((i32 & 0xFF000000) >> 24);
                }
                else
                if (matchType == MatchTypes.TypeBig32)
                {
                    retval = new byte[4];

                    UInt32 i32 = OctalStringToInt(match);

                    retval[0] = System.Convert.ToByte((i32 & 0xFF000000) >> 24);
                    retval[1] = System.Convert.ToByte((i32 & 0x00FF0000) >> 16);
                    retval[2] = System.Convert.ToByte((i32 & 0x0000FF00) >> 8);
                    retval[3] = System.Convert.ToByte(i32 & 0x000000FF);
                }
            }

            return(retval);
        }
Beispiel #29
0
 public Match(MatchTypes matchTypes, string matchValue)
 {
     this.MatchType = matchTypes;
     this.MatchValue = matchValue;
 }
Beispiel #30
0
 public static List <Match> Matches(string line, string pattern, MatchTypes validMatch = MatchTypes.WordOnly, string seqdelim = STRINGQUOTE)
 {
     return(Matches(line, pattern, SearchTypes.REGEX, validMatch, seqdelim));
 }
Beispiel #31
0
        public static List <string> Split(string line, string delimiter, SearchTypes search, MatchTypes validMatch = MatchTypes.WordOnly, string seqdelim = STRINGQUOTE, bool trim = false)
        {
            List <Match> matches = Matches(line, delimiter, search, validMatch, seqdelim);
            var          words   = new List <string>();

            if (matches.Any())
            {
                int prev = 0;

                foreach (Match match in matches)
                {
                    words.Add(trim ? line.Substring(prev, match.Index - prev).Trim()
                                                   : line.Substring(prev, match.Index - prev));

                    prev = match.Index + match.Length;
                }

                words.Add(trim ? line.Substring(prev, line.Length - prev).Trim()
                                               : line.Substring(prev, line.Length - prev));
            }
            else
            {
                words.Add(trim ? line.Trim() : line);
            }

            return(words);
        }
Beispiel #32
0
 public MessagePattern(MessageTypes type, MatchTypes matchType, string matchPattern)
 {
     MessageType = type;
     MatchType   = matchType;
     Pattern     = matchPattern;
 }
        /// <summary>
        /// Tries to match the message with a MessageType, using the pattern passed.
        /// If the message matches the pattern, and the pattern contains the ?&lt;data&gt; placeholder,
        /// any strings in that placeholder are stored into mData.
        /// </summary>
        /// <param name="rule">The regex to look for</param>
        /// <param name="matchType">The type of match to perform, i.e. Regex or EndsWith</param>
        /// <param name="type">The type to set this object to if a match is found</param>
        /// <returns>True if the message matches, else False.</returns>
        private bool ProcessMatch(MatchTypes matchType, string rule, MessageTypes type)
        {
            bool retval = false;
            Data = new Dictionary<string, string>();

            switch (matchType)
            {
                case (MatchTypes.EndsWith):
                    if (Message.EndsWith(rule))
                    {
                        Type = type;
                        retval = true;
                    }
                    break;

                case (MatchTypes.Regex):
                    Regex RE = new Regex(rule);
                    if (RE.IsMatch(Message))
                    {
                        Type = type;
                        MatchCollection matches = Regex.Matches(Message, rule);
                        foreach (Match match in matches)
                        {
                            for (int i = 1; i < match.Groups.Count; i++)
                            {
                                Data.Add(RE.GroupNameFromNumber(i), match.Groups[i].Value);
                            }
                        }

                        retval = true;
                    }
                    break;
            }

            if (Data.ContainsKey("username"))
            {
                SetUser(Data["username"]);
            }

            return retval;
        }
            public MessagePattern(string type, string matchType, string matchPattern)
            {
                if (Enum.IsDefined(typeof(MessageTypes), type))
                {
                    MessageType = (MessageTypes)Enum.Parse(typeof(MessageTypes), type);
                }
                else
                {
                    MessageType = MessageTypes.Other;
                }

                if (Enum.IsDefined(typeof(MatchTypes), matchType))
                {
                    MatchType = (MatchTypes)Enum.Parse(typeof(MatchTypes), matchType);
                }
                else
                {
                    MatchType = MatchTypes.EndsWith;
                }

                Pattern = matchPattern;
            }
Beispiel #35
0
 // Token: 0x06000DFE RID: 3582
 // RVA: 0x0004D28C File Offset: 0x0004B48C
 public bMatch(MatchTypes matchTypes_0, MatchScoringTypes matchScoringTypes_0, MatchTeamTypes matchTeamTypes_0, PlayModes playModes_0, string string_0, string string_1, int int_0, string string_2, string string_3, int int_1, Mods mods_0, int int_2, MultiSpecialModes multiSpecialModes_0, int int_3)
 {
     this.matchType = matchTypes_0;
     this.playMode = playModes_0;
     this.matchScoringType = matchScoringTypes_0;
     this.matchTeamType = matchTeamTypes_0;
     this.gameName = string_0;
     this.gamePassword = string_1;
     this.beatmapName = string_2;
     this.beatmapChecksum = string_3;
     this.beatmapId = int_1;
     this.activeMods = mods_0;
     this.hostId = int_2;
     this.specialModes = multiSpecialModes_0;
     this.Seed = int_3;
     this.SendPassword = true;
     for (int i = 0; i < bMatch.smethod_0(); i++)
     {
         this.slotStatus[i] = ((i < int_0) ? SlotStatus.flag_0 : SlotStatus.flag_1);
         this.slotId[i] = -1;
     }
     if (string_0.Length > 50)
     {
         string_0 = string_0.Remove(50);
     }
 }
 public MessagePattern(MessageTypes type, MatchTypes matchType, string matchPattern)
 {
     MessageType = type;
     MatchType = matchType;
     Pattern = matchPattern;
 }
Beispiel #37
0
        private static Tile FindMatches(Tile currentTile, MatchTypes matchType, List <List <string> > tiles)
        {
            var           tileAData       = currentTile.TileData;
            List <string> matchedTileData = null;
            string        matchedTileId   = null;

            for (int i = 0; i < tiles.Count; i++)
            {
                var tileB     = tiles[i];
                var tileBData = tileB.GetRange(1, tiles[i].Count - 1);

                if (matchType == MatchTypes.Top)
                {
                    if (IsMatchedTop(tileAData, tileBData))
                    {
                        matchedTileData = tileBData;
                        matchedTileId   = tileB[0];
                        tiles.RemoveAt(i);
                        break;
                    }
                    else
                    {
                        for (int k = 0; k < methodsToCall.Count; k++)
                        {
                            var processedTileBData = methodsToCall[k].Invoke(tileBData);

                            if (IsMatchedTop(tileAData, processedTileBData))
                            {
                                matchedTileData = processedTileBData;
                                matchedTileId   = tileB[0];
                                tiles.RemoveAt(i);
                                break;
                            }
                        }
                    }
                }

                if (matchType == MatchTypes.Right)
                {
                    if (IsMatchedRight(tileAData, tileBData))
                    {
                        matchedTileData = tileBData;
                        matchedTileId   = tileB[0];
                        tiles.RemoveAt(i);
                        break;
                    }
                    else
                    {
                        for (int k = 0; k < methodsToCall.Count; k++)
                        {
                            var processedTileBData = methodsToCall[k].Invoke(tileBData);

                            if (IsMatchedRight(tileAData, processedTileBData))
                            {
                                matchedTileData = processedTileBData;
                                matchedTileId   = tileB[0];
                                tiles.RemoveAt(i);
                                break;
                            }
                        }
                    }
                }

                if (matchType == MatchTypes.Left)
                {
                    if (IsMatchedLeft(tileAData, tileBData))
                    {
                        matchedTileData = tileBData;
                        matchedTileId   = tileB[0];
                        tiles.RemoveAt(i);
                        break;
                    }
                    else
                    {
                        for (int k = 0; k < methodsToCall.Count; k++)
                        {
                            var processedTileBData = methodsToCall[k].Invoke(tileBData);

                            if (IsMatchedLeft(tileAData, processedTileBData))
                            {
                                matchedTileData = processedTileBData;
                                matchedTileId   = tileB[0];
                                tiles.RemoveAt(i);
                                break;
                            }
                        }
                    }
                }

                if (matchType == MatchTypes.Bottom)
                {
                    if (IsMatchedBottom(tileAData, tileBData))
                    {
                        matchedTileData = tileBData;
                        matchedTileId   = tileB[0];
                        tiles.RemoveAt(i);
                    }
                    else
                    {
                        for (int k = 0; k < methodsToCall.Count; k++)
                        {
                            var processedTileB = methodsToCall[k].Invoke(tileBData);

                            if (IsMatchedBottom(tileAData, processedTileB))
                            {
                                matchedTileData = processedTileB;
                                matchedTileId   = tileB[0];
                                tiles.RemoveAt(i);
                                break;
                            }
                        }
                    }
                }
            }

            var resultCoords = new Coords();

            switch (matchType)
            {
            case MatchTypes.Top:
                resultCoords.X = currentTile.Coords.X;
                resultCoords.Y = currentTile.Coords.Y + 1;
                break;

            case MatchTypes.Right:
                resultCoords.X = currentTile.Coords.X + 1;
                resultCoords.Y = currentTile.Coords.Y;
                break;

            case MatchTypes.Bottom:
                resultCoords.X = currentTile.Coords.X;
                resultCoords.Y = currentTile.Coords.Y - 1;
                break;

            case MatchTypes.Left:
                resultCoords.X = currentTile.Coords.X - 1;
                resultCoords.Y = currentTile.Coords.Y;
                break;
            }



            if (matchedTileData != null)
            {
                return(new Tile(matchedTileId, matchedTileData, resultCoords));
            }
            else
            {
                return(new Tile(null, null, resultCoords));
            }
        }