本文整理汇总了C#中System.IO.FileInfo.ReadBinary方法的典型用法代码示例。如果您正苦于以下问题:C# FileInfo.ReadBinary方法的具体用法?C# FileInfo.ReadBinary怎么用?C# FileInfo.ReadBinary使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.IO.FileInfo
的用法示例。
在下文中一共展示了FileInfo.ReadBinary方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: LoadAgentList
private void LoadAgentList()
{
if(agentList == null)
{
FileInfo fileInfo = new FileInfo(FilePath);
var bytes = fileInfo.ReadBinary();
agentList = FormatterMg.XMLDerObjectFromBytes(typeof( ObservableCollection<Agent>), bytes) as ObservableCollection<Agent>;
}
}
示例2: TestMethod2
public void TestMethod2()
{
FileInfo fileInfo = new FileInfo(@"T:\test.dat");
var bytes = fileInfo.ReadBinary();
FileDB db = bytes.ToObject<FileDB>();
List<domain.Order> list = db.OrderList;
}
示例3: LoadFileDB
public FileDB LoadFileDB()
{
if (db == null)
{
FileInfo fileInfo = new FileInfo(this.fileDbPath);
var bytes = fileInfo.ReadBinary();
db = FormatterMg.XMLDerObjectFromBytes(typeof(FileDB), bytes) as FileDB;
}
return db;
}
示例4: AddFile
/// <summary>
/// Adds a file to the zip file
/// </summary>
/// <param name="File">File to add</param>
/// <param name="FileInfo">File information</param>
/// <param name="Package">Package to add the file to</param>
protected virtual void AddFile(string File, FileInfo FileInfo, Package Package)
{
File.ThrowIfNullOrEmpty("File");
if (!FileInfo.Exists)
throw new ArgumentException("FileInfo does not exist");
Uri UriPath = PackUriHelper.CreatePartUri(new Uri(File, UriKind.Relative));
PackagePart PackagePart = Package.CreatePart(UriPath, System.Net.Mime.MediaTypeNames.Text.Xml, CompressionOption.Maximum);
byte[] Data = FileInfo.ReadBinary();
PackagePart.GetStream().Write(Data, 0, Data.Count());
Package.CreateRelationship(PackagePart.Uri, TargetMode.Internal, "http://schemas.microsoft.com/opc/2006/sample/document");
}