Ejemplo n.º 1
0
        private void AddFileM3U(music mc, object entry = null)
        {
            PlayList pl;

            if (entry == null)
            {
                pl = M3U.LoadM3U(mc.fileName, rootPath);
            }
            else
            {
                pl = M3U.LoadM3U(entry, mc.arcFileName);
            }
            if (pl == null)
            {
                return;
            }
            if (pl.lstMusic == null || pl.lstMusic.Count < 1)
            {
                return;
            }

            foreach (music m in pl.lstMusic)
            {
                AddFileLoop(m, entry);
            }
        }
Ejemplo n.º 2
0
        private void AddFileLZH(music mc, object entry = null)
        {
            if (entry != null)
            {
                return;
            }

            UnlhaWrap.UnlhaCmd             cmd = new UnlhaWrap.UnlhaCmd();
            List <Tuple <string, UInt64> > res = cmd.GetFileList(mc.fileName, "*.*");

            mc.arcFileName = mc.fileName;
            mc.arcType     = EnmArcType.LZH;
            List <string> zipMember = new List <string>();
            List <music>  mMember   = new List <music>();

            foreach (Tuple <string, UInt64> ent in res)
            {
                if (Common.CheckExt(ent.Item1) != EnmFileFormat.M3U)
                {
                    zipMember.Add(ent.Item1);
                }
                else
                {
                    PlayList pl = M3U.LoadM3U(ent, mc.arcFileName);
                    foreach (music m in pl.lstMusic)
                    {
                        mMember.Add(m);
                    }
                }
            }

            foreach (string zm in zipMember)
            {
                bool found = false;
                foreach (music m in mMember)
                {
                    if (m.fileName == zm)
                    {
                        found = true;
                        break;
                    }
                }
                if (!found && Common.CheckExt(zm) == EnmFileFormat.VGM)
                {
                    string vzm = "";
                    if (Path.GetExtension(zm).ToLower() == ".vgm")
                    {
                        vzm = Path.ChangeExtension(zm, ".vgz");
                    }
                    else
                    {
                        vzm = Path.ChangeExtension(zm, ".vgm");
                    }
                    foreach (music m in mMember)
                    {
                        if (m.fileName == vzm)
                        {
                            found = true;
                            break;
                        }
                    }
                }
                if (!found)
                {
                    music zmc = new music();
                    zmc.fileName    = zm;
                    zmc.arcFileName = mc.arcFileName;
                    zmc.arcType     = mc.arcType;
                    mMember.Add(zmc);
                }
            }

            foreach (Tuple <string, UInt64> ent in res)
            {
                foreach (music m in mMember)
                {
                    string vzm = "";
                    if (Path.GetExtension(m.fileName).ToLower() == ".vgm")
                    {
                        vzm = Path.ChangeExtension(m.fileName, ".vgz");
                    }
                    else if (Path.GetExtension(m.fileName).ToLower() == ".vgz")
                    {
                        vzm = Path.ChangeExtension(m.fileName, ".vgm");
                    }

                    if (ent.Item1 == m.fileName || ent.Item1 == vzm)
                    {
                        m.format      = Common.CheckExt(m.fileName);
                        m.arcFileName = mc.arcFileName;
                        m.arcType     = mc.arcType;
                        AddFileLoop(m, new Tuple <string, string>(m.arcFileName, ent.Item1));
                    }
                }
            }
        }
Ejemplo n.º 3
0
        private void AddFileZIP(music mc, object entry = null)
        {
            if (entry != null)
            {
                return;
            }

            using (ZipArchive archive = ZipFile.OpenRead(mc.fileName))
            {
                mc.arcFileName = mc.fileName;
                mc.arcType     = EnmArcType.ZIP;
                List <string> zipMember = new List <string>();
                List <music>  mMember   = new List <music>();
                foreach (ZipArchiveEntry ent in archive.Entries)
                {
                    if (Common.CheckExt(ent.FullName) != EnmFileFormat.M3U)
                    {
                        zipMember.Add(ent.FullName);
                    }
                    else
                    {
                        PlayList pl = M3U.LoadM3U(ent, mc.arcFileName);
                        foreach (music m in pl.lstMusic)
                        {
                            mMember.Add(m);
                        }
                    }
                }

                foreach (string zm in zipMember)
                {
                    bool found = false;
                    foreach (music m in mMember)
                    {
                        if (m.fileName == zm)
                        {
                            found = true;
                            break;
                        }
                    }
                    if (!found && Common.CheckExt(zm) == EnmFileFormat.VGM)
                    {
                        string vzm = "";
                        if (Path.GetExtension(zm).ToLower() == ".vgm")
                        {
                            vzm = Path.ChangeExtension(zm, ".vgz");
                        }
                        else
                        {
                            vzm = Path.ChangeExtension(zm, ".vgm");
                        }
                        foreach (music m in mMember)
                        {
                            if (m.fileName == vzm)
                            {
                                found = true;
                                break;
                            }
                        }
                    }
                    if (!found)
                    {
                        music zmc = new music();
                        zmc.fileName    = zm;
                        zmc.arcFileName = mc.arcFileName;
                        zmc.arcType     = mc.arcType;
                        mMember.Add(zmc);
                    }
                }

                foreach (ZipArchiveEntry ent in archive.Entries)
                {
                    foreach (music m in mMember)
                    {
                        string vzm = "";
                        if (Path.GetExtension(m.fileName).ToLower() == ".vgm")
                        {
                            vzm = Path.ChangeExtension(m.fileName, ".vgz");
                        }
                        else if (Path.GetExtension(m.fileName).ToLower() == ".vgz")
                        {
                            vzm = Path.ChangeExtension(m.fileName, ".vgm");
                        }

                        if (ent.FullName == m.fileName || ent.FullName == vzm)
                        {
                            m.format      = Common.CheckExt(m.fileName);
                            m.arcFileName = mc.arcFileName;
                            m.arcType     = mc.arcType;
                            AddFileLoop(m, ent);
                        }
                    }
                }
            }
        }