本文整理汇总了C#中System.IO.FileStream.Deserialize方法的典型用法代码示例。如果您正苦于以下问题:C# FileStream.Deserialize方法的具体用法?C# FileStream.Deserialize怎么用?C# FileStream.Deserialize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.IO.FileStream
的用法示例。
在下文中一共展示了FileStream.Deserialize方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Read
/// <summary>
/// Reads the collection.
/// </summary>
/// <returns>The collection with data that was written.</returns>
public MainModel Read()
{
MainModel result;
string path = Path.Combine(this.dataDirectory, entitiesNameV1 + ".xml");
if (!File.Exists(path))
{
return null;
}
using (FileStream stream = new FileStream(path, FileMode.Open, FileAccess.Read))
{
result = stream.Deserialize<MainModel>();
}
return result;
}
示例2: PlManagerHistory
/// <summary>
/// Creates a new PlanetLab manager history instance for the specified folder.
/// </summary>
/// <param name="slice">The PlanetLab slice.</param>
public PlManagerHistory(PlSlice slice)
{
// Validate the arguments.
if (null == slice) throw new ArgumentNullException("slice");
try
{
// If the file exists.
if (File.Exists(CrawlerConfig.Static.PlanetLabHistoryFileName))
{
// Load from file the list of runs.
using (FileStream file = new FileStream(CrawlerConfig.Static.PlanetLabHistoryFileName, FileMode.Open))
{
file.Deserialize<PlManagerHistory>(this);
}
}
}
catch
{
// Catch all exceptions.
}
}
示例3: GetOnTheFlyGestureDefinition
public static List<GestureToken> GetOnTheFlyGestureDefinition(Assembly assembly, string resourceName)
{
Stream stream = new FileStream(resourceName, FileMode.Open, FileAccess.Read);
if (stream != null)
return stream.Deserialize();
else
return null;
}
示例4: Open
/// <summary>
/// Opens the history run with the specified identifier.
/// </summary>
/// <param name="id">The history identifier.</param>
/// <returns>The manager history run.</returns>
public PlManagerHistoryRun Open(PlManagerHistoryId id)
{
// Open the history from the file.
using (FileStream file = new FileStream(id.FileName, FileMode.Open))
{
// Deserialize the history run.
return file.Deserialize<PlManagerHistoryRun>();
}
}