Exemple #1
0
        void MainForm_Load(object sender, EventArgs e)
        {
            MainWindowLoading loader = new MainWindowLoading();

            loader.Show();

            loader.Log("Begin Check For Updates");
            CheckForUpdates();

            loader.Log("Find Archives Folder");
            SetArchivesRoot();

            loader.Log("Begin Loading RAF Archives");
            consoleLogTB.Text = "www.ItzWarty.com Riot Archive File Packer/Unpacker " + ApplicationInformation.BuildTime;

            rafContentView.TreeViewNodeSorter = new RAFFSOTreeNodeSorter();

            //Enumerate RAF files
            string[] archivePaths = Directory.GetDirectories(archivesRoot);
            #region load_raf_archives
            for (int i = 0; i < archivePaths.Length; i++)
            {
                string archiveName = archivePaths[i].Replace(archivesRoot, "").Replace("/", "");

                loader.Log("Load Archive - " + archiveName + " [0%]");
                //Title("Loading RAF File - " + archiveName);
                //Log("Loading RAF Archive Folder: " + archiveName);

                RAFArchive raf = null;
                RAFInMemoryFileSystemObject archiveRoot = new RAFInMemoryFileSystemObject(null, RAFFSOType.ARCHIVE, archiveName);
                rafContentView.Nodes.Add(archiveRoot);
#if !DEBUG
                try
                {
#endif
                //Load raf file table and add to our list of archives
                rafArchives.Add(archiveName,
                                raf = new RAFArchive(
                                    Directory.GetFiles(archivePaths[i], "*.raf")[0]
                                    )
                                );

                //Enumerate entries and add to our tree... in the future this should become sorted
                List <RAFFileListEntry> entries = raf.GetDirectoryFile().GetFileList().GetFileEntries();
                for (int j = 0; j < entries.Count; j++)
                {
                    // Console.WriteLine(entries[j].StringNameHash.ToString("x").PadLeft(8, '0').ToUpper());
                    if (j % 1000 == 0)
                    {
                        loader.Log("Load Archive - " + archiveName + " [" + (j * 100 / entries.Count) + "%]");
                    }
                    //Title("Loading RAF Files - " + archiveName +" - " + j+"/"+entries.Count);

                    RAFInMemoryFileSystemObject node = archiveRoot.AddToTree(RAFFSOType.FILE, entries[j].FileName);
                }
                //Log(entries.Count.ToString() + " Files");
#if !DEBUG
            }
            catch (Exception exception) { Log("FAILED:\r\n" + exception.Message + "\r\n"); }
#endif

                //Add to our tree displayer
                //Title("Sorting nodes... this might take a while");
                if (archiveRoot.Nodes.Count == 0)
                {
                    MessageBox.Show("Another instance of RAF Manager is likely already open.\r\n" +
                                    "If not, then another application has not released control over the \r\n" +
                                    "RAF Archives.  RAF Manager will continue to run, but some features \r\n" +
                                    "may not work properly.  Usually a restart of the application will \r\n" +
                                    "fix this.  If you have issues, post a reply on the forum thread, \r\n" +
                                    "whose link can be found under the 'About' menu header.");
                }
            }
            #endregion

            try
            {
                while (loader.Visible) //Hack - i have no idea why this is necessary sometimes... probs race condition somewhere
                {
                    loader.Hide();
                    Application.DoEvents();
                }
            }catch {}

            lock (consoleLogTB)
            {
                Log("");
                Log("A simple guide for using RAF Manager can be located at About->Simple Guide.");
                Log("");

                if (File.Exists(".laststate.rmproj"))
                {
                    Log("Open last state");
                    OpenProject(".laststate.rmproj");
                }
            }
        }
Exemple #2
0
        void MainForm_Load(object sender, EventArgs e)
        {
            MainWindowLoading loader = new MainWindowLoading();
            loader.Show();

            loader.Log("Begin Check For Updates");
            CheckForUpdates();

            loader.Log("Find Archives Folder");
            SetArchivesRoot();

            loader.Log("Begin Loading RAF Archives");
            consoleLogTB.Text = "www.ItzWarty.com Riot Archive File Packer/Unpacker " + ApplicationInformation.BuildTime;

            rafContentView.TreeViewNodeSorter = new RAFFSOTreeNodeSorter();

            //Enumerate RAF files
            string[] archivePaths = Directory.GetDirectories(archivesRoot);
            #region load_raf_archives
            for (int i = 0; i < archivePaths.Length; i++)
            {
                string archiveName = archivePaths[i].Replace(archivesRoot, "").Replace("/", "");

                loader.Log("Load Archive - " + archiveName +" [0%]");
                //Title("Loading RAF File - " + archiveName);
                //Log("Loading RAF Archive Folder: " + archiveName);

                RAFArchive raf = null;
                RAFInMemoryFileSystemObject archiveRoot = new RAFInMemoryFileSystemObject(null, RAFFSOType.ARCHIVE, archiveName);
                rafContentView.Nodes.Add(archiveRoot);
#if !DEBUG
                try
                {
#endif
                //Load raf file table and add to our list of archives
                rafArchives.Add(archiveName,
                    raf = new RAFArchive(
                        Directory.GetFiles(archivePaths[i], "*.raf")[0]
                    )
                );

                //Enumerate entries and add to our tree... in the future this should become sorted
                List<RAFFileListEntry> entries = raf.GetDirectoryFile().GetFileList().GetFileEntries();
                for (int j = 0; j < entries.Count; j++)
                {
                    // Console.WriteLine(entries[j].StringNameHash.ToString("x").PadLeft(8, '0').ToUpper());
                    if (j % 1000 == 0)
                        loader.Log("Load Archive - " + archiveName + " [" + (j * 100 / entries.Count) + "%]");
                    //Title("Loading RAF Files - " + archiveName +" - " + j+"/"+entries.Count);

                    RAFInMemoryFileSystemObject node = archiveRoot.AddToTree(RAFFSOType.FILE, entries[j].FileName);
                }
                //Log(entries.Count.ToString() + " Files");
#if !DEBUG
                }
                catch (Exception exception) { Log("FAILED:\r\n" + exception.Message + "\r\n"); }
#endif

                //Add to our tree displayer
                //Title("Sorting nodes... this might take a while");
                if (archiveRoot.Nodes.Count == 0)
                {
                    MessageBox.Show("Another instance of RAF Manager is likely already open.\r\n" +
                                    "If not, then another application has not released control over the \r\n" +
                                    "RAF Archives.  RAF Manager will continue to run, but some features \r\n" +
                                    "may not work properly.  Usually a restart of the application will \r\n" +
                                    "fix this.  If you have issues, post a reply on the forum thread, \r\n" +
                                    "whose link can be found under the 'About' menu header.");
                }
            }
            #endregion

            try
            {
                while (loader.Visible) //Hack - i have no idea why this is necessary sometimes... probs race condition somewhere
                {
                    loader.Hide();
                    Application.DoEvents();
                }
            }catch{}

            lock (consoleLogTB)
            {
                Log("");
                Log("A simple guide for using RAF Manager can be located at About->Simple Guide.");
                Log("");

                if (File.Exists(".laststate.rmproj"))
                {
                    Log("Open last state");
                    OpenProject(".laststate.rmproj");
                }
            }
        }