Пример #1
0
        private void CreateFileOrDirectory(rpcCracker cracker, rpcPacker packer, bool createFile)
        {
            createargs args = new createargs(cracker);

            String createPath = FileTable.LookupFileEntry(args.Where.DirHandle).Name + @"\" + args.Where.FileName;

            Console.WriteLine("Create: {0}", createPath);

            fhandle fh;

            if ((fh = FileTable.LookupFileHandle(createPath)) == null)
            {
                fh = FileTable.Add(new FileEntry(createPath));
            }

            if (createFile == true)
            {
                new FileInfo(createPath).Create().Close();
            }
            else
            {
                new DirectoryInfo(createPath).Create();
            }

            fattr attr = new fattr(fh);

            if (attr.IsFile() != createFile)
            {
                throw new System.Exception();
            }

            diropres.PackSuccess(packer, fh, attr);
        }
Пример #2
0
        private void CreateFileOrDirectory(rpcCracker cracker, rpcPacker packer, bool createFile)
        {
            createargs args = new createargs(cracker);

            String createPath = FileTable.LookupFileEntry(args.Where.DirHandle).Name + @"\" + args.Where.FileName;

            Console.WriteLine("Create: {0}", createPath);

            fhandle fh;

            if ((fh = FileTable.LookupFileHandle(createPath)) == null)
                fh = FileTable.Add(new FileEntry(createPath));

            if (createFile == true)
                new FileInfo(createPath).Create().Close();
            else
                new DirectoryInfo(createPath).Create();

            fattr attr = new fattr(fh);

            if (attr.IsFile() != createFile)
                throw new System.Exception();

            diropres.PackSuccess(packer, fh, attr);
        }