예제 #1
0
        public bool TryCreateDirectory(string path, bool createIntermediates, NSFileAttributes attributes)
        {
            NSError error;
            var     dict = attributes == null ? null : attributes.ToDictionary();

            return(TryCreateDirectory(path, createIntermediates, dict, out error));
        }
예제 #2
0
 public void SetAttributes(NSFileAttributes attributes, string path)
 {
     if (attributes == null)
     {
         throw new ArgumentNullException("attributes");
     }
     SetAttributes(attributes.ToDictionary(), path);
 }
예제 #3
0
 public bool TrySetAttributes(NSFileAttributes attributes, string path, out NSError error)
 {
     if (attributes == null)
     {
         throw new ArgumentNullException("attributes");
     }
     return(TrySetAttributes(attributes.ToDictionary(), path, out error));
 }
예제 #4
0
        public bool SetAttributes(NSFileAttributes attributes, string path)
        {
            NSError ignore;

            if (attributes == null)
            {
                throw new ArgumentNullException("attributes");
            }

            return(SetAttributes(attributes.ToDictionary(), path, out ignore));
        }
예제 #5
0
        public NSFileAttributes GetAttributes(string path)
        {
            NSError error;
            var     result = NSFileAttributes.FromDict(_GetAttributes(path, out error));

            if (result == null)
            {
                throw new NSErrorException(error);
            }
            return(result);
        }
예제 #6
0
        internal static NSFileSystemAttributes FromDict(NSDictionary dict)
        {
            if (dict == null)
            {
                return(null);
            }
            var   ret = new NSFileSystemAttributes(dict);
            ulong l   = 0;
            uint  i   = 0;

            ret.Size      = NSFileAttributes.fetch(dict, NSFileManager.SystemSize, ref l) ? l : 0;
            ret.FreeSize  = NSFileAttributes.fetch(dict, NSFileManager.SystemFreeSize, ref l) ? l : 0;
            ret.Nodes     = NSFileAttributes.fetch(dict, NSFileManager.SystemNodes, ref l) ? (long)l : 0;
            ret.FreeNodes = NSFileAttributes.fetch(dict, NSFileManager.SystemFreeNodes, ref l) ? (long)l : 0;
            ret.Number    = NSFileAttributes.fetch(dict, NSFileManager.SystemFreeNodes, ref i) ? i : 0;

            return(ret);
        }
예제 #7
0
 public bool CreateFile(string path, NSData data, NSFileAttributes attributes)
 {
     return CreateFile (path, data, attributes.ToDictionary ());
 }
예제 #8
0
 public bool CreateDirectory(string path, bool createIntermediates, NSFileAttributes attributes)
 {
     NSError error;
     return CreateDirectory (path, createIntermediates, attributes.ToDictionary (), out error);
 }
예제 #9
0
        public static NSFileAttributes FromDict(NSDictionary dict)
        {
            if (dict == null)
                return null;
            var ret = new NSFileAttributes ();

            bool b = false;
            if (fetch (dict, NSFileManager.AppendOnly, ref b))
                ret.AppendOnly = b;
            if (fetch (dict, NSFileManager.Busy, ref b))
                ret.Busy = b;
            if (fetch (dict, NSFileManager.Immutable, ref b))
                ret.Immutable = b;
            //if (fetch (dict, NSFileManager.ProtectedFile, ref b))
            //ret.ProtectedFile = b;
            if (fetch (dict, NSFileManager.ExtensionHidden, ref b))
                ret.FileExtensionHidden = b;
            var date = dict.ObjectForKey (NSFileManager.CreationDate) as NSDate;
            if (date != null)
                ret.CreationDate = date;
            date = dict.ObjectForKey (NSFileManager.ModificationDate) as NSDate;
            if (date != null)
                ret.ModificationDate = date;
            var name = dict.ObjectForKey (NSFileManager.OwnerAccountName) as NSString;
            if (name != null)
                ret.OwnerAccountName = name.ToString ();
            uint u = 0;
            if (fetch (dict, NSFileManager.DeviceIdentifier, ref u))
                ret.DeviceIdentifier = u;
            if (fetch (dict, NSFileManager.GroupOwnerAccountID, ref u))
                ret.FileGroupOwnerAccountID = u;
            if (fetch (dict, NSFileManager.OwnerAccountID, ref u))
                ret.FileOwnerAccountID = u;
            if (fetch (dict, NSFileManager.HfsTypeCode, ref u))
                ret.HfsTypeCode = u;
            if (fetch (dict, NSFileManager.PosixPermissions, ref u))
                ret.PosixPermissions = u;
            if (fetch (dict, NSFileManager.ReferenceCount, ref u))
                ret.FileReferenceCount = u;
            if (fetch (dict, NSFileManager.SystemFileNumber, ref u))
                ret.FileSystemFileNumber = u;
            ulong l = 0;
            if (fetch (dict, NSFileManager.Size, ref l))
                ret.FileSize = l;
            return ret;
        }
예제 #10
0
 public NSFileAttributes TryGetAttributes(string path, out NSError error)
 {
     return(NSFileAttributes.FromDict(_GetAttributes(path, out error)));
 }
예제 #11
0
        public bool CreateFile(string path, NSData data, NSFileAttributes attributes)
        {
            var dict = attributes == null ? null : attributes.ToDictionary();

            return(CreateFile(path, data, dict));
        }
예제 #12
0
        public bool SetAttributes(NSFileAttributes attributes, string path)
        {
            NSError ignore;

            return(SetAttributes(attributes.ToDictionary(), path, out ignore));
        }
예제 #13
0
		public bool CreateFile (string path, NSData data, NSFileAttributes attributes)
		{
			var dict = attributes == null ? null : attributes.ToDictionary ();
			return CreateFile (path, data, dict);
		}
예제 #14
0
		public bool SetAttributes (NSFileAttributes attributes, string path)
		{
			NSError ignore;
			if (attributes == null)
				throw new ArgumentNullException ("attributes");

			return SetAttributes (attributes.ToDictionary (), path, out ignore);
		}
예제 #15
0
        public static NSFileAttributes FromDict(NSDictionary dict)
        {
            if (dict == null)
            {
                return(null);
            }
            var ret = new NSFileAttributes();

            bool b = false;

            if (fetch(dict, NSFileManager.AppendOnly, ref b))
            {
                ret.AppendOnly = b;
            }
            if (fetch(dict, NSFileManager.Busy, ref b))
            {
                ret.Busy = b;
            }
            if (fetch(dict, NSFileManager.Immutable, ref b))
            {
                ret.Immutable = b;
            }
            //if (fetch (dict, NSFileManager.ProtectedFile, ref b))
            //ret.ProtectedFile = b;
            if (fetch(dict, NSFileManager.ExtensionHidden, ref b))
            {
                ret.FileExtensionHidden = b;
            }
            var date = dict.ObjectForKey(NSFileManager.CreationDate) as NSDate;

            if (date != null)
            {
                ret.CreationDate = date;
            }
            date = dict.ObjectForKey(NSFileManager.ModificationDate) as NSDate;
            if (date != null)
            {
                ret.ModificationDate = date;
            }
            var name = dict.ObjectForKey(NSFileManager.OwnerAccountName) as NSString;

            if (name != null)
            {
                ret.OwnerAccountName = name.ToString();
            }
            uint u = 0;

            if (fetch(dict, NSFileManager.DeviceIdentifier, ref u))
            {
                ret.DeviceIdentifier = u;
            }
            if (fetch(dict, NSFileManager.GroupOwnerAccountID, ref u))
            {
                ret.FileGroupOwnerAccountID = u;
            }
            if (fetch(dict, NSFileManager.OwnerAccountID, ref u))
            {
                ret.FileOwnerAccountID = u;
            }
            if (fetch(dict, NSFileManager.HfsTypeCode, ref u))
            {
                ret.HfsTypeCode = u;
            }
            if (fetch(dict, NSFileManager.PosixPermissions, ref u))
            {
                ret.PosixPermissions = u;
            }
            if (fetch(dict, NSFileManager.ReferenceCount, ref u))
            {
                ret.FileReferenceCount = u;
            }
            if (fetch(dict, NSFileManager.SystemFileNumber, ref u))
            {
                ret.FileSystemFileNumber = u;
            }
            ulong l = 0;

            if (fetch(dict, NSFileManager.Size, ref l))
            {
                ret.FileSize = l;
            }
            return(ret);
        }
예제 #16
0
        public NSFileAttributes GetAttributes(string path)
        {
            NSError error;

            return(NSFileAttributes.FromDict(_GetAttributes(path, out error)));
        }
예제 #17
0
 public bool CreateFile(string path, NSData data, NSFileAttributes attributes)
 {
     return(CreateFile(path, data, attributes.ToDictionary()));
 }
예제 #18
0
        public bool CreateDirectory(string path, bool createIntermediates, NSFileAttributes attributes)
        {
            NSError error;

            return(CreateDirectory(path, createIntermediates, attributes.ToDictionary(), out error));
        }
예제 #19
0
 public bool SetAttributes(NSFileAttributes attributes, string path, out NSError error)
 {
     return SetAttributes (attributes.ToDictionary (), path, out error);
 }
예제 #20
0
		public bool CreateDirectory (string path, bool createIntermediates, NSFileAttributes attributes)
		{
			NSError error;
			var dict = attributes == null ? null : attributes.ToDictionary ();
			return CreateDirectory (path, createIntermediates, dict, out error);
		}
예제 #21
0
        public bool SetAttributes(NSFileAttributes attributes, string path)
        {
            NSError ignore;

            return SetAttributes (attributes.ToDictionary (), path, out ignore);
        }
예제 #22
0
 public bool SetAttributes(NSFileAttributes attributes, string path, out NSError error)
 {
     return(SetAttributes(attributes.ToDictionary(), path, out error));
 }