Exemplo n.º 1
0
        private bool IsReallyEnabled(SimPe.Interfaces.Files.IPackedFileDescriptor pfd, SimPe.Interfaces.Files.IPackageFile package)
        {
            if (System.IO.File.Exists(DefaultCareerFile))
            {
                return(true);
            }

            if (package == null)
            {
                System.Windows.Forms.MessageBox.Show("You do not have a package open and the Default Career File was not found.");
                return(false);
            }
            Interfaces.Files.IPackedFileDescriptor[] globals = package.FindFiles(Data.MetaData.GLOB_FILE);
            if (globals.Length == 1)
            {
                SimPe.Plugin.Glob glob = new SimPe.Plugin.Glob();
                glob.ProcessData(globals[0], package);
                if (glob.SemiGlobalName == "JobDataGlobals")
                {
                    return(true);
                }
            }
            System.Windows.Forms.MessageBox.Show("This package does not contain a career.");
            return(false);
        }
Exemplo n.º 2
0
        public bool Parse(List <string> argv)
        {
            if (!argv.Remove("-gensemiglob"))
            {
                return(false);
            }

            System.Collections.Generic.List <uint> added = new System.Collections.Generic.List <uint>();
            Splash.Screen.SetMessage("Loading FileTable...");
            SimPe.FileTable.FileIndex.Load();
            Splash.Screen.SetMessage("Looking for GLOB Resources...");
            SimPe.Interfaces.Scenegraph.IScenegraphFileIndexItem[] resources = SimPe.FileTable.FileIndex.FindFile(SimPe.Data.MetaData.GLOB_FILE, true);

            Splash.Screen.SetMessage("Found " + resources.Length + " GLOB Resources");
            string fl = Helper.SimPeSemiGlobalFile;

//            Console.WriteLine("Opening " + fl);
            System.IO.StreamWriter sw = new System.IO.StreamWriter(fl, false);
            sw.WriteLine("<semiglobals>");

            int ct  = 0;
            int unq = 0;

            foreach (SimPe.Interfaces.Scenegraph.IScenegraphFileIndexItem item in resources)
            {
                if (ct % 23 == 0)
                {
                    Splash.Screen.SetMessage("Wrote " + ct + " (" + unq + " unique) entries");
                }
                ct++;

                SimPe.Plugin.Glob glb = new SimPe.Plugin.Glob();
                glb.ProcessData(item);

                if (!added.Contains(glb.SemiGlobalGroup))
                {
                    sw.WriteLine("  <semiglobal>");
                    sw.WriteLine("    <known />");
                    sw.WriteLine("    <group>" + Helper.HexString(glb.SemiGlobalGroup) + "</group>");
                    sw.WriteLine("    <name>" + glb.SemiGlobalName + "</name>");
                    sw.WriteLine("  </semiglobal>");
                    added.Add(glb.SemiGlobalGroup);
                    unq++;
                }
            }
//            Console.WriteLine("Wrote " + ct + " (" + unq + " unique) entries");
            sw.WriteLine("</semiglobals>");
//            Console.WriteLine("Finished writing to " + fl);
            sw.Close();
            sw.Dispose();
            sw = null;
//            Console.WriteLine("Closed File");
            Splash.Screen.SetMessage("");

            return(true);
        }