示例#1
0
 public EditorWindow(AbstractPackage pkg)
 {
     InitializeComponent();
     _pkg    = pkg;
     Resize += (o, e) => discUsageGraphic.Invalidate();
     LoadPackage();
 }
示例#2
0
 /// <summary>
 /// Closes the currently opened package.
 /// </summary>
 private void ClosePackage()
 {
     _pkg = null;
     listView1.Items.Clear();
     _allFiles?.Clear();
     discUsageGraphic.Invalidate();
     discUsageBar.Value = 0;
 }
示例#3
0
 static int SumVersion(AbstractPackage package)
 {
     if (package is OperatorPackage operatorPackage)
     {
         return(package.Version + operatorPackage.SubPackages.Select(SumVersion).Sum());
     }
     return(package.Version);
 }
示例#4
0
 public PackageView(AbstractPackage pkg)
 {
     InitializeComponent();
     pm               = PackageManager.GetInstance();
     children         = new List <PackageView>(0);
     currentPackage   = pkg;
     currentDirectory = currentPackage.RootDirectory;
     ResetBreadcrumbs();
     FillFileView();
 }
示例#5
0
        public PackageView(AbstractPackage pkg, PackageManager pm)
        {
            InitializeComponent();
            InitCustomComponents();

            this.pm          = pm;
            children         = new List <PackageView>(0);
            currentPackage   = pkg;
            currentDirectory = currentPackage.RootDirectory;
            filePropertyGrid.SelectedObject = currentPackage;
            ResetBreadcrumbs();
            FillFileView();
        }
示例#6
0
        public FarArchive(string path)
        {
            path         = Path.GetFullPath(path); // Workaround for GameArchives parsing directory name
            _archivePath = path;

            try
            {
                AbstractPackage pkg = PackageReader.ReadPackageFromFile(path);
                _archive = pkg as FSARPackage;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
示例#7
0
        public void Unload()
        {
            parent?.RemoveChildPackage(this);
            var childrenFixed = children.ToArray();

            foreach (var pkg in childrenFixed)
            {
                pkg.Unload();
            }
            currentPackage?.Dispose();
            currentPackage   = null;
            currentDirectory = null;
            FillFileView();
            ResetBreadcrumbs();
            (this.FindForm() as ArchiveExplorer).RemoveTab(this.Tag as TabPage);
        }
示例#8
0
        public void Unload()
        {
            parent?.RemoveChildPackage(this);
            ew?.Close();
            var childrenFixed = children.ToArray();

            foreach (var pkg in childrenFixed)
            {
                pkg.Unload();
            }
            currentPackage?.Dispose();
            currentPackage   = null;
            currentDirectory = null;
            FillFileView();
            ResetBreadcrumbs();
            OnRemoveTab?.Invoke(Tag as TabPage);
        }
示例#9
0
        public FarArchive(string path)
        {
            _archivePath = path;

            try
            {
                AbstractPackage pkg = PackageReader.ReadPackageFromFile(path);

                if (pkg is FSARPackage)
                {
                    _archive = pkg as FSARPackage;
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
示例#10
0
 private void button1_Click(object sender, EventArgs e)
 {
     try
     {
         var ekpfs = new string(Crypto.ComputeKeys(pkg.Header.content_id, passcodeTextBox.Text, 1)
                                .Select(b => (char)b).ToArray());
         package  = PackageReader.ReadPackageFromFile(pkgFile, ekpfs);
         innerPfs = PackageReader.ReadPackageFromFile(package.GetFile("/pfs_image.dat"));
         var view = new PackageView(innerPfs, PackageManager.GetInstance());
         view.Dock = DockStyle.Fill;
         filesTab.Controls.Clear();
         filesTab.Controls.Add(view);
         passcode = passcodeTextBox.Text;
     }
     catch (Exception)
     {
         MessageBox.Show("Invalid passcode!");
     }
 }
示例#11
0
 public static Tuple <long, long> GetLargestFreeBlock(this AbstractPackage pkg)
 {
     return(new Tuple <long, long>(0, 0));
 }
示例#12
0
 static bool IsLiteral(AbstractPackage header) => header.TypeId == TypeLiteral;