Esempio n. 1
0
        public Form OpenFile(byte[] File, string name)
        {
            BinaryDataReader bin   = new BinaryDataReader(new MemoryStream(File));
            string           Magic = bin.ReadString(4);

            if (Magic == "Yaz0")
            {
                return(OpenFile(ManagedYaz0.Decompress(File), name));
            }
            else if (Magic == "SARC")
            {
                var f = new EditorForms.SzsEditor(SARCExt.SARC.UnpackRamN(File), this);
                f.Text = name;
                OpenForm(f);
                return(f);
            }
            else if (Magic == "FLYT")
            {
                EditorView editorView = new EditorView(new BflytFile(File));
                editorView.Text = name;
                OpenForm(editorView);
                return(editorView);
            }
            else if (Magic == "FLAN")
            {
                var editor = new BflanEditor(new BflanFile(File));
                OpenForm(editor);
                return(editor);
            }
            return(null);
        }
Esempio n. 2
0
        public Form OpenFile(byte[] File, IFileWriter saveTo)
        {
            string Magic  = Encoding.ASCII.GetString(File, 0, 4);
            Form   result = null;

            if (Magic == "Yaz0")
            {
                return(OpenFile(ManagedYaz0.Decompress(File), saveTo));
            }
            else if (Magic == "SARC")
            {
                result = new EditorForms.SzsEditor(SARCExt.SARC.Unpack(File), saveTo, this);
            }
            else if (Magic == "FLYT")
            {
                result = new EditorView(new BflytFile(File), saveTo);
            }
            else if (Magic == "FLAN")
            {
                result = new BflanEditor(new BflanFile(File), saveTo);
            }

            if (result != null)
            {
                OpenForm(result);
            }

            return(result);
        }
Esempio n. 3
0
        private void BFLANToolStripMenuItem_Click(object sender, EventArgs e)
        {
            var f = BflanEditor.OpenFromJson();

            if (f != null)
            {
                OpenForm(f);
            }
        }
Esempio n. 4
0
 private void BFLANToolStripMenuItem_Click(object sender, EventArgs e)
 {
     try
     {
         var f = BflanEditor.OpenFromJson();
         if (f != null)
         {
             OpenForm(f);
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(
             "Error while opening the provided file: " + ex.Message + "\r\n" +
             "This often happens when trying to open a json file that doesn't contain animations. " +
             "If you want to open a json layout open the target szs first and then load it from the window that appears.\r\n\r\n" +
             "More details: " + ex.ToString());
     }
 }