예제 #1
0
 public void CreateDataBase()
 {
     if (String.IsNullOrEmpty(ME3Directory.cookedPath))
     {
         MessageBox.Show("This functionality requires ME3 to be installed. Set its path at:\n Options > Set Custom Path > Mass Effect 3");
         return;
     }
     FileStream fs = new FileStream(DataBaseFile, FileMode.Create, FileAccess.Write);
     string pathcook = ME3Directory.cookedPath;
     DebugOutput.Clear();
     DebugOutput.PrintLn("Levelbase.cs: Loading files from :" + pathcook);
     string[] files = Directory.GetFiles(pathcook, "*.pcc");
     for (int i = 0; i < files.Length; i++)
     {
         string file = files[i];
         DebugOutput.PrintLn(i + "/" + (files.Length - 1) + " Scanning : " + Path.GetFileName(file));
         PCCObject pcc = new PCCObject(file);
         for (int j = 0; j < pcc.Exports.Count(); j++)
         {
             PCCObject.ExportEntry e = pcc.Exports[j];
             if (e.ClassName == "Level")
             {
                 Level l = new Level(pcc, j, true);
                 DBEntry entry = new DBEntry();
                 entry.filepath = file;
                 entry.index = j;
                 entry.count = l.Objects.Count();
                 database.Add(entry);
                 //foreach(int idx in l.Objects)
                 //    if (pcc.isExport(idx) && pcc.Exports[idx].ClassName == "BioPlaypenVolumeAdditive")
                 //        DebugOutput.PrintLn("#############################found");
                 DebugOutput.PrintLn("\tfound Level with " + entry.count + " Objects");
             }
         }
     }
     database.Sort((a,b) => a.filepath.CompareTo(b.filepath));
     BitConverter.IsLittleEndian = true;
     byte[] buff = BitConverter.GetBytes(database.Count());
     fs.Write(buff, 0, 4);
     foreach (DBEntry e in database)
     {
         buff = BitConverter.GetBytes(e.index);
         fs.Write(buff, 0, 4);
         buff = BitConverter.GetBytes(e.count);
         fs.Write(buff, 0, 4);
         buff = BitConverter.GetBytes(e.filepath.Length);
         fs.Write(buff, 0, 4);
         foreach (char c in e.filepath)
             fs.WriteByte((byte)c);
     }
     fs.Close();
 }
예제 #2
0
        private void listBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            int n = listBox1.SelectedIndex;
            if (n == -1)
                return;
            DBEntry l = database[n];
            if (File.Exists(l.filepath))
            {

                PCCObject pcc = new PCCObject(l.filepath);
                Level lev = new Level(pcc, l.index, true);
                string s = "";
                s += "Loading Level from : " + Path.GetFileName(l.filepath) + "\n";
                s += "Object count : " + lev.Objects.Count + "\n==============\n\n";
                for (int i = 0; i < lev.Objects.Count(); i++)
                {
                    int index = lev.Objects[i];
                    s += "(" + i + "/" + (lev.Objects.Count() - 1) + ") ";
                    s += "#" + index + " : \"" + pcc.Exports[index].ObjectName + "\" Class : \"" + pcc.Exports[index].ClassName + "\"\n";
                }
                rtb1.Text = s;
            }
        }
예제 #3
0
        private void listBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            int n = listBox1.SelectedIndex;
            if (n == -1)
                return;
            DBEntry l = database[n];
            if (File.Exists(l.filepath))
            {

                try
                {
                    using (ME3Package pcc = MEPackageHandler.OpenME3Package(l.filepath))
                    {
                        Level lev = new Level(pcc, l.index, true);
                        string s = "";
                        s += "Loading Level from : " + Path.GetFileName(l.filepath) + "\n";
                        s += "Object count : " + lev.Objects.Count + "\n==============\n\n";
                        for (int i = 0; i < lev.Objects.Count(); i++)
                        {
                            int index = lev.Objects[i];
                            s += "(" + i + "/" + (lev.Objects.Count() - 1) + ") ";
                            s += "#" + index + " : \"" + pcc.Exports[index].ObjectName + "\" Class : \"" + pcc.Exports[index].ClassName + "\"\n";
                        }
                        rtb1.Text = s; 
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Error:\n" + ex.Message);
                }
            }
        }