Пример #1
0
        /// <summary>
        /// 从索引文件及设置文件中读取数据,初始化数据。
        /// </summary>
        private void InitData()
        {
            #region 包含路径 排除路径
            this.fileInPath  = Deal.ListStringClone(Static.Settings.FileIndexInPath);  //文件索引包含路径
            this.fileOutPath = Deal.ListStringClone(Static.Settings.FileIndexOutPath); //文件索引排除路径
            this.mp3InPath   = Deal.ListStringClone(Static.Settings.MP3IndexInPath);   //MP3索引包含路径
            this.mp3OutPath  = Deal.ListStringClone(Static.Settings.MP3IndexOutPath);  //MP3索引排除路径

            this.UpdateListView(this.lvwFIn, this.fileInPath);
            this.UpdateListView(this.lvwFOut, this.fileOutPath);
            this.UpdateListView(this.lvwMIn, this.mp3InPath);
            this.UpdateListView(this.lvwMOut, this.mp3OutPath);
            #endregion

            #region 索引信息

            IndexInfoDB indexInfo = new IndexInfoDB();
            indexInfo.ReadIndexInfoDB();//读取索引信息
            this.lblFCreation.Text = indexInfo.FCreationTime;
            this.lblFUpdate.Text   = indexInfo.FUpdateTime;
            this.lblFFiles.Text    = Deal.ToEnglishNumString(indexInfo.FFileNums);
            this.lblFPaths.Text    = Deal.ToEnglishNumString(indexInfo.FFolderNums);

            this.lblMCreation.Text = indexInfo.MCreationTime;
            this.lblMUpdate.Text   = indexInfo.MUpdateTime;
            this.lblMFiles.Text    = Deal.ToEnglishNumString(indexInfo.MFileNums);
            this.lblMPaths.Text    = Deal.ToEnglishNumString(indexInfo.MFolderNums);

            #endregion
        }
Пример #2
0
        /// <summary>
        /// 初始化设置
        /// </summary>
        private void InitSettings()
        {
            //初始化设置信息
            Static.Settings.ReadSettings();
            Static.FileIndexPath = Static.Settings.FileIndexPath;
            Static.MP3IndexPath  = Static.Settings.MP3IndexPath;
            IndexInfoDB indexInfo = new IndexInfoDB();

            indexInfo.ReadIndexInfoDB();
            Static.MP3Artist   = indexInfo.MP3Artist;
            Static.MP3SongNums = indexInfo.MFileNums;

            this.停止更新ToolStripMenuItem.Enabled = false;
            this.保存结果ToolStripMenuItem.Enabled = false;
            this.tsslLength        = this.statusStrip.Width - 120;
            this.orginalStatusText = "永远别说永远,凡事都有可能。";
            this.tsslStatus.Text   = Deal.LimitStringLength(this.orginalStatusText, this.tsslLength);

            this.modeStatus        = ModeStatus.FILE;
            this.magicMirrorStatus = MagicMirrorStatus.Close;
            this.lvStatus          = ListViewStatus.File;

            this.isSearchWithResult = false;
            this.indexMode          = IndexMode.All;   //默认索引模式为所有
            this.searchMode         = SearchMode.File; //默认搜索模式为文件
            //this.index = new Index(this, this.indexMode);
            this.search      = new Search(this, this.searchMode);
            this.magicMirror = new MagicMirror();
            this.magicMirror.SetProperties(MagicMode.None, null);
            this.pnlMagicMirror.Controls.Add(this.magicMirror);
            this.magicMirror.Dock = DockStyle.Fill;

            this.btnNext.Visible     = false;
            this.btnPrevious.Visible = false;
            this.tsslPages.Visible   = false;

            //加入文件夹图标,未知文件的图标,mp3图标,jpg图标。
            this.imgIcon.Images.Add("f", GetSystemIcon.GetFolderIcon(false));
            this.imgIcon.Images.Add("u", GetSystemIcon.GetUnknownFileIcon(false));
            this.imgIcon.Images.Add(".mp3", GetSystemIcon.GetIconByFileType(".mp3", false));
            this.imgIcon.Images.Add(".jpg", GetSystemIcon.GetIconByFileType(".jpg", false));
            this.imgIcon.Images.Add(".txt", GetSystemIcon.GetIconByFileType(".txt", false));
            this.imgIcon.Images.Add("artist", Properties.Resources.artist);
        }
Пример #3
0
        /// <summary>
        /// 保存文件索引信息的索引信息文件
        /// </summary>
        private void SaveIndexInfo()
        {
            IndexInfoDB indexInfoDB = new IndexInfoDB();//索引数据库信息

            indexInfoDB.ReadIndexInfoDB();
            string strNow = DateTime.Now.ToString();

            switch (indexType)
            {
            case IndexMode.All:
            {
                if (indexInfoDB.FCreationTime == "")
                {
                    indexInfoDB.FCreationTime = strNow;
                }
                indexInfoDB.FUpdateTime   = strNow;
                indexInfoDB.FFileNums     = this.fileCounter;
                indexInfoDB.FFolderNums   = this.folderCounter;
                indexInfoDB.FileIndexPath = this.fileScanPath;

                if (indexInfoDB.MCreationTime == "")
                {
                    indexInfoDB.MCreationTime = strNow;
                }

                indexInfoDB.MUpdateTime   = strNow;
                indexInfoDB.MFileNums     = this.mp3FileCounter;
                indexInfoDB.MFolderNums   = this.mp3FolderCounter;
                indexInfoDB.MP3IndexPath  = Deal.ListStringClone(this.mp3ScanPath);
                indexInfoDB.MP3Artist     = Deal.ListStringClone(this.mp3Artist);
                indexInfoDB.MP3Directorys = Deal.ListStringClone(this.mp3Directorys);
                break;
            }

            case IndexMode.File:
            {
                if (indexInfoDB.FCreationTime == "")
                {
                    indexInfoDB.FCreationTime = strNow;
                }
                indexInfoDB.FUpdateTime   = strNow;
                indexInfoDB.FFileNums     = this.fileCounter;
                indexInfoDB.FFolderNums   = this.folderCounter;
                indexInfoDB.FileIndexPath = Deal.ListStringClone(this.fileScanPath);
                break;
            }

            case IndexMode.MP3:
            {
                if (indexInfoDB.MCreationTime == "")
                {
                    indexInfoDB.MCreationTime = strNow;
                }

                indexInfoDB.MUpdateTime   = strNow;
                indexInfoDB.MFileNums     = this.mp3FileCounter;
                indexInfoDB.MFolderNums   = this.mp3FolderCounter;
                indexInfoDB.MP3IndexPath  = Deal.ListStringClone(this.mp3ScanPath);
                indexInfoDB.MP3Artist     = Deal.ListStringClone(this.mp3Artist);
                indexInfoDB.MP3Directorys = Deal.ListStringClone(this.mp3Directorys);

                //更新全局变量中的艺术家信息与曲目数。
                Static.MP3Artist   = Deal.ListStringClone(indexInfoDB.MP3Artist);
                Static.MP3SongNums = indexInfoDB.MFileNums;
                break;
            }
            }
            indexInfoDB.WriteIndexInfoDB();
        }