예제 #1
0
파일: rvTree.cs 프로젝트: RomVault/RVWorld
        private static void SetExpanded(RvFile pTree, bool rightClick, bool isWorking)
        {
            if (!rightClick)
            {
                pTree.Tree.SetTreeExpanded(!pTree.Tree.TreeExpanded, isWorking);
                return;
            }
            if (!isWorking)
            {
                RvTreeRow.OpenStream();
            }
            // Find the value of the first child node.
            for (int i = 0; i < pTree.ChildCount; i++)
            {
                RvFile d = pTree.Child(i);
                if (!d.IsDir || d.Tree == null)
                {
                    continue;
                }

                //Recusivly Set All Child Nodes to this value
                SetExpandedRecurse(pTree, !d.Tree.TreeExpanded, isWorking);
                break;
            }
            if (!isWorking)
            {
                RvTreeRow.CloseStream();
            }
        }
예제 #2
0
 public override EFile DatRemove()
 {
     Tree = null;
     Game = null;
     _dirDats.Clear();
     return(base.DatRemove());
 }
예제 #3
0
 public override void DatAdd(RvBase b)
 {
     Tree = ((RvDir)b).Tree;
     Game = ((RvDir)b).Game;
     if (_dirDats.Count > 0)
     {
         ReportError.SendAndShow(Resources.RvDir_SetDat_Setting_Dir_with_a_dat_list);
     }
     base.DatAdd(b);
 }
예제 #4
0
        public override void Read(BinaryReader br, List<RvDat> parentDirDats)
        {
            base.Read(br, parentDirDats);
            bool foundTree = br.ReadBoolean();
            if (foundTree)
            {
                Tree = new RvTreeRow();
                Tree.Read(br);
            }
            else
                Tree = null;

            bool foundGame = br.ReadBoolean();
            if (foundGame)
            {
                Game = new RvGame();
                Game.Read(br);
            }
            else
                Game = null;

            int count = br.ReadInt32();
            _dirDats.Clear();
            for (int i = 0; i < count; i++)
            {
                RvDat dat = new RvDat { DatIndex = i };
                dat.Read(br);
                _dirDats.Add(dat);

                string datname = TreeFullName + @"\" + dat.GetData(RvDat.DatData.DatName);
                if (datname.Length >= 9 && datname.Substring(0, 9) == @"RomVault\")
                    datname = datname.Substring(9);

                DB.Bgw.ReportProgress(0, new bgwText("Loading: " + datname));
                DB.Bgw.ReportProgress((int)br.BaseStream.Position);

            }
            if (_dirDats.Count > 0)
                parentDirDats = _dirDats;

            count = br.ReadInt32();
            _children.Clear();
            for (int i = 0; i < count; i++)
            {
                RvBase tChild = DBTypeGet.GetRvType((FileType)br.ReadByte());

                tChild.Parent = this;
                tChild.Read(br, parentDirDats);
                _children.Add(tChild);
            }

            if (DBTypeGet.isCompressedDir(FileType))
                ZipStatus = (ZipStatus)br.ReadByte();

        }
예제 #5
0
파일: rvTree.cs 프로젝트: RomVault/RVWorld
 private static void SetChecked(RvFile pTree, RvTreeRow.TreeSelect nSelection, bool isWorking, bool shiftPressed)
 {
     if (!isWorking)
     {
         RvTreeRow.OpenStream();
     }
     SetCheckedRecurse(pTree, nSelection, isWorking, shiftPressed);
     if (!isWorking)
     {
         RvTreeRow.CloseStream();
     }
 }
예제 #6
0
        private static void FindDats(RvTreeRow treeRow)
        {
            if (treeRow.DatId != null)
            {
                string localdir = treeRow.dirFullName;
                localdir = localdir.Substring(treeRow.dirFullName.Length);
                Debug.WriteLine(localdir);
                localdir = Path.Combine(_outputdir, localdir);
                ExtractZips((uint)treeRow.DatId, localdir);
                return;
            }

            List<RvTreeRow> rows = RvTreeRow.ReadTreeFromDBZipRebuild(treeRow.dirFullName);
            for (int i = 0; i < rows.Count; i++)
            {
                if (_bgw.CancellationPending)
                    return;

                Debug.WriteLine(rows[i].dirName + " : " + rows[i].dirFullName);
                if (rows[i].DatId == null)
                    continue;

                string localdir = rows[i].dirFullName;
                localdir = localdir.Substring(treeRow.dirFullName.Length);
                if (rows[i].MultiDatDir)
                    localdir = Path.Combine(localdir, rows[i].datName);
                Debug.WriteLine(localdir);
                localdir = Path.Combine(_outputdir, localdir);

                ExtractZips((uint)rows[i].DatId, localdir);
            }
        }
예제 #7
0
 public override EFile DatRemove()
 {
     Tree = null;
     Game = null;
     _dirDats.Clear();
     return base.DatRemove();
 }
예제 #8
0
 public override void DatAdd(RvBase b)
 {
     Tree = ((RvDir)b).Tree;
     Game = ((RvDir)b).Game;
     if (_dirDats.Count > 0)
         ReportError.SendAndShow(Resources.RvDir_SetDat_Setting_Dir_with_a_dat_list);
     base.DatAdd(b);
 }
예제 #9
0
        private void updateSelectedTreeRow(RvTreeRow tr)
        {
            lblDITName.Text = tr.datName;
            lblDITPath.Text = tr.dirFullName;

            if (tr.DatId != null)
            {
                RvDat tDat = new RvDat();
                tDat.DBRead((uint)tr.DatId);
                lblDITDescription.Text = tDat.Description;
                lblDITCategory.Text = tDat.Category;
                lblDITVersion.Text = tDat.Version;
                lblDITAuthor.Text = tDat.Author;
                lblDITDate.Text = tDat.Date;
            }
            else
            {
                lblDITDescription.Text = "";
                lblDITCategory.Text = "";
                lblDITVersion.Text = "";
                lblDITAuthor.Text = "";
                lblDITDate.Text = "";
            }
            lblDITRomsGot.Text = tr.RomGot.ToString("#,0");
            lblDITRomsMissing.Text = (tr.RomTotal - tr.RomGot - tr.RomNoDump).ToString("#,0");
            lblDITRomsTotal.Text = tr.RomTotal.ToString("#,0");
            lblDITRomsNoDump.Text = tr.RomNoDump.ToString("#,0");

            UpdateGameGrid(tr.DatId);
        }
예제 #10
0
 private static void SetChecked(RvFile pTree, RvTreeRow.TreeSelect nSelection)
 {
     RvTreeRow.OpenStream();
     SetCheckedRecurse(pTree, nSelection);
     RvTreeRow.CloseStream();
 }
예제 #11
0
 private void SetExpanded(RvTreeRow pTree, MouseButtons mouseB)
 {
     if (mouseB == MouseButtons.Left)
     {
         RvTreeRow.SetTreeExpanded(pTree.DirId, !pTree.Expanded);
         Setup(RvTreeRow.ReadTreeFromDB());
     }
     else
     {
         RvTreeRow.SetTreeExpandedChildren(pTree.DirId);
         Setup(RvTreeRow.ReadTreeFromDB());
     }
 }
예제 #12
0
        private void PaintTree(RvTreeRow pTree, Graphics g, Rectangle t)
        {
            int y = pTree.RTree.Top - _vScroll;

            if (pTree.RTree.IntersectsWith(t))
            {
                Pen p = new Pen(Brushes.Gray, 1) { DashStyle = DashStyle.Dot };

                string lTree = pTree.TreeBranches;
                for (int j = 0; j < lTree.Length; j++)
                {
                    int x = j * 18 - _hScroll;
                    string cTree = lTree.Substring(j, 1);
                    switch (cTree)
                    {
                        case "│":
                            g.DrawLine(p, x + 9, y, x + 9, y + 16);
                            break;

                        case "└":
                            g.DrawLine(p, x + 9, y, x + 9, y + 16);
                            g.DrawLine(p, x + 9, y + 16, x + 27, y + 16);
                            break;
                    }
                }
            }

            if (!pTree.RExpand.IsEmpty)
                if (pTree.RExpand.IntersectsWith(t))
                {
                    g.DrawImage(pTree.Expanded ? RvImages.ExpandBoxMinus : RvImages.ExpandBoxPlus, RSub(pTree.RExpand, _hScroll, _vScroll));
                }

            if (pTree.RIcon.IntersectsWith(t))
            {
                int icon;

                if (pTree.RomGot == (pTree.RomTotal - pTree.RomNoDump))
                    icon = 3;
                else if (pTree.RomGot > 0)
                    icon = 2;
                else
                    icon = 1;

                Bitmap bm;
                //if (pTree.Dat == null && pTree.DirDatCount != 1) // Directory above DAT's in Tree
                if (string.IsNullOrEmpty(pTree.datName))
                    bm = RvImages.GetBitmap("DirectoryTree" + icon);
                else
                    bm = RvImages.GetBitmap("Tree" + icon);

                if (bm != null)
                {
                    g.DrawImage(bm, RSub(pTree.RIcon, _hScroll, _vScroll));
                }
            }

            Rectangle recBackGround = new Rectangle(pTree.RText.X, pTree.RText.Y, Width - pTree.RText.X + _hScroll, pTree.RText.Height);

            if (recBackGround.IntersectsWith(t))
            {
                string thistxt = pTree.dirName;
                if (!string.IsNullOrEmpty(pTree.datName) || !string.IsNullOrEmpty(pTree.description))
                {
                    if (!string.IsNullOrEmpty(pTree.description))
                        thistxt += ": " + pTree.description;
                    else
                        thistxt += ": " + pTree.datName;
                }
                if (pTree.RomTotal > 0 || pTree.RomGot > 0 || pTree.RomNoDump > 0)
                {
                    thistxt += " ( Have: " + pTree.RomGot.ToString("#,0") + " / Missing: " + (pTree.RomTotal - pTree.RomGot - pTree.RomNoDump).ToString("#,0") + " )";
                }
                if (_lSelected == pTree)
                {
                    g.FillRectangle(new SolidBrush(Color.FromArgb(51, 153, 255)), RSub(recBackGround, _hScroll, _vScroll));
                    g.DrawString(thistxt, new Font("Microsoft Sans Serif", 8), Brushes.White, pTree.RText.Left - _hScroll, pTree.RText.Top + 1 - _vScroll);
                }
                else
                    g.DrawString(thistxt, new Font("Microsoft Sans Serif", 8), Brushes.Black, pTree.RText.Left - _hScroll, pTree.RText.Top + 1 - _vScroll);

            }
        }
예제 #13
0
        private bool CheckMouseDown(RvTreeRow pTree, int x, int y, MouseEventArgs mevent)
        {
            if (pTree.RExpand.Contains(x, y))
            {
                SetExpanded(pTree, mevent.Button);
                return true;
            }

            if (pTree.RText.Contains(x, y))
            {

                if (RvSelected != null)
                    RvSelected(pTree, mevent);

                _lSelected = pTree;
                Refresh();
                return true;
            }

            return false;
        }
예제 #14
0
 public static void SetDatZipInfo(RvTreeRow treeRow, string outputDir)
 {
     _gameId = null;
     _treeRow = treeRow;
     _outputdir = outputDir;
 }
예제 #15
0
        public override void Read(BinaryReader br, List <RvDat> parentDirDats)
        {
            base.Read(br, parentDirDats);
            bool foundTree = br.ReadBoolean();

            if (foundTree)
            {
                Tree = new RvTreeRow();
                Tree.Read(br);
            }
            else
            {
                Tree = null;
            }

            bool foundGame = br.ReadBoolean();

            if (foundGame)
            {
                Game = new RvGame();
                Game.Read(br);
            }
            else
            {
                Game = null;
            }

            int count = br.ReadInt32();

            _dirDats.Clear();
            for (int i = 0; i < count; i++)
            {
                RvDat dat = new RvDat {
                    DatIndex = i
                };
                dat.Read(br);
                _dirDats.Add(dat);

                string datname = TreeFullName + @"\" + dat.GetData(RvDat.DatData.DatName);
                if ((datname.Length >= 9) && (datname.Substring(0, 9) == @"RomVault\"))
                {
                    datname = datname.Substring(9);
                }

                DB.Bgw.ReportProgress(0, new bgwText("Loading: " + datname));
                DB.Bgw.ReportProgress((int)br.BaseStream.Position);
            }
            if (_dirDats.Count > 0)
            {
                parentDirDats = _dirDats;
            }

            count = br.ReadInt32();
            _children.Clear();
            for (int i = 0; i < count; i++)
            {
                RvBase tChild = DBTypeGet.GetRvType((FileType)br.ReadByte());

                tChild.Parent = this;
                tChild.Read(br, parentDirDats);
                _children.Add(tChild);
            }

            if (DBTypeGet.isCompressedDir(FileType))
            {
                ZipStatus = (ZipStatus)br.ReadByte();
            }
        }
예제 #16
0
 public static void SetDatZipInfo(int gameId, string outputDir)
 {
     _gameId = (uint?)gameId;
     _treeRow = null;
     _outputdir = outputDir;
 }
예제 #17
0
        private void DatSetSelected(RvTreeRow cf)
        {
            DirTree.Refresh();
            GameGrid.Rows.Clear();
            RomGrid.Rows.Clear();

            if (cf == null)
                return;

            UpdateGameGrid(cf.DatId);
        }