public BarPageHandler(String parentName, BarFile file) { Console.WriteLine("DEBUG > BarPageHandler > Processing file..."); FileName = parentName; BarFileLoaded = file; MemOffset = getFileAddress(); Console.WriteLine("DEBUG > BarPageHandler > File processed!"); }
public BarPage(String parentName, BarFile file) { Console.WriteLine("DEBUG > BarPage > Subfile: " + file.Name); handler = new BarPageHandler(parentName, file); DataContext = handler; if (parentName != null) { hideExportForSubfile(); } InitializeComponent(); }
public async static Task <BarViewModel> Load(string filename, bool doCRC32) { BarViewModel barViewModel = new BarViewModel(); barViewModel.extractingState = 0; barViewModel.barFilePath = filename; barViewModel.IsCRC32Checked = doCRC32; barViewModel.barFile = await BarFile.Load(filename, doCRC32); barViewModel.ResetProgress(); barViewModel.entriesCollection = new CollectionViewSource(); barViewModel.entriesCollection.Source = barViewModel.barFile.BarFileEntrys; barViewModel.entriesCollection.Filter += barViewModel.Filter; return(barViewModel); }
/// <summary> /// Add parts to the entity. /// </summary> private void AddParts(MultipartEntity entity, string command, string barFilePath, bool includePackageId, bool includePackageName, string packageId) { entity.AddBody(new StringBody(PartEncoding, "command", command)); if (barFilePath != null) { entity.AddBody(new FileBody("file", Path.GetFileName(barFilePath), new FileInfo(barFilePath), "application/zip")); } if (includePackageId || includePackageName) { string name = null; if (packageId == null) { if (barFilePath == null) { throw new ArgumentNullException("barFilePath"); } var barFile = new BarFile(barFilePath); packageId = barFile.Manifest.PackageId; name = barFile.Manifest.PackageName; } if (includePackageId) { if (packageId == null) { throw new ArgumentException("Missing Package-Id"); } entity.AddBody(new StringBody(PartEncoding, "package_id", packageId)); } if (includePackageName || (name != null)) { if (name == null) { throw new ArgumentException("Missing Package-Name"); } entity.AddBody(new StringBody(PartEncoding, "package_name", name)); } } }
public static async Task <BarViewModel> Create(string rootFolder, uint version) { BarViewModel barViewModel = new BarViewModel(); barViewModel.extractingState = 0; var filename = rootFolder; if (rootFolder.EndsWith(Path.DirectorySeparatorChar.ToString())) { filename = rootFolder.Substring(0, rootFolder.Length - 1); } barViewModel.IsCRC32Checked = true; barViewModel.barFilePath = filename + ".bar"; barViewModel.barFile = await BarFile.Create(rootFolder, version); barViewModel.entriesCollection = new CollectionViewSource(); barViewModel.ResetProgress(); barViewModel.entriesCollection.Source = barViewModel.barFile.BarFileEntrys; barViewModel.entriesCollection.Filter += barViewModel.Filter; return(barViewModel); }