Пример #1
0
        public void open(string fileName)
        {
            if (currentPanel != null)
            {
                currentPanel.finalize();
                ContentContainer.Controls.Remove((Control)currentPanel);
            }

            FileIO.file file = FileIO.load(fileName);
            currentFormat = file.type;

            if (file.type != FileIO.formatType.unsupported)
            {
                switch (file.type)
                {
                    case FileIO.formatType.container: currentPanel = new OContainerPanel(); break;
                    case FileIO.formatType.image: currentPanel = new OImagePanel(); break;
                    case FileIO.formatType.model: currentPanel = new OViewportPanel(); break;
                    case FileIO.formatType.texture: currentPanel = new OTexturesPanel(); break;
                }

                ((Control)currentPanel).Dock = DockStyle.Fill;
                SuspendDrawing();
                ContentContainer.Controls.Add((Control)currentPanel);
                ContentContainer.Controls.SetChildIndex((Control)currentPanel, 0);
                ResumeDrawing();
                currentPanel.launch(file.data);
            }
            else
                MessageBox.Show("Unsupported file format!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
        }
Пример #2
0
        public void open(string fileName)
        {
            if (currentPanel != null)
            {
                currentPanel.finalize();
                ContentContainer.Controls.Remove((Control)currentPanel);
            }

            try
            {
                FileIO.file file = FileIO.load(fileName);
                currentFormat = file.type;

                if (currentFormat != FileIO.formatType.unsupported)
                {
                    switch (currentFormat)
                    {
                    case FileIO.formatType.container:
                        currentPanel = new OContainerPanel();
                        break;

                    case FileIO.formatType.image:
                        currentPanel = new OImagePanel();
                        break;

                    case FileIO.formatType.model:
                        currentPanel = new OViewportPanel();
                        break;

                    case FileIO.formatType.texture:
                        currentPanel = new OTexturesPanel();
                        break;
                    }

                    ((Control)currentPanel).Dock = DockStyle.Fill;
                    SuspendDrawing();
                    ContentContainer.Controls.Add((Control)currentPanel);
                    ContentContainer.Controls.SetChildIndex((Control)currentPanel, 0);
                    ResumeDrawing();
                    currentPanel.launch(file.data);
                }
                else
                {
                    MessageBox.Show("Unsupported file format!", "Error", MessageBoxButtons.OK,
                                    MessageBoxIcon.Exclamation);
                }
            }
            catch (Exception e)
            {
                MessageBox.Show("An error occured while reading this File!\n\n" + e.Message + "\n"
                                + Regex.Replace(e.StackTrace, @" in .*\:line", " at line").Replace("Ohana3DS_Rebirth.", ""), "Error",
                                MessageBoxButtons.OK, MessageBoxIcon.Exclamation);

                if (currentPanel != null)
                {
                    currentPanel.finalize();
                    ContentContainer.Controls.Remove((Control)currentPanel);
                }
            }
        }
Пример #3
0
        public void open(string fileName)
        {
            file          = FileIO.load(fileName);
            currentFormat = file.type;

            if (file.type != FileIO.formatType.unsupported)
            {
                switch (file.type)
                {
                case FileIO.formatType.container: currentPanel = new OContainerPanel(); break;

                case FileIO.formatType.image: currentPanel = new OImagePanel(); break;

                case FileIO.formatType.model: currentPanel = new OViewportPanel(); break;

                case FileIO.formatType.texture: currentPanel = new OTexturesPanel(); break;

                case FileIO.formatType.animation: currentPanel = new OAnimationsPanel(); break;
                }

                ((Control)currentPanel).Dock = DockStyle.Fill;
                SuspendDrawing();
                ContentContainer.Controls.Add((Control)currentPanel);
                ContentContainer.Controls.SetChildIndex((Control)currentPanel, 0);
                ResumeDrawing();
                currentPanel.launch(file.data);
            }
            else
            {
                MessageBox.Show("Unsupported file format!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        }
Пример #4
0
        /// <summary>
        ///     Imports a file of the given type.
        ///     Returns data relative to the chosen type.
        /// </summary>
        /// <param name="type">The type of the data</param>
        /// <returns></returns>
        public static object import(string fileName)
        {
            try
            {
                FileIO.file       file          = FileIO.load(fileName);
                FileIO.formatType currentFormat = file.type;

                if (currentFormat != FileIO.formatType.unsupported)
                {
                    switch (currentFormat)
                    {
                    case FileIO.formatType.container:
                        ((OContainer)file.data).name = Path.GetFileNameWithoutExtension(fileName);
                        return((OContainer)file.data);

                    case FileIO.formatType.image:
                        ((RenderBase.OTexture)file.data).name = Path.GetFileNameWithoutExtension(fileName);
                        return((RenderBase.OTexture)file.data);

                    case FileIO.formatType.model:
                        return((RenderBase.OModelGroup)file.data);

                    case FileIO.formatType.texture:
                        return((RenderBase.OTexture)file.data);
                    }
                }
                else
                {
                    Console.WriteLine("Error: Unsupported file format!");
                }
            }
            catch (Exception)
            {
                Console.WriteLine("Error: Unsupported file format!");
            }
            return(null);
        }
Пример #5
0
        public void open(string fileName)
        {
            modelChangeWatcher.EnableRaisingEvents = false;

            if (currentPanel != null)
            {
                currentPanel.finalize();
                ContentContainer.Controls.Remove((Control)currentPanel);
            }

            try
            {
                this.fileToOpen = fileName;

                FileIO.file file = FileIO.load(fileName);
                currentFormat = file.type;

                if (currentFormat != FileIO.formatType.unsupported)
                {
                    switch (currentFormat)
                    {
                    case FileIO.formatType.container:
                        currentPanel = new OContainerPanel();
                        break;

                    case FileIO.formatType.image:
                        currentPanel = new OImagePanel();
                        break;

                    case FileIO.formatType.model:
                        currentPanel = new OViewportPanel();
                        break;

                    case FileIO.formatType.texture:
                        currentPanel = new OTexturesPanel();
                        break;
                    }

                    ((Control)currentPanel).Dock = DockStyle.Fill;
                    SuspendDrawing();
                    ContentContainer.Controls.Add((Control)currentPanel);
                    ContentContainer.Controls.SetChildIndex((Control)currentPanel, 0);
                    ResumeDrawing();
                    currentPanel.launch(file.data);

                    modelChangeWatcher.Path = Path.GetDirectoryName(fileName);
                    modelChangeWatcher.EnableRaisingEvents = true;

                    Text = GetWindowTitle();
                }
                else
                {
                    MessageBox.Show("Unsupported file format!", "Error", MessageBoxButtons.OK,
                                    MessageBoxIcon.Exclamation);
                }
            }
            catch (Exception)
            {
                MessageBox.Show("Unsupported file format!", "Error", MessageBoxButtons.OK,
                                MessageBoxIcon.Exclamation);

                if (currentPanel != null)
                {
                    currentPanel.finalize();
                    ContentContainer.Controls.Remove((Control)currentPanel);
                }
            }
        }
Пример #6
0
        private void open(FileIO.file file)
        {
            if (currentPanel != null)
            {
                currentPanel.finalize();
                ContentContainer.Controls.Remove((Control)currentPanel);
                currentPanel = null;
            }

            try
            {
                //FileIO.file file = FileIO.load(fileName);
                currentFormat = file.type;

                if (currentFormat != FileIO.formatType.unsupported)
                {
                    switch (currentFormat)
                    {
                    case FileIO.formatType.container:
                        currentPanel = new OContainerPanel();
                        break;

                    case FileIO.formatType.image:
                        currentPanel = new OImagePanel();
                        break;

                    case FileIO.formatType.model:
                        currentPanel = new OViewportPanel();
                        break;

                    case FileIO.formatType.texture:
                        currentPanel = new OTexturesPanel();
                        break;
                    }

                    ((Control)currentPanel).Dock = DockStyle.Fill;
                    SuspendDrawing();
                    ContentContainer.Controls.Add((Control)currentPanel);
                    ContentContainer.Controls.SetChildIndex((Control)currentPanel, 0);
                    ResumeDrawing();
                    currentPanel.OpenSubResource += Panel_OpenSubResource;
                    currentPanel.launch(file.data);
                }
                else
                {
                    MessageBox.Show("Unsupported file format!", "Error", MessageBoxButtons.OK,
                                    MessageBoxIcon.Exclamation);
                }
            }
            catch (Exception)
            {
                MessageBox.Show("Unsupported file format!", "Error", MessageBoxButtons.OK,
                                MessageBoxIcon.Exclamation);

                if (currentPanel != null)
                {
                    currentPanel.finalize();
                    ContentContainer.Controls.Remove((Control)currentPanel);
                    currentPanel = null;
                }
            }
        }