CodeBus
www.codebus.net
Search
Sign in
Sign up
Hot Search :
Source
embeded
web
remote control
p2p
game
More...
Location :
Home
Search - ASCII
Main Category
SourceCode
Documents
Books
WEB Code
Develop Tools
Other resource
Search - ASCII - List
[
Windows Kernel
]
换位密码的加密策略及程序实现
DL : 0
换位密码的加密策略及程序实现
Date
: 2008-11-18
Size
: 56kb
User
:
blakewhite
[
Windows Kernel
]
DiscUtils读写iso以及虚拟磁盘文件类库源码
DL : 1
源码包含一个读取ISO文件和虚拟磁盘文件(VHD, VDI, XVA, VMDK, etc)的类和完整的调用示例。 对于ISO、UDF、FAT和NTFS的支持已经非常完善。支持VHD, XVA, VMDK 和VDI格式的读写与注册。 类库中还包含一个简单的iSCSI启动器,可以通过iSCSI和一个NFS客户端实现对磁盘的访问。 这里有几段简单的示例代码,可以看出来使用还是非常方便的: 新建一个ISO文件: CDBuilder builder = new CDBuilder(); builder.UseJoliet = true; builder.VolumeIdentifier = "A_SAMPLE_DISK"; builder.AddFile(@"Folder\Hello.txt", Encoding.ASCII.GetBytes("Hello World!")); builder.Build(@"C:\temp\sample.iso"); 你可以通过流或者文件的方式来进行ISO的操作。 从ISO文件中提取一个文件: using (FileStream isoStream = File.Open(@"C:\temp\sample.iso")) { CDReader cd = new CDReader(isoStream, true); Stream fileStream = cd.OpenFile(@"Folder\Hello.txt", FileMode.Open); // Use fileStream... } 同样,你也可以浏览ISO内部包含的目录或者作为启动盘。 新建一个虚拟磁盘: long diskSize = 30 * 1024 * 1024; //30MB using (Stream vhdStream = File.Create(@"C:\TEMP\mydisk.vhd")) { Disk disk = Disk.InitializeDynamic(vhdStream, diskSize); BiosPartitionTable.Initialize(disk, WellKnownPartitionType.WindowsFat); using (FatFileSystem fs = FatFileSystem.FormatPartition(disk, 0, null)) { fs.CreateDirectory(@"TestDir\CHILD"); // do other things with the file system... } } 新建一个虚拟软盘: using (FileStream fs = File.Create(@"myfloppy.vfd")) { using (FatFileSystem floppy = FatFileSystem.FormatFloppy(fs, FloppyDiskType.HighDensity, "MY FLOPPY ")) { using (Stream s = floppy.OpenFile("foo.txt", FileMode.Create)) { // Use stream... } } } 也可以作为启动软盘使用。
Date
: 2017-08-11
Size
: 428.01kb
User
:
twklzw
CodeBus
is one of the largest source code repositories on the Internet!
Contact us :
1999-2046
CodeBus
All Rights Reserved.