Exemplo n.º 1
0
 public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value)
 {
     if (value is TimeSpan)
     {
         TimeSpan span = (TimeSpan)value;
         if (span == TimeSpan.MinValue)
         {
             return(TimeSec.MinValue);
         }
         if (span == TimeSpan.MaxValue)
         {
             return(TimeSec.MaxValue);
         }
         if (span == TimeSpan.Zero)
         {
             return(TimeSec.Zero);
         }
         return(new TimeSec((TimeSpan)value));
     }
     if (value is string)
     {
         return(TimeSec.Parse((string)value));
     }
     if (value is int)
     {
         int num1 = (int)value;
         return(new TimeSec((double)((int)value)));
     }
     return(base.ConvertFrom(context, culture, value));
 }
Exemplo n.º 2
0
    void ClearTimesStringSetup(float thatClearTime, Text ClearTime)
    {
        float TimeMin;
        float TimeSec;

        TimeSec = thatClearTime % 60;
        TimeMin = thatClearTime - TimeSec;
        TimeMin = (TimeMin / 60);
        string timeString = (TimeMin.ToString() + "min " + TimeSec.ToString() + "sec");

        ClearTime.text = timeString;
    }
Exemplo n.º 3
0
        /// <summary>
        /// from a TimeSec, transform it to a string
        /// </summary>
        /// <param name="timeSec"></param>
        /// <returns></returns>
        public static string GetTimeInStringFromTimeSec(TimeSec timeSec)
        {
            StringBuilder timeInText = new StringBuilder();

            if (timeSec.Seconds == -1)
            {
                return(timeInText.ToString());
            }

            if (timeSec.Minutes < 10)
            {
                timeInText.Append("0");
            }
            timeInText.Append(timeSec.Minutes);

            timeInText.Append(" ' ");

            if (timeSec.Seconds < 10)
            {
                timeInText.Append("0");
            }
            timeInText.Append(timeSec.Seconds);

            timeInText.Append(" '' ");

            timeSec.Miliseconds = (int)timeSec.Miliseconds;
            if (timeSec.Miliseconds < 10)
            {
                timeInText.Append("0");
            }

            if (timeSec.Miliseconds >= 100)
            {
                timeSec.Miliseconds = 99;
            }

            timeInText.Append(timeSec.Miliseconds);
            return(timeInText.ToString());
        }
Exemplo n.º 4
0
        private void Calculate()
        {
            bool   FlagV   = false; // this and corr2k used for pre-2001 values of the four corrections that changed in 2001
            bool   FlagD   = false;
            double corr2kv = 0d;
            double corr2kd = 0d;

            txtvcorrx.Visible = false;
            txtdcorrx.Visible = false;
            txtvcorrx.Clear();
            txtdcorrx.Clear();
            if (optSunPlanets.Checked == false & optAries.Checked == false & optMoon.Checked == false & (optFwd.Checked == true & (!string.IsNullOrEmpty(txtUTm.Text) | !string.IsNullOrEmpty(txtUTs.Text) | !string.IsNullOrEmpty(txtv.Text)) | optBack.Checked == true & (!string.IsNullOrEmpty(txtDeg.Text) | !string.IsNullOrEmpty(txtMin.Text))))
            {
                ErrorMsgBox("You must select an object.");
                return;
            }

            if (optSunPlanets.Checked == true)
            {
                // k = 15
                k = CommonGlobals.g_SunPlanetsHrDeg;
            }

            if (optAries.Checked == true)
            {
                k = CommonGlobals.g_AriesHrDeg;
                // k = 15.04106864 ' same as value used in SRF FormSRF code
                // k = 15 + (36000 / 36535) / 24            '=15.0410677618... but this works
            }

            if (optMoon.Checked == true)
            {
                k = CommonGlobals.g_MoonHrDeg;
                // k = 14 + 19 / 60
            }

            if (optFwd.Checked == true) // optFwd is the UTC to GHA I&C conversion
            {
                // UTHrs  = (UTMin + UTSec/60)/60
                // GHA Incr = Body 1 hr Degrees Factor(k) * UTHrs
                GHAIncrement = k * (Conversion.Val(txtUTm.Text) + Conversion.Val(txtUTs.Text) / 60d) / 60d;
                // Corr factor = Daily page factor * (UTMin + 0.5) / 60
                vcorr = Conversion.Val(txtv.Text) * (Conversion.Val(txtUTm.Text) + 0.5d) / 60d;
                dcorr = Conversion.Val(txtd.Text) * (Conversion.Val(txtUTm.Text) + 0.5d) / 60d;
                // Arcane rounding of vcorr and dcorr to make certain they match almanac values
                vcorr           = Conversion.Int(vcorr * 10d + 0.50000000000001d) / 10d;
                dcorr           = Conversion.Int(dcorr * 10d + 0.50000000000001d) / 10d;
                GHAIncrementDeg = (short)Conversion.Int(GHAIncrement);
                GHAIncrementMin = (GHAIncrement - GHAIncrementDeg) * 60d;
                GHAIncrementMin = Conversion.Int(GHAIncrementMin * 10d + 0.500000000001d) / 10d;
                if (Conversion.Val(txtUTm.Text) == 22d & Conversion.Val(txtv.Text) == 2.8d)
                {
                    vcorr   = 1.0d;
                    corr2kv = 1.1d;
                    FlagV   = true;
                }

                if (Conversion.Val(txtUTm.Text) == 22d & Conversion.Val(txtv.Text) == 16.4d)
                {
                    vcorr   = 6.1d;
                    corr2kv = 6.2d;
                    FlagV   = true;
                }

                if (Conversion.Val(txtUTm.Text) == 42d & Conversion.Val(txtv.Text) == 15.6d)
                {
                    vcorr = 11.1d;
                }

                if (Conversion.Val(txtUTm.Text) == 52d & Conversion.Val(txtv.Text) == 13.2d)
                {
                    vcorr = 11.6d;
                }

                if (Conversion.Val(txtUTm.Text) == 52d & Conversion.Val(txtv.Text) == 17.2d)
                {
                    vcorr = 15.1d;
                }

                if (Conversion.Val(txtUTm.Text) == 55d & Conversion.Val(txtv.Text) == 18d)
                {
                    vcorr = 16.7d;
                }

                if (Conversion.Val(txtUTm.Text) == 57d & Conversion.Val(txtv.Text) == 13.2d)
                {
                    vcorr = 12.7d;
                }

                if (Conversion.Val(txtUTm.Text) == 52d & Conversion.Val(txtv.Text) == 9.2d)
                {
                    corr2kv = 8.1d;
                    FlagV   = true;
                }

                if (Conversion.Val(txtUTm.Text) == 52d & Conversion.Val(txtv.Text) == 16.4d)
                {
                    corr2kv = 14.4d;
                    FlagV   = true;
                }

                if (Conversion.Val(txtUTm.Text) == 22d & Conversion.Val(txtd.Text) == 16.4d)
                {
                    dcorr   = 6.1d;
                    corr2kd = 6.2d;
                    FlagD   = true;
                }

                if (Conversion.Val(txtUTm.Text) == 42d & Conversion.Val(txtd.Text) == 15.6d)
                {
                    dcorr = 11.1d;
                }

                if (Conversion.Val(txtUTm.Text) == 52d & Conversion.Val(txtd.Text) == 13.2d)
                {
                    dcorr = 11.6d;
                }

                if (Conversion.Val(txtUTm.Text) == 52d & Conversion.Val(txtd.Text) == 17.2d)
                {
                    dcorr = 15.1d;
                }

                if (Conversion.Val(txtUTm.Text) == 55d & Conversion.Val(txtd.Text) == 18d)
                {
                    dcorr = 16.7d;
                }

                if (Conversion.Val(txtUTm.Text) == 57d & Conversion.Val(txtd.Text) == 13.2d)
                {
                    dcorr = 12.7d;
                }

                if (Conversion.Val(txtUTm.Text) == 52d & Conversion.Val(txtd.Text) == 9.2d)
                {
                    corr2kd = 8.1d;
                    FlagD   = true;
                }

                if (Conversion.Val(txtUTm.Text) == 52d & Conversion.Val(txtd.Text) == 16.4d)
                {
                    corr2kd = 14.4d;
                    FlagD   = true;
                }

                txtDeg.Text   = GHAIncrementDeg.ToString("0", CultureInfo.CurrentCulture);
                txtMin.Text   = GHAIncrementMin.ToString("00.0", CultureInfo.CurrentCulture);
                txtvcorr.Text = vcorr.ToString("0.0", CultureInfo.CurrentCulture);
                txtdcorr.Text = dcorr.ToString("0.0", CultureInfo.CurrentCulture);
                if (FlagV == true)
                {
                    txtvcorrx.Text    = "v-corr value is Post-2001. Pre-2001 value is " + Strings.Format(corr2kv, "0.0");
                    txtvcorrx.Visible = true;
                }
                else
                {
                    txtvcorrx.Clear();
                    txtvcorrx.Visible = false;
                }

                if (FlagD == true)
                {
                    txtdcorrx.Text    = "d-corr value is Post-2001. Pre-2001 value is " + Strings.Format(corr2kd, "0.0");
                    txtdcorrx.Visible = true;
                }
                else
                {
                    txtdcorrx.Clear();
                    txtdcorrx.Visible = false;
                }
            }

            if (optBack.Checked == true)
            {
                Time        = 60d * (Conversion.Val(txtDeg.Text) + Conversion.Val(txtMin.Text) / 60d) / k;
                TimeMin     = (short)Conversion.Int(Time);
                TimeSec     = Conversion.Int((Time - TimeMin) * 60d + 0.5d);
                txtUTm.Text = TimeMin.ToString("0", CultureInfo.CurrentCulture);
                txtUTs.Text = TimeSec.ToString("00", CultureInfo.CurrentCulture);
                txtv.Clear();
                txtd.Clear();

                // txtIC.AppendText("Time " & Strings.Format(TimeMin, "0") & "m" & Strings.Format(TimeSec, "00") & g_LatS)
            }
        }
Exemplo n.º 5
0
    }                                                      // 0x008714F0-0x008716C0

    public static void SetShakeDungeon(Vector2 size, TimeSec time)
    {
    }                                                                     // 0x008716C0-0x00871770
Exemplo n.º 6
0
    }                                                                    // 0x00871280-0x008714F0

    public static void ReturnMapColor(TimeSec time)
    {
    }                                                      // 0x008714F0-0x008716C0
Exemplo n.º 7
0
    public static bool IsChangeLightColor() => default;     // 0x008711C0-0x00871280

    public static void ChangeMapColor(Color target, TimeSec time)
    {
    }                                                                    // 0x00871280-0x008714F0
Exemplo n.º 8
0
    }                                                                      // 0x00871050-0x00871120

    public static void ReturnLightColor(TimeSec time)
    {
    }                                                       // 0x00871120-0x008711C0
Exemplo n.º 9
0
    }                                                              // 0x00870EF0-0x00871050

    public static void ChangeLightColor(Color target, TimeSec time)
    {
    }                                                                      // 0x00871050-0x00871120