Example #1
0
 private PathInformation getPathInformation(string fakePath)
 {
     Trace.TraceInformation(String.Format("Searching for path {0} in members", fakePath));
     foreach (Member m in this.members)
     {
         Trace.TraceInformation(String.Format("Checking existance of object in member at {0}", m.MemberPath));
         FileSystemObjectKind objectKind = m.GetFileSystemObjectKind(fakePath);
         if (objectKind == FileSystemObjectKind.None)
         {
             continue;
         }
         string realPath = m.GetRootedPath(fakePath);
         PathInformation pathInfo = new PathInformation(m, objectKind, realPath);
         Trace.TraceInformation(String.Format("Object {0} found on member at {1}", pathInfo, pathInfo.ContainingMember.MemberPath));
         return pathInfo;
     }
     Trace.TraceInformation("Could not find object in members");
     return null;
 }
Example #2
0
 private int executeGenericFileSystemOperation(PathInformation pathInfo, bool mutableOperation, GenericFileSystemOperationDelegate operation)
 {
     return this.executeGenericPathInformationOperation(pathInfo, mutableOperation, delegate(PathInformation pInfo)
     {
         operation.Invoke();
     });
 }
Example #3
0
        private int executeGenericPathInformationOperation(PathInformation pathInfo, bool mutableOperation, GenericPathInformationOperationDelegate operation)
        {
            if (pathInfo == null)
            {
                throw new ArgumentNullException("pathInfo");
            }
            if (operation == null)
            {
                throw new ArgumentNullException("operation");
            }
            Trace.TraceInformation("Executing operation on path " + pathInfo.RealPath);

            if (mutableOperation && pathInfo.ContainingMember.ReadOnly)
            {
                Trace.TraceInformation("Attempted to modify read-only object");
                return -DokanNet.ERROR_ACCESS_DENIED;
            }

            try
            {
                operation.Invoke(pathInfo);
            }
            catch (ArgumentException e)
            {
                Trace.TraceWarning(String.Format("Operation on path {0} failed because: {1} (managed exception; no Win32 error code)", pathInfo.RealPath, e.Message));
                return -2;
            }
            catch (Exception e)
            {
                int errorCode = AufsImpl.getLastError();
                Trace.TraceWarning(String.Format("Operation on path {0} failed because: {1} (error code of {2})", pathInfo.RealPath, e.Message, errorCode));
                return errorCode;
            }
            Trace.TraceInformation("Operation completed successfully");
            return 0;
        }
Example #4
0
 private static FileSystemInfo getFileSystemInfoForPathInfo(PathInformation pathInfo)
 {
     if (pathInfo == null)
     {
         throw new ArgumentNullException("pathInfo");
     }
     switch (pathInfo.ObjectKind)
     {
         case FileSystemObjectKind.File:
             return new FileInfo(pathInfo.RealPath);
         case FileSystemObjectKind.Directory:
             return new DirectoryInfo(pathInfo.RealPath);
         default:
             return null;
     }
 }