Exemplo n.º 1
0
        static public void Register(ExportBasis Driver, string name)
        {
            Drivers[name] = Driver;
            Debug.WriteLine($"Registered export driver '{name}'");
#if EXPORT_ALPHA
            System.Console.WriteLine($"ALPHA> Registered export driver '{name}'");
#endif
        }
Exemplo n.º 2
0
 void Init(string[] args)
 {
     Kthura.automap = false;
     if (args.Length == 0)
     {
         Uitleg();
         OriCol();
         Environment.Exit(0);
     }
     InitJCR6.Go();
     ExportBasis.Init();
     Dirry.InitAltDrives(AltDrivePlaforms.Windows); // TODO: I may need to expand this later for Linux and Mac.
     cli_Settings = new FlagParse(args);
     cli_Settings.CrString("target");
     cli_Settings.CrString("project");
     cli_Settings.CrString("map");
     cli_Settings.CrString("xpto");
     if (!cli_Settings.Parse())
     {
         Uitleg();
         Error("Parsing command line input failed!");
     }
     Project = cli_Settings.GetString("project");
     Map     = cli_Settings.GetString("map");
     XPTo    = cli_Settings.GetString("xpto");
     Target  = cli_Settings.GetString("target");
     Assert(File.Exists(GlobalConfigFile), $"I cannot find {GlobalConfigFile}");
     GlobalConfig = GINI.ReadFromFile(GlobalConfigFile);
     Assert(GlobalConfig != null, "Global config could nt be properly loaded");
     Assert(Project, "Hey! I don't have a project!");
     Assert(WorkSpace, "I can't find out what the workspace is. Is Kthura properly configured?");
     Assert(File.Exists(ProjectConfigFile), $"I could not access {ProjectConfigFile}. It appears it doesn't exist!");
     Doing("Reading project", ProjectConfigFile);
     ProjectConfig = GINI.ReadFromFile(ProjectConfigFile);
     Assert(ProjectConfig, "Project could not be properly read.");
     Target = cli_Settings.GetString("target");
     if (Target == "")
     {
         Target = ProjectConfig.C("EXPORT.TARGET");
     }
     Assert(Target, "No target");
     Doing("Exporting to", Target);
     Assert(ExportBasis.HaveDriver(Target), $"Driver to export to {Target} has not been found!");
     XPTo = cli_Settings.GetString("xpto");
     if (XPTo == "")
     {
         XPTo = ProjectConfig.C("EXPORT.XPTO");
     }
     Assert(XPTo, "No export-to folder.");
     Map = cli_Settings.GetString("map");
 }
Exemplo n.º 3
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.º 4
0
 static public void Register(ExportBasis Driver) => Register(Driver, Driver.name);