예제 #1
0
 protected void Button1_Click(object sender, EventArgs e)
 {
     if (TextBox1.Text == (string)Session["username"])
     {
         if (TextBox2.Text == (string)Session["password"])
         {
             if (TextBox2.Text != TextBox3.Text && TextBox3.Text != null)
             {
                 Ques   a       = new Ques();
                 string account = TextBox1.Text;
                 var    s       = (from r in db.Ques where r.username == account select r).First();
                 s.password = TextBox3.Text;
                 db.SubmitChanges();
                 Session["password"] = s.password;
                 this.Response.Write(" <script language=javascript>alert('修改成功!');location.href='Login.aspx';</script> ");
             }
             else
             {
                 Response.Write("新密码不能与旧密码相同");
             }
         }
         else
         {
             Response.Write("请输入正确的密码");
         }
     }
     else
     {
         Response.Write("用户名不正确!");
     }
 }
예제 #2
0
 public player(String name, String mail, String score, String GUID)
 {
     this.name  = name;
     this.mail  = mail;
     this.score = score;
     this.GUID  = GUID;
     this.Ques  = null;
 }
예제 #3
0
        public async Task <ActionResult> Add(Ques Q)
        {
            var NewQ = new Ques {
                question = Q.question, ans = Q.ans
            };
            await db.Questions.AddAsync(NewQ);

            await db.SaveChangesAsync();

            return(Ok());
        }
예제 #4
0
    protected void Button1_Click(object sender, EventArgs e)
    {
        MovieDataContext db   = new MovieDataContext();
        Ques             ques = new Ques();

        ques.username = txtName.Text;
        ques.password = txtPassword.Text;
        db.Ques.InsertOnSubmit(ques);
        db.SubmitChanges();
        Response.Write("<script type='text/javascript'>alert('注册成功!正在跳转到登陆页面');location.href='Login.aspx';</script> ");
    }
예제 #5
0
    protected void btnLogin_Click(object sender, EventArgs e)
    {
        MovieDataContext db       = new MovieDataContext();
        Ques             Q        = new Ques();
        string           UserID   = txtName.Text;
        string           password = txtPassword.Text;
        var p = from c in db.Ques
                where c.username == UserID && c.password == password
                select c;

        if (p.Count() != 0)
        {
            Session["username"] = UserID;
            Session["password"] = password;
            this.Response.Write(" <script language=javascript>alert('登录成功!');location.href='Home.aspx';</script> ");
        }
        else
        {
            Response.Write(" <script language=javascript>alert('您的账号或密码错误!');location.href='Login.aspx';</script> ");
        }
    }
예제 #6
0
    //initialize question array at once from sql.
    private void getAllQues()
    {
        MySqlConnection myConnect;
        MySqlCommand    myCommand;
        MySqlDataReader reader;
        string          myConnectString = "server=eu-cdbr-azure-west-b.cloudapp.net;User Id=bd5ee543622578;password=fca73da9;database=realmoney";

        myConnect = new MySqlConnection(myConnectString);
        myConnect.Open();
        myCommand = new MySqlCommand("SELECT * FROM ques", myConnect);
        reader    = myCommand.ExecuteReader();
        reader.Read();
        for (int i = 0; i < game_questions.Length; i++)
        {
            if (reader.Read())
            {
                Ques q = new Ques(reader[1].ToString(), reader[2].ToString(), reader[3].ToString(), reader[4].ToString(), reader[5].ToString(), reader[6].ToString());
                game_questions[i] = q;
            }
        }
        myConnect.Close();
    }
예제 #7
0
 partial void DeleteQues(Ques instance);
예제 #8
0
 partial void UpdateQues(Ques instance);
예제 #9
0
 partial void InsertQues(Ques instance);
예제 #10
0
    /*bool CheckIfQDone(int q)
     * {
     *  for (int i = 0; i < _qDone.Length; i++)
     *  {
     *      if (q == i)
     *      {
     *          return true;
     *      }
     *  }
     *
     *  return false;
     * }*/

    void SelectQuestion()
    {
        Random random = new Random();

        Terminal.ClearScreen();
        switch (_quesNo)
        {
        case 1:
            Terminal.WriteLine("First you have to shut down the safety measures \n Identify the Character");
            break;

        case 2:
            Terminal.WriteLine("Identify the Character");
            break;

        case 3:
            Terminal.WriteLine("Identify the Character");
            break;

        case 4:
            Terminal.WriteLine("Security Measures Shut Down");
            Terminal.WriteLine("Breach the Firewall to access files");
            Terminal.WriteLine("Identify the Symbol");
            break;

        case 5:
            Terminal.WriteLine("Identify the Symbol");
            break;

        case 6:
            Terminal.WriteLine("Firewall Breached");
            Terminal.WriteLine("Security Breach Detected");
            Terminal.WriteLine("Prevent System Shutdown . . . .");
            break;

        default:
            Terminal.WriteLine("Identify the symbol");
            break;
        }
        switch (_level)
        {
        case 1:
            int rand1 = random.Next(1, 6);
            //if(CheckIfQDone(rand1))
            //SelectQuestion();
            switch (rand1)
            {
            case 1:
                //_qDone[0] = 1;
                _ques = Ques.Casper;
                StartCoroutine(DrawFigure("Assets/Figures/casper.txt"));
                break;

            case 2:
                //_qDone[1] = 2;
                _ques = Ques.Homer;
                StartCoroutine(DrawFigure("Assets/Figures/Homer.txt"));
                break;

            case 3:
                //_qDone[2] = 3;
                _ques = Ques.AtBomb;
                StartCoroutine(DrawFigure("Assets/Figures/AtBombman.txt"));
                break;

            case 4:
                //_qDone[3] = 4;
                _ques = Ques.Smurfs;
                StartCoroutine(DrawFigure("Assets/Figures/Smurfs.txt"));
                break;

            case 5:
                //_qDone[4] = 5;
                _ques = Ques.Sonic;
                StartCoroutine(DrawFigure("Assets/Figures/sonic.txt"));
                break;
            }
            break;

        case 2:
            int rand2 = random.Next(6, 10);
            //if(CheckIfQDone(rand2))
            //    SelectQuestion();
            switch (rand2)
            {
            case 6:
                //_qDone[0] = 6;
                _ques = Ques.BioHaz;
                StartCoroutine(DrawFigure("Assets/Figures/BioHaz.txt"));
                break;

            case 7:
                //_qDone[1] = 7;
                _ques = Ques.Peace;
                StartCoroutine(DrawFigure("Assets/Figures/peace.txt"));
                break;

            case 8:
                //_qDone[2] = 8;
                _ques = Ques.HitMan;
                StartCoroutine(DrawFigure("Assets/Figures/Hit.txt"));
                break;

            case 9:
                //_qDone[3] = 9;
                _ques = Ques.Volks;
                StartCoroutine(DrawFigure("Assets/Figures/Volks.txt"));
                break;
            }
            break;

        case 3:
            int rand3 = random.Next(10, 13);
            //if(CheckIfQDone(rand3))
            //   SelectQuestion();
            switch (rand3)
            {
            case 10:
                //_qDone[0] = 10;
                _ques = Ques.SquidWard;
                StartCoroutine(DrawFigure("Assets/Figures/Squidward.txt"));
                break;

            case 11:
                //_qDone[1] = 11;
                _ques = Ques.Popoye;
                StartCoroutine(DrawFigure("Assets/Figures/Popoye.txt"));
                break;

            case 12:
                //_qDone[3] = 12;
                _ques = Ques.GhostBusters;
                StartCoroutine(DrawFigure("Assets/Figures/ghostbusters.txt"));
                break;
            }
            break;
        }
    }
예제 #11
0
 public async Task AddQue(int roomId)
 {
     Ques.Add(roomId, new Queue <FFMPEG> {
     });
     Streaming.Add(roomId, new FFMPEGStreaming());
 }
 private Node group0() {
     boolean capturingGroup = false;
     Node head = null;
     Node tail = null;
     int save = _flags;
     root = null;
     int ch = next();
     if (ch == '?') {
         ch = skip();
         switch (ch) {
         case ':':   //  (?:xxx) pure group
             head = createGroup(true);
             tail = root;
             head.next = expr(tail);
             break;
         case '=':   // (?=xxx) and (?!xxx) lookahead
         case '!':
             head = createGroup(true);
             tail = root;
             head.next = expr(tail);
             if (ch == '=') {
                 head = tail = new Pos(head);
             } else {
                 head = tail = new Neg(head);
             }
             break;
         case '>':   // (?>xxx)  independent group
             head = createGroup(true);
             tail = root;
             head.next = expr(tail);
             head = tail = new Ques(head, INDEPENDENT);
             break;
         case '<':   // (?<xxx)  look behind
             ch = read();
             if (ASCII.isLower(ch) || ASCII.isUpper(ch)) {
                 // named captured group
                 String name = groupname(ch);
                 if (namedGroups().containsKey(name))
                     throw error(new String("Named capturing group <" + name
                                 + "> is already defined"));
                 capturingGroup = true;
                 head = createGroup(false);
                 tail = root;
                 namedGroups().put(name, new Integer(capturingGroupCount-1));
                 head.next = expr(tail);
                 break;
             }
             int start = _cursor;
             head = createGroup(true);
             tail = root;
             head.next = expr(tail);
             tail.next = lookbehindEnd;
             TreeInfo info = new TreeInfo();
             head.study(info);
             if (info.maxValid == false) {
                 throw error(new String("Look-behind group does not have "
                             + "an obvious maximum length"));
             }
             boolean hasSupplementary = findSupplementary(start, patternLength);
             if (ch == '=') {
                 head = tail = (hasSupplementary ?
                                new BehindS(head, info.maxLength,
                                            info.minLength) :
                                new Behind(head, info.maxLength,
                                           info.minLength));
             } else if (ch == '!') {
                 head = tail = (hasSupplementary ?
                                new NotBehindS(head, info.maxLength,
                                               info.minLength) :
                                new NotBehind(head, info.maxLength,
                                              info.minLength));
             } else {
                 throw error(new String("Unknown look-behind group"));
             }
             break;
         case '$':
         case '@':
             throw error(new String("Unknown group type"));
         default:    // (?xxx:) inlined match flags
             unread();
             addFlag();
             ch = read();
             if (ch == ')') {
                 return null;    // Inline modifier only
             }
             if (ch != ':') {
                 throw error(new String("Unknown inline modifier"));
             }
             head = createGroup(true);
             tail = root;
             head.next = expr(tail);
             break;
         }
     } else { // (xxx) a regular group
         capturingGroup = true;
         head = createGroup(false);
         tail = root;
         head.next = expr(tail);
     }
     accept(')', new String("Unclosed group"));
     _flags = save;
     // Check for quantifiers
     Node node = closure(head);
     if (node == head) { // No closure
         root = tail;
         return node;    // Dual return
     }
     if (head == tail) { // Zero length assertion
         root = node;
         return node;    // Dual return
     }
     if (node is Ques) {
         Ques ques = (Ques) node;
         if (ques.type == POSSESSIVE) {
             root = node;
             return node;
         }
         tail.next = new BranchConn();
         tail = tail.next;
         if (ques.type == GREEDY) {
             head = new Branch(head, null, tail);
         } else { // Reluctant quantifier
             head = new Branch(null, head, tail);
         }
         root = tail;
         return head;
     } else if (node is Curly) {
         Curly curly = (Curly) node;
         if (curly.type == POSSESSIVE) {
             root = node;
             return node;
         }
         // Discover if the group is deterministic
         TreeInfo info = new TreeInfo();
         if (head.study(info)) { // Deterministic
             GroupTail temp = (GroupTail) tail;
             head = root = new GroupCurly(head.next, curly.cmin,
                                curly.cmax, curly.type,
                                ((GroupTail)tail).localIndex,
                                ((GroupTail)tail).groupIndex,
                                          capturingGroup);
             return head;
         } else { // Non-deterministic
             int temp = ((GroupHead) head).localIndex;
             Loop loop;
             if (curly.type == GREEDY)
                 loop = new Loop(this.localCount, temp);
             else  // Reluctant Curly
                 loop = new LazyLoop(this.localCount, temp);
             Prolog prolog = new Prolog(loop);
             this.localCount += 1;
             loop.cmin = curly.cmin;
             loop.cmax = curly.cmax;
             loop.body = head;
             tail.next = loop;
             root = loop;
             return prolog; // Dual return
         }
     }
     throw error(new String("Internal logic error"));
 }