private string fGetDirSizeString(TreeDir dir)
        {
            string dirSize = null;

            if (mBooFirstDir)
            {
                dirSize = dir.DirectorySizeToString(TreeDir.BinaryPrefix.Gibibytes);
                if (decimal.Parse(Regex.Split(dirSize, "\\" + mDecimalSymbol)[0]) == 0)
                {
                    dirSize = dir.DirectorySizeToString(TreeDir.BinaryPrefix.Mebibytes);
                    if (decimal.Parse(Regex.Split(dirSize, " ")[0]) == 0)
                    {
                        dirSize = dir.DirectorySizeToString(TreeDir.BinaryPrefix.Kibibytes);
                    }
                }
            }
            else
            {
                dirSize = dir.DirectorySizeToString(TreeDir.BinaryPrefix.Mebibytes);
                if (decimal.Parse(Regex.Split(dirSize, "\\" + mDecimalSymbol)[0]) == 0)
                {
                    dirSize = dir.DirectorySizeToString(TreeDir.BinaryPrefix.Kibibytes);
                }
            }

            return(dirSize);
        }
Exemplo n.º 2
0
        private TreeDir GetFiles(string dirPath)
        {
            TreeDir dir = new TreeDir(dirPath);

            try
            {
                foreach (string filepath in Directory.GetFiles(dirPath))
                {
                    dir.SetFile(filepath, TreeDir.BinaryPrefix.Kibibytes);
                }
            }
            catch (UnauthorizedAccessException ex)
            {
                Debug.WriteLine(ex.ToString());
            }

            try
            {
                foreach (string subDirPath in Directory.GetDirectories(dirPath))
                {
                    TreeDir subdir = new TreeDir(subDirPath);
                    subdir = GetFiles(subDirPath);
                    dir.AddDir(subdir);
                }
            }
            catch (UnauthorizedAccessException ex)
            {
                Debug.WriteLine(ex.ToString());
            }

            return dir;
        }
        private TreeDir GetFiles(string dirPath)
        {
            TreeDir dir = new TreeDir(dirPath);

            try
            {
                foreach (string filepath in Directory.GetFiles(dirPath))
                {
                    dir.SetFile(filepath, TreeDir.BinaryPrefix.Kibibytes);
                }
            }
            catch (UnauthorizedAccessException ex)
            {
                Debug.WriteLine(ex.ToString());
            }

            try
            {
                foreach (string subDirPath in Directory.GetDirectories(dirPath))
                {
                    TreeDir subdir = new TreeDir(subDirPath);
                    subdir = GetFiles(subDirPath);
                    dir.AddDir(subdir);
                }
            }
            catch (UnauthorizedAccessException ex)
            {
                Debug.WriteLine(ex.ToString());
            }

            return(dir);
        }
Exemplo n.º 4
0
    //create a passage
    private void CreatePassage(TreeMazeCell curCell, TreeMazeCell neighbor, TreeDir dir)
    {
        TreeMazePassage passage = Instantiate(passagePrefab) as TreeMazePassage;

        passage.Init(curCell, neighbor, dir);
        passage = Instantiate(passagePrefab) as TreeMazePassage;
        passage.Init(neighbor, curCell, dir.GetOppositeDir());
    }
Exemplo n.º 5
0
 public void Init(TreeMazeCell cell, TreeMazeCell otherCell, TreeDir dir)
 {
     this.cell      = cell;
     this.otherCell = otherCell;
     this.dir       = dir;
     cell.SetEdge(dir, this);
     transform.parent        = cell.transform;
     transform.localPosition = Vector3.zero;
     transform.localRotation = dir.ToRotation();
 }
        private string IndexRootFolderToHtml(string folderPath, StringBuilder sb, bool bAddFooter)
        {
            if (mBooFirstIndexFile)
            {
                sb.AppendLine(Xhtml.GetDocType());
                if (mSettings.GetConfig().CollapseFolders)
                {
                    sb.AppendLine(Xhtml.GetCollapseJs());
                    sb.AppendLine(Xhtml.GetCollapseCss());
                }
                sb.AppendLine(Xhtml.GetCssStyle(mSettings.GetConfig().CssFilePath));

                if (mBooMoreFilesToCome)
                {
                    sb.AppendLine(Xhtml.GetTitle(mSettings.GetConfig().MergedHtmlTitle));
                    mBooMoreFilesToCome = false;
                }
                else
                {
                    string[] c = folderPath.Split(Path.DirectorySeparatorChar);
                    if (c[1].Length == 0)
                    {
                        sb.AppendLine(Xhtml.GetTitle("Index for " + folderPath));
                    }
                    else
                    {
                        sb.AppendLine(Xhtml.GetTitle("Index for " + Path.GetFileName(folderPath)));
                    }
                }

                sb.AppendLine(Xhtml.CloseHead());
                sb.AppendLine(Xhtml.OpenBody());

                mBooFirstIndexFile = false;
            }

            TreeDir rootDir = new TreeDir(folderPath);

            rootDir = Analyze(rootDir.DirectoryPath());

            this.IndexToHtmlFile(rootDir, sb);

            if (bAddFooter)
            {
                sb.AppendLine(Xhtml.OpenDiv());
                sb.AppendLine("<hr />");
                sb.AppendLine(mSettings.GetFooterText(null, IndexingEngine.TreeNetLib, true));
                sb.AppendLine(Xhtml.CloseDiv());
                sb.AppendLine(Xhtml.CloseBody());
            }

            mBooFirstDir = true;

            return(sb.ToString());
        }
Exemplo n.º 7
0
    //creating a wall
    private void CreateWall(TreeMazeCell curCell, TreeMazeCell neighbor, TreeDir dir)
    {
        TreeMazeWall wall = Instantiate(wallPrefab) as TreeMazeWall;

        wall.Init(curCell, neighbor, dir);
        if (neighbor != null)
        {
            wall = Instantiate(wallPrefab) as TreeMazeWall;
            wall.Init(neighbor, curCell, dir.GetOppositeDir());
        }
    }
Exemplo n.º 8
0
 private TreeDir Analyze(string rootDirPath)
 {
     TreeDir dirRoot = new TreeDir(rootDirPath);
     dirRoot = GetFiles(dirRoot.DirectoryPath());
     if (mSettings.GetConfig().SortBySize)
     {
         dirRoot.GetSubDirColl().Sort(new TreeDirComparer());
         if (mSettings.GetConfig().SortBySizeMode == FileSortMode.Descending)
         {
             dirRoot.GetSubDirColl().Reverse();
         }
     }
     return dirRoot;
 }
        private TreeDir Analyze(string rootDirPath)
        {
            TreeDir dirRoot = new TreeDir(rootDirPath);

            dirRoot = GetFiles(dirRoot.DirectoryPath());
            if (mSettings.GetConfig().SortBySize)
            {
                dirRoot.GetSubDirColl().Sort(new TreeDirComparer());
                if (mSettings.GetConfig().SortBySizeMode == FileSortMode.Descending)
                {
                    dirRoot.GetSubDirColl().Reverse();
                }
            }
            return(dirRoot);
        }
Exemplo n.º 10
0
    public double GetSize(TreeDir.BinaryPrefix prefix)
    {
        switch (prefix)
        {
            case TreeDir.BinaryPrefix.Bytes:
                return mSize;
            case TreeDir.BinaryPrefix.Kibibits:
                return (mSize / 128);
            case TreeDir.BinaryPrefix.Kibibytes:
                return (mSize / 1024);
            case TreeDir.BinaryPrefix.Mebibytes:
                return (mSize / (1024 * 1024));
            case TreeDir.BinaryPrefix.Gibibytes:
                return (mSize / (1024 * 1024 * 1024));
        }

        return mSize;
    }
        private string IndexFolderToTxt(string folderPath, StringBuilder sb, bool AddFooter)
        {
            if (Directory.Exists(folderPath))
            {
                // 2.7.1.6 TreeGUI crashed on Could not find a part of the path

                TreeDir dir = new TreeDir(folderPath);
                dir = Analyze(dir.DirectoryPath());
                this.IndexToTxtFile(dir, sb);
                if (AddFooter)
                {
                    sb.AppendLine("____");
                    sb.AppendLine(mSettings.GetFooterText(null, IndexingEngine.TreeNetLib, false));
                }
            }

            return(sb.ToString());
        }
        private string GetHeadingOpen(TreeDir dir)
        {
            string          cName = "trigger";
            List <TreeFile> files = dir.GetFilesColl(mSettings);

            /*
             * if (mNumTabs > mSettings.GetConfig().FolderExpandLevel)
             * {
             *  cName = "expanded";
             * }
             * else
             * {
             *  cName = "trigger";
             * }
             */

            string tabs = string.Empty;

            if (mNumTabs < 7)
            {
                if (dir.GetSubDirColl().Count > 0 || files.Count > 0)
                {
                    tabs = string.Format("<h{0} class=\"{1}\">", mNumTabs.ToString(), cName);
                }
                else
                {
                    tabs = string.Format("<h{0}>", mNumTabs.ToString());
                }
            }
            else
            {
                if (dir.GetSubDirColl().Count > 0 || files.Count > 0)
                {
                    tabs = string.Format("<h6 class=\"{0}\">", cName);
                }
                else
                {
                    tabs = "<h6>";
                }
            }

            return(tabs);
        }
        private string fGetDirPath(TreeDir dir)
        {
            string dirName = null;

            string[] c = dir.DirectoryPath().Split(Path.DirectorySeparatorChar);
            if (c[1].Length == 0)
            {
                // Root Drive
                dirName = dir.DirectoryPath();
            }
            else
            {
                if (mSettings.GetConfig().ShowFolderPath)
                {
                    dirName = dir.DirectoryPath();
                }
                else
                {
                    dirName = dir.DirectoryName();
                }
            }
            return(dirName);
        }
Exemplo n.º 14
0
    //getting the current cell, checks if its all edges are initialized and if so removing it from the list
    //a cell will be fully initialized only when all its neighbors have been visited.
    //in order to prevent incorrect walls, we should pick a random direction that is not yet initialized for current cell
    private void DoNextStep(List <TreeMazeCell> activeCells)
    {
        int curIndex = activeCells.Count - 1;

        TreeMazeCell curCell = activeCells[curIndex];

        if (curCell.IsFullyInit)
        {
            activeCells.RemoveAt(curIndex);
            return;
        }

        TreeDir direction = curCell.RandomNoDir;

        IntVector2 coor = curCell.coordinates + direction.ToIntVector2();

        if (ContainsCoor(coor))
        {
            // checking if the neighbor doesnt exists, if so we are creating it and adding a passage between the
            //neighbor and the current cell. If the neighbor already exists, separate them with wall.
            TreeMazeCell neighbor = GetNewCell(coor);
            if (neighbor == null)
            {
                neighbor = CreateCell(coor);
                CreatePassage(curCell, neighbor, direction);
                activeCells.Add(neighbor);
            }
            else
            {
                CreateWall(curCell, neighbor, direction);
            }
        }
        else
        {
            CreateWall(curCell, null, direction);
        }
    }
Exemplo n.º 15
0
        public bool isBannedFolder(TreeDir dir)
        {
            // Check if Option set to Enable Filtering
            if (mSettings.GetConfig().EnabledFiltering)
            {
                DirectoryInfo    di        = new DirectoryInfo(dir.DirectoryPath());
                FileAttributesEx dirAttrib = new FileAttributesEx(dir.DirectoryPath());

                string[] c = dir.DirectoryPath().Split(Path.DirectorySeparatorChar);
                // If Options says to filter protected OS folders
                if (mSettings.GetConfig().HideProtectedOperatingSystemFilesFolders)
                {
                    return(c[1].Length != 0 && dirAttrib.isReadOnlyDirectory() && mSettings.GetConfig().HideProtectedOperatingSystemFilesFolders);
                }

                // If Config says to filter Hidden Folders
                if (mSettings.GetConfig().IgnoreHiddenFolders)
                {
                    return(dirAttrib.isHidden());
                }

                // If Config says to filter System Folders
                if (mSettings.GetConfig().IgnoreSystemFolders)
                {
                    return(dirAttrib.isSystem());
                }

                //war59312: If Config says to filter Empty Folders
                if (mSettings.GetConfig().IgnoreEmptyFolders&& dir.DirectorySize() == 0.0)
                {
                    return(true);
                }
            }

            return(false);
        }
Exemplo n.º 16
0
        public bool isBannedFolder(TreeDir dir)
        {
            // Check if Option set to Enable Filtering
            if (mSettings.GetConfig().EnabledFiltering)
            {
                DirectoryInfo di = new DirectoryInfo(dir.DirectoryPath());
                FileAttributesEx dirAttrib = new FileAttributesEx(dir.DirectoryPath());

                string[] c = dir.DirectoryPath().Split(Path.DirectorySeparatorChar);
                // If Options says to filter protected OS folders
                if (mSettings.GetConfig().HideProtectedOperatingSystemFilesFolders)
                {
                    return c[1].Length != 0 && dirAttrib.isReadOnlyDirectory() && mSettings.GetConfig().HideProtectedOperatingSystemFilesFolders;
                }

                // If Config says to filter Hidden Folders
                if (mSettings.GetConfig().IgnoreHiddenFolders)
                {
                    return dirAttrib.isHidden();
                }

                // If Config says to filter System Folders
                if (mSettings.GetConfig().IgnoreSystemFolders)
                {
                    return dirAttrib.isSystem();
                }

                //war59312: If Config says to filter Empty Folders
                if (mSettings.GetConfig().IgnoreEmptyFolders && dir.DirectorySize() == 0.0)
                {
                    return true;
                }
            }

            return false;
        }
        private TreeDir IndexToTxtFile(TreeDir dir, StringBuilder sb)
        {
            bool isNotIndexableDir = mFilter.isBannedFolder(dir);

            string dirSize  = fGetDirSizeString(dir);
            string dirTitle = string.Format("{0} [{1}]", dir.DirectoryName(), dirSize);

            string strStars = "";

            char[] styleArray = mSettings.GetConfig().FolderHeadingStyle.ToCharArray();

            for (int i = 0; i <= dirTitle.Length - 1; i++)
            {
                strStars += styleArray[i % styleArray.Length];
            }

            sb.AppendLine(GetTabs() + strStars);
            sb.AppendLine(GetTabs() + dirTitle);
            sb.AppendLine(GetTabs() + strStars);

            if (double.Parse(Regex.Split(dir.DirectorySizeToString(TreeDir.BinaryPrefix.Kibibytes), " ")[0]) == 0)
            {
                sb.AppendLine(GetTabs() + mSettings.GetOptions().EmptyFolderMessage);
            }

            if (mSettings.GetConfig().ShowFilesTreeNet)
            {
                List <TreeFile> files = dir.GetFilesColl(mSettings);
                if (files.Count > 0)
                {
                    sb.AppendLine();
                }
                foreach (TreeFile fi in files)
                {
                    string fileDesc = GetTabs() + "  ";

                    if (mSettings.GetConfig().ShowFileSize)
                    {
                        string fileSize = fi.GetSizeToString(TreeDir.BinaryPrefix.Mebibytes);
                        if (double.Parse(Regex.Split(fileSize, "\\" + mDecimalSymbol)[0]) == 0)
                        {
                            fileSize = fi.GetSizeToString(TreeDir.BinaryPrefix.Kibibytes);
                        }
                        fileDesc += string.Format("{0} [{1}]", fi.GetFileName(), fileSize);
                    }
                    else
                    {
                        fileDesc += fi.GetFileName();
                    }

                    if (mSettings.GetConfig().AudioInfo&& fIsAudio(fi.GetFileExtension().ToLower()) == true)
                    {
                        try
                        {
                            TagLib.File audioFile = TagLib.File.Create(fi.GetFilePath());
                            double      fsize     = fi.GetSize(TreeDir.BinaryPrefix.Kibibits);
                            double      dura      = audioFile.Properties.Duration.TotalSeconds;

                            if (dura > 0)
                            {
                                Debug.WriteLine(fsize / dura);
                                fileDesc += string.Format(" [{0} Kibit/s]", (fsize / dura).ToString("0.00"), fGetHMS(audioFile.Properties.Duration.TotalSeconds));
                                fileDesc += string.Format(" [{0}]", fGetHMS(audioFile.Properties.Duration.TotalSeconds));
                            }
                        }
                        catch (Exception ex)
                        {
                            Debug.WriteLine(ex.ToString() + "\n" + fi.GetFilePath());
                        }
                    }
                    sb.AppendLine(fileDesc);
                }
                sb.AppendLine();
            }

            mNumTabs += 1;

            foreach (TreeDir d in dir.GetSubDirColl())
            {
                TreeDir sd = new TreeDir(d.DirectoryPath());
                sd = IndexToTxtFile(d, sb);
            }
            mNumTabs -= 1;

            return(dir);
        }
        public override string IndexNow(IndexingMode IndexMode, bool bWriteToFile = true)
        {
            string        fp         = null;
            StringBuilder sb         = new StringBuilder();
            List <string> folderList = new List <string>();

            folderList = mSettings.GetConfig().FolderList;
            TreeNetIndexer treeNetLib = new TreeNetIndexer(mSettings);

            string ext = mSettings.GetConfig().IndexFileExt;

            switch (IndexMode)
            {
            case IndexingMode.IN_EACH_DIRECTORY:
                IndexInEachDir(mSettings);
                break;

            case IndexingMode.IN_ONE_FOLDER_MERGED:
                if (mSettings.GetConfig().MergeFiles)
                {
                    fp = mSettings.fGetIndexFilePath(-1, IndexingMode.IN_ONE_FOLDER_MERGED);

                    if (mSettings.GetConfig().FolderList.Count > 1)
                    {
                        for (int i = 0; i <= mSettings.GetConfig().FolderList.Count - 2; i++)
                        {
                            string  strDirPath = mSettings.GetConfig().FolderList[i];
                            TreeDir dir        = new TreeDir(strDirPath);

                            this.CurrentDirMessage = "Indexing " + strDirPath;

                            if (ext.Contains(".html"))
                            {
                                treeNetLib.mBooMoreFilesToCome = true;
                                treeNetLib.IndexRootFolderToHtml(strDirPath, sb, false);
                            }
                            else
                            {
                                treeNetLib.IndexFolderToTxt(strDirPath, sb, false);
                            }

                            this.Progress += 1;
                        }
                    }

                    TreeDir lastDir = new TreeDir(mSettings.GetConfig().FolderList[mSettings.GetConfig().FolderList.Count - 1]);
                    this.CurrentDirMessage = "Indexing " + lastDir.DirectoryPath();

                    if (ext.Contains(".html"))
                    {
                        treeNetLib.mBooFirstIndexFile = false || mSettings.GetConfig().FolderList.Count == 1;
                        treeNetLib.IndexRootFolderToHtml(lastDir.DirectoryPath(), sb, true);
                    }
                    else
                    {
                        treeNetLib.IndexFolderToTxt(lastDir.DirectoryPath(), sb, true);
                    }

                    if (mSettings.GetConfig().ZipMergedFile)
                    {
                        mSettings.ZipAdminFile(fp, null);
                    }

                    this.Progress += 1;
                }
                break;

            case IndexingMode.IN_ONE_FOLDER_SEPERATE:
                // DO NOT MERGE INDEX FILES
                if (!Directory.Exists(mSettings.GetConfig().OutputDir))
                {
                    MessageBox.Show(string.Format("{0} does not exist." + Environment.NewLine + Environment.NewLine + "Please change the Output folder in Configuration." + Environment.NewLine + "The index file will be created in the same folder you chose to index.", mSettings.GetConfig().OutputDir), Application.ProductName, MessageBoxButtons.OK);
                }

                for (int i = 0; i <= mSettings.GetConfig().FolderList.Count - 1; i++)
                {
                    string strDirPath = mSettings.GetConfig().FolderList[i];

                    string sDrive   = Path.GetPathRoot(strDirPath).Substring(0, 1);
                    string sDirName = Path.GetFileName(strDirPath);
                    string sep      = mSettings.GetOptions().IndividualIndexFileWordSeperator;

                    //where = mSettings.GetConfig().OutputDir + "\" + sDrive + sep + sDirName + sep + mSettings.GetConfig().GetIndexFileName
                    // New Behavior for getting where location
                    fp = mSettings.fGetIndexFilePath(i, IndexingMode.IN_ONE_FOLDER_SEPERATE);
                    mSettings.GetConfig().SetIndexPath(fp);
                    //MsgBox(where = mSettings.GetConfig().OutputDir + "\" + sDrive + sep + sDirName + sep + mSettings.GetConfig().GetIndexFileName)

                    this.CurrentDirMessage = "Indexing " + strDirPath;

                    if (ext.Contains(".html"))
                    {
                        treeNetLib.mBooFirstIndexFile = true;
                        treeNetLib.IndexRootFolderToHtml(strDirPath, sb, true);
                    }
                    else
                    {
                        treeNetLib.IndexFolderToTxt(strDirPath, sb, true);
                    }

                    if (mSettings.GetConfig().ZipFilesInOutputDir)
                    {
                        mSettings.ZipAdminFile(fp, null);
                    }

                    this.Progress += 1;
                }
                break;
            }

            if (bWriteToFile)
            {
                using (StreamWriter sw = new StreamWriter(fp, false))
                {
                    sw.Write(sb.ToString());
                    sw.Close();
                }
            }
            return(sb.ToString());
        }
Exemplo n.º 19
0
        private string IndexFolderToTxt(string folderPath, StringBuilder sb, bool AddFooter)
        {
            if (Directory.Exists(folderPath))
            {
                // 2.7.1.6 TreeGUI crashed on Could not find a part of the path

                TreeDir dir = new TreeDir(folderPath);
                dir = Analyze(dir.DirectoryPath());
                this.IndexToTxtFile(dir, sb);
                if (AddFooter)
                {
                    sb.AppendLine("____");
                    sb.AppendLine(mSettings.GetFooterText(null, IndexingEngine.TreeNetLib, false));
                }
            }

            return sb.ToString();
        }
Exemplo n.º 20
0
        private string IndexRootFolderToHtml(string folderPath, StringBuilder sb, bool bAddFooter)
        {
            if (mBooFirstIndexFile)
            {
                sb.AppendLine(Xhtml.GetDocType());
                if (mSettings.GetConfig().CollapseFolders)
                {
                    sb.AppendLine(Xhtml.GetCollapseJs());
                    sb.AppendLine(Xhtml.GetCollapseCss());
                }
                sb.AppendLine(Xhtml.GetCssStyle(mSettings.GetConfig().CssFilePath));

                if (mBooMoreFilesToCome)
                {
                    sb.AppendLine(Xhtml.GetTitle(mSettings.GetConfig().MergedHtmlTitle));
                    mBooMoreFilesToCome = false;
                }
                else
                {
                    string[] c = folderPath.Split(Path.DirectorySeparatorChar);
                    if (c[1].Length == 0)
                    {
                        sb.AppendLine(Xhtml.GetTitle("Index for " + folderPath));
                    }
                    else
                    {
                        sb.AppendLine(Xhtml.GetTitle("Index for " + Path.GetFileName(folderPath)));
                    }
                }

                sb.AppendLine(Xhtml.CloseHead());
                sb.AppendLine(Xhtml.OpenBody());

                mBooFirstIndexFile = false;
            }

            TreeDir rootDir = new TreeDir(folderPath);

            rootDir = Analyze(rootDir.DirectoryPath());

            this.IndexToHtmlFile(rootDir, sb);

            if (bAddFooter)
            {
                sb.AppendLine(Xhtml.OpenDiv());
                sb.AppendLine("<hr />");
                sb.AppendLine(mSettings.GetFooterText(null, IndexingEngine.TreeNetLib, true));
                sb.AppendLine(Xhtml.CloseDiv());
                sb.AppendLine(Xhtml.CloseBody());
            }

            mBooFirstDir = true;

            return sb.ToString();
        }
Exemplo n.º 21
0
 //getting edge based on the direction
 public TreeCellEdges GetEdge(TreeDir dir)
 {
     return(edges[(int)dir]);
 }
Exemplo n.º 22
0
        private TreeDir IndexToTxtFile(TreeDir dir, StringBuilder sb)
        {
            bool isNotIndexableDir = mFilter.isBannedFolder(dir);

            string dirSize = fGetDirSizeString(dir);
            string dirTitle = string.Format("{0} [{1}]", dir.DirectoryName(), dirSize);

            string strStars = "";
            char[] styleArray = mSettings.GetConfig().FolderHeadingStyle.ToCharArray();

            for (int i = 0; i <= dirTitle.Length - 1; i++)
            {
                strStars += styleArray[i % styleArray.Length];
            }

            sb.AppendLine(GetTabs() + strStars);
            sb.AppendLine(GetTabs() + dirTitle);
            sb.AppendLine(GetTabs() + strStars);

            if (double.Parse(Regex.Split(dir.DirectorySizeToString(TreeDir.BinaryPrefix.Kibibytes), " ")[0]) == 0)
            {
                sb.AppendLine(GetTabs() + mSettings.GetOptions().EmptyFolderMessage);
            }

            if (mSettings.GetConfig().ShowFilesTreeNet)
            {
                List<TreeFile> files = dir.GetFilesColl(mSettings);
                if (files.Count > 0)
                {
                    sb.AppendLine();
                }
                foreach (TreeFile fi in files)
                {
                    string fileDesc = GetTabs() + "  ";

                    if (mSettings.GetConfig().ShowFileSize)
                    {
                        string fileSize = fi.GetSizeToString(TreeDir.BinaryPrefix.Mebibytes);
                        if (double.Parse(Regex.Split(fileSize, "\\" + mDecimalSymbol)[0]) == 0)
                        {
                            fileSize = fi.GetSizeToString(TreeDir.BinaryPrefix.Kibibytes);
                        }
                        fileDesc += string.Format("{0} [{1}]", fi.GetFileName(), fileSize);
                    }
                    else
                    {
                        fileDesc += fi.GetFileName();
                    }

                    if (mSettings.GetConfig().AudioInfo && fIsAudio(fi.GetFileExtension().ToLower()) == true)
                    {
                        try
                        {
                            TagLib.File audioFile = TagLib.File.Create(fi.GetFilePath());
                            double fsize = fi.GetSize(TreeDir.BinaryPrefix.Kibibits);
                            double dura = audioFile.Properties.Duration.TotalSeconds;

                            if (dura > 0)
                            {
                                Debug.WriteLine(fsize / dura);
                                fileDesc += string.Format(" [{0} Kibit/s]", (fsize / dura).ToString("0.00"), fGetHMS(audioFile.Properties.Duration.TotalSeconds));
                                fileDesc += string.Format(" [{0}]", fGetHMS(audioFile.Properties.Duration.TotalSeconds));
                            }
                        }
                        catch (Exception ex)
                        {
                            Debug.WriteLine(ex.ToString() + "\n" + fi.GetFilePath());
                        }
                    }
                    sb.AppendLine(fileDesc);
                }
                sb.AppendLine();
            }

            mNumTabs += 1;

            foreach (TreeDir d in dir.GetSubDirColl())
            {
                TreeDir sd = new TreeDir(d.DirectoryPath());
                sd = IndexToTxtFile(d, sb);
            }
            mNumTabs -= 1;

            return dir;
        }
Exemplo n.º 23
0
        public override string IndexNow(IndexingMode IndexMode, bool bWriteToFile = true)
        {
            string fp = null;
            StringBuilder sb = new StringBuilder();
            List<string> folderList = new List<string>();
            folderList = mSettings.GetConfig().FolderList;
            TreeNetIndexer treeNetLib = new TreeNetIndexer(mSettings);

            string ext = mSettings.GetConfig().IndexFileExt;

            switch (IndexMode)
            {
                case IndexingMode.IN_EACH_DIRECTORY:
                    IndexInEachDir(mSettings);
                    break;
                case IndexingMode.IN_ONE_FOLDER_MERGED:
                    if (mSettings.GetConfig().MergeFiles)
                    {
                        fp = mSettings.fGetIndexFilePath(-1, IndexingMode.IN_ONE_FOLDER_MERGED);

                        if (mSettings.GetConfig().FolderList.Count > 1)
                        {
                            for (int i = 0; i <= mSettings.GetConfig().FolderList.Count - 2; i++)
                            {
                                string strDirPath = mSettings.GetConfig().FolderList[i];
                                TreeDir dir = new TreeDir(strDirPath);

                                this.CurrentDirMessage = "Indexing " + strDirPath;

                                if (ext.Contains(".html"))
                                {
                                    treeNetLib.mBooMoreFilesToCome = true;
                                    treeNetLib.IndexRootFolderToHtml(strDirPath, sb, false);
                                }
                                else
                                {
                                    treeNetLib.IndexFolderToTxt(strDirPath, sb, false);
                                }

                                this.Progress += 1;
                            }
                        }

                        TreeDir lastDir = new TreeDir(mSettings.GetConfig().FolderList[mSettings.GetConfig().FolderList.Count - 1]);
                        this.CurrentDirMessage = "Indexing " + lastDir.DirectoryPath();

                        if (ext.Contains(".html"))
                        {
                            treeNetLib.mBooFirstIndexFile = false || mSettings.GetConfig().FolderList.Count == 1;
                            treeNetLib.IndexRootFolderToHtml(lastDir.DirectoryPath(), sb, true);
                        }
                        else
                        {
                            treeNetLib.IndexFolderToTxt(lastDir.DirectoryPath(), sb, mSettings.GetConfig().AddFooter);
                        }

                        if (mSettings.GetConfig().ZipMergedFile)
                        {
                            mSettings.ZipAdminFile(fp, null);
                        }

                        this.Progress += 1;
                    }
                    break;
                case IndexingMode.IN_ONE_FOLDER_SEPERATE:
                    // DO NOT MERGE INDEX FILES
                    if (!Directory.Exists(mSettings.GetConfig().OutputDir))
                    {
                        MessageBox.Show(string.Format("{0} does not exist." + Environment.NewLine + Environment.NewLine + "Please change the Output folder in Configuration." + Environment.NewLine + "The index file will be created in the same folder you chose to index.", mSettings.GetConfig().OutputDir), Application.ProductName, MessageBoxButtons.OK);
                    }

                    for (int i = 0; i <= mSettings.GetConfig().FolderList.Count - 1; i++)
                    {
                        string strDirPath = mSettings.GetConfig().FolderList[i];

                        string sDrive = Path.GetPathRoot(strDirPath).Substring(0, 1);
                        string sDirName = Path.GetFileName(strDirPath);
                        string sep = mSettings.GetOptions().IndividualIndexFileWordSeperator;

                        //where = mSettings.GetConfig().OutputDir + "\" + sDrive + sep + sDirName + sep + mSettings.GetConfig().GetIndexFileName
                        // New Behavior for getting where location
                        fp = mSettings.fGetIndexFilePath(i, IndexingMode.IN_ONE_FOLDER_SEPERATE);
                        mSettings.GetConfig().SetIndexPath(fp);
                        //MsgBox(where = mSettings.GetConfig().OutputDir + "\" + sDrive + sep + sDirName + sep + mSettings.GetConfig().GetIndexFileName)

                        this.CurrentDirMessage = "Indexing " + strDirPath;

                        if (ext.Contains(".html"))
                        {
                            treeNetLib.mBooFirstIndexFile = true;
                            treeNetLib.IndexRootFolderToHtml(strDirPath, sb, mSettings.GetConfig().AddFooter);
                        }
                        else
                        {
                            treeNetLib.IndexFolderToTxt(strDirPath, sb, mSettings.GetConfig().AddFooter);
                        }

                        if (mSettings.GetConfig().ZipFilesInOutputDir)
                        {
                            mSettings.ZipAdminFile(fp, null);
                        }

                        this.Progress += 1;
                    }
                    break;
            }

            if (bWriteToFile)
            {
                using (StreamWriter sw = new StreamWriter(fp, false))
                {
                    sw.Write(sb.ToString());
                    sw.Close();
                }
            }
            return sb.ToString();
        }
Exemplo n.º 24
0
        private string fGetDirSizeString(TreeDir dir)
        {
            string dirSize = null;

            if (mBooFirstDir)
            {
                dirSize = dir.DirectorySizeToString(TreeDir.BinaryPrefix.Gibibytes);
                if (decimal.Parse(Regex.Split(dirSize, "\\" + mDecimalSymbol)[0]) == 0)
                {
                    dirSize = dir.DirectorySizeToString(TreeDir.BinaryPrefix.Mebibytes);
                    if (decimal.Parse(Regex.Split(dirSize, " ")[0]) == 0)
                    {
                        dirSize = dir.DirectorySizeToString(TreeDir.BinaryPrefix.Kibibytes);
                    }
                }
            }
            else
            {
                dirSize = dir.DirectorySizeToString(TreeDir.BinaryPrefix.Mebibytes);
                if (decimal.Parse(Regex.Split(dirSize, "\\" + mDecimalSymbol)[0]) == 0)
                {
                    dirSize = dir.DirectorySizeToString(TreeDir.BinaryPrefix.Kibibytes);
                }
            }

            return dirSize;
        }
 public void AddDir(TreeDir mySubDir)
 {
     mSubDirCol.Add(mySubDir);
 }
Exemplo n.º 26
0
        private string GetHeadingOpen(TreeDir dir)
        {
            string cName = "trigger";
            List<TreeFile> files = dir.GetFilesColl(mSettings);

            /*
            if (mNumTabs > mSettings.GetConfig().FolderExpandLevel)
            {
                cName = "expanded";
            }
            else
            {
                cName = "trigger";
            }
            */

            string tabs = string.Empty;

            if (mNumTabs < 7)
            {
                if (dir.GetSubDirColl().Count > 0 || files.Count > 0)
                {
                    tabs = string.Format("<h{0} class=\"{1}\">", mNumTabs.ToString(), cName);
                }
                else
                {
                    tabs = string.Format("<h{0}>", mNumTabs.ToString());
                }
            }
            else
            {
                if (dir.GetSubDirColl().Count > 0 || files.Count > 0)
                {
                    tabs = string.Format("<h6 class=\"{0}\">", cName);
                }
                else
                {
                    tabs = "<h6>";
                }
            }

            return tabs;
        }
Exemplo n.º 27
0
 public void AddDir(TreeDir mySubDir)
 {
     mSubDirCol.Add(mySubDir);
 }
Exemplo n.º 28
0
 public static Quaternion ToRotation(this TreeDir dir)
 {
     return(rotations[(int)dir]);
 }
Exemplo n.º 29
0
 private string fGetDirPath(TreeDir dir)
 {
     string dirName = null;
     string[] c = dir.DirectoryPath().Split(Path.DirectorySeparatorChar);
     if (c[1].Length == 0)
     {
         // Root Drive
         dirName = dir.DirectoryPath();
     }
     else
     {
         if (mSettings.GetConfig().ShowFolderPath)
         {
             dirName = dir.DirectoryPath();
         }
         else
         {
             dirName = dir.DirectoryName();
         }
     }
     return dirName;
 }
Exemplo n.º 30
0
        private TreeDir IndexToHtmlFile(TreeDir dir, StringBuilder where)
        {
            bool isNotIndexableDir = mFilter.isBannedFolder(dir);

            string dirName = fGetDirPath(dir);
            string dirSize = (string)fGetDirSizeString(dir);

            string dirTitle = null;

            if (mSettings.GetConfig().EnabledFiltering && mSettings.GetConfig().IgnoreEmptyFolders && dir.DirectorySize() == 0.0)
            {
                //war59312 - dont show empty folders
                dirTitle = "";
            }
            else
            {
                if (mSettings.GetConfig().ShowDirSize)
                {
                    dirTitle = Xhtml.GetValidXhtmlLine(string.Format("{0} [{1}]", dirName, dirSize));
                }
                else
                {
                    dirTitle = Xhtml.GetValidXhtmlLine(dirName);
                }
            }

            if (mBooFirstDir)
            {
                rootDir = dir.DirectoryPath();
                where.AppendLine("<h1>" + dirTitle + "</h1>");
                mBooFirstDir = false;
                mNumTabs = 1;
            }
            else
            {
                if (!isNotIndexableDir)
                {
                    if (mSettings.GetConfig().EnabledFiltering && mSettings.GetConfig().IgnoreEmptyFolders && dir.DirectorySize() == 0.0)
                    {
                        //war59312 - dont show empty folders
                    }
                    else
                    {
                        if (mSettings.GetConfig().ShowFolderPathOnStatusBar)
                        {
                            string hyperlinkDir = null;
                            if (mSettings.GetConfig().ShowVirtualFolders)
                            {
                                // Virtual Folders
                                hyperlinkDir = mSettings.GetConfig().ServerInfo + "/" + fGetVirtualDirName(dir.DirectoryPath()).Replace("\\", "/");
                            }
                            else
                            {
                                // Locally Browse
                                hyperlinkDir = "file://" + dir.DirectoryPath();
                            }
                            hyperlinkDir = "<a href=" + (char)34 + hyperlinkDir + (char)34 + ">" + dirTitle + "</a>";
                            where.AppendLine(GetHeadingOpen(dir) + hyperlinkDir + GetHeadingClose());
                        }
                        else
                        {
                            where.AppendLine(GetHeadingOpen(dir) + dirTitle + GetHeadingClose());
                        }
                    }
                }
            }

            if (!isNotIndexableDir)
            {
                if (mSettings.GetConfig().EnabledFiltering && mSettings.GetConfig().IgnoreEmptyFolders && dir.DirectorySize() == 0.0)
                {
                    //war59312 - dont show empty folders
                }
                else
                {
                    List<TreeFile> files = dir.GetFilesColl(mSettings);

                    if (fDivWrap(dir))
                    {
                        where.AppendLine(Xhtml.OpenDiv());
                    }

                    if (double.Parse(Regex.Split(dir.DirectorySizeToString(TreeDir.BinaryPrefix.Kibibytes), " ")[0]) > 0 | files.Count > 0)
                    {
                        if (mSettings.GetConfig().ShowFileCount)
                        {
                            if (files.Count > 0)
                            {
                                where.AppendLine(Xhtml.OpenPara("foldercount"));
                                where.AppendLine("Files Count: " + files.Count.ToString());
                                where.AppendLine(Xhtml.ClosePara());
                            }
                        }
                    }
                    else
                    {
                        //Note:
                        // dir.GetFilesColl().Count = 0 DOESNT ALWAYS MEAN THAT
                        // it is an empty directory because there can be subfolders
                        // with files
                        //System.Windows.Forms.MessageBox.Show(dir.GetFilesColl().Count)
                        where.AppendLine(Xhtml.OpenPara(""));
                        where.AppendLine(mSettings.GetOptions().EmptyFolderMessage + Xhtml.AddBreak());
                        where.AppendLine(Xhtml.ClosePara());
                    }

                    if (files.Count > 0)
                    {
                        // Check if there is AT LEAST ONE valid file
                        bool booPrintList = false;
                        foreach (TreeFile fp in files)
                        {
                            if (!mFilter.IsBannedFile(fp.GetFilePath()))
                            {
                                booPrintList = true;
                                break;
                            }
                        }

                        if (mSettings.GetConfig().ShowFilesTreeNet)
                        {
                            if (booPrintList)
                            {
                                switch (mSettings.GetConfig().IndexListType)
                                {
                                    case XHTMLFileListMode.Bullets:
                                        where.AppendLine(Xhtml.OpenBulletedList());
                                        break;
                                    case XHTMLFileListMode.Numbered:
                                        where.AppendLine(Xhtml.OpenNumberedList());
                                        break;
                                }
                            }

                            if (mSettings.GetConfig().RevereFileOrder)
                            {
                                files.Reverse();
                            }

                            foreach (TreeFile f in files)
                            {
                                string lLine = null;

                                if (!mFilter.IsBannedFile(f.GetFilePath()))
                                {
                                    string strFilePath = null;

                                    if (mSettings.GetConfig().ShowFilePath)
                                    {
                                        if (mSettings.GetConfig().ShowVirtualFolders)
                                        {
                                            strFilePath = fGetVirtualDirName(f.GetFilePath());
                                        }
                                        else
                                        {
                                            strFilePath = f.GetFilePath();
                                        }
                                    }
                                    else
                                    {
                                        if (mSettings.GetConfig().HideExtension)
                                        {
                                            strFilePath = f.GetFileNameWithoutExtension();
                                        }
                                        else
                                        {
                                            strFilePath = f.GetFileName();
                                        }
                                    }

                                    if (mSettings.GetConfig().ShowFileSize)
                                    {
                                        string fileSize = f.GetSizeToString(TreeDir.BinaryPrefix.Mebibytes);
                                        if (double.Parse(Regex.Split(fileSize, "\\" + mDecimalSymbol)[0]) == 0)
                                        {
                                            fileSize = f.GetSizeToString(TreeDir.BinaryPrefix.Kibibytes);
                                        }
                                        lLine = Xhtml.GetValidXhtmlLine(strFilePath) + " " + Xhtml.GetSpan(string.Format(" [{0}]", fileSize), "filesize");
                                    }
                                    else
                                    {
                                        lLine = Xhtml.GetValidXhtmlLine(strFilePath);
                                    }

                                    if (mSettings.GetConfig().AudioInfo && fIsAudio(f.GetFileExtension().ToLower()) == true)
                                    {
                                        try
                                        {
                                            TagLib.File audioFile = TagLib.File.Create(f.GetFilePath());
                                            double fsize = f.GetSize(TreeDir.BinaryPrefix.Kibibits);
                                            double dura = audioFile.Properties.Duration.TotalSeconds;

                                            if (dura > 0)
                                            {
                                                Debug.WriteLine(fsize / dura);
                                                lLine += Xhtml.GetSpan(string.Format(" [{0} kb/s]", (fsize / dura).ToString("0.00"), fGetHMS(audioFile.Properties.Duration.TotalSeconds)), "audioinfo");
                                                lLine += Xhtml.GetSpan(string.Format(" [{0}]", fGetHMS(audioFile.Properties.Duration.TotalSeconds)), "audiolength");
                                            }
                                        }
                                        catch (Exception ex)
                                        {
                                            Debug.WriteLine(ex.ToString() + "\n" + f.GetFilePath());
                                        }
                                    }

                                    where.AppendLine("<li>" + lLine + "</li>");
                                }
                            }

                            if (booPrintList)
                            {
                                switch (mSettings.GetConfig().IndexListType)
                                {
                                    case XHTMLFileListMode.Bullets:
                                        where.AppendLine(Xhtml.CloseBulletedList());
                                        break;
                                    case XHTMLFileListMode.Numbered:
                                        where.AppendLine(Xhtml.CloseNumberedList());
                                        break;
                                }
                            }
                            // Show Files for TreeNet
                        }
                    }

                    mNumTabs += 1;

                    foreach (TreeDir d in dir.GetSubDirColl())
                    {
                        TreeDir sd = new TreeDir(d.DirectoryPath());
                        sd = IndexToHtmlFile(d, where);
                    }

                    if (fDivWrap(dir))
                    {
                        where.AppendLine(Xhtml.CloseDiv());
                    }

                    mNumTabs -= 1;
                }
            }

            return dir;
        }
 private bool fDivWrap(TreeDir dir)
 {
     return((rootDir != dir.DirectoryPath()) && (dir.GetSubDirColl().Count > 0 | mSettings.GetConfig().ShowFileCount));
 }
Exemplo n.º 32
0
 private bool fDivWrap(TreeDir dir)
 {
     return (rootDir != dir.DirectoryPath()) && (dir.GetSubDirColl().Count > 0 | mSettings.GetConfig().ShowFileCount);
 }
        private TreeDir IndexToHtmlFile(TreeDir dir, StringBuilder where)
        {
            bool isNotIndexableDir = mFilter.isBannedFolder(dir);

            string dirName = fGetDirPath(dir);
            string dirSize = (string)fGetDirSizeString(dir);

            string dirTitle = null;

            if (mSettings.GetConfig().EnabledFiltering&& mSettings.GetConfig().IgnoreEmptyFolders&& dir.DirectorySize() == 0.0)
            {
                //war59312 - dont show empty folders
                dirTitle = "";
            }
            else
            {
                if (mSettings.GetConfig().ShowDirSize)
                {
                    dirTitle = Xhtml.GetValidXhtmlLine(string.Format("{0} [{1}]", dirName, dirSize));
                }
                else
                {
                    dirTitle = Xhtml.GetValidXhtmlLine(dirName);
                }
            }

            if (mBooFirstDir)
            {
                rootDir = dir.DirectoryPath();
                where.AppendLine("<h1>" + dirTitle + "</h1>");
                mBooFirstDir = false;
                mNumTabs     = 1;
            }
            else
            {
                if (!isNotIndexableDir)
                {
                    if (mSettings.GetConfig().EnabledFiltering&& mSettings.GetConfig().IgnoreEmptyFolders&& dir.DirectorySize() == 0.0)
                    {
                        //war59312 - dont show empty folders
                    }
                    else
                    {
                        if (mSettings.GetConfig().ShowFolderPathOnStatusBar)
                        {
                            string hyperlinkDir = null;
                            if (mSettings.GetConfig().ShowVirtualFolders)
                            {
                                // Virtual Folders
                                hyperlinkDir = mSettings.GetConfig().ServerInfo + "/" + fGetVirtualDirName(dir.DirectoryPath()).Replace("\\", "/");
                            }
                            else
                            {
                                // Locally Browse
                                hyperlinkDir = "file://" + dir.DirectoryPath();
                            }
                            hyperlinkDir = "<a href=" + (char)34 + hyperlinkDir + (char)34 + ">" + dirTitle + "</a>";
                            where.AppendLine(GetHeadingOpen(dir) + hyperlinkDir + GetHeadingClose());
                        }
                        else
                        {
                            where.AppendLine(GetHeadingOpen(dir) + dirTitle + GetHeadingClose());
                        }
                    }
                }
            }

            if (!isNotIndexableDir)
            {
                if (mSettings.GetConfig().EnabledFiltering&& mSettings.GetConfig().IgnoreEmptyFolders&& dir.DirectorySize() == 0.0)
                {
                    //war59312 - dont show empty folders
                }
                else
                {
                    List <TreeFile> files = dir.GetFilesColl(mSettings);

                    if (fDivWrap(dir))
                    {
                        where.AppendLine(Xhtml.OpenDiv());
                    }

                    if (double.Parse(Regex.Split(dir.DirectorySizeToString(TreeDir.BinaryPrefix.Kibibytes), " ")[0]) > 0 | files.Count > 0)
                    {
                        if (mSettings.GetConfig().ShowFileCount)
                        {
                            if (files.Count > 0)
                            {
                                where.AppendLine(Xhtml.OpenPara("foldercount"));
                                where.AppendLine("Files Count: " + files.Count.ToString());
                                where.AppendLine(Xhtml.ClosePara());
                            }
                        }
                    }
                    else
                    {
                        //Note:
                        // dir.GetFilesColl().Count = 0 DOESNT ALWAYS MEAN THAT
                        // it is an empty directory because there can be subfolders
                        // with files
                        //System.Windows.Forms.MessageBox.Show(dir.GetFilesColl().Count)
                        where.AppendLine(Xhtml.OpenPara(""));
                        where.AppendLine(mSettings.GetOptions().EmptyFolderMessage + Xhtml.AddBreak());
                        where.AppendLine(Xhtml.ClosePara());
                    }

                    if (files.Count > 0)
                    {
                        // Check if there is AT LEAST ONE valid file
                        bool booPrintList = false;
                        foreach (TreeFile fp in files)
                        {
                            if (!mFilter.IsBannedFile(fp.GetFilePath()))
                            {
                                booPrintList = true;
                                break;
                            }
                        }

                        if (mSettings.GetConfig().ShowFilesTreeNet)
                        {
                            if (booPrintList)
                            {
                                switch (mSettings.GetConfig().IndexListType)
                                {
                                case XHTMLFileListMode.Bullets:
                                    where.AppendLine(Xhtml.OpenBulletedList());
                                    break;

                                case XHTMLFileListMode.Numbered:
                                    where.AppendLine(Xhtml.OpenNumberedList());
                                    break;
                                }
                            }

                            if (mSettings.GetConfig().RevereFileOrder)
                            {
                                files.Reverse();
                            }

                            foreach (TreeFile f in files)
                            {
                                string lLine = null;

                                if (!mFilter.IsBannedFile(f.GetFilePath()))
                                {
                                    string strFilePath = null;

                                    if (mSettings.GetConfig().ShowFilePath)
                                    {
                                        if (mSettings.GetConfig().ShowVirtualFolders)
                                        {
                                            strFilePath = fGetVirtualDirName(f.GetFilePath());
                                        }
                                        else
                                        {
                                            strFilePath = f.GetFilePath();
                                        }
                                    }
                                    else
                                    {
                                        if (mSettings.GetConfig().HideExtension)
                                        {
                                            strFilePath = f.GetFileNameWithoutExtension();
                                        }
                                        else
                                        {
                                            strFilePath = f.GetFileName();
                                        }
                                    }

                                    if (mSettings.GetConfig().ShowFileSize)
                                    {
                                        string fileSize = f.GetSizeToString(TreeDir.BinaryPrefix.Mebibytes);
                                        if (double.Parse(Regex.Split(fileSize, "\\" + mDecimalSymbol)[0]) == 0)
                                        {
                                            fileSize = f.GetSizeToString(TreeDir.BinaryPrefix.Kibibytes);
                                        }
                                        lLine = Xhtml.GetValidXhtmlLine(strFilePath) + " " + Xhtml.GetSpan(string.Format(" [{0}]", fileSize), "filesize");
                                    }
                                    else
                                    {
                                        lLine = Xhtml.GetValidXhtmlLine(strFilePath);
                                    }

                                    if (mSettings.GetConfig().AudioInfo&& fIsAudio(f.GetFileExtension().ToLower()) == true)
                                    {
                                        try
                                        {
                                            TagLib.File audioFile = TagLib.File.Create(f.GetFilePath());
                                            double      fsize     = f.GetSize(TreeDir.BinaryPrefix.Kibibits);
                                            double      dura      = audioFile.Properties.Duration.TotalSeconds;

                                            if (dura > 0)
                                            {
                                                Debug.WriteLine(fsize / dura);
                                                lLine += Xhtml.GetSpan(string.Format(" [{0} kb/s]", (fsize / dura).ToString("0.00"), fGetHMS(audioFile.Properties.Duration.TotalSeconds)), "audioinfo");
                                                lLine += Xhtml.GetSpan(string.Format(" [{0}]", fGetHMS(audioFile.Properties.Duration.TotalSeconds)), "audiolength");
                                            }
                                        }
                                        catch (Exception ex)
                                        {
                                            Debug.WriteLine(ex.ToString() + "\n" + f.GetFilePath());
                                        }
                                    }

                                    where.AppendLine("<li>" + lLine + "</li>");
                                }
                            }

                            if (booPrintList)
                            {
                                switch (mSettings.GetConfig().IndexListType)
                                {
                                case XHTMLFileListMode.Bullets:
                                    where.AppendLine(Xhtml.CloseBulletedList());
                                    break;

                                case XHTMLFileListMode.Numbered:
                                    where.AppendLine(Xhtml.CloseNumberedList());
                                    break;
                                }
                            }
                            // Show Files for TreeNet
                        }
                    }

                    mNumTabs += 1;

                    foreach (TreeDir d in dir.GetSubDirColl())
                    {
                        TreeDir sd = new TreeDir(d.DirectoryPath());
                        sd = IndexToHtmlFile(d, where);
                    }

                    if (fDivWrap(dir))
                    {
                        where.AppendLine(Xhtml.CloseDiv());
                    }

                    mNumTabs -= 1;
                }
            }

            return(dir);
        }
Exemplo n.º 34
0
 public static IntVector2 ToIntVector2(this TreeDir dir)
 {
     return(defineVecotrs[(int)dir]);
 }
Exemplo n.º 35
0
 //seting edge
 public void SetEdge(TreeDir dir, TreeCellEdges edge)
 {
     edges[(int)dir] = edge;
     initEdgeCount  += 1;
 }
Exemplo n.º 36
0
 public string GetSizeToString(TreeDir.BinaryPrefix prefix)
 {
     string bp = "";
     switch (prefix)
     {
         case TreeDir.BinaryPrefix.Gibibytes:
             bp = " GiB";
             break;
         case TreeDir.BinaryPrefix.Mebibytes:
             bp = " MiB";
             break;
         case TreeDir.BinaryPrefix.Kibibytes:
             bp = " KiB";
             break;
     }
     return GetSize(prefix).ToString("N") + bp;
 }
Exemplo n.º 37
0
 public static TreeDir GetOppositeDir(this TreeDir dir)
 {
     return(opposites[(int)dir]);
 }