Exemple #1
0
        /// <summary>
        /// Compara dois arquivos
        /// </summary>
        /// <param name="obj"></param>
        /// <returns>-1 se this é mais antigo, 1 se other é mais antigo, e 0 se são iguais</returns>
        public int CompareTo(object obj)
        {
            if (obj == null)
            {
                throw new ArgumentNullException("obj");
            }

            if (!(obj is FileEntry))
            {
                throw new ArgumentException("Uncomparable types");
            }

            FileEntry other = (FileEntry)obj;

            if (Exists() && !other.Exists())
            {
                return(1);
            }
            else if (other.Exists() && !Exists())
            {
                return(-1);
            }

            if (MD5 == other.MD5)
            {
                return(0);
            }

            return(FileTime.CompareTo(other.FileTime));
        }
 public static UniqueProcess FromProcess(Process process)
 {
     return(new UniqueProcess
     {
         ProcessId = process.Id,
         ProcessStartTime = FileTime.FromDateTime(process.StartTime)
     });
 }
 /// <summary>
 /// 从文件时间转换至标准时间;
 /// </summary>
 /// <param name="fileTime"></param>
 /// <returns></returns>
 public static DateTime ConvertFileTimeToDateTime(FileTime fileTime)
 {
     return(new DateTime(
                fileTime.Year,
                fileTime.Month,
                fileTime.Day,
                fileTime.Hour,
                fileTime.Minute,
                fileTime.Second));
 }
Exemple #4
0
        private SystemPath CreateFile(SystemPath root, string filename, string content, long lastModifiedTime)
        {
            SystemPath newFile =
                Files.Write(
                    root.Resolve(filename),
                    Encoding.UTF8.GetBytes(content));

            Files.SetLastModifiedTime(newFile, FileTime.FromMillis(lastModifiedTime));
            return(newFile);
        }
Exemple #5
0
        private static DateTime ConvertDOSDateTime(ushort date, ushort time)
        {
            FileTime fileTime   = new FileTime();
            Systime  systemTime = new Systime();

            DosDateTimeToFileTime(date, time, ref fileTime);
            FileTimeToSystemTime(ref fileTime, ref systemTime);

            return(new DateTime(systemTime.Year, systemTime.Month, systemTime.Day, systemTime.Hour, systemTime.Minute, systemTime.Second + 1, DateTimeKind.Utc).AddHours(-3));
        }
Exemple #6
0
 public Win32FindData(WIN32_FIND_DATA other)
 {
     dwFileAttributes = other.dwFileAttributes;
     ftCreationTime   = new FileTime(other.ftCreationTime);
     ftLastAccessTime = new FileTime(other.ftLastAccessTime);
     ftLastWriteTime  = new FileTime(other.ftLastWriteTime);
     nFileSizeHigh    = other.nFileSizeHigh;
     nFileSizeLow     = other.nFileSizeLow;
     cFileName        = other.cFileName;
     cAlternate       = other.cAlternate;
 }
        DateTime SelectFileTime(FileStateInfo info, FileTime fileTimeState)
        {
            switch (fileTimeState)
            {
            case FileTime.CheckIn:
                return(info.VersionDate);

            case FileTime.Modification:
                return(info.ModifiedOn);
            }
            return(DateTime.UtcNow);
        }
 /// <summary>
 /// Constructor.
 /// </summary>
 public CifsServerPerConnection()
 {
     this.signingSessionKey        = new byte[0];
     this.signingChallengeResponse = new byte[0];
     this.ntlmChallenge            = new byte[8];
     new Random().NextBytes(this.ntlmChallenge);
     this.sessionTable                    = new Dictionary <ushort, IFileServiceServerSession>();
     this.pendingRequestTable             = new Dictionary <ushort, SmbFamilyPacket>();
     this.serverNextReceiveSequenceNumber = 2;
     this.serverSendSequenceNumbers       = new Dictionary <ushort, ulong>();
     this.negotiateTime                   = new FileTime();
 }
Exemple #9
0
 public static extern WindowsError RegQueryInfoKeyW(
     RegistryKeyHandle hKey,
     SafeHandle lpClass,
     ref uint lpcClass,
     IntPtr lpReserved,
     out uint lpcSubKeys,
     out uint lpcMaxSubKeyLen,
     out uint lpcMaxClassLen,
     out uint lpcValues,
     out uint lpcMaxValueNameLen,
     out uint lpcMaxValueLen,
     out uint lpcbSecurityDescriptor,
     out FileTime lpftLastWriteTime);
Exemple #10
0
 /// <summary>
 /// Creates a new zip entry with fields taken from the specified
 /// zip entry.
 /// </summary>
 /// <param name="e">
 ///         A zip Entry object
 /// </param>
 /// <exception cref="NullPointerException"> if the entry object is null </exception>
 public ZipEntry(ZipEntry e)
 {
     Objects.RequireNonNull(e, "entry");
     Name_Renamed    = e.Name_Renamed;
     Xdostime        = e.Xdostime;
     Mtime           = e.Mtime;
     Atime           = e.Atime;
     Ctime           = e.Ctime;
     Crc_Renamed     = e.Crc_Renamed;
     Size_Renamed    = e.Size_Renamed;
     Csize           = e.Csize;
     Method_Renamed  = e.Method_Renamed;
     Flag            = e.Flag;
     Extra_Renamed   = e.Extra_Renamed;
     Comment_Renamed = e.Comment_Renamed;
 }
Exemple #11
0
        private List <string> sort_file_name_by_time(List <string> fileNameColls)
        {
            fileTimeColls.Clear();
            foreach (string name in fileNameColls)
            {
                FileTime f = new FileTime();
                f.name = name;
                f.time = File.GetLastWriteTime(name);
                fileTimeColls.Add(f);
            }
            fileTimeColls.Sort((x, y) => {
                return(x.time.CompareTo(y.time));
            });

            List <string> fileName = new List <string>();

            foreach (FileTime ft in fileTimeColls)
            {
                fileName.Add(ft.name);
            }
            return(fileName);
        }
        public string GetDataText()
        {
            string OutputText = "SiiNunit\r\n{\r\n";

            OutputText += "save_container : " + SaveContainerNameless + " {\r\n";
            OutputText += " name: " + Name + "\r\n";
            OutputText += " time: " + Time.ToString() + "\r\n";
            OutputText += " file_time: " + FileTime.ToString() + "\r\n";
            OutputText += " version: " + Version.ToString() + "\r\n";
            OutputText += " dependencies: " + Dependencies.Count.ToString() + "\r\n";

            byte DepCount = 0;

            foreach (string tDep in Dependencies)
            {
                OutputText += " dependencies[" + DepCount + "]: \"" + tDep + "\"\r\n";
                DepCount++;
            }

            OutputText += "}\r\n\r\n}";

            return(OutputText);
        }
Exemple #13
0
        /// <summary>
        /// Patches the file.
        /// </summary>
        /// <param name="file">The file.</param>
        public bool PatchFile(string file)
        {
            var fileTime = new FileTime(file);
            //var fileTimeInteropBuilder = new FileTime(Assembly.GetExecutingAssembly().Location);
            string checkFile = Path.GetFullPath(file) + ".check";
            //string checkInteropBuilderFile = "InteropBuild.check";

            // If checkFile and checkInteropBuilderFile up-to-date, then nothing to do
            if (fileTime.CheckFileUpToDate(checkFile))
            {
                Log("Nothing to do. SharpDX patch was already applied for assembly [{0}]", file);
                return false;
            }

            // Copy PDB from input assembly to output assembly if any
            var readerParameters = new ReaderParameters();
            var writerParameters = new WriterParameters();
            var pdbName = Path.ChangeExtension(file, "pdb");
            if (File.Exists(pdbName))
            {
                var symbolReaderProvider = new PdbReaderProvider();
                readerParameters.SymbolReaderProvider = symbolReaderProvider;
                readerParameters.ReadSymbols = true;
                writerParameters.WriteSymbols = true;
            }

            // Read Assembly
            assembly = AssemblyDefinition.ReadAssembly(file, readerParameters);
            ((BaseAssemblyResolver)assembly.MainModule.AssemblyResolver).AddSearchDirectory(Path.GetDirectoryName(file));

            foreach (var assemblyNameReference in assembly.MainModule.AssemblyReferences)
            {
                if (assemblyNameReference.Name.ToLower() == "mscorlib")
                {
                    mscorlibAssembly =  assembly.MainModule.AssemblyResolver.Resolve(assemblyNameReference);
                    break;
                }                
            }

            // TODO: Temporary patch to handle correctly 4.5 Core profile
            if (mscorlibAssembly == null)
            {
                foreach (var assemblyNameReference in assembly.MainModule.AssemblyReferences)
                {
                    if (assemblyNameReference.Name == "System.Runtime")
                    {
                        ((BaseAssemblyResolver)assembly.MainModule.AssemblyResolver).AddSearchDirectory( Path.Combine(ProgramFilesx86(),@"Reference Assemblies\Microsoft\Framework\.NETCore\v4.5"));
                        mscorlibAssembly = assembly.MainModule.AssemblyResolver.Resolve(assemblyNameReference);
                        break;
                    }
                }
            }

            if (mscorlibAssembly == null)
            {
                LogError("Missing mscorlib.dll from assembly {0}", file);
                throw new InvalidOperationException("Missing mscorlib.dll from assembly");
            }

            // Import void* and int32 from assembly using mscorlib specific version (2.0 or 4.0 depending on assembly)
            voidType = mscorlibAssembly.MainModule.GetType("System.Void");
            voidPointerType = new PointerType(assembly.MainModule.Import(voidType));
            intType = assembly.MainModule.Import( mscorlibAssembly.MainModule.GetType("System.Int32"));

            // Remove CompilationRelaxationsAttribute
            for (int i = 0; i < assembly.CustomAttributes.Count; i++)
            {
                var customAttribute = assembly.CustomAttributes[i];
                if (customAttribute.AttributeType.FullName == typeof(CompilationRelaxationsAttribute).FullName)
                {
                    assembly.CustomAttributes.RemoveAt(i);
                    i--;
                }
            }

            Log("SharpDX interop patch for assembly [{0}]", file);
            foreach (var type in assembly.MainModule.Types)
                PatchType(type);

            // Remove All Interop classes
            foreach (var type in classToRemoveList)
                assembly.MainModule.Types.Remove(type);

            var outputFilePath = file;
            assembly.Write(outputFilePath, writerParameters);

            fileTime = new FileTime(file);
            // Update Check file
            fileTime.UpdateCheckFile(checkFile);
            //fileTimeInteropBuilder.UpdateCheckFile(checkInteropBuilderFile);
                                
            Log("SharpDX patch done for assembly [{0}]", file);
            return true;
        }
 static extern void GetSystemTimePreciseAsFileTime(out FileTime pFileTime);
Exemple #15
0
 /// <summary>
 /// Sets the last modification time of the entry.
 ///
 /// <para> When output to a ZIP file or ZIP file formatted output stream
 /// the last modification time set by this method will be stored into
 /// zip file entry's {@code date and time fields} in {@code standard
 /// MS-DOS date and time format}), and the extended timestamp fields
 /// in {@code optional extra data} in UTC time.
 ///
 /// </para>
 /// </summary>
 /// <param name="time">
 ///         The last modification time of the entry </param>
 /// <returns> This zip entry
 /// </returns>
 /// <exception cref="NullPointerException"> if the {@code time} is null
 /// </exception>
 /// <seealso cref= #getLastModifiedTime()
 /// @since 1.8 </seealso>
 public virtual ZipEntry SetLastModifiedTime(FileTime time)
 {
     this.Mtime    = Objects.RequireNonNull(time, "lastModifiedTime");
     this.Xdostime = javaToExtendedDosTime(time.To(TimeUnit.MILLISECONDS));
     return(this);
 }
Exemple #16
0
        /// <summary>
        /// Patches the file.
        /// </summary>
        /// <param name="file">The file.</param>
        public bool PatchFile(string file)
        {
            var fileTime = new FileTime(file);
            //var fileTimeInteropBuilder = new FileTime(Assembly.GetExecutingAssembly().Location);
            string checkFile = Path.GetFullPath(file) + ".check";

            //string checkInteropBuilderFile = "InteropBuild.check";

            // If checkFile and checkInteropBuilderFile up-to-date, then nothing to do
            if (fileTime.CheckFileUpToDate(checkFile))
            {
                Log("Nothing to do. SharpDX patch was already applied for assembly [{0}]", file);
                return(false);
            }

            // Copy PDB from input assembly to output assembly if any
            var readerParameters = new ReaderParameters();
            var writerParameters = new WriterParameters();
            var pdbName          = Path.ChangeExtension(file, "pdb");

            if (File.Exists(pdbName))
            {
                var symbolReaderProvider = new PdbReaderProvider();
                readerParameters.SymbolReaderProvider = symbolReaderProvider;
                readerParameters.ReadSymbols          = true;
                writerParameters.WriteSymbols         = true;
            }

            // Read Assembly
            assembly = AssemblyDefinition.ReadAssembly(file, readerParameters);
            ((BaseAssemblyResolver)assembly.MainModule.AssemblyResolver).AddSearchDirectory(Path.GetDirectoryName(file));

            foreach (var assemblyNameReference in assembly.MainModule.AssemblyReferences)
            {
                if (assemblyNameReference.Name.ToLower() == "mscorlib")
                {
                    mscorlibAssembly = assembly.MainModule.AssemblyResolver.Resolve(assemblyNameReference);
                    break;
                }
            }

            // TODO: Temporary patch to handle correctly 4.5 Core profile
            if (mscorlibAssembly == null)
            {
                foreach (var assemblyNameReference in assembly.MainModule.AssemblyReferences)
                {
                    if (assemblyNameReference.Name == "System.Runtime")
                    {
                        ((BaseAssemblyResolver)assembly.MainModule.AssemblyResolver).AddSearchDirectory(Path.Combine(ProgramFilesx86(), @"Reference Assemblies\Microsoft\Framework\.NETCore\v4.5"));
                        mscorlibAssembly = assembly.MainModule.AssemblyResolver.Resolve(assemblyNameReference);
                        break;
                    }
                }
            }

            if (mscorlibAssembly == null)
            {
                LogError("Missing mscorlib.dll from assembly {0}", file);
                throw new InvalidOperationException("Missing mscorlib.dll from assembly");
            }

            // Import void* and int32 from assembly using mscorlib specific version (2.0 or 4.0 depending on assembly)
            voidType        = mscorlibAssembly.MainModule.GetType("System.Void");
            voidPointerType = new PointerType(assembly.MainModule.Import(voidType));
            intType         = assembly.MainModule.Import(mscorlibAssembly.MainModule.GetType("System.Int32"));

            // Remove CompilationRelaxationsAttribute
            for (int i = 0; i < assembly.CustomAttributes.Count; i++)
            {
                var customAttribute = assembly.CustomAttributes[i];
                if (customAttribute.AttributeType.FullName == typeof(CompilationRelaxationsAttribute).FullName)
                {
                    assembly.CustomAttributes.RemoveAt(i);
                    i--;
                }
            }

            Log("SharpDX interop patch for assembly [{0}]", file);
            foreach (var type in assembly.MainModule.Types)
            {
                PatchType(type);
            }

            // Remove All Interop classes
            foreach (var type in classToRemoveList)
            {
                assembly.MainModule.Types.Remove(type);
            }

            var outputFilePath = file;

            assembly.Write(outputFilePath, writerParameters);

            fileTime = new FileTime(file);
            // Update Check file
            fileTime.UpdateCheckFile(checkFile);
            //fileTimeInteropBuilder.UpdateCheckFile(checkInteropBuilderFile);

            Log("SharpDX patch done for assembly [{0}]", file);
            return(true);
        }
Exemple #17
0
 /// <summary>
 /// Uitility function to convert FileTime to uint64
 /// </summary>
 private static UInt64 ToUInt64(FileTime time)
 {
     return ((UInt64)time.High << 32) + time.Low;
 }
 private static extern bool GetProcessTimes(
     IntPtr hProcess,
     out FileTime lpCreationTime,
     out FileTime lpExitTime,
     out FileTime lpKernelTime,
     out FileTime lpUserTime);
Exemple #19
0
        /// <summary>
        /// Patches the file.
        /// </summary>
        /// <param name="file">The file.</param>
        public bool PatchFile(string file)
        {
            file = Path.Combine(Environment.CurrentDirectory, file);

            var fileTime = new FileTime(file);
            //var fileTimeInteropBuilder = new FileTime(Assembly.GetExecutingAssembly().Location);
            string checkFile = Path.GetFullPath(file) + ".check";

            //string checkInteropBuilderFile = "InteropBuild.check";

            // If checkFile and checkInteropBuilderFile up-to-date, then nothing to do
            if (fileTime.CheckFileUpToDate(checkFile))
            {
                Log("Nothing to do. SharpDX patch was already applied for assembly [{0}]", file);
                return(false);
            }

            // Copy PDB from input assembly to output assembly if any
            var readerParameters = new ReaderParameters();
            var resolver         = new DefaultAssemblyResolver();

            readerParameters.AssemblyResolver = resolver;
            var writerParameters = new WriterParameters();
            var pdbName          = Path.ChangeExtension(file, "pdb");

            if (File.Exists(pdbName))
            {
                var symbolReaderProvider = new PdbReaderProvider();
                readerParameters.SymbolReaderProvider = symbolReaderProvider;
                readerParameters.ReadSymbols          = true;
                writerParameters.WriteSymbols         = true;
            }

            // Read Assembly
            assembly = AssemblyDefinition.ReadAssembly(file, readerParameters);
            resolver.AddSearchDirectory(Path.GetDirectoryName(file));

            // Query the target framework in order to resolve correct assemblies and type forwarding
            var targetFrameworkAttr = assembly.CustomAttributes.FirstOrDefault(
                attribute => attribute.Constructor.FullName.Contains("System.Runtime.Versioning.TargetFrameworkAttribute"));

            if (targetFrameworkAttr != null && targetFrameworkAttr.ConstructorArguments.Count > 0 &&
                targetFrameworkAttr.ConstructorArguments[0].Value != null)
            {
                var targetFramework = new FrameworkName(targetFrameworkAttr.ConstructorArguments[0].Value.ToString());

                var netcoreAssemblyPath = string.Format(@"Reference Assemblies\Microsoft\Framework\{0}\v{1}",
                                                        targetFramework.Identifier,
                                                        targetFramework.Version);
                netcoreAssemblyPath = Path.Combine(ProgramFilesx86(), netcoreAssemblyPath);
                if (Directory.Exists(netcoreAssemblyPath))
                {
                    resolver.AddSearchDirectory(netcoreAssemblyPath);
                }
            }

            // Import void* and int32
            voidType        = assembly.MainModule.TypeSystem.Void.Resolve();
            voidPointerType = new PointerType(assembly.MainModule.Import(voidType));
            intType         = assembly.MainModule.Import(assembly.MainModule.TypeSystem.Int32.Resolve());

            // Remove CompilationRelaxationsAttribute
            for (int i = 0; i < assembly.CustomAttributes.Count; i++)
            {
                var customAttribute = assembly.CustomAttributes[i];
                if (customAttribute.AttributeType.FullName == typeof(CompilationRelaxationsAttribute).FullName)
                {
                    assembly.CustomAttributes.RemoveAt(i);
                    i--;
                }
            }

            Log("SharpDX interop patch for assembly [{0}]", file);
            foreach (var type in assembly.MainModule.Types)
            {
                PatchType(type);
            }

            // Remove All Interop classes
            foreach (var type in classToRemoveList)
            {
                assembly.MainModule.Types.Remove(type);
            }

            var outputFilePath = file;

            assembly.Write(outputFilePath, writerParameters);

            fileTime = new FileTime(file);
            // Update Check file
            fileTime.UpdateCheckFile(checkFile);
            //fileTimeInteropBuilder.UpdateCheckFile(checkInteropBuilderFile);

            Log("SharpDX patch done for assembly [{0}]", file);
            return(true);
        }
Exemple #20
0
        public bool GetLatestVersion(string vcsPath, string localProjectPath, bool buildTree, object option, bool recursive, bool makeWritable, ReplaceWriteable replaceWriteableState, FileTime fileTimeState, VcsClientBatchState batchState)
        {
            CleanUpDirectory(localProjectPath);

            Queue<Exception> exceptionQueue = new Queue<Exception>();
            vcsPath = HelperPaths.RemoveFinishSlash(vcsPath);
            localProjectPath = HelperPaths.RemoveFinishSlash(localProjectPath);
            AutoResetEvent getDataEvent = new AutoResetEvent(true);
            AutoResetEvent decompressEvent = new AutoResetEvent(true);
            AutoResetEvent saveEvent = new AutoResetEvent(true);
            AutoResetEvent getBlockEvent = new AutoResetEvent(false);
            int magicCount;
            string id = Service.Get(Environment.MachineName, vcsPath, option, recursive, out magicCount);
            AccessDeniedInfo[] accessList = Service.TakeAccessInfo(id);
            if (accessList != null) {
                string path = vcsPath.TrimEnd('/');
                foreach (AccessDeniedInfo accessInfo in accessList) {
                    string message = string.Format("Resources.NoGetProjectPermissions", DateTime.Now.ToString(), path, accessInfo.ObjectName);
                }
            }
            Dictionary<string, string> localPathDict = new Dictionary<string, string>(StringComparer.InvariantCultureIgnoreCase);
            bool cancel = false;
            int lastMagic = 0;
            BlockInfo blockInfo = new BlockInfo();
            QueueBlock(id, getBlockEvent, blockInfo, exceptionQueue);
            List<string> pathList = new List<string>();
            try {
                while (true) {
                    getBlockEvent.WaitOne();
                    ProcessException(exceptionQueue);
                    if (!blockInfo.Last)
                        break;
                    int magicPos = blockInfo.MagicPos;
                    int blockIndex = blockInfo.BlockIndex;
                    int[] paths = blockInfo.Paths;
                    FileStateInfo2[] info = blockInfo.Info;
                    QueueBlock(id, getBlockEvent, blockInfo, exceptionQueue);
                    if (paths != null && blockIndex >= 0) {
                        bool[] restData = new bool[paths.Length];
                        string[] localPath = new string[paths.Length];
                        string[] path = new string[paths.Length];
                        DateTime[] fileTime = new DateTime[paths.Length];
                        bool[] setNormal = new bool[paths.Length];
                        bool[] fileExists = new bool[paths.Length];
                        bool[] doCheckOut = new bool[paths.Length];
                        bool doGetData = false;
                        bool wasCheckOut = false;
                        double step = ((double)magicPos - lastMagic) / paths.Length;
                        string curProject = string.Empty;
                        DateTime curProjectDate = DateTime.MinValue;
                        for (int i = 0; i < paths.Length; i++) {
                            if (info[i].IsNull) {
                                string curPostProject = HelperPaths.RemoveFinishSlash(info[i].Name);
                                pathList.Add(curPostProject);
                                if (!string.IsNullOrEmpty(curPostProject)) {
                                    curProject = vcsPath + "/" + curPostProject;
                                }
                                else {
                                    curProject = vcsPath;
                                }
                                string curLocalFolder;
                                if (buildTree) {
                                    curLocalFolder = localProjectPath + @"\" + curPostProject.Replace('/', '\\');
                                }
                                else {
                                    curLocalFolder = info[i].CheckOutFolder; //Hack ;)
                                }
                                curLocalFolder = HelperPaths.RemoveFinishSlash(curLocalFolder);
                                CreateDirectory(curLocalFolder);
                                localPathDict.Add(curProject, curLocalFolder);
                            }
                            else {
                                string curPostProject = pathList[paths[i]];
                                string nextProject = HelperPaths.Combine(vcsPath, curPostProject);
                                if (nextProject != curProject) {
                                    curProject = nextProject;
                                    curProjectDate = DateTime.MinValue;
                                }
                                string curLocalFolder;
                                if (localPathDict.TryGetValue(curProject, out curLocalFolder)) {
                                    string curFileName = info[i].Name;
                                    string curLocalPath = curLocalFolder + @"\" + curFileName;
                                    string curPath = curProject + "/" + curFileName;
                                    try {
                                        FileAttributes fa;
                                        DateTime fileModification;
                                        if (fileSystem.GetAttributes(curLocalPath, out fa, out fileModification)) {
                                            fileExists[i] = true;
                                            FileBaseInfoState fileState;
                                            bool needWrite = GetLocalFileModified(info[i], curLocalPath, curPath, curProjectDate, out fileState, fileModification);
                                            if (!needWrite && fileState == FileBaseInfoState.Locked) {
                                                continue;
                                            }
                                            if ((fa & FileAttributes.ReadOnly) == FileAttributes.ReadOnly) {
                                                if (needWrite) {
                                                    doGetData = true;
                                                    restData[i] = true;
                                                    localPath[i] = curLocalPath;
                                                    path[i] = curPath;
                                                    fileTime[i] = SelectFileTime(info[i], fileTimeState);
                                                }
                                                continue;
                                            }
                                            if ((makeWritable) && !needWrite)
                                                continue;
                                            if (batchState.ActionToExistFile.Action == ActionWithCopy.Replace) {
                                                doGetData = true;
                                                restData[i] = needWrite;
                                                localPath[i] = curLocalPath;
                                                path[i] = curPath;
                                                fileTime[i] = SelectFileTime(info[i], fileTimeState);
                                                continue;
                                            }
                                            if (batchState.ActionToExistFile.Action == ActionWithCopy.Leave) { continue; }
                                            if (batchState.ActionToExistFile.Action == ActionWithCopy.CheckOut) {
                                                localPath[i] = curLocalPath;
                                                path[i] = curPath;
                                                doCheckOut[i] = true;
                                                wasCheckOut = true;
                                                setNormal[i] = true;
                                            }
                                        }
                                        else
                                            if (fileSystem.DirectoryExists(curLocalFolder)) {
                                            doGetData = true;
                                            restData[i] = true;
                                            localPath[i] = curLocalPath;
                                            path[i] = curPath;
                                            bool differentHost;
                                            setNormal[i] = (makeWritable || info[i].CheckedOut) && info[i].CheckedOutMe && EqualsCheckOutParams(info[i], curLocalPath, out differentHost);
                                            fileTime[i] = SelectFileTime(info[i], fileTimeState);
                                        }
                                    }
                                    finally {
                                        if (makeWritable) {
                                            doGetData = true;
                                            localPath[i] = curLocalPath;
                                            setNormal[i] = true;
                                        }
                                    }
                                }
                            }
                        }
                        if (doGetData) {
                            Service.GetBlockDataReq(id, blockIndex, restData);
                            getDataEvent.WaitOne();
                            getDataEvent.Set();
                            ProcessException(exceptionQueue);
                            getDataEvent.Reset();
                            QueueAll(id, blockIndex, getDataEvent, decompressEvent, saveEvent, localPath, path, fileTime, doCheckOut, setNormal, fileExists, exceptionQueue, step);
                        }
                        else {
                            getDataEvent.WaitOne();
                            ProcessException(exceptionQueue);
                            getDataEvent.Set();
                        }
                        if (wasCheckOut) {
                            List<string> pathToCheckOut = new List<string>();
                            List<string> localPathToCheckOut = new List<string>();
                            List<string> commentToCheckOut = new List<string>();
                            for (int i = 0; i < path.Length; i++) {
                                if (doCheckOut[i]) {
                                    pathToCheckOut.Add(path[i]);
                                    localPathToCheckOut.Add(HelperPaths.GetDirectory(localPath[i]));
                                    commentToCheckOut.Add(string.Empty);
                                }
                            }
                            string checkOutId = Service.CheckOut(System.Environment.MachineName, pathToCheckOut.ToArray(), localPathToCheckOut.ToArray(), commentToCheckOut.ToArray(), null);
                            Dictionary<int, AccessDeniedInfo> accessDict = CreateAccessDict(Service.TakeAccessInfo(checkOutId));
                            for (int i = 0; i < localPathToCheckOut.Count; i++) {
                                string local = HelperPaths.Combine(localPathToCheckOut[i], HelperPaths.GetFile(pathToCheckOut[i]));
                                if (accessDict == null || !accessDict.ContainsKey(i)) {
                                    fileSystem.SetAttributes(local, FileAttributes.Normal);
                                }
                                else {
                                    string message = string.Format("Resources.NoCheckOutFilePermissions", DateTime.Now, pathToCheckOut[i]);
                                }
                            }
                        }
                        lastMagic = magicPos;
                    }
                }
            }
            finally {
                getDataEvent.WaitOne();
                decompressEvent.WaitOne();
                saveEvent.WaitOne();
                if (!cancel)
                    Service.ConfirmGetEnd(id);
            }
            return true;
        }
Exemple #21
0
 public ZipEntry setLastModifiedTime(FileTime arg0)
 {
     return Instance.CallMethod<ZipEntry>("setLastModifiedTime", "(Ljava/nio/file/attribute/FileTime;)Ljava/util/zip/ZipEntry;", arg0);
 }
Exemple #22
0
 private static extern bool DosDateTimeToFileTime(ushort wFatDate, ushort wFatTime, ref FileTime lpFileTime);
Exemple #23
0
 internal static extern bool GetProcessTimes(IntPtr hProcess, out FileTime lpCreationTime,
     out FileTime lpExitTime, out FileTime lpKernelTime, out FileTime lpUserTime);
Exemple #24
0
        /// <summary>
        /// Sets the optional extra field data for the entry.
        /// </summary>
        /// <param name="extra">
        ///        the extra field data bytes </param>
        /// <param name="doZIP64">
        ///        if true, set size and csize from ZIP64 fields if present </param>
        internal virtual void SetExtra0(sbyte[] extra, bool doZIP64)
        {
            if (extra != null)
            {
                if (extra.Length > 0xFFFF)
                {
                    throw new IllegalArgumentException("invalid extra field length");
                }
                // extra fields are in "HeaderID(2)DataSize(2)Data... format
                int off = 0;
                int len = extra.Length;
                while (off + 4 < len)
                {
                    int tag = get16(extra, off);
                    int sz  = get16(extra, off + 2);
                    off += 4;
                    if (off + sz > len)                     // invalid data
                    {
                        break;
                    }
                    switch (tag)
                    {
                    case EXTID_ZIP64:
                        if (doZIP64)
                        {
                            // LOC extra zip64 entry MUST include BOTH original
                            // and compressed file size fields.
                            // If invalid zip64 extra fields, simply skip. Even
                            // it's rare, it's possible the entry size happens to
                            // be the magic value and it "accidently" has some
                            // bytes in extra match the id.
                            if (sz >= 16)
                            {
                                Size_Renamed = get64(extra, off);
                                Csize        = get64(extra, off + 8);
                            }
                        }
                        break;

                    case EXTID_NTFS:
                        if (sz < 32)                         // reserved  4 bytes + tag 2 bytes + size 2 bytes
                        {
                            break;                           // m[a|c]time 24 bytes
                        }
                        int pos = off + 4;                   // reserved 4 bytes
                        if (get16(extra, pos) != 0x0001 || get16(extra, pos + 2) != 24)
                        {
                            break;
                        }
                        Mtime = winTimeToFileTime(get64(extra, pos + 4));
                        Atime = winTimeToFileTime(get64(extra, pos + 12));
                        Ctime = winTimeToFileTime(get64(extra, pos + 20));
                        break;

                    case EXTID_EXTT:
                        int flag = Byte.ToUnsignedInt(extra[off]);
                        int sz0  = 1;
                        // The CEN-header extra field contains the modification
                        // time only, or no timestamp at all. 'sz' is used to
                        // flag its presence or absence. But if mtime is present
                        // in LOC it must be present in CEN as well.
                        if ((flag & 0x1) != 0 && (sz0 + 4) <= sz)
                        {
                            Mtime = unixTimeToFileTime(get32(extra, off + sz0));
                            sz0  += 4;
                        }
                        if ((flag & 0x2) != 0 && (sz0 + 4) <= sz)
                        {
                            Atime = unixTimeToFileTime(get32(extra, off + sz0));
                            sz0  += 4;
                        }
                        if ((flag & 0x4) != 0 && (sz0 + 4) <= sz)
                        {
                            Ctime = unixTimeToFileTime(get32(extra, off + sz0));
                            sz0  += 4;
                        }
                        break;

                    default:
                        break;
                    }
                    off += sz;
                }
            }
            this.Extra_Renamed = extra;
        }
Exemple #25
0
 /// <summary>
 /// Sets the creation time of the entry.
 ///
 /// <para> If set, the creation time will be stored into the extended
 /// timestamp fields of entry's {@code optional extra data}, when
 /// output to a ZIP file or ZIP file formatted stream.
 ///
 /// </para>
 /// </summary>
 /// <param name="time">
 ///         The creation time of the entry </param>
 /// <returns> This zip entry
 /// </returns>
 /// <exception cref="NullPointerException"> if the {@code time} is null
 /// </exception>
 /// <seealso cref= #getCreationTime()
 /// @since 1.8 </seealso>
 public virtual ZipEntry SetCreationTime(FileTime time)
 {
     this.Ctime = Objects.RequireNonNull(time, "creationTime");
     return(this);
 }
Exemple #26
0
 /// <summary>
 /// Sets the last access time of the entry.
 ///
 /// <para> If set, the last access time will be stored into the extended
 /// timestamp fields of entry's {@code optional extra data}, when output
 /// to a ZIP file or ZIP file formatted stream.
 ///
 /// </para>
 /// </summary>
 /// <param name="time">
 ///         The last access time of the entry </param>
 /// <returns> This zip entry
 /// </returns>
 /// <exception cref="NullPointerException"> if the {@code time} is null
 /// </exception>
 /// <seealso cref= #getLastAccessTime()
 /// @since 1.8 </seealso>
 public virtual ZipEntry SetLastAccessTime(FileTime time)
 {
     this.Atime = Objects.RequireNonNull(time, "lastAccessTime");
     return(this);
 }
Exemple #27
0
        /// <summary>
        /// Patches the file.
        /// </summary>
        /// <param name="file">The file.</param>
        public bool PatchFile(string file)
        {
            file = Path.Combine(Environment.CurrentDirectory, file);

            var fileTime = new FileTime(file);
            //var fileTimeInteropBuilder = new FileTime(Assembly.GetExecutingAssembly().Location);
            string checkFile = Path.GetFullPath(file) + ".check";
            //string checkInteropBuilderFile = "InteropBuild.check";

            // If checkFile and checkInteropBuilderFile up-to-date, then nothing to do
            if (fileTime.CheckFileUpToDate(checkFile))
            {
                Log("Nothing to do. SharpDX patch was already applied for assembly [{0}]", file);
                return false;
            }

            // Copy PDB from input assembly to output assembly if any
            var readerParameters = new ReaderParameters();
            var resolver = new DefaultAssemblyResolver();
            readerParameters.AssemblyResolver = resolver;
            var writerParameters = new WriterParameters();
            var pdbName = Path.ChangeExtension(file, "pdb");
            if (File.Exists(pdbName))
            {
                var symbolReaderProvider = new PdbReaderProvider();
                readerParameters.SymbolReaderProvider = symbolReaderProvider;
                readerParameters.ReadSymbols = true;
                writerParameters.WriteSymbols = true;
            }

            // Read Assembly
            assembly = AssemblyDefinition.ReadAssembly(file, readerParameters);
            resolver.AddSearchDirectory(Path.GetDirectoryName(file));

            // Query the target framework in order to resolve correct assemblies and type forwarding
            var targetFrameworkAttr = assembly.CustomAttributes.FirstOrDefault(
                attribute => attribute.Constructor.FullName.Contains("System.Runtime.Versioning.TargetFrameworkAttribute"));
            if(targetFrameworkAttr != null && targetFrameworkAttr.ConstructorArguments.Count > 0 &&
                targetFrameworkAttr.ConstructorArguments[0].Value != null)
            {
                var targetFramework = new FrameworkName(targetFrameworkAttr.ConstructorArguments[0].Value.ToString());

                var netcoreAssemblyPath = string.Format(@"Reference Assemblies\Microsoft\Framework\{0}\v{1}",
                    targetFramework.Identifier,
                    targetFramework.Version);
                netcoreAssemblyPath = Path.Combine(ProgramFilesx86(), netcoreAssemblyPath);
                if(Directory.Exists(netcoreAssemblyPath))
                {
                    resolver.AddSearchDirectory(netcoreAssemblyPath);
                }
            }

            // Import void* and int32 
            voidType = assembly.MainModule.TypeSystem.Void.Resolve();
            voidPointerType = new PointerType(assembly.MainModule.Import(voidType));
            intType = assembly.MainModule.Import( assembly.MainModule.TypeSystem.Int32.Resolve());

            // Remove CompilationRelaxationsAttribute
            for (int i = 0; i < assembly.CustomAttributes.Count; i++)
            {
                var customAttribute = assembly.CustomAttributes[i];
                if (customAttribute.AttributeType.FullName == typeof(CompilationRelaxationsAttribute).FullName)
                {
                    assembly.CustomAttributes.RemoveAt(i);
                    i--;
                }
            }

            Log("SharpDX interop patch for assembly [{0}]", file);
            foreach (var type in assembly.MainModule.Types)
                PatchType(type);

            // Remove All Interop classes
            foreach (var type in classToRemoveList)
                assembly.MainModule.Types.Remove(type);

            var outputFilePath = file;
            assembly.Write(outputFilePath, writerParameters);

            fileTime = new FileTime(file);
            // Update Check file
            fileTime.UpdateCheckFile(checkFile);
            //fileTimeInteropBuilder.UpdateCheckFile(checkInteropBuilderFile);
                                
            Log("SharpDX patch done for assembly [{0}]", file);
            return true;
        }
Exemple #28
0
 public static extern bool GetSystemTimes([Out] out FileTime idleTime, [Out] out FileTime kernelTime,
                                          [Out] out FileTime userTime);
Exemple #29
0
 public static DateTime FileTimeToDateTime(this FileTime input)
 => DateTime.FromFileTime(((long)input.DateTimeHigh << 32) + input.DateTimeLow);
 /// <summary>
 /// Uitility function to convert FileTime to uint64
 /// </summary>
 private static UInt64 ToUInt64(FileTime time)
 {
     return(((UInt64)time.High << 32) + time.Low);
 }
Exemple #31
0
 internal static extern uint ProcessTrace([In] ulong[] handles, [In] uint count, [In] ref FileTime start, [In] ref FileTime end);
        public bool GetLatestVersion(string vcsPath, string localProjectPath, bool buildTree, object option, bool recursive, bool makeWritable, ReplaceWriteable replaceWriteableState, FileTime fileTimeState, VcsClientBatchState batchState)
        {
            CleanUpDirectory(localProjectPath);

            Queue <Exception> exceptionQueue = new Queue <Exception>();

            vcsPath          = HelperPaths.RemoveFinishSlash(vcsPath);
            localProjectPath = HelperPaths.RemoveFinishSlash(localProjectPath);
            AutoResetEvent getDataEvent    = new AutoResetEvent(true);
            AutoResetEvent decompressEvent = new AutoResetEvent(true);
            AutoResetEvent saveEvent       = new AutoResetEvent(true);
            AutoResetEvent getBlockEvent   = new AutoResetEvent(false);
            int            magicCount;
            string         id = Service.Get(Environment.MachineName, vcsPath, option, recursive, out magicCount);

            AccessDeniedInfo[] accessList = Service.TakeAccessInfo(id);
            if (accessList != null)
            {
                string path = vcsPath.TrimEnd('/');
                foreach (AccessDeniedInfo accessInfo in accessList)
                {
                    string message = string.Format("Resources.NoGetProjectPermissions", DateTime.Now.ToString(), path, accessInfo.ObjectName);
                }
            }
            Dictionary <string, string> localPathDict = new Dictionary <string, string>(StringComparer.InvariantCultureIgnoreCase);
            bool      cancel    = false;
            int       lastMagic = 0;
            BlockInfo blockInfo = new BlockInfo();

            QueueBlock(id, getBlockEvent, blockInfo, exceptionQueue);
            List <string> pathList = new List <string>();

            try {
                while (true)
                {
                    getBlockEvent.WaitOne();
                    ProcessException(exceptionQueue);
                    if (!blockInfo.Last)
                    {
                        break;
                    }
                    int              magicPos   = blockInfo.MagicPos;
                    int              blockIndex = blockInfo.BlockIndex;
                    int[]            paths      = blockInfo.Paths;
                    FileStateInfo2[] info       = blockInfo.Info;
                    QueueBlock(id, getBlockEvent, blockInfo, exceptionQueue);
                    if (paths != null && blockIndex >= 0)
                    {
                        bool[]     restData       = new bool[paths.Length];
                        string[]   localPath      = new string[paths.Length];
                        string[]   path           = new string[paths.Length];
                        DateTime[] fileTime       = new DateTime[paths.Length];
                        bool[]     setNormal      = new bool[paths.Length];
                        bool[]     fileExists     = new bool[paths.Length];
                        bool[]     doCheckOut     = new bool[paths.Length];
                        bool       doGetData      = false;
                        bool       wasCheckOut    = false;
                        double     step           = ((double)magicPos - lastMagic) / paths.Length;
                        string     curProject     = string.Empty;
                        DateTime   curProjectDate = DateTime.MinValue;
                        for (int i = 0; i < paths.Length; i++)
                        {
                            if (info[i].IsNull)
                            {
                                string curPostProject = HelperPaths.RemoveFinishSlash(info[i].Name);
                                pathList.Add(curPostProject);
                                if (!string.IsNullOrEmpty(curPostProject))
                                {
                                    curProject = vcsPath + "/" + curPostProject;
                                }
                                else
                                {
                                    curProject = vcsPath;
                                }
                                string curLocalFolder;
                                if (buildTree)
                                {
                                    curLocalFolder = localProjectPath + @"\" + curPostProject.Replace('/', '\\');
                                }
                                else
                                {
                                    curLocalFolder = info[i].CheckOutFolder; //Hack ;)
                                }
                                curLocalFolder = HelperPaths.RemoveFinishSlash(curLocalFolder);
                                CreateDirectory(curLocalFolder);
                                localPathDict.Add(curProject, curLocalFolder);
                            }
                            else
                            {
                                string curPostProject = pathList[paths[i]];
                                string nextProject    = HelperPaths.Combine(vcsPath, curPostProject);
                                if (nextProject != curProject)
                                {
                                    curProject     = nextProject;
                                    curProjectDate = DateTime.MinValue;
                                }
                                string curLocalFolder;
                                if (localPathDict.TryGetValue(curProject, out curLocalFolder))
                                {
                                    string curFileName  = info[i].Name;
                                    string curLocalPath = curLocalFolder + @"\" + curFileName;
                                    string curPath      = curProject + "/" + curFileName;
                                    try {
                                        FileAttributes fa;
                                        DateTime       fileModification;
                                        if (fileSystem.GetAttributes(curLocalPath, out fa, out fileModification))
                                        {
                                            fileExists[i] = true;
                                            FileBaseInfoState fileState;
                                            bool needWrite = GetLocalFileModified(info[i], curLocalPath, curPath, curProjectDate, out fileState, fileModification);
                                            if (!needWrite && fileState == FileBaseInfoState.Locked)
                                            {
                                                continue;
                                            }
                                            if ((fa & FileAttributes.ReadOnly) == FileAttributes.ReadOnly)
                                            {
                                                if (needWrite)
                                                {
                                                    doGetData    = true;
                                                    restData[i]  = true;
                                                    localPath[i] = curLocalPath;
                                                    path[i]      = curPath;
                                                    fileTime[i]  = SelectFileTime(info[i], fileTimeState);
                                                }
                                                continue;
                                            }
                                            if ((makeWritable) && !needWrite)
                                            {
                                                continue;
                                            }
                                            if (batchState.ActionToExistFile.Action == ActionWithCopy.Replace)
                                            {
                                                doGetData    = true;
                                                restData[i]  = needWrite;
                                                localPath[i] = curLocalPath;
                                                path[i]      = curPath;
                                                fileTime[i]  = SelectFileTime(info[i], fileTimeState);
                                                continue;
                                            }
                                            if (batchState.ActionToExistFile.Action == ActionWithCopy.Leave)
                                            {
                                                continue;
                                            }
                                            if (batchState.ActionToExistFile.Action == ActionWithCopy.CheckOut)
                                            {
                                                localPath[i]  = curLocalPath;
                                                path[i]       = curPath;
                                                doCheckOut[i] = true;
                                                wasCheckOut   = true;
                                                setNormal[i]  = true;
                                            }
                                        }
                                        else
                                        if (fileSystem.DirectoryExists(curLocalFolder))
                                        {
                                            doGetData    = true;
                                            restData[i]  = true;
                                            localPath[i] = curLocalPath;
                                            path[i]      = curPath;
                                            bool differentHost;
                                            setNormal[i] = (makeWritable || info[i].CheckedOut) && info[i].CheckedOutMe && EqualsCheckOutParams(info[i], curLocalPath, out differentHost);
                                            fileTime[i]  = SelectFileTime(info[i], fileTimeState);
                                        }
                                    }
                                    finally {
                                        if (makeWritable)
                                        {
                                            doGetData    = true;
                                            localPath[i] = curLocalPath;
                                            setNormal[i] = true;
                                        }
                                    }
                                }
                            }
                        }
                        if (doGetData)
                        {
                            Service.GetBlockDataReq(id, blockIndex, restData);
                            getDataEvent.WaitOne();
                            getDataEvent.Set();
                            ProcessException(exceptionQueue);
                            getDataEvent.Reset();
                            QueueAll(id, blockIndex, getDataEvent, decompressEvent, saveEvent, localPath, path, fileTime, doCheckOut, setNormal, fileExists, exceptionQueue, step);
                        }
                        else
                        {
                            getDataEvent.WaitOne();
                            ProcessException(exceptionQueue);
                            getDataEvent.Set();
                        }
                        if (wasCheckOut)
                        {
                            List <string> pathToCheckOut      = new List <string>();
                            List <string> localPathToCheckOut = new List <string>();
                            List <string> commentToCheckOut   = new List <string>();
                            for (int i = 0; i < path.Length; i++)
                            {
                                if (doCheckOut[i])
                                {
                                    pathToCheckOut.Add(path[i]);
                                    localPathToCheckOut.Add(HelperPaths.GetDirectory(localPath[i]));
                                    commentToCheckOut.Add(string.Empty);
                                }
                            }
                            string checkOutId = Service.CheckOut(System.Environment.MachineName, pathToCheckOut.ToArray(), localPathToCheckOut.ToArray(), commentToCheckOut.ToArray(), null);
                            Dictionary <int, AccessDeniedInfo> accessDict = CreateAccessDict(Service.TakeAccessInfo(checkOutId));
                            for (int i = 0; i < localPathToCheckOut.Count; i++)
                            {
                                string local = HelperPaths.Combine(localPathToCheckOut[i], HelperPaths.GetFile(pathToCheckOut[i]));
                                if (accessDict == null || !accessDict.ContainsKey(i))
                                {
                                    fileSystem.SetAttributes(local, FileAttributes.Normal);
                                }
                                else
                                {
                                    string message = string.Format("Resources.NoCheckOutFilePermissions", DateTime.Now, pathToCheckOut[i]);
                                }
                            }
                        }
                        lastMagic = magicPos;
                    }
                }
            }
            finally {
                getDataEvent.WaitOne();
                decompressEvent.WaitOne();
                saveEvent.WaitOne();
                if (!cancel)
                {
                    Service.ConfirmGetEnd(id);
                }
            }
            return(true);
        }
Exemple #33
0
        //
        //	 * (non-Javadoc)
        //	 *
        //	 * @see java.lang.Runnable#run()
        //
        public virtual void Run()
        {
            while (!interrupt)
            {
                dir.Refresh();
                DateTime lastMod = dir.LastWriteTime;
                if (lastMod > lastModified || lastFileTime.Count > 0) // has the
                // directory
                // been
                // touched?
                {
                    lastModified = lastMod;
                    FileInfo[] files          = FileUtil.listFilesWithExtension(dir, extension);
                    int        fileListLength = files != null ? files.Length : 0;

                    for (int i = lastFileTime.Count - 1; i >= 0; i--)
                    {
                        bool found = false;
                        for (int j = 0; j < fileListLength; j++)
                        // loop over all matching files in the directory
                        {
                            if (files != null)
                            {
                                FileTime lftAt = lastFileTime[i];
                                if (files[j] != null && files[j].FullName.Equals(lftAt.f.FullName))
                                {
                                    found = true;
                                    if (files[j].LastWriteTime == lftAt.modified)
                                    {
                                        if (files[j].Exists)
                                        {
                                            hfl.hotFile(files[j]); // exists and stabilized - call callback
                                        }
                                        else
                                        {
                                            found = false;
                                        }
                                    }
                                    else
                                    {
                                        lftAt.modified = files[j].LastWriteTime;
                                    }

                                    files[j] = null; // this file has been processed,
                                    // remove from list for performance
                                }
                            }
                        }

                        if (!found)
                        {
                            lastFileTime.Remove(lastFileTime[i]); // not there anymore
                        }
                    }

                    if (files != null)
                    {
                        for (int i = 0; i < fileListLength; i++) // the file is new -
                        // add to list for nextr check
                        {
                            if (files[i] != null)
                            {
                                lastFileTime.Add(new FileTime(files[i]));
                            }
                        }
                    }
                }

                StatusCounter.sleep(stabilizeTime);
            }

            Thread.CurrentThread.Interrupt();
        }
Exemple #34
0
        public void FromFileTimeTest(int high, int low, long expectedTicks)
        {
            FileTime fileTime = new FileTime((uint)low, (uint)high);

            fileTime.ToDateTimeUtc().ToLocalTime().Ticks.Should().Be(expectedTicks);
        }
Exemple #35
0
 private static extern bool GetFileTime(int hFile,
                                        out FileTime lpCreationTime,
                                        out FileTime lpLastAccessTime,
                                        out FileTime lpLastWriteTime);
Exemple #36
0
 private static extern bool FileTimeToSystemTime(ref FileTime lpFileTime, ref Systime lpSystemTime);
Exemple #37
0
 DateTime SelectFileTime(FileStateInfo info, FileTime fileTimeState)
 {
     switch (fileTimeState) {
         case FileTime.CheckIn:
             return info.VersionDate;
         case FileTime.Modification:
             return info.ModifiedOn;
     }
     return DateTime.UtcNow;
 }