You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
42 lines
998 B
42 lines
998 B
using System;
|
|
using System.Collections.Generic;
|
|
using System.IO;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace apphost_extract
|
|
{
|
|
public class AppHostFile
|
|
{
|
|
private FileStream FileStream;
|
|
|
|
public AppHostFileHeader Header { get; set; }
|
|
|
|
|
|
public AppHostFile(FileStream fileStream)
|
|
{
|
|
FileStream = fileStream;
|
|
Header = new AppHostFileHeader(FileStream);
|
|
}
|
|
|
|
|
|
public static AppHostFile Open(string path)
|
|
{
|
|
if (!File.Exists(path)) Log.Fatal("File not found.");
|
|
|
|
try
|
|
{
|
|
FileStream fs = new FileStream(path, FileMode.Open, FileAccess.ReadWrite);
|
|
AppHostFile file = new AppHostFile(fs);
|
|
return file;
|
|
}
|
|
catch(Exception ex)
|
|
{
|
|
Log.Fatal($"Exception when trying to open file: {ex.Message}");
|
|
return null;
|
|
}
|
|
}
|
|
}
|
|
}
|