fCraft.FlatfilePlayerDBProvider.ToDateTimeLegacy C# (CSharp) Method

ToDateTimeLegacy() public static method

public static ToDateTimeLegacy ( long timestamp ) : System.DateTime
timestamp long
return System.DateTime
        public static DateTime ToDateTimeLegacy( long timestamp ) {
            return new DateTime( timestamp * TicksPerMillisecond + DateTimeUtil.TicksToUnixEpoch, DateTimeKind.Utc );
        }

Same methods

FlatfilePlayerDBProvider::ToDateTimeLegacy ( [ str, System.DateTime &result ) : bool

Usage Example

Example #1
0
        internal static IPBanInfo LoadFormat1([NotNull] string[] fields)
        {
            if (fields == null)
            {
                throw new ArgumentNullException("fields");
            }
            if (fields.Length != 8)
            {
                throw new ArgumentException("Unexpected field count", "fields");
            }
            IPBanInfo info = new IPBanInfo {
                Address  = IPAddress.Parse(fields[0]),
                BannedBy = FlatfilePlayerDBProvider.Unescape(fields[1])
            };

            FlatfilePlayerDBProvider.ToDateTimeLegacy(fields[2], out info.BanDate);
            if (fields[3].Length > 0)
            {
                info.BanReason = FlatfilePlayerDBProvider.Unescape(fields[3]);
            }
            if (fields[4].Length > 0)
            {
                info.PlayerName = FlatfilePlayerDBProvider.Unescape(fields[4]);
            }

            Int32.TryParse(fields[5], out info.Attempts);
            info.LastAttemptName = FlatfilePlayerDBProvider.Unescape(fields[6]);
            FlatfilePlayerDBProvider.ToDateTimeLegacy(fields[7], out info.LastAttemptDate);

            return(info);
        }