private void cmdFindRom_Click(object sender, System.EventArgs e)
        {
            //Obtenir le fichier a ouvrir
            OpenFileDialog openFile = new OpenFileDialog();

            openFile.Title           = _res.GetString("OpenDialog_OpenRomTitle");
            openFile.Filter          = _res.GetString("OpenDialog_OpenRomFilter");
            openFile.CheckFileExists = true;
            openFile.CheckPathExists = true;
            openFile.ShowDialog(this);
            string FileName = openFile.FileName;

            if (File.Exists(FileName))
            {
                if (SnesRom.isValid(FileName))
                {
                    SnesRom snes = new SnesRom(FileName);

                    //Nom du projet
                    if (!UserHaveAllReadyProjectName || txtProjectName.Text == "")
                    {
                        txtProjectName.Text = snes.RomName;
                    }

                    txtRomPath.Text = FileName;
                }
                else
                {
                    MessageBox.Show(this, this._res.GetString("InvalidSnesFile"),
                                    this._res.GetString("Erreur"),
                                    MessageBoxButtons.OK,
                                    MessageBoxIcon.Error);
                }
            }
        }
Exemplo n.º 2
0
        internal static void Show()
        {
            Application.SetHighDpiMode(HighDpiMode.SystemAware);
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            Form      = new BrowserForm();
            Form.Text = "Metal Combat: Falcon's Revenge";

            Rom.Data = Properties.Resources.Rom;

            SnesRom.Load();

            var romNode   = Form.TreeView.Nodes.Add("rom", "Metal Combat: Falcon's Revenge");
            var songsNode = romNode.Nodes.Add("songs", "Songs");

            var position = MetalCombatRom.SongTableAddress;

            Form.TreeView.AfterSelect += TreeView_AfterSelect;

            Form.ListView.View = View.Details;

            Form.ListView.DoubleClick += ListView_DoubleClick;

            Application.Run(Form);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Creation d'un projet
        /// </summary>
        /// <param name="Name">Nom du projet</param>
        /// <param name="Path">Repertoire du projet</param>
        /// <param name="RomFileName">Chemin vers le fichier rom a utilisé</param>
        /// <returns></returns>
        public bool CreateProject(string ProjectName, string Path, string RomFileName, string TBLFileName)
        {
            if (!File.Exists(RomFileName))
            {
                return(false);
            }
            if (!File.Exists(TBLFileName))
            {
                return(false);
            }

            if (SnesRom.isValid(RomFileName))
            {
                //creation  des repertoire de projet
                Directory.CreateDirectory(Path + @"\" + ProjectName);

                //Nom du fichier projet
                this._FileName = Path + @"\" + ProjectName + @"\" + ProjectName + ".vrsproj";
                string prjPath = Path + @"\" + ProjectName;
                this._Name = ProjectName;

                //Copie des fichiers repertoire de projet
                string romfilename     = System.IO.Path.GetFileName(RomFileName);
                string workromfilename = System.IO.Path.GetFileNameWithoutExtension(RomFileName) + ".work";
                string destFile        = prjPath + @"\" + romfilename;
                string destFileWork    = prjPath + @"\" + workromfilename;
                string tblfile         = prjPath + @"\" + System.IO.Path.GetFileName(TBLFileName);

                File.Copy(RomFileName, destFile, true);
                File.Copy(RomFileName, destFileWork, true);
                File.Copy(TBLFileName, tblfile, true);

                this._RomFile     = romfilename;
                this._WorkRomFile = workromfilename;

                //MD5
                SnesRom snes = new SnesRom(romfilename);
                this._InternalRomName = snes.RomName;
                this._MD5Key          = snes.MD5Hash;

                //Ajout de la TBL au projet
                TBLFile tbl = new TBLFile();
                tbl.Key          = "tbl" + Convert.ToString(this._TBLFileArray.Count);
                tbl.Name         = System.IO.Path.GetFileNameWithoutExtension(TBLFileName);
                tbl.RelativePath = System.IO.Path.GetFileName(TBLFileName);
                tbl.Default      = true;
                this._TBLFileArray.Add(tbl);

                //Enregistrement du projet
                Save();

                //Fin de la fonction
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemplo n.º 4
0
        private void button6_Click(object sender, System.EventArgs e)
        {
            //SnesRom rom = new SnesRom("ff2.smc");
            OpenFileDialog file = new OpenFileDialog();

            file.ShowDialog(this);

            if (File.Exists(file.FileName))
            {
                SnesRom rom = new SnesRom(file.FileName);
                textBox5.Text = rom.RomName;
                MessageBox.Show("Fichier SNES Valide : " + SnesRom.isValid(file.FileName).ToString());
            }
        }
Exemplo n.º 5
0
 private void button7_Click(object sender, System.EventArgs e)
 {
     MessageBox.Show(SnesRom.isValid(@"d:\cookies.txt").ToString());
 }
Exemplo n.º 6
0
        /// <summary>
        /// Charger un projet dans l'explorateur de projet
        /// </summary>
        /// <param name="FileName">Chemin du fichier a charger</param>
        /// <returns>
        /// Retourne une enumeration du type ProjectError qui
        /// dicte le type d'erreur rencontré lors du chargement
        /// </returns>
        public ProjectError LoadProject(string FileName, bool Refresh)
        {
            ProjectError returnValue = ProjectError.NoError;

            if (File.Exists(FileName))
            {
                if (!Refresh)
                {
                    //Efface le projet courrant
                    CloseProject();

                    this._FileName = FileName;

                    //Cree un nouveau projet
                    this._Projet = new Project(FileName);
                    returnValue  = this._Projet.Load();
                }
                else
                {
                    this.tvProject.Nodes.Clear();
                    returnValue = ProjectError.NoError;
                }

                //Creation des nodes pour le treeview du ProjectExplorer
                if (returnValue == ProjectError.NoError)
                {
                    tvProject.BeginUpdate();

                    //Creation des rom
                    string ProjectPath = this._Projet.ProjectPath;
                    string romPath     = ProjectPath + @"\" + this._Projet.RomFile;
                    string romWorkPath = ProjectPath + @"\" + this._Projet.WorkRomFile;

                    SnesRom snes = new SnesRom(ProjectPath + @"\" + this._Projet.RomFile);
                    snes.Load();

                    TreeNode RomNode = new TreeNode(snes.RomName);
                    RomNode.ImageIndex         = 6;
                    RomNode.SelectedImageIndex = 6;
                    RomNode.Tag = "rom";

                    snes.Load(romWorkPath);
                    TreeNode WorkRomNode = new TreeNode(snes.RomName);
                    WorkRomNode.ImageIndex         = 7;
                    WorkRomNode.SelectedImageIndex = 7;
                    WorkRomNode.Tag = "workrom";

                    //Creation des fichier Table
                    TreeNode TableNode = new TreeNode(this._String_TBL, MakeTableNode());
                    TableNode.ImageIndex         = 2;
                    TableNode.SelectedImageIndex = 2;
                    TableNode.Tag = "tbl";

                    //Creation des Fichier Texte
                    TreeNode TextNode = new TreeNode(this._String_Texte, MakeTextNodes());
                    TextNode.SelectedImageIndex = 2;
                    TextNode.ImageIndex         = 2;
                    TextNode.Tag = "text";

                    //Creation des Fichier Binaire
                    TreeNode HexaNode = new TreeNode(this._String_Hexa, MakeHexaSnapShotNode());
                    HexaNode.ImageIndex         = 2;
                    HexaNode.SelectedImageIndex = 2;
                    HexaNode.Tag = "hexasnap";

                    //Ajoute la racine au tree view
                    TreeNode[] RootChild = new TreeNode[5] {
                        RomNode, WorkRomNode, TextNode, TableNode, HexaNode
                    };
                    TreeNode root = new TreeNode(this._String_Projet + " - '" + this._Projet.Name + "'", RootChild);
                    root.ImageIndex = 0;
                    root.Tag        = "root";
                    root.Expand();
                    tvProject.Nodes.Add(root);

                    tvProject.EndUpdate();

                    //Fin de la fonction
                    return(returnValue);
                }
                else
                {
                    return(returnValue);                    //Fin de la fonction
                }
            }
            else
            {
                return(ProjectError.FileNotFound);                //Fin de la fonction
            }
        }
Exemplo n.º 7
0
        /// <summary>
        /// Obtenir l'objet selectionné
        /// (TODO : a optimiser bientot)
        /// </summary>
        /// <remarks>
        /// ExplorerNodeType.HexaFile = objet de type : VRS.Library.Projet.HexaSnapShot
        /// ExplorerNodeType.TBLFile = objet de type : VRS.Library.Projet.TBLStream
        /// ExplorerNodeType.Root = objet de type : VRS.Library.Projet.Project
        /// ExplorerNodeType.Nothing = objet de type : null
        /// </remarks>
        public object GetSelectedObject()
        {
            SnesRom snes = null;

            switch (this.SelectedItemType)
            {
            case ExplorerNodeType.HexaFile:
                HexaSnapShot hexsnap = null;
                for (int i = 0; i < this._Projet.HexaSnapShot.Count; i++)
                {
                    if (((HexaSnapShot)this._Projet.HexaSnapShot[i]).Key == tvProject.SelectedNode.Tag.ToString())
                    {
                        hexsnap = (HexaSnapShot)this.Projet.HexaSnapShot[i];
                    }
                }
                return(hexsnap);

            case ExplorerNodeType.TBLFile:
                TBLStream tbl = null;
                for (int i = 0; i < this._Projet.Tables.Count; i++)
                {
                    if (((TBLFile)this._Projet.Tables[i]).Key == tvProject.SelectedNode.Tag.ToString())
                    {
                        string path = this._Projet.ProjectPath + Path.DirectorySeparatorChar + ((TBLFile)this.Projet.Tables[i]).RelativePath;
                        tbl     = new TBLStream(path);
                        tbl.key = tvProject.SelectedNode.Tag.ToString();
                        tbl.Load();
                    }
                }
                return(tbl);

            case ExplorerNodeType.TextFile:
                TextFile txt = null;
                for (int i = 0; i < this._Projet.Textes.Count; i++)
                {
                    if (((TextFile)this._Projet.Textes[i]).key == tvProject.SelectedNode.Tag.ToString())
                    {
                        txt = (TextFile)this.Projet.Textes[i];
                    }
                }
                return(txt);

            case ExplorerNodeType.Root:
                return(this._Projet);

            case ExplorerNodeType.Folder:
                //TODO: a finir
                Folder dir = new Folder();
                return(dir);

            case ExplorerNodeType.Rom:
                snes = new SnesRom(this._Projet.ProjectPath + @"\" + this._Projet.RomFile);
                snes.Load();
                return(snes);

            case ExplorerNodeType.WorkRom:
                snes = new SnesRom(this._Projet.ProjectPath + @"\" + this._Projet.WorkRomFile);
                snes.Load();
                return(snes);

            default:
                return(null);
            }
        }