示例#1
0
 private void cloneToolStripMenuItem_Click(object sender, EventArgs e)
 {
     string f = listView1.SelectedItems[0].Text;
     tabFile old = FileManager.GetTabFile(f);
     NewTabForm A = new NewTabForm();
     DialogResult dr = A.ShowDialog();
     if (dr == System.Windows.Forms.DialogResult.OK)
     {
         T = FileManager.CreateNewTabFile(A.TabName, A.TabPrefix, old.ColumnHeaders.ToArray());
         listView1.Items.Add(A.TabName + ".tab");
         selectTab(T);
     }
 }
示例#2
0
 private void newTabToolStripMenuItem_Click(object sender, EventArgs e)
 {
     NewTabForm A = new NewTabForm();
     DialogResult dr = A.ShowDialog();
     if (dr == System.Windows.Forms.DialogResult.OK)
     {
         T = FileManager.CreateNewTabFile(A.TabName, A.TabPrefix);
         listView1.Items.Add(A.TabName + ".tab");
     }
 }
示例#3
0
        public static void InitFileManager(D3DApplication a_App, string a_Basepath = null)
        {
            NotifyOnPhysicalWatch = true;
            g_pApp = a_App;
            API_Device D = a_App.Device;

            e_MatEffect = new EffectWrapper("matCombiner.fx", D);
            r_MatTarget = new RenderTarget(2048, 2048, 1, SlimDX.Direct3D11.BindFlags.RenderTarget, SlimDX.DXGI.Format.B8G8R8A8_UNorm, 1, SlimDX.Direct3D11.ResourceOptionFlags.None, D);

            D.Content.FileHandleCreator = getHandle;
            D.Content.RegisterMaterialLoader(new XmatLoader());
            D.Content.RegisterModelLoader(new XMACLoader());
            D.Content.RegisterModelLoader(new XMSHLoader());
            D.Content.RegisterTextureLoader(new XIMGLoader());

            string basePath2 = Registry.GetValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Deep Silver\Risen\", "INSTALL_DIR", string.Empty) as string;
            if (basePath2 != null && Directory.Exists(basePath2))
            {//registry based
                g_pGamepath = basePath2.Replace(@"\bin", @"\");
            }
            else if(!string.IsNullOrEmpty(a_Basepath))
            {//ini file based
                g_pGamepath = a_Basepath + @"\";
            }
            else
            {
                var msg = "Couldn't find risen directory. Terminating";
                SystemLog.Append(LogImportance.System, msg);
                SystemLog.Flush();
                MessageBox.Show(msg);
                throw new Exception();
            }

            m_Paks = new Dictionary<string, RisenPak>();
            DirectoryInfo[] Ds = new DirectoryInfo[] { new DirectoryInfo(g_pGamepath + "/data/common"), new DirectoryInfo(g_pGamepath + "/data/compiled") };
            for (int i = 0; i < Ds.Length; i++)
            {
                if (!Ds[i].Exists)
                    continue;

                int n = -1;
                while (true)
                {
                    string a = n.ToString().PadLeft(2, '0');
                    FileInfo[] Fs = Ds[i].GetFiles(n < 0 ? ("*.pak") : ("*.p" + a));
                    foreach (FileInfo f in Fs)
                    {
                        string key = Ds[i].Name + @"\" + f.Name.Replace(f.Extension, "") + (n < 0 ? "" : a);
                        RisenPak val = new RisenPak(FileManager.GetFile(f.FullName), _Files, n >= 0);
                        m_Paks.Add(key, val);
                    }
                    n++;
                    if (Fs.Length == 0)
                        break;
                }
            }

            m_Watcher.Path = g_pGamepath;
            m_Watcher.IncludeSubdirectories = true;
            m_Watcher.NotifyFilter = NotifyFilters.FileName;
            m_Watcher.Created += W_Created;
            m_Watcher.Deleted += W_Created;
            m_Watcher.Renamed += W_Created;
            m_Watcher.EnableRaisingEvents = true;

            initFinished = true;

            StdFileReader S = new StdFileReader();
            Dictionary<string, EFile> _PhyFiles = new Dictionary<string, EFile>();
            List<EFile> newFiles = new List<EFile>();
            Stack<DirectoryInfo> Dirs = new Stack<DirectoryInfo>();
            Dirs.Push(new DirectoryInfo(g_pGamepath + "/Data"));
            while (Dirs.Count != 0)
            {
                DirectoryInfo d = Dirs.Pop();
                DirectoryInfo[] _d = d.GetDirectories();
                FileInfo[] _f = d.GetFiles();
                foreach (DirectoryInfo q0 in _d)
                    Dirs.Push(q0);
                foreach (FileInfo q1 in _f)
                {
                    string k = q1.Name.ToUpper();
                    if (!isArchiveExtension(q1))
                    {
                        EFile e = new EFile(q1.FullName, S);
                        if (_PhyFiles.ContainsKey(k))
                        {
                            SystemLog.Append(LogImportance.System, "Two identical physical files found!");
                            throw new Exception("Two identical physical files found!");
                        }
                        _PhyFiles.Add(k, e);
                        if (!FileManager._PhyFiles.ContainsKey(k))
                            newFiles.Add(e);
                    }
                }
            }
            FileManager._PhyFiles = _PhyFiles;

            List<EFile> tabfiles = new List<EFile>();
            System.IO.StreamReader tr = new System.IO.StreamReader(g_pGamepath + "data\\ini\\loc.ini");
            while (!tr.EndOfStream)
            {
                string l = tr.ReadLine();
                while (!tr.EndOfStream && string.IsNullOrEmpty(l))
                    l = tr.ReadLine();
                if (tr.EndOfStream)
                    break;
                string prefix = tr.ReadLine().Replace("prefix=", ""), csv = tr.ReadLine().Replace("csv=", ""), bin = tr.ReadLine().Replace("bin=", "");
                EFile a = GetFile(bin.Replace(@"#G3:/", ""));
                if (!a.IsOpenable)
                    SystemLog.Append(LogImportance.Warning, "Tab file not found : " + a.Name);
                tabFile b = new tabFile(a);
                tab_files.Add(a.Name, b);
                tab_FilesPrefix.Add(prefix.ToLower(), b);
            }
            tr.Close();
        }
示例#4
0
        void selectTab(tabFile t)
        {
            notice = false;
            dataGridView1.Rows.Clear();
            dataGridView1.Columns.Clear();

            this.T = t;
            foreach (string s in T.ColumnHeaders)
                dataGridView1.Columns.Add(s, s);
            for (int i = 0; i < T.Rows; i++)
                dataGridView1.Rows.Add();

            for (int i = 0; i < T.Columns; i++)
                for (int j = 0; j < T.Rows; j++)
                    dataGridView1.Rows[j].Cells[i].Value = T[j, i];

            notice = true;
        }
示例#5
0
        public static tabFile CreateNewTabFile(string name, string prefix, params string[] columns)
        {
            EFile a = CreateNewPhysicalFile(NewFileType.Tab, name + ".tab");
            tabFile t = new tabFile(a, columns);
            t.serialize();

            tab_files.Add(a.Name, t);
            tab_FilesPrefix.Add(prefix.ToLower(), t);

            string n = g_pGamepath + "data\\ini\\loc.ini";
            List<string> A = new List<string>(File.ReadAllLines(n));
            A.Add(Environment.NewLine + "[" + prefix + "]");
            A.Add("prefix=" + prefix);
            A.Add("csv=#G3:/Data/Raw/Strings/" + name + ".csv");
            A.Add("bin=#G3:/Data/Compiled/Strings/" + name + ".tab");
            File.WriteAllLines(n, A.ToArray());

            return t;
        }