Beispiel #1
0
        private void GetFileList(DirectoryInfo diroot, List <AutoUpdateFileInfo> fileLists)
        {
            foreach (FileInfo file in diroot.GetFiles())
            {
                if (file.Extension == ".dll" || file.Extension == ".exe" || file.Extension == ".pdb")
                {
                    var             autoUpdateFile  = new AutoUpdateFileInfo();
                    FileVersionInfo fileVersionInfo = FileVersionInfo.GetVersionInfo(file.FullName);
                    autoUpdateFile.LastVer     = fileVersionInfo.FileVersion;
                    autoUpdateFile.Path        = file.Name;
                    autoUpdateFile.NeedRestart = true;
                    autoUpdateFile.Size        = file.Length;
                    autoUpdateFile.Url         = ConfigHelper.ParamsConfig.GetParamValue("BaseUrl") + file.Name;

                    fileLists.Add(autoUpdateFile);
                }
            }

            foreach (DirectoryInfo dirSub in diroot.GetDirectories())
            {
                GetFileList(dirSub, fileLists);
            }
        }
        private void GetFileList(DirectoryInfo diroot, List<AutoUpdateFileInfo> fileLists)
        {
            foreach (FileInfo file in diroot.GetFiles())
            {
                if (file.Extension == ".dll" || file.Extension == ".exe"|| file.Extension == ".pdb")
                {
                    var autoUpdateFile = new AutoUpdateFileInfo();
                    FileVersionInfo fileVersionInfo = FileVersionInfo.GetVersionInfo(file.FullName);
                    autoUpdateFile.LastVer = fileVersionInfo.FileVersion;
                    autoUpdateFile.Path = file.Name;
                    autoUpdateFile.NeedRestart = true;
                    autoUpdateFile.Size = file.Length;
                    autoUpdateFile.Url = ConfigHelper.ParamsConfig.GetParamValue("BaseUrl") + file.Name;

                    fileLists.Add(autoUpdateFile);
                }
            }

            foreach (DirectoryInfo dirSub in diroot.GetDirectories())
            {
                GetFileList(dirSub, fileLists);
            }
        }