protected override void Execute(CodeActivityContext context) { try { long resultBytes = 0; double resultMB = 0; localOutPutPath = string.Empty; localPath = DirectoryPath.Get(context); localSubDir = IncludeSubDir.Get(context); localSearch = FindDirectoryName.Get(context); this.Validate(); resultBytes = FindDirectorySize(new DirectoryInfo(localPath), localSubDir); if (resultBytes > 0) { resultMB = resultBytes / 1024; resultMB = resultMB / 1024; resultMB = System.Math.Round(resultMB, 2); } SizeBytes.Set(context, resultBytes); SizeMB.Set(context, resultMB); if (!string.IsNullOrEmpty(localOutPutPath)) { OutPutPath.Set(context, localOutPutPath); } } catch (Exception ex) { throw ex; } }
private void button2_Click(object sender, EventArgs e) { FolderBrowserDialog dlg = new FolderBrowserDialog(); if (dlg.ShowDialog() == DialogResult.OK) { mOutPath = dlg.SelectedPath.ToString(); OutPutPath.Clear(); OutPutPath.AppendText(mOutPath); } }