Ejemplo n.º 1
0
        public PkgView(IFile pkg)
        {
            InitializeComponent();
            using (var s = pkg.GetStream())
                ObjectPreview(new LibOrbisPkg.PKG.PkgReader(s).ReadHeader());
            using (var s = pkg.GetStream())
                this.pkg = new PkgReader(s).ReadPkg();
            try
            {
                var package  = PackageReader.ReadPackageFromFile(pkg);
                var innerPfs = PackageReader.ReadPackageFromFile(package.GetFile("/pfs_image.dat"));
                var view     = new PackageView(innerPfs, PackageManager.GetInstance());
                view.Dock = DockStyle.Fill;
                filesTab.Controls.Add(view);
            } catch (Exception) {
                tabControl1.TabPages.Remove(filesTab);
            }

            foreach (var e in this.pkg.Metas.Metas)
            {
                var lvi = new ListViewItem(new[] {
                    e.id.ToString(),
                    string.Format("0x{0:X}", e.DataSize),
                    string.Format("0x{0:X}", e.DataOffset),
                    e.Encrypted ? "Yes" : "No",
                    e.KeyIndex.ToString(),
                });
                lvi.Tag = e;
                entriesListView.Items.Add(lvi);
            }
        }
Ejemplo n.º 2
0
        // Token: 0x0600106B RID: 4203 RVA: 0x00014918 File Offset: 0x00012B18
        public static void Serialize(Stream stream, PackageView instance)
        {
            int num = 0;

            using (MemoryStream memoryStream = new MemoryStream())
            {
                Int32Proxy.Serialize(memoryStream, instance.Bonus);
                if (instance.Items != null)
                {
                    ListProxy <int> .Serialize(memoryStream, instance.Items, new ListProxy <int> .Serializer <int>(Int32Proxy.Serialize));
                }
                else
                {
                    num |= 1;
                }
                if (instance.Name != null)
                {
                    StringProxy.Serialize(memoryStream, instance.Name);
                }
                else
                {
                    num |= 2;
                }
                DecimalProxy.Serialize(memoryStream, instance.Price);
                Int32Proxy.Serialize(stream, ~num);
                memoryStream.WriteTo(stream);
            }
        }
Ejemplo n.º 3
0
    public void OnEnable()
    {
        var packages = NugetHelper.Search();

        foreach (var package in packages)
        {
            Debug.Log("Found Package: " + package.Title);
            m_currentlyBrowsing.Add(package);
        }

        // Each editor window contains a root VisualElement object
        VisualElement root = rootVisualElement;

        // A stylesheet can be added to a VisualElement.
        // The style will be applied to the VisualElement and all of its children.
        var styleSheet = AssetDatabase.LoadAssetAtPath <StyleSheet>("Assets/CPM/Scripts/Editor/ConvergePackageManager.uss");

        root.styleSheets.Add(styleSheet);

        BindToolbar();
        BindTwoPaneSplitView();
        BindBrowseList();
        BindPackageView();

        m_packageView = rootVisualElement.Query <PackageView>("package-view").First();
    }
Ejemplo n.º 4
0
        public ActionResult Package()
        {
            PackageView PaV = new PackageView
            {
                Packages = PaF.GetAllPakage(),
                json     = JObject.Parse(FT.LoadFile(Request.PhysicalApplicationPath + "/ServerData/Pages.json"))
            };

            return(View(PaV));
        }
Ejemplo n.º 5
0
        public PackageView Details(int id)
        {
            PackageView pv = GetById(id);

            if (pv.Name == null)
            {
            }

            return(pv);
        }
Ejemplo n.º 6
0
 public ActionResult AddPackage(PackageView model)
 {
     if (ModelState.IsValid)
     {
         prepo.AddPackage(model);
         var pb = new PackageBusiness();
         return(RedirectToAction("AddPackageBenefits", new { packID = pb.GetByName(model.Name).PackageId }));
     }
     return(View(model));
 }
Ejemplo n.º 7
0
 public void UpdatePackage(PackageView model)
 {
     using (var prepo = new PackageRepository())
     {
         Package p = prepo.GetById(model.PackageId);
         if (p != null)
         {
             p.Name           = model.Name;
             p.PremiumAmount  = model.PremiumAmount;
             p.maxBeneficiary = model.maxBeneficiary;
             prepo.Update(p);
         }
     }
 }
Ejemplo n.º 8
0
        public PackageView GetNovelPackage(Constants.PackageType packageType, int novelId)
        {
            PackageView result = null;

            if (novelId > 0)
            {
                using (var conn = DbConnection(DbOperation.Read))
                {
                    var repo = new Repository.PackageRepo(conn);
                    result = repo.GetNovelPackage(packageType, novelId);
                }
            }

            return(result);
        }
Ejemplo n.º 9
0
 //Packages
 public void AddPackage(PackageView model)
 {
     using (var prepo = new PackageRepository())
     {
         var pack = new Package();
         {
             if (GetByName(model.Name).Name == null)
             {
                 pack.Name           = model.Name;
                 pack.PremiumAmount  = model.PremiumAmount;
                 pack.maxBeneficiary = model.maxBeneficiary;
                 prepo.Insert(pack);
             }
         };
     }
 }
Ejemplo n.º 10
0
        public PackageView GetById(int id)
        {
            using (var b = new PackageRepository())
            {
                Package pack  = b.GetById(id);
                var     model = new PackageView();

                if (pack != null)
                {
                    model.PackageId      = pack.packageID;
                    model.Name           = pack.Name;
                    model.PremiumAmount  = pack.PremiumAmount;
                    model.maxBeneficiary = pack.maxBeneficiary;
                }
                return(model);
            }
        }
Ejemplo n.º 11
0
        // Token: 0x0600106C RID: 4204 RVA: 0x000149C4 File Offset: 0x00012BC4
        public static PackageView Deserialize(Stream bytes)
        {
            int         num         = Int32Proxy.Deserialize(bytes);
            PackageView packageView = new PackageView();

            packageView.Bonus = Int32Proxy.Deserialize(bytes);
            if ((num & 1) != 0)
            {
                packageView.Items = ListProxy <int> .Deserialize(bytes, new ListProxy <int> .Deserializer <int>(Int32Proxy.Deserialize));
            }
            if ((num & 2) != 0)
            {
                packageView.Name = StringProxy.Deserialize(bytes);
            }
            packageView.Price = DecimalProxy.Deserialize(bytes);
            return(packageView);
        }
Ejemplo n.º 12
0
        public PkgView(IFile pkgFile)
        {
            InitializeComponent();
            this.pkgFile = pkgFile;
            using (var s = pkgFile.GetStream())
                ObjectPreview(new LibOrbisPkg.PKG.PkgReader(s).ReadHeader());
            using (var s = pkgFile.GetStream())
                pkg = new PkgReader(s).ReadPkg();
            try
            {
                var dk3    = Crypto.RSA2048Decrypt(pkg.EntryKeys.Keys[3].key, RSAKeyset.PkgDerivedKey3Keyset);
                var iv_key = Crypto.Sha256(
                    pkg.ImageKey.meta.GetBytes()
                    .Concat(dk3)
                    .ToArray());
                var imageKeyDecrypted = pkg.ImageKey.FileData.Clone() as byte[];
                Crypto.AesCbcCfb128Decrypt(
                    imageKeyDecrypted,
                    imageKeyDecrypted,
                    imageKeyDecrypted.Length,
                    iv_key.Skip(16).Take(16).ToArray(),
                    iv_key.Take(16).ToArray());
                var ekpfs    = Crypto.RSA2048Decrypt(imageKeyDecrypted, RSAKeyset.FakeKeyset);
                var package  = PackageReader.ReadPackageFromFile(pkgFile, new string(ekpfs.Select(b => (char)b).ToArray()));
                var 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);
            } catch (Exception) {
            }

            foreach (var e in pkg.Metas.Metas)
            {
                var lvi = new ListViewItem(new[] {
                    e.id.ToString(),
                    string.Format("0x{0:X}", e.DataSize),
                    string.Format("0x{0:X}", e.DataOffset),
                    e.Encrypted ? "Yes" : "No",
                    e.KeyIndex.ToString(),
                });
                lvi.Tag = e;
                entriesListView.Items.Add(lvi);
            }
        }
Ejemplo n.º 13
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!");
     }
 }
Ejemplo n.º 14
0
        private void ReopenFileView()
        {
            if (!pkg.CheckEkpfs(ekpfs))
            {
                return;
            }

            var package = PackageReader.ReadPackageFromFile(pkgFile, new string(ekpfs.Select(b => (char)b).ToArray()));

            closePkg = () => package.Dispose();
            var innerPfs = PackageReader.ReadPackageFromFile(package.GetFile("/pfs_image.dat"));

            closePkg = () => { innerPfs.Dispose(); package.Dispose(); };
            var view = new PackageView(innerPfs, PackageManager.GetInstance());

            view.Dock = DockStyle.Fill;
            filesTab.Controls.Clear();
            filesTab.Controls.Add(view);
        }
Ejemplo n.º 15
0
        public PackageView GetByName(string name)
        {
            using (var b = new PackageRepository())
            {
                var model = new PackageView();

                foreach (Package pack in b.GetAll())
                {
                    if (pack.Name == name)
                    {
                        model.PackageId      = pack.packageID;
                        model.Name           = pack.Name;
                        model.PremiumAmount  = pack.PremiumAmount;
                        model.maxBeneficiary = pack.maxBeneficiary;
                    }
                }

                return(model);
            }
        }
Ejemplo n.º 16
0
 public ActionResult Edit(PackageView model)
 {
     prepo.UpdatePackage(model);
     return(RedirectToAction("GetAll"));
 }