Inheritance: Mission
    public void PerformMissionAboveQueueCapacityWithUnskilledTeamShouldFailOldestPutAllOthersOnHold()
    {
        // Arrange
        var soldier = new Ranker("Soldier", 20, 100, 100);

        this.army.AddSoldier(soldier);

        var mission1 = new Easy(soldier.OverallSkill);
        var mission2 = new Medium(soldier.OverallSkill * 100);
        var mission3 = new Hard(soldier.OverallSkill * 100);
        var mission4 = new Hard(soldier.OverallSkill * 100);

        this.missionController.Missions.Enqueue(mission1);
        this.missionController.Missions.Enqueue(mission2);
        this.missionController.Missions.Enqueue(mission3);

        // Act
        var result = this.missionController.PerformMission(mission4).Trim();

        var expectedResult = new StringBuilder()
                             .AppendLine($"Mission declined - {mission1.Name}")
                             .AppendLine($"Mission on hold - {mission2.Name}")
                             .AppendLine($"Mission on hold - {mission3.Name}")
                             .AppendLine($"Mission on hold - {mission4.Name}")
                             .ToString()
                             .Trim();

        // Assert
        Assert.AreEqual(1, this.missionController.FailedMissionCounter, "Incorrect FailedMissionsCounter!");
        Assert.AreEqual(0, this.missionController.SuccessMissionCounter, "Incorrect SuccessMissionCounter!");
        Assert.AreEqual(3, this.missionController.Missions.Count, "Incorrect Mission count!");
        Assert.AreEqual(expectedResult, result, "Incorrect Result msg!");
    }
    public void PerformMission_MissionShouldFail()
    {
        IMission mission  = new Easy(1500);
        var      expected = $"Mission on hold - {mission.Name}{Environment.NewLine}";

        Assert.AreEqual(expected, this.controller.PerformMission(mission));
    }
Beispiel #3
0
    public static void Main(String[] args)
    {
        try {
            Curl.GlobalInit((int)CURLinitFlag.CURL_GLOBAL_ALL);

            Easy easy = new Easy();

            Easy.WriteFunction wf = new Easy.WriteFunction(OnWriteData);
            easy.SetOpt(CURLoption.CURLOPT_WRITEFUNCTION, wf);

            // simple post - with a string
            easy.SetOpt(CURLoption.CURLOPT_POSTFIELDS,
                "url=index%3Dstripbooks&field-keywords=Topology&Go.x=10&Go.y=10");

            easy.SetOpt(CURLoption.CURLOPT_USERAGENT,
                "Mozilla 4.0 (compatible; MSIE 6.0; Win32");
            easy.SetOpt(CURLoption.CURLOPT_FOLLOWLOCATION, true);
            easy.SetOpt(CURLoption.CURLOPT_URL,
                "http://www.amazon.com/exec/obidos/search-handle-form/002-5928901-6229641");
            easy.SetOpt(CURLoption.CURLOPT_POST, true);
     
            easy.Perform();
            easy.Cleanup();

            Curl.GlobalCleanup();
        }
        catch(Exception ex) {
            Console.WriteLine(ex);
        }
    }
Beispiel #4
0
 static CodeStatement SetFailureIfNull(CodeExpression expr)
 {
     return(new CodeConditionStatement(Easy.Binary(expr,
                                                   CodeBinaryOperatorType.IdentityInequality,
                                                   Easy.Null),
                                       new CodeSnippetStatement("\t\t\t\treturn SetFailure();")));
 }
    public void PerformMissionAboveQueueCapacityWithSkilledTeamShouldFailOldestExecuteNext()
    {
        // Arrange
        var soldier = new Ranker("Soldier", 20, 100, 100);

        this.army.AddSoldier(soldier);

        this.wareHouse.AddAmmunitions(nameof(AutomaticMachine), 1000);
        this.wareHouse.AddAmmunitions(nameof(Gun), 1000);
        this.wareHouse.AddAmmunitions(nameof(Helmet), 1000);

        var mission1 = new Easy(soldier.OverallSkill);
        var mission2 = new Medium(soldier.OverallSkill);
        var mission3 = new Hard(soldier.OverallSkill * 100);
        var mission4 = new Hard(soldier.OverallSkill * 100);

        this.missionController.Missions.Enqueue(mission1);
        this.missionController.Missions.Enqueue(mission2);
        this.missionController.Missions.Enqueue(mission3);

        // Act
        var result = this.missionController.PerformMission(mission4).Trim();

        var expectedResult = new StringBuilder()
                             .AppendLine($"Mission declined - {mission1.Name}")
                             .AppendLine($"Mission completed - {mission2.Name}")
                             .ToString()
                             .Trim();

        // Assert
        Assert.AreEqual(1, this.missionController.FailedMissionCounter, "Incorrect FailedMissionsCounter!");
        Assert.AreEqual(1, this.missionController.SuccessMissionCounter, "Incorrect SuccessMissionCounter!");
        Assert.AreEqual(2, this.missionController.Missions.Count, "Incorrect Mission count!");
        Assert.AreEqual(true, result.StartsWith(expectedResult), "Incorrect Result msg!");
    }
Beispiel #6
0
        static CodeTypeDeclaration CreateNotImplementedAstVisitorClass(List <Type> nodeTypes)
        {
            CodeTypeDeclaration td = new CodeTypeDeclaration("NotImplementedAstVisitor");

            td.TypeAttributes = TypeAttributes.Public | TypeAttributes.Class;
            td.BaseTypes.Add(new CodeTypeReference("IAstVisitor"));

            string comment = "<summary>\n " +
                             "IAstVisitor implementation that always throws NotImplementedExceptions.\n " +
                             "</summary>";

            td.Comments.Add(new CodeCommentStatement(comment, true));

            foreach (Type type in nodeTypes)
            {
                if (!type.IsAbstract)
                {
                    EasyMethod m = td.AddMethod(typeof(object), VisitPrefix + type.Name);
                    m.Attributes = MemberAttributes.Public;
                    m.AddParameter(ConvertType(type), GetFieldName(type.Name));
                    m.AddParameter(new CodeTypeReference(typeof(object)), "data");

                    m.Body.Throw(Easy.New(typeof(NotImplementedException), Easy.Prim(type.Name)));
                }
            }

            return(td);
        }
Beispiel #7
0
        public static string f_https_getTextByUrl(string url)
        {
            var dataRecorder = new EasyDataRecorder();

            Curl.GlobalInit((int)CURLinitFlag.CURL_GLOBAL_DEFAULT);
            try
            {
                using (Easy easy = new Easy())
                {
                    easy.SetOpt(CURLoption.CURLOPT_WRITEFUNCTION, (Easy.WriteFunction)dataRecorder.HandleWrite);

                    Easy.SSLContextFunction sf = new Easy.SSLContextFunction(OnSSLContext);
                    easy.SetOpt(CURLoption.CURLOPT_SSL_CTX_FUNCTION, sf);

                    easy.SetOpt(CURLoption.CURLOPT_URL, url);
                    //easy.SetOpt(CURLoption.CURLOPT_CAINFO, "ca-bundle.crt");
                    easy.SetOpt(CURLoption.CURLOPT_CAINFO, "ca-bundle.crt");


                    easy.Perform();
                }
            }
            finally
            {
                Curl.GlobalCleanup();
            }

            string s = Encoding.UTF8.GetString(dataRecorder.Written.ToArray());

            return(s);
        }
        }//end method

        //save new registered user in xml
        public void XMLUserSave(string user, string pass, int access)
        {
            AddUsers();
            userFile.Add(new User(user, pass, (UserAccess)access));
            Easy.save(userFile, regUsersXML);
            WritePermissionsToFile((UserAccess)access); //get user permissions
        }//end method
Beispiel #9
0
 //method to save new registered user
 public void TokensSave(string tokenID, string iD)
 {
     TokensLoad();                                                    //load old tokens in the system
     tokensInSystem.Add(new Token(iD, tokenID));                      //add new token
     Easy.save(tokensInSystem, tokensXML);                            //save new user
     tokensHelper = tokensInSystem.ToArray(typeof(Token)) as Token[]; //get tokens data
 }
Beispiel #10
0
    public static void Main(String[] args)
    {
        try {
            Curl.GlobalInit((int)CURLinitFlag.CURL_GLOBAL_ALL);

            Easy easy = new Easy();

            Easy.WriteFunction wf = new Easy.WriteFunction(OnWriteData);
            easy.SetOpt(CURLoption.CURLOPT_WRITEFUNCTION, wf);

            Easy.SSLContextFunction sf = new Easy.SSLContextFunction(OnSSLContext);
            easy.SetOpt(CURLoption.CURLOPT_SSL_CTX_FUNCTION, sf);

            easy.SetOpt(CURLoption.CURLOPT_URL, args[0]);
            easy.SetOpt(CURLoption.CURLOPT_CAINFO, "ca-bundle.crt");

            easy.Perform();
            easy.Cleanup();

            Curl.GlobalCleanup();
        }
        catch (Exception ex) {
            Console.WriteLine(ex);
        }
    }
    public void Constr_ShouldInitializeMissions()
    {
        IMission mission  = new Easy(100);
        var      expected = 0;

        Assert.AreEqual(expected, this.controller.Missions.Count);
    }
Beispiel #12
0
    public void MissionControllerDisplaysSuccessMessage()
    {
        IMission easyMission = new Easy(0);
        string   result      = this.missionController.PerformMission(easyMission);

        Assert.IsTrue(result.Contains("completed"));
    }
Beispiel #13
0
    public static void Main(String[] args)
    {
        try {
            Curl.GlobalInit((int)CURLinitFlag.CURL_GLOBAL_ALL);

            Easy easy = new Easy();

            Easy.WriteFunction wf = new Easy.WriteFunction(OnWriteData);
            easy.SetOpt(CURLoption.CURLOPT_WRITEFUNCTION, wf);

            // simple post - with a string
            easy.SetOpt(CURLoption.CURLOPT_POSTFIELDS,
                        "url=index%3Dstripbooks&field-keywords=Topology&Go.x=10&Go.y=10");

            easy.SetOpt(CURLoption.CURLOPT_USERAGENT,
                        "Mozilla 4.0 (compatible; MSIE 6.0; Win32");
            easy.SetOpt(CURLoption.CURLOPT_FOLLOWLOCATION, true);
            easy.SetOpt(CURLoption.CURLOPT_URL,
                        "http://www.amazon.com/exec/obidos/search-handle-form/002-5928901-6229641");
            easy.SetOpt(CURLoption.CURLOPT_POST, true);

            easy.Perform();
            easy.Cleanup();

            Curl.GlobalCleanup();
        }
        catch (Exception ex) {
            Console.WriteLine(ex);
        }
    }
Beispiel #14
0
    public static void Main(String[] args)
    {
        try {
            Curl.GlobalInit((int)CURLinitFlag.CURL_GLOBAL_ALL);

            Easy easy = new Easy();

            Easy.WriteFunction wf = new Easy.WriteFunction(OnWriteData);
            easy.SetOpt(CURLoption.CURLOPT_WRITEFUNCTION, wf);

            Easy.SSLContextFunction sf = new Easy.SSLContextFunction(OnSSLContext);
            easy.SetOpt(CURLoption.CURLOPT_SSL_CTX_FUNCTION, sf);

            easy.SetOpt(CURLoption.CURLOPT_URL, args[0]);
            easy.SetOpt(CURLoption.CURLOPT_CAINFO, "ca-bundle.crt");

            easy.Perform();
            easy.Cleanup();

            Curl.GlobalCleanup();
        }
        catch(Exception ex) {
            Console.WriteLine(ex);
        }
    }
Beispiel #15
0
    public static void Main(String[] args)
    {
        try {
            Curl.GlobalInit((int)CURLinitFlag.CURL_GLOBAL_ALL);

            Easy.WriteFunction wf = new Easy.WriteFunction(OnWriteData);

            Easy easy1 = new Easy();
            String s1 = (String)args[0].Clone();
            easy1.SetOpt(CURLoption.CURLOPT_URL, args[0]);
            easy1.SetOpt(CURLoption.CURLOPT_WRITEFUNCTION, wf);
            easy1.SetOpt(CURLoption.CURLOPT_WRITEDATA, s1);

            Easy easy2 = new Easy();
            String s2 = (String)args[1].Clone();
            easy2.SetOpt(CURLoption.CURLOPT_URL, args[1]);
            easy2.SetOpt(CURLoption.CURLOPT_WRITEFUNCTION, wf);
            easy2.SetOpt(CURLoption.CURLOPT_WRITEDATA, s2);

            Multi multi = new Multi();
            multi.AddHandle(easy1);
            multi.AddHandle(easy2);

            int stillRunning = 1;
            // call Multi.Perform right away (note ref qualifier)
            while (multi.Perform(ref stillRunning) ==
                CURLMcode.CURLM_CALL_MULTI_PERFORM);

            while (stillRunning != 0)
            {
                multi.FDSet();
                int rc = multi.Select(1000); // one second
                switch(rc)
                {
                    case -1:
                        Console.WriteLine("Multi.Select() returned -1");
                        stillRunning = 0;
                        break;

                    case 0:
                    default:
                    {
                        while (multi.Perform(ref stillRunning) ==
                            CURLMcode.CURLM_CALL_MULTI_PERFORM);
                        break;
                    }
                }
            }

            // various cleanups
            multi.Cleanup();
            easy1.Cleanup();
            easy2.Cleanup();
            Curl.GlobalCleanup();
        }
        catch(Exception ex) {
            Console.WriteLine(ex);
        }
    }
Beispiel #16
0
        //Создание коллекций
        static TestCollections CreateCollection(out int N)
        {
            Console.WriteLine("Введите количество элементов коллекции:");
            N = Easy.ReadNaturalNum("Количество элементов коллекции");
            TestCollections t;

            return(t = new TestCollections(N));
        }
Beispiel #17
0
    public void ShouldNotExecuteMission()
    {
        IMission mission        = new Easy(1000);
        string   result         = missionController.PerformMission(mission);
        string   expectedResult = "Mission on hold - Suppression of civil rebellion";

        Assert.AreEqual(result, expectedResult);
    }
Beispiel #18
0
        public void RunningSumOf1dArrayTest(int[] givenArr, int[] expectedArr)
        {
            //Action
            int[] outputArr = Easy.RunningSum(givenArr);

            //Assert
            expectedArr.ToExpectedObject().ShouldEqual(outputArr);
        }
Beispiel #19
0
        public void TestEasy()
        {
            var   easy = new Easy();
            Level level;

            level = LevelFactory.CreateLevel("Easy");
            Assert.Equal(easy.levelType, level.levelType);
        }
Beispiel #20
0
    public void TestCorrectAddInMissionQueue()
    {
        IMission mission = new Easy(10);

        this.missionController.PerformMission(mission);

        Assert.That(this.missionController.Missions.Count, Is.EqualTo(1));
    }
 //load some users in arraylist userFile
 private void AddUsers()
 {
     /*userFile.Add(new User("root", "root", UserAccess.EMPLOYEE));
      * userFile.Add(new User("Ivan", "vankata", UserAccess.CLIENT));
      * userFile.Add(new User("Peter", "pesho", UserAccess.NONE));
      * Easy.save(userFile, regUsers);*/
     userFile = (ArrayList)Easy.load(regUsersXML);
 }//end method
Beispiel #22
0
    private void EasyTouchInitial(string path)
    {
        GameObject tmpEasyTouch = GetControl(path);

        easyTouch = new Easy(tmpEasyTouch.transform.position, tmpEasyTouch, 75, player);
        AddDrag(path, easyTouch.OnDrag);
        AddOnEndDrag(path, easyTouch.OnEndDrag);
    }
    public void MissionSuccessful()
    {
        var mission        = new Easy(10.0);
        var result         = this.mc.PerformMission(mission).Trim();
        var expectedString = string.Format("Mission completed - {0}", mission.Name);

        Assert.AreEqual(expectedString, result);
    }
    // Use this for initialization
    void Start()
    {
        GameObject explosion = this.gameObject.transform.FindChild ("Explosion").gameObject;

        barrel = this.gameObject.AddComponent<Easy>() as Easy;
        sounds = GetComponents<AudioSource> ();
        barrel.construct (this.gameObject, explosion, sounds[1]);
    }
Beispiel #25
0
        public void MergeTwoSortedLists()
        {
            //arrange
            var target = new Easy();
            var l1     = new ListNode(-2)
            {
                next = new ListNode(5)
                {
                    // next = new ListNode(5)
                }
            };

            var l2 = new ListNode(-9)
            {
                next = new ListNode(-6)
                {
                    next = new ListNode(-3)
                    {
                        next = new ListNode(-1)
                        {
                            next = new ListNode(1)
                            {
                                next = new ListNode(6)
                            }
                        }
                    }
                }
            };

            var expected = new ListNode(-9)
            {
                next = new ListNode(-6)
                {
                    next = new ListNode(-3)
                    {
                        next = new ListNode(-2)
                        {
                            next = new ListNode(-1)
                            {
                                next = new ListNode(1)
                                {
                                    next = new ListNode(5)
                                    {
                                        next = new ListNode(6)
                                    }
                                }
                            }
                        }
                    }
                }
            };

            //act
            ListNode actual = target.MergeTwoSortedLists(l1, l2);

            //assert
            expected.ToExpectedObject().ShouldEqual(actual);
        }
Beispiel #26
0
    public void PerformMissionShouldReturnSuccessMessage()
    {
        IMission mission = new Easy(0);

        string result         = missionController.PerformMission(mission);
        string expectedResult = "Mission completed - Suppression of civil rebellion";

        Assert.IsTrue(result.StartsWith(expectedResult));
    }
Beispiel #27
0
    public static void run(String[] args)
    {
        try {
            Curl.GlobalInit((int)CURLinitFlag.CURL_GLOBAL_ALL);

            // <form action="http://mybox/cgi-bin/myscript.cgi
            //  method="post" enctype="multipart/form-data">
            MultiPartForm mf = new MultiPartForm();

            // <input name="frmUsername">
            mf.AddSection(CURLformoption.CURLFORM_COPYNAME, "frmUsername",
                          CURLformoption.CURLFORM_COPYCONTENTS, "testtcc",
                          CURLformoption.CURLFORM_END);

            // <input name="frmPassword">
            mf.AddSection(CURLformoption.CURLFORM_COPYNAME, "frmPassword",
                          CURLformoption.CURLFORM_COPYCONTENTS, "tcc",
                          CURLformoption.CURLFORM_END);

            // <input name="frmFileOrigPath">
            mf.AddSection(CURLformoption.CURLFORM_COPYNAME, "frmFileOrigPath",
                          CURLformoption.CURLFORM_COPYCONTENTS, args[1],
                          CURLformoption.CURLFORM_END);

            // <input name="frmFileDate">
            mf.AddSection(CURLformoption.CURLFORM_COPYNAME, "frmFileDate",
                          CURLformoption.CURLFORM_COPYCONTENTS, "08/01/2004",
                          CURLformoption.CURLFORM_END);

            // <input type="File" name="f1">
            mf.AddSection(CURLformoption.CURLFORM_COPYNAME, "f1",
                          CURLformoption.CURLFORM_FILE, args[1],
                          CURLformoption.CURLFORM_CONTENTTYPE, "application/binary",
                          CURLformoption.CURLFORM_END);

            Easy easy = new Easy();

            Easy.DebugFunction df = new Easy.DebugFunction(OnDebug);
            easy.SetOpt(CURLoption.CURLOPT_DEBUGFUNCTION, df);
            easy.SetOpt(CURLoption.CURLOPT_VERBOSE, true);

            Easy.ProgressFunction pf = new Easy.ProgressFunction(OnProgress);
            easy.SetOpt(CURLoption.CURLOPT_PROGRESSFUNCTION, pf);

            easy.SetOpt(CURLoption.CURLOPT_URL, args[0]);
            easy.SetOpt(CURLoption.CURLOPT_HTTPPOST, mf);

            easy.Perform();
            //easy.Cleanup();
            mf.Free();

            Curl.GlobalCleanup();
        }
        catch (Exception ex) {
            Console.WriteLine(ex);
        }
    }
Beispiel #28
0
    public static void Main(String[] args)
    {
        try {
            Curl.GlobalInit((int)CURLinitFlag.CURL_GLOBAL_ALL);

            // <form action="http://mybox/cgi-bin/myscript.cgi
            //  method="post" enctype="multipart/form-data">
            MultiPartForm mf = new MultiPartForm();

            // <input name="frmUsername">
            mf.AddSection(CURLformoption.CURLFORM_COPYNAME, "frmUsername",
                CURLformoption.CURLFORM_COPYCONTENTS, "testtcc",
                CURLformoption.CURLFORM_END);

            // <input name="frmPassword">
            mf.AddSection(CURLformoption.CURLFORM_COPYNAME, "frmPassword",
                CURLformoption.CURLFORM_COPYCONTENTS, "tcc",
                CURLformoption.CURLFORM_END);

            // <input name="frmFileOrigPath">
            mf.AddSection(CURLformoption.CURLFORM_COPYNAME, "frmFileOrigPath",
                CURLformoption.CURLFORM_COPYCONTENTS, args[1],
                CURLformoption.CURLFORM_END);

            // <input name="frmFileDate">
            mf.AddSection(CURLformoption.CURLFORM_COPYNAME, "frmFileDate",
                CURLformoption.CURLFORM_COPYCONTENTS, "08/01/2004",
                CURLformoption.CURLFORM_END);

            // <input type="File" name="f1">
            mf.AddSection(CURLformoption.CURLFORM_COPYNAME, "f1",
                CURLformoption.CURLFORM_FILE, args[1],
                CURLformoption.CURLFORM_CONTENTTYPE, "application/binary",
                CURLformoption.CURLFORM_END);

            Easy easy = new Easy();
 
            Easy.DebugFunction df = new Easy.DebugFunction(OnDebug);
            easy.SetOpt(CURLoption.CURLOPT_DEBUGFUNCTION, df);
            easy.SetOpt(CURLoption.CURLOPT_VERBOSE, true);

            Easy.ProgressFunction pf = new Easy.ProgressFunction(OnProgress);
            easy.SetOpt(CURLoption.CURLOPT_PROGRESSFUNCTION, pf);

            easy.SetOpt(CURLoption.CURLOPT_URL, args[0]);
            easy.SetOpt(CURLoption.CURLOPT_HTTPPOST, mf);

            easy.Perform();
            easy.Cleanup();
            mf.Free();

            Curl.GlobalCleanup();
        }
        catch(Exception ex) {
            Console.WriteLine(ex);
        }
    }
Beispiel #29
0
 public void ThreadFunc() {
     Easy easy = new Easy();
     easy.SetOpt(CURLoption.CURLOPT_URL, url);
     easy.SetOpt(CURLoption.CURLOPT_WRITEFUNCTION, wf);
     easy.SetOpt(CURLoption.CURLOPT_WRITEDATA, url);
     easy.SetOpt(CURLoption.CURLOPT_SHARE, share);
     easy.Perform();
     easy.Cleanup();
 }
    public void FailMissionsOnHoldDeletesMissions()
    {
        var easy = new Easy(200.0);

        this.mc.Missions.Enqueue(easy);

        this.mc.FailMissionsOnHold();
        Assert.AreEqual(0, this.mc.Missions.Count);
    }
Beispiel #31
0
 //method to save new registered user
 public void UsersSave(string userName, string password, int access)
 {
     AddUsers();                                                          //load old users in usersInSystem ArrayList
     usersInSystem.Add(new User(userName, password, (UserAccess)access)); //add new user
     Easy.save(usersInSystem, usersXML);                                  //save new user
     usersHelper     = usersInSystem.ToArray(typeof(User)) as User[];     //get user data
     lastLoginAccess = (UserAccess)access;                                //get user access
     Easy.save((int)lastLoginAccess, lastLoginUser);                      //save the user access
 }
Beispiel #32
0
    public void CanPerformMission()
    {
        IMission mission = new Easy(12);

        army.AddSoldier(new Ranker("Saruman", 33, 23, 21));
        mc.PerformMission(mission);

        Assert.IsTrue(mc.SuccessMissionCounter == 1);
    }
Beispiel #33
0
        public static int FlexMenu(string task, int max, int min)
        {
            Console.ForegroundColor = ConsoleColor.White;
            Console.WriteLine(task);
            int choice = Easy.Choice(max, min, "Ошибка. Выберите пункт из меню:");

            Console.WriteLine();
            return(choice);
        }
Beispiel #34
0
 static CodeStatement AssertIsNotNull(CodeExpression expr)
 {
     return(new CodeExpressionStatement(
                Easy.Type("Debug").InvokeMethod("Assert",
                                                Easy.Binary(expr,
                                                            CodeBinaryOperatorType.IdentityInequality,
                                                            Easy.Null))
                ));
 }
Beispiel #35
0
 private void Menu_Paint(object sender, PaintEventArgs e)
 {
     Play.Draw(e.Graphics);
     Achiev.Draw(e.Graphics);
     Quit.Draw(e.Graphics);
     Leaderboards.Draw(e.Graphics);
     Easy.Draw(e.Graphics);
     Medium.Draw(e.Graphics);
     Hard.Draw(e.Graphics);
 }
        public dynamic GetValue(Easy.Domain.Application.ReturnContext context, object data)
        {
            Model.Supplier supplier = data as Model.Supplier;

            if (supplier.GetBrokenRules().Count > 0)
            {
                return new ResultWithData<int>(ResultStatus.Error, 0, supplier.GetBrokenRules()[0].Description);
            }
            return new ResultWithData<int>(ResultStatus.Ok, supplier.Id);
        }
        void EasyEntrySelected(object sender, PlayerIndexEventArgs e)
        {
            Easy easyDiff = new Easy();

            GameScreen[] screensToLoad = new GameScreen[2];
            screensToLoad[0] = new BackgroundScreen(true, true);
            screensToLoad[1] = new ScoreAttackScreen(easyDiff, e.PlayerIndex);

            LoadingScreen.Load(ScreenManager, true, e.PlayerIndex, screensToLoad);
        }
Beispiel #38
0
    public static void Main(String[] args)
    {
        try {
            Curl.GlobalInit((int)CURLinitFlag.CURL_GLOBAL_ALL);

            Easy easy = new Easy();
            Easy.HeaderFunction hf = new Easy.HeaderFunction(OnHeaderData);

            easy.SetOpt(CURLoption.CURLOPT_URL, args[0]);
            easy.SetOpt(CURLoption.CURLOPT_HEADERFUNCTION, hf);
            easy.Perform();
            easy.Cleanup();

            Curl.GlobalCleanup();
        }
        catch(Exception ex) {
            Console.WriteLine(ex);
        }
    }
Beispiel #39
0
    public static void Main(String[] args)
    {
        try {
            Curl.GlobalInit((int)CURLinitFlag.CURL_GLOBAL_ALL);

            FileStream fs = new FileStream(args[0], FileMode.Open,
                FileAccess.Read, FileShare.Read);

            Easy easy = new Easy();

            Easy.ReadFunction rf = new Easy.ReadFunction(OnReadData);
            easy.SetOpt(CURLoption.CURLOPT_READFUNCTION, rf);
            easy.SetOpt(CURLoption.CURLOPT_READDATA, fs);
          
            Easy.DebugFunction df = new Easy.DebugFunction(OnDebug);
            easy.SetOpt(CURLoption.CURLOPT_DEBUGFUNCTION, df);
            easy.SetOpt(CURLoption.CURLOPT_VERBOSE, true);

            Easy.ProgressFunction pf = new Easy.ProgressFunction(OnProgress);
            easy.SetOpt(CURLoption.CURLOPT_PROGRESSFUNCTION, pf);

            easy.SetOpt(CURLoption.CURLOPT_URL, args[1]);
            easy.SetOpt(CURLoption.CURLOPT_USERPWD,
                args[2] + ":" + args[3]);
            easy.SetOpt(CURLoption.CURLOPT_UPLOAD, true);
            easy.SetOpt(CURLoption.CURLOPT_INFILESIZE, fs.Length);

            easy.Perform();
            easy.Cleanup();

            fs.Close();

            Curl.GlobalCleanup();
        }
        catch(Exception ex) {
            Console.WriteLine(ex);
        }
    }
 public bool IsMapped(Easy.Domain.Application.ReturnContext context)
 {
     return true;
 }
Beispiel #41
0
    public static void Main(String[] args)
    {
        try {
            Curl.GlobalInit((int)CURLinitFlag.CURL_GLOBAL_ALL);

            Easy easy = new Easy();
            easy.SetOpt(CURLoption.CURLOPT_URL, args[0]);
            easy.SetOpt(CURLoption.CURLOPT_PRIVATE, "Private string");
            easy.SetOpt(CURLoption.CURLOPT_FILETIME, true);
            easy.Perform();

            // now, exercise the various GetInfo stuff
            double d = 0.0;
            easy.GetInfo(CURLINFO.CURLINFO_CONNECT_TIME, ref d);
            Console.WriteLine("Connect Time: {0}", d);

            d = 0.0;
            easy.GetInfo(CURLINFO.CURLINFO_CONTENT_LENGTH_DOWNLOAD, ref d);
            Console.WriteLine("Content Length (Download): {0}", d);
    
            d = 0.0;
            easy.GetInfo(CURLINFO.CURLINFO_CONTENT_LENGTH_UPLOAD, ref d);
            Console.WriteLine("Content Length (Upload): {0}", d);
    
            string s = null;
            easy.GetInfo(CURLINFO.CURLINFO_CONTENT_TYPE, ref s);
            Console.WriteLine("Content Type: {0}", s);
    
            DateTime dt = new DateTime(0);
            easy.GetInfo(CURLINFO.CURLINFO_FILETIME, ref dt);
            Console.WriteLine("File time: {0}", dt);
    
            int n = 0;
            easy.GetInfo(CURLINFO.CURLINFO_HEADER_SIZE, ref n);
            Console.WriteLine("Header Size: {0}", n);
    
            n = 0;
            easy.GetInfo(CURLINFO.CURLINFO_HTTPAUTH_AVAIL, ref n);
            Console.WriteLine("Authentication Bitmask: {0}", n);
    
            n = 0;
            easy.GetInfo(CURLINFO.CURLINFO_HTTP_CONNECTCODE, ref n);
            Console.WriteLine("HTTP Connect Code: {0}", n);
    
            d = 0.0;            
            easy.GetInfo(CURLINFO.CURLINFO_NAMELOOKUP_TIME, ref d);
            Console.WriteLine("Name Lookup Time: {0}", d);
    
            n = 0;
            easy.GetInfo(CURLINFO.CURLINFO_OS_ERRNO, ref n);
            Console.WriteLine("OS Errno: {0}", n);
    
            d = 0.0;
            easy.GetInfo(CURLINFO.CURLINFO_PRETRANSFER_TIME, ref d);
            Console.WriteLine("Pretransfer time: {0}", d);
    
            object o = null;
            easy.GetInfo(CURLINFO.CURLINFO_PRIVATE, ref o);
            Console.WriteLine("Private Data: {0}", o);
    
            n = 0;
            easy.GetInfo(CURLINFO.CURLINFO_PROXYAUTH_AVAIL, ref n);
            Console.WriteLine("Proxy Authentication Schemes: {0}", n);
    
            n = 0;
            easy.GetInfo(CURLINFO.CURLINFO_REDIRECT_COUNT, ref n);
            Console.WriteLine("Redirect count: {0}", n);
    
            d = 0.0;
            easy.GetInfo(CURLINFO.CURLINFO_REDIRECT_TIME, ref d);
            Console.WriteLine("Redirect time: {0}", d);
    
            n = 0;
            easy.GetInfo(CURLINFO.CURLINFO_REQUEST_SIZE, ref n);
            Console.WriteLine("Request size: {0}", n);
    
            n = 0;
            easy.GetInfo(CURLINFO.CURLINFO_RESPONSE_CODE, ref n);
            Console.WriteLine("Response code: {0}", n);
    
            d = 0.0;
            easy.GetInfo(CURLINFO.CURLINFO_SIZE_DOWNLOAD, ref d);
            Console.WriteLine("Download size: {0}", d);
    
            d = 0.0;
            easy.GetInfo(CURLINFO.CURLINFO_SIZE_UPLOAD, ref d);
            Console.WriteLine("Upload size: {0}", d);
    
            d = 0.0;
            easy.GetInfo(CURLINFO.CURLINFO_SPEED_DOWNLOAD, ref d);
            Console.WriteLine("Download speed: {0}", d);
    
            d = 0.0;
            easy.GetInfo(CURLINFO.CURLINFO_SPEED_UPLOAD, ref d);
            Console.WriteLine("Upload speed: {0}", d);
    
            n = 0;
            easy.GetInfo(CURLINFO.CURLINFO_SSL_VERIFYRESULT, ref n);
            Console.WriteLine("SSL verification result: {0}", n);
    
            d = 0.0;
            easy.GetInfo(CURLINFO.CURLINFO_STARTTRANSFER_TIME, ref d);
            Console.WriteLine("Start transfer time: {0}", d);
    
            d = 0.0;
            easy.GetInfo(CURLINFO.CURLINFO_TOTAL_TIME, ref d);
            Console.WriteLine("Total time: {0}", d);
    
            easy.Cleanup();
            Curl.GlobalCleanup();
        }
        catch(Exception ex) {
            Console.WriteLine(ex);
        }
    }