当前位置: 首页>>代码示例>>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;未经允许,请勿转载。