Exemple #1
0
        private void Input_ValueChanged(object sender, EventArgs e)
        {
            if (Working)
            {
                return;
            }

            try
            {
                Working = true;

                DateTime gameMasterTimestamp = TimestampUtils.TicksToDateTime(numberBox.Value);
                DateTime fileTimestamp       = maskedDateTimePicker.Value;
                TimeSpan difference          = gameMasterTimestamp - fileTimestamp;

                StringBuilder stringBuilder = new StringBuilder("new Mangle(");
                stringBuilder.AppendFormat($"\"{numberBox.Text}\", ");
                stringBuilder.AppendFormat($"new DateTime({fileTimestamp.Year:0000}, {fileTimestamp.Month:00}, {fileTimestamp.Day:00}, {fileTimestamp.Hour:00}, {fileTimestamp.Minute:00}, 0, DateTimeKind.Utc)),");
                stringBuilder.AppendFormat($"    // {gameMasterTimestamp.Year:0000}-{gameMasterTimestamp.Month:00}-{gameMasterTimestamp.Day:00} {gameMasterTimestamp.Hour:00}:{gameMasterTimestamp.Minute:00}:{gameMasterTimestamp.Second:00}.{gameMasterTimestamp.Millisecond:000}");
                stringBuilder.AppendFormat($" - {difference.Days:00} days, {difference.Hours:00} hours, {difference.Minutes:00} minutes");

                textBoxMunge.Text = stringBuilder.ToString();
            }
            catch (Exception)
            {
                // One of the fields is invalid.
                textBoxMunge.Text = string.Empty;
            }
            finally
            {
                Working = false;
            }
        }
Exemple #2
0
        private void numberBox_ValueChanged(object sender, EventArgs e)
        {
            if (Working)
            {
                return;
            }

            try
            {
                Working = true;

                maskedDateTimePicker.Value = checkBoxGameMaster.Checked ?
                                             GameMasterTimestampUtils.TicksToDateTime(numberBox.Value) :
                                             TimestampUtils.TicksToDateTime(numberBox.Value);
            }
            finally
            {
                Working = false;
            }
        }
Exemple #3
0
        private void numberBoxTimeStamp_ValueChanged(object sender, EventArgs e)
        {
            // Make sure we aren't in the middle of doing work.
            if (Working)
            {
                return;
            }

            try
            {
                Working = true;

                // Convert TimeStamp to DateTime for each.
                maskedDateTimePickerNormal.Value     = TimestampUtils.TicksToDateTime(numberBoxTimeStamp.Value);
                maskedDateTimePickerGameMaster.Value = GameMasterTimestampUtils.TicksToDateTime(numberBoxTimeStamp.Value);
            }
            finally
            {
                Working = false;
            }
        }
Exemple #4
0
 public static DateTime TicksToDateTime(ulong timeStamp)
 {
     return(AdjustForMangle(TimestampUtils.TicksToDateTime(timeStamp)));
 }