Пример #1
0
        private void TagModify(string fullPath, FileInfomation fileInfomation)
        {
            var file = TagLib.File.Create(fullPath);
            var tag1 = file.GetTag(TagLib.TagTypes.Id3v1);

            tag1.Title      = fileInfomation.Title;
            tag1.Performers = fileInfomation.Performers;
            tag1.Comment    = "";

            var tag2 = file.GetTag(TagLib.TagTypes.Id3v2);

            tag2.Title      = fileInfomation.Title;
            tag2.Performers = fileInfomation.Performers;
            tag2.Comment    = "Create by MiguTools copyright protected MiguTools. Author kerryasuka.";

            file.Save();

            File.Delete(fileInfomation.FileInfo.FullName);
            normalCount++;
            LogEvent?.Invoke(string.Format("{0} - {1}", string.Join(',', fileInfomation.Performers), fileInfomation.Title), normalCount);
        }
Пример #2
0
        private void Adapter(List <FileInfo> files)
        {
            files.ForEach(f =>
            {
                string nameWithoutExtension = Path.GetFileNameWithoutExtension(f.Name);
                List <string> sns           = nameWithoutExtension.Split("-".ToCharArray()).ToList();

                if (sns.Count > 2)
                {
                    m_abnormalFile.Add(nameWithoutExtension);
                    return;
                }

                sns.ForEach(s =>
                {
                    if (string.IsNullOrEmpty(s))
                    {
                        sns.Remove(s);
                    }
                    ;
                });

                FileInfomation info = new FileInfomation()
                {
                    FileInfo             = f,
                    SourcePath           = sourcePath,
                    DestinationPath      = desPath,
                    NameWithoutExtension = nameWithoutExtension,
                    FileType             = (FileType)Enum.Parse(typeof(FileType), Path.GetExtension(f.Name).ToLower().Replace(".", "")),
                    Performers           = new string[] { sns[1].Trim() },
                    Title = sns[0].Trim(),
                };

                m_fileInfomation.Add(info);
            });

            ErrorEvent?.Invoke(m_abnormalFile);
        }