Exemplo n.º 1
0
 public MSGstr(int index, string newstring, CharList New)
 {
     NewChar                = New;
     Index                  = index;
     NewString              = newstring;
     OldString.ListChanged += OldString_ListChanged;
 }
Exemplo n.º 2
0
 public Names(int Index, byte[] OldName, string NewName, CharList New)
 {
     NewChar      = New;
     this.Index   = Index;
     this.NewName = NewName;
     this.OldName = OldName;
 }
Exemplo n.º 3
0
 public CharList(CharList other) : this(solar_corePINVOKE.new_CharList__SWIG_1(CharList.getCPtr(other)), true)
 {
     if (solar_corePINVOKE.SWIGPendingException.Pending)
     {
         throw solar_corePINVOKE.SWIGPendingException.Retrieve();
     }
 }
Exemplo n.º 4
0
        public override void HandleRequest(HttpListenerContext context)
        {
            NameValueCollection query;

            using (StreamReader rdr = new StreamReader(context.Request.InputStream))
                query = HttpUtility.ParseQueryString(rdr.ReadToEnd());

            DbAccount acc;
            var       status = Database.Verify(query["guid"], query["password"], out acc);

            if (status == LoginStatus.OK || status == LoginStatus.AccountNotExists)
            {
                if (status == LoginStatus.AccountNotExists)
                {
                    acc = Database.CreateGuestAccount(query["guid"]);
                }
                var list = CharList.FromDb(Database, acc);
                list.Servers = GetServerList();
                Write(context, list.ToXml().ToString());
            }
            else
            {
                Write(context, "<Error>" + status.GetInfo() + "</Error>");
            }
        }
Exemplo n.º 5
0
        public override void HandleRequest(RequestContext context, NameValueCollection query)
        {
            DbAccount acc;
            var       status = Database.Verify(query["guid"], query["password"], out acc);

            if (status == LoginStatus.OK || status == LoginStatus.AccountNotExists)
            {
                if (status == LoginStatus.AccountNotExists)
                {
                    acc = Database.CreateGuestAccount(query["guid"]);
                }

                if (acc.Admin && acc.AccountIdOverride != 0)
                {
                    var accOverride = Database.GetAccount(acc.AccountIdOverride);
                    if (accOverride != null)
                    {
                        acc = accOverride;
                    }
                }

                var list = CharList.FromDb(Database, acc);
                list.Servers = GetServerList();
                WriteXml(context, list.ToXml().ToString());
            }
            else
            {
                Write(context, "<Error>" + status.GetInfo() + "</Error>");
            }
        }
Exemplo n.º 6
0
 public Names(int Index, string OldName, string NewName, CharList New)
 {
     NewChar      = New;
     this.Index   = Index;
     this.NewName = NewName;
     this.OldName = Utilities.String.SplitString(OldName, '-');
 }
Exemplo n.º 7
0
        protected override void HandleRequest()
        {
            DbAccount acc;
            var       status = Database.Verify(Query["guid"], Query["password"], out acc);

            if (status == LoginStatus.OK || status == LoginStatus.AccountNotExists)
            {
                if (status == LoginStatus.AccountNotExists)
                {
                    acc = Database.CreateGuestAccount(Query["guid"]);
                }
                if (acc.Banned)
                {
                    using (StreamWriter wtr = new StreamWriter(Context.Response.OutputStream))
                        wtr.WriteLine("<Error>Account under maintenance</Error>");
                    Context.Response.Close();
                }

                var ca = new DbClassAvailability(acc);
                if (ca.IsNull)
                {
                    ca.Init(GameData);
                }
                ca.Flush();

                var list = CharList.FromDb(Database, acc);
                list.Servers = GetServerList();
                WriteLine(list.ToXml(Program.GameData, acc));
            }
            else
            {
                WriteErrorLine(status.GetInfo());
            }
        }
Exemplo n.º 8
0
        private bool IsBaseX(char character, int numBase)
        {
            const string CharList = "0123456789abcdefghijklmnopqrstuvwxyz";
            var          index    = CharList.IndexOf(character.ToString(), StringComparison.CurrentCultureIgnoreCase);

            return(index >= 0 && index < numBase);
        }
Exemplo n.º 9
0
 public CharListEnumerator(CharList collection)
 {
     collectionRef = collection;
     currentIndex  = -1;
     currentObject = null;
     currentSize   = collectionRef.Count;
 }
Exemplo n.º 10
0
        protected override void HandleRequest()
        {
            DbAccount acc;
            var       status = Database.Verify(Query["guid"], Query["password"], out acc);

            if (status == LoginStatus.OK || status == LoginStatus.AccountNotExists)
            {
                if (status == LoginStatus.AccountNotExists)
                {
                    acc = Database.CreateGuestAccount(Query["guid"]);
                }

                var ca = new DbClassAvailability(acc);
                if (ca.IsNull)
                {
                    ca.Init(GameData);
                }
                ca.Flush();

                var list = CharList.FromDb(Database, acc);
                list.Servers = GetServerList();
                WriteLine(list.ToXml(Program.GameData, acc));
            }
            else
            {
                WriteErrorLine(status.GetInfo());
            }
        }
Exemplo n.º 11
0
        public override async Task RunImpl()
        {
            L2Player player = _client.CurrentPlayer;

            if (player == null)
            {
                return;
            }

            if (player.PBlockAct == 1)
            {
                player.SendActionFailedAsync();
                return;
            }

            if (player.isInCombat())
            {
                player.SendSystemMessage(SystemMessageId.CantRestartWhileFighting);
                player.SendActionFailedAsync();
                return;
            }

            await _client.Logout();

            player.SendPacketAsync(new RestartResponse());

            await _client.FetchAccountCharacters();

            CharList csl = new CharList(_client, _client.SessionKey.PlayOkId1);

            player.SendPacketAsync(csl);
        }
Exemplo n.º 12
0
        public static List <TextBaseElement> GetTextBaseList(this string String, CharList FontMap)
        {
            List <TextBaseElement> MyByteArrayList = new List <TextBaseElement>();

            foreach (var a in Regex.Split(String, "(\r\n|\r|\n)"))
            {
                if (Regex.IsMatch(a, "\r\n|\r|\n"))
                {
                    MyByteArrayList.Add(new TextBaseElement("System", new byte[] { 0x0A }));
                }
                else
                {
                    foreach (var b in Regex.Split(a, @"({[^}]+})"))
                    {
                        if (Regex.IsMatch(b, @"{.+}"))
                        {
                            MyByteArrayList.Add(new TextBaseElement("System", Utilities.String.SplitString(b.Substring(1, b.Length - 2), ' ')));
                        }
                        else
                        {
                            MyByteArrayList.Add(new TextBaseElement("Text", FontMap.Encode(b, CharList.EncodeOptions.Bracket)));
                        }
                    }
                }
            }

            return(MyByteArrayList);
        }
Exemplo n.º 13
0
        public Boolean LoadChars()
        {
            if (db.IsConnected)
            {
                DatabaseDataContext data = new UOData.DatabaseDataContext();
                string query             = "SELECT player.id, mobile.name, mobile.model, mobile.direction, mobile.notoriety, mobile.x, mobile.y, mobile.z FROM mobile INNER JOIN player ON (mobile.id = player.mobile_id) WHERE mobile.account_id = " + AccountID + ";";
                var    players           = from pl in data.players where pl.account_id == AccountID select pl;

                foreach (var pl in players)
                {
                    var chars = from ch in data.mobiles where ch.id == pl.mobile_id select ch;
                    foreach (var ch in chars)
                    {
                        CharList.Add(new Character()
                        {
                            Uid       = ch.id,
                            Name      = ch.name,
                            CharModel = (short)ch.model,
                            Direction = (byte)ch.direction,
                            Notoriety = (short)ch.notoriety,
                            X         = (short)ch.x,
                            Y         = (short)ch.y,
                            Z         = (byte)ch.z,
                            Password  = m_Password
                        });
                    }
                }

                MySqlDataReader result = db.ExecuteQuery(query);

                if (result.HasRows)
                {
                    while (result.Read())
                    {
                        Character temp = new Character();
                        temp.Uid       = Int32.Parse(result.GetValue(0).ToString());
                        temp.Name      = result.GetValue(1).ToString();
                        temp.CharModel = Int16.Parse(result.GetValue(2).ToString());
                        temp.Direction = Byte.Parse(result.GetValue(3).ToString());
                        temp.Notoriety = short.Parse(result.GetValue(4).ToString());
                        temp.X         = Int16.Parse(result.GetValue(5).ToString());
                        temp.Y         = Int16.Parse(result.GetValue(6).ToString());
                        temp.Z         = Byte.Parse(result.GetValue(7).ToString());
                        temp.Password  = m_Password;
                        CharList.Add(temp);
                    }
                    return(true);
                }
            }
            return(false);

            CharList = new List <Character>();
            Character temp1 = new Character();

            temp1.Name     = "metal";
            temp1.Password = "******";
            CharList.Add(temp1);
            return(true);
        }
Exemplo n.º 14
0
 public static void add_sink_file(CharList args)
 {
     solar_corePINVOKE.Log_add_sink_file(CharList.getCPtr(args));
     if (solar_corePINVOKE.SWIGPendingException.Pending)
     {
         throw solar_corePINVOKE.SWIGPendingException.Retrieve();
     }
 }
Exemplo n.º 15
0
 public void SetRange(int index, CharList values)
 {
     solar_corePINVOKE.CharList_SetRange(swigCPtr, index, CharList.getCPtr(values));
     if (solar_corePINVOKE.SWIGPendingException.Pending)
     {
         throw solar_corePINVOKE.SWIGPendingException.Retrieve();
     }
 }
Exemplo n.º 16
0
        public void load()
        {
            var elem = XElement.Parse(request.OnResponse());

            Account.account = new AccountData(elem.Element("Account"));
            CharList.load(elem);
            Servers.load(elem.Element("Servers"));
        }
        public ThreeLetterFunCardData CloneCard()
        {
            ThreeLetterFunCardData output = (ThreeLetterFunCardData)MemberwiseClone();

            output._completeList = _completeList.ToCustomBasicList();
            output.CharList      = CharList.ToCustomBasicList(); //i think.
            return(output);
        }
Exemplo n.º 18
0
        ///////////////////////////////////////////////////////////////////////////////////////////////

        private static void RemoveEndOfLine(
            byte[] buffer,            /* in */
            CharList endOfLine,       /* in */
            bool useAnyEndOfLineChar, /* in */
            ref int bufferLength      /* in, out */
            )
        {
            if ((buffer != null) && (endOfLine != null) && (bufferLength > 0))
            {
                if (useAnyEndOfLineChar)
                {
                    int bufferIndex = bufferLength - 1;

                    while (bufferIndex >= 0)
                    {
                        if (endOfLine.Contains(ConversionOps.ToChar(buffer[bufferIndex])))
                        {
                            bufferIndex--;
                        }
                        else
                        {
                            break;
                        }
                    }

                    bufferLength = bufferIndex + 1;
                }
                else
                {
                    int eolLength = endOfLine.Count;

                    if (bufferLength >= eolLength)
                    {
                        bool match       = true;
                        int  bufferIndex = bufferLength - eolLength;
                        int  eolIndex    = 0;

                        while ((bufferIndex < bufferLength) &&
                               (eolIndex < eolLength))
                        {
                            if (buffer[bufferIndex] != ConversionOps.ToByte(endOfLine[eolIndex]))
                            {
                                match = false;
                                break;
                            }

                            bufferIndex++;
                            eolIndex++;
                        }

                        if (match)
                        {
                            bufferLength -= eolLength;
                        }
                    }
                }
            }
        }
Exemplo n.º 19
0
        public StringList(string file, int length, CharList charlist)
        {
            List <byte[]> splited = SplitByNull(File.ReadAllBytes(file));

            foreach (var a in splited)
            {
                list.Add(new Tuple <string, int>(charlist.Decode(a.Where(x => x != 0).ToArray()), a.Length));
            }
        }
Exemplo n.º 20
0
        public static CharList Repeat(string value, int count)
        {
            global::System.IntPtr cPtr = solar_corePINVOKE.CharList_Repeat(value, count);
            CharList ret = (cPtr == global::System.IntPtr.Zero) ? null : new CharList(cPtr, true);

            if (solar_corePINVOKE.SWIGPendingException.Pending)
            {
                throw solar_corePINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
Exemplo n.º 21
0
        protected override bool ReadBody(ISourceStream source, CompoundTokenDetails details)
        {
            int      start        = source.PreviewPosition;
            bool     allowEscapes = details.IsSet((short)IdOptions.AllowsEscapes);
            CharList outputChars  = new CharList();

            while (!source.EOF())
            {
                char current = source.PreviewChar;
                if (Grammar.IsWhitespaceOrDelimiter(current))
                {
                    break;
                }
                if (allowEscapes && current == this.EscapeChar)
                {
                    current = ReadUnicodeEscape(source, details);
                    //We  need to back off the position. ReadUnicodeEscape sets the position to symbol right after escape digits.
                    //This is the char that we should process in next iteration, so we must backup one char, to pretend the escaped
                    // char is at position of last digit of escape sequence.
                    source.PreviewPosition--;
                    if (details.Error != null)
                    {
                        return(false);
                    }
                }
                //Check if current character is OK
                if (!CharOk(current, source.PreviewPosition == start))
                {
                    break;
                }
                //Check if we need to skip this char
#if NETSTANDARD
                UnicodeCategory currCat = CharUnicodeInfo.GetUnicodeCategory(current);
#else
                UnicodeCategory currCat = char.GetUnicodeCategory(current); //I know, it suxx, we do it twice, fix it later
#endif
                if (!this.CharsToRemoveCategories.Contains(currCat))
                {
                    outputChars.Add(current); //add it to output (identifier)
                }
                source.PreviewPosition++;
            }//while
            if (outputChars.Count == 0)
            {
                return(false);
            }
            //Convert collected chars to string
            details.Body = new string(outputChars.ToArray());
            if (!CheckCaseRestriction(details.Body))
            {
                return(false);
            }
            return(!string.IsNullOrEmpty(details.Body));
        }
Exemplo n.º 22
0
        static public long BaseDecode(string value, int numBase)
        {
            const string CharList = "0123456789abcdefghijklmnopqrstuvwxyz";
            var          result   = 0L;

            foreach (char character in value)
            {
                result = result * numBase + CharList.IndexOf(character.ToString(), StringComparison.CurrentCultureIgnoreCase);
            }
            return(result);
        }
Exemplo n.º 23
0
        public CharList GetRange(int index, int count)
        {
            global::System.IntPtr cPtr = solar_corePINVOKE.CharList_GetRange(swigCPtr, index, count);
            CharList ret = (cPtr == global::System.IntPtr.Zero) ? null : new CharList(cPtr, true);

            if (solar_corePINVOKE.SWIGPendingException.Pending)
            {
                throw solar_corePINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
Exemplo n.º 24
0
        /// <summary>
        /// Adds a new character to TCTData.Data.CharList and invokes CharacterAddedEvent
        /// </summary>
        /// <param name="character">Character to be added (if not existing)</param>
        public static void AddCharacter(Character character)
        {
            bool found = false;

            foreach (var cl in CharList)
            {
                if (cl.Name == character.Name)
                {
                    found         = true;
                    cl.Laurel     = character.Laurel;
                    cl.Level      = character.Level;
                    cl.CharClass  = character.CharClass;
                    cl.GuildId    = character.GuildId;
                    cl.LocationId = character.LocationId;
                    cl.LastOnline = character.LastOnline;
                    cl.AccountId  = character.AccountId;
                    cl.Position   = character.Position;

                    break;
                }
            }

            if (!found)
            {
                // add char to chList
                CharList.Add(character);

                // check for TC
                int tc = 1;
                if (AccountList.Find(a => a.Id == character.AccountId).TeraClub)
                {
                    tc = 2;
                }

                // initialize dungeons
                for (int j = 0; j < DungList.Count; j++)
                {
                    if (DungList[j].ShortName == "AH" || DungList[j].ShortName == "EA" || DungList[j].ShortName == "GL" || DungList[j].ShortName == "CA")
                    {
                        CharList.Last().Dungeons.Add(new CharDungeon(DungList[j].ShortName, DungList[j].MaxBaseRuns, 0));
                    }
                    else
                    {
                        CharList.Last().Dungeons.Add(new CharDungeon(DungList[j].ShortName, DungList[j].MaxBaseRuns * tc, 0));
                    }
                }

                // create and add strip to list

                CharacterAddedEvent.Invoke(CharList.Count - 1);

                //UI.MainWin.CreateStrip(CharList.Count - 1);
            }
        }
Exemplo n.º 25
0
        ///////////////////////////////////////////////////////////////////////////////////////////////

        public ReturnCode Read( /* throw */
            CharList endOfLine,
            bool useAnyEndOfLineChar,
            ref ByteList list,
            ref Result error
            )
        {
            CheckDisposed();

            return(Read(Count.Invalid, endOfLine, useAnyEndOfLineChar, ref list, ref error));
        }
Exemplo n.º 26
0
        static void Main(string[] args)
        {
            CharList <char> charList = new CharList <char>();

            charList.Add('m');
            charList.Add('g');
            charList.Add('s');
            charList.Add('@');
            charList.Add('$');
            charList.Add('3');
            charList.DeleteMoreThanA();
        }
        private StringBuilder RemoveTrashXMLFast(StringBuilder text)
        {
            // Removing other
            if (text.ToString().Any(c => !CharList.Contains(c.ToString().ToLower()[0])))
            {
                foreach (char c in text.ToString().Where(c => !CharList.Contains(c.ToString().ToLower()[0])))
                {
                    text.Replace(c.ToString(), " ");
                }
            }

            return(text);
        }
Exemplo n.º 28
0
        public static String ToBase36(UInt64 input)
        {
            const String CharList = "0123456789abcdefghijklmnopqrstuvwxyz";

            char[] clistarr = CharList.ToCharArray();
            var    result   = new Stack <char>();

            while (input != 0)
            {
                result.Push(clistarr[input % 36]);
                input /= 36;
            }
            return(new String(result.ToArray()));
        }
Exemplo n.º 29
0
    public static void Initialize()
    {
        forgeList        = FindObjectOfType <ForgeList>();
        equipmentManager = FindObjectOfType <EquipmentManager>();
        charList         = FindObjectOfType <CharList>();
        teamBuilder      = ScriptableObject.CreateInstance(typeof(TeamBuilder)) as TeamBuilder;

        mapManager = ScriptableObject.CreateInstance(typeof(MapManager)) as MapManager;

        tavernManager = ScriptableObject.CreateInstance(typeof(TavernManager)) as TavernManager;

        MainManager.resourcesData.LoadData();
        resourcesUI = FindObjectOfType <ResourcesCountUI>();
        resourcesUI.Initialize();
    }
Exemplo n.º 30
0
        protected override bool ReadBody(ISourceStream source, ScanDetails details)
        {
            int      start        = source.Position;
            bool     allowEscapes = !details.IsSet(ScanFlags.DisableEscapes);
            CharList outputChars  = new CharList();

            while (!source.EOF())
            {
                char current = source.CurrentChar;
                if (_terminators.IndexOf(current) >= 0)
                {
                    break;
                }
                if (allowEscapes && current == this.EscapeChar)
                {
                    current = ReadUnicodeEscape(source, details);
                    //We  need to back off the position. ReadUnicodeEscape sets the position to symbol right after escape digits.
                    //This is the char that we should process in next iteration, so we must backup one char, to pretend the escaped
                    // char is at position of last digit of escape sequence.
                    source.Position--;
                    if (details.HasError())
                    {
                        return(false);
                    }
                }
                //Check if current character is OK
                if (!CharOk(current, source.Position == start))
                {
                    break;
                }
                //Check if we need to skip this char
                UnicodeCategory currCat = char.GetUnicodeCategory(current); //I know, it suxx, we do it twice, fix it later
                if (!this.CharsToRemoveCategories.Contains(currCat))
                {
                    outputChars.Add(current); //add it to output (identifier)
                }
                source.Position++;
            }//while
            if (outputChars.Count == 0)
            {
                return(false);
            }
            //Convert collected chars to string
            details.Body = new string(outputChars.ToArray());
            return(!string.IsNullOrEmpty(details.Body));
        }
Exemplo n.º 31
0
 public void giveInfos(string txt, CharList _ownr)
 {
     Setup();
     linkText.text = txt;
     Owner = _ownr;
     switch ( PopType)
     {
     case PopTypeList.Dialog :
     {
         PopDialog();
         break;
     }
     case PopTypeList.NotifHour :
     {
         PopNotif();
         break;
     }
     }
 }