Exemplo n.º 1
0
        private void GuessAllButton_Click(object sender, EventArgs e)
        {
            // build list of all directories with name that follows first
            DirectoryInfo dirInfo   = Directory.GetParent(_camRoot.Path());
            string        parentDir = dirInfo.FullName;

            string dirName = Path.GetFileName(_camRoot.Path());

            Console.WriteLine("_camRoot \"" + _camRoot.Path() + "\" parentDir \"" + parentDir + "\" local dir \"" + dirName + "\"");

            int numMovieFilesToGuess = _sources.Count;

            int i = 0;

            for (i = dirName.Length - 1; i > 0; i--)
            {
                if ((dirName[i] < '0') || (dirName[i] > '9'))
                {
                    break;
                }
            }
            if (i > 0)
            {
                string baseName = dirName.Substring(0, i + 1);
                int    numZeros = dirName.Length - baseName.Length;

                string format = string.Format("{0}\\{1}{{0:", parentDir, baseName);
                for (int j = 0; j < numZeros; j++)
                {
                    format = format + "0";
                }
                format = format + "}";

                string camPath;
                int    camCount = 0;
                do
                {
                    camCount++;
                    camPath = string.Format(format, camCount);
                    Console.WriteLine("Looking for \"" + camPath + "\"");
                } while (Directory.Exists(camPath));
                camCount--;

                Console.WriteLine("Num of cam dirs = " + camCount);

                int startingCam = _currentCamera + 1;
                for (int camIndex = startingCam; camIndex < (camCount + 1); camIndex++)
                {
                    _currentCamera = camIndex;
                    //
                    camPath = string.Format(format, camIndex);
                    LoadCameraPath(camPath, false, camIndex, true, numMovieFilesToGuess); // true = do guess!
                }
            }
        }
Exemplo n.º 2
0
 private void TraverseLoadMovieList(ref DirectoryOrFile _df, ref List <DirectoryOrFile> _list)
 {
     if (_df.Type() == DirectoryOrFile.DOF_Type.FILE)
     {
         // is this a movie?
         int i = 0;
         for (i = 0; i < _knownMovieTypes.Length; i++)
         {
             if (Path.GetExtension(_df.Path()).ToLower().Contains(_knownMovieTypes[i]))
             {
                 break;
             }
         }
         if (i < _knownMovieTypes.Length)
         {
             // this is a movie
             _list.Add(_df);
         }
     }
     else
     {
         for (int i = 0; i < _df.NumChildren(); i++)
         {
             DirectoryOrFile childDf = _df.Child(i);
             TraverseLoadMovieList(ref childDf, ref _list);
         }
     }
 }