Exemplo n.º 1
0
 private Program(string[] args)
 {
     fp = new FlagParse(args);
     Dirry.InitAltDrives();
     MKL.Lic("Alternate Dir - Program.cs", "GNU General Public License 3");
     MKL.Version("Alternate Dir - Program.cs", "19.10.27");
     fp.CrBool("p", false);
     fp.CrBool("all", false);
     fp.CrBool("ansi", OnWindows);
     fp.CrBool("s", false);
     fp.CrBool("w", false);
     fp.CrBool("b", false);
     fp.CrBool("h", false);
     fp.Parse();
 }
Exemplo n.º 2
0
 static void Main(string[] args)
 {
     Dirry.InitAltDrives();
     JCR6_lzma.Init();
     JCR6_zlib.Init();
     if (args.Length != 1)
     {
         Console.WriteLine("Usage: KthuraConvert <Project>");
     }
     else
     {
         var M = new Program(args[0]);
         M.Run();
     }
     TrickyDebug.AttachWait();
 }
Exemplo n.º 3
0
 static void Run(string[] args)
 {
     try {
         var Targs = new string[args.Length - 1];
         var Exe   = Dirry.AD(args[0]);
         for (int i = 1; i < args.Length; ++i)
         {
             Targs[i - 1] = args[i];
         }
         Debug.WriteLine($"Loading: {Exe}");
         var State = new WenState($"QCLI: {Exe}", Exe);
     } catch (Exception E) {
         Console.WriteLine("ERROR");
         Console.WriteLine(E.Message);
     }
 }
Exemplo n.º 4
0
        public void SaveMap()
        {
            #region Save the map in TeddyBear's native format
            UI.ErrorNotice = "";
            ProjectData.Log($"Compresion = {ProjectData.MapCompression}");
            var r = TeddySave.Save(ProjectData.Map, ProjectData.MapFile, "", ProjectData.MapCompression, ProjectData.MapCompression);
            if (r != "" && r != "Ok")
            {
                UI.ErrorNotice = r; return;
            }
            #endregion

            #region Export the map if applicable
            if (ProjectData.ProjectConfig.C("XPORT.EDITAUTO").ToUpper() != "YES")
            {
                return;
            }
            var XTo     = ProjectData.ProjectConfig.C("XPORT.TO");
            var XTarget = ProjectData.ProjectConfig.C("XPORT.TARGET").ToLower();
            if (XTo == "")
            {
                UI.ErrorNotice = "EXPORT: Folder to export to not configured!"; return;
            }
            XTo = Dirry.AD(XTo);
            if (XTarget == "")
            {
                UI.ErrorNotice = "EXPORT: Target language to export to not set!"; return;
            }
            if (!XPort_Base.Drivers.ContainsKey(XTarget))
            {
                UI.ErrorNotice = $"EXPORT: Target language '{XTarget}' unknown!"; return;
            }
            try {
                ProjectData.Log($"Translating into {XTarget} to folder {XTo}");
                var translation = XPort_Base.Drivers[XTarget].Translate(ProjectData.Map);
                Directory.CreateDirectory(XTo);
                var outfile = XPort_Base.Drivers[XTarget].TransFile($"{XTo}/{qstr.StripDir(ProjectData.MapFile)}");
                ProjectData.Log($"Saving translation into {outfile}");
                QuickStream.SaveString(outfile, translation);
            } catch (Exception e) {
                UI.ErrorNotice = $"EXPORT.SAVE: {e.Message}";
            }
            #endregion
        }
Exemplo n.º 5
0
        void LoadMainConfig()
        {
            if (!File.Exists(GINIFILE))
            {
                Crash($"I need configuration first!\nLoading the launcher will do that for you!");
            }
            dwriteln($"Reading: {GINIFILE}");
            MainConfig = GINI.ReadFromFile(GINIFILE);
            switch (MainConfig.C("Platform").ToUpper())
            {
            case "WINDOWS": Dirry.InitAltDrives(AltDrivePlaforms.Windows); break;

            case "LINUX": Dirry.InitAltDrives(AltDrivePlaforms.Linux); break;

            default:
                Crash($"Unknown platform setting in project file: {MainConfig.C("Platform")}");
                break;
            }
        }
Exemplo n.º 6
0
        void TranslateMaps()
        {
            Doing("Analysing Maps for Project", XProject);
            var tdrv   = XPort_Base.Drivers[XTarget];
            var mapdir = Dirry.AD(ProjectConfig.C("LevelDir"));
            var fl     = FileList.GetDir(mapdir);

            foreach (string mapname in fl)
            {
                Doing("Translating", mapname);
                var map = TeddyBear.TeddyMap.Load($"{mapdir}/{mapname}");
                if (map == null)
                {
                    Crash($"Map Load Error\n{JCR6.JERROR}");
                }
                var translation = tdrv.Translate(map);
                QuickStream.SaveString(tdrv.TransFile($"{XTo}/{mapname}"), translation);
            }
        }
Exemplo n.º 7
0
 static Core()
 {
     MKL.Lic("Stach - Core.cs", "GNU General Public License 3");
     MKL.Version("Stach - Core.cs", "21.03.09");
     FFS.Hello();
     Debug.WriteLine($"Running on {Platform}");
     Dirry.InitAltDrives();
     Config = GINIE.FromFile($"{Dirry.C("$AppSupport$/Stach.ini")}");
     Config.AutoSaveSource = $"{Dirry.C("$AppSupport$/Stach.ini")}";
     JCR6_lzma.Init();
     JCR6_jxsrcca.Init();
     JCR6_zlib.Init();
     new JCR_QuakePack();
     new JCR_a();
     new JCR_QuickLink();
     JCR_JCR5.Init();
     new JCR6_WAD();
     new JCR_WestwoodPAK();
 }
        public static void Main(string[] getargs)
        {
#if DEBUG
            string[] args = { "C", "Test" };
#else
            string[] args = getargs;
#endif
            Dirry.C("$AppSupport"); // Just forces MKL to be properly set :P
            QOpen.Hello();
            qstr.Chr(1);
            Compile.Hi();
            MKL.Lic("DevLog Compiler - DevLogCompiler.cs", "GNU General Public License 3");
            MKL.Version("DevLog Compiler - DevLogCompiler.cs", "18.11.17");
            Console.WriteLine($"DevLog - version {MKL.Newest}");
            Console.WriteLine($"(c) Jeroen P. Broks 2018-20{qstr.Left(MKL.Newest,2)}");
#if DEBUG
            Console.WriteLine("\n\nWARNING! This is the debug version!\nAs the name suggests this build should be used for debugging purposes ONLY!\n");
#endif
            if (args.Length == 0)
            {
                Console.WriteLine("\n\n");
                Console.WriteLine("DevLogCompiler c <project> - Compiles Project Into Binary form");
                //Console.WriteLine("DevLogCompiler d <project> - Decompiles Project From Binary form back to text form");
                Console.WriteLine("DevlogCompiler v           - Full version information");
                return;
            }
            switch (args[0].ToUpper())
            {
            case "C": if (args.Length != 2)
                {
                    Console.WriteLine("Invalid command line input!"); return;
                }
                Compile.Go($"{WorkSpace}/Projects/{args[1]}");
                break;

            case "V": Console.WriteLine($"\n{MKL.All()}"); break;

            default: Console.WriteLine("Unknown command switch"); break;
            }
        }
Exemplo n.º 9
0
        void Export(string amap)
        {
            if (amap == "")
            {
                foreach (string m in FileList.GetDir(Dirry.AD($"{MapDir}")))
                {
                    Export(m);
                }
                return;
            }
            var    exporter   = ExportBasis.Get(Target);
            var    outputfile = $"{XPTo}/{exporter.ExportedFile(amap)}";
            Kthura kmap       = null; // (=null is required or the compiler THINKS we got an unassigned thing.... TRY it! :P

            Doing("Exporting Map", amap);
            Doing("Output", outputfile);
            Magenta(" Reading\r");
            try {
                kmap = Kthura.Load($"{MapDir}/{amap}");
            } catch (Exception e) {
                if (JCR6.JERROR != "" && JCR6.JERROR != "OK")
                {
                    Error(JCR6.JERROR);
                }
                Error(e);
            }
            Assert(kmap != null, $"Failed to load the map!    {JCR6.JERROR}");
            Magenta(" Translating\r");
            var translation = exporter.DoExport(kmap);

            Magenta(" Writing      \r");
            try {
                Directory.CreateDirectory(qstr.ExtractDir(outputfile));
                QuickStream.SaveString(outputfile, translation);
            } catch (Exception e) {
                Error(e);
            }
            Magenta("                  \n");
        }
Exemplo n.º 10
0
        static void LoadScript(string script, string args)
        {
            script = Dirry.AD(script.Replace("\\", "/"));
            State  = new Lua();
            var CallScript = $"ls = loadstring or load\nlocal LoadNeil = assert(ls(\"{NeilScript.Replace("\\","\\\\").Replace("\n", "\\n").Replace("\r", "").Replace("\"","\\\"")}\",\"Neil itself\"))\nNeil = LoadNeil()";

            Debug.WriteLine(CallScript);
            State.DoString(CallScript, "Call Neil itself");
            // newk,oftype,rw,defaultvalue
            // if (true) throw new Exception(args);
            State.DoString($"Neil.Globals('Args','table','constant',{args})", "Set CLI arguments");
            new API(State, script);
            TrickyDebug.Chat("Loaded Neil");
            var s = QuickStream.LoadString(Dirry.AD(script));

            TrickyDebug.Chat($"Loaded Script: {script}");
            //var scr = s.Replace("\\", "\\\\").Replace("\n", "\\n").Replace("\r", "").Replace("\"", "\\\"");
            var scr = s.Replace("\\", "\\\\");

            for (int i = 0; i < 256; i++)
            {
                if (i < 32 || i > 120 || (char)i == '"')
                {
                    scr = scr.Replace($"{(char)i}", $"\\{qstr.Right($"00{i}", 3)}");
                }
            }
            // Console.WriteLine($"<C#>{scr}</C#>");
            // Console.WriteLine($"Script: {script}");
            TrickyDebug.Chat("String secured");
            var sendscr = $"local translation = assert(Neil.Translate(\"{scr}\",\"Translate: {script}\"))\n\nlocal err; QUICKNEILSCRIPTFUNCTION,err = ls(translation,\"{script}\")\n\nif not QUICKNEILSCRIPTFUNCTION then error(\"Compiling the translation failed\\n\"..tostring(err)..\"\\n\\n\"..translation) end";

            //Console.WriteLine($"<TRANSLATION>\n{sendscr}\n</TRANSLATION>");
            Debug.WriteLine(sendscr);
            State.DoString(sendscr, "Translating");
            State.DoString("QUICKNEILSCRIPTFUNCTION()", "Run-Time");
        }
Exemplo n.º 11
0
        void SetupProject(string[] args)
        {
            dwriteln("Project setup started");
            FlagParse fp = new FlagParse(args);

            fp.CrString("Target", "");
            fp.CrString("To", "");
            fp.CrString("Project", "");
            if (!fp.Parse(
#if DEBUG
                    true
#endif
                    ))
            {
                Crash("Flag parsing failed!");
            }
            XProject = fp.GetString("Project");
            XTarget  = fp.GetString("Target");
            XTo      = fp.GetString("To");
            if (XProject == "" && XTarget == "" && XTo == "")
            {
                cwrite(ConsoleColor.Cyan, "Usage: ");
                cwrite(ConsoleColor.DarkGreen, $"{qstr.RemSuffix(qstr.StripDir(System.Reflection.Assembly.GetEntryAssembly().Location),".exe")} ");
                cwrite(ConsoleColor.DarkMagenta, "-<flag> <value>\n\n");
                cwrite(ConsoleColor.Red, string.Format("{0,15}", "-Project ")); cwriteln(ConsoleColor.Green, "Define the project");
                cwrite(ConsoleColor.Red, string.Format("{0,15}", "-Target ")); cwriteln(ConsoleColor.Green, "Define the target language");
                cwrite(ConsoleColor.Red, string.Format("{0,15}", "-To ")); cwriteln(ConsoleColor.Green, "Define the folder where the translations should go to");
                Console.WriteLine("");
                cwriteln(ConsoleColor.Yellow, "Supported target languages:");
                foreach (string drv in XPort_Base.Drivers.Keys)
                {
                    cwrite(ConsoleColor.Red, "= ");
                    cwriteln(ConsoleColor.DarkYellow, drv);
                }
                Console.WriteLine("");
                cwriteln(ConsoleColor.White, "Please note that \"To\" and \"Target\" can also be defined in the project file, so you don't have to name them here.\nWhen using them here on the cli even if set in the project file, the value set in the cli will take priority!");
                Halt(0);
            }
            if (XProject == "")
            {
                Crash("No Project!");
            }
            ProjectFile = Dirry.AD($"{MainConfig.C("WorkSpace")}/{XProject}/{XProject}.project.GINI");
            dwriteln($"Reading: {ProjectFile}");
            ProjectConfig = GINI.ReadFromFile(ProjectFile);
            cwrite(ConsoleColor.Yellow, "Reading Project: ");
            cwriteln(ConsoleColor.Cyan, XProject);
            if (ProjectConfig == null)
            {
                Crash($"Reading {ProjectFile} failed!");
            }
            if (XTarget == "")
            {
                XTarget = ProjectConfig.C("XPORT.TARGET");
            }
            if (XTarget == "")
            {
                Crash("And to what language do you want to translate this to? Without the -Target flag, I don't know!");
            }
            if (XTo == "")
            {
                XTo = ProjectConfig.C("XPORT.TO");
            }
            if (XTo == "")
            {
                Crash("And where do you want the translations to be put? Without the -To flag, I don't know!");
            }
            XTarget = XTarget.ToLower();
            if (!XPort_Base.Drivers.ContainsKey(XTarget))
            {
                Crash($"I cannot export to {XTarget}");
            }
        }
Exemplo n.º 12
0
        static void Main(string[] args)
        {
            // Header
            QCol.Red("Kitty "); QCol.Magenta("Coded by: Tricky\n");
            QCol.Yellow($"(c) {MKL.CYear(2019)} Jeroen P. Broks\n\n");
            // Init
            Dirry.InitAltDrives();
            KittyHigh.Init();
            new KittyHighCS();
            new KittyHighNIL();
            new KittyHighLua();
            new KittyHighGINI();
            new KittyHighScyndi();
            new KittyBlitzMax();
            new KittyHighC();
            new KittyHighPascal();
            new KittyHighBrainFuck();
            new KittyHighGo();
            new KittyHighBlitzBasic();
            new KittyHighSASKIA();
            new KittyHighPython();
            new KittyHighJavaScript();
            new KittyHighWhiteSpace();
            new KittyHighBASIC();
            new KittyHighJava();
            new KittyHighINI();
            new KittyHighVB();
            new KittyHighCobra();
            new KittyHighHtml();
            new KittyHighXml();
            new KittyHighNeil();
            var slin = true;

            if (args.Length == 0)
            {
                QCol.Green("Kitty is a simple program which will help you view source files in syntax highlight\n");
                QCol.Magenta("Usage:\t");
                QCol.Yellow("Kitty ");
                QCol.Cyan("<switches> ");
                QCol.White("<files>");
                QCol.Green("[");
                QCol.Cyan("<switches> ");
                QCol.White("<files>");
                QCol.Green("..]");
                Console.WriteLine("\n\n");
                QCol.Yellow("Please note that switches affect all files defined after it not those that come before it. This allows you to configure each file shown\n\n");
                QCol.Cyan("-ln              "); QCol.Yellow("Toggle line numbers on/off (default is on)\n");
                QCol.Cyan("-nolinenumbers   "); QCol.Yellow("Turn line numbers off\n");
                QCol.Cyan("-Showlinenumbers "); QCol.Yellow("Turn line numbers on\n");
                QCol.Cyan("-re              "); QCol.Yellow("Toggle searching by RegEx (this allows limited support for Wild Cards and more nice things)\n");
                QCol.Cyan("-p, -more        "); QCol.Yellow("Turn \"more\" mode on/off. (Read note below)\n");
                QCol.Cyan("-support         "); QCol.Yellow("Show a list of all supported file formats\n");
                QCol.Red("\n\nThe \"more\" mode!\n");
                QCol.Yellow("Does not entirely work the same as the 'more' utility, but has the same primary function!\n");
                QCol.Yellow("When the \"more\" bar appears you can hit space to show the next line, Enter/Return to show the entire next page and escape to turn the more mode off\n");
                QCol.White("\n\nKitty can be used as as CLI tool, but the integry has been made to be included in your own projects, and has been released under the terms of the zlib license\n\n");
                return;
            }
            // Go for it
            QCol.Doing("Called from:", System.IO.Directory.GetCurrentDirectory());
            void ViewFile(string a)
            {
                try {
                    var arg = Dirry.AD(a).Replace("\\", "/");
                    QCol.Doing("Reading", arg); KittyHigh.PageBreak();
                    var src  = QuickStream.LoadString(arg);
                    var eoln = qstr.EOLNType(arg);
                    // QCol.Doing("EOLN", eoln); // didn't work anyway
                    //QCol.OriCol();
                    var       ext    = qstr.ExtractExt(arg).ToLower();
                    KittyHigh Viewer = KittyHigh.Langs["OTHER"];
                    if (KittyHigh.Langs.ContainsKey(ext))
                    {
                        Viewer = KittyHigh.Langs[ext];
                    }
                    QCol.Doing("Type", Viewer.Language); KittyHigh.PageBreak();
                    KittyHigh.WriteLine();
                    Viewer.Show(src, slin);
                } catch (Exception ex) {
                    QCol.QuickError($"{ex.Message}\n");
#if DEBUG
                    QCol.Magenta($"{ex.StackTrace}\n\n");
#endif
                }
            }

            var aregex = false;
            foreach (string a in args)
            {
                if (qstr.Prefixed(a, "-"))
                {
                    switch (a.ToLower())
                    {
                    case "-ln": slin = !slin; break;

                    case "-nolinenumbers": slin = false; break;

                    case "-showlinenumbers": slin = true; break;

                    case "-p":
                    case "-more": KittyHigh.BrkLines = !KittyHigh.BrkLines; break;

                    case "-re": aregex = !aregex; break;

                    case "-support":
                        foreach (string ext in KittyHigh.Langs.Keys)
                        {
                            QCol.Cyan(qstr.Left($"{ext}                    ", 20));
                            QCol.Yellow($"{KittyHigh.Langs[ext].Language}\n");
                        }
                        break;

                    default: QCol.QuickError($"Unknown switch: {a}"); break;
                    }
                }
                else if (aregex)
                {
                    QCol.Doing("Searching for RegEx", a);
                    var rgxl = RegExTree.Tree(a);
                    foreach (string af in rgxl)
                    {
                        ViewFile(af);
                    }
                }
                else
                {
                    ViewFile(a);
                }
            }
            TrickyDebug.AttachWait();
        }
Exemplo n.º 13
0
 /* Crappy Callback Stuff */
 public Game1()
 {
     graphics = new GraphicsDeviceManager(this);
     Content.RootDirectory = "Content";
     Dirry.InitAltDrives();
 }
Exemplo n.º 14
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            TGINI config;

            try {
                config = GINI.ReadFromFile(Dirry.C("$AppSupport$/TeddyBaseConfig.GINI"));
            } catch (Exception err) {
                Afgekeurd($"Failed to load the configuration file\n{err.Message}");
                return;
            }
            switch (config.C("PLATFORM"))
            {
            case "Windows":
                Dirry.InitAltDrives(AltDrivePlaforms.Windows);
                break;

            case "Linux":
                Dirry.InitAltDrives(AltDrivePlaforms.Linux, config.C("LINUX_MEDIA"));
                break;

            default:
                Afgekeurd($"Platform {config.C("PLATFORM")} unknown");
                return;
            }
            var workspace = config.C("WORKSPACE");

            if (workspace == "")
            {
                Afgekeurd("Workspace not configured. Please run the launcher first!"); return;
            }

            TGINI project       = new TGINI();
            var   prjallowregex = new Regex(@"^[a-zA-Z0-9_ ]+$");

            ProjectName.Text = ProjectName.Text.Trim();
            var projectdir = $"{workspace}/{ProjectName.Text}";

            if (ProjectName.Text == "")
            {
                Afgekeurd("No project name given!"); return;
            }
            if (!prjallowregex.IsMatch(ProjectName.Text))
            {
                Afgekeurd("Only numbers letters underscores and spaces allowed in project name"); return;
            }
            if (Directory.Exists(projectdir))
            {
                Afgekeurd("That project already exists!"); return;
            }
            var mapw = qstr.ToInt(MapW.Text);
            var maph = qstr.ToInt(MapH.Text);

            if (mapw <= 0 || maph <= 0)
            {
                Afgekeurd("The map format has incorrect values"); return;
            }
            if (mapw * maph > 50000)
            {
                var r = MessageBox.Show($"These settings will be very very costly on your RAM. {mapw * maph} bytes per layer at least, and then the object layer not counted. Are you SURE, you wanna do this?", "Are you crazy?", MessageBoxButton.YesNo, MessageBoxImage.Warning);
                if (r == MessageBoxResult.No)
                {
                    return;
                }
            }
            var layers = Layers.Text.Split(';');

            if (layers.Length < 1)
            {
                Afgekeurd("A TeddyBear project MUST have at least 1 layer");
            }

            // Not really needed as the editor will never use it, but I guess it's just good practise
            project.D("PROJECTNAME", ProjectName.Text);

            // Create Project
            try {
                Directory.CreateDirectory(Dirry.AD(projectdir));
            } catch (Exception err) { Afgekeurd($"Project creation folder failed!\n\nDir: {Dirry.AD(projectdir)}\n\n{err.Message}"); return; }

            // Grid should when you are not an advanced user always be 32x32, and if you are an advanced user, why are you using this wizard?
            project.D("GRIDX", "32");
            project.D("GRIDY", "32");

            // Sizes
            project.D("SIZEX", $"{mapw}");
            project.D("SIZEY", $"{maph}");
            project.D("ResizeTextures", "FALSE");

            // Layers
            foreach (string layer in Layers.Text.Split(';'))
            {
                if (layer != "")
                {
                    project.Add("LAYERS", layer);
                    if (!qstr.Prefixed(layer, "Zone_"))
                    {
                        project.D($"HOT.{layer}", "BC");
                    }
                }
            }

            // Map dir
            var mapdir = MapFileFolder.Text;

            if (mapdir == "*InProject*")
            {
                mapdir = $"{projectdir}/Maps";
            }
            project.D("LevelDir", mapdir);
            try {
                Directory.CreateDirectory(Dirry.AD(mapdir));
            } catch (Exception err) {
                Afgekeurd($"Creation/access of map folder failed! -- Please note that a (project dir is now already created, you may need to destroy it for another go)\n\n{err.Message}");
                return;
            }

            // Texture dirs
            var texdir = TextureFolder.Text;

            if (texdir == "*InProject*")
            {
                texdir = $"{projectdir}/Textures";
            }
            var texdirs = texdir.Split(';');

            foreach (string td in texdirs)
            {
                project.Add("textures", td);
                try {
                    Directory.CreateDirectory(Dirry.AD(td));
                } catch (Exception err) {
                    Afgekeurd($"Creation/access of texture folder {td} failed! -- Please note that a (project dir is now already created, you may need to destroy it for another go)\n\n{err.Message}");
                    return;
                }
            }

            // Meta data
            var metas = MetaData.Text.Split(';');

            foreach (string meta in metas)
            {
                project.Add("Data", meta.Trim());
            }

            // Create project file
            try {
                project.SaveSource(Dirry.AD($"{projectdir}/{ProjectName.Text}.Project.GINI"));
            } catch (Exception err) {
                Afgekeurd($"I could not create project file '{projectdir}/{ProjectName.Text}.Project.GINI'\n\n{err.Message}");
                return;
            }
            MessageBox.Show("Project succesfully created", ProjectName.Text);
        }
Exemplo n.º 15
0
        public string GetTree(string path, bool hidden)
        {
            var lijst = FileList.GetTree(Dirry.AD(path), true, hidden);

            return(mkLuaStringFromTable(lijst));
        }
Exemplo n.º 16
0
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            ProjectData.InitJCRDrivers();
            ProjectData.SetGame(this);

            #region Screen Size
            //graphics.PreferredBackBufferWidth = GraphicsDevice.DisplayMode.Width;
            //graphics.PreferredBackBufferHeight = GraphicsDevice.DisplayMode.Height;
            graphics.HardwareModeSwitch = false;
            graphics.IsFullScreen       = true;
            graphics.ApplyChanges();
            #endregion

            #region TeddyBear Draw MonoGame Driver
            TeddyBear.TeddyDraw_MonoGame.Init();
            #endregion

            // Sprite Batch
            SB = new SpriteBatch(GraphicsDevice);

            // Mouse Pointer
            MousePointer = ProjectData.GetTex(GraphicsDevice, "MousePointer.png");

            // TQMG
            TQMG.Init(graphics, GraphicsDevice, SB, ProjectData.JCR);
            TQMG.RegLog(ProjectData.Log);

            // Exporter
            TeddyXport.XPort.init();

            // Unknown
            TeddyBear.TeddyDraw_MonoGame.SetUnknown(TQMG.GetImage("Unknown.png"));
            TeddyBear.TeddyDraw_MonoGame.Log = ProjectData.Log;


            // Do we have a project and a map?
#if DEBUG
            if (false)
            {
            }              // just some crap as things are different while debugging.
#else
            if (ProjectData.args.Length < 3)
            {
                Crash.Error(this, "No arguments given!\nUsage: TeddyEdit <project> <map>\n \n If you are not sure how to use this tool, use the launcher in stead!");
            }
#endif
            else
            {
#if DEBUG
                ProjectData.Project = "Test";
#else
                ProjectData.Project = ProjectData.args[1];
#endif
                if (!ProjectData.AllWell)
                {
                    Crash.Error(this, $"Project loading failed! {ProjectData.Project}");
                }
                else
                {
#if DEBUG
                    ProjectData.MapFile = $"{Dirry.AD(ProjectData.ProjectConfig.C("LevelDir"))}/Test Map";
#else
                    ProjectData.MapFile = $"{Dirry.AD(ProjectData.ProjectConfig.C("LevelDir"))}/{ProjectData.args[2]}";
#endif
                }
            }


            // Teddy Save Log
            TeddyBear.TeddySave.SetLog(ProjectData.Log);

            // Final
            base.Initialize();

            if (ProjectData.AllWell)
            {
                SetStage(Main.Me);
            }
        }