コード例 #1
0
        void LoadCustomMidis()
        {
            string[] paths = System.IO.Directory.GetFiles(UnityEngine.Application.persistentDataPath, "*.mid");
            if (paths.Length == 0)
            {
                return;
            }

            foreach (string path in paths)
            {
                var fileName  = System.IO.Path.GetFileName(path);
                var midiProto = new Protos.Api.MidiProto {
                    _id             = path,
                    name            = fileName,
                    sourceSongName  = "Unknown".Translate(),
                    sourceAlbumName = "Local Midis".Translate(),
                };
                midiProtoList.Add(midiProto);
            }
        }
コード例 #2
0
 public static byte[] ReadMidiBytes(Protos.Api.MidiProto midi)
 {
     return(System.IO.File.Exists(midi._id) ? System.IO.File.ReadAllBytes(midi._id) :
            System.IO.File.ReadAllBytes(System.IO.Path.Combine(WebCache.instance.rootPath, midi.hash)));
 }