当前位置: 首页>>代码示例>>C#>>正文


C# Database.getRole方法代码示例

本文整理汇总了C#中db.Database.getRole方法的典型用法代码示例。如果您正苦于以下问题:C# Database.getRole方法的具体用法?C# Database.getRole怎么用?C# Database.getRole使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在db.Database的用法示例。


在下文中一共展示了Database.getRole方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: PlayerText

 public void PlayerText(RealmTime time, PlayerTextPacket pkt)
 {
     if (pkt.Text[0] == '/')
     {
         string[] x = pkt.Text.Trim().Split(' ');
         try
         {
             AnnounceText = pkt.Text.Substring(10);
             NewsText = pkt.Text.Substring(6).Split(';');
         }
         catch
         {
             Console.WriteLine("Error at line 24 of Player.Chat.cs");
         }
         ChatMessage = pkt.Text;
         string[] z = pkt.Text.Trim().Split('|');
         y = z.Skip(1).ToArray();
         ProcessCmd(x[0].Trim('/'), x.Skip(1).ToArray());
     }
     else
     {
         if (psr.Account.Admin == true)
         {
             Owner.BroadcastPacket(new TextPacket()
                 {
                     Name = "@" + psr.Account.Name,
                     Stars = psr.Player.Stars,
                     BubbleTime = 5,
                     Text = pkt.Text
                 }, null);
         }
         else
         {
             int role;
             using (Database db1 = new Database())
             {
                 role = db1.getRole(psr.Account);
             }
             if (role >= (int)Database.Roles.Donator)
             {
                 Owner.BroadcastPacket(new TextPacket()
                 {
                     Name = "#" + psr.Account.Name,
                     Stars = psr.Player.Stars,
                     BubbleTime = 5,
                     Text = pkt.Text
                 }, null);
             }
             else
             {
                 Owner.BroadcastPacket(new TextPacket()
                 {
                     Name = Name,
                     ObjectId = Id,
                     Stars = Stars,
                     BubbleTime = 5,
                     Recipient = "",
                     Text = pkt.Text,
                     CleanText = pkt.Text
                 }, null);
             }
         }
     }
 }
开发者ID:CarlosX,项目名称:rotmg_svr,代码行数:64,代码来源:Player.Chat.cs

示例2: CmdReqAdmin

 bool CmdReqAdmin()
 {
     using (Database db1 = new Database())
     {
         if (db1.getRole(psr.Account) >= (int)db.Database.Roles.Admin)
         {
             return true;
         }
         else
         {
             psr.SendPacket(new TextPacket()
             {
                 BubbleTime = 0,
                 Stars = -1,
                 Name = "",
                 Text = "You are not an admin!"
             });
             return false;
         }
     }
 }
开发者ID:CarlosX,项目名称:rotmg_svr,代码行数:21,代码来源:Player.Chat.cs

示例3: HandleRequest

        public void HandleRequest(HttpListenerContext context)
        {
            NameValueCollection query;
            using (StreamReader rdr = new StreamReader(context.Request.InputStream))
                query = HttpUtility.ParseQueryString(rdr.ReadToEnd());

            using (var db1 = new Database())
            {

                chrs = new Chars()
                {
                    Characters = new List<Char>() { },
                    NextCharId = 2,
                    MaxNumChars = 1,
                    Account = db1.Verify(query["guid"], query["password"]),
                    Servers = new List<ServerItem>() //leave this list empty for the Oryx Sleeping message
                    {
                        new ServerItem()
                        {
                            Name = "Local",
                            Lat = 22.28,
                            Long = 114.16,
                            DNS = "127.0.0.1",//db.confreader.getservers(false).ToString(), //127.0.0.1, CHANGE THIS TO LET YOUR FRIENDS CONNECT
                            Usage = 0.2,
                            AdminOnly = false
                        }
                        //new ServerItem()
                        //{
                        //    Name = "Admin Realm",
                        //    Lat = 22.28,
                        //    Long = 114.16,
                        //    DNS = "127.0.0.1",
                        //    Usage = 0.2,
                        //    AdminOnly = true
                        //}
                    }
                };
                Account dvh = null;
                if (chrs.Account != null)
                {
                    db1.GetCharData(chrs.Account, chrs);
                    db1.LoadCharacters(chrs.Account, chrs);
                    chrs.News = db1.GetNews(chrs.Account);
                    dvh = chrs.Account;
                    if (db1.getRole(chrs.Account) >= (int)Database.Roles.Moderator)
                    {
                        chrs.Account.Admin = true;
                    }
                }
                else
                {
                    chrs.Account = Database.CreateGuestAccount(query["guid"]);
                    chrs.News = db1.GetNews(null);
                }
                if (dvh != null && db1.isWhitelisted(dvh) == false)
                {
                    chrs = Whitelist.whitelisted;
                }
                if (dvh != null && db1.isBanned(dvh) == true)
                {
                    chrs = new Chars();
                }
                MemoryStream ms = new MemoryStream();
                XmlSerializer serializer = new XmlSerializer(chrs.GetType(), new XmlRootAttribute(chrs.GetType().Name) { Namespace = "" });

                XmlWriterSettings xws = new XmlWriterSettings();
                xws.OmitXmlDeclaration = true;
                xws.Encoding = Encoding.UTF8;
                XmlWriter xtw = XmlWriter.Create(context.Response.OutputStream, xws);
                serializer.Serialize(xtw, chrs, chrs.Namespaces);
            }
        }
开发者ID:lcnvdl,项目名称:rotmg-server,代码行数:72,代码来源:list.cs


注:本文中的db.Database.getRole方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。