Пример #1
0
        public static void SetNewFileName()
        {
            //파일 경로가 있을때.
            if (!string.IsNullOrEmpty(FIleManager.FilePath))
            {
                string path = FIleManager.FilePath.Substring(0, FilePath.LastIndexOf('\\') + 1);
                //새로운파일 이름 입력 안했을 때.
                if (string.IsNullOrEmpty(FIleManager.NewFileName))
                {
                    string newName = FilePath.Substring(FilePath.LastIndexOf('\\') + 1, FileName.Split('.')[0].Length) + @".json";
                    NewFileName = path + newName;
                }

                //입력 했을 때.
                else
                {
                    if (NewFileName.Contains(".json"))
                    {
                        //json입력.
                        NewFileName = path + NewFileName;
                    }
                    else
                    {
                        NewFileName = path + NewFileName + @".json";
                    }
                }
            }
        }
Пример #2
0
        /// <summary>
        /// Finds and sets song artist, sets determines song title then returns if artist was identified.
        /// </summary>
        /// <returns></returns>
        private void setSongInfo()
        {
            string s1, s2;

            if (NewFileName.Contains('-'))
            {
                //Dividing character between artist and song title.
                int div = NewFileName.IndexOf("-");

                //Split filename into artist and song name, lower and trim string.
                s1 = NewFileName.Substring(0, div).ToLower().Trim();
                s2 = NewFileName.Substring(div + 1, NewFileName.Length - (div + 1)).ToLower().Trim();

                //If substring 1 contains a matching artist set filename with artist first.
                if (LibraryManager.checkArtist(s1))
                {
                    Artist      = StringUtils.formatText(s1);
                    Title       = StringUtils.formatText(s2);
                    NewFileName = Artist + " - " + Title;

                    artistFound = true;
                }
                //If substring 2 contains a matching artist set filename with artist first.
                else if (LibraryManager.checkArtist(s2))
                {
                    Artist      = StringUtils.formatText(s2);
                    Title       = StringUtils.formatText(s1);
                    NewFileName = Artist + " - " + Title;

                    artistFound = true;
                }
                else
                {
                    Artist      = StringUtils.formatText(s1);
                    Title       = StringUtils.formatText(s2);
                    NewFileName = Artist + " - " + Title;
                }
            }
        }