Пример #1
0
        private ObservableCollection <EnvironmentDirectory> initTree(
            string inSpawningDir,
            BackgroundWorker inSender = null)
        {
            EnvironmentDirectory.StaticBackgroundWorker = inSender;
            EnvironmentDirectory root = new EnvironmentDirectory(inSpawningDir);
            ObservableCollection <EnvironmentDirectory> tmpTree;

            tmpTree = new ObservableCollection <EnvironmentDirectory>();
            tmpTree.Add(root);
            return(tmpTree);
        }
Пример #2
0
        private SetMarkingsContainer convertToSetMarkings(
            EnvironmentDirectory inDir)
        {
            SetMarkingsContainer ret = new SetMarkingsContainer();

            ret.SetIsArchive(inDir.IsArchive);
            ret.SetFullPathMarkingsFile(inDir.GetFullPathToMarkingsFile());
            ret.SetPath(inDir.PathName);
            ret.SetFolderOrArchiveName(inDir.LastDirOrArchiveName);
            ret.SetHasMarkingsfile(inDir.MarkingsFileFound);
            return(ret);
        }
Пример #3
0
        // Will return a list of string of all directories showed
        private List <SetMarkingsContainer> dirTreeToDirList(
            EnvironmentDirectory inDir)
        {
            List <SetMarkingsContainer> ret = new List <SetMarkingsContainer>();

            if (inDir.MarkingRoutineWillRunOn)
            {
                ret.Add(convertToSetMarkings(inDir));
            }
            foreach (EnvironmentDirectory d in inDir.SubDirectories)
            {
                ret.AddRange(dirTreeToDirList(d));
            }

            return(ret);
        }
        private void init(string inPath, string inName, bool inIsArchive)
        {
            _updateBgWorkerProgress();
            _pathName             = inPath;
            _lastDirOrArchiveName = inName;
            _isArchive            = inIsArchive;
            _subDirectories       = new List <EnvironmentDirectory>();
            if (_isArchive)
            {
                _fullPathToMarkingsFile =
                    _pathName +
                    "\\markings_" +
                    inName.Substring(0, inName.Length - 4) +
                    ".xml";
            }
            else
            {
                _fullPathToMarkingsFile = _pathName + "\\" + _lastDirOrArchiveName + "\\markings.xml";
            }
            // If it is an archive, there is no reason to search
            // subdirectories.
            // For sub directories, they must be searched for sub sub dirs
            // and archives...
            if (!_isArchive)
            {
                //Get each file of this directory
                string[] filesEntries = getFileList(
                    _pathName, _lastDirOrArchiveName);

                //Check each file of this directory
                foreach (string f in filesEntries)
                {
                    string onlyPath;
                    string onlyName;
                    StaticHelper.SplitNameAndPath(f, out onlyPath, out onlyName);

                    if (StaticHelper.CheckIsArchive(onlyName))
                    {//its a archive file, so this must be added to the tree.
                        EnvironmentDirectory tmpArchive;
                        tmpArchive = new EnvironmentDirectory(
                            Path.Combine(_pathName, _lastDirOrArchiveName),
                            onlyName, true);
                        tmpArchive.searchForOwnMarkings(filesEntries);
                        _subDirectories.Add(tmpArchive);
                    }
                    if (StaticHelper.IsFolderMarking(onlyName))
                    {
                        // its a folder marking information.
                        // These kind of markings will only exactly
                        // for the images in this folder
                        _markingsFileFound       = true;
                        _markingRoutineWillRunOn = false;
                    }
                }



                //Get each sub directory of this directory
                string[] subdirectoryEntries = getDirList(_pathName, _lastDirOrArchiveName);

                //Recursive adding entry for each sub dir
                foreach (string d in subdirectoryEntries)
                {
                    string onlyPath;
                    string onlyName;
                    StaticHelper.SplitNameAndPath(d, out onlyPath, out onlyName);
                    _subDirectories.Add(
                        new EnvironmentDirectory(
                            Path.Combine(_pathName, _lastDirOrArchiveName),
                            onlyName,
                            false));
                }
            }
        }