Ejemplo n.º 1
0
        public ConverterOptions(MocoConverter converter)
        {
            this.Converter = converter;
            this.ConverterSettings = converter.Settings;

            ExtensionConverter.converter = this.Converter;
        }
Ejemplo n.º 2
0
        public FormMain()
        {
            InitializeComponent();

            logWindow = new FormLog();
            logWindow.VisibleChanged += logWindow_VisibleChanged;
            logWindow.Show();
            //logWindow.Owner = this;

            converter = new MocoConverter(new MocoSettings() {
                LogProvider = logWindow
            });
            converter.LoadPlugins(Path.GetFullPath("."));

            converterOptions = new ConverterOptions(converter);
            converterOptions.LoadSettings();
            propertyGrid1.SelectedObject = converterOptions;
        }
Ejemplo n.º 3
0
        static void Main(string[] args)
        {
            Stopwatch watch = new Stopwatch();
            watch.Start();

            Program.config = new Config();
            bool argsOK = true;

            try
            {
                // TODO: load some optional global config file
                parseCliArgumenst(args);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());
                argsOK = false;
            }

            // alls things loaded
            if (Program.config.WriteInfo)
            {
                string version = Assembly.GetExecutingAssembly().GetName().Version.ToString();
                Console.WriteLine("MocoChan CLI v. {0}", version);
                Console.WriteLine();
            }

            // check if import and export is given
            if (Program.config.InputFiles.Count == 0)
            {
                Console.WriteLine("At least one input File is needed");
                Console.WriteLine();
                Program.config.WriteHelp = true;
                argsOK = false;
            }

            if (string.IsNullOrWhiteSpace(Program.config.Exporter))
            {
                Console.WriteLine("exporter (-e) must be set");
                Console.WriteLine();
                Program.config.WriteHelp = true;
                argsOK = false;
            }

            if (Program.config.WriteHelp)
            {
                Console.WriteLine("Basic Usage:");
                Console.WriteLine(" MocoChan -e ext [options] inputFile.ext [inputFile.ext, ...]");
                Console.WriteLine();
                Console.WriteLine("List of avaible options:");
                Console.WriteLine(" -e     --exporter : Extension of File Type to the exported to.");
                Console.WriteLine("        --pluginDir  : Allows you to load Plugin from a Directory different than");
                Console.WriteLine("                       the current Folder.");
                Console.WriteLine(" -s     --scale      : Scale the model by Factor. 2 = double size, 0.5 half size");
                Console.WriteLine(" -n     --normals    : recalculate the Normals");
                Console.WriteLine(" -o     --output     : Set output Folder. Default same as file origin.");

                Console.WriteLine();
            }

            if (!argsOK)
            {
                // a message shouls be already be printed
                return;
            }

            //settings.outputDir = Program.config.outputDir;
            //settings.exporter = Program.config.exporter;

            MocoConverter converter = new MocoConverter(new MocoSettings() {
                LogProvider = new ConsoleLogProvider()
            });
            converter.LoadPlugins(Program.config.PluginDirectory);

            foreach (string file in Program.config.InputFiles)
            {
                converter.Convert(file, "");
            }

            Console.WriteLine();
            Console.WriteLine("Totaltime: {0}", watch.Elapsed.ToString());

            #if DEBUG
            Console.ReadKey();
            #endif
        }