當前位置: 首頁>>代碼示例>>C#>>正文


C# DateTime.ToFileTime方法代碼示例

本文整理匯總了C#中System.DateTime.ToFileTime方法的典型用法代碼示例。如果您正苦於以下問題:C# DateTime.ToFileTime方法的具體用法?C# DateTime.ToFileTime怎麽用?C# DateTime.ToFileTime使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在System.DateTime的用法示例。


在下文中一共展示了DateTime.ToFileTime方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: FILETIME

		/// <summary>
		/// Builds a FILETIME structure using a DateTime value.
		/// </summary>
		/// <param name="dt">DateTime value used to initialize the FILETIME structure.</param>
		public  FILETIME  ( DateTime  dt )
		   {
			ulong		value	=  ( ulong )  dt. ToFileTime ( ) ;

			__dwHighDateTime	=  ( uint ) ( ( value  >>  32 )  &  0xFFFFFFFF ) ;
			__dwLowDateTime		=  ( uint ) ( value  &  0xFFFFFFFF ) ;
			Value	=  ( ulong ) dt. ToFileTime ( ) ;
		    }
開發者ID:wuthering-bytes,項目名稱:sharpthrak,代碼行數:12,代碼來源:FILETIME.cs

示例2: ZipFileInfo

		public ZipFileInfo (DateTime fileTime)
		{
			date = new ZipTime (fileTime);
			dosDate = new IntPtr ((int)fileTime.ToFileTime ());
			internalFileAttributes = IntPtr.Zero;
			externalFileAttributes = IntPtr.Zero;
		}
開發者ID:nobled,項目名稱:mono,代碼行數:7,代碼來源:ZipFileInfo.cs

示例3: WakeupTimer

 public WakeupTimer(DateTime time, Action runAction)
 {
     _runAction = runAction;
     var worker = new BackgroundWorker();
     worker.DoWork += DoWork;
     worker.RunWorkerCompleted += RunWorkerCompleted;
     worker.RunWorkerAsync(time.ToFileTime());
 }
開發者ID:lgatto,項目名稱:proteowizard,代碼行數:8,代碼來源:WakeupTimer.cs

示例4: DateTimeToFiletime

 /// <summary>
 /// Returns an equivalent <see cref="System.Runtime.InteropServices.ComTypes.FILETIME"/> of the <see cref="System.DateTime"/> object.
 /// </summary>
 /// <param name="dateTime">The date time.</param>
 /// <returns></returns>
 public static FILETIME DateTimeToFiletime( DateTime dateTime )
 {
     FILETIME ft;
     long hFT1 = dateTime.ToFileTime();
     ft.dwLowDateTime = (int) ( ( hFT1 << 32 ) >> 32 );
     ft.dwHighDateTime = (int) ( hFT1 >> 32 );
     return ft;
 }
開發者ID:Redth,項目名稱:ImapiNet,代碼行數:13,代碼來源:ComUtilities.cs

示例5: ToSystemTime

 private Win32Native.SystemTime ToSystemTime(DateTime dateTime)
 {
     long fileTime = dateTime.ToFileTime();
     var systemTime = new Win32Native.SystemTime();
     if (!Win32Native.FileTimeToSystemTime(ref fileTime, systemTime))
         Win32ErrorHelper.ThrowExceptionIfGetLastErrorIsNotZero();
     return systemTime;
 }
開發者ID:sagar1589,項目名稱:Delta.Cryptography,代碼行數:8,代碼來源:CryptContext.cs

示例6: GenerateETag

 private static string GenerateETag(DateTime lastModified, DateTime now) {
     long num = lastModified.ToFileTime();
     long num2 = now.ToFileTime();
     string str = num.ToString("X8", CultureInfo.InvariantCulture);
     if ((num2 - num) <= 0x1c9c380L) {
         return ("W/\"" + str + "\"");
     }
     return ("\"" + str + "\"");
 }
開發者ID:eckesnuff,項目名稱:eckesnuff.se,代碼行數:9,代碼來源:StaticFileHandler.cs

示例7: GenerateETag

 public static string GenerateETag(DateTime lastModified, DateTime now)
 {
     long lastModifiledFileTime = lastModified.ToFileTime();
     long dateNow = now.ToFileTime();
     string str = lastModifiledFileTime.ToString("X8", CultureInfo.InvariantCulture);
     if ((dateNow - lastModifiledFileTime) <= TimeSpan.TicksPerSecond) // There are 10 million ticks in one second.
     {
         return ("W/\"" + str + "\"");
     }
     return ("\"" + str + "\"");
 }
開發者ID:vincoss,項目名稱:RangeRequestHandler,代碼行數:11,代碼來源:HttpHeaderHelper.cs

示例8: SetWakeUpTime

 public void SetWakeUpTime(DateTime time)
 {
     try
     {
         bgWorker.RunWorkerAsync(time.ToFileTime());
     }
     catch (Exception)
     {
         Log.AppLog.WriteEntry(this, Localise.GetPhrase("Background timer already running, cannot start another event"), Log.LogEntryType.Warning, true);
     }
 }
開發者ID:hoeness2,項目名稱:mcebuddy2,代碼行數:11,代碼來源:PowerManagement.cs

示例9: GenerateETag

        private static string GenerateETag(HttpContext context, DateTime lastModified, DateTime now) {
            // Get 64-bit FILETIME stamp
            long lastModFileTime = lastModified.ToFileTime();
            long nowFileTime = now.ToFileTime();
            string hexFileTime = lastModFileTime.ToString("X8", CultureInfo.InvariantCulture);

            // Do what IIS does to determine if this is a weak ETag.
            // Compare the last modified time to now and if the difference is
            // less than or equal to 3 seconds, then it is weak
            if ((nowFileTime - lastModFileTime) <= 30000000) {
                return "W/\"" + hexFileTime + "\"";
            }
            return  "\"" + hexFileTime + "\"";
        }
開發者ID:uQr,項目名稱:referencesource,代碼行數:14,代碼來源:StaticFileHandler.cs

示例10: ConvertDateTime

 //ExStart:ConvertDateTime
 private static byte[] ConvertDateTime(DateTime t)
 {
     long filetime = t.ToFileTime();
     byte[] d = new byte[8];
     d[0] = (byte)(filetime & 0xFF);
     d[1] = (byte)((filetime & 0xFF00) >> 8);
     d[2] = (byte)((filetime & 0xFF0000) >> 16);
     d[3] = (byte)((filetime & 0xFF000000) >> 24);
     d[4] = (byte)((filetime & 0xFF00000000) >> 32);
     d[5] = (byte)((filetime & 0xFF0000000000) >> 40);
     d[6] = (byte)((filetime & 0xFF000000000000) >> 48);
     d[7] = (byte)(((ulong)filetime & 0xFF00000000000000) >> 56);
     return d;
 }
開發者ID:aspose-email,項目名稱:Aspose.Email-for-.NET,代碼行數:15,代碼來源:SetMAPIProperties.cs

示例11: Main

        static void Main(string[] args)
        {
            Console.WriteLine(Win32ApiHelper.IsSystemResumeAutomatic());

            DateTime lastBootUpTime = new DateTime();
            ManagementObjectSearcher searcher = new ManagementObjectSearcher("select * from win32_OperatingSystem");
            foreach (ManagementObject queryObj in searcher.Get())
            {
                var timeStr = Convert.ToString(queryObj["LastBootUpTime"]);
                Console.WriteLine(timeStr);
                lastBootUpTime = ManagementDateTimeConverter.ToDateTime(timeStr);
                Console.WriteLine(lastBootUpTime);
            }

            IntPtr status = Marshal.AllocCoTaskMem(Marshal.SizeOf(typeof(long)));
            Win32ApiHelper.CallNtPowerInformation(
              Win32ApiHelper.POWER_INFORMATION_LEVEL.LastSleepTime,
              (IntPtr)null,
              0,
              status,
              (UInt32)Marshal.SizeOf(typeof(long))
              );

            long lastSleepTime = (long) Marshal.PtrToStructure(status, typeof(long));
            Console.WriteLine(DateTime.FromFileTime(lastBootUpTime.ToFileTime() + lastSleepTime));

            Win32ApiHelper.CallNtPowerInformation(
              Win32ApiHelper.POWER_INFORMATION_LEVEL.LastWakeTime,
              (IntPtr)null,
              0,
              status,
              (UInt32)Marshal.SizeOf(typeof(long))
              );

            long lastWakeTime = (long)Marshal.PtrToStructure(status, typeof(long));
            Console.WriteLine(DateTime.FromFileTime(lastBootUpTime.ToFileTime() + lastWakeTime));
        }
開發者ID:kal444,項目名稱:sleeper,代碼行數:37,代碼來源:Program.cs

示例12: BarData

        /// <summary>
        /// Construct empty BarData, for this dateTime.
        /// </summary>
        public BarData(DateTime dateTime)
        {
            _dateTime = dateTime.ToFileTime();
            _volume = double.NaN;
            _open = double.NaN;
            _close = double.NaN;
            _high = double.NaN;
            _low = double.NaN;
            isHigherPrev = false;
            //_arrow = 0;
            isCompleted = true;
            //_stopLoss = 0;
            //_gainTip = 0;
            //_stopGain = 0;
            sar = double.NaN;
            cr = double.NaN;
            isReverse = false;
            rsi = double.NaN;

            rsi2 = double.NaN;
            rsi3 = double.NaN;
            rsi4 = double.NaN;
            actPrice = double.NaN;
            stopLossPrice = double.NaN;
            stopGainPrice = double.NaN;
            signalList = new List<CandleSignal>();
            exHigh = _high;
            exLow = _low;
            ar = double.NaN;
            ar2 = double.NaN;
            br = double.NaN;
            cci = double.NaN;
            cci2 = double.NaN;
            cci3 = double.NaN;
            indicators = new Dictionary<string, double>();
            lwr = new Dictionary<string, double>();
            wr = double.NaN;
            wr2 = double.NaN;
            lwr.Add(LWR.LWR1, 0);
            lwr.Add(LWR.LWR2, 0);
            boll = new Dictionary<string, double>();
            boll.Add(BOLL.UPPER, 0);
            boll.Add(BOLL.MID, 0);
            boll.Add(BOLL.LOWER, 0);
        }
開發者ID:harryho,項目名稱:demo-fx-trading-platform-prototype,代碼行數:48,代碼來源:BarData.cs

示例13: DateTimeToLong

 public static long DateTimeToLong(DateTime dt)
 {
     if (dt==DateTime.MinValue)
     {
         return 0;
     }
     else
     {
         try
         {
             return dt.ToFileTime();
         }
         catch
         {
             return 0;
         }
     }
 }
開發者ID:Confectrician,項目名稱:GSAKWrapper,代碼行數:18,代碼來源:Conversion.cs

示例14: Add

        public void Add(HttpContent content, string name, string fileName, FileAttributes attributes, DateTime lastWriteTimeUtc)
        {
            if (content.Headers.ContentDisposition == null)
            {
                content.Headers.ContentDisposition = new ContentDispositionHeaderValue("dir-sync-data")
                                                         {
                                                             Name = name,
                                                             FileName = fileName,
                                                             FileNameStar = fileName,
                                                         };
                var parameters = content.Headers.ContentDisposition.Parameters;

                parameters.Add(new NameValueHeaderValue("fileAttributes", HttpUtility.UrlEncode(attributes.ToString())));
                parameters.Add(new NameValueHeaderValue("lastWriteTimeUtc", lastWriteTimeUtc.ToFileTime().ToString(CultureInfo.InvariantCulture)));
            }

            base.Add(content);
        }
開發者ID:peteraglen,項目名稱:condep-dsl,代碼行數:18,代碼來源:MultipartSyncDirContent.cs

示例15: PosTest1

 public bool PosTest1()
 {
     bool retVal = true;
     TestLibrary.TestFramework.BeginScenario("PosTest1: The current dateTime equals 1601/1/1");
     try
     {
         DateTime date1 = new DateTime(1601, 1, 1).ToLocalTime().ToUniversalTime();
         long result = date1.ToFileTime();
         if (result != 0)
         {
             TestLibrary.TestFramework.LogError("001", "The ActualResult is not the ExpectResult");
             retVal = false;
         }
     }
     catch (Exception e)
     {
         TestLibrary.TestFramework.LogError("002", "Unexpect exception:" + e);
         retVal = false;
     }
     return retVal;
 }
開發者ID:l1183479157,項目名稱:coreclr,代碼行數:21,代碼來源:datetimetofiletime.cs


注:本文中的System.DateTime.ToFileTime方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。