Exemple #1
0
        public static void CopyAll()
        {
            FileCopies copy = getNextCopy();

            while (copy != null)
            {
                System.IO.File.Move(copy.Source, copy.Destination);
                copy = getNextCopy();
            }
        }
Exemple #2
0
        public static void AddFile(string Source, string Destination)
        {
            FileCopies copy = new FileCopies();

            copy.Source      = Source;
            copy.Destination = Destination;

            lock (copies)
                copies.Add(copy);
        }
Exemple #3
0
        public MainWindow()
        {
            InitializeComponent();


            Rule r;

            r          = new Rule();
            r.Name     = "Naruto Dubbed #1";
            r.ScanPath = @"\\mediaserver\AnimeRoot\Naruto\Dubbed";
            r.IncludeSubdirectories = true;
            r.DestinationPath       = @"\\mediaserver\AnimeRoot\Naruto\Dubbed";
            r.ScanPattern           = @"[AnimeRG]+Naruto+Shippuden+*NUM0*+(Dub)+*STR0*+(1280x720)+[Phr0stY]-*STR9*.mp4";
            r.DestinationPattern    = @"Naruto Shippuuden *NUM0* Dubbed - *STR0*.mp4";
            r.StringsToSpace        = new string[] { "+" };
            Rule.AddRule(r);

            r          = new Rule();
            r.Name     = "Naruto Dubbed #2";
            r.ScanPath = @"\\mediaserver\AnimeRoot\Naruto\Dubbed";
            r.IncludeSubdirectories = true;
            r.DestinationPath       = @"\\mediaserver\AnimeRoot\Naruto\Dubbed";
            r.ScanPattern           = @"[AnimeRG]+Naruto+Shippuden+*NUM0*+*STR0*+(Dub)+(1280x720)+[Phr0stY]-*STR9*.mp4";
            r.DestinationPattern    = @"Naruto Shippuuden *NUM0#3* Dubbed - *STR0*.mp4";
            r.StringsToSpace        = new string[] { "+" };
            Rule.AddRule(r);

            r          = new Rule();
            r.Name     = "Naruto Dubbed #3";
            r.ScanPath = @"\\mediaserver\AnimeRoot\Naruto\Dubbed";
            r.IncludeSubdirectories = true;
            r.DestinationPath       = @"\\mediaserver\AnimeRoot\Naruto\Dubbed";
            r.ScanPattern           = @"[AnimeRG]+Naruto+Shippuden+*NUM0*+(Dub)+(1280x720)+[Phr0stY]-*STR9*.mp4";
            r.DestinationPattern    = @"Naruto Shippuuden *NUM0* Dubbed.mp4";
            r.StringsToSpace        = new string[] { "+" };
            Rule.AddRule(r);

            r          = new Rule();
            r.Name     = "Naruto Dubbed #4";
            r.ScanPath = @"\\mediaserver\AnimeRoot\Naruto\Dubbed";
            r.IncludeSubdirectories = true;
            r.DestinationPath       = @"\\mediaserver\AnimeRoot\Naruto\Dubbed";
            r.ScanPattern           = @"[AnimeRG]+Naruto+Shippuden+*NUM0*+(Dub)+(1280x720)+[Phr0sstY]-*STR9*.mp4";
            r.DestinationPattern    = @"Naruto Shippuuden *NUM0* Dubbed.mp4";
            r.StringsToSpace        = new string[] { "+" };
            Rule.AddRule(r);

            r          = new Rule();
            r.Name     = "Naruto Dubbed #5";
            r.ScanPath = @"\\mediaserver\AnimeRoot\Naruto\Dubbed";
            r.IncludeSubdirectories = true;
            r.DestinationPath       = @"\\mediaserver\AnimeRoot\Naruto\Dubbed";
            r.ScanPattern           = @"[AnimeRG]+Naruto+Shippuden+*NUM0*+(Dub)+720p+[Phr0stY]-*STR9*.mp4";
            r.DestinationPattern    = @"Naruto Shippuuden *NUM0* Dubbed.mp4";
            r.StringsToSpace        = new string[] { "+" };
            Rule.AddRule(r);

            r          = new Rule();
            r.Name     = "Naruto Dubbed #6";
            r.ScanPath = @"\\mediaserver\AnimeRoot\Naruto\Dubbed";
            r.IncludeSubdirectories = true;
            r.DestinationPath       = @"\\mediaserver\AnimeRoot\Naruto\Dubbed";
            r.ScanPattern           = @"[M@nI]+Naruto+Shippuden+-+*NUM0*+-+*STR0*+(Dual+Audio)[720p]-*STR9*.mp4";
            r.DestinationPattern    = @"Naruto Shippuuden *NUM0#3* Dubbed - *STR0*.mp4";
            r.StringsToSpace        = new string[] { "+" };
            Rule.AddRule(r);

            r          = new Rule();
            r.Name     = "Naruto Dubbed #7";
            r.ScanPath = @"\\mediaserver\AnimeRoot\Naruto\Dubbed";
            r.IncludeSubdirectories = true;
            r.DestinationPath       = @"\\mediaserver\AnimeRoot\Naruto\Dubbed";
            r.ScanPattern           = @"Naruto+Shippuuden+-+*NUM0*+-+*STR0*-r*STR9*.mp4";
            r.DestinationPattern    = @"Naruto Shippuuden *NUM0#3* Dubbed - *STR0*.mp4";
            r.StringsToSpace        = new string[] { "+" };
            Rule.AddRule(r);

            r          = new Rule();
            r.Name     = "Naruto Dubbed #8";
            r.ScanPath = @"\\mediaserver\AnimeRoot\Naruto\Dubbed";
            r.IncludeSubdirectories = true;
            r.DestinationPath       = @"\\mediaserver\AnimeRoot\Naruto\Dubbed";
            r.ScanPattern           = @"Naruto+Shippuden+-+*NUM0*+-+*STR0*-r*STR9*.mp4";
            r.DestinationPattern    = @"Naruto Shippuuden *NUM0#3* Dubbed - *STR0*.mp4";
            r.StringsToSpace        = new string[] { "+" };
            Rule.AddRule(r);

            r          = new Rule();
            r.Name     = "Naruto Dubbed #9";
            r.ScanPath = @"\\mediaserver\AnimeRoot\Naruto\Dubbed";
            r.IncludeSubdirectories = true;
            r.DestinationPath       = @"\\mediaserver\AnimeRoot\Naruto\Dubbed";
            r.ScanPattern           = @"Naruto+Shippuden+*NUM0*+*STR0*+(1280x720)+[Phr0stY]-*STR9*.mp4";
            r.DestinationPattern    = @"Naruto Shippuuden *NUM0#3* Dubbed - *STR0*.mp4";
            r.StringsToSpace        = new string[] { "+" };
            Rule.AddRule(r);

            r          = new Rule();
            r.Name     = "Naruto Dubbed #10";
            r.ScanPath = @"\\mediaserver\AnimeRoot\Naruto\Dubbed";
            r.IncludeSubdirectories = true;
            r.DestinationPath       = @"\\mediaserver\AnimeRoot\Naruto\Dubbed";
            r.ScanPattern           = @"[M@nI]+Naruto+Shippuden+-+*NUM0*+-+*STR0*-r*STR9*.mp4";
            r.DestinationPattern    = @"Naruto Shippuuden *NUM0#3* Dubbed - *STR0*.mp4";
            r.StringsToSpace        = new string[] { "+" };
            Rule.AddRule(r);

            r          = new Rule();
            r.Name     = "Naruto Dubbed #11";
            r.ScanPath = @"\\mediaserver\AnimeRoot\Naruto\Dubbed";
            r.IncludeSubdirectories = true;
            r.DestinationPath       = @"\\mediaserver\AnimeRoot\Naruto\Dubbed";
            r.ScanPattern           = @"[RPRip-ARRG]Naruto+Shippuden+*NUM0*+*STR0*[720p;Dub-Audio+x264]-*STR9*.mp4";
            r.DestinationPattern    = @"Naruto Shippuuden *NUM0#3* Dubbed - *STR0*.mp4";
            r.StringsToSpace        = new string[] { "+" };
            Rule.AddRule(r);

            r          = new Rule();
            r.Name     = "Naruto Dubbed #12";
            r.ScanPath = @"\\mediaserver\AnimeRoot\Naruto\Dubbed";
            r.IncludeSubdirectories = true;
            r.DestinationPath       = @"\\mediaserver\AnimeRoot\Naruto\Dubbed";
            r.ScanPattern           = @"Naruto+Shippuden+Episode+*NUM0*-r*STR9*.mp4";
            r.DestinationPattern    = @"Naruto Shippuuden *NUM0#3* Dubbed.mp4";
            r.StringsToSpace        = new string[] { "+" };
            Rule.AddRule(r);


            /*
             * r = new Rule();
             * r.Name = "Naruto Dubbed #0";
             * r.ScanPath = @"\\mediaserver\AnimeRoot\Naruto\Dubbed";
             * r.IncludeSubdirectories = true;
             * r.DestinationPath = @"\\mediaserver\AnimeRoot\Naruto\Dubbed";
             * r.ScanPattern = @"Naruto Shippuuden *NUM0* Dubbed - *STR0*.mp4";
             * r.DestinationPattern = @"Naruto Shippuuden *NUM0#3* Dubbed - *STR0*.mp4";
             * r.StringsToSpace = new string[] { "+" };
             * Rule.AddRule(r);
             */



            Rule.ScanAll();

            FileCopies.CopyAll();
        }
Exemple #4
0
        private void scanFile(string Filename)
        {
            string[] strVals  = new string[10];
            int[]    intVals  = new int[10];
            string   filename = System.IO.Path.GetFileName(Filename);
            int      index    = 0;

            if (filename == "Naruto+Shippuden+-+009+-+The+Jinchurikis+Tears-r834.1-r726-r41.mp4")
            {
            }

            for (int i = 0; i < scanParts.Length; i++)
            {
                // Text match portion
                if (i % 2 == 0)
                {
                    if (filename.Substring(index, scanParts[i].Length).ToUpper() != scanParts[i].ToUpper())
                    {
                        return;
                    }
                    index += scanParts[i].Length;
                }
                // Pattern match portion
                else
                {
                    int saveIndex;
                    int endIndex;
                    if (scanParts[i].StartsWith("NUM")
                        &&
                        int.TryParse(scanParts[i].Substring(3), out saveIndex))
                    {
                        endIndex = filename.IndexOf(scanParts[i + 1], index, StringComparison.OrdinalIgnoreCase);
                        if (endIndex == -1)
                        {
                            return;
                        }
                        if (!int.TryParse(filename.Substring(index, endIndex - index), out intVals[saveIndex]))
                        {
                            return;
                        }
                        index = endIndex;
                    }
                    else if (scanParts[i].StartsWith("STR")
                             &&
                             int.TryParse(scanParts[i].Substring(3), out saveIndex))
                    {
                        endIndex = filename.IndexOf(scanParts[i + 1], index, StringComparison.OrdinalIgnoreCase);
                        if (endIndex == -1)
                        {
                            return;
                        }
                        strVals[saveIndex] = filename.Substring(index, endIndex - index);
                        index = endIndex;
                    }
                    else
                    {
                        return;
                    }
                }
            }


            string dest = DestinationPattern;

            for (int i = 0; i < intVals.Length; i++)
            {
                dest = dest.Replace("*NUM" + i.ToString() + "*", intVals[i].ToString());
                dest = dest.Replace("*NUM" + i.ToString() + "#1*", intVals[i].ToString("0"));
                dest = dest.Replace("*NUM" + i.ToString() + "#2*", intVals[i].ToString("00"));
                dest = dest.Replace("*NUM" + i.ToString() + "#3*", intVals[i].ToString("000"));
                dest = dest.Replace("*NUM" + i.ToString() + "#4*", intVals[i].ToString("0000"));
                dest = dest.Replace("*NUM" + i.ToString() + "#5*", intVals[i].ToString("00000"));
            }
            for (int i = 0; i < strVals.Length; i++)
            {
                dest = dest.Replace("*STR" + i.ToString() + "*", strVals[i]);
            }
            for (int i = 0; i < StringsToSpace.Length; i++)
            {
                dest = dest.Replace(StringsToSpace[i], " ");
            }
            dest = System.IO.Path.Combine(DestinationPath, dest);


            if (Filename.ToUpper() != dest.ToUpper())
            {
                FileCopies.AddFile(Filename, dest);
                FilesQueued++;
            }
        }