当前位置: 首页>>代码示例>>C#>>正文


C# FilePermissions类代码示例

本文整理汇总了C#中FilePermissions的典型用法代码示例。如果您正苦于以下问题:C# FilePermissions类的具体用法?C# FilePermissions怎么用?C# FilePermissions使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


FilePermissions类属于命名空间,在下文中一共展示了FilePermissions类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ReadFrom

        public virtual int ReadFrom(byte[] buffer, int offset)
        {
            DescriptorTag = Utilities.ToStruct<DescriptorTag>(buffer, offset);
            InformationControlBlock = Utilities.ToStruct<InformationControlBlock>(buffer, offset + 16);
            Uid = Utilities.ToUInt32LittleEndian(buffer, offset + 36);
            Gid = Utilities.ToUInt32LittleEndian(buffer, offset + 40);
            Permissions = (FilePermissions)Utilities.ToUInt32LittleEndian(buffer, offset + 44);
            FileLinkCount = Utilities.ToUInt16LittleEndian(buffer, offset + 48);
            RecordFormat = buffer[offset + 50];
            RecordDisplayAttributes = buffer[offset + 51];
            RecordLength = Utilities.ToUInt16LittleEndian(buffer, offset + 52);
            InformationLength = Utilities.ToUInt64LittleEndian(buffer, offset + 56);
            LogicalBlocksRecorded = Utilities.ToUInt64LittleEndian(buffer, offset + 64);
            AccessTime = UdfUtilities.ParseTimestamp(buffer, offset + 72);
            ModificationTime = UdfUtilities.ParseTimestamp(buffer, offset + 84);
            AttributeTime = UdfUtilities.ParseTimestamp(buffer, offset + 96);
            Checkpoint = Utilities.ToUInt32LittleEndian(buffer, offset + 108);
            ExtendedAttributeIcb = Utilities.ToStruct<LongAllocationDescriptor>(buffer, offset + 112);
            ImplementationIdentifier = Utilities.ToStruct<ImplementationEntityIdentifier>(buffer, offset + 128);
            UniqueId = Utilities.ToUInt64LittleEndian(buffer, offset + 160);
            ExtendedAttributesLength = Utilities.ToInt32LittleEndian(buffer, offset + 168);
            AllocationDescriptorsLength = Utilities.ToInt32LittleEndian(buffer, offset + 172);
            AllocationDescriptors = Utilities.ToByteArray(buffer, offset + 176 + ExtendedAttributesLength, AllocationDescriptorsLength);

            byte[] eaData = Utilities.ToByteArray(buffer, offset + 176, ExtendedAttributesLength);
            ExtendedAttributes = ReadExtendedAttributes(eaData);

            return (int)(176 + ExtendedAttributesLength + AllocationDescriptorsLength);
        }
开发者ID:JGTM2016,项目名称:discutils,代码行数:29,代码来源:FileEntry.cs

示例2: Create

		public static Handle Create (string uri, OpenMode mode, bool exclusive, FilePermissions perm, int priority, AsyncCallback callback)
		{
			IntPtr handle = IntPtr.Zero;
			AsyncCallbackWrapper wrapper = new AsyncCallbackWrapper (callback, null);
			gnome_vfs_async_create (out handle, uri, mode, exclusive, (uint)perm, priority, wrapper.NativeDelegate, IntPtr.Zero);
			return new Handle (handle);
		}
开发者ID:directhex,项目名称:xamarin-gnome-sharp2,代码行数:7,代码来源:Async.cs

示例3: FromUnixPermissionString

		public static FilePermissions FromUnixPermissionString (string value)
		{
			if (value == null)
				throw new ArgumentNullException ("value");
			if (value.Length != 9 && value.Length != 10)
				throw new ArgumentException ("value", "must contain 9 or 10 characters");

			int i = 0;
			FilePermissions perms = new FilePermissions ();

			if (value.Length == 10) {
				perms |= GetUnixPermissionDevice (value [i]);
				++i;
			}

			perms |= GetUnixPermissionGroup (
				value [i++], FilePermissions.S_IRUSR,
				value [i++], FilePermissions.S_IWUSR,
				value [i++], FilePermissions.S_IXUSR,
				's', 'S', FilePermissions.S_ISUID);

			perms |= GetUnixPermissionGroup (
				value [i++], FilePermissions.S_IRGRP,
				value [i++], FilePermissions.S_IWGRP,
				value [i++], FilePermissions.S_IXGRP,
				's', 'S', FilePermissions.S_ISGID);

			perms |= GetUnixPermissionGroup (
				value [i++], FilePermissions.S_IROTH,
				value [i++], FilePermissions.S_IWOTH,
				value [i++], FilePermissions.S_IXOTH,
				't', 'T', FilePermissions.S_ISVTX);

			return perms;
		}
开发者ID:calumjiao,项目名称:Mono-Class-Libraries,代码行数:35,代码来源:NativeConvert.Original.cs

示例4: Create

		public UnixStream Create (FilePermissions mode)
		{
			int fd = Syscall.creat (FullPath, mode);
			if (fd < 0)
				UnixMarshal.ThrowExceptionForLastError ();
			base.Refresh ();
			return new UnixStream (fd);
		}
开发者ID:jjenki11,项目名称:blaze-chem-rendering,代码行数:8,代码来源:UnixFileInfo.cs

示例5: Create

		public static Handle Create (Uri uri, OpenMode mode, bool exclusive, FilePermissions perm)
		{
			IntPtr handle = IntPtr.Zero;
			Result result = gnome_vfs_create_uri (out handle, uri.Handle, mode, exclusive, (uint)perm);
			if (result != Result.Ok) {
				Vfs.ThrowException (uri, result);
				return null;
			} else {
				return new Handle (handle);
			}
		}
开发者ID:directhex,项目名称:xamarin-gnome-sharp2,代码行数:11,代码来源:Sync.cs

示例6: CreateDirectory

        public void CreateDirectory(string path, FilePermissions permissions, Action<UvArgs> callback = null)
        {
            IntPtr req = IntPtr.Zero;

            try
            {
                req = this.CreateRequest();
                CheckError(Uvi.uv_fs_mkdir(this.Loop.Handle, req, path, (int)permissions, _mkdirDelegate));
                _mkdirCallback = new UvCallback(this, callback);
            }
            catch (Exception)
            {
                this.FreeRequest(req);
                throw;
            }
        }
开发者ID:gigi81,项目名称:sharpuv,代码行数:16,代码来源:Filesystem.cs

示例7: ToFilePermissions

		private static extern int ToFilePermissions (UInt32 value, out FilePermissions rval);
开发者ID:Profit0004,项目名称:mono,代码行数:1,代码来源:NativeConvert.generated.cs

示例8: CreateDirectory

 /// <summary>
 /// Creates the directory. Both normal and meta directories are created.
 /// </summary>
 /// <param name="path">The path.</param>
 /// <param name="mode">The mode.</param>
 public override Errno CreateDirectory(string path, FilePermissions mode)
 {
     var result = base.CreateDirectory(path, mode);
       if (result != 0) {
     // First directory creation unsuccessful. No need to create the 2nd one.
     return result;
       } else {
     var metaPath = _pathFactory.CreateVirtualPath(new VirtualRawPath(path),
       PathFactory.FilesysOp.Read);
     result = base.CreateDirectory(metaPath.PathString, mode);
     if (result != 0) {
       Logger.WriteLineIf(LogLevel.Error, _log_props, string.Format(
     "Error occurred while creating {0}. Removing {1}... (Virtual paths)",
     metaPath.PathString, path));
       // Error in the 2nd creation. Delete the first one.
       base.RemoveDirectory(path);
     }
     return result;
       }
 }
开发者ID:xujyan,项目名称:hurricane,代码行数:25,代码来源:RedirectFSHelper.cs

示例9: Create

		public static UnixStream Create (string path, FilePermissions mode)
		{
			int fd = Syscall.creat (path, mode);
			if (fd < 0)
				UnixMarshal.ThrowExceptionForLastError ();
			return new UnixStream (fd);
		}
开发者ID:jjenki11,项目名称:blaze-chem-rendering,代码行数:7,代码来源:UnixFile.cs

示例10: GetSymbolicMode

		// Implement the GNU ls(1) permissions spec; see `info coreutils ls`,
		// section 10.1.2, the `-l' argument information.
		private static char GetSymbolicMode (FilePermissions value, 
			FilePermissions xbit, char both, char setonly, FilePermissions setxbit)
		{
			bool is_x  = UnixFileSystemInfo.IsSet (value, xbit);
			bool is_sx = UnixFileSystemInfo.IsSet (value, setxbit);
			
			if (is_x && is_sx)
				return both;
			if (is_sx)
				return setonly;
			if (is_x)
				return 'x';
			return '-';
		}
开发者ID:calumjiao,项目名称:Mono-Class-Libraries,代码行数:16,代码来源:NativeConvert.Original.cs

示例11: ToUnixPermissionString

		// Create ls(1) drwxrwxrwx permissions display
		public static string ToUnixPermissionString (FilePermissions value)
		{
			char [] access = new char[] {
				'-',            // device
				'-', '-', '-',  // owner
				'-', '-', '-',  // group
				'-', '-', '-',  // other
			};
			bool have_device = true;
			switch (value & FilePermissions.S_IFMT) {
				case FilePermissions.S_IFDIR:   access [0] = 'd'; break;
				case FilePermissions.S_IFCHR:   access [0] = 'c'; break;
				case FilePermissions.S_IFBLK:   access [0] = 'b'; break;
				case FilePermissions.S_IFREG:   access [0] = '-'; break;
				case FilePermissions.S_IFIFO:   access [0] = 'p'; break;
				case FilePermissions.S_IFLNK:   access [0] = 'l'; break;
				case FilePermissions.S_IFSOCK:  access [0] = 's'; break;
				default:                        have_device = false; break;
			}
			SetUnixPermissionGroup (value, access, 1, 
				FilePermissions.S_IRUSR, FilePermissions.S_IWUSR, FilePermissions.S_IXUSR,
				's', 'S', FilePermissions.S_ISUID);
			SetUnixPermissionGroup (value, access, 4, 
				FilePermissions.S_IRGRP, FilePermissions.S_IWGRP, FilePermissions.S_IXGRP,
				's', 'S', FilePermissions.S_ISGID);
			SetUnixPermissionGroup (value, access, 7, 
				FilePermissions.S_IROTH, FilePermissions.S_IWOTH, FilePermissions.S_IXOTH,
				't', 'T', FilePermissions.S_ISVTX);
			return have_device 
				? new string (access)
				: new string (access, 1, 9);
		}
开发者ID:calumjiao,项目名称:Mono-Class-Libraries,代码行数:33,代码来源:NativeConvert.Original.cs

示例12: open

 public static void open(string path, OpenFlags flags, FilePermissions mode, Action<int, int> callback)
 {
     eio_open (path, flags, mode, 0, openCB, GCHandle.ToIntPtr (GCHandle.Alloc (callback)));
 }
开发者ID:aaronfeng,项目名称:manos,代码行数:4,代码来源:Libeio.cs

示例13: FromFilePermissions

		public static UInt32 FromFilePermissions (FilePermissions value)
		{
			UInt32 rval;
			if (FromFilePermissions (value, out rval) == -1)
				ThrowArgumentException (value);
			return rval;
		}
开发者ID:Profit0004,项目名称:mono,代码行数:7,代码来源:NativeConvert.generated.cs

示例14: TryFromFilePermissions

		public static bool TryFromFilePermissions (FilePermissions value, out UInt32 rval)
		{
			return FromFilePermissions (value, out rval) == 0;
		}
开发者ID:Profit0004,项目名称:mono,代码行数:4,代码来源:NativeConvert.generated.cs

示例15: OnCreateDirectory

        protected override Errno OnCreateDirectory(string directory, FilePermissions mode)
        {
            Logging.Write("In OnCreateDirectory (" + directory + ")");

            //	Determine which node this will be a sub-node of.
            string npath = directory.Substring(0, directory.LastIndexOf("/") + 1);
            Logging.Write("NodePath: " + npath);

            int parentnodeid = SoundCloudFS.FileTree.Node.FindNode(npath);
            Logging.Write("ParentNodeID: " + parentnodeid.ToString());

            if(parentnodeid < 0) { return Errno.ENOENT; }

            string newnodename = directory.Substring(directory.LastIndexOf('/') + 1);
            int newnodeid = Engine.FSNodes[parentnodeid].AddSubNode(newnodename);
            Engine.FSNodes[newnodeid].NodeType = SoundCloudFS.FileTree.Node.NodeTypeTree;

            Logging.Write("Created Directory, newnodeid: " + newnodeid.ToString());
            //return base.OnCreateDirectory (directory, mode);

            if(Engine.Config.AutoSaveNodes)
            {
                SoundCloudFS.FileTree.Node.SaveNodes();
            }

            return 0;
        }
开发者ID:gurudvlp,项目名称:SoundCloudFS,代码行数:27,代码来源:FS.cs


注:本文中的FilePermissions类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。