Esempio n. 1
0
        public void run()
        {
            switch (type)
            {
            case RotationType.Wait:
                wait();
                break;

            case RotationType.SleepWait:
                DateTime utc      = DateTime.Now.AddMinutes(waitTime);
                long     waketime = utc.ToFileTime();
                running = true;
                bgWorker.RunWorkerAsync(waketime);
                SetSuspendState(false, true, true);
                break;

            case RotationType.SmurfDone:
                running = true;
                Smurf smurfDoneInstance = new Smurf(smurfData, type);
                smurfDoneInstance.smurfCompleted += smurfCompleted;
                break;

            case RotationType.SmurfTime:
                running = true;
                Smurf smurfTimeInstance = new Smurf(smurfData, type, smurfTime);
                smurfTimeInstance.smurfCompleted += smurfCompleted;
                break;
            }
        }
Esempio n. 2
0
 public ActionResult Create(Smurf smurf)
 {
     if (ModelState.IsValid)
     {
         db.Smurfs.Add(smurf);
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(smurf));
 }
Esempio n. 3
0
 public void Connect(string user, string password, Region region, Smurf _owner)
 {
     if (!this.isConnected)
     {
         new Thread(delegate(object state)
         {
             this.owner         = _owner;
             this.user          = user;
             this.password      = password;
             this.regionName    = region.ToString();
             this.clientVersion = RegionInfo.getRegionVersion(region.ToString());
             this.server        = RegionInfo.GetServerValue(region);
             this.loginQueue    = RegionInfo.GetLoginQueueValue(region);
             this.locale        = RegionInfo.GetLocaleValue(region);
             this.useGarena     = RegionInfo.GetUseGarenaValue(region);
             try
             {
                 this.client = new TcpClient(this.server, 0x833);
                 if ((!this.useGarena || this.GetGarenaToken()) && (this.GetAuthKey() && this.GetIpAddress()))
                 {
                     this.sslStream           = new SslStream(this.client.GetStream(), false, new RemoteCertificateValidationCallback(this.AcceptAllCertificates));
                     IAsyncResult asyncResult = this.sslStream.BeginAuthenticateAsClient(this.server, null, null);
                     using (asyncResult.AsyncWaitHandle)
                     {
                         if (asyncResult.AsyncWaitHandle.WaitOne(-1))
                         {
                             this.sslStream.EndAuthenticateAsClient(asyncResult);
                         }
                     }
                     if (this.Handshake())
                     {
                         this.BeginReceive();
                         if (this.SendConnect() && this.Login())
                         {
                             this.StartHeartbeat();
                         }
                     }
                 }
             }
             catch
             {
                 this.Error("Riots servers are currently unavailable.", ErrorType.AuthKey);
                 this.Disconnect();
             }
         }).Start();
     }
 }
Esempio n. 4
0
        static void TestOutInterfaces()
        {
            // This exhibits polymorphism because
            // we are able to group together types
            ISpeak[] speaks = new ISpeak[2];

            ISpeak speak = new Smurf();

            // unicorn implements ispeak...so we can use it
            Unicorn uni = new Unicorn();

            uni.Color = "pink";
            uni.Name  = "Magical Unicorn";
            uni.CreateCutieMark();

            Smurf smurf = new Smurf();

            smurf.Name = "Smurfy";

            speaks[0] = uni;
            speaks[1] = smurf;

            for (int i = 0; i < speaks.Length; i++)
            {
                speaks[i].SayHello();
            }

            MagicalCreature[] mc = new MagicalCreature[2];

            Dragon dragon = new Dragon();

            mc[0] = uni;
            mc[1] = dragon;

            for (int i = 0; i < mc.Length; i++)
            {
                if (mc[i] is ISpeak)
                {
                    // put that obj in another array
                    // save it into the db
                }
            }
        }
Esempio n. 5
0
        public void GameTest()
        {
            Form form = new Form();

            GenericGame game = new GenericGame();

            Assert.IsInstanceOfType(game, typeof(GenericGame));     //passes

            IFactory SmurfFactory = new SmurfFactory();

            Assert.IsInstanceOfType(SmurfFactory, typeof(SmurfFactory));     //passes

            IFactory MinionFactory = new MinionFactory();

            Assert.IsInstanceOfType(MinionFactory, typeof(MinionFactory));

            IFigure SFigure = new Smurf();
            IHouse  SHouse  = new HouseSmurf();
            IFemale SFemale = new Smurfin();
            IFood   SFood   = new FoodSmurf();

            Assert.IsInstanceOfType(SFigure, typeof(IFigure)); //passes
            Assert.IsInstanceOfType(SHouse, typeof(IHouse));   //passes
            Assert.IsInstanceOfType(SFemale, typeof(IFemale)); //passes
            Assert.IsInstanceOfType(SFood, typeof(IFood));     //passes

            IFigure MFigure = new Minion();
            IHouse  MHouse  = new HouseMinion();
            IFemale MFemale = new MinionFemale();
            IFood   MFood   = new FoodMinion();

            Assert.IsInstanceOfType(MFigure, typeof(IFigure)); //passes
            Assert.IsInstanceOfType(MHouse, typeof(IHouse));   //passes
            Assert.IsInstanceOfType(MFemale, typeof(IFemale)); //passes
            Assert.IsInstanceOfType(MFood, typeof(IFood));     //passes
        }
Esempio n. 6
0
 public void LolConnection(ref Smurf _owner)
 {
     owner = _owner;
 }