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