예제 #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;
            }
        }
예제 #2
0
 protected override void serializeContent(ICustomDataWriter writer)
 {
     writer.WriteByte((byte)Channel);
     writer.WriteUTF(Content);
     writer.WriteInt(TimestampUtils.GetFromNow());
     writer.WriteUTF(Content);
 }
예제 #3
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;
            }
        }
예제 #4
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;
            }
        }
예제 #5
0
 private void maskedDateTimePickerNormal_ValueChanged(object sender, EventArgs e)
 {
     numberBoxTimeStamp.Value = TimestampUtils.DateTimeToTicks(maskedDateTimePickerNormal.Value);
 }
예제 #6
0
 public static DateTime TimestampToDateTime(string timeStamp)
 {
     return(AdjustForMangle(TimestampUtils.TimestampToDateTime(timeStamp)));
 }
예제 #7
0
 public static ulong HexTimeStampToTicks(string hexTimeStamp)
 {
     return(TimestampUtils.HexTimeStampToTicks(hexTimeStamp));
 }
예제 #8
0
 public static ulong DateTimeToTicks(DateTime dateTime)
 {
     return(TimestampUtils.DateTimeToTicks(dateTime));
 }
예제 #9
0
 public Mangle(string gameMaster, DateTime corrected)
 {
     Start     = TimestampUtils.HexTimeStampToDateTime(gameMaster);
     Corrected = corrected;
 }