示例#1
0
        /// <summary>
        /// このトラックのメタテキストを,指定されたファイルに出力します.
        /// </summary>
        /// <param name="file"></param>
        public void printMetaText(string file, string encoding = "Shift_JIS")
        {
            TextStream tms    = new TextStream();
            int        count  = MetaText.getEventList().getCount();
            int        clLast = MetaText.getEventList().getElement(count - 1).Clock + 480;

            MetaText.print(tms, clLast, 0);
            InternalStreamWriter sw = null;

            try {
                sw = new InternalStreamWriter(file, encoding);
                tms.setPointer(-1);
                while (tms.ready())
                {
                    string line = tms.readLine().ToString();
                    sw.write(line);
                    sw.newLine();
                }
            } catch (Exception ex) {
                serr.println("VsqTrack#printMetaText; ex=" + ex);
            } finally {
                if (sw != null)
                {
                    try {
                        sw.close();
                    } catch (Exception ex2) {
                        serr.println("VsqTrack#printMetaText; ex2=" + ex2);
                    }
                }
            }
        }
示例#2
0
        public void write(string file, UstFileWriteOptions options)
        {
            InternalStreamWriter sw = null;

            try {
                sw = new InternalStreamWriter(file, "Shift_JIS");
                sw.write("[#SETTING]"); sw.newLine();
                if (options.settingTempo)
                {
                    sw.write("Tempo=" + m_tempo); sw.newLine();
                }
                if (options.settingTracks)
                {
                    sw.write("Tracks=1"); sw.newLine();
                }
                if (options.settingProjectName)
                {
                    sw.write("ProjectName=" + m_project_name); sw.newLine();
                }
                if (options.settingVoiceDir)
                {
                    sw.write("VoiceDir=" + m_voice_dir); sw.newLine();
                }
                if (options.settingOutFile)
                {
                    sw.write("OutFile=" + m_out_file); sw.newLine();
                }
                if (options.settingCacheDir)
                {
                    sw.write("CacheDir=" + m_cache_dir); sw.newLine();
                }
                if (options.settingTool1)
                {
                    sw.write("Tool1=" + m_tool1); sw.newLine();
                }
                if (options.settingTool2)
                {
                    sw.write("Tool2=" + m_tool2); sw.newLine();
                }
                UstTrack target = m_tracks[0];
                int      count  = target.getEventCount();
                for (int i = 0; i < count; i++)
                {
                    target.getEvent(i).print(sw);
                }
                if (options.trackEnd)
                {
                    sw.write("[#TRACKEND]");
                }
                sw.newLine();
            } catch (Exception ex) {
                serr.println("UstFile#write; ex=" + ex);
            } finally {
                if (sw != null)
                {
                    try {
                        sw.close();
                    } catch (Exception ex2) {
                        serr.println("UstFile#write; ex2=" + ex2);
                    }
                }
            }
        }