Пример #1
0
        private TaskPlanner.FileListEntry CheckChangesValidPath(ValidPath validPath, List <TaskPlanner.FileListEntry> FileList)
        {
            // go through all Before Actions check for changes of validPath (check with absolute paths)

            foreach (TaskPlanner.FileListEntry fileListEntry in FileList)
            {
                if (fileListEntry.Path == validPath.strValidPath)
                {
                    if (fileListEntry.targetNode.AnyNodeActionThisNode > Tasks.enTasks.CreateSubfolder)
                    {
                        return(fileListEntry);
                    }
                }
            }


            return(null);
        }
Пример #2
0
        private List <ValidPath> GetAllValidPathsFromString(string strPlaylist, string basePath) // string can be any playlist format
        {
            // Boundary condidtions
            // The paths always contain a ".xxx" ending
            // The path can be inside ""(.wpl) or fill up its own line(.m3u) or after a "="(.kpl)
            // The path can be absolute or relative

            List <ValidPath> listValidPaths = new List <ValidPath>();

            // Procedure:
            // 1) advance the string until a "." is found
            for (int i = 0; i < strPlaylist.Length; i++)
            {
                if (strPlaylist[i] == '.')
                {
                    // 2) from there move back and forth until a invalid path char is found
                    char[] invalidChars = System.IO.Path.GetInvalidPathChars();

                    int iStart = i, iEnd = i;
                    if (GetBoundarys(strPlaylist, invalidChars, ref iStart, ref iEnd, false)) // Normally
                    {
                        string     fullpath = "";
                        enPathType pathType = enPathType.absolute;
                        if (CheckFile(strPlaylist, iStart, iEnd, basePath, ref fullpath, ref pathType)) // 3) check if path ok
                        {
                            ValidPath validPath = new ValidPath();

                            validPath.strValidPath = fullpath;
                            validPath.iEnd         = iEnd;
                            validPath.iStart       = iStart;
                            validPath.PathType     = pathType;

                            listValidPaths.Add(validPath);
                            i = iEnd + 1;
                            continue;
                        }
                    }

                    iStart = i;
                    iEnd   = i;
                    if (GetBoundarys(strPlaylist, invalidChars, ref iStart, ref iEnd, true)) // In case of KPL
                    {
                        string     fullpath = "";
                        enPathType pathType = enPathType.absolute;
                        if (CheckFile(strPlaylist, iStart, iEnd, basePath, ref fullpath, ref pathType)) // 3) check if path ok
                        {
                            ValidPath validPath = new ValidPath();

                            validPath.strValidPath = fullpath;
                            validPath.iEnd         = iEnd;
                            validPath.iStart       = iStart;
                            validPath.PathType     = pathType;

                            listValidPaths.Add(validPath);
                            i = iEnd + 1;
                            continue;
                        }
                    }
                }
            }

            return(listValidPaths);
        }