コード例 #1
0
ファイル: MailServer.cs プロジェクト: strangea/OpenHacknet
 public new static bool validUser(byte type)
 {
     if (!Daemon.validUser(type))
     {
         return(type == 2);
     }
     return(true);
 }
コード例 #2
0
 public new static bool validUser(byte type)
 {
     return(Daemon.validUser(type) || (int)type == 2);
 }
コード例 #3
0
ファイル: DisplayModule.cs プロジェクト: strangea/OpenHacknet
        private void doLoginDisplay()
        {
            var strArray = os.displayCache.Split(new string[1]
            {
                "#$#$#$$#$&$#$#$#$#"
            }, StringSplitOptions.None);
            var text1 = "";
            var text2 = "";
            var num1  = -1;
            var num2  = 0;

            if (strArray[0].Equals("loginData"))
            {
                text1 = !(strArray[1] != "") ? os.terminal.currentLine : strArray[1];
                if (strArray.Length > 2)
                {
                    num2  = 1;
                    text2 = strArray[2];
                    if (text2.Equals(""))
                    {
                        for (var index = 0; index < os.terminal.currentLine.Length; ++index)
                        {
                            text2 += "*";
                        }
                    }
                    else
                    {
                        var str = "";
                        for (var index = 0; index < text2.Length; ++index)
                        {
                            str += "*";
                        }
                        text2 = str;
                    }
                }
                if (strArray.Length > 3)
                {
                    num2 = 2;
                    num1 = Convert.ToInt32(strArray[3]);
                }
            }
            doConnectHeader();
            var destinationRectangle = GuiData.tmpRect;

            destinationRectangle.X      = bounds.X + 2;
            destinationRectangle.Y      = this.y;
            destinationRectangle.Height = 200;
            destinationRectangle.Width  = bounds.Width - 4;
            spriteBatch.Draw(Utils.white, destinationRectangle, num1 == 0 ? os.lockedColor : os.indentBackgroundColor);
            destinationRectangle.Height = 22;
            this.y += 30;
            var vector2 = TextItem.doMeasuredLabel(new Vector2(this.x, this.y), "Login ", Color.White);

            if (num1 == 0)
            {
                x += (int)vector2.X;
                TextItem.doLabel(new Vector2(x, y), "Failed", os.brightLockedColor);
                x -= (int)vector2.X;
            }
            else if (num1 != -1)
            {
                x += (int)vector2.X;
                TextItem.doLabel(new Vector2(x, y), "Successful", os.brightUnlockedColor);
                x -= (int)vector2.X;
            }
            this.y += 60;
            if (num2 == 0)
            {
                destinationRectangle.Y = y;
                spriteBatch.Draw(Utils.white, destinationRectangle, os.subtleTextColor);
            }
            spriteBatch.DrawString(GuiData.smallfont, "username :"******"password :"******"Complete" : "Back",
                                    os.indentBackgroundColor))
                {
                    command = "connect";
                }
                if (num1 > 0 || !Button.doButton(123456, x + 75, y, 70, 30, "Retry", os.indentBackgroundColor))
                {
                    return;
                }
                os.runCommand("login");
            }
            else
            {
                this.y += 65;
                var x        = this.x;
                var y        = this.y;
                var computer = os.connectedComp == null ? os.thisComputer : os.connectedComp;
                for (var index = 0; index < computer.users.Count; ++index)
                {
                    if (computer.users[index].known && Daemon.validUser(computer.users[index].type))
                    {
                        x = this.x + 320;
                        if (Button.doButton(123457 + index, this.x, this.y, 300, 25,
                                            "Login - User: "******" Pass: "******"Cancel", os.lockedColor))
                {
                    return;
                }
                forceLogin("", "");
                command = "connect";
            }
        }
コード例 #4
0
        private void doLoginDisplay()
        {
            string[] separator = new string[1] {
                "#$#$#$$#$&$#$#$#$#"
            };
            if (!this.lockLoginDisplayCache)
            {
                this.loginDetailsCache = this.os.displayCache;
            }
            string[] strArray = this.loginDetailsCache.Split(separator, StringSplitOptions.None);
            string   text1    = "";
            string   text2    = "";
            int      num1     = -1;
            int      num2     = 0;

            if (strArray[0].Equals("loginData"))
            {
                text1 = !(strArray[1] != "") ? this.os.terminal.currentLine : strArray[1];
                if (strArray.Length > 2)
                {
                    num2  = 1;
                    text2 = strArray[2];
                    if (text2.Equals(""))
                    {
                        for (int index = 0; index < this.os.terminal.currentLine.Length; ++index)
                        {
                            text2 += "*";
                        }
                    }
                    else
                    {
                        string str = "";
                        for (int index = 0; index < text2.Length; ++index)
                        {
                            str += "*";
                        }
                        text2 = str;
                    }
                }
                if (strArray.Length > 3)
                {
                    num2 = 2;
                    num1 = Convert.ToInt32(strArray[3]);
                }
            }
            this.doConnectHeader();
            Rectangle tmpRect = GuiData.tmpRect;

            tmpRect.X      = this.bounds.X + 2;
            tmpRect.Y      = this.y;
            tmpRect.Height = 200;
            tmpRect.Width  = this.bounds.Width - 4;
            this.spriteBatch.Draw(Utils.white, tmpRect, num1 == 0 ? this.os.lockedColor : this.os.indentBackgroundColor);
            if (num1 != 0)
            {
                ;
            }
            tmpRect.Height = 22;
            this.y        += 30;
            Vector2 vector2 = TextItem.doMeasuredLabel(new Vector2((float)this.x, (float)this.y), LocaleTerms.Loc("Login "), new Color?(Color.White));

            if (num1 == 0)
            {
                this.x += (int)vector2.X;
                TextItem.doLabel(new Vector2((float)this.x, (float)this.y), LocaleTerms.Loc("Failed"), new Color?(this.os.brightLockedColor));
                this.x -= (int)vector2.X;
                this.lockLoginDisplayCache = true;
            }
            else if (num1 != -1)
            {
                this.x += (int)vector2.X;
                TextItem.doLabel(new Vector2((float)this.x, (float)this.y), LocaleTerms.Loc("Successful"), new Color?(this.os.brightUnlockedColor));
                this.x -= (int)vector2.X;
                this.lockLoginDisplayCache = true;
            }
            this.y += 60;
            if (num2 == 0)
            {
                tmpRect.Y = this.y;
                this.spriteBatch.Draw(Utils.white, tmpRect, this.os.subtleTextColor);
            }
            int    num3  = 100;
            string text3 = LocaleTerms.Loc("username :"******"password :"******"Complete") : LocaleTerms.Loc("Back"), new Color?(this.os.indentBackgroundColor)))
                {
                    this.command = "connect";
                }
                if (num1 > 0 || !Button.doButton(123456, this.x + width + 5, this.y, width, 30, LocaleTerms.Loc("Retry"), new Color?(this.os.indentBackgroundColor)))
                {
                    return;
                }
                this.lockLoginDisplayCache = false;
                this.loginDetailsCache     = (string)null;
                this.os.runCommand("login");
            }
            else
            {
                this.y += 65;
                int      x        = this.x;
                int      y        = this.y;
                Computer computer = this.os.connectedComp == null ? this.os.thisComputer : this.os.connectedComp;
                for (int index = 0; index < computer.users.Count; ++index)
                {
                    if (computer.users[index].known && Daemon.validUser(computer.users[index].type))
                    {
                        x = this.x + 320;
                        if (Button.doButton(123457 + index, this.x, this.y, 300, 25, "Login - User: "******" Pass: "******"Cancel"), new Color?(this.os.lockedColor)))
                {
                    this.forceLogin("", "");
                    this.command = "connect";
                }
            }
        }