コード例 #1
0
ファイル: IE.cs プロジェクト: mohamadpk/Monitoring
 /// <summary>
 /// Filetimes to long.
 /// </summary>
 /// <param name="ft">The ft.</param>
 /// <returns>the file time is important for microsoft ie history because create time of history is create time of that file</returns>
 private static DateTime FILETIMEToLong(System.Runtime.InteropServices.FILETIME ft)
 {
     try {
         ulong high     = (ulong)ft.dwHighDateTime;
         uint  low      = (uint)ft.dwLowDateTime;
         long  fileTime = (long)((high << 32) + low);
         return(DateTime.FromFileTimeUtc(fileTime));
     }
     catch (Exception ex)
     {
         var epoch = new DateTime(1, 1, 1, 0, 0, 0, DateTimeKind.Utc);
         return(epoch);
     }
 }
コード例 #2
0
ファイル: NativeMethods.cs プロジェクト: rajeshwarn/gFile
        public static DateTime ToDateTime(this System.Runtime.InteropServices.FILETIME time)
        {
            long     hFT2 = (((long)time.dwHighDateTime) << 32) + time.dwLowDateTime;
            DateTime dte  = DateTime.FromFileTime(hFT2);

            return(dte);

            //ulong high = (ulong)time.dwHighDateTime;
            //uint low = (uint)time.dwLowDateTime;
            //long fileTime = (long)((high << 32) + low);
            //try
            //{
            //    return DateTime.FromFileTimeUtc(fileTime);
            //}
            //catch
            //{
            //    return DateTime.FromFileTimeUtc(0xFFFFFFFF);
            //}
        }
コード例 #3
0
 internal static extern int MsiSummaryInfoGetProperty(uint summaryInfo, int property, out uint dataType, out int integerValue, ref FILETIME fileTimeValue, StringBuilder stringValueBuf, ref int stringValueBufSize);
コード例 #4
0
 /// <summary>
 /// Update the file times on the given file handle.
 /// </summary>
 public static unsafe void SetFileCreationTime(SafeFileHandle hFile, DateTime creationTime)
 {
     FILETIME fileCreationTime = new FILETIME(creationTime.ToFileTimeUtc());
     if (!SetFileTime(hFile, &fileCreationTime, null, null)) {
         throw new Win32Exception(Marshal.GetLastWin32Error());
     }
 }
コード例 #5
0
ファイル: PlatformInvokes.cs プロジェクト: 40a/PowerShell
 internal static extern bool LocalFileTimeToFileTime(
     FILETIME lpLocalFileTime, // _In_   const FILETIME *
     FILETIME lpFileTime); // _Out_  LPFILETIME 
コード例 #6
0
ファイル: DoPatch.cs プロジェクト: Windriderking/ME3Patch
 public static extern void GetSystemTimeAsFileTime(FILETIME *lpSystemTimeAsFileTime);
コード例 #7
0
ファイル: Interop.cs プロジェクト: simple555a/Solarfist
 internal static OpcRcw.Ae.FILETIME Convert(System.Runtime.InteropServices.FILETIME input)
 {
     return(new OpcRcw.Ae.FILETIME {
         dwLowDateTime = input.dwLowDateTime, dwHighDateTime = input.dwHighDateTime
     });
 }
コード例 #8
0
ファイル: OPClib.cs プロジェクト: youkebing/opcserver
 public static extern bool ReadTagWithTimeStamp(UInt32 TagHandle, ref Object Value, ref UInt16 Quality, ref FILETIME Timestamp);
コード例 #9
0
ファイル: OPClib.cs プロジェクト: youkebing/opcserver
 public static extern bool ConvertFileTimeToVBDate1(ref FILETIME FileTime, ref double VBDate);
コード例 #10
0
   public static extern void LookupHistoryAssembly(
 string pwzFilePath,
 ref FILETIME pftActivationDate,
 string pwzAsmName,
 string pwzPublicKeyToken, 
 string wzCulture,
 string pwzVerRef,
 out IntPtr pHistAsm);
コード例 #11
0
ファイル: Yellows.cs プロジェクト: Makk24/QZone
 private string FILETIMEtoDataTime(FILETIME time)
 {
     IntPtr intPtr = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(FILETIME)));
     IntPtr intPtr2 = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(Yellows.SYSTEMTIME)));
     Marshal.StructureToPtr(time, intPtr, true);
     Yellows.FileTimeToSystemTime(intPtr, intPtr2);
     Yellows.SYSTEMTIME sYSTEMTIME = (Yellows.SYSTEMTIME)Marshal.PtrToStructure(intPtr2, typeof(Yellows.SYSTEMTIME));
     return string.Concat(new string[]
     {
         sYSTEMTIME.wYear.ToString(),
         ".",
         sYSTEMTIME.wMonth.ToString(),
         ".",
         sYSTEMTIME.wDay.ToString(),
         ".",
         sYSTEMTIME.wHour.ToString(),
         ".",
         sYSTEMTIME.wMinute.ToString(),
         ".",
         sYSTEMTIME.wSecond.ToString()
     });
 }
コード例 #12
0
ファイル: Kernel32.cs プロジェクト: AtVirus/DarkAgent
 public static extern bool FileTimeToLocalFileTime([In] ref FILETIME lpFileTime, out FILETIME lpLocalFileTime);
コード例 #13
0
ファイル: Kernel.cs プロジェクト: labeuze/source
		[DllImport("kernel32")] public static extern int SystemTimeToFileTime(ref User.Struct.SYSTEMTIME lpSystemTime, ref FILETIME lpFileTime);
コード例 #14
0
ファイル: Kernel.cs プロジェクト: labeuze/source
		[DllImport("kernel32")] public static extern int SetFileTime(HANDLE hFile, ref FILETIME lpCreationTime, ref FILETIME lpLastAccessTime, ref FILETIME lpLastWriteTime);
コード例 #15
0
ファイル: Win32API.cs プロジェクト: betology/SambaPOS-3
 public static extern long FileTimeToSystemTime(ref FILETIME FileTime, ref SYSTEMTIME SystemTime);
コード例 #16
0
ファイル: Kernel.cs プロジェクト: labeuze/source
		[DllImport("kernel32")] public static extern int LocalFileTimeToFileTime(ref FILETIME lpLocalFileTime, ref FILETIME lpFileTime);
コード例 #17
0
ファイル: MsiInterop.cs プロジェクト: sillsdev/FwSupportTools
 internal static extern uint MsiSummaryInfoSetProperty(IntPtr summaryInfo, int property, uint dataType, int integerValue, ref FILETIME fileTimeValue, string stringValue);
コード例 #18
0
ファイル: OPClib.cs プロジェクト: youkebing/opcserver
 public static extern bool ConvertVBDateToFileTime1(ref double VBDate, ref FILETIME FileTime);
コード例 #19
0
ファイル: Win32api.cs プロジェクト: ginobilinie/webbrowser
 /// <summary>
 /// Converts a file time to DateTime format.
 /// </summary>
 /// <param name="filetime">FILETIME structure</param>
 /// <returns>DateTime structure</returns>
 public static DateTime FileTimeToDateTime(FILETIME filetime)
 {
     SYSTEMTIME st = new SYSTEMTIME();
     FileTimeToSystemTime(ref filetime, ref st);
     return new DateTime(st.Year, st.Month, st.Day, st.Hour , st.Minute, st.Second, st.Milliseconds);
 }
コード例 #20
0
ファイル: Win32api.cs プロジェクト: ginobilinie/webbrowser
 static extern bool FileTimeToSystemTime(ref FILETIME FileTime, ref SYSTEMTIME SystemTime);
コード例 #21
0
ファイル: Win32api.cs プロジェクト: ginobilinie/webbrowser
        static extern bool SystemTimeToFileTime([In] ref SYSTEMTIME lpSystemTime, 
			out FILETIME lpFileTime);
コード例 #22
0
ファイル: DoPatch.cs プロジェクト: Windriderking/ME3Patch
 public static extern bool GetFileTime(HandleRef hFile, out FILETIME *lpCreationTime, out FILETIME *lpLastAccessTime, out FILETIME *lpLastWriteTime);
コード例 #23
0
ファイル: FileEx.cs プロジェクト: futurist/barcodeLY
        /// <summary>
        /// Sets the date and time, in local time, that the file was last updated or written to.</summary>
        /// <param name="path">The file for which to set the creation date and time information.</param>
        /// <param name="lastWriteTime">A DateTime containing the value to set for the last write date and time of path. This value is expressed in local time.</param>
        public static void SetLastWriteTime(string path, DateTime lastWriteTime)
        {
            FILETIME ft;
            IntPtr hFile = IntPtr.Zero;

            if (path == null)
                throw new ArgumentNullException();

            if (path.Length > 260)
                throw new PathTooLongException();

            if (path.Trim().Length == 0)
                throw new ArgumentException();

            hFile = CreateFile(path, FileAccess.Write, FileShare.Write, FileCreateDisposition.OpenExisting, 0);

            if ((int) hFile == InvalidHandle)
            {
                int e = Marshal.GetLastWin32Error();
                if ((e == 2) || (e == 3))
                {
                    throw new FileNotFoundException();
                }
                else
                {
                    throw new Exception("Unmanaged Error: " + e);
                }
            }

            ft = new FILETIME(lastWriteTime.ToFileTime());

            SetFileTime(hFile, null, ft, null);

            CloseHandle(hFile);
        }
コード例 #24
0
ファイル: PlatformInvokes.cs プロジェクト: 40a/PowerShell
 internal static extern bool DosDateTimeToFileTime(
     short wFatDate, // _In_   WORD
     short wFatTime, // _In_   WORD
     FILETIME lpFileTime); // _Out_  LPFILETIME 
コード例 #25
0
ファイル: OPClib.cs プロジェクト: youkebing/opcserver
 public static extern bool UpdateTagWithTimeStamp(UInt32 TagHandle, Object Value, UInt16 Quality, FILETIME timestamp);
コード例 #26
0
ファイル: PlatformInvokes.cs プロジェクト: 40a/PowerShell
 internal static extern bool SetFileTime(
     IntPtr hFile, // _In_      HANDLE
     FILETIME lpCreationTime, // _In_opt_  const FILETIME *
     FILETIME lpLastAccessTime, // _In_opt_  const FILETIME *
     FILETIME lpLastWriteTime); // _In_opt_  const FILETIME *
コード例 #27
0
ファイル: OPClib.cs プロジェクト: youkebing/opcserver
 public static extern bool UpdateTagWithTimeStampByName([MarshalAs(UnmanagedType.LPStr)] String Name, Object Value, FILETIME TimeStamp, UInt16 Quality);
コード例 #28
0
 static unsafe extern bool SetFileTime(SafeFileHandle hFile, FILETIME* creationTime, FILETIME* lastAccessTime, FILETIME* lastWriteTime);
コード例 #29
0
ファイル: OPClib.cs プロジェクト: youkebing/opcserver
 public static extern bool UpdateTagWithTimeStampToList(UInt32 TagHandle, Object Value, FILETIME TimeStamp, UInt16 Quality);
コード例 #30
0
ファイル: ComInterfaces.cs プロジェクト: Ridter/Trebuchet
 public void SetElementTimes(string pwcsName, FILETIME[] pctime, FILETIME[] patime, FILETIME[] pmtime)
 {
 }
コード例 #31
0
ファイル: OPClib.cs プロジェクト: youkebing/opcserver
 public static extern bool VBCreateFileTime(UInt16 Year,
     UInt16 Month,
     UInt16 Day,
     UInt16 Hour,
     UInt16 Minute,
     UInt16 Second,
     UInt16 Milliseconds,
     ref FILETIME FileTime);
コード例 #32
0
			internal void From(NativeMethods.WIN32_FIND_DATA findData)
			{
				fileAttributes = findData.dwFileAttributes;
				ftCreationTime = findData.ftCreationTime;
				ftLastAccessTime = findData.ftLastAccessTime;
				ftLastWriteTime = findData.ftLastWriteTime;
				fileSizeHigh = findData.nFileSizeHigh;
				fileSizeLow = findData.nFileSizeLow;
			}
コード例 #33
0
ファイル: Kernel.cs プロジェクト: labeuze/source
		[DllImport("kernel32")] public static extern int GetThreadTimes(HANDLE hThread, ref FILETIME lpCreationTime, ref FILETIME lpExitTime, ref FILETIME lpKernelTime, ref FILETIME lpUserTime);