Ejemplo n.º 1
0
 private ISubRoot ExecuteAllSubRootFilter(ISubRoot subroot)
 {
     foreach (var subrootexcuter in SubrootWorkunit())
     {
         subrootexcuter.Workunit = subroot;
         ((IExecuteable)subrootexcuter).Execute();
         subroot = subrootexcuter.Workunit;
     }
     return subroot;
 }
Ejemplo n.º 2
0
        private string[] fillCurrentInfo(IRoot root, ISubRoot subRoot, ILeaf leaf)
        {
            string[] info = new string[7];

            info[0] = getRootFolderByCopyMode();
            info[1] = root.Name;
            info[2] = subRoot.Year > 0 ? subRoot.Year.ToString() : "";
            info[3] = subRoot.Name;
            info[4] = leaf.Count > 0 ? leaf.Count.ToString() : "";
            string tracknr = "";

            if (leaf.Number > 0)
            {
                tracknr = leaf.Number.ToString();
                if (leaf.Number < 10)
                {
                    tracknr = "0" + tracknr;
                }
            }
            info[5] = tracknr;
            info[6] = leaf.Name;
            return info;
        }
Ejemplo n.º 3
0
        private void WriteFolderStruct(IRoot root, ISubRoot subRoot, ILeaf leaf)
        {
            List<string> formatstrings = FormatString.Split('\\').ToList();

            string[] info = fillCurrentInfo(root, subRoot, leaf);

            // bzw da das nicht geht
            // wird das stück formatstring das diese lehren zahlen enthält nicht mit ein gefügt
            // das alles noch in ordner ändern wird fies
            DirectoryInfo Folder = null;
            bool ContainsValue = false;

            // das alles soll nur für die ordner geschehen
            for(int i = 0; i< formatstrings.Count -1 ; i++)
            {
                foreach(char c in formatstrings[i])
                {
                    // such die zahlen im formatstring
                    if( 47 < c &&  c < 58) // wenn es ne zahl ist , ich brauch nur einstellige suchen
                    {
                        // zum int parsen schauen was in dem array an information enthalten ist
                        // format entfernen oder nicht ....
                        int pos = c - 48; // an manchen stellen hatten sie einfach keine lust mehr
                        if(pos < info.Length)
                        {
                            // kontrolliere alle werte die zu diesen zahlen gehören
                            if(!String.IsNullOrWhiteSpace(info[pos]))
                            {
                                ContainsValue = true;
                                break;
                            }
                        }
                    }
                }
                if(!ContainsValue)
                {
                    // wer fehlt fliegt
                    formatstrings.RemoveAt(i);
                    i--;
                    continue;
                }
                ContainsValue = false;

                // hier wird das getan was notwendiog ist ?!
                // formatstück nehmen info anwenden
                string currentSubFolder = ApplyWriteType(String.Format(formatstrings[i], info));

                if (Folder == null)
                {
                    Folder = new DirectoryInfo(currentSubFolder);
                }
                else
                {
                    Folder = Folder.CreateSubdirectory(currentSubFolder);
                }
                Folder.Create();
            }

            // jetzt "nur" noch die Dateien aber das ja egal
            FileInfo fi = new FileInfo(leaf.FullFilePath);

            string folder = Folder.FullName;
            string extension = fi.Extension;
            string fileName = ApplyWriteType(String.Format(formatstrings[formatstrings.Count - 1], info));

            string FullTargetName = folder + "\\" + fileName + extension;

            Copy(FullTargetName, leaf.FullFilePath);

            //fi.CopyTo(FullName, true);
        }
Ejemplo n.º 4
0
 public void WorkUnit(ISubRoot workunit)
 {
     SubRoot = workunit;
 }