コード例 #1
0
        public static string GetChoice(HashSet <Series> s)
        {
            ChoiceWindow cw = new ChoiceWindow(s);

            cw.ShowDialog();

            return(cw.choice);
        }
コード例 #2
0
        private void SetSeriesDestinationPath(Series s)
        {
            Debug.WriteLine("------Before getting destination path------");
            string destinationPath = GetDestinationPath(s);

            // We got no current folder for the series, so we create one.
            if (destinationPath.Length == 0)
            {
                Debug.WriteLine("No folder exists for the series, so we create one");
                if (setObj.DestinationList.Count > 1)
                {
                    ChoiceWindow cw = new ChoiceWindow(setObj.DestinationList);
                    cw.ShowDialog();
                    destinationPath = cw.choice;
                }
                else
                {
                    destinationPath = setObj.DestinationList.First();
                }
                s.Name           = Utility.SanitizeString(s.Name);
                destinationPath += '\\' + s.Name;
                Debug.WriteLine("Folder name after creation: " + destinationPath);
            }
            Debug.WriteLine("Current destination path: " + destinationPath);
            destinationPath += "\\Season " + s.Season;
            Debug.WriteLine("Current destination path: " + destinationPath);

            s.Name  = Utility.SanitizeString(s.Name.Trim(' '));
            s.Title = Utility.SanitizeString(s.Title);

            Debug.WriteLine("Series title: " + s.Title);

            Tuple <List <int>, string> format = Utility.ParseSeriesFormat(setObj.CustomFormat);

            if ((setObj.CustomFormat != "" || setObj.CustomFormat != null) && format.Item2 != "")
            {
                string fm = "\\" + format.Item2;
                destinationPath += String.Format(fm, Utility.SeriesParameters);
                destinationPath += String.Format(fm, s.Name, s.Season, s.Episode, s.Title);
            }
            else
            {
                destinationPath += String.Format("\\{0} - {1}{2} - {3}.{4}", s.Name, s.Season, (s.Episode < 10 ? "x0" : "x") + s.Episode, s.Title, s.Extension);
            }

            //destinationPath += '\\' + s.Name + " - " + s.Season + (s.Episode < 10 ? "x0" : "x") + s.Episode + " - " + s.Title + "." + s.Extension;

            s.DestinationPath = destinationPath;
        }