コード例 #1
0
    public void SaveWAV()
    {
        if (m_OperationInProgress)
        {
            return;
        }

        if (m_WavSave.ShowDialog())
        {
            StartCoroutine(SaveWAVRoutine(m_WavSave.OpenFile( ), true));
        }
    }
コード例 #2
0
    public void SaveVGM()
    {
        if (m_OperationInProgress)
        {
            return;
        }

        if (m_VgmSave.ShowDialog())
        {
            StartCoroutine(SaveVGMRoutine(m_VgmSave));
        }
    }
コード例 #3
0
    public void SaveFile(bool saveAs = true)
    {
        playback.Stop( );

        if (!saveAs && (m_OpenFile == "" || !File.Exists(m_OpenFile)))
        {
            saveAs = true;
        }

        if (!saveAs || m_TuneSave.ShowDialog())
        {
            SongFile song = new SongFile( );
            song.patternLength  = data.patternLength;
            song.lookupTable    = data.lookupTable;
            song.transposeTable = data.transposeTable;
            song.songData       = data.songData;

            int presetCount = instruments.presets.Length;
            song.instruments = new Instruments.InstrumentInstance [presetCount];
            Array.Copy(instruments.presets, song.instruments, presetCount);

            song.songName   = SongData.songName;
            song.artistName = SongData.artistName;

            IFormatter formatter = new BinaryFormatter();
            Stream     fs        = !saveAs ? new FileStream(m_OpenFile, FileMode.Create) : m_TuneSave.OpenFile( );
            formatter.Serialize(fs, song);
            fs.Close( );

            if (saveAs)
            {
                m_OpenFile = m_TuneSave.filePath;
            }

            fileModified = false;
        }
    }