当前位置: 首页>>代码示例>>C#>>正文


C# DateTime.ToFileTimeUtc方法代码示例

本文整理汇总了C#中System.DateTime.ToFileTimeUtc方法的典型用法代码示例。如果您正苦于以下问题:C# DateTime.ToFileTimeUtc方法的具体用法?C# DateTime.ToFileTimeUtc怎么用?C# DateTime.ToFileTimeUtc使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.DateTime的用法示例。


在下文中一共展示了DateTime.ToFileTimeUtc方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Attach

        public void Attach(byte[] streamId, byte[] streamIdToAttach, DateTime expiresAt)
        {
            if (ByteArrayHelper.Compare(streamId, streamIdToAttach))
                throw new ArgumentException("Attaching a stream to itself is now allowed.");

            var stream = repository.Load(streamId);
            var result = stream.Attach(streamIdToAttach, expiresAt.ToFileTimeUtc());
            if (result.IsSuccessful)
                repository.AttachStream(streamId, streamIdToAttach, expiresAt.ToFileTimeUtc());
        }
开发者ID:Elders,项目名称:ActivityStreams,代码行数:10,代码来源:StreamService.cs

示例2: GetFileMd5

 public static string GetFileMd5(string fileName, DateTime modified)
 {
     fileName += modified.ToFileTimeUtc();
     char[] fileNameChars = fileName.ToCharArray();
     byte[] buffer = new byte[_stringEncoder.GetByteCount(fileNameChars, 0, fileName.Length, true)];
     _stringEncoder.GetBytes(fileNameChars, 0, fileName.Length, buffer, 0, true);
     return BitConverter.ToString(_md5CryptoProvider.ComputeHash(buffer)).Replace("-", string.Empty);
 }
开发者ID:rengasamy,项目名称:elFinder.Net,代码行数:8,代码来源:Helper.cs

示例3: EncodeUtcTime

 public sealed override byte[] EncodeUtcTime(DateTime utcTime)
 {
     long ft = utcTime.ToFileTimeUtc();
     unsafe
     {
         return Interop.Crypt32.CryptEncodeObjectToByteArray(CryptDecodeObjectStructType.PKCS_UTC_TIME, &ft);
     }
 }
开发者ID:ESgarbi,项目名称:corefx,代码行数:8,代码来源:PkcsPalWindows.cs

示例4: DateTimeToFILETIME

 static FILETIME DateTimeToFILETIME(DateTime time)
 {
     FILETIME ft;
     var value = time.ToFileTimeUtc();
     ft.dwLowDateTime = (int)(value & 0xFFFFFFFF);
     ft.dwHighDateTime = (int)(value >> 32);
     return ft;
 }
开发者ID:cincuranet,项目名称:AbsoluteTimer,代码行数:8,代码来源:AbsoluteTimer.cs

示例5: DateTimeToFiletime

 public static FILETIME DateTimeToFiletime(DateTime time)
 {
     FILETIME ft;
     long hFT1 = time.ToFileTimeUtc();
     ft.dwLowDateTime = (uint)(hFT1 & 0xFFFFFFFF);
     ft.dwHighDateTime = (uint)(hFT1 >> 32);
     return ft;
 }
开发者ID:CharlesZHENG,项目名称:csexwb2,代码行数:8,代码来源:WinApis.cs

示例6: DateTimeToFiletime

 /// <summary>
 /// Converts DateTime to Win32 FileTime format
 /// </summary>
 public static Win32FileTime DateTimeToFiletime( DateTime time )
 {
     Win32FileTime ft;
     var fileTime = time.ToFileTimeUtc( );
     ft.DateTimeLow = ( uint ) ( fileTime & 0xFFFFFFFF );
     ft.DateTimeHigh = ( uint ) ( fileTime >> 32 );
     return ft;
 }
开发者ID:Kudach,项目名称:QuickIO,代码行数:11,代码来源:InternalRawDataHelpers.cs

示例7: ToFileTimeStructureUtc

 public static FILETIME ToFileTimeStructureUtc(DateTime dateTime)
 {
     var value = dateTime.ToFileTimeUtc();
     return new FILETIME
     {
         dwHighDateTime = unchecked((int)((value >> 32) & 0xFFFFFFFF)),
         dwLowDateTime = unchecked((int)(value & 0xFFFFFFFF))
     };
 }
开发者ID:blinds52,项目名称:FiddlerCertGen,代码行数:9,代码来源:FileTimeHelper.cs

示例8: Detach

        public void Detach(byte[] streamId, byte[] streamIdToDetach, DateTime detachedSince)
        {
            if (ByteArrayHelper.Compare(streamId, streamIdToDetach))
                throw new ArgumentException("Detaching a stream from itself is now allowed.");

            var stream = repository.Load(streamId);
            var result = stream.Detach(streamIdToDetach, detachedSince);
            if (result.IsSuccessful)
                repository.DetachStream(streamId, streamIdToDetach, detachedSince.ToFileTimeUtc());
        }
开发者ID:Elders,项目名称:ActivityStreams,代码行数:10,代码来源:StreamService.cs

示例9: MessageLocation

        /// <summary>
        /// Create a path to queue for the given <paramref name="peer"/> and <paramref name="messageQueuedTime"/>.
        /// </summary>
        /// <param name="peer">The peer to build the path for.</param>
        /// <param name="messageQueuedTime">The message file time to build a path for.</param>
        /// <returns>A path to queue for the given <paramref name="peer"/> and <paramref name="messageQueuedTime"/>.</returns>
        public static string MessageLocation(IPeer peer, DateTime messageQueuedTime)
        {
            var messageLocation = string.Format(
                CultureInfo.InvariantCulture,
                "/{0}/queue/{1}",
                peer.EscapePeerAddress(),
                messageQueuedTime.ToFileTimeUtc());

            return messageLocation;
        }
开发者ID:dibble-james,项目名称:ServiceBus,代码行数:16,代码来源:MessageExtensions.cs

示例10: WaitThenDoStuff

        public static void WaitThenDoStuff(DateTime time, Action stuff)
        {
            Task.Run(() =>
            {
                IntPtr timer = NativeMethods.CreateWaitableTimer(IntPtr.Zero, 1, null);
                long abs_utc_time = time.ToFileTimeUtc();
                NativeMethods.SetWaitableTimer(timer, ref abs_utc_time, 0, IntPtr.Zero, IntPtr.Zero, 1);
                NativeMethods.WaitForSingleObject(timer, NativeMethods.INFINITE);

                stuff();
            });
        }
开发者ID:EFanZh,项目名称:EFanZh,代码行数:12,代码来源:SystemActions.cs

示例11: IsValidValue

 public static bool IsValidValue(DateTime value)
 {
     var flag = true;
     try
     {
         value.ToFileTimeUtc();
     }
     catch
     {
         flag = false;
     }
     return flag;
 }
开发者ID:ouyh18,项目名称:LtePlatform,代码行数:13,代码来源:NTTaggedData.cs

示例12: Encode

 private static byte[] Encode(DateTime signingTime)
 {
     long val = signingTime.ToFileTimeUtc();
     System.Security.Cryptography.SafeLocalAllocHandle handle = System.Security.Cryptography.CAPI.LocalAlloc(0x40, new IntPtr(Marshal.SizeOf(typeof(long))));
     Marshal.WriteInt64(handle.DangerousGetHandle(), val);
     byte[] encodedData = new byte[0];
     if (!System.Security.Cryptography.CAPI.EncodeObject("1.2.840.113549.1.9.5", handle.DangerousGetHandle(), out encodedData))
     {
         throw new CryptographicException(Marshal.GetLastWin32Error());
     }
     handle.Dispose();
     return encodedData;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:13,代码来源:Pkcs9SigningTime.cs

示例13: IsValidValue

 public static bool IsValidValue(DateTime value)
 {
     bool result = true;
     try
     {
         value.ToFileTimeUtc();
     }
     catch
     {
         result = false;
     }
     return result;
 }
开发者ID:GameDiffs,项目名称:TheForest,代码行数:13,代码来源:NTTaggedData.cs

示例14: FILETIME

        /// <summary>
        /// Creates a new instance of the FILETIME struct.
        /// </summary>
        /// <param name="dateTime">A <see cref="DateTime"/> object to copy data from.</param>
        public FILETIME(DateTime dateTime)
        {
            // Get the file time as a long in Utc
            //
            long fileTime = dateTime.ToFileTimeUtc();

            // Copy the low bits
            //
            dwLowDateTime = (DWORD)(fileTime & 0xFFFFFFFF);

            // Copy the high bits
            //
            dwHighDateTime = (DWORD)(fileTime >> 32);
        }
开发者ID:josemesona,项目名称:Win32Ex,代码行数:18,代码来源:Structs.cs

示例15: DataTimeTransfer

        public void DataTimeTransfer(ref long dataTimeValue)
        {
            DateTime dtServerTime = new DateTime(2016, 2, 8);
            DateTime dtFromClient = DateTime.FromFileTimeUtc(dataTimeValue);
            if (dtServerTime == dtFromClient)
            {
                dataTimeValue = dtServerTime.ToFileTimeUtc();
            }
            else
            {
                dataTimeValue = -1;
            }

        }
开发者ID:snitsars,项目名称:pCORBAtraining,代码行数:14,代码来源:ServerImpl.cs


注:本文中的System.DateTime.ToFileTimeUtc方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。