////private void simpleButton1_Click(object sender, EventArgs e) ////{ //// string strPath = $@"\\MANUFACTURING\Impact\PFCS\ProgramFiles"; //// string strFileFilter = $@"*.*"; //// DirectoryInfo di = new DirectoryInfo(strPath); //// IEnumerable<FileInfo> iefiDirContents = di.GetFiles(strFileFilter); //// using (MyVersionEntity db = new MyVersionEntity()) //// { //// foreach (FileInfo fi in iefiDirContents) //// { //// var fvinfo = FileVersionInfo.GetVersionInfo(fi.FullName); //// VersionedItems vi = new VersionedItems() //// { //// Name = fi.Name, //// version = new Version(fvinfo.ProductVersion), //// }; //// db.VersionedItem.Local.Add(vi); //// } //// gridControl1.DataSource = null; //// gridControl1.Refresh(); //// gridControl1.DataSource = db.VersionedItem; //// } ////} private void simpleButton1_Click(object sender, EventArgs e) { string strPath = $@"\\MANUFACTURING\Impact\PFCS\ProgramFiles"; string [] strFileFilter = { $@"*.exe", $@"*.dll" }; DirectoryInfo di = new DirectoryInfo(strPath); List <VersionedItems> vIList = new List <VersionedItems>(); FileVersionInfo fvinfo; foreach (string exten in strFileFilter) { IEnumerable <FileInfo> iefiDirContents = di.GetFiles(exten); foreach (FileInfo fi in iefiDirContents) { fvinfo = FileVersionInfo.GetVersionInfo(fi.FullName); try { VersionedItems vi = new VersionedItems() { Name = fi.Name, /*version = new Version(fvinfo.ProductVersion),*/ version = new Version(fvinfo.FileVersion), }; vIList.Add(vi); } catch (Exception xcptn) { Trace.WriteLine($@""); Trace.WriteLine($@"Begin of Exception Error Output"); Trace.WriteLine($@""); Trace.WriteLine($@"{xcptn}"); Trace.WriteLine($@""); Trace.WriteLine($@"{xcptn.InnerException}"); Trace.WriteLine($@""); Trace.WriteLine($@"{fi.ToString()}"); Trace.WriteLine($@""); Trace.WriteLine($@"{fvinfo.ToString()}"); Trace.WriteLine($@""); Trace.WriteLine($@"End of Exception Error Output"); Trace.WriteLine($@""); Trace.WriteLine($@""); } finally { } } } gridControl1.DataSource = null; gridControl1.Refresh(); gridControl1.DataSource = vIList; }
private void CodeForThread() { List <string> strListMissed = new List <string>(); List <VersionedItems> vIList = new List <VersionedItems>(); string strPath = string.Empty; int cap = _listComputerNames.Count; int iter = 1; string progress = $@""; SetProgressBar(); ShowProgressPanel(); foreach (string system in _listComputerNames) { StepProgressBar(); try { //strPath = $@"\\{system}\C$\PFCS\"; strPath = string.Format(_installedPFCSPath, system); UpdateProgressPanel(string.Format(_loadingString, iter, cap, strPath)); iter++; string strFileFilter = _FileFilter; DirectoryInfo di = new DirectoryInfo(strPath); FileVersionInfo fvinfo; IEnumerable <FileInfo> iefiDirContents = di.GetFiles(strFileFilter); foreach (FileInfo fi in iefiDirContents) { fvinfo = FileVersionInfo.GetVersionInfo(fi.FullName); VersionedItems vi = new VersionedItems() { Name = fi.Name, /*version = new Version(fvinfo.ProductVersion),*/ IsExtensionable = !string.IsNullOrEmpty(fi.Extension), Extension = (!string.IsNullOrEmpty(fi.Extension) ? fi.Extension : null), FullPathandName = fi.FullName, version = new Version(fvinfo.FileVersion), Info = fi }; vIList.Add(vi); } SetDataGrid1(vIList); } catch (Exception xcptn) { InvokeTrace(string.Empty); InvokeTrace($@"Begin of Exception Error Output"); //Trace.WriteLine(string.Empty); //Trace.WriteLine($@"Begin of Exception Error Output"); Trace.WriteLine(string.Empty); Trace.WriteLine($@"{xcptn}"); Trace.WriteLine(string.Empty); Trace.WriteLine($@"{xcptn.InnerException}"); Trace.WriteLine(string.Empty); Trace.WriteLine($@"{strPath}"); //Trace.WriteLine($@""); //Trace.WriteLine($@"{fvinfo.ToString()}"); Trace.WriteLine(string.Empty); Trace.WriteLine($@"End of Exception Error Output"); Trace.WriteLine(string.Empty); Trace.WriteLine(string.Empty); strListMissed.Add(strPath); } finally { } } SetDataGrid2(strListMissed); HideProgressPanel(); }