private void button19_Click(object sender, System.EventArgs e) { TBLStream tbl = new TBLStream("ff2.tbl"); tbl.Load(); propertyGrid1.SelectedObject = tbl; }
private void button1_Click(object sender, System.EventArgs e) { TBLStream tbl = new TBLStream(); tbl.Load(@"C:\Programmation\FINAL FANTASY 2 - vrsprojet\Final Fantasy 2 us.tbl"); ItemPanel.SuspendLayout(); //Vide le tableau ItemPanel.Controls.Clear(); TableFixeEntry[] entry = new TableFixeEntry[50]; long HexaPos = 492041; //temp var for (int i = 50 - 1; i > -1; i--) { entry[i] = new TableFixeEntry(); entry[i].Length = 9; entry[i].Position = HexaPos; entry[i].FileName = @"C:\Programmation\FINAL FANTASY 2 - vrsprojet\Final Fantasy 2 - Version 1.1 (US).smc"; entry[i].TBL = tbl; HexaPos = entry[i].NextPosition; entry[i].Decode(); entry[i].Dock = DockStyle.Top; } ItemPanel.Controls.AddRange(entry); ItemPanel.ResumeLayout(); ItemPanel.AutoScrollMinSize = new Size(0, this.Height - 100); }
/// <summary> /// Enregistre la TBL /// </summary> /// <param name="filename">Nom du fichier</param> public void Save(string filename) { TBLStream tbl = new TBLStream(filename); TBLEntry entry = null; for (int i = ItemPanel.Controls.Count; i > 0; i--) { entry = (TBLEntry)ItemPanel.Controls[i - 1]; tbl.Add(new DTE(entry.Entry, entry.Value)); } tbl.Save(); }
private void cmdCreateProject_Click(object sender, System.EventArgs e) { if (txtProjectBaseFolder.Text != "" && txtProjectName.Text != "" && txtRomPath.Text != "" && txtTBLPath.Text != "") { //Ferme le projet presentement ouvert dans FormMain this._mainDialog._ProjetExplorer.CloseProject(); //Creation d'un projet Project projet = new Project(); projet.CreateProject(this.txtProjectName.Text, this.txtProjectBaseFolder.Text, this.txtRomPath.Text, this.txtTBLPath.Text); //Ajout des favoris if (this._UseTBLBookMark) { TBLStream tbl = new TBLStream(this.txtTBLPath.Text); tbl.Load(); Favoris fav; for (int i = 0; i < tbl.BookMark.Count; i++) { fav = (Favoris)tbl.BookMark[i]; fav.File = Path.GetFileName(this.txtRomPath.Text); fav.Key = "mark" + projet.Favoris.Count; projet.Favoris.Add(fav); } projet.Save(); } //ouverture du projet dans l'explorateur de projet this._mainDialog.OpenProject(projet.FileName); //Fermeture de la boite de dialogue this.Close(); } else { MessageBox.Show(this, this._res.GetString("FormNewProjet_CreateEnterAllInfo"), this._res.GetString("Erreur"), MessageBoxButtons.OK, MessageBoxIcon.Information); } }
public void LoadFile(string filename) { //Creation l'objet TBL TBLStream myTBL = new TBLStream(); //Charger la table if (myTBL.Load(filename)) { //Vide la liste //lvTable.Items.Clear(); this._filename = filename; //this._FileName = FileName; this.ItemPanel.SuspendLayout(); //remplir la list TBLEntry[] entry = new TBLEntry[myTBL.Length]; int j = 0; //for (int i=0; i< myTBL.Length; i++ ){ for (int i = myTBL.Length - 1; i > -1; i--) { entry[i] = new TBLEntry(); //Dock TOP pour un auto resize entry[i].Dock = DockStyle.Top; //Remplir le control entry[i].Entry = myTBL[j].Entry; entry[i].Value = myTBL[j].Value; entry[i].Type = myTBL[j].Type; //Creation du tag pour la recherche entry[i].Tag = "entry" + this.ItemPanel.Controls.Count; j++; } this.ItemPanel.Controls.AddRange(entry); this.ItemPanel.ResumeLayout(); AddItem("", ""); this.OnResize(EventArgs.Empty); } }
private void cmdFindTBL_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_OpenTBLFilter"); openFile.CheckFileExists = true; openFile.CheckPathExists = true; openFile.ShowDialog(this); string FileName = openFile.FileName; if (File.Exists(FileName)) { TBLStream tbl = new TBLStream(FileName); tbl.Load(); this._UseTBLBookMark = false; if (tbl.Length > 0) { txtTBLPath.Text = FileName; if (tbl.BookMark.Count > 0) { if (MessageBox.Show(this, this._res.GetString("FormNewProjet_TBLHaveBookMark"), App.Name, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { this._UseTBLBookMark = true; } else { this._UseTBLBookMark = false; } } } else { MessageBox.Show(this, this._res.GetString("InvalidTBLFile"), this._res.GetString("Erreur"), MessageBoxButtons.OK, MessageBoxIcon.Error); } } }
/// <summary> /// Charger un fichier dans le control avec un Table de jeu (TBL) /// </summary> /// <param name="Filename">Chemin vers le fichier ROM(path)</param> /// <param name="TBLFileName">Chemin vers le fichier TBL(path)</param> public void LoadFile(string Filename, string TBLFileName) { if (File.Exists(Filename)) { FileInfo fi = new FileInfo(Filename); this._FileName = Filename; this._isLoaded = true; sbValue.Maximum = (int)fi.Length; this._FileLen = fi.Length; if (File.Exists(TBLFileName)) { this._TBL = new TBLStream(TBLFileName); this._TBL.Load(); this._isUseTBL = true; } LoadPosition("0"); } }
private void button1_Click(object sender, System.EventArgs e) { listBox1.Items.Clear(); TBLStream myTBL = new TBLStream(); //Chargement de la TBL myTBL.Load(@"e:\ff2.tbl"); this.Text = "" + myTBL.Length; //Total d'entre //myTBL[1].Entry = "33"; // modification pour tester l'indexer //remplir la list for (int i = 0; i < myTBL.Length; i++) { if (myTBL[i].Type != DTEType.EndBlock && myTBL[i].Type != DTEType.EndLine) { listBox1.Items.Add(myTBL[i].Entry + "=" + myTBL[i].Value); } else { listBox1.Items.Add(myTBL[i].Entry); } } //enregistrer dans un autre fichier myTBL.Save(@"e:\test.txt"); //total de DTE this.Text = Convert.ToString(myTBL.TotalASCII); //Cleen object myTBL.Dispose(); }
private void ExtractString(int MinTaille, long StartPos, long StopPos, short Performance, string FindString) { if (File.Exists(this._FileName)) { if (File.Exists(tblCombo1.SelectedItem.Tag.ToString())) { //Vide la liste de rechercher lvFind.Items.Clear(); //Ouverture du fichier FileInfo info = new FileInfo(this._FileName); HexEdit.Load(ref this._FileName, (int)info.Length); TBLStream tbl = new TBLStream(tblCombo1.SelectedItem.Tag.ToString()); tbl.Load(); int ChunkSize = Performance * 10000; long DataLen = StopPos - StartPos; if (DataLen > 0) { int i = (int)StartPos; pb.Maximum = (int)DataLen; string buffer = ""; string[] bufferSplittedHexa; string dte = ""; string str = ""; long StrPos = 0; //Commancement de la recherche des chaine do { if (this._Cancel) { break; } buffer = HexEdit.GetDataChunk(i); bufferSplittedHexa = Convertir.StringHexa_LittleEndian(buffer, true).Trim().Split(new char[] { ' ' }); for (int j = 0; j < bufferSplittedHexa.Length; j++) { dte = tbl.FindTBLMatch(bufferSplittedHexa[j]); if (dte != "#") { str += dte; } else { if (str.IndexOf(FindString, 0) != -1) { if (str.Length >= MinTaille) { ListViewItem item = new ListViewItem(Convertir.DecimalToHexa(StrPos)); item.SubItems.Add(str); lvFind.Items.Add(item); } } str = ""; StrPos = i + j + 1; } if ((i + j) > DataLen) { break; } if (j % 10000 == 0) { pb.Value = i + j; } } //Assignation i += ChunkSize; }while(i < DataLen); //Reinitialise a 0 this.pb.Value = 0; this._Cancel = false; tbButtonFind.Enabled = true; tblButtonStop.Enabled = false; panelParam.Enabled = true; if (lvFind.Items.Count == 0) { MessageBox.Show(this, this._String_NoItemFound, "Message", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show(this, lvFind.Items.Count + " " + this._String_TotalItem, "Message", MessageBoxButtons.OK, MessageBoxIcon.Information); } } // Datalen > 0 } // TBL } //Filename }
/// <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); } }