예제 #1
0
        private void Open()
        {
            OpenFileDialog openFile = new OpenFileDialog();

            openFile.Filter = "N64 ROMs (*.n64, *.z64)|*.n64;*.z64|All files|*";

            if (openFile.ShowDialog() == true)
            {
                Version = CheckRomVersion(openFile.FileName);

                if (Version == ROMVer.Unknown)
                {
                    return;
                }

                Importer file = new Importer(openFile.FileName, m_controlCodes, false, Version == ROMVer.Debug);
                MessageList = file.GetMessageList();

                // If message list is null, we failed to open a ROM
                if (MessageList == null)
                {
                    return;
                }

                m_inputFileName = openFile.FileName;
                m_inputFile     = file.GetInputFile();

                ViewSource.Source = MessageList;
                SelectedMessage   = MessageList[0];

                WindowTitle = string.Format("{0} - Ocarina of Time Text Editor", openFile.FileName);

                OldMode  = true;
                ZZRPMode = false;
            }
        }
예제 #2
0
        private void OpenZZRPL()
        {
            OpenFileDialog openFile = new OpenFileDialog();

            openFile.Filter = "zzrtl Projects (*.zzrpl)|*.zzrpl";

            if (openFile.ShowDialog() == true)
            {
                string zzrplFolder = Path.GetDirectoryName(openFile.FileName);


                string msgDataEd = Path.Combine(zzrplFolder, "messages", "StringData.bin");
                string tableEd   = Path.Combine(zzrplFolder, "messages", "MessageTable.tbl");

                if (!File.Exists(msgDataEd) || !File.Exists(tableEd))
                {
                    string msgData    = Path.Combine(zzrplFolder, "messages", "_vanilla-1.0", "StringData.bin");
                    string table      = Path.Combine(zzrplFolder, "messages", "_vanilla-1.0", "MessageTable.tbl");
                    string msgDataDeb = Path.Combine(zzrplFolder, "messages", "_vanilla-debug", "StringData.bin");
                    string tableDeb   = Path.Combine(zzrplFolder, "messages", "_vanilla-debug", "MessageTable.tbl");

                    if ((!File.Exists(msgData) || !File.Exists(table)) && (!File.Exists(msgDataDeb) || !File.Exists(tableDeb)))
                    {
                        System.Windows.Forms.MessageBox.Show("Not a ZZRTL-Audio filesystem.");
                        return;
                    }

                    if (File.Exists(msgData))
                    {
                        File.Copy(msgData, msgDataEd);
                        File.Copy(table, tableEd);
                    }
                    else if (File.Exists(msgDataDeb))
                    {
                        File.Copy(msgDataDeb, msgDataEd);
                        File.Copy(tableDeb, tableEd);
                    }
                }

                Importer file = new Importer(openFile.FileName, m_controlCodes, EditMode.ZZRPL, Version == ROMVer.Debug);
                MessageList = file.GetMessageList();

                // If message list is null, we failed to parse.
                if (MessageList == null)
                {
                    return;
                }

                m_inputFileName = openFile.FileName;
                m_inputFile     = file.GetInputFile();

                ViewSource.Source = MessageList;
                SelectedMessage   = MessageList[0];

                WindowTitle = Path.GetFileNameWithoutExtension(openFile.FileName) + " - Ocarina of Time Text Editor";

                ZZRPMode  = false;
                OldMode   = false;
                ZZRPLMode = true;
            }
        }