コード例 #1
0
    static int Main()
    {
        R1   myobj = new R1();
        int  res   = 0;
        long lres;

        MyProxy real_proxy = new MyProxy(myobj);

        R1 o = (R1)real_proxy.GetTransparentProxy();

        if (RemotingServices.IsTransparentProxy(null))
        {
            return(1);
        }

        if (!RemotingServices.IsTransparentProxy(o))
        {
            return(2);
        }

        Console.WriteLine("XXXXXXXXXXXX: " + RemotingServices.GetRealProxy(o));

        if (o.GetType() != myobj.GetType())
        {
            return(3);
        }

        MyStruct myres = o.Add(2, out res, 3);

        Console.WriteLine("Result: " + myres.a + " " +
                          myres.b + " " + myres.c + " " + res);

        if (myres.a != 2)
        {
            return(4);
        }

        if (myres.b != 3)
        {
            return(5);
        }

        if (myres.c != 5)
        {
            return(6);
        }

        if (res != 5)
        {
            return(7);
        }

        R1 o2 = new R1();

        lres = test_call(o2);

        lres = test_call(o);

        Console.WriteLine("Result: " + lres);
        if (lres != 5)
        {
            return(8);
        }

        lres = test_call(o);

        o.test_field = 2;

        Console.WriteLine("test_field: " + o.test_field);
        if (o.test_field != 2)
        {
            return(9);
        }

        RemoteDelegate1 d1     = new RemoteDelegate1(o.Add);
        MyStruct        myres2 = d1(2, out res, 3);

        Console.WriteLine("Result: " + myres2.a + " " +
                          myres2.b + " " + myres2.c + " " + res);

        if (myres2.a != 2)
        {
            return(10);
        }

        if (myres2.b != 3)
        {
            return(11);
        }

        if (myres2.c != 5)
        {
            return(12);
        }

        if (res != 5)
        {
            return(13);
        }

        RemoteDelegate2 d2 = new RemoteDelegate2(o.nonvirtual_Add);

        d2(6, 7);

        if (!(real_proxy.GetTransparentProxy() is R2))
        {
            return(14);
        }

        /* Test what happens if the proxy doesn't return the required information */
        EmptyProxy handler = new EmptyProxy(typeof(R3));
        R3         o3      = (R3)handler.GetTransparentProxy();

        if (o3.anObject != null)
        {
            return(15);
        }

        if (o.null_test_field != null)
        {
            return(16);
        }

        return(0);
    }
コード例 #2
0
 public R1Term(R1 coefficient) : this(coefficient, new R1Constant(1.0))
 {
 }
コード例 #3
0
ファイル: Combo.cs プロジェクト: Taazuma/RoninOldAddons
        public static void Execute()
        {
            var enemiesq = EntityManager.Heroes.Enemies.OrderByDescending
                               (a => a.HealthPercent).Where(a => !a.IsMe && a.IsValidTarget() && a.Distance(Player) <= Q.Range);
            var enemiesr = EntityManager.Heroes.Enemies.OrderByDescending
                               (a => a.HealthPercent).Where(a => !a.IsMe && a.IsValidTarget() && a.Distance(Player) <= R.Range);
            var enemiesw = EntityManager.Heroes.Enemies.OrderByDescending
                               (a => a.HealthPercent).Where(a => !a.IsMe && a.IsValidTarget() && a.Distance(Player) <= W.Range);
            var enemies = EntityManager.Heroes.Enemies.OrderByDescending
                              (a => a.HealthPercent).Where(a => !a.IsMe && a.IsValidTarget() && a.Distance(Player) <= E.Range);
            var target = TargetSelector.GetTarget(1900, DamageType.Magical);

            if (ComboMenu.GetCheckBoxValue("cOne"))
            {
                if (R.IsReady() && target.IsValidTarget(R.Range) && ComboMenu.GetCheckBoxValue("rUse"))
                {
                    foreach (var ultenemies in enemiesr)
                    {
                        R.Cast();
                        R1.Cast(ultenemies);
                    }
                }

                if (E.IsReady() && ComboMenu.GetCheckBoxValue("eUse"))
                {
                    foreach (var eenemies in enemies)

                    {
                        E.Cast(eenemies);
                    }
                }

                if (W.IsReady() && ComboMenu.GetCheckBoxValue("wUse"))
                {
                    W.Cast();
                }

                if (Q.IsReady() && target.IsValidTarget(Q.Range) && ComboMenu.GetCheckBoxValue("qUse"))
                {
                    foreach (var qenemies in enemiesq)
                    {
                        var predQ = Q.GetPrediction(qenemies);

                        {
                            Q.Cast(predQ.CastPosition);
                        }
                    }
                }
            }

            else if (ComboMenu.GetCheckBoxValue("cTwo"))
            {
                if (R.IsReady() && target.IsValidTarget(R.Range) && ComboMenu.GetCheckBoxValue("rUse"))
                {
                    foreach (var ultenemies in enemiesr)
                    {
                        R.Cast();
                        R1.Cast(ultenemies);
                    }
                }

                if (W.IsReady() && ComboMenu.GetCheckBoxValue("wUse"))
                {
                    W.Cast();
                }


                if (E.IsReady() && target.IsValidTarget(E.Range) && ComboMenu.GetCheckBoxValue("eUse"))
                {
                    foreach (var eenemies in enemies)

                    {
                        E.Cast(eenemies);
                    }
                }

                if (Q.IsReady() && target.IsValidTarget(Q.Range) && ComboMenu.GetCheckBoxValue("qUse"))
                {
                    foreach (var qenemies in enemiesq)
                    {
                        var predQ = Q.GetPrediction(qenemies);

                        {
                            Q.Cast(predQ.CastPosition);
                        }
                    }
                }
            }

            else if (ComboMenu.GetCheckBoxValue("cThree"))
            {
                if (R.IsReady() && target.IsValidTarget(R.Range) && ComboMenu.GetCheckBoxValue("rUse"))
                {
                    foreach (var ultenemies in enemiesr)
                    {
                        R.Cast();
                        R1.Cast(ultenemies);
                    }
                }

                if (Q.IsReady() && target.IsValidTarget(Q.Range) && ComboMenu.GetCheckBoxValue("qUse"))
                {
                    foreach (var qenemies in enemiesq)
                    {
                        var predQ = Q.GetPrediction(qenemies);

                        {
                            Q.Cast(predQ.CastPosition);
                        }

                        if (E.IsReady() && ComboMenu.GetCheckBoxValue("eUse"))
                        {
                            foreach (var eenemies in enemies)

                            {
                                E.Cast(eenemies);
                            }
                        }
                    }
                }
            }
        }
 R()
 {
     vB = new V1();
     rB = new R1();
 }
コード例 #5
0
 public MultiCtors(R1 p1)
 {
 }
コード例 #6
0
 static int Main()
 {
     R1
     myobj
     =
     new
     R1
     ();
     int
     res
     =
     0;
     MyProxy
     real_proxy
     =
     new
     MyProxy
     (myobj);
     R1
     o
     =
     (R1)real_proxy.GetTransparentProxy
     ();
     RemoteDelegate1
     d1
     =
     new
     RemoteDelegate1
     (o.Add);
     IAsyncResult
     ar
     =
     d1.BeginInvoke
     (2,
     out
     res,
     3,
     null,
     null);
     MyStruct
     myres
     =
     d1.EndInvoke
     (out
     res,
     ar);
     Console.WriteLine
     ("Result: "
     +
     myres.a
     +
     " "
     +
     myres.b
     +
     " "
     +
     myres.c
     +
     " "
     +
     res);
     if
     (myres.a
     !=
     2)
     return
     1;
     if
     (myres.b
     !=
     3)
     return
     2;
     if
     (myres.c
     !=
     5)
     return
     3;
     if
     (res
     !=
     5)
     return
     4;
     return
     0;
 }
コード例 #7
0
        private static void ComboLogic()
        {
            if (ComboW)
            {
                var t = EntityManager.Heroes.Enemies.Find(x => x.IsValidTarget(W.Range) && !x.HasBuffOfType(BuffType.SpellShield));

                if (t != null)
                {
                    if (W.IsReady() && !Orbwalker.CanAutoAttack)
                    {
                        W.Cast();
                    }
                }
            }

            if (E.IsReady())
            {
                var t = EntityManager.Heroes.Enemies.Where(e => e.IsValidTarget(E.Range + myHero.GetAutoAttackRange()));

                if (t == null)
                {
                    return;
                }

                var t12 = t.OrderByDescending(e => TargetSelector.GetPriority(e)).FirstOrDefault();

                if (t12 != null)
                {
                    if (myHero.Distance(t12) > myHero.GetAutoAttackRange() + 20)
                    {
                        E.Cast(t12.ServerPosition);
                    }
                }
                if (ComboE == 0)
                {
                    var t1 = t.OrderByDescending(e => TargetSelector.GetPriority(e)).FirstOrDefault();

                    if (t1 != null)
                    {
                        E.Cast(t1.ServerPosition);
                    }
                }
                else if (ComboE == 1)
                {
                    if (t != null)
                    {
                        E.Cast(Game.CursorPos);
                    }
                }
            }

            if (ComboR)
            {
                if (R1.IsReady())
                {
                    if (useR1 && !myHero.HasBuff("RivenFengShuiEngine"))
                    {
                        var t = TargetSelector.GetTarget(900, DamageType.Physical);
                        if (t == null)
                        {
                            return;
                        }
                        if (t.Distance(myHero.ServerPosition) < E.Range + myHero.AttackRange && myHero.CountEnemiesInRange(500) >= 1)
                        {
                            R1.Cast();
                        }
                    }

                    if (myHero.HasBuff("RivenFengShuiEngine"))
                    {
                        var t = TargetSelector.GetTarget(900, DamageType.Physical);
                        if (t == null)
                        {
                            return;
                        }
                        if (t.ServerPosition.Distance(myHero.ServerPosition) < 850)
                        {
                            switch (R2Mode)
                            {
                            case 0:
                                if (Rdame(t, t.Health) > t.Health && t.IsValidTarget(R2.Range) && t.Distance(myHero.ServerPosition) < 600)
                                {
                                    CastR2 = true;
                                }
                                else
                                {
                                    CastR2 = false;
                                }
                                break;

                            case 1:
                                if (t.HealthPercent < 25 && t.Health > Rdame(t, t.Health) + Damage.GetAutoAttackDamage(myHero, t) * 2)
                                {
                                    CastR2 = true;
                                }
                                else
                                {
                                    CastR2 = false;
                                }
                                break;

                            case 2:
                                if (t.IsValidTarget(R2.Range) && t.Distance(myHero.ServerPosition) < 600)
                                {
                                    CastR2 = true;
                                }
                                else
                                {
                                    CastR2 = false;
                                }
                                break;

                            case 3:
                                CastR2 = false;
                                break;
                            }
                        }

                        if (CastR2)
                        {
                            R2.Cast(t);
                        }
                    }
                }
            }
        }
コード例 #8
0
 public override int GetHashCode()
 {
     return(R1.GetHashCode() ^ R2.GetHashCode() ^ C.GetHashCode());
 }
コード例 #9
0
ファイル: R1Term.cs プロジェクト: marcosalm/Jetfuel-CSharp
 public R1Term(R1 coefficient, R1 power)
 {
     this._Coefficient = coefficient;
     this._Power = power;
 }
コード例 #10
0
        private static void Combo()
        {
            if (ComboMenu["ComboW"].Cast <CheckBox>().CurrentValue)
            {
                var t = EntityManager.Heroes.Enemies.Find(x => x.IsValidTarget(W.Range) && !x.HasBuffOfType(BuffType.SpellShield));

                if (t != null)
                {
                    if (W.IsReady() && !Orbwalker.CanAutoAttack)


                    {
                        W.Cast();
                    }

                    UseItems(t);
                    UseItems2(t);
                }
            }

            if (E.IsReady())
            {
                var t = EntityManager.Heroes.Enemies.Where(e => e.IsValidTarget(E.Range + myHero.GetAutoAttackRange()));

                if (t == null)
                {
                    return;
                }

                if (ComboMenu["ComboE"].Cast <CheckBox>().CurrentValue)
                {
                    var t1 = t.OrderByDescending(e => TargetSelector.GetPriority(e)).FirstOrDefault();

                    if (t1 != null)
                    {
                        E.Cast(t1.ServerPosition);
                    }
                }
            }

            {
                if (ComboMenu["RForce"].Cast <KeyBind>().CurrentValue)
                {
                    if (R1.IsReady())
                    {
                        if (ComboMenu["RForce"].Cast <KeyBind>().CurrentValue&& !myHero.HasBuff("RivenFengShuiEngine"))
                        {
                            var t = TargetSelector.GetTarget(700, DamageType.Physical);
                            if (t == null)
                            {
                                return;
                            }
                            if (t.Distance(myHero.ServerPosition) < E.Range + myHero.AttackRange && myHero.CountEnemiesInRange(500) >= 1)
                            {
                                R1.Cast();
                            }
                        }

                        if (myHero.HasBuff("RivenFengShuiEngine"))
                        {
                            var t = TargetSelector.GetTarget(900, DamageType.Physical);
                            if (t == null)
                            {
                                return;
                            }

                            {
                                if (ComboBox(ComboMenu, "UseRType") == 0)
                                {
                                    var target = TargetSelector.SelectedTarget;
                                    if (DamageIndicators.Rdmg(t, t.Health) > t.Health && t.IsValidTarget(R2.Range) && t.Distance(myHero.ServerPosition) < 600)
                                    {
                                        R2.Cast(t.ServerPosition);
                                    }
                                    else
                                    {
                                        CastR2 = false;
                                    }
                                }
                                else if (ComboBox(ComboMenu, "UseRType") == 1)
                                {
                                    var prediction = R2.GetPrediction(t);
                                    if (t.HealthPercent < 50 && t.Health > DamageIndicators.Rdmg(t, t.Health) + Damage.GetAutoAttackDamage(myHero, t) * 2)
                                    {
                                        R2.Cast(t.ServerPosition);
                                    }
                                    else
                                    {
                                        CastR2 = false;
                                    }
                                }

                                else if (ComboBox(ComboMenu, "UseRType") == 2)
                                {
                                    if (t.IsValidTarget(R2.Range) && t.Distance(myHero.ServerPosition) < 200)
                                    {
                                        R2.Cast(t.ServerPosition);
                                    }
                                    else
                                    {
                                        CastR2 = false;
                                    }
                                }
                                else if (ComboBox(ComboMenu, "UseRType") == 3)
                                {
                                    CastR2 = false;
                                }
                            }

                            if (CastR2)
                            {
                                R2.Cast(t);
                            }
                        }
                    }
                }
            }
        }
コード例 #11
0
        //  OutputArray _R, OutputArray _t, double distanceThresh, InputOutputArray _mask, OutputArray triangulatedPoints

        public static int RecoverPose(Mat E, PointF[] _points1, PointF[] _points2, Mat _cameraMatrix, double _distanceThresh, out Mat _R, out Mat _t, out Mat _PM)
        {
            Mat pointsMat1 = new Mat();
            Mat pointsMat2 = new Mat();
            Mat cameraMat  = new Mat();

            cameraMat = _cameraMatrix;


            _R  = new Mat();
            _t  = new Mat();
            _PM = new Mat();

            double[,] p1;
            double[,] p2;

            if (_points1.Length <= _points2.Length)
            {
                p1 = new double[_points1.Length, 2];
                p2 = new double[_points1.Length, 2];
            }
            else
            {
                p1 = new double[_points2.Length, 2];

                p2 = new double[_points2.Length, 2];
            }

            for (int i = 0; i < _points1.Length && i < _points2.Length; i++)
            {
                p1[i, 0] = (double)_points1[i].X;
                p1[i, 1] = (double)_points1[i].Y;

                p2[i, 0] = (double)_points2[i].X;
                p2[i, 1] = (double)_points2[i].Y;
            }


            Matrix <double> points1      = new Matrix <double>(p1);
            Matrix <double> points2      = new Matrix <double>(p2);
            Matrix <double> cameraMatrix = new Matrix <double>(cameraMat.Rows, cameraMat.Cols, cameraMat.NumberOfChannels);

            cameraMat.CopyTo(cameraMatrix);

            //Need points1.checkVector

            Debug.Assert(cameraMatrix.Rows == 3 && cameraMatrix.Cols == 3 && cameraMatrix.NumberOfChannels == 1);

            double fx = cameraMatrix[0, 0];
            double fy = cameraMatrix[1, 1];
            double cx = cameraMatrix[0, 2];
            double cy = cameraMatrix[1, 2];

            for (int i = 0; i < points1.Rows; i++)
            {
                points1[i, 0] = (points1[i, 0] - cx) / fx;
                points2[i, 0] = (points2[i, 0] - cx) / fx;
                points1[i, 1] = (points1[i, 1] - cy) / fy;
                points2[i, 1] = (points2[i, 1] - cy) / fy;
            }

            Matrix <double> temp1 = new Matrix <double>(points1.Cols, points1.Rows);
            Matrix <double> temp2 = new Matrix <double>(points2.Cols, points2.Rows);

            CvInvoke.Transpose(points1, temp1);
            CvInvoke.Transpose(points2, temp2);
            points1 = temp1;
            points2 = temp2;

            Matrix <double> R1;
            Matrix <double> R2;
            Matrix <double> t;

            DecomposeEssentialMat(E, out R1, out R2, out t); // we are doing decomposition of E


            double[,] I = { { 1, 0, 0, 0 },
                            { 0, 1, 0, 0 },
                            { 0, 0, 1, 0 } };

            Matrix <double> P0 = new Matrix <double>(I); // And we have 4 results
            Matrix <double> P1 = R1.ConcateHorizontal(t);
            Matrix <double> P2 = R2.ConcateHorizontal(t);
            Matrix <double> P3 = R1.ConcateHorizontal(t * (-1));
            Matrix <double> P4 = R2.ConcateHorizontal(t * (-1));

            // Do the cheirality check.
            // Notice here a threshold dist is used to filter
            // out far away points (i.e. infinite points) since
            // their depth may vary between positive and negtive.

            Mat[] allTriangulations = new Mat[4];
            int   good1             = Mask(P0, P1, points1, points2, _distanceThresh);
            int   good2             = Mask(P0, P2, points1, points2, _distanceThresh);
            int   good3             = Mask(P0, P3, points1, points2, _distanceThresh);
            int   good4             = Mask(P0, P4, points1, points2, _distanceThresh);



            if (good1 >= good2 && good1 >= good3 && good1 >= good4)
            {
                _R  = R1.Mat;
                _t  = t.Mat;
                _PM = P1.Mat;
                return(good1);
            }
            else if (good2 >= good1 && good2 >= good3 && good2 >= good4)
            {
                _R  = R2.Mat;
                _t  = t.Mat;
                _PM = P2.Mat;
                return(good2);
            }
            else if (good3 >= good1 && good3 >= good2 && good3 >= good4)
            {
                t   = t * (-1);
                _R  = R1.Mat;
                _t  = t.Mat;
                _PM = P3.Mat;
                return(good3);
            }
            else
            {
                t   = t * (-1);
                _R  = R2.Mat;
                _t  = t.Mat;
                _PM = P4.Mat;
                return(good4);
            }
        }
コード例 #12
0
 private static void ForceR()
 {
     forceR = (R1.IsReady() && R1.Name == IsFirstR);
     Core.DelayAction(() => forceR = false, 700);
 }
コード例 #13
0
 private static void ForceR()
 {
     ssfl = (R.IsReady() && R.Name == "RivenFengShuiEngine" && R1.Cast());
     Core.DelayAction(() => ssfl = true, 500);
 }
コード例 #14
0
        private static void BurstLogic()
        {
            Orbwalker.OrbwalkTo(Game.CursorPos);
            var e = TargetSelector.GetTarget(E.Range + flashSlot.Range, DamageType.Physical);

            if (e != null && !e.IsDead && e.IsValidTarget() && !e.IsZombie)
            {
                if (R1.IsReady())
                {
                    if (myHero.HasBuff("RivenFengShuiEngine"))
                    {
                        if (Q.IsReady())
                        {
                            if (E.IsReady() && W.IsReady())
                            {
                                if (e.Distance(myHero.ServerPosition) < E.Range + myHero.AttackRange + 100)
                                {
                                    E.Cast(e.Position);
                                }
                            }
                        }
                    }

                    if (E.IsReady())
                    {
                        if (e.Distance(myHero.ServerPosition) < myHero.AttackRange + E.Range + 100)
                        {
                            R1.Cast();
                            E.Cast(e.Position);
                        }
                    }
                }

                if (W.IsReady())
                {
                    if (EntityManager.Heroes.Enemies.Any(x => x.IsValidTarget(W.Range)))
                    {
                        W.Cast();
                    }
                }

                if (BurstItem)
                {
                    if (e.Distance(myHero.ServerPosition) <= E.Range + 500)
                    {
                        if (Item.CanUseItem(ItemId.Youmuus_Ghostblade) && Item.HasItem(ItemId.Youmuus_Ghostblade))
                        {
                            Item.UseItem(ItemId.Youmuus_Ghostblade);
                        }
                    }

                    if (myHero.IsInAutoAttackRange(e))
                    {
                        if (Item.CanUseItem(ItemId.Tiamat_Melee_Only) && Item.HasItem(ItemId.Tiamat_Melee_Only))
                        {
                            Item.UseItem(ItemId.Tiamat_Melee_Only);
                        }

                        if (Item.CanUseItem(ItemId.Titanic_Hydra) && Item.HasItem(ItemId.Titanic_Hydra))
                        {
                            Item.UseItem(ItemId.Titanic_Hydra);
                        }

                        if (Item.CanUseItem(ItemId.Ravenous_Hydra_Melee_Only) && Item.HasItem(ItemId.Ravenous_Hydra_Melee_Only))
                        {
                            Item.UseItem(ItemId.Ravenous_Hydra_Melee_Only);
                        }
                    }
                }

                if (BurstIgnite)
                {
                    if (e.HealthPercent < 50)
                    {
                        if (ignite.IsReady())
                        {
                            ignite.Cast(e);
                        }
                    }
                }

                if (BurstFlash)
                {
                    if (flashSlot.IsReady() && R1.IsReady() && R1.Name == "RivenFengShuiEngine" && E.IsReady() && W.IsReady())
                    {
                        if (e.Distance(myHero.ServerPosition) <= 780 && e.Distance(myHero.ServerPosition) >= E.Range + myHero.AttackRange + 85)
                        {
                            Core.DelayAction(delegate { flashSlot.Cast(e.ServerPosition); }, 500);
                            E.Cast(e.ServerPosition);
                            R1.Cast();
                        }
                    }
                }
            }
        }
コード例 #15
0
        //WIP
        private static void Junglesteal()
        {
            if (!R1.IsReady())
            {
                return;
            }

            if (Config.Item("Blue").GetValue <bool>()) //Blue
            {
                var blueBuff =
                    ObjectManager.Get <Obj_AI_Minion>()
                    .Where(x => x.CharData.BaseSkinName == "SRU_Blue")
                    .Where(x => player.GetSpellDamage(x, SpellSlot.R) > x.Health)
                    .FirstOrDefault(x => x.Team != player.Team);     /// ---------- Check Playerteam stuff ~

                if (blueBuff != null)
                {
                    R1.Cast(blueBuff);
                }
            }

            if (Config.Item("Red").GetValue <bool>()) //Red
            {
                var redBuff =
                    ObjectManager.Get <Obj_AI_Minion>()
                    .Where(x => x.CharData.BaseSkinName == "SRU_Red")
                    .Where(x => player.GetSpellDamage(x, SpellSlot.R) > x.Health)
                    .FirstOrDefault(x => x.Team != player.Team);

                if (redBuff != null)
                {
                    R1.Cast(redBuff);
                }
            }

            if (Config.Item("Baron").GetValue <bool>()) //Baron
            {
                var Baron =
                    ObjectManager.Get <Obj_AI_Minion>()
                    .Where(x => x.CharData.BaseSkinName == "SRU_Baron")
                    .Where(x => player.GetSpellDamage(x, SpellSlot.R) > x.Health)
                    .FirstOrDefault(x => x.Team != player.Team);

                if (Baron != null)
                {
                    R1.Cast(Baron);
                }
            }

            if (Config.Item("Dragon").GetValue <bool>()) //Dragon
            {
                var Dragon =
                    ObjectManager.Get <Obj_AI_Minion>()
                    .Where(x => x.CharData.BaseSkinName == "SRU_Dragon")
                    .Where(x => player.GetSpellDamage(x, SpellSlot.R) > x.Health)
                    .FirstOrDefault(x => x.Team != player.Team);

                if (Dragon != null)
                {
                    R1.Cast(Dragon);
                }
            }
        }
コード例 #16
0
ファイル: R1Term.cs プロジェクト: marcosalm/Jetfuel-CSharp
 public R1Term(R1 coefficient)
     : this(coefficient, new R1Constant(1.0))
 {
 }
コード例 #17
0
        public static void Routine()
        {
            var targetR = TargetSelector.GetTarget(R1.Range, TargetSelector.DamageType.Magical);
            var target  = TargetSelector.GetTarget(Q1.Range, TargetSelector.DamageType.Magical);

            if (target == null || !target.IsValid || targetR == null || !targetR.IsValid)
            {
                return;
            }

            Ignite = player.GetSpellSlot("summonerdot");

            //[R] Aoe Cast
            byte hitcount;

            hitcount = (byte)Config.Item("advanced.R.aoe.count").GetValue <Slider>().Value;

            if (Config.Item("advanced.R.aoe").GetValue <bool>() && R1.IsReady() && !E1.IsReady() && target.IsValidTarget(E1.Range + E1.Width))
            {
                R1.CastIfWillHit(target, hitcount);
            }

            #region -- Variables/Floats etc.
            float qdmg    = Q1.GetDamage(target);
            float edmg    = E1.GetDamage(target);
            float rdmg    = R1.GetDamage(target);
            float aa      = (float)Player.GetAutoAttackDamage(target);
            var   insideE = Lux_E != null && target.Distance(Lux_E.Position) <= E1.Width;
            var   thp     = target.Health;
            var   AArange = Orbwalking.GetRealAutoAttackRange(player);
            var   debuff  = target.HasBuff("luxilluminatingfraulein");
            if (debuff)
            {
                rdmg += PassiveDMG(target);
            }
            if (debuff)
            {
                aa += PassiveDMG(target);
            }
            if (insideE)
            {
                rdmg += edmg;
            }
            var rooted = target.HasBuff("LuxLightBindingMis");
            #endregion


            if (insideE && thp < edmg && target.IsValidTarget(R1.Range))
            {
                return;
            }

            if (rooted && insideE && rdmg + edmg > thp && target.IsValidTarget(R1.Range))
            {
                SpellCastR(targetR);
            }

            #region -- Q spellcast

            var prediction = Q1.GetPrediction(target, true);
            var collision  = Q1.GetCollision(Player.Position.To2D(), new List <Vector2> {
                prediction.UnitPosition.To2D()
            });
            if (Config.Item("combo.Q").GetValue <bool>() &&
                Environment.TickCount - E1.LastCastAttemptT > 400 && Environment.TickCount - R1.LastCastAttemptT > 800 && prediction.Hitchance >= PredQ("prediction.Q"))
            {
                if (collision.Count == 2)
                {
                    if (collision[0].IsChampion() || collision[1].IsChampion())
                    {
                        Q1.Cast(prediction.CastPosition);
                    }
                }
                else if (collision.Count == 1 && collision[0].IsChampion())
                {
                    Q1.Cast(prediction.CastPosition);
                }
                else if (collision.Count <= 1)
                {
                    Q1.Cast(prediction.CastPosition);
                }
                #endregion -- Q spellcast end


                if (rooted && thp < aa && target.IsValidTarget(AArange))
                {
                    return;
                }

                if (Config.Item("combo.E").GetValue <bool>() && Environment.TickCount - Q1.LastCastAttemptT > 875 && Environment.TickCount - R1.LastCastAttemptT > 800)
                {
                    SpellCast(target, E1.Range, E1, false, 1, true, PredE("prediction.E"));
                }

                if (IgniteKillCheck() < thp && target.HasBuff("summonerdot"))
                {
                    return;
                }

                if (Config.Item("combo.R").GetValue <bool>() && R1.IsReady())
                {
                    SpellCastR(targetR);
                }

                if (!target.IsValidTarget(600))
                {
                    return;
                }

                var ignitemenu = Config.Item("autospells.ignite").GetValue <bool>();

                if (thp > IgniteDamage(target) && thp < IgniteDamage(target) + edmg + aa && rooted && E1.IsReady() && target.IsValidTarget(600) && Ignite.IsReady() && ignitemenu)
                {
                    player.Spellbook.CastSpell(Ignite, target);
                    Printchat("Ignite casted");
                }

                if (thp < IgniteDamage(target) + rdmg + aa && rooted && Ignite.IsReady() && R1.IsReady() && ignitemenu)
                {
                    player.Spellbook.CastSpell(Ignite, target);
                    Printchat("Ignite casted");
                }

                if (thp < IgniteDamage(target) + rdmg + aa && Ignite.IsReady() && R1.IsReady() && ignitemenu)
                {
                    player.Spellbook.CastSpell(Ignite, target);
                    Printchat("Ignite casted");
                }

                if (thp < IgniteDamage(target) && target.IsValidTarget(600) && AllyCheck(target, 600) < 1 && Ignite.IsReady() && ignitemenu)
                {
                    player.Spellbook.CastSpell(Ignite, target);
                    Printchat("Ignite casted");
                }
            }
        }
コード例 #18
0
 public static void Special_Draw(EventArgs args)
 {
     if (Checked && Event.Humanform)
     {
         Takedown_grey.Draw(new Vector2(275 + XBonus, 200 + YBonus));
         string status = Spells.Q.IsLearned ? Event.IsReady(Event.CD["Takedown"]) ? "Ready" : Event.CD["Takedown"].ToString() : "Not learn";
         Colour color  = Spells.Q.IsLearned ? Event.IsReady(Event.CD["Takedown"]) ? Colour.Green : Colour.White : Colour.Red;
         Drawing.DrawText(275 + XBonus, 275 + YBonus, color, status);
     }
     if (Checked && Event.Humanform)
     {
         Pounce_grey.Draw(new Vector2(345 + XBonus, 200 + YBonus));
         string status = Spells.W.IsLearned ? Event.IsReady(Event.CD["Pounce"]) ? "Ready" : Event.CD["Pounce"].ToString() : "Not learn";
         Colour color  = Spells.W.IsLearned ? Event.IsReady(Event.CD["Pounce"]) ? Colour.Green : Colour.White : Colour.Red;
         Drawing.DrawText(345 + XBonus, 275 + YBonus, color, status);
     }
     if (Checked && Event.Humanform)
     {
         Swipe_grey.Draw(new Vector2(415 + XBonus, 200 + YBonus));
         string status = Spells.E.IsLearned ? Event.IsReady(Event.CD["Swipe"]) ? "Ready" : Event.CD["Swipe"].ToString() : "Not learn";
         Colour color  = Spells.E.IsLearned ? Event.IsReady(Event.CD["Swipe"]) ? Colour.Green : Colour.White : Colour.Red;
         Drawing.DrawText(415 + XBonus, 275 + YBonus, color, status);
     }
     //--------------------------------------------------------------------------//
     if (Checked && !Event.Humanform)
     {
         Javelin_Toss_grey.Draw(new Vector2(275 + XBonus, 200 + YBonus));
         string status = Spells.Q.IsLearned ? Event.IsReady(Event.CD["Javelintoss"]) ? "Ready" : Event.CD["Javelintoss"].ToString() : "Not learn";
         Colour color  = Spells.Q.IsLearned ? Event.IsReady(Event.CD["Javelintoss"]) ? Colour.Green : Colour.White : Colour.Red;
         Drawing.DrawText(275 + XBonus, 275 + YBonus, color, status);
     }
     if (Checked && !Event.Humanform)
     {
         Bushwhack_grey.Draw(new Vector2(345 + XBonus, 200 + YBonus));
         string status = Spells.W.IsLearned ? Event.IsReady(Event.CD["Bushwhack"]) ? "Ready" : Event.CD["Bushwhack"].ToString() : "Not learn";
         Colour color  = Spells.W.IsLearned ? Event.IsReady(Event.CD["Bushwhack"]) ? Colour.Green : Colour.White : Colour.Red;
         Drawing.DrawText(345 + XBonus, 275 + YBonus, color, status);
     }
     if (Checked && !Event.Humanform)
     {
         Primal_Surge_grey.Draw(new Vector2(415 + XBonus, 200 + YBonus));
         string status = Spells.E.IsLearned ? Event.IsReady(Event.CD["Primalsurge"]) ? "Ready" : Event.CD["Primalsurge"].ToString() : "Not learn";
         Colour color  = Spells.E.IsLearned ? Event.IsReady(Event.CD["Primalsurge"]) ? Colour.Green : Colour.White : Colour.Red;
         Drawing.DrawText(415 + XBonus, 275 + YBonus, color, status);
     }
     //---------------------------------------------------------------------------//
     if (Checked && Event.Humanform)
     {
         R1.Draw(new Vector2(485 + XBonus, 200 + YBonus));
         string status = Spells.R.IsLearned ? Event.IsReady(Event.CD["Aspect"]) ? "Ready" : Event.CD["Aspect"].ToString() : "Not learn";
         Colour color  = Spells.R.IsLearned ? Event.IsReady(Event.CD["Aspect"]) ? Colour.Green : Colour.White : Colour.Red;
         Drawing.DrawText(485 + XBonus, 275 + YBonus, color, status);
     }
     if (Checked && !Event.Humanform)
     {
         Aspect_of_the_Cougar_grey.Draw(new Vector2(485 + XBonus, 200 + YBonus));
         string status = Spells.R.IsLearned ? Event.IsReady(Event.CD["Aspect"]) ? "Ready" : Event.CD["Aspect"].ToString() : "Not learn";
         Colour color  = Spells.R.IsLearned ? Event.IsReady(Event.CD["Aspect"]) ? Colour.Green : Colour.White : Colour.Red;
         Drawing.DrawText(485 + XBonus, 275 + YBonus, color, status);
     }
 }
コード例 #19
0
ファイル: remoting1.cs プロジェクト: Zman0169/mono
	static int Main () {
		R1 myobj = new R1 ();
		int res = 0;
		long lres;
		
		MyProxy real_proxy = new MyProxy (myobj);

		R1 o = (R1)real_proxy.GetTransparentProxy ();

		if (RemotingServices.IsTransparentProxy (null))
			return 1;
		
		if (!RemotingServices.IsTransparentProxy (o))
			return 2;

		Console.WriteLine ("XXXXXXXXXXXX: " + RemotingServices.GetRealProxy (o));

		if (o.GetType () != myobj.GetType ())
			return 3;

		MyStruct myres = o.Add (2, out res, 3);

		Console.WriteLine ("Result: " + myres.a + " " +
				   myres.b + " " + myres.c +  " " + res);

		if (myres.a != 2)
			return 4;
		
		if (myres.b != 3)
			return 5;
		
		if (myres.c != 5)
			return 6;

		if (res != 5)
			return 7;

		R1 o2 = new R1 ();
		
		lres = test_call (o2);
		
		lres = test_call (o);

		Console.WriteLine ("Result: " + lres);
		if (lres != 5)
			return 8;
		
		lres = test_call (o);

		o.test_field = 2;
		
		Console.WriteLine ("test_field: " + o.test_field);
		if (o.test_field != 2)
			return 9;

		RemoteDelegate1 d1 = new RemoteDelegate1 (o.Add);
		MyStruct myres2 = d1 (2, out res, 3);

		Console.WriteLine ("Result: " + myres2.a + " " +
				   myres2.b + " " + myres2.c +  " " + res);

		if (myres2.a != 2)
			return 10;
		
		if (myres2.b != 3)
			return 11;
		
		if (myres2.c != 5)
			return 12;

		if (res != 5)
			return 13;

		RemoteDelegate2 d2 = new RemoteDelegate2 (o.nonvirtual_Add);
		d2 (6, 7);

		if (!(real_proxy.GetTransparentProxy () is R2))
			return 14;

		/* Test what happens if the proxy doesn't return the required information */
		EmptyProxy handler = new EmptyProxy ( typeof (R3) );
		R3 o3 = (R3)handler.GetTransparentProxy();

		if (o3.anObject != null)
			return 15;

		if (o.null_test_field != null)
			return 16;

		return 0;
	}
コード例 #20
0
ファイル: Form.cs プロジェクト: mariyasimic/Hacktoberfest-5
        public void Inicio()
        {
            Point p = new Point();                      // Creamos un punto que nos ayudará a mover las reinas

            p.X         = 78;                           // Punto X inicial de la Reina 5
            p.Y         = 317;                          // Punto Y inicial de la Reina 5
            R5.Location = p;                            // Cambiamos la locación de la Reina 5

            p.X         = 78;                           // Punto X inicial de la Reina 4
            p.Y         = 258;                          // Punto Y inicial de la Reina 4
            R4.Location = p;                            // Cambiamos la locación de la Reina 4

            p.X         = 78;                           // Punto X inicial de la Reina 3
            p.Y         = 199;                          // Punto Y inicial de la Reina 3
            R3.Location = p;                            // Cambiamos la locación de la Reina 3

            p.X         = 78;                           // Punto X inicial de la Reina 2
            p.Y         = 140;                          // Punto Y inicial de la Reina 2
            R2.Location = p;                            // Cambiamos la locación de la Reina 2

            p.X         = 78;                           // Punto X inicial de la Reina 1
            p.Y         = 80;                           // Punto Y inicial de la Reina 1
            R1.Location = p;                            // Cambiamos la locación de la Reina 1
            R1.Refresh();                               // Refrescamos los pictureboxs para tener la imagen actual de como se verían

            for (int i = 0; i < 5; i++)                 // Ciclo que mueve la Reina 1
            {
                for (int j = 0; j < 5; j++)             // Ciclo que mueve la Reina 2
                {
                    for (int k = 0; k < 5; k++)         // Cliclo que mueve la Reina 3
                    {
                        for (int l = 0; l < 5; l++)     // Ciclo que mueve la Reina 2
                        {
                            for (int m = 0; m < 5; m++) // Ciclo que mueve la Reina 1
                            {
                                tablero[0] = i;         // Colocamos la Reina 1
                                tablero[1] = j;         // Colocamos la Reina 2
                                tablero[2] = k;         // Colocamos la Reina 3
                                tablero[3] = l;         // Colocamos la Reina 4
                                tablero[4] = m;         // Colocamos la Reina 5

                                Thread.Sleep(20);       // Asignamos la velocidad con la que se moverán las reinas

                                // Imprimir picturebox
                                if (Verificar())                                                                                                   // Sí la función devuelve verdadero
                                {
                                    if (MessageBox.Show("Encontró una solución", "!SOLUCION¡", MessageBoxButtons.OKCancel) == DialogResult.Cancel) // Mostramos un mensaje que dice sí queremos continuar o terminar el proceso
                                    {
                                        return;                                                                                                    // Sí damos click en "Cancelar" se tendrá que empezar de nuevo
                                    }
                                }

                                Tablero.Refresh();                    // Refrescamos a la imagen actual del Tablero

                                if (m + 1 != 5)                       // Si la Reina 5 está en la posición 5, no moveremos las reina
                                {
                                    p.X         = R5.Location.X + 59; // Cambiamos el punto X de la Reina 5
                                    p.Y         = R5.Location.Y;      // Cambiamos el punto Y de la Reina 5
                                    R5.Location = p;                  // Movemos la locación de la Reina 5
                                    R5.Refresh();                     // Refrescamos a la imagen actual de la Reina 5
                                }
                            } // Fin for de m

                            p.X         = 78;                     // Cambiamos el punto X al inicial de la Reina 5
                            p.Y         = 317;                    // Cambiamos el punto Y al inicial de la Reina 5
                            R5.Location = p;                      // Movemos la Reina 5 a su punto inicial

                            if (l + 1 != 5)                       // Si la Reina 4 está en la posición 5, no moveremos las reina
                            {
                                p.X         = R4.Location.X + 59; // Cambiamos el punto X de la Reina 4
                                p.Y         = R4.Location.Y;      // Cambiamos el punto Y de la Reina 4
                                R4.Location = p;                  // Movemos la locación de la Reina 4
                            }

                            R4.Refresh(); // Refrescamos a la imagen actual de la Reina 4
                        } // Fin for de l

                        p.X         = 78;                     // Cambiamos el punto X al inicial de la Reina 4
                        p.Y         = 258;                    // Cambiamos el punto Y al inicial de la Reina 4
                        R4.Location = p;                      // Movemos la Reina 4 a su punto inicial

                        if (k + 1 != 5)                       // Si la Reina 3 está en la posición 5, no moveremos las reina
                        {
                            p.X         = R3.Location.X + 59; // Cambiamos el punto X de la Reina 3
                            p.Y         = R3.Location.Y;      // Cambiamos el punto Y de la Reina 3
                            R3.Location = p;                  // Movemos la locación de la Reina 3
                        }

                        R3.Refresh(); // Refrescamos a la imagen actual de la Reina 3
                    } // Fin for de k

                    p.X         = 78;                     // Cambiamos el punto X al inicial de la Reina 3
                    p.Y         = 199;                    // Cambiamos el punto Y al inicial de la Reina 3
                    R3.Location = p;                      // Movemos la Reina 3 a su punto inicial

                    if (j + 1 != 5)                       // Si la Reina 2 está en la posición 5, no moveremos las reina
                    {
                        p.X         = R2.Location.X + 59; // Cambiamos el punto X de la Reina 2
                        p.Y         = R2.Location.Y;      // Cambiamos el punto Y de la Reina 2
                        R2.Location = p;                  // Movemos la locación de la Reina 2
                    }

                    R2.Refresh(); // Refrescamos a la imagen actual de la Reina 2
                } // Fin for de j

                p.X         = 78;                     // Cambiamos el punto X al inicial de la Reina 2
                p.Y         = 140;                    // Cambiamos el punto Y al inicial de la Reina 2
                R2.Location = p;                      // Movemos la Reina 2 a su punto inicial

                if (i + 1 != 5)                       // Si la Reina 1 está en la posición 5, no moveremos las reina
                {
                    p.X         = R1.Location.X + 59; // Cambiamos el punto X de la Reina 1
                    p.Y         = R1.Location.Y;      // Cambiamos el punto Y de la Reina 1
                    R1.Location = p;                  // Movemos la locación de la Reina 1
                }

                R1.Refresh(); // Refrescamos a la imagen actual de la Reina 1
            } // Fin for de i

            p.X         = 78; // Cambiamos el punto X al inicial de la Reina 1
            p.Y         = 80; // Cambiamos el punto Y al inicial de la Reina 1
            R1.Location = p;  // Movemos la Reina 1 a su punto inicial
            R1.Refresh();     // Refrescamos la imagen a la inicial
        }
コード例 #21
0
ファイル: remoting2.cs プロジェクト: Zman0169/mono
	static int Main () {
		R1 myobj = new R1 ();
		long lres;
		
		MyProxy real_proxy = new MyProxy (myobj);

		R1 o = (R1)real_proxy.GetTransparentProxy ();

		RemoteDelegate2 d2 = new RemoteDelegate2 (o.nonvirtual_Add);
		d2 (6, 7);
		
		IAsyncResult ar1 = d2.BeginInvoke (2, 4, null, null);
		lres = d2.EndInvoke (ar1);
		if (lres != 6)
			return 1;

		return 0;
	}
コード例 #22
0
ファイル: Lux.cs プロジェクト: Dekryptor/Port-1
        public static void SpellCastR(AIHeroClient target)
        {
            if (target == null)
            {
                return;
            }
            if (!target.IsValid)
            {
                return;
            }
            var rslider = Config.Item("combo.r.slider").GetValue <Slider>().Value;

            #region variables/floats
            //[R] Combo Sequences
            double qdmg = Q1.GetDamage(target);
            double edmg = E1.GetDamage(target);
            double rdmg = R1.GetDamage(target);
            double aa   = Player.GetAutoAttackDamage(target);
            Ignite = player.GetSpellSlot("summonerdot");
            var insideE = Lux_E != null && target.Distance(Lux_E.Position) < E1.Width;
            var thp     = target.Health;
            var AArange = Orbwalking.GetRealAutoAttackRange(player);

            var debuff = target.HasBuff("luxilluminatingfraulein");

            if (debuff)
            {
                rdmg += PassiveDMG(target);
            }
            if (debuff)
            {
                aa += PassiveDMG(target);
            }
            if (insideE)
            {
                rdmg += edmg;
            }

            var qcollision = Q1.GetCollision(player.Position.To2D(), new List <Vector2> {
                Q1.GetPrediction(target).CastPosition.To2D()
            });
            var minioncol = qcollision.Where(x => (x is AIHeroClient) && x.IsEnemy).Count();
            var qpred     = Q1.GetPrediction(target).Hitchance >= HitChance.High;
            var epred     = E1.GetPrediction(target).Hitchance >= HitChance.High;

            var rooted = target.HasBuff("LuxLightBindingMis");


            if (target.Distance(player.Position) < rslider && !rooted)
            {
                return;
            }


            #endregion
            if (insideE && Lux_E != null)
            {
                return;
            }

            //Checks if Allies can kill the bitch
            if (AllyCheck(target, 600) >= 2 && target.Health < rdmg / 2)
            {
                return;
            }
            //Checks if an Ally can kill le bitch
            if (AllyCheck(target, 600) >= 1 && target.Health < rdmg / 2)
            {
                return;
            }

            if (rooted && insideE && rdmg + edmg > thp && target.IsValidTarget(R1.Range))
            {
                SpellCast(target, R1.Range, R1, false, 1, false, PredR("prediction.R"));
            }

            if (E1.IsReady() && thp < edmg && target.IsValidTarget(E1.Range) && epred)
            {
                return;
            }

            if (Q1.IsReady() && thp < qdmg && target.IsValidTarget(Q1.Range) && minioncol <= 1 && qpred)
            {
                return;
            }

            if (insideE && thp < edmg)
            {
                return;
            }

            if (insideE && thp < edmg + aa && target.IsValidTarget(AArange))
            {
                return;
            }

            if (thp < aa && target.IsValidTarget(AArange))
            {
                return;
            }

            if (thp < edmg && E1.IsReady() && rooted && target.IsValidTarget(E1.Range))
            {
                return;
            }

            if (Q1.IsReady() && !E1.IsReady() && thp < qdmg && target.IsValidTarget(Q1.Range) && minioncol <= 1 && qpred)
            {
                return;
            }

            if (E1.IsReady() && !Q1.IsReady() && thp < edmg && target.IsValidTarget(E1.Range) && epred)
            {
                return;
            }

            if (rooted && debuff && thp < aa && target.IsValidTarget(AArange))
            {
                return;
            }

            if (Environment.TickCount - E1.LastCastAttemptT < 100 || Environment.TickCount - Q1.LastCastAttemptT < 800 && !rooted)
            {
                return;
            }

            if (rooted && insideE && thp < rdmg + edmg && target.IsValidTarget(R1.Range))
            {
                SpellCast(target, R1.Range, R1, false, 1, false, PredR("prediction.R"));
            }

            if (rooted && E1.IsReady() && target.IsValidTarget(E1.Range) && thp < rdmg + edmg && target.IsValidTarget(R1.Range))
            {
                SpellCast(target, R1.Range, R1, false, 1, false, PredR("prediction.R"));
            }

            if (rooted && debuff && thp < rdmg + aa && target.IsValidTarget(AArange))
            {
                SpellCast(target, R1.Range, R1, false, 1, false, PredR("prediction.R"));
            }

            if (rooted && debuff && thp < rdmg && target.IsValidTarget(R1.Range))
            {
                SpellCast(target, R1.Range, R1, false, 1, false, PredR("prediction.R"));
            }

            if (thp < rdmg)
            {
                SpellCast(target, R1.Range, R1, false, 1, false, PredR("prediction.R"));
            }
        }
コード例 #23
0
ファイル: main.cs プロジェクト: AndreasNygaard/PrakProg
    static void Main()
    {
        int    n = 5, m = 4;
        matrix A1  = new matrix(n, m);
        var    rnd = new Random(1);

        for (int i = 0; i < n; i++)
        {
            for (int j = 0; j < m; j++)
            {
                A1[i, j] = 2 * (rnd.NextDouble() - 0.5);
            }
        }
        WriteLine("____Assignment A1____");
        A1.print($"QR-decomposition:\nrandom {n}x{m} matrix A:");
        (matrix Q, matrix R1) = qrDecomp.qr_gs_decomp(A1);
        R1.print("matrix R:");
        matrix QTQ = Q.T * Q;
        matrix QR  = Q * R1;

        QTQ.print("Q^T*Q:");
        QR.print("Q*R:");
        if (A1.approx(QR))
        {
            WriteLine("Q*R=A, test passed");
        }
        else
        {
            WriteLine("Q*R!=A, test failed");
        }
        Write("\n\n");


        matrix A2 = new matrix(n, n);

        rnd = new Random(2);
        for (int i = 0; i < n; i++)
        {
            for (int j = 0; j < n; j++)
            {
                A2[i, j] = 2 * (rnd.NextDouble() - 0.5);
            }
        }
        vector b = new vector(n);

        rnd = new Random(3);
        for (int i = 0; i < n; i++)
        {
            b[i] = 2 * (rnd.NextDouble() - 0.5);
        }
        WriteLine("____Assignment A2____");
        A2.print($"Solving system of equations A*x=Q*R*x=b:\nrandom {n}x{n} matrix A:");
        (matrix Q2, matrix R2) = qrDecomp.qr_gs_decomp(A2);
        Q2.print("matrix Q:");
        R2.print("matrix R:");
        b.print("vector b:");
        vector x2  = qrDecomp.qr_gs_solve(Q2, R2, b);
        vector Ax2 = A2 * x2;

        x2.print("solution vector x:");
        Ax2.print("A*x:");
        if (b.approx(A2 * x2))
        {
            WriteLine("A*x=b, test passed");
        }
        else
        {
            WriteLine("A*x!=b, test failed");
        }
        Write("\n\n");


        matrix A3 = new matrix(n, n);

        rnd = new Random(4);
        for (int i = 0; i < n; i++)
        {
            for (int j = 0; j < n; j++)
            {
                A3[i, j] = 2 * (rnd.NextDouble() - 0.5);
            }
        }
        WriteLine("____Assignment B____");
        A3.print($"Decomposing A into Q*R:\nrandom {n}x{n} matrix A:");
        (matrix Q3, matrix R3) = qrDecomp.qr_gs_decomp(A3);
        Q3.print("matrix Q:");
        R3.print("matrix R:");
        matrix B = qrDecomp.qr_gs_inverse(Q3, R3);
        matrix I = new matrix(n, n);

        for (int i = 0; i < n; i++)
        {
            for (int j = 0; j < n; j++)
            {
                I[i, j] = 0;
                if (i == j)
                {
                    I[i, j] = 1;
                }
            }
        }
        I.print($"Idenity matrix I({n}):");
        B.print("Inverse matrix B:");
        matrix AB       = A3 * B;
        matrix AB_round = new matrix(n, n); // rounded matrix to 10th decimal to get a nicer output

        for (int i = 0; i <= n - 1; i++)
        {
            for (int j = 0; j <= n - 1; j++)
            {
                AB_round[i, j] = Math.Round((Double)AB[i, j], 10);
            }
        }
        AB_round.print("A*B:");
        if (AB.approx(I))
        {
            WriteLine("A*B=I, test passed");             // test is still with unrounded matrix
        }
        else
        {
            WriteLine("A*B!=I, test failed");
        }
        Write("\n\n");


        WriteLine("____Assignment C____");
        A2.print($"Givens rotation of the same coefficient matrix as in part A(2):\nrandom {n}x{m} matrix A:");
        matrix T = A2.copy();

        qrDecomp.qr_givens_decomp(T);
        T.print("Matrix with R in the upper trinagle and angles of the Givens rotation below, T:");
        b.print("Same vector b as in A(2):");
        vector Gb  = b.copy();
        vector x4  = qrDecomp.qr_givens_solve(T, Gb);
        vector Ax4 = A2 * x4;

        x4.print("solution vector x:");
        Ax4.print("A*x:");
        if (b.approx(A2 * x4))
        {
            WriteLine("A*x=b, test passed");
        }
        else
        {
            WriteLine("A*x!=b, test failed");
        }
        Write("\n\n");
    }
コード例 #24
0
ファイル: Combo.cs プロジェクト: Taazuma/EB-T
        public static void Execute()
        {
            var enemiesq = EntityManager.Heroes.Enemies.OrderByDescending
                               (a => a.HealthPercent).Where(a => !a.IsMe && a.IsValidTarget() && a.Distance(Player) <= Q.Range);
            var enemiesr = EntityManager.Heroes.Enemies.OrderByDescending
                               (a => a.HealthPercent).Where(a => !a.IsMe && a.IsValidTarget() && a.Distance(Player) <= R.Range);
            var enemiesw = EntityManager.Heroes.Enemies.OrderByDescending
                               (a => a.HealthPercent).Where(a => !a.IsMe && a.IsValidTarget() && a.Distance(Player) <= W.Range);
            var enemies = EntityManager.Heroes.Enemies.OrderByDescending
                              (a => a.HealthPercent).Where(a => !a.IsMe && a.IsValidTarget() && a.Distance(Player) <= E.Range);
            var target = TargetSelector.GetTarget(1900, DamageType.Magical);

            if (target == null || target.IsInvulnerable || target.MagicImmune)
            {
                return;
            }

            if (ComboMenu["Comba"].Cast <ComboBox>().CurrentValue == 0)
            {
                if (R.IsReady() && target.IsValidTarget(R.Range) && ComboMenu.GetCheckBoxValue("rUse"))
                {
                    foreach (var ultenemies in enemiesr)
                    {
                        R.Cast();
                        R1.Cast(ultenemies);
                        Program.ItemsYuno();
                    }
                }

                if (E.IsReady() && ComboMenu.GetCheckBoxValue("eUse"))
                {
                    foreach (var eenemies in enemies)

                    {
                        E.Cast(eenemies);
                        Program.Items();
                    }
                }

                if (W.IsReady() && ComboMenu.GetCheckBoxValue("wUse"))
                {
                    W.Cast();
                }

                if (Q.IsReady() && target.IsValidTarget(Q.Range) && ComboMenu.GetCheckBoxValue("qUse"))
                {
                    foreach (var qenemies in enemiesq)
                    {
                        var predQ = Q.GetPrediction(qenemies);

                        {
                            Q.Cast(predQ.CastPosition);
                        }
                    }
                }
            }

            else if (ComboMenu["Comba"].Cast <ComboBox>().CurrentValue == 1)
            {
                if (R.IsReady() && target.IsValidTarget(R.Range) && ComboMenu.GetCheckBoxValue("rUse"))
                {
                    foreach (var ultenemies in enemiesr)
                    {
                        R.Cast();
                        R1.Cast(ultenemies);
                        Program.ItemsYuno();
                    }
                }

                if (E.IsReady() && target.IsValidTarget(E.Range) && ComboMenu.GetCheckBoxValue("eUse"))
                {
                    foreach (var eenemies in enemies)

                    {
                        E.Cast(eenemies);
                        Program.Items();
                    }
                }

                if (Q.IsReady() && target.IsValidTarget(Q.Range) && ComboMenu.GetCheckBoxValue("qUse"))
                {
                    foreach (var qenemies in enemiesq)
                    {
                        var predQ = Q.GetPrediction(qenemies);

                        {
                            Q.Cast(predQ.CastPosition);
                        }
                    }
                }
            }

            else if (ComboMenu["Comba"].Cast <ComboBox>().CurrentValue == 2)
            {
                if (R.IsReady() && target.IsValidTarget(R.Range) && ComboMenu.GetCheckBoxValue("rUse"))
                {
                    foreach (var ultenemies in enemiesr)
                    {
                        R.Cast();
                        R1.Cast(ultenemies);
                        Program.ItemsYuno();
                    }
                }

                if (Q.IsReady() && target.IsValidTarget(Q.Range) && ComboMenu.GetCheckBoxValue("qUse"))
                {
                    foreach (var qenemies in enemiesq)
                    {
                        var predQ = Q.GetPrediction(qenemies);

                        {
                            Q.Cast(predQ.CastPosition);
                        }
                    }

                    if (E.IsReady() && ComboMenu.GetCheckBoxValue("eUse") && target.IsValidTarget(E.Range))
                    {
                        E.Cast(target);
                        Program.Items();
                    }
                }
            }

            else if (ComboMenu["Comba"].Cast <ComboBox>().CurrentValue == 3)
            {
                if (R.IsReady() && target.IsValidTarget(R.Range) && ComboMenu.GetCheckBoxValue("rUse"))
                {
                    foreach (var ultenemies in enemiesr)
                    {
                        R.Cast();
                        R1.Cast(ultenemies);
                    }
                }

                if (Q.IsReady() && target.IsValidTarget(Q.Range) && ComboMenu.GetCheckBoxValue("qUse"))
                {
                    foreach (var qenemies in enemiesq)
                    {
                        var predQ = Q.GetPrediction(qenemies);

                        {
                            Q.Cast(predQ.CastPosition);
                        }
                    }
                }

                if (E.IsReady() && ComboMenu.GetCheckBoxValue("eUse") && target.IsValidTarget(E.Range))
                {
                    E.Cast(target);
                }

                Program.ItemsYuno();
                Program.Items();

                if (SpellManager.Smite.IsReady())
                {
                    SpellManager.Smite.Cast(target);
                }
            }
        }
コード例 #25
0
 public R1Term(R1 coefficient, R1 power)
 {
     this._Coefficient = coefficient;
     this._Power       = power;
 }
コード例 #26
0
    static int Main()
    {
        R1   myobj = new R1();
        int  res   = 0;
        long lres;

        MyProxy real_proxy = new MyProxy(myobj);

        R1 o = (R1)real_proxy.GetTransparentProxy();

        if (RemotingServices.IsTransparentProxy(null))
        {
            return(1);
        }

        if (!RemotingServices.IsTransparentProxy(o))
        {
            return(2);
        }

        Console.WriteLine("XXXXXXXXXXXX: " + RemotingServices.GetRealProxy(o));

        if (o.GetType() != myobj.GetType())
        {
            return(3);
        }

        MyStruct myres = o.Add(2, out res, 3);

        Console.WriteLine("Result: " + myres.a + " " +
                          myres.b + " " + myres.c + " " + res);

        if (myres.a != 2)
        {
            return(4);
        }

        if (myres.b != 3)
        {
            return(5);
        }

        if (myres.c != 5)
        {
            return(6);
        }

        if (res != 5)
        {
            return(7);
        }

        R1 o2 = new R1();

        lres = test_call(o2);

        lres = test_call(o);

        Console.WriteLine("Result: " + lres);
        if (lres != 5)
        {
            return(8);
        }

        lres = test_call(o);

        o.test_field = 2;

        int i = o.test_field;          // copy to local variable necessary to avoid CS1690: "Accessing a member on 'member' may cause a runtime exception because it is a field of a marshal-by-reference class"

        Console.WriteLine("test_field: " + i);
        if (i != 2)
        {
            return(9);
        }

        RemoteDelegate1 d1     = new RemoteDelegate1(o.Add);
        MyStruct        myres2 = d1(2, out res, 3);

        Console.WriteLine("Result: " + myres2.a + " " +
                          myres2.b + " " + myres2.c + " " + res);

        if (myres2.a != 2)
        {
            return(10);
        }

        if (myres2.b != 3)
        {
            return(11);
        }

        if (myres2.c != 5)
        {
            return(12);
        }

        if (res != 5)
        {
            return(13);
        }

        RemoteDelegate2 d2 = new RemoteDelegate2(o.nonvirtual_Add);

        d2(6, 7);

        if (!(real_proxy.GetTransparentProxy() is R2))
        {
            return(14);
        }

        /* Test what happens if the proxy doesn't return the required information */
        EmptyProxy handler = new EmptyProxy(typeof(R3));
        R3         o3      = (R3)handler.GetTransparentProxy();

        if (o3.anObject != null)
        {
            return(15);
        }

        if (o.null_test_field != null)
        {
            return(16);
        }

        return(0);
    }
コード例 #27
0
ファイル: Corki.cs プロジェクト: wllad14/LeagueRepo
 private void Drawing_OnDraw(EventArgs args)
 {
     if (Config.Item("watermark").GetValue <bool>())
     {
         Drawing.DrawText(Drawing.Width * 0.2f, Drawing.Height * 0f, System.Drawing.Color.Cyan, "OneKeyToWin AIO - " + Player.ChampionName + " by Sebby");
     }
     if (Config.Item("nktdE").GetValue <bool>())
     {
         if (Game.CursorPos.Distance(Player.Position) > Player.AttackRange + Player.BoundingRadius * 2)
         {
             drawText("dash: ON ", Player.Position, System.Drawing.Color.Red);
         }
         else
         {
             drawText("dash: OFF ", Player.Position, System.Drawing.Color.GreenYellow);
         }
     }
     if (Config.Item("qRange").GetValue <bool>())
     {
         if (Config.Item("onlyRdy").GetValue <bool>())
         {
             if (Q.IsReady())
             {
                 Utility.DrawCircle(ObjectManager.Player.Position, Q.Range, System.Drawing.Color.Cyan, 1, 1);
             }
         }
         else
         {
             Utility.DrawCircle(ObjectManager.Player.Position, Q.Range, System.Drawing.Color.Cyan, 1, 1);
         }
     }
     if (Config.Item("wRange").GetValue <bool>())
     {
         if (Config.Item("onlyRdy").GetValue <bool>())
         {
             if (W.IsReady())
             {
                 Utility.DrawCircle(ObjectManager.Player.Position, W.Range, System.Drawing.Color.Orange, 1, 1);
             }
         }
         else
         {
             Utility.DrawCircle(ObjectManager.Player.Position, W.Range, System.Drawing.Color.Orange, 1, 1);
         }
     }
     if (Config.Item("eRange").GetValue <bool>())
     {
         if (Config.Item("onlyRdy").GetValue <bool>())
         {
             if (E.IsReady())
             {
                 Utility.DrawCircle(ObjectManager.Player.Position, E.Range, System.Drawing.Color.Yellow, 1, 1);
             }
         }
         else
         {
             Utility.DrawCircle(ObjectManager.Player.Position, E.Range, System.Drawing.Color.Yellow, 1, 1);
         }
     }
     if (Config.Item("rRange").GetValue <bool>())
     {
         if (Config.Item("onlyRdy").GetValue <bool>())
         {
             if (R1.IsReady())
             {
                 Utility.DrawCircle(ObjectManager.Player.Position, R2.Range, System.Drawing.Color.Gray, 1, 1);
             }
         }
         else
         {
             Utility.DrawCircle(ObjectManager.Player.Position, R2.Range, System.Drawing.Color.Gray, 1, 1);
         }
     }
 }
コード例 #28
0
 private void Drawing_OnDraw(EventArgs args)
 {
     if (Config.Item("nktdE", true).GetValue <bool>())
     {
         if (Game.CursorPos.Distance(Player.Position) > Player.AttackRange + Player.BoundingRadius * 2)
         {
             drawText("dash: ON ", Player.Position, System.Drawing.Color.Red);
         }
         else
         {
             drawText("dash: OFF ", Player.Position, System.Drawing.Color.GreenYellow);
         }
     }
     if (Config.Item("qRange", true).GetValue <bool>())
     {
         if (Config.Item("onlyRdy", true).GetValue <bool>())
         {
             if (Q.IsReady())
             {
                 Utility.DrawCircle(ObjectManager.Player.Position, Q.Range, System.Drawing.Color.Cyan, 1, 1);
             }
         }
         else
         {
             Utility.DrawCircle(ObjectManager.Player.Position, Q.Range, System.Drawing.Color.Cyan, 1, 1);
         }
     }
     if (Config.Item("wRange", true).GetValue <bool>())
     {
         if (Config.Item("onlyRdy", true).GetValue <bool>())
         {
             if (W.IsReady())
             {
                 Utility.DrawCircle(ObjectManager.Player.Position, W.Range, System.Drawing.Color.Orange, 1, 1);
             }
         }
         else
         {
             Utility.DrawCircle(ObjectManager.Player.Position, W.Range, System.Drawing.Color.Orange, 1, 1);
         }
     }
     if (Config.Item("eRange", true).GetValue <bool>())
     {
         if (Config.Item("onlyRdy", true).GetValue <bool>())
         {
             if (E.IsReady())
             {
                 Utility.DrawCircle(ObjectManager.Player.Position, E.Range, System.Drawing.Color.Yellow, 1, 1);
             }
         }
         else
         {
             Utility.DrawCircle(ObjectManager.Player.Position, E.Range, System.Drawing.Color.Yellow, 1, 1);
         }
     }
     if (Config.Item("rRange", true).GetValue <bool>())
     {
         if (Config.Item("onlyRdy", true).GetValue <bool>())
         {
             if (R1.IsReady())
             {
                 Utility.DrawCircle(ObjectManager.Player.Position, R2.Range, System.Drawing.Color.Gray, 1, 1);
             }
         }
         else
         {
             Utility.DrawCircle(ObjectManager.Player.Position, R2.Range, System.Drawing.Color.Gray, 1, 1);
         }
     }
 }
コード例 #29
0
 static long test_call(R1 o)
 {
     return(o.nonvirtual_Add(2, 3));
 }
コード例 #30
0
ファイル: IMDBScraper.cs プロジェクト: lickey10/SCTV
        /// <summary>
        /// find and display multiple matches
        /// </summary>
        /// <param name="matchContent"></param>
        /// <returns></returns>
        private Media displayMultipleMatches(string matchContent, bool bestMatch)
        {
            //find the imdbNumber and titles and display
            ArrayList searchResults = new ArrayList();
            string    foundImdbNum  = "";
            Media     foundMatch    = null;
            Media     selectedMedia = null;
            int       matchIndex    = 0;

            //string linkPattern = @"(<a.*?>.*?</a>)";
            string linkPattern = @"find-title-.*?/title_popular/images/b.gif.*?</td>";//popular title match
            Regex  R1          = new Regex(linkPattern,
                                           RegexOptions.IgnoreCase | RegexOptions.IgnorePatternWhitespace);

            if (R1.Matches(matchContent).Count == 0)
            {
                linkPattern = @"find-title-.*?</td></tr></table>";

                R1 = new Regex(linkPattern,
                               RegexOptions.IgnoreCase | RegexOptions.IgnorePatternWhitespace);
            }

            if (R1.Matches(matchContent).Count == 0)
            {
                linkPattern = @"find-title-.*?<br>&#160;";

                R1 = new Regex(linkPattern,
                               RegexOptions.IgnoreCase | RegexOptions.IgnorePatternWhitespace);
            }

            foreach (Match match in R1.Matches(matchContent))
            {
                Media media = new Media();

                media.IMDBNum = getIMDBNum(match.Groups[0].Value);

                foundImdbNum = media.IMDBNum;

                media.Title = getMultipleMatchTitle(matchContent, matchIndex);

                if (media.Title.Trim().Length > 0)
                {
                    searchResults.Add(media);

                    if (bestMatch)
                    {
                        break;
                    }
                }

                matchIndex++;
            }

            if (bestMatch)
            {
                if (searchResults.Count > 0)
                {
                    selectedMedia = (Media)searchResults[0];

                    //get info
                    if (foundImdbNum != null && foundImdbNum.Length > 0)
                    {
                        foundMatch = getInfoByNumber(selectedMedia);
                    }
                }
            }
            else
            {
                //display results
                MultipleMatches multipleMatches = new MultipleMatches(searchResults);
                DialogResult    result          = multipleMatches.ShowDialog();

                if (result == DialogResult.OK)
                {
                    foundMatch = multipleMatches.MediaResult;
                }
            }

            return(foundMatch);
        }
コード例 #31
0
    static int Main()
    {
        R1 myobj = new R1 ();
        int res = 0;
        long lres;

        MyProxy real_proxy = new MyProxy (myobj);

        R1 o = (R1)real_proxy.GetTransparentProxy ();

        if (RemotingServices.IsTransparentProxy (null))
            return 1;

        if (!RemotingServices.IsTransparentProxy (o))
            return 2;

        Console.WriteLine ("XXXXXXXXXXXX: " + RemotingServices.GetRealProxy (o));

        if (o.GetType () != myobj.GetType ())
            return 3;

        MyStruct myres = o.Add (2, out res, 3);

        Console.WriteLine ("Result: " + myres.a + " " +
                   myres.b + " " + myres.c +  " " + res);

        if (myres.a != 2)
            return 4;

        if (myres.b != 3)
            return 5;

        if (myres.c != 5)
            return 6;

        if (res != 5)
            return 7;

        R1 o2 = new R1 ();

        lres = test_call (o2);

        lres = test_call (o);

        Console.WriteLine ("Result: " + lres);
        if (lres != 5)
            return 8;

        lres = test_call (o);

        o.test_field = 2;

        Console.WriteLine ("test_field: " + o.test_field);
        if (o.test_field != 2)
            return 9;

        RemoteDelegate1 d1 = new RemoteDelegate1 (o.Add);
        MyStruct myres2 = d1 (2, out res, 3);

        Console.WriteLine ("Result: " + myres2.a + " " +
                   myres2.b + " " + myres2.c +  " " + res);

        if (myres2.a != 2)
            return 10;

        if (myres2.b != 3)
            return 11;

        if (myres2.c != 5)
            return 12;

        if (res != 5)
            return 13;

        RemoteDelegate2 d2 = new RemoteDelegate2 (o.nonvirtual_Add);
        d2 (6, 7);

        if (!(real_proxy.GetTransparentProxy () is R2))
            return 14;

        return 0;
    }
コード例 #32
0
 static int Main()
 {
     R1
     myobj
     =
     new
     R1
     ();
     return
     myobj.ldfield_test
     ();
 }
コード例 #33
0
        private static void Drawings(EventArgs args)
        {
            if (Config.Item("disable.draws").GetValue <bool>())
            {
                return;
            }

            if (Config.Item("optimize").GetValue <bool>())
            {
                return;
            }

            if (Lux_E != null && Config.Item("draw.LuxE.position").GetValue <bool>())
            {
                var pos1 = Drawing.WorldToScreen(player.Position);
                var pos2 = Drawing.WorldToScreen(Lux_E.Position);


                Drawing.DrawLine(pos1, pos2, 1, System.Drawing.Color.LightBlue);
                Drawing.DrawCircle(Lux_E.Position, 100, System.Drawing.Color.Gray);

                foreach (var enemy in HeroManager.Enemies.Where(e => !e.IsDead))
                {
                    var pos3 = Drawing.WorldToScreen(enemy.Position);
                    if (enemy.Position.Distance(Lux_E.Position) < 200)
                    {
                        Drawing.DrawLine(pos2, pos3, 1, System.Drawing.Color.DarkRed);
                    }
                }
            }

            if (Config.Item("draw.Q").GetValue <Circle>().Active)
            {
                if (Q1.Level > 0)
                {
                    Render.Circle.DrawCircle(ObjectManager.Player.Position, Q1.Range,
                                             Q1.IsReady() ? Config.Item("draw.Q").GetValue <Circle>().Color : System.Drawing.Color.Red);
                }
            }

            if (Config.Item("draw.W").GetValue <Circle>().Active)
            {
                if (W1.Level > 0)
                {
                    Render.Circle.DrawCircle(ObjectManager.Player.Position, W1.Range,
                                             W1.IsReady() ? Config.Item("draw.W").GetValue <Circle>().Color : System.Drawing.Color.Red);
                }
            }

            if (Config.Item("draw.E").GetValue <Circle>().Active)
            {
                if (E1.Level > 0)
                {
                    Render.Circle.DrawCircle(ObjectManager.Player.Position, E1.Range - 1,
                                             E1.IsReady() ? Config.Item("draw.E").GetValue <Circle>().Color : System.Drawing.Color.Red);
                }
            }

            if (Config.Item("draw.R").GetValue <Circle>().Active)
            {
                if (R1.Level > 0)
                {
                    Render.Circle.DrawCircle(ObjectManager.Player.Position, R1.Range - 2,
                                             R1.IsReady() ? Config.Item("draw.R").GetValue <Circle>().Color : System.Drawing.Color.Red);
                }
            }
        }
コード例 #34
0
ファイル: Pivots.cs プロジェクト: fandres70/NinjaTrader.Base
        /// <summary>
        /// Called on each bar update event (incoming tick)
        /// </summary>
        protected override void OnBarUpdate()
        {
            if (Bars == null)
            {
                return;
            }
            if (!Bars.BarsType.IsIntraday && Bars.Period.Id != PeriodType.Day)
            {
                return;
            }
            if (Bars.Period.Id == PeriodType.Day && pivotRangeType == PivotRange.Daily)
            {
                return;
            }
            if (Bars.Period.Id == PeriodType.Day && Bars.Period.Value > 1)
            {
                return;
            }

            // pivots only work for
            // - intraday
            // - 1 day chart with PivotRange Weekly or Monthly

            if (!isDailyDataLoaded)
            {
                if (priorDayHLC == HLCCalculationMode.DailyBars && Bars.BarsType.IsIntraday)
                {
                    Enabled = false;
                    System.Threading.ThreadPool.QueueUserWorkItem(new System.Threading.WaitCallback(GetBarsNow));
                    return;
                }

                existsHistDailyData = false;
                isDailyDataLoaded   = true;
            }

            IBar dailyBar;

            if (existsHistDailyData)
            {
                sessionDateDaily = GetLastBarSessionDate(Time[0], Bars, PivotRange.Daily);
                dailyBar         = dailyBars.Get(dailyBars.GetBar(sessionDateDaily));

                if (dailyBar.Time.Date > sessionDateDaily.Date)
                {
                    for (DateTime i = sessionDateDaily; i >= dailyBars.GetTime(0); i = i.AddDays(-1))
                    {
                        dailyBar = dailyBars.Get(dailyBars.GetBar(i));
                        if (dailyBar.Time.Date == i.Date)
                        {
                            break;
                        }
                    }
                }
            }
            else
            {
                dailyBar = null;
            }

            double high  = existsHistDailyData ? dailyBar.High : High[0];
            double low   = existsHistDailyData ? dailyBar.Low : Low[0];
            double close = existsHistDailyData ? dailyBar.Close : Close[0];

            DateTime lastBarTimeStamp = GetLastBarSessionDate(Time[0], Bars, pivotRangeType);

            if ((currentDate != Cbi.Globals.MinDate && pivotRangeType == PivotRange.Daily && lastBarTimeStamp != currentDate) ||
                (currentWeek != Cbi.Globals.MinDate && pivotRangeType == PivotRange.Weekly && lastBarTimeStamp != currentWeek) ||
                (currentMonth != Cbi.Globals.MinDate && pivotRangeType == PivotRange.Monthly && lastBarTimeStamp != currentMonth))
            {
                pp           = (currentHigh + currentLow + currentClose) / 3;
                s1           = 2 * pp - currentHigh;
                r1           = 2 * pp - currentLow;
                s2           = pp - (currentHigh - currentLow);
                r2           = pp + (currentHigh - currentLow);
                s3           = pp - 2 * (currentHigh - currentLow);
                r3           = pp + 2 * (currentHigh - currentLow);
                currentClose = (priorDayHLC == HLCCalculationMode.UserDefinedValues) ? userDefinedClose : close;
                currentHigh  = (priorDayHLC == HLCCalculationMode.UserDefinedValues) ? userDefinedHigh : high;
                currentLow   = (priorDayHLC == HLCCalculationMode.UserDefinedValues) ? userDefinedLow : low;
            }
            else
            {
                currentClose = (priorDayHLC == HLCCalculationMode.UserDefinedValues) ? userDefinedClose : close;
                currentHigh  = (priorDayHLC == HLCCalculationMode.UserDefinedValues) ? userDefinedHigh : Math.Max(currentHigh, high);
                currentLow   = (priorDayHLC == HLCCalculationMode.UserDefinedValues) ? userDefinedLow : Math.Min(currentLow, low);
            }

            if (pivotRangeType == PivotRange.Daily)
            {
                currentDate = lastBarTimeStamp;
            }
            if (pivotRangeType == PivotRange.Weekly)
            {
                currentWeek = lastBarTimeStamp;
            }
            if (pivotRangeType == PivotRange.Monthly)
            {
                currentMonth = lastBarTimeStamp;
            }

            if ((pivotRangeType == PivotRange.Daily && currentDate != Cbi.Globals.MinDate) ||
                (pivotRangeType == PivotRange.Weekly && currentWeek != Cbi.Globals.MinDate) ||
                (pivotRangeType == PivotRange.Monthly && currentMonth != Cbi.Globals.MinDate))
            {
                PP.Set(pp);
                R1.Set(r1);
                S1.Set(s1);
                R2.Set(r2);
                S2.Set(s2);
                R3.Set(r3);
                S3.Set(s3);
            }
        }
コード例 #35
0
 static int Main()
 {
     R1
     myobj
     =
     new
     R1
     ();
     myobj.S.F
     =
     -1;
     if
     (myobj.S.F
     !=
     -1)
     return
     1;
     return
     myobj.ldfield_test
     ();
 }
コード例 #36
0
        public Form4(string DBID, string MYhost, string MYuser, string MYpass, string MYdbname)
        {
            InitializeComponent();

            // Datenbank Verbindungs Aufbau
            string connStr = @"SERVER=" + MYhost + ";" +
                             "DATABASE=" + MYdbname + ";" +
                             "UID=" + MYuser + ";" +
                             "PWD=" + MYpass + ";";

            MySqlConnection connSYS = new MySqlConnection(connStr);
            MySqlCommand    com     = connSYS.CreateCommand();

            com.CommandText = "SELECT * FROM `media` WHERE `dbid` LIKE \'" + DBID + "%\'";

            MySqlDataReader Reader;

            connSYS.Open();
            Reader = com.ExecuteReader();
            while (Reader.Read())
            {
                string m01 = "";
                string m02 = "";
                string m03 = "";
                string m04 = "";
                string m05 = "";
                string m06 = "";
                string m07 = "";
                string m08 = "";
                string m09 = "";
                string m10 = "";
                string m11 = "";
                string m12 = "";
                string m13 = "";
                string m14 = "";

                m01 += Reader.GetValue(0).ToString();   //<<DB ID
                m02 += Reader.GetValue(1).ToString();   //<<Inhaber ID
                m03 += Reader.GetValue(2).ToString();   //<<Inhaber
                m04 += Reader.GetValue(3).ToString();   //<<Name
                m05 += Reader.GetValue(4).ToString();   //<<Band
                m06 += Reader.GetValue(5).ToString();   //<<Doppel Bannd
                m07 += Reader.GetValue(6).ToString();   //<<ISBN 10
                m08 += Reader.GetValue(7).ToString();   //<<ISBN 13
                m09 += Reader.GetValue(8).ToString();   //<<Preis
                m10 += Reader.GetValue(9).ToString();   //<<Typ
                m11 += Reader.GetValue(10).ToString();  //<<Verlag
                m12 += Reader.GetValue(11).ToString();  //<<BildURL
                m13 += Reader.GetValue(12).ToString();  //<<Standort
                m14 += Reader.GetValue(13).ToString();  //<<Zusand

                label2.Text  = m01;
                label3.Text  = m02;
                label5.Text  = m03;
                label8.Text  = m04;
                label10.Text = m05 + " (Doppelband?: " + m06 + ")";
                label12.Text = m07;
                label14.Text = m08;
                label16.Text = m09;
                label18.Text = m10;
                label20.Text = m11;
                //Abfrage bei Keine Bilder --> Shere Untenb
                label22.Text = m13;
                label23.Text = m14;

                if (m12 == "")
                {
                    pictureBox1.Load("https://arisatheotaku.files.wordpress.com/2012/04/lesen.jpg");
                }
                else
                {
                    pictureBox1.Load(m12);
                }
            }
            connSYS.Close();

            string connStr2 = @"SERVER=" + MYhost + ";" +
                              "DATABASE=" + MYdbname + ";" +
                              "UID=" + MYuser + ";" +
                              "PWD=" + MYpass + ";";

            MySqlConnection connSYS2 = new MySqlConnection(connStr2);
            MySqlCommand    com2     = connSYS2.CreateCommand();

            com2.CommandText = "SELECT `username`,`email` FROM `user` WHERE `username` LIKE \'" + label5.Text + "%\'";

            MySqlDataReader R1;

            connSYS2.Open();
            R1 = com2.ExecuteReader();
            while (R1.Read())
            {
                string u1 = "";
                string u2 = "";

                u1 += R1.GetValue(0).ToString();
                u2 += R1.GetValue(1).ToString();

                label26.Text = u2;
            }


            //zusand
            if (label23.Text == "Seher Gut")
            {
                progressBar1.Value = 100;
            }
            if (label23.Text == "Gut")
            {
                progressBar1.Value = 75;
            }
            if (label23.Text == "Mittel")
            {
                progressBar1.Value = 50;
            }
            if (label23.Text == "Schelcht")
            {
                progressBar1.Value = 25;
            }
            if (label23.Text == "Seher Schlecht")
            {
                progressBar1.Value = 0;
            }

            //PlugIn Tool
            if (label18.Text == "Anime")
            {
                linkLabel1.Text = "weiter infos zur Anime";
            }
            else
            {
                linkLabel1.Text = "";
            }
        }
コード例 #37
0
ファイル: remoting1.cs プロジェクト: Zman0169/mono
	static long test_call (R1 o)
	{
		return o.nonvirtual_Add (2, 3);
	}
コード例 #38
0
ファイル: CPU.cs プロジェクト: liusj666/AxNew
        public VAL Run(int breakPoint)
        {
L1:

            Instruction I = CS[IP];
            Operand operand = I.operand;

            position.line  = I.line;
            position.col   = I.col;
            position.cur   = I.cur;
            position.block = I.block;

            if (I.line == breakPoint)
            {
                return(null);
            }

            switch (I.cmd)
            {
                //----------------------------------------------------------------------------

                #region  MOV, STO,STO1, RMT. RCP

            case INSTYPE.MOV:
                if (operand.ty == OPRTYPE.identcon)         // MOV [v]
                {
                    if (CS[IP + 1].cmd == INSTYPE.OFS)      // if this is offset of a struct, keep variable name
                    {
                        REG.Push(new VAL(operand));
                    }
                    else
                    {
                        REG.Push(GetVAL(operand.Str, false));
                    }
                }
                else if (operand.ty == OPRTYPE.addrcon)         // MOV [BP-3]
                {
                    //VAL opr = Register.BPAddr(BP, operand);

                    VAL opr = new VAL();
                    opr.ty    = VALTYPE.addrcon;
                    opr.value = BP + operand.Addr;
                    opr.name  = operand.name;

                    REG.Push(opr);
                }
                else
                {
                    VAL x = new VAL(operand);
                    if (operand.ty == OPRTYPE.funccon)
                    {
                        if (ES.SP > -1)
                        {
                            x.temp = new ContextInstance(this.context, ES.Top());
                        }
                        else
                        {
                            x.temp = new ContextInstance(this.context, new VAL());
                        }
                    }

                    REG.Push(VAL.Clone(x));     // MOV 3
                }
                break;



            //----------------------------------------------------------------------------


            case INSTYPE.STO1:
            case INSTYPE.STO:
                R0 = REG.Pop();
                R1 = REG.pop();
                if (R1.ty == VALTYPE.addrcon)
                {
                    SS[R1.Address] = R0;
                }
                else
                {
                    HostOperation.Assign(R1, R0);
                }

                if (I.cmd == INSTYPE.STO)
                {
                    REG.Push(R1);
                }
                break;

            case INSTYPE.RMT:
                if (CS[IP + 1].cmd != INSTYPE.HALT)      //used for expression decoding,keep last value
                {
                    REG.Pop();
                }
                break;

            case INSTYPE.RCP:
                REG.Push(VAL.Clone(REG.Top()));
                break;

                #endregion


                //----------------------------------------------------------------------------

                #region PUSH/POP/SP/ESI/ESO
            case INSTYPE.ESI:
                R0 = REG.Pop();
                ES.Push(R0);
                break;

            case INSTYPE.ESO:
                ES.Pop();
                break;

            case INSTYPE.PUSH:
                if (operand != null && operand.ty == OPRTYPE.regcon)
                {
                    switch (operand.SEG)
                    {
                    case SEGREG.BP: SS.Push(new VAL(BP)); break;

                    case SEGREG.SP: SS.Push(new VAL(SS.SP)); break;

                    case SEGREG.SI: SS.Push(new VAL(SI)); break;

                    case SEGREG.IP: SS.Push(new VAL(IP + 2)); break;

                    case SEGREG.EX: EX.Push((int)operand.value); break;
                    }
                }
                else
                {
                    R0 = REG.Pop();
                    SS.Push(R0);
                }
                break;

            case INSTYPE.POP:
                if (operand.ty == OPRTYPE.regcon)
                {
                    switch (operand.SEG)
                    {
                    case SEGREG.BP: BP = (SS.Pop()).Address; break;

                    case SEGREG.SI: SI = (SS.Pop()).Address; break;

                    case SEGREG.SP: SS.SP = (SS.Pop()).Address; break;

                    case SEGREG.EX: EX.Pop(); break;
                    }
                }
                else
                {
                    R0 = SS.Pop();
                    REG.Push(R0);
                }
                break;

            case INSTYPE.SP:
                SS.SP += operand.Addr;
                break;

                #endregion


                //----------------------------------------------------------------------------

                #region OFS, ARR
            //----------------------------------------------------------------------------
            // Associative List
            // Mike={{"street", "3620 Street"},{"zip", 20201},{"phone","111-222-333},{"apt",1111}}
            // Mike.street = "3620 Street";
            // Mike.zip = 40802;
            case INSTYPE.OFS:
                R0 = REG.Pop();
                R1 = REG.pop();
                {
                    VAL v = new VAL();
                    switch (R1.ty)
                    {
                    case VALTYPE.hostcon:
                        v = R1.getter(R0, true, OffsetType.STRUCT);
                        goto LOFS;

                    case VALTYPE.addrcon:
                        v = SS[R1.Address];
                        if (v.Undefined || v.IsNull)
                        {
                            v.ty    = VALTYPE.listcon;
                            v.value = new VALL();
                        }
                        break;

                    case VALTYPE.listcon:
                        v = R1;
                        break;

                    default:           // if assoicative arrary is empty or not list
                        R1.ty    = VALTYPE.listcon;
                        R1.value = new VALL();
                        v        = R1;
                        break;
                    }

                    switch (v.ty)
                    {
                    case VALTYPE.listcon:
                        VALL L = v.List;
                        v = L[R0.Str];

                        // if property is not found in the associative array
                        if (!v.Defined)
                        {
                            L[R0.Str] = v;
                        }

                        break;

                    case VALTYPE.hostcon:
                        //VAL.Assign(v, VAL.HostTypeOffset(v.value, R0.value));
                        v = HostOperation.HostTypeOffset(v, R0, OffsetType.STRUCT);
                        break;
                    }

LOFS:
                    if ((object)v == null)
                    {
                        v = new VAL();
                    }

                    v.name = R1.name + "." + R0.name;
                    REG.Push(v);
                }
                break;

            case INSTYPE.ARR:
                R0 = REG.Pop();
                R1 = REG.pop();
                {
                    VAL v = new VAL();
                    switch (R1.ty)
                    {
                    case VALTYPE.addrcon:
                        v = SS[R1.Address];           //indirect addressing
                        if (v.Undefined || v.IsNull)
                        {
                            v.ty    = VALTYPE.listcon;
                            v.value = new VALL();
                            v       = v.getter(R0, true, OffsetType.ARRAY);
                        }
                        else
                        {
                            v = v.getter(R0, true, OffsetType.ARRAY);
                        }
                        break;

                    case VALTYPE.listcon:                       //push reference
                        v = R1.getter(R0, true, OffsetType.ARRAY);
                        break;

                    case VALTYPE.hostcon:
                        v = R1.getter(R0, true, OffsetType.ARRAY);
                        if (!v.Defined)
                        {
                            throw new RuntimeException(position, "{0} does not have property {1}.", R1, R0);
                        }
                        break;

                    default:
                        //refer: public VAL this[VAL arr], when R1 == null, dynamically allocate a list
                        R1.ty    = VALTYPE.listcon;
                        R1.value = new VALL();
                        v        = R1.getter(R0, true, OffsetType.ARRAY);

                        //JError.OnRuntime(0);
                        break;
                    }

                    v.name = R1.name + "[" + R0.ToString() + "]";
                    REG.Push(v);
                }
                break;

                #endregion


                //----------------------------------------------------------------------------

                #region  CALL, NEW, ENDP, RET, GNRC
            case  INSTYPE.GNRC:
                R0 = REG.Pop();         // R0 = new Type[] { string, int }
                R1 = REG.Pop();         // R1 = System.Collection.Generic
                {
                    Operand opr = I.operand;
                    VAL     R2  = R1[opr.Str];    // I.val.Str == Dictionary`2
                    if (R2.Undefined)             // Type is not registered
                    {
                        object t = HostType.GetType(R1.name + "." + opr.Str);
                        if (t != null)
                        {
                            R2 = VAL.NewHostType(t);
                        }
                        else
                        {
                            throw new RuntimeException(position, "Type {0}.{1} is not registered.", R1.name, opr.Str);
                        }
                    }

                    object A = R0.HostValue;
                    if (A is object[] && ((object[])A).Length == 0)         //case: typeof(Dictionary<,>)
                    {
                        if (R2.value is Type)
                        {
                            REG.Push(VAL.NewHostType(R2.value));
                        }
                        else
                        {
                            throw new RuntimeException(position, "{0} is not System.Type.", R1);
                        }
                    }
                    else
                    {
                        if (!(A is Type[]))
                        {
                            throw new RuntimeException(position, "<{0}> is not System.Type[].", R0.ToString2());
                        }

                        if (R2.value is Type)
                        {
                            Type t = (Type)R2.value;
                            REG.Push(VAL.NewHostType(t.MakeGenericType((Type[])A)));
                        }
                        else if (R2.value is MethodInfo)
                        {
                            MethodInfo t = (MethodInfo)R2.value;
                            VAL        m = VAL.NewHostType(t.MakeGenericMethod((Type[])A));
                            m.temp = R2.temp;
                            REG.Push(m);
                        }
                        else if (R2.value is MethodInfo[])
                        {
                            MethodInfo[] T = (MethodInfo[])R2.value;
                            for (int i = 0; i < T.Length; i++)
                            {
                                T[i] = T[i].MakeGenericMethod((Type[])A);
                            }
                            VAL m = VAL.NewHostType(T);
                            m.temp = R2.temp;
                            REG.Push(m);
                        }
                        else
                        {
                            throw new RuntimeException(position, "{0} is not System.Type.", R1);
                        }
                    }
                }

                break;

            case INSTYPE.CALL:
                if (operand.ty == OPRTYPE.intcon)
                {
                    IP = operand.Addr;
                }
                else if (operand.ty == OPRTYPE.addrcon)      // high-level programming
                {
                    SysFuncCallByAddr(SS[operand.Addr + BP]);
                }
                else if (operand.ty == OPRTYPE.regcon)
                {
                    SysFuncCallByAddr(SS[operand.Addr + SS.SP]);
                }
                else if (operand.ty == OPRTYPE.none)       //used for Generic method
                {
                    if (ES.IsEmpty())
                    {
                        R0 = REG.Pop();
                    }
                    else
                    {
                        R0 = ES.Top();
                    }

                    SysFuncCallByName(R0);
                }
                else
                {
                    SysFuncCallByName(new VAL(operand));
                }
                goto L1;

            case INSTYPE.NEW:
                if (operand.ty == OPRTYPE.funccon)
                {
                    NewInstance(new VAL(operand));         //system predifined class & user-defined class
                }
                else if (operand.ty == OPRTYPE.none)       //used for Generic class
                {
                    if (ES.IsEmpty())
                    {
                        R0 = REG.Pop();
                    }
                    else
                    {
                        R0 = ES.Top();
                    }

                    NewInstance(R0);
                }
                else if (operand.ty == OPRTYPE.intcon)
                {
                    int opr = (int)operand.value;
                    if (opr > 1)
                    {
                        R0 = REG.Pop();
                        R1 = REG.Pop();
                    }
                    else
                    {
                        R1 = REG.Pop();
                    }

                    if (R1.value is Type)
                    {
                        Type ty = (Type)R1.value;

                        if (opr == 1)
                        {
                            if (ty.IsArray)
                            {
                                R0 = VAL.Array();
                            }
                            else
                            {
                                R0 = new VAL();
                            }
                        }

                        if (R0.ty == VALTYPE.listcon)
                        {
                            if (ty.IsArray)
                            {
                                R0.List.ty = ty;
                            }
                            else
                            {
                                throw new RuntimeException(position, "new object failed. {0} is not Array Type", R1);
                            }
                        }

                        R0.Class = ty.FullName;
                        REG.Push(R0);
                    }
                    else
                    {
                        throw new RuntimeException(position, "new object failed. {0} is not System.Type", R1);
                    }

                    IP++;
                }

                goto L1;

            case INSTYPE.ENDP:
                if ((OPRTYPE)operand.Intcon == OPRTYPE.classcon)
                {
                    REG.Push(ES.Top());                 //return this;
                }
                else
                {
                    REG.Push(VAL.VOID);        //return void;
                }
                SS.SP = BP;                    //PUSH BP; POP SP;
                BP    = (SS.Pop()).Address;    //POP BP;

                R0 = SS.Top();                 //EXEC RET
                IP = R0.Address;
                goto L1;

            case INSTYPE.RET:
                if (!SS.IsEmpty())
                {
                    R0 = SS.Top();
                    IP = R0.Address;                        //goto V.i
                }
                else
                {
                    if (REG.IsEmpty())
                    {
                        return(VAL.VOID);
                    }
                    else
                    {
                        return(REG.Top());
                    }
                }

                goto L1;

                #endregion


                //----------------------------------------------------------------------------

                #region  +,-,*,/,%,>,<,!=,==,<=,>=, ++, --
            //----------------------------------------------------------------------------
            case INSTYPE.NEG:
                R0 = REG.Pop();
                if (operand.Intcon == -1)
                {
                    R0 = -R0;       //call VAL.operator -(VAL)
                }
                else
                {
                    R0 = +R0;       //call VAL.operator +(VAL)
                }
                REG.Push(R0);
                break;

            case INSTYPE.ADD: R0 = REG.Pop(); R1 = REG.Pop(); R1 += R0; REG.Push(R1); break;

            case INSTYPE.SUB: R0 = REG.Pop(); R1 = REG.Pop(); R1 -= R0; REG.Push(R1); break;

            case INSTYPE.MUL: R0 = REG.Pop(); R1 = REG.Pop(); R1 *= R0; REG.Push(R1); break;

            case INSTYPE.DIV: R0 = REG.Pop(); R1 = REG.Pop(); R1 /= R0; REG.Push(R1); break;

            case INSTYPE.MOD: R0 = REG.Pop(); R1 = REG.Pop(); R1 %= R0; REG.Push(R1); break;

            case INSTYPE.GTR: R0 = REG.Pop(); R1 = REG.Pop(); REG.Push(new VAL(R1 > R0)); break;

            case INSTYPE.LSS: R0 = REG.Pop(); R1 = REG.Pop(); REG.Push(new VAL(R1 < R0)); break;

            case INSTYPE.GEQ: R0 = REG.Pop(); R1 = REG.Pop(); REG.Push(new VAL(R1 >= R0)); break;

            case INSTYPE.LEQ: R0 = REG.Pop(); R1 = REG.Pop(); REG.Push(new VAL(R1 <= R0)); break;

            case INSTYPE.EQL: R0 = REG.Pop(); R1 = REG.Pop(); REG.Push(new VAL(R1 == R0)); break;

            case INSTYPE.NEQ: R0 = REG.Pop(); R1 = REG.Pop(); REG.Push(new VAL(R1 != R0)); break;

            case INSTYPE.INC:
                R0 = REG.pop();
                R1 = VAL.Clone(R0);
                if (R0.ty == VALTYPE.addrcon)
                {
                    SS[R0.Address] += new VAL(1);
                }
                else     //global varible
                {
                    HostOperation.Assign(R0, R0 + new VAL(1));
                }
                REG.Push(R1);
                break;

            case INSTYPE.DEC:
                R0 = REG.pop();
                R1 = VAL.Clone(R0);
                if (R0.ty == VALTYPE.addrcon)
                {
                    SS[R0.Address] -= new VAL(1);
                }
                else     //global varible
                {
                    HostOperation.Assign(R0, R0 - new VAL(1));
                }
                REG.Push(R1);
                break;

                #endregion


                //----------------------------------------------------------------------------

                #region MARK, END, EACH, CAS, DIRC

            case INSTYPE.MARK: REG.Push(Mark); break;

            case INSTYPE.END:
            {
                VAL L = new VAL(new VALL());
                while (REG.Top() != Mark)
                {
                    L.List.Insert(REG.Pop());
                }
                REG.Pop();                      // pop mark
                REG.Push(L);
            } break;

            case INSTYPE.EACH:
                R0 = REG.Pop();             //Collection
                R1 = REG.pop();             //address of element [BP+addr]
                REG.Push(ForEach(R0, SS[R1.Intcon], SS[R1.Intcon + 1]));
                break;

            case INSTYPE.CAS:
                R0 = REG.Pop(); R1 = REG.Top();
                if (R1 == R0)
                {
                    REG.Pop(); IP = operand.Addr; goto L1;
                }                                                            //goto V.i
                break;

            case INSTYPE.DIRC:          //directive command
                switch (operand.mod)
                {
                case Constant.SCOPE:
                    this.scope = (string)operand.value;
                    break;
                }
                break;

                #endregion


                //----------------------------------------------------------------------------

                #region &&, ||, ~, &, |, >>, <<
            //----------------------------------------------------------------------------
            case INSTYPE.NOTNOT:
                R0 = REG.Pop();
                if (R0.ty == VALTYPE.stringcon)
                {
                    REG.Push(Computer.Run(scope, R0.Str, CodeType.statements, context));
                }
                else
                {
                    REG.Push(new VAL(!R0));         //call VAL.operator !(VAL)
                }
                break;

            case INSTYPE.ANDAND: R0 = REG.pop(); R1 = REG.Pop();
                REG.Push(new VAL(R0.ty == VALTYPE.boolcon && R1.ty == VALTYPE.boolcon? R0.Boolcon && R1.Boolcon: false));
                break;

            case INSTYPE.OROR: R0 = REG.pop(); R1 = REG.Pop();
                REG.Push(new VAL(R0.ty == VALTYPE.boolcon && R1.ty == VALTYPE.boolcon ? R0.Boolcon || R1.Boolcon : false));
                break;


            //----------------------------------------------------------------------------
            case INSTYPE.NOT: R0 = REG.Pop();
                REG.Push(~R0);      //call VAL.operator ~(VAL)
                break;

            case INSTYPE.AND: R0 = REG.pop(); R1 = REG.Pop();
                REG.Push(R1 & R0);
                break;

            case INSTYPE.OR: R0 = REG.pop(); R1 = REG.Pop();
                REG.Push(R1 | R0);
                break;

            case INSTYPE.XOR: R0 = REG.pop(); R1 = REG.Pop();
                REG.Push(R1 ^ R0);
                break;

            //----------------------------------------------------------------------------
            case INSTYPE.SHL: R0 = REG.pop(); R1 = REG.Pop();
                if (!(R0.value is int))
                {
                    throw new RuntimeException(position, "the 2nd operand {0} in << operation must be integer", R0);
                }
                REG.Push(R1 << (int)R0.value);
                break;

            case INSTYPE.SHR: R0 = REG.pop(); R1 = REG.Pop();
                if (!(R0.value is int))
                {
                    throw new RuntimeException(position, "the 2nd operand {0} in >> operation must be integer", R0);
                }
                REG.Push(R1 >> (int)R0.value);
                break;
                #endregion


                //----------------------------------------------------------------------------

                #region JUMP, ADR, VLU

            case INSTYPE.JMP: IP = operand.Addr; goto L1;

            case INSTYPE.LJMP: IP += operand.Addr; goto L1;

            case INSTYPE.JNZ:
                if (REG.Pop() == new VAL(true))
                {
                    IP = operand.Addr; goto L1;
                }
                else
                {
                    break;
                }

            case INSTYPE.JZ:
                if (REG.Pop() != new VAL(true))
                {
                    IP = operand.Addr; goto L1;
                }
                else
                {
                    break;
                }

            case INSTYPE.LJZ:
                if (REG.Pop() != new VAL(true))
                {
                    IP += operand.Addr; goto L1;
                }
                else
                {
                    break;
                }

            case INSTYPE.ADR:
                R0 = REG.Pop();
                REG.Push(new VAL(R0.name));
                break;

            case INSTYPE.VLU:
                R0 = REG.Pop();
                if (R0.ty == VALTYPE.stringcon)
                {
                    REG.Push(Computer.Run(scope, R0.Str, CodeType.expression, context));
                }
                else
                {
                    throw new RuntimeException(position, "Invalid address type:" + R0.ToString());
                }
                break;

                #endregion


                //----------------------------------------------------------------------------


                #region  THIS,BASE
            case INSTYPE.THIS:                                           //this.x
                if (ES.SP > -1)
                {
                    if (this.scope != "")
                    {
                        VAL NS = GetScopeVAL(this.scope);
                        if (NS != ES.Top())
                        {
                            REG.Push(NS);
                        }
                    }
                    else
                    {
                        REG.Push(ES.Top());
                    }
                }
                else if (this.scope != "")
                {
                    if (operand.ty == OPRTYPE.intcon)                         //this.x=100;
                    {
                        REG.Push(GetScopeVAL(this.scope));
                    }
                    else
                    {
                        REG.Push(new VAL(this.scope));             //p=&this.x;
                    }
                }
                else
                {
                    if (CS[IP + 2].cmd == INSTYPE.OFS)
                    {
                        CS[IP + 2].cmd = INSTYPE.NOP;
                    }
                    else
                    {
                        throw new RuntimeException(position, "Operator[this] is invalid since namespace is empty.");
                    }
                }
                break;

            case INSTYPE.BASE:           //base.x
                //if (ES.SP > -1)
                //{
                //    VAL BS = ES.Top()[JExpression.BASE_INSTANCE];
                //    if((object)BS!=null)
                //        REG.Push(BS);
                //    else
                //        throw new RuntimeException(string.Format("Operator[base] is invalid since class {0} does not have base class.",ES.Top()));
                //}
                if (this.scope != "")
                {
                    string bv = "";
                    int    n  = 1;
                    if (operand.ty == OPRTYPE.intcon)          //base.base.x=10;
                    {
                        n = operand.Intcon;

                        bv = GetBaseScope(this.scope, n);

                        if (bv != "")
                        {
                            REG.Push(GetScopeVAL(bv));
                        }
                        else
                        {
                            if (CS[IP + 2].cmd == INSTYPE.OFS)
                            {
                                CS[IP + 2].cmd = INSTYPE.NOP;
                            }
                        }
                    }
                    else
                    {
                        n  = operand.Addr;                 // p = &base.base.x;
                        bv = GetBaseScope(this.scope, n);
                        REG.Push(new VAL(bv));
                    }
                }
                else
                {
                    throw new RuntimeException(position, "Operator[base] is invalid since scope is root.");
                }
                break;

                #endregion


                //----------------------------------------------------------------------------

                #region THRW, DDT, HALT

            case INSTYPE.THRW:
                R0 = REG.Top();
                if (!(R0.HostValue is Exception))
                {
                    throw new RuntimeException(position, "{0} is not type of System.Exception.", R0.HostValue);
                }

                if (EX.IsEmpty())
                {
                    throw (Exception)R0.HostValue;
                }
                IP = EX.Pop();

                if (IP == -1)
                {
                    throw (Exception)R0.HostValue;
                }
                break;

            case INSTYPE.DDT:
                Logger.WriteLine(DebugInfo());
                break;

            case INSTYPE.HALT:
                if (REG.IsEmpty())
                {
                    return(VAL.VOID);
                }
                else
                {
                    return(REG.Top());
                }

                #endregion
            }

            IP++;
            goto L1;
        }
コード例 #39
0
ファイル: remoting5.cs プロジェクト: Zman0169/mono
	static int Main () {
		R1 myobj = new R1 ();

		// Test ldflda on MarshalByRefObjects
		myobj.S.F = -1;
		if (myobj.S.F != -1)
			return 1;

		return myobj.ldfield_test ();
	}
コード例 #40
0
        // Example:
        //
        //    0:009> r
        //     r0=00000000  r1=00000000  r2=00000000  r3=76fdcf09  r4=00000000  r5=028df6e0
        //     r6=028df730  r7=00000000  r8=00000001  r9=01507858 r10=015156a8 r11=028df8e8
        //    r12=00000000  sp=028df6c8  lr=00000000  pc=76ccce24 psr=600f0030 -ZC-- Thumb
        //    KERNELBASE!RaiseFailFastException+0x60:
        //    76ccce24 f000f846 bl          KERNELBASE!SignalStartWerSvc (76ccceb4)
        //
        public override ColorString ToColorString()
        {
            if (null == m_colorString)
            {
                ConsoleColor color;
                ColorString  cs = new ColorString(" r0=");
                color = GetColorForDiffAgainstBaseline("r0");
                cs.Append(R0.GetColorizedValueString(color));
                cs.Append("  r1=");
                color = GetColorForDiffAgainstBaseline("r1");
                cs.Append(R1.GetColorizedValueString(color));
                cs.Append("  r2=");
                color = GetColorForDiffAgainstBaseline("r2");
                cs.Append(R2.GetColorizedValueString(color));
                cs.Append("  r3=");
                color = GetColorForDiffAgainstBaseline("r3");
                cs.Append(R3.GetColorizedValueString(color));
                cs.Append("  r4=");
                color = GetColorForDiffAgainstBaseline("r4");
                cs.Append(R4.GetColorizedValueString(color));
                cs.Append("  r5=");
                color = GetColorForDiffAgainstBaseline("r5");
                cs.Append(R5.GetColorizedValueString(color));
                cs.AppendLine();

                cs.Append(" r6=");
                color = GetColorForDiffAgainstBaseline("r6");
                cs.Append(R6.GetColorizedValueString(color));
                cs.Append("  r7=");
                color = GetColorForDiffAgainstBaseline("r7");
                cs.Append(R7.GetColorizedValueString(color));
                cs.Append("  r8=");
                color = GetColorForDiffAgainstBaseline("r8");
                cs.Append(R8.GetColorizedValueString(color));
                cs.Append("  r9=");
                color = GetColorForDiffAgainstBaseline("r9");
                cs.Append(R9.GetColorizedValueString(color));
                cs.Append(" r10=");
                color = GetColorForDiffAgainstBaseline("r10");
                cs.Append(R10.GetColorizedValueString(color));
                cs.Append(" r11=");
                color = GetColorForDiffAgainstBaseline("r11");
                cs.Append(R11.GetColorizedValueString(color));
                cs.AppendLine();

                cs.Append("r12=");
                color = GetColorForDiffAgainstBaseline("r12");
                cs.Append(R12.GetColorizedValueString(color));
                cs.Append("  sp=");
                color = GetColorForDiffAgainstBaseline("sp");
                cs.Append(Sp.GetColorizedValueString(color));
                cs.Append("  lr=");
                color = GetColorForDiffAgainstBaseline("lr");
                cs.Append(Lr.GetColorizedValueString(color));
                cs.Append("  pc=");
                color = GetColorForDiffAgainstBaseline("pc");
                cs.Append(Pc.GetColorizedValueString(color));
                cs.Append(" psr=");
                color = GetColorForDiffAgainstBaseline("psr");
                cs.Append(Psr.GetColorizedValueString(color));

                // TODO:
                cs.AppendLine(" TBD: flags and mode");

                cs.Append(DbgProvider.ColorizeSymbol(StackFrame.SymbolName));
                if (0 != StackFrame.Displacement)
                {
                    cs.Append("+0x");
                    cs.Append(StackFrame.Displacement.ToString("x"));
                }
                cs.AppendLine(":");
                cs.Append(Disasm(Pc.ValueAsPointer));

                m_colorString = cs;
            }
            return(m_colorString);
        } // end ToString()