當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。