public override string GetItemDisplaySummaryInfo(int index) { if (index == 0) { return(""); } else { FtpEntryInfo info = internal_list.Keys[index - 1]; if (info.Directory) { return(string.Format ("Directory [{0}] [{1} {2}]", info.Permission, info.Timestamp.ToShortDateString(), info.Timestamp.ToShortTimeString())); } else { return(string.Format ("{0} [{1}] [{2} {3}]", IOhelper.SizeToString(info.Size), info.Permission, info.Timestamp.ToShortDateString(), info.Timestamp.ToShortTimeString())); } } }
public override string GetItemDisplaySummaryInfo(int index) { Process p = intern_list[index]; string total_cpu_time = string.Empty; try { total_cpu_time = p.TotalProcessorTime.ToString(); } catch (Exception) { total_cpu_time = "<Unknown>"; } string working_set = string.Empty; try { working_set = IOhelper.SizeToString(p.WorkingSet64); } catch (Exception) { working_set = "<Unknown>"; } return(string.Format ("PID:{0} [{1}] [{2}]", p.Id, total_cpu_time, working_set)); }
protected override void internal_command_proc() { QueryPanelInfoEventArgs e = new QueryPanelInfoEventArgs(); OnQueryCurrentPanel(e); if (!(e.ItemCollection is DirectoryList)) { return; } try { DirectoryList dl = (DirectoryList)e.ItemCollection; VolumeSpaceInfo info = WinAPiFSwrapper.GetVolumeSpaceInfo(dl.DirectoryPath); VolumeSpaceInfoDialog dialog = new VolumeSpaceInfoDialog(); dialog.textBoxTotalSize.Text = IOhelper.SizeToString(info.TotalNumberOfBytes); dialog.textBoxTotalAvailable.Text = IOhelper.SizeToString(info.FreeBytesAvailable); dialog.Text = dl.DirectoryPath; dialog.ShowDialog(); } catch (Exception ex) { Messages.ShowException(ex); } }
public override string GetSummaryInfo() { return (string.Format ("Total: {0} stream(s), {1}", internal_list.Count - 1, IOhelper.SizeToString(total_size))); }
public override string GetSummaryInfo() { return(string.Format ("[{0} folders] [{1} files] [{2}]", cache_directory_count, cache_files_count, IOhelper.SizeToString(cache_size))); }
public override string GetItemDisplaySummaryInfo(int index) { var name = internal_list.Keys[index]; if (name == "..") { return(Options.GetLiteral(Options.LANG_UP)); } var entry = zip_file.GetEntry(name); if (entry == null) { //try to get slash-ended entry entry = zip_file.GetEntry(name + "/"); if (entry == null) { //this is fake dir return("[" + Options.GetLiteral(Options.LANG_DIRECTORY) + "]"); } } var fa = FileAttributes.Normal; if (entry.IsDOSEntry) { try { fa = (FileAttributes)entry.ExternalFileAttributes; } catch (Exception) { } } if (entry.IsDirectory) { return(string.Format ("[" + Options.GetLiteral(Options.LANG_DIRECTORY) + "] [{0}] [{1} {2}]", IOhelper.FileAttributes2String(fa), entry.DateTime.ToShortDateString(), entry.DateTime.ToShortTimeString())); } else { return(string.Format ("{0} [{1}] [{2}] [{3} {4}]", IOhelper.SizeToString(entry.Size), IOhelper.SizeToString(entry.CompressedSize), IOhelper.FileAttributes2String(fa), entry.DateTime.ToShortDateString(), entry.DateTime.ToShortTimeString())); } }
public override string GetItemDisplaySummaryInfo(int index) { string_builder.Remove(0, string_builder.Length); if (internal_list.Keys[index].DeviceReady) { string_builder.Append(string.Format("[Total: {0}] [Available: {1}]", IOhelper.SizeToString(internal_list.Keys[index].VolumeSpaceInfo.TotalNumberOfBytes), IOhelper.SizeToString(internal_list.Keys[index].VolumeSpaceInfo.FreeBytesAvailable))); } return(string_builder.ToString()); }
public override string GetItemDisplaySummaryInfo(int index) { FileStreamInfo info = internal_list.Keys[index]; return (string.Format ("{0} [{1}] [{2}]", IOhelper.SizeToString(info.Size), IOhelper.FileStreamID2String(info.ID), IOhelper.FileStreamAttributes2String(info.Attributes))); }
public override string GetSummaryInfo(int[] indices) { ulong sel_size = 0UL; for (int i = 0; i < indices.Length; i++) { sel_size += internal_list.Keys[indices[i]].Size; } return (string.Format ("Selected {0} stream(s), {1}", indices.Length, IOhelper.SizeToString(sel_size))); }
public override string GetSummaryInfo(int[] indices) { if (indices.Length == 0) { return(GetSummaryInfo()); } else { var sel_size = 0L; var file_count = 0; var dir_count = 0; for (var i = 0; i < indices.Length; i++) { if (indices[i] > internal_list.Count) { continue; } sel_size += internal_list.Keys[indices[i] - 1].Size; if (internal_list.Keys[indices[i] - 1].Directory) { dir_count++; } else { file_count++; } } return(string.Format (Options.GetLiteral (Options.LANG_SELECTED) + ": {0} " + Options.GetLiteral(Options.LANG_DIRECTORIES) + " {1} " + Options.GetLiteral(Options.LANG_FILE_VOLUME_INFORMATION) + " {2}", dir_count, file_count, IOhelper.SizeToString(sel_size))); } }
public override string GetItemDisplaySummaryInfo(int index) { WIN32_FIND_DATA data = internal_list.Keys[index]; DateTime mod_time = DateTime.FromFileTime(data.ftLastWriteTime); if ((data.dwFileAttributes & FileAttributes.Directory) == FileAttributes.Directory) { return(string.Format ("[Directory] [{0}] [{1} {2}]", IOhelper.FileAttributes2String(data.dwFileAttributes), mod_time.ToShortDateString(), mod_time.ToShortTimeString())); } else { return(string.Format ("{0} [{1}] [{2} {3}]", IOhelper.SizeToString(data.FileSize), IOhelper.FileAttributes2String(data.dwFileAttributes), mod_time.ToShortDateString(), mod_time.ToShortTimeString())); } }
public override string GetSummaryInfo(int[] indices) { if (indices.Length == 0) { return(GetSummaryInfo()); } else { long sel_size = 0L; int file_count = 0; int dir_count = 0; for (int i = 0; i < indices.Length; i++) { if (indices[i] > internal_list.Count) { continue; } sel_size += internal_list.Keys[indices[i] - 1].Size; if (internal_list.Keys[indices[i] - 1].Directory) { dir_count++; } else { file_count++; } } return(string.Format ("Selected: {0} dir(s) {1} file(s) {2}", dir_count, file_count, IOhelper.SizeToString(sel_size))); } }
private void update_progress(UpdateProgressArgs e) { //will be invoke in UI thread - canot use anything else e and progress_dialog members switch (e.Reason) { case UpdateProgressReason.ChunkFinish: progress_dialog.SetProgress(e.TotalTransferred, e.TotalSize); progress_dialog.labelSpeed.Text = string.Format (Options.GetLiteral(Options.LANG_0_KBYTE_SEC), e.KBytesPerSec); progress_dialog.labelStatusTotal.Text = string.Format (Options.GetLiteral(Options.LANG_0_BYTES_TRANSFERRED), e.TotalTransferred); break; case UpdateProgressReason.JobBegin: progress_dialog.Text = Options.GetLiteral(Options.LANG_EXTRACT); break; case UpdateProgressReason.JobDone: progress_dialog.SetProgress(100, 100); progress_dialog.labelSpeed.Text = string.Format (Options.GetLiteral(Options.LANG_0_KBYTE_SEC), e.KBytesPerSec); break; case UpdateProgressReason.StreamSwitch: progress_dialog.labelStatus.Text = string.Format (Options.GetLiteral(Options.LANG_0_ARROW_1_2), e.SourceFile, e.DestinationFile, IOhelper.SizeToString(e.StreamSize)); progress_dialog.labelSpeed.Text = string.Format (Options.GetLiteral(Options.LANG_0_KBYTE_SEC), e.KBytesPerSec); break; } }
private void update_progress(UpdateProgressArgs e) { //will be invoke in UI thread - canot use anything else e and progress_dialog members switch (e.Reason) { case UpdateProgressReason.ChunkFinish: //progress_dialog.SetProgressStream(e.StreamTransferred, e.StreamSize); if (label_update_count > label_update_interval) { progress_dialog.labelSpeed.Text = string.Format(update_lit_0, e.KBytesPerSec); } if (e.EnableTotalProgress) { progress_dialog.SetProgress(e.TotalTransferred, e.TotalSize); if (label_update_count > label_update_interval) { progress_dialog.labelStatusTotal.Text = string.Format (update_lit_1, e.TotalTransferred, e.TotalSize, (e.TotalSize == 0) ? 0 : (double)e.TotalTransferred / (double)e.TotalSize); } } else { progress_dialog.SetProgress(e.StreamTransferred, e.StreamSize); if (label_update_count > label_update_interval) { progress_dialog.labelStatusTotal.Text = string.Format(update_lit_2, e.TotalTransferred); } } if (label_update_count > label_update_interval) { label_update_count = 0; } else { label_update_count += (e.StreamTransferred - stream_transferred_pre_chunk); } stream_transferred_pre_chunk = e.StreamTransferred; break; case UpdateProgressReason.JobBegin: label_update_count = 0; progress_dialog.Text = Options.GetLiteral(Options.LANG_COPY); break; case UpdateProgressReason.JobDone: label_update_count = 0; progress_dialog.SetProgress(100, 100); progress_dialog.labelSpeed.Text = string.Format(update_lit_0, e.KBytesPerSec); //if (e.EnableTotalProgress) //{ // progress_dialog.SetProgress(100, 100); //} progress_dialog.labelStatusTotal.Text = string.Format (Options.GetLiteral(Options.LANG_0_BYTES_FROM_1_FILES_TRANSFERRED), e.TotalTransferred, e.FilesCopied); break; case UpdateProgressReason.StreamSwitch: stream_transferred_pre_chunk = 0; label_update_count = 0; progress_dialog.labelStatus.Text = string.Format (update_lit_3, e.SourceFile, e.DestinationFile, IOhelper.SizeToString(e.StreamSize)); progress_dialog.labelSpeed.Text = string.Format(update_lit_0, e.KBytesPerSec); if (e.EnableTotalProgress) { progress_dialog.SetProgress(e.TotalTransferred, e.TotalSize); progress_dialog.labelStatusTotal.Text = string.Format (update_lit_1, e.TotalTransferred, e.TotalSize, (e.TotalSize == 0) ? 0 : (double)e.TotalTransferred / (double)e.TotalSize); } else { progress_dialog.labelStatusTotal.Text = string.Format(update_lit_2, e.TotalTransferred); } break; case UpdateProgressReason.TotalSizeCalculated: if (e.EnableTotalProgress) { progress_dialog.labelStatusTotal.Text = string.Format (update_lit_1, e.TotalTransferred, e.TotalSize, (e.TotalSize == 0) ? 0 : (double)e.TotalTransferred / (double)e.TotalSize); } break; } }
public override string GetSummaryInfo(int[] indices) { if (cache_selected_indices.Length != indices.Length) { //need refresh selection cache internal_refresh_selected_cache(indices); cache_selected_indices = indices; } else { //need check selection indices for (int i = 0; i < indices.Length; i++) { if (indices[i] != cache_selected_indices[i]) { //need refresh selection cache internal_refresh_selected_cache(indices); cache_selected_indices = indices; break; } } } //now selection cache must be valid return(string.Format("Selected: {0} folders, {1} files, {2}", cache_directory_selected_count, cache_files_selected_count, IOhelper.SizeToString(cache_size_selected))); }
public void Fill(Process p) { Text = p.ProcessName; textBoxProcessId.Text = p.Id.ToString(); textBoxProcessName.Text = p.ProcessName; try { textBoxProcessPriorityClass.Text = p.PriorityClass.ToString(); } catch (Exception ex) { errorProvider1.SetError(textBoxProcessPriorityClass, ex.Message); } try { textBoxProcessWindowTitle.Text = p.MainWindowTitle; } catch (Exception ex) { errorProvider1.SetError(textBoxProcessWindowTitle, ex.Message); } try { checkBoxProcessPriorityBoostEnable.Checked = p.PriorityBoostEnabled; } catch (Exception ex) { errorProvider1.SetError(checkBoxProcessPriorityBoostEnable, ex.Message); } try { checkBoxProcessResponding.Checked = p.Responding; } catch (Exception ex) { errorProvider1.SetError(checkBoxProcessResponding, ex.Message); } try { textBoxProcessMainModule.Text = p.MainModule.FileName; } catch (Exception ex) { errorProvider1.SetError(textBoxProcessMainModule, ex.Message); } try { textBoxProcessNonpagedSystemMemorySize.Text = IOhelper.SizeToString(p.NonpagedSystemMemorySize64); } catch (Exception ex) { errorProvider1.SetError(textBoxProcessNonpagedSystemMemorySize, ex.Message); } try { textBoxprocessorUserProcessorTime.Text = p.UserProcessorTime.ToString(); } catch (Exception ex) { errorProvider1.SetError(textBoxprocessorUserProcessorTime, ex.Message); } try { textBoxProcessPagedMemorySize.Text = IOhelper.SizeToString(p.PagedMemorySize64); } catch (Exception ex) { errorProvider1.SetError(textBoxProcessPagedMemorySize, ex.Message); } try { textBoxProcessPagedSystemMemorySize.Text = IOhelper.SizeToString(p.PagedSystemMemorySize64); } catch (Exception ex) { errorProvider1.SetError(textBoxProcessPagedSystemMemorySize, ex.Message); } try { textBoxProcessPrivateMemorySize.Text = IOhelper.SizeToString(p.PrivateMemorySize64); } catch (Exception ex) { errorProvider1.SetError(textBoxProcessPrivateMemorySize, ex.Message); } try { textBoxProcessPrivilegedProcessorTime.Text = p.PrivilegedProcessorTime.ToString(); } catch (Exception ex) { errorProvider1.SetError(textBoxProcessPrivilegedProcessorTime, ex.Message); } try { textBoxProcessStartTime.Text = p.StartTime.ToString(); } catch (Exception ex) { errorProvider1.SetError(textBoxProcessStartTime, ex.Message); } try { var time_from_start = DateTime.Now.Subtract(p.StartTime); var secs_from_start = time_from_start.TotalSeconds; var secs_cpu_time = p.TotalProcessorTime.TotalSeconds; var cpu_load = secs_cpu_time / secs_from_start; textBoxProcessTotalProcessorTime.Text = string.Format("{0} <{1:P4}>", p.TotalProcessorTime.ToString(), cpu_load); } catch (Exception ex) { errorProvider1.SetError(textBoxProcessTotalProcessorTime, ex.Message); } try { textBoxProcessVirtualMemorySize.Text = IOhelper.SizeToString(p.VirtualMemorySize64); } catch (Exception ex) { errorProvider1.SetError(textBoxProcessVirtualMemorySize, ex.Message); } try { textBoxProcessWorkingSet.Text = IOhelper.SizeToString(p.WorkingSet64); } catch (Exception ex) { errorProvider1.SetError(textBoxProcessWorkingSet, ex.Message); } try { var pmc = p.Modules; foreach (ProcessModule pm in pmc) { var lvi = new ListViewItem(); lvi.Text = pm.FileName; lvi.SubItems.Add(pm.FileVersionInfo.CompanyName); lvi.SubItems.Add(pm.FileVersionInfo.ProductName); lvi.SubItems.Add(pm.FileVersionInfo.ProductVersion); lvi.SubItems.Add(IOhelper.SizeToString((long)pm.ModuleMemorySize)); listViewModulesInfo.Items.Add(lvi); } listViewModulesInfo.Dock = DockStyle.Fill; } catch (Exception ex) { errorProvider1.SetError(listViewModulesInfo, ex.Message); } try { var ptc = p.Threads; foreach (ProcessThread pt in ptc) { var lvi = new ListViewItem(); try { lvi.Text = pt.Id.ToString(); var ts = pt.ThreadState; if (ts == ThreadState.Wait) { lvi.SubItems.Add(pt.ThreadState.ToString() + " " + pt.WaitReason.ToString()); } else { lvi.SubItems.Add(pt.ThreadState.ToString()); } if (pt.ThreadState != ThreadState.Terminated) { lvi.SubItems.Add(pt.PriorityLevel.ToString()); //load var total_secs = DateTime.Now.Subtract(pt.StartTime).TotalSeconds; var cpu_secs = pt.TotalProcessorTime.TotalSeconds; var cpu_load = cpu_secs / total_secs; lvi.SubItems.Add(string.Format("{0:P4}", cpu_load)); lvi.SubItems.Add(pt.StartTime.ToString()); lvi.SubItems.Add(pt.PrivilegedProcessorTime.ToString()); lvi.SubItems.Add(pt.UserProcessorTime.ToString()); } } catch (Exception ex_int) { lvi.SubItems.Add(ex_int.Message); } listViewThreadsInfo.Items.Add(lvi); } listViewThreadsInfo.Dock = DockStyle.Fill; } catch (Exception ex) { errorProvider1.SetError(listViewThreadsInfo, ex.Message); } }
private void update_progress(UpdateProgressArgs e) { //will be invoke in UI thread - canot use anything else e and progress_dialog members switch (e.Reason) { case UpdateProgressReason.ChunkFinish: progress_dialog.SetProgressStream(e.StreamTransferred, e.StreamSize); progress_dialog.labelSpeed.Text = string.Format("{0:N0} Kbyte/sec", e.KBytesPerSec); //progress_dialog.labelStatus.Text = // string.Format // ("'{0}' -> '{1}' ({2})", // e.SourceFile, // e.DestinationFile, // IOhelper.SizeToString(e.StreamSize)); if (e.EnableTotalProgress) { progress_dialog.SetProgressTotal(e.TotalTransferred, e.TotalSize); progress_dialog.labelStatusTotal.Text = string.Format ("{0:N0} bytes from {1:N0} ({2:P0}) transferred", e.TotalTransferred, e.TotalSize, (e.TotalSize == 0) ? 0 : (double)e.TotalTransferred / (double)e.TotalSize); } else { progress_dialog.labelStatusTotal.Text = string.Format("{0:N0} bytes transferred", e.TotalTransferred); } break; case UpdateProgressReason.JobBegin: progress_dialog.Text = "Copy"; start_tick = Environment.TickCount; break; case UpdateProgressReason.JobDone: progress_dialog.SetProgressStream(100, 100); progress_dialog.labelSpeed.Text = string.Format("{0:N0} Kbyte/sec", e.KBytesPerSec); if (e.EnableTotalProgress) { progress_dialog.SetProgressTotal(100, 100); } progress_dialog.labelStatusTotal.Text = string.Format ("{0:N0} bytes from {1:N0} file(s) transferred", e.TotalTransferred, e.FilesCopied); break; case UpdateProgressReason.StreamSwitch: progress_dialog.labelStatus.Text = string.Format ("'{0}' -> '{1}' ({2})", e.SourceFile, e.DestinationFile, IOhelper.SizeToString(e.StreamSize)); //progress_dialog.labelSpeed.Text = string.Format("{0:N0} Kbyte/sec", e.KBytesPerSec); if (e.EnableTotalProgress) { progress_dialog.SetProgressTotal(e.TotalTransferred, e.TotalSize); //progress_dialog.labelStatusTotal.Text = // string.Format // ("{0:N0} bytes from {1:N0} ({2:P0}) transferred", // e.TotalTransferred, // e.TotalSize, // (e.TotalSize == 0) ? 0 : (double)e.TotalTransferred / (double)e.TotalSize); } else { //progress_dialog.labelStatusTotal.Text = //string.Format("{0:N0} bytes transferred", e.TotalTransferred); } break; case UpdateProgressReason.TotalSizeCalculated: if (e.EnableTotalProgress) { progress_dialog.labelStatusTotal.Text = string.Format ("{0:N0} bytes from {1:N0} ({2:P0}) transferred", e.TotalTransferred, e.TotalSize, (e.TotalSize == 0) ? 0 : (double)e.TotalTransferred / (double)e.TotalSize); } break; } }