private void Open(string AFileName) { // Display the ProgressBar control. pBar1.Visible = true; // Set Minimum to 0 to represent the first file being copied. pBar1.Minimum = 0; // Set Maximum to the total number of files to copy. pBar1.Maximum = 100; // Set the initial value of the ProgressBar. pBar1.Value = 1; cache.UpdateProgress += UpdateProgress; cache.Load(AFileName, false); cache.ReAnalyze(); config.HideFastFuncs = false; config.HideLibFuncs = false; config.FastThreshold = 100; config.TimeDisplay = TTimeDisplay.tdPercent; System.IO.FileInfo fileInfo = new System.IO.FileInfo(AFileName); config.WorkingDir = fileInfo.DirectoryName; //now that configs are set, refresh RefreshExplorer(); //new stuff FDoc fDoc = new FDoc(cache, config); TabPage tp = new TabPage(); System.IO.FileInfo fileInfo2 = new System.IO.FileInfo(cache.Cmd); tp.Text = fileInfo2.Name; tp.ImageIndex = (int)tForm1ImageIndex.imgClose; tp.Controls.Add(fDoc); this.tabControl2.TabPages.Add(tp); pBar1.Visible = false; }
static void Main(string[] args) { Console.WriteLine("PARSING START:" + DateTime.Now.ToLongTimeString()); TCacheGrind cache = new TCacheGrind(); cache.Load(@"c:\wamp\tmp\cachegrind.out.1531400630.16376", false); Console.WriteLine("PARSING END:" + DateTime.Now.ToLongTimeString()); Console.ReadLine(); }
private void RefreshExplorer() { System.IO.FileInfo F; string[] Code; TCacheGrind CG; TExplorerData ED; // sb.SimplePanel := True; string ApplicationHint = "Refreshing Explorer list. Please wait..."; ClearExplorer(); if (config.WorkingDir != string.Empty) { CG = new TCacheGrind(); Code = System.IO.Directory.GetFiles(config.WorkingDir, @"cachegrind.out.*"); foreach (string dir in Code) { F = new System.IO.FileInfo(dir); ED = new TExplorerData(); ED.FileName = config.WorkingDir + @"\" + F.Name; ED.Modified = F.LastWriteTime; ED.Size = F.Length; try { CG.Load(config.WorkingDir + @"\" + F.Name, true); ED.Title = CG.Cmd; } catch (Exception) { ED.Title = "(Error: Cannot read file)"; } ExplorerList.Add(ED); } // update list lvExplorerInvalidate(); // register change notify /*TODO: do we need this? * cn.Active := False; * cn.Notifications[0].Directory := Config.WorkingDir; * cn.Active := True; */ } ApplicationHint = ""; }