Exemple #1
0
        static void InitializeScripts(string entryDirectory)
        {
#if SCRIPT_ENABLED
            // Load scripts
            System.IO.Directory.CreateDirectory(entryDirectory + "scripts");
            System.IO.Directory.CreateDirectory(entryDirectory + "scripts/import");
            System.IO.Directory.CreateDirectory(entryDirectory + "scripts/export");
            System.IO.Directory.CreateDirectory(entryDirectory + "scripts/command");
            System.IO.Directory.CreateDirectory(entryDirectory + "scripts/selected");

            Script.Compiler.Initialize();

            {
                var files = System.IO.Directory.GetFiles(entryDirectory + "scripts/command", "*.*", System.IO.SearchOption.AllDirectories);

                foreach (var file in files)
                {
                    var ext = System.IO.Path.GetExtension(file);
                    if (ext == ".cs" || ext == ".py")
                    {
                        Script.CommandScript script = null;
                        string error = string.Empty;

                        if (Script.Compiler.CompileScript <Script.CommandScript>(file, out script, out error))
                        {
                            CommandScripts.Add(script);
                        }
                        else
                        {
                            if (OnOutputMessage != null)
                            {
                                OnOutputMessage(error);
                            }
                        }
                    }
                }
            }

            {
                var files = System.IO.Directory.GetFiles(entryDirectory + "scripts/selected", "*.*", System.IO.SearchOption.AllDirectories);
                foreach (var file in files)
                {
                    var ext = System.IO.Path.GetExtension(file);
                    if (ext == ".cs" || ext == ".py")
                    {
                        Script.SelectedScript script = null;
                        string error = string.Empty;

                        if (Script.Compiler.CompileScript <Script.SelectedScript>(file, out script, out error))
                        {
                            SelectedScripts.Add(script);
                        }
                        else
                        {
                            if (OnOutputMessage != null)
                            {
                                OnOutputMessage(error);
                            }
                        }
                    }
                }
            }

            {
                var files = System.IO.Directory.GetFiles(entryDirectory + "scripts/export", "*.*", System.IO.SearchOption.AllDirectories);
                foreach (var file in files)
                {
                    var ext = System.IO.Path.GetExtension(file);
                    if (ext == ".cs" || ext == ".py")
                    {
                        Script.ExportScript script = null;
                        string error = string.Empty;

                        if (Script.Compiler.CompileScript <Script.ExportScript>(file, out script, out error))
                        {
                            ExportScripts.Add(script);
                        }
                        else
                        {
                            if (OnOutputMessage != null)
                            {
                                OnOutputMessage(error);
                            }
                        }

                        Console.WriteLine(error);
                    }
                }
            }

            {
                var files = System.IO.Directory.GetFiles(entryDirectory + "scripts/import", "*.*", System.IO.SearchOption.AllDirectories);
                foreach (var file in files)
                {
                    var ext = System.IO.Path.GetExtension(file);
                    if (ext == ".cs" || ext == ".py")
                    {
                        Script.ImportScript script = null;
                        string error = string.Empty;

                        if (Script.Compiler.CompileScript <Script.ImportScript>(file, out script, out error))
                        {
                            ImportScripts.Add(script);
                        }
                        else
                        {
                            if (OnOutputMessage != null)
                            {
                                OnOutputMessage(error);
                            }
                        }
                    }
                }
            }
#endif
        }
Exemple #2
0
        public static void Initialize()
        {
            var entryDirectory = GetEntryDirectory() + "\\";

            // スクリプト読み込み
            System.IO.Directory.CreateDirectory(entryDirectory + "scripts");
            System.IO.Directory.CreateDirectory(entryDirectory + "scripts/import");
            System.IO.Directory.CreateDirectory(entryDirectory + "scripts/export");
            System.IO.Directory.CreateDirectory(entryDirectory + "scripts/command");
            System.IO.Directory.CreateDirectory(entryDirectory + "scripts/selected");

            Script.Compiler.Initialize();

            {
                var files = System.IO.Directory.GetFiles(entryDirectory + "scripts/command", "*.*", System.IO.SearchOption.AllDirectories);
                foreach (var file in files)
                {
                    var ext = System.IO.Path.GetExtension(file);
                    if (ext == ".cs" || ext == ".py")
                    {
                        Script.CommandScript script = null;
                        string error = string.Empty;

                        if (Script.Compiler.CompileScript <Script.CommandScript>(file, out script, out error))
                        {
                            CommandScripts.Add(script);
                        }
                        else
                        {
                            if (OnOutputMessage != null)
                            {
                                OnOutputMessage(error);
                            }
                        }
                    }
                }
            }

            {
                var files = System.IO.Directory.GetFiles(entryDirectory + "scripts/selected", "*.*", System.IO.SearchOption.AllDirectories);
                foreach (var file in files)
                {
                    var ext = System.IO.Path.GetExtension(file);
                    if (ext == ".cs" || ext == ".py")
                    {
                        Script.SelectedScript script = null;
                        string error = string.Empty;

                        if (Script.Compiler.CompileScript <Script.SelectedScript>(file, out script, out error))
                        {
                            SelectedScripts.Add(script);
                        }
                        else
                        {
                            if (OnOutputMessage != null)
                            {
                                OnOutputMessage(error);
                            }
                        }
                    }
                }
            }

            {
                var files = System.IO.Directory.GetFiles(entryDirectory + "scripts/export", "*.*", System.IO.SearchOption.AllDirectories);
                foreach (var file in files)
                {
                    var ext = System.IO.Path.GetExtension(file);
                    if (ext == ".cs" || ext == ".py")
                    {
                        Script.ExportScript script = null;
                        string error = string.Empty;

                        if (Script.Compiler.CompileScript <Script.ExportScript>(file, out script, out error))
                        {
                            ExportScripts.Add(script);
                        }
                        else
                        {
                            if (OnOutputMessage != null)
                            {
                                OnOutputMessage(error);
                            }
                        }
                    }
                }
            }

            {
                var files = System.IO.Directory.GetFiles(entryDirectory + "scripts/import", "*.*", System.IO.SearchOption.AllDirectories);
                foreach (var file in files)
                {
                    var ext = System.IO.Path.GetExtension(file);
                    if (ext == ".cs" || ext == ".py")
                    {
                        Script.ImportScript script = null;
                        string error = string.Empty;

                        if (Script.Compiler.CompileScript <Script.ImportScript>(file, out script, out error))
                        {
                            ImportScripts.Add(script);
                        }
                        else
                        {
                            if (OnOutputMessage != null)
                            {
                                OnOutputMessage(error);
                            }
                        }
                    }
                }
            }

            LoadOption();
        }
Exemple #3
0
        public static void Initialize(Language?language = null)
        {
            var entryDirectory = GetEntryDirectory() + "/";

            Command.CommandManager.Changed += new EventHandler(CommandManager_Changed);
            FullPath = string.Empty;

            option = LoadOption(language);

            // Switch the language according to the loaded settings
            Language = Option.GuiLanguage;

            // Switch the culture according to the set language
            switch (Language)
            {
            case Effekseer.Language.English:
                Thread.CurrentThread.CurrentUICulture = new CultureInfo("en-US");
                break;

            case Effekseer.Language.Japanese:
                Thread.CurrentThread.CurrentUICulture = new CultureInfo("ja-JP");
                break;
            }

            New();

            // Load scripts
            System.IO.Directory.CreateDirectory(entryDirectory + "scripts");
            System.IO.Directory.CreateDirectory(entryDirectory + "scripts/import");
            System.IO.Directory.CreateDirectory(entryDirectory + "scripts/export");
            System.IO.Directory.CreateDirectory(entryDirectory + "scripts/command");
            System.IO.Directory.CreateDirectory(entryDirectory + "scripts/selected");

            Script.Compiler.Initialize();

            {
                var files = System.IO.Directory.GetFiles(entryDirectory + "scripts/command", "*.*", System.IO.SearchOption.AllDirectories);

                foreach (var file in files)
                {
                    var ext = System.IO.Path.GetExtension(file);
                    if (ext == ".cs" || ext == ".py")
                    {
                        Script.CommandScript script = null;
                        string error = string.Empty;

                        if (Script.Compiler.CompileScript <Script.CommandScript>(file, out script, out error))
                        {
                            CommandScripts.Add(script);
                        }
                        else
                        {
                            if (OnOutputMessage != null)
                            {
                                OnOutputMessage(error);
                            }
                        }
                    }
                }
            }

            {
                var files = System.IO.Directory.GetFiles(entryDirectory + "scripts/selected", "*.*", System.IO.SearchOption.AllDirectories);
                foreach (var file in files)
                {
                    var ext = System.IO.Path.GetExtension(file);
                    if (ext == ".cs" || ext == ".py")
                    {
                        Script.SelectedScript script = null;
                        string error = string.Empty;

                        if (Script.Compiler.CompileScript <Script.SelectedScript>(file, out script, out error))
                        {
                            SelectedScripts.Add(script);
                        }
                        else
                        {
                            if (OnOutputMessage != null)
                            {
                                OnOutputMessage(error);
                            }
                        }
                    }
                }
            }

            {
                var files = System.IO.Directory.GetFiles(entryDirectory + "scripts/export", "*.*", System.IO.SearchOption.AllDirectories);
                foreach (var file in files)
                {
                    var ext = System.IO.Path.GetExtension(file);
                    if (ext == ".cs" || ext == ".py")
                    {
                        Script.ExportScript script = null;
                        string error = string.Empty;

                        if (Script.Compiler.CompileScript <Script.ExportScript>(file, out script, out error))
                        {
                            ExportScripts.Add(script);
                        }
                        else
                        {
                            if (OnOutputMessage != null)
                            {
                                OnOutputMessage(error);
                            }
                        }

                        Console.WriteLine(error);
                    }
                }
            }

            {
                var files = System.IO.Directory.GetFiles(entryDirectory + "scripts/import", "*.*", System.IO.SearchOption.AllDirectories);
                foreach (var file in files)
                {
                    var ext = System.IO.Path.GetExtension(file);
                    if (ext == ".cs" || ext == ".py")
                    {
                        Script.ImportScript script = null;
                        string error = string.Empty;

                        if (Script.Compiler.CompileScript <Script.ImportScript>(file, out script, out error))
                        {
                            ImportScripts.Add(script);
                        }
                        else
                        {
                            if (OnOutputMessage != null)
                            {
                                OnOutputMessage(error);
                            }
                        }
                    }
                }
            }
        }