Inheritance: MonoBehaviour
Example #1
0
 // Use this for initialization
 void Start()
 {
     //setting up the global shit
     //GlobalStuff.setBaddieOne(3);
     Cursor.visible = false;
     GlobalStuff.reset();
 }
Example #2
0
        public void Init()
        {
            if (GlobalStuff.FindSetting("isNew") == "1")
            {
                MessageBox.Show("Please initialize the database in Misc > Database with Scan");
                this.BeginInvoke(new MethodInvoker(Close));
                return;
            }

            SQLiteConnection con = Database.GetConnection();

            con.Open();
            SQLiteDataReader reader = new SQLiteCommand("SELECT DISTINCT name FROM res WHERE rtype = 'AFECB022' ORDER BY name ", con).ExecuteReader();

            scriptPaths = new List <string>();
            while (reader.Read())
            {
                scriptPaths.Add(reader.GetString(0));
            }
            con.Close();
            MakeTree();

            const int tabPixels = 24;

            richTextBox1.SelectionTabs = new int[] { (tabPixels * 1), (tabPixels * 2), (tabPixels * 3), (tabPixels * 4), (tabPixels * 5), (tabPixels * 6), (tabPixels * 7), (tabPixels * 8) };
            init = true;
        }
        public void Init()
        {
            if (GlobalStuff.FindSetting("isNew") == "1")
            {
                MessageBox.Show("Please initialize the database in Misc > Database with Scan");
                this.BeginInvoke(new MethodInvoker(Close));
                return;
            }
            string path = GlobalStuff.FindSetting("gamepath");

            path += "Data\\cas.cat";
            cat   = new CATFile(path);
            SQLiteConnection con = Database.GetConnection();

            con.Open();
            SQLiteDataReader reader = new SQLiteCommand("SELECT name,sha1 FROM res WHERE rtype='36F3F2C0' ORDER BY name", con).ExecuteReader();

            shaderDatabases = new Dictionary <string, string>();

            while (reader.Read())
            {
                if (!shaderDatabases.ContainsKey(reader.GetString(0)))
                {
                    shaderDatabases.Add(reader.GetString(0), reader.GetString(1));
                }
            }

            con.Close();
            MakeTree();
            init = true;
        }
Example #4
0
        private void exportAllButton_Click(object sender, EventArgs e)
        {
            FolderBrowserDialog d = new FolderBrowserDialog();

            if (d.ShowDialog() == DialogResult.OK)
            {
                var entries   = Database.LoadAllEbxEntries();
                var stopwatch = new Stopwatch();
                stopwatch.Start();

                for (int i = 0; i < entries.Count; i++)
                {
                    var ebxEntry = entries[i];

                    var bytes  = Tools.GetDataBySHA1(ebxEntry.sha1, GlobalStuff.getCatFile());
                    var daiEbx = new DAIEbx();
                    daiEbx.Serialize(new MemoryStream(bytes));
                    var ebxContainers = EbxDataContainers.fromDAIEbx(daiEbx, str => {}, false);
                    var txt           = ebxContainers.toText();

                    var outPath = Path.Combine(d.SelectedPath, $"{ebxEntry.path}_{ebxEntry.sha1.Substring(0, 8)}");
                    var dir     = Path.GetDirectoryName(outPath);
                    Directory.CreateDirectory(dir);
                    File.WriteAllText(outPath, txt, Encoding.UTF8);

                    if (i % 100 == 0)
                    {
                        Frontend.updateStatus($"Exported {i}/{entries.Count}, elapsec {stopwatch.ElapsedMilliseconds/1000}s");
                    }
                }

                Frontend.updateStatus("Finished export");
            }
        }
    private void InitializeRoom(bool moveRoom = false)
    {
        if (previousRoom != null)
        {
            Destroy(previousRoom.gameObject);
        }

        Debug.Log("setting previous room to: " + currentRoom);
        previousRoom = currentRoom;

        var roomGo = Instantiate(Resources.Load("Prefabs/Room"), currentSpawnPos, Quaternion.identity, transform) as GameObject;

        currentSpawnPos    = new Vector2(0, 0.5f);
        roomGo.name       += roomsVisited;
        currentRoom        = roomGo.GetComponent <Room>();
        currentRoomEnemies = new List <Enemy>();

        if (moveRoom)
        {
            MoveRooms();
            directionOfArrival = directionInTransit;
        }
        roomsVisited++;

        GlobalStuff.FreezeAllMovement();
        GlobalStuff.LoseAllControl();
        StartCoroutine(DelayBlockingExits());
    }
Example #6
0
        private void treeView1_AfterSelect(object sender, TreeViewEventArgs e)
        {
            try {
                if (ignoreonce)
                {
                    ignoreonce = false;
                    hideViewer();
                }
                else
                {
                    statusConsumer("Loading requested EBX...");

                    TreeNode t = treeView1.SelectedNode;
                    if (t == null || t.Name == "")
                    {
                        return;
                    }

                    string sha1 = t.Name;
                    byte[] data = Tools.GetDataBySHA1(sha1, GlobalStuff.getCatFile());

                    DAIEbx ebxFile = deserializeEbx(data);
                    setEbxFile(ebxFile);

                    statusConsumer("Done.");
                    showViewer();
                }
            } catch (Exception ex)
            {
                messageBoxOnException(ex);
            }
        }
Example #7
0
        private void createForAllDupsModToolStripMenuItem_Click(object sender, EventArgs e)
        {
            MessageBox.Show("Please select replacement data");
            OpenFileDialog d = new OpenFileDialog();

            d.Filter = "*.bin|*.bin";
            if (d.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                Mod mod = new Mod();
                mod.jobs = new List <Mod.ModJob>();
                Mod.ModJob mj = new Mod.ModJob();
                mj.data = File.ReadAllBytes(d.FileName);
                MessageBox.Show("Please select mod save location");
                SaveFileDialog d2 = new SaveFileDialog();
                d2.Filter = "*.DAIMWV|*.DAIMWV";
                if (d2.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    int plen = GlobalStuff.FindSetting("gamepath").Length;
                    mj.type        = 1;
                    mj.bundlePaths = new List <string>();
                    mj.tocPaths    = new List <string>();
                    bool skip = false;
                    for (int i = 0; i < ttprevlist.Count; i++)
                    {
                        DBAccess.RESInformation resi = ttprevlist[i];
                        mj.respath = resi.resname;
                        skip       = false;
                        foreach (string p in mj.bundlePaths)
                        {
                            if (p == resi.bundlepath)
                            {
                                skip = true;
                                break;
                            }
                        }
                        if (!skip)
                        {
                            mj.bundlePaths.Add(resi.bundlepath);
                        }
                        skip = false;
                        foreach (string p in mj.tocPaths)
                        {
                            if (p == resi.tocfilepath.Substring(plen))
                            {
                                skip = true;
                                break;
                            }
                        }
                        if (!skip && !resi.tocfilepath.ToLower().Contains("\\patch\\"))
                        {
                            mj.tocPaths.Add(resi.tocfilepath.Substring(plen));
                        }
                    }
                    mj.restype = types[toolStripComboBox1.SelectedIndex];
                    mod.jobs.Add(mj);
                    mod.Save(d2.FileName);
                    MessageBox.Show("Done.");
                }
            }
        }
Example #8
0
    IEnumerator PauseForDramaticEffect()
    {
        //  LevelManager.Instance.Player1.GetComponent<Movement>().enabled = false;
        //   LevelManager.Instance.Player2.GetComponent<Movement>().enabled = false;
        GlobalStuff.FreezeSpawning();
        GlobalStuff.FreezeAllMovement();
        GlobalStuff.LoseAllControl();
        yield return(new WaitForSeconds(.5f));

        childWithParticleSystem.SetActive(true);
        yield return(new WaitForSeconds(2f));

        FlashScreenUI.Instance.FlashScreen(0, 1f);
        yield return(new WaitForSeconds(1.5f));

        FlashScreenUI.Instance.FlashScreen(1, 1f);
        yield return(new WaitForSeconds(1.5f));

        FlashScreenUI.Instance.FlashScreen(0, .5f);
        yield return(new WaitForSeconds(.6f));

        FlashScreenUI.Instance.FlashScreen(1, .4f);
        yield return(new WaitForSeconds(.6f));

        FlashScreenUI.Instance.FlashScreen(0, .4f);
        yield return(new WaitForSeconds(.6f));

        FlashScreenUI.Instance.FlashScreen(2, 1f);
        yield return(new WaitForSeconds(.9f));

        childWithParticleSystem.SetActive(false);
        yield return(new WaitForSeconds(.5f));

        DeactivateUltimate();
    }
        private void treeView5_AfterSelect(object sender, TreeViewEventArgs e)
        {
            TreeNode t = treeView5.SelectedNode;

            if (t == null || t.Nodes.Count != 0)
            {
                return;
            }
            string path = t.Text;

            while (t.Parent.Text != "Textures")
            {
                t    = t.Parent;
                path = t.Text + "/" + path;
            }
            listBox2.Items.Clear();
            ttprevlist = new List <DBAccess.TextureInformation>();
            int    count   = 0;
            string DAIpath = GlobalStuff.FindSetting("gamepath");

            foreach (DBAccess.TextureInformation tmp in ttlist)
            {
                if (tmp.name == path)
                {
                    ttprevlist.Add(tmp);
                    DBAccess.BundleInformation buni = DBAccess.GetBundleInformationByIndex(tmp.bundleIndex);
                    listBox2.Items.Add((count++) + " : " + buni.filepath.Substring(DAIpath.Length, buni.filepath.Length - DAIpath.Length) + " -> " + buni.bundlepath);
                }
            }
            if (listBox2.Items.Count > 0)
            {
                listBox2.SelectedIndex = 0;
            }
        }
        public void Init()
        {
            if (GlobalStuff.FindSetting("isNew") == "1")
            {
                MessageBox.Show("Please initialize the database in Misc > Database with Scan");
                this.BeginInvoke(new MethodInvoker(Close));
                return;
            }
            string path = GlobalStuff.FindSetting("gamepath");

            path += "Data\\cas.cat";
            cat   = new CATFile(path);
            SQLiteConnection con = Database.GetConnection();

            con.Open();
            SQLiteDataReader reader = new SQLiteCommand("SELECT path FROM langsbfiles WHERE path LIKE '%\\loctext\\%' ORDER BY path ", con).ExecuteReader();

            toolStripComboBox1.Items.Clear();
            languages = new List <string>();
            while (reader.Read())
            {
                languages.Add(reader.GetString(0));
            }
            con.Close();
            foreach (string l in languages)
            {
                toolStripComboBox1.Items.Add(Path.GetFileNameWithoutExtension(l));
            }
            toolStripComboBox1.SelectedIndex = 0;
            language = new SBFile(languages[0]);
            MakeTree();
            init = true;
        }
 // Update is called once per frame
 void Update()
 {
     if (Input.GetKeyDown(KeyCode.Return))
     {
         GlobalStuff.changeBaddie(GlobalStuff.CurFight, false);
         SceneManager.LoadScene("Area 1", LoadSceneMode.Single);
     }
 }
Example #12
0
        public void LoadById(string id)
        {
            hb1.ByteProvider       = new DynamicByteProvider(new byte[0]);
            hb2.ByteProvider       = new DynamicByteProvider(new byte[0]);
            toolStripTextBox1.Text = id;
            while (!hasLoaded)
            {
                Application.DoEvents();
            }
            listBox1.Items.Clear();
            ttprevlist = new List <DBAccess.RESInformation>();
            string DAIpath = GlobalStuff.FindSetting("gamepath");

            foreach (DBAccess.RESInformation tmp in ttlist)
            {
                if (tmp.resname == id)
                {
                    ttprevlist.Add(tmp);
                }
            }
            List <DBAccess.RESInformation> tmplist = new List <DBAccess.RESInformation>();

            for (int i = 0; i < ttprevlist.Count; i++)
            {
                if (ttprevlist[i].isPatch)
                {
                    continue;
                }
                bool found = false;
                for (int j = 0; j < tmplist.Count; j++)
                {
                    if (tmplist[j].bundlepath == ttprevlist[i].bundlepath &&
                        tmplist[j].tocfilepath == ttprevlist[i].tocfilepath)
                    {
                        found = true;
                        break;
                    }
                }
                if (!found)
                {
                    tmplist.Add(ttprevlist[i]);
                }
            }
            int count = 0;

            ttprevlist = tmplist;
            List <string> paths = new List <string>();

            foreach (DBAccess.RESInformation tmp in ttprevlist)
            {
                paths.Add((count++) + " : " + tmp.tocfilepath.Substring(DAIpath.Length, tmp.tocfilepath.Length - DAIpath.Length) + " -> " + tmp.bundlepath);
            }
            listBox1.Items.AddRange(paths.ToArray());
            if (listBox1.Items.Count > 0)
            {
                listBox1.SelectedIndex = 0;
            }
        }
    IEnumerator DelayBlockingExits()
    {
        yield return(new WaitForSeconds(1f));

        BlockExits();
        GlobalStuff.UnfreezeAll();
        GlobalStuff.RegainAllControl();
        EnemySpawner.Instance.Initialize();
    }
Example #14
0
        private void ScanFiles()
        {
            Log("Saving file paths into db...");
            SQLiteConnection con = Database.GetConnection();

            con.Open();
            var transaction = con.BeginTransaction();

            string[] files = Directory.GetFiles(GlobalStuff.FindSetting("gamepath"), "*.sb", SearchOption.AllDirectories);
            Log("SB files...");
            foreach (string file in files)
            {
                if (!file.ToLower().Contains("\\update\\"))//exlude patches
                {
                    if (!file.Contains("\\loc\\") &&
                        !file.Contains("\\locfacefx\\") &&
                        !file.Contains("\\loctext\\"))
                    {
                        Database.AddSBFile(file, con);
                    }
                    else
                    {
                        Database.AddLanguageSBFile(file, con);
                    }
                }
            }
            transaction.Commit();
            transaction = con.BeginTransaction();
            Log("TOC files...");
            files = Directory.GetFiles(GlobalStuff.FindSetting("gamepath"), "*.toc", SearchOption.AllDirectories);
            foreach (string file in files)
            {
                if (!file.ToLower().Contains("\\update\\"))//exlude patches
                {
                    if (!file.Contains("\\loc\\") &&
                        !file.Contains("\\locfacefx\\") &&
                        !file.Contains("\\loctext\\"))
                    {
                        Database.AddTOCFile(file, con);
                    }
                    else
                    {
                        Database.AddLanguageTOCFile(file, con);
                    }
                }
            }
            transaction.Commit();
            transaction = con.BeginTransaction();
            Log("CAS files...");
            files = Directory.GetFiles(GlobalStuff.FindSetting("gamepath"), "*.cas", SearchOption.AllDirectories);
            foreach (string file in files)
            {
                Database.AddCASFile(file, con);
            }
            transaction.Commit();
            con.Close();
        }
Example #15
0
        private void treeView1_AfterSelect(object sender, TreeViewEventArgs e)
        {
            treeView2.Nodes.Clear();
            if (treeView1.SelectedNode == null)
            {
                return;
            }
            string path = Path.GetDirectoryName(GlobalStuff.FindSetting("gamepath")) + Helpers.GetPathFromNode(treeView1.SelectedNode);

            PreviewFile(path);
        }
Example #16
0
 public void Init()
 {
     if (GlobalStuff.FindSetting("isNew") == "1")
     {
         MessageBox.Show("Please initialize the database in Misc > Database with Scan");
         this.BeginInvoke(new MethodInvoker(Close));
         return;
     }
     Scripting.SetScriptOutput(rtb2);
     init = true;
 }
Example #17
0
        private void toolStripButton1_Click(object sender, EventArgs e)
        {
            TreeNode t = treeView1.SelectedNode;

            if (t == null)
            {
                t = treeView1.Nodes[0];
            }
            string search = toolStripTextBox1.Text;

            toolStripButton2.Visible = true;
            stop = false;
            while ((t = FindNext(t)) != null)
            {
                Application.DoEvents();
                statusConsumer("Searching : " + GetPath(t) + "...");
                if (stop)
                {
                    statusConsumer("Search stopped.");
                    toolStripButton2.Visible = false;
                    return;
                }
                try
                {
                    byte[] data = Tools.GetDataBySHA1(t.Name, GlobalStuff.getCatFile());
                    if (data.Length != 0)
                    {
                        DAIEbx ebxFile = deserializeEbx(data);
                        string xml     = ebxFile.ToXml();

                        if (xml.Contains(search))
                        {
                            ignoreonce             = true;
                            treeView1.SelectedNode = t;

                            showViewer();
                            setEbxFile(ebxFile);
                            rawXmlViewer.search(search);

                            statusConsumer("Match!");
                            toolStripButton2.Visible = false;
                            return;
                        }
                    }
                }
                catch (Exception ex)
                {
                    messageBoxOnException(ex);
                }
            }
            toolStripButton2.Visible = false;
            statusConsumer("Not found.");
        }
Example #18
0
 // Update is called once per frame
 void Update()
 {
     if (!GlobalStuff.getBaddie(pos))
     {
         //enabled = false;
         Destroy(this.gameObject);
     }
     if (GlobalStuff.getBaddie(pos))
     {
         WithInDistance();
     }
 }
Example #19
0
        private void listBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            int n = listBox1.SelectedIndex;

            if (n == -1)
            {
                return;
            }
            string path = GlobalStuff.FindSetting("gamepath") + listBox1.Items[n];

            PreviewFile(path);
        }
    public void Warp(WarpTile.WarpDirection warpDir)
    {
        directionInTransit = warpDir;
        if (canWarp)
        {
            GlobalStuff.PauseGame();
            HidePlayers();
            canWarp = false;

            InitializeRoom(true);
        }
    }
Example #21
0
    private void DeactivateUltimate()
    {
        foreach (var e in FindObjectsOfType <Enemy>())
        {
            e.Damage(ultimateDamage, Character.Effectiveness.SUPER);
        }

        // LevelManager.Instance.Player1.GetComponent<Movement>().enabled = true;
        // LevelManager.Instance.Player2.GetComponent<Movement>().enabled = true;
        GlobalStuff.UnfreezeSpawning();
        GlobalStuff.UnfreezeAll();
        GlobalStuff.RegainAllControl();
    }
Example #22
0
        private void createSingleModToolStripMenuItem_Click(object sender, EventArgs e)
        {
            int n = listBox1.SelectedIndex;

            if (n == -1)
            {
                return;
            }
            MessageBox.Show("Please select replacement texture (same size)");
            OpenFileDialog d = new OpenFileDialog();

            d.Filter = "*.dds|*.dds";
            if (d.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                byte[] data = File.ReadAllBytes(d.FileName);
                MessageBox.Show("Please select mod save location");
                SaveFileDialog d2 = new SaveFileDialog();
                d2.Filter = "*.DAIMWV|*.DAIMWV";
                if (d2.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    Mod mod = new Mod();
                    mod.jobs = new List <Mod.ModJob>();
                    Mod.ModJob mj = new Mod.ModJob();
                    mj.type        = 0;
                    mj.bundlePaths = new List <string>();
                    mj.tocPaths    = new List <string>();
                    int plen = GlobalStuff.FindSetting("gamepath").Length;
                    DBAccess.BundleInformation  buni = bil[n];
                    DBAccess.TextureInformation ti   = new DBAccess.TextureInformation();
                    foreach (DBAccess.TextureInformation t in til)
                    {
                        if (t.bundleIndex == buni.index)
                        {
                            ti = t;
                        }
                    }
                    DBAccess.TOCInformation toci = DBAccess.GetTocInformationByIndex(buni.tocIndex);
                    mj.respath = ti.name;
                    mj.bundlePaths.Add(buni.bundlepath);
                    mj.tocPaths.Add(toci.path.Substring(plen, toci.path.Length - plen));
                    MemoryStream m = new MemoryStream();
                    m.Write(data, 0x80, data.Length - 0x80);
                    mj.data = m.ToArray();
                    mod.jobs.Add(mj);
                    mod.Save(d2.FileName);
                    MessageBox.Show("Done.");
                }
            }
        }
Example #23
0
        private void button3_Click(object sender, EventArgs e)
        {
            if (GlobalStuff.FindSetting("isNew") != "1")
            {
                MessageBox.Show("Database was already filled with data, please clear it before scan.");
                return;
            }
            OpenFileDialog d = new OpenFileDialog();

            d.Filter = "DragonAgeInquisition.exe|DragonAgeInquisition.exe";
            if (d.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                StartScan(Path.GetDirectoryName(d.FileName) + "\\");
            }
        }
Example #24
0
 private void toolStripButton3_Click(object sender, EventArgs e)
 {
     try
     {
         string input  = Microsoft.VisualBasic.Interaction.InputBox("Please enter offset in decimal", "Find by offset and cas number", "");
         uint   offset = Convert.ToUInt32(input);
         input = Microsoft.VisualBasic.Interaction.InputBox("Please enter cas number decimal", "Find by offset and cas number", "");
         uint casnr = Convert.ToUInt32(input);
         input = Microsoft.VisualBasic.Interaction.InputBox("Search base(b) or patch(p)?", "Find by offset and cas number", "b");
         CATFile cat = null;
         if (input != "p")
         {
             cat = new CATFile(GlobalStuff.FindSetting("gamepath") + "Data\\cas.cat");
         }
         else
         {
             cat = new CATFile(GlobalStuff.FindSetting("gamepath") + "Update\\Patch\\Data\\cas.cat");
         }
         byte[] sha1 = new byte[0];
         for (int i = 0; i < cat.lines.Count; i++)
         {
             if (cat.lines[i][7] == casnr && cat.lines[i][5] <= offset && cat.lines[i][5] + cat.lines[i][6] > offset)
             {
                 MemoryStream m = new MemoryStream();
                 for (int j = 0; j < 5; j++)
                 {
                     Helpers.WriteLEUInt(m, cat.lines[i][j]);
                 }
                 sha1 = m.ToArray();
                 break;
             }
         }
         cat = null;
         if (sha1.Length == 0)
         {
             MessageBox.Show("SHA1 not found!");
             return;
         }
         toolStripTextBox1.Text = Helpers.ByteArrayToHexString(sha1);
         Thread t = new Thread(ThreadedSearch);
         t.Start();
         MessageBox.Show("Done.");
         return;
     }
     catch (Exception)
     {
     }
 }
Example #25
0
 public void Init()
 {
     if (GlobalStuff.FindSetting("isNew") == "1")
     {
         MessageBox.Show("Please initialize the database in Misc > Database with Scan");
         this.BeginInvoke(new MethodInvoker(Close));
         return;
     }
     this.WindowState = FormWindowState.Maximized;
     Application.DoEvents();
     statusConsumer("Querying...");
     EBXList = Database.LoadAllEbxEntries();
     statusConsumer("Making Tree...");
     MakeTree();
     statusConsumer("Done.");
     init = true;
 }
Example #26
0
        public static string GetOrSetAuthor()
        {
            string name = GlobalStuff.FindSetting("author");

            if (name == "")
            {
                string input = Microsoft.VisualBasic.Interaction.InputBox("Please enter author name", "Author name", "noname");
                if (input != "")
                {
                    name = input;
                    GlobalStuff.AssignSetting("author", name);
                }
                else
                {
                    name = "noname";
                }
            }
            return(name);
        }
Example #27
0
        private void StartScan(string basepath)
        {
            rtb1.Text = "";
            Log("Starting Scan...");
            Mod.GetOrSetAuthor();
            Stopwatch sp = new Stopwatch();

            sp.Start();
            GlobalStuff.AssignSetting("isNew", "0");
            GlobalStuff.settings.Add("gamepath", basepath);
            Database.SaveSettings();
            CATFile cat = ScanCAT();

            ScanFiles();
            ScanBundles(cat);
            sp.Stop();
            Log("\n\n===============\nTime : " + sp.Elapsed.ToString() + "\nDone.");
            MessageBox.Show("Done.");
        }
Example #28
0
    public override void Die()
    {
        isPlayerDead = true;

        if (!LevelManager.Instance.isOnePlayerDead)
        {
            LevelManager.Instance.isOnePlayerDead = true;
            DisablePlayer();
        }
        else
        {
            GlobalStuff.FreezeSpawning();
            GlobalStuff.FreezeAllMovement();
            Debug.Log("Game Over");
            gameOverText.SetActive(true);

            StartCoroutine(EndGameWait());
            // TODO: GameOver
        }
    }
Example #29
0
        private void Search()
        {
            rtb1.Text = rtb2.Text = rtb3.Text = "";
            string sha1 = toolStripTextBox1.Text.Trim().ToLower();

            if (sha1.Length != 40)
            {
                MessageBox.Show("Not valid SHA1!");
                return;
            }
            byte[] data = SHA1Access.GetDataBySha1(Helpers.HexStringToByteArray(sha1));
            if (data.Length == 0)
            {
                MessageBox.Show("SHA1 not found!");
                return;
            }
            hb1.ByteProvider = new DynamicByteProvider(data);
            el = DBAccess.GetEBXInformationBySHA1(sha1);
            rl = DBAccess.GetRESInformationBySHA1(sha1);
            cl = DBAccess.GetChunkInformationBySHA1(sha1);
            listBox1.Items.Clear();
            int count = 0;
            int l     = GlobalStuff.FindSetting("gamepath").Length;

            foreach (DBAccess.EBXInformation ei in el)
            {
                listBox1.Items.Add((count++) + " : " + ei.ebxname);
            }
            listBox2.Items.Clear();
            count = 0;
            foreach (DBAccess.RESInformation ri in rl)
            {
                listBox2.Items.Add((count++) + " : " + ri.resname);
            }
            listBox3.Items.Clear();
            count = 0;
            foreach (DBAccess.ChunkInformation ci in cl)
            {
                listBox3.Items.Add((count++) + " : id = " + Helpers.ByteArrayToHexString(ci.id));
            }
        }
Example #30
0
        private void createSingleModToolStripMenuItem_Click(object sender, EventArgs e)
        {
            int n = listBox2.SelectedIndex;

            if (n == -1)
            {
                return;
            }
            MessageBox.Show("Please select replacement data");
            OpenFileDialog d = new OpenFileDialog();

            d.Filter = "*.bin|*.bin";
            if (d.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                byte[] data = File.ReadAllBytes(d.FileName);
                MessageBox.Show("Please select mod save location");
                SaveFileDialog d2 = new SaveFileDialog();
                d2.Filter = "*.DAIMWV|*.DAIMWV";
                if (d2.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    Mod mod = new Mod();
                    mod.jobs = new List <Mod.ModJob>();
                    Mod.ModJob mj = new Mod.ModJob();
                    mj.type        = 1;
                    mj.bundlePaths = new List <string>();
                    mj.tocPaths    = new List <string>();
                    int plen = GlobalStuff.FindSetting("gamepath").Length;
                    DBAccess.RESInformation resi = ttprevlist[n];
                    mj.respath = resi.resname;
                    mj.bundlePaths.Add(resi.bundlepath);
                    mj.tocPaths.Add(resi.tocfilepath.Substring(plen));
                    MemoryStream m = new MemoryStream();
                    m.Write(data, 0x80, data.Length - 0x80);
                    mj.data    = m.ToArray();
                    mj.restype = types[toolStripComboBox1.SelectedIndex];
                    mod.jobs.Add(mj);
                    mod.Save(d2.FileName);
                    MessageBox.Show("Done.");
                }
            }
        }