public string sizeScreenShoot() { string return_LogWebCam = ""; long FunMustRe_Key2 = 0; try { string dire = System.IO.Directory.GetCurrentDirectory(); DirectoryInfo dir = new DirectoryInfo(dire); FileInfo[] files = dir.GetFiles("*.png"); foreach (var item in files) { string[] items = item.ToString().Split('°'); if (items[4] == "Screenshoot") { string filepath = Path.GetFullPath(item.Name); FunMustRe_Key2 += new System.IO.FileInfo(filepath).Length; } } } catch { } if (FunMustRe_Key2 < 1024) { return_LogWebCam = FunMustRe_Key2.ToString() + " Bytes"; } else if (FunMustRe_Key2 >= 1024) { return_LogWebCam = (FunMustRe_Key2 / 1024).ToString() + " Kb"; } else if (FunMustRe_Key2 >= 1048576) { return_LogWebCam = (FunMustRe_Key2 / 1048576).ToString() + " Mb"; } return(return_LogWebCam); }
public string size_LogApp() { string return_LogApp = ""; long FunMustRe_Key2 = 0; try { string dire = System.IO.Directory.GetCurrentDirectory(); DirectoryInfo dir = new DirectoryInfo(dire); FileInfo[] files = dir.GetFiles("*.txt"); foreach (var item in files) { if (item.ToString() == "logApp.txt") { string filepath = Path.GetFullPath(item.Name); FunMustRe_Key2 = new System.IO.FileInfo(filepath).Length; } } } catch { } if (FunMustRe_Key2 < 1024) { return_LogApp = FunMustRe_Key2.ToString() + " Bytes"; } else if (FunMustRe_Key2 >= 1024) { return_LogApp = (FunMustRe_Key2 / 1024).ToString() + " Kb"; } else if (FunMustRe_Key2 >= 1048576) { return_LogApp = (FunMustRe_Key2 / 1048576).ToString() + " Mb"; } return(return_LogApp); }