Esempio n. 1
0
        public static void Call(string path)
        {
            var efkpkg = new EfkPkg();

            efkpkg.AddCurrentEffect();
            efkpkg.Export(path);
        }
Esempio n. 2
0
        public void Show(string path, EfkPkg efkpkg)
        {
            title          = MultiLanguageTextProvider.GetText("ImportEfkPkgTitle");
            EfkPkg         = efkpkg;
            sourceFilePath = Utils.Misc.BackSlashToSlash(path);

            // FileViewer Path or Current Effect Path or Current Directory
            var fileViewer = (Dock.FileViewer)Manager.GetWindow(typeof(Dock.FileViewer));

            if (fileViewer != null && !string.IsNullOrEmpty(fileViewer.CurrentPath))
            {
                targetDirPath = fileViewer.CurrentPath;
            }
            else if (!string.IsNullOrEmpty(Core.Root.GetFullPath()))
            {
                targetDirPath = Path.GetDirectoryName(Core.Root.GetFullPath());
            }
            else
            {
                targetDirPath = Directory.GetCurrentDirectory();
            }
            targetDirPath      = Utils.Misc.BackSlashToSlash(targetDirPath);
            targetDirPathValid = Directory.Exists(targetDirPath);

            foreach (var file in efkpkg.AllFiles)
            {
                var import = new ImportFile();
                import.DestinationName = file.RelativePath;
                import.DoesImport      = true;
                import.ValidationPath(targetDirPath);
                importFiles.Add(file, import);
            }

            Manager.AddControl(this);
        }
Esempio n. 3
0
        public void Show(string path, EfkPkg efkpkg)
        {
            title          = MultiLanguageTextProvider.GetText("ImportEfkPkgTitle");
            sourceFilePath = Utils.Misc.BackSlashToSlash(path);

            // FileViewer Path or Current Effect Path or Current Directory
            string targetDirPath = null;
            var    fileViewer    = (Dock.FileViewer)Manager.GetWindow(typeof(Dock.FileViewer));

            if (fileViewer != null && !string.IsNullOrEmpty(fileViewer.CurrentPath))
            {
                targetDirPath = fileViewer.CurrentPath;
            }
            else if (!string.IsNullOrEmpty(Core.Root.GetFullPath()))
            {
                targetDirPath = Path.GetDirectoryName(Core.Root.GetFullPath());
            }
            else
            {
                targetDirPath = Directory.GetCurrentDirectory();
            }

            try
            {
                importer = new EfkPkgImporter(efkpkg, targetDirPath);
            }
            catch (Exception e)
            {
                var mb = new MessageBox();
                mb.Show("Error", e.Message);
                ShouldBeRemoved = true;
            }

            Manager.AddControl(this);
        }
Esempio n. 4
0
        public void Show(string path, EfkPkg efkpkg)
        {
            if (Core.Language == Language.Japanese)
            {
                this.title = "Effekseerパッケージのインポート";
            }
            else
            {
                this.title = "Importing the Effekseer package";
            }

            EfkPkg         = efkpkg;
            sourceFilePath = Utils.Misc.BackSlashToSlash(path);

            // FileViewer Path or Current Effect Path or Current Directory
            var fileViewer = (Dock.FileViewer)Manager.GetWindow(typeof(Dock.FileViewer));

            if (fileViewer != null && !string.IsNullOrEmpty(fileViewer.CurrentPath))
            {
                targetDirPath = fileViewer.CurrentPath;
            }
            else if (!string.IsNullOrEmpty(Core.Root.GetFullPath()))
            {
                targetDirPath = Path.GetDirectoryName(Core.Root.GetFullPath());
            }
            else
            {
                targetDirPath = Directory.GetCurrentDirectory();
            }
            targetDirPath      = Utils.Misc.BackSlashToSlash(targetDirPath);
            targetDirPathValid = Directory.Exists(targetDirPath);

            foreach (var file in efkpkg.AllFiles)
            {
                var import = new ImportFile();
                import.DestinationName = file.Name;
                import.DoesImport      = true;
                import.ValidationPath(targetDirPath);
                importFiles.Add(file, import);
            }

            Manager.AddControl(this);
        }
Esempio n. 5
0
        public void Update()
        {
            if (isFirstUpdate)
            {
                Manager.NativeManager.OpenPopup(id);
                isFirstUpdate = false;
            }

            float dpiScale = Manager.DpiScale;

            Manager.NativeManager.SetNextWindowSize(500 * dpiScale, 400 * dpiScale, swig.Cond.Once);

            if (Manager.NativeManager.BeginPopupModal(title + id, ref opened))
            {
                {
                    var text = MultiLanguageTextProvider.GetText("ImportSourcePackage");
                    Manager.NativeManager.PushItemWidth(-1);
                    Manager.NativeManager.Text(text);
                    Manager.NativeManager.InputText("###SSourceFilePath", sourceFilePath, swig.InputTextFlags.ReadOnly);
                    Manager.NativeManager.PopItemWidth();
                }
                {
                    var text = MultiLanguageTextProvider.GetText("ImportDestinationDirectory");
                    Manager.NativeManager.PushItemWidth(-Manager.NativeManager.GetTextLineHeightWithSpacing());
                    Manager.NativeManager.Text(text);
                    string icon = (targetDirPathValid) ? Icons.CommonCheck : Icons.CommonError;
                    if (Manager.NativeManager.InputText(icon + "###TargetDirPath", targetDirPath))
                    {
                        targetDirPath      = Manager.NativeManager.GetInputTextResult();
                        targetDirPathValid = Directory.Exists(targetDirPath);
                        foreach (var file in EfkPkg.AllFiles)
                        {
                            importFiles[file].ValidationPath(targetDirPath);
                        }
                    }
                    Manager.NativeManager.PopItemWidth();
                }

                Manager.NativeManager.Spacing();

                var size = Manager.NativeManager.GetContentRegionAvail();
                UpdateFileList(new swig.Vec2(0, size.Y - 32 * dpiScale));

                Manager.NativeManager.Spacing();

                {
                    var textImport = MultiLanguageTextProvider.GetText("Import");
                    var textCancel = MultiLanguageTextProvider.GetText("Cancel");

                    float buttonWidth = 100 * dpiScale;
                    Manager.NativeManager.SetCursorPosX(Manager.NativeManager.GetContentRegionAvail().X / 2 - buttonWidth + 4 * dpiScale);

                    if (Manager.NativeManager.Button(textImport, buttonWidth))
                    {
                        var files = importFiles
                                    .Where(kv => kv.Value.DoesImport)
                                    .Select(kv => kv.Key)
                                    .ToArray();

                        foreach (var file in files)
                        {
                            file.Name = importFiles[file].DestinationName;
                        }

                        try
                        {
                            EfkPkg.ExtractFiles(targetDirPath, files);
                        }
                        catch (Exception e)
                        {
                            var mb = new MessageBox();
                            mb.Show("Error", e.Message);
                        }

                        ShouldBeRemoved = true;
                    }

                    Manager.NativeManager.SameLine();

                    if (Manager.NativeManager.Button(textCancel, buttonWidth))
                    {
                        ShouldBeRemoved = true;
                    }
                }

                Manager.NativeManager.EndPopup();
            }
            else
            {
                ShouldBeRemoved = true;
            }
        }