118
BoostUp Utilities DEVELOPER JAYDEEP H. ADESARA (BCA 6 TH SEMESTER) DEVELOPED AT R. P. BHALODIA COLLEGE GUIDED BY MR. RAVIRAJ VAGHELA SUBMITTED AT SAURASHTRA UNIVERSITY BoostUp Utilities A Project Report On

BoostUp Utilities

Embed Size (px)

DESCRIPTION

This is a system software that maintains your system and increases performance of system

Citation preview

Page 1: BoostUp Utilities

BoostUp Utilities

DEVELOPER JAYDEEP H. ADESARA (BCA 6TH SEMESTER)

DEVELOPED AT R. P. BHALODIA COLLEGE

GUIDED BY MR. RAVIRAJ VAGHELA

SUBMITTED AT SAURASHTRA UNIVERSITY

BoostUp Utilities

A Project Report

On

Page 2: BoostUp Utilities

BoostUp Utilities

Preface

The practical training is almost important in understanding theoretical aspect. Viewing to this is importance. I have prepared this project report to enrich our knowledge regarding software management system in our practical work. I have selected project with respect to “BoostUp Utilities” including all the details related to system and increasing performance of user system.

By making this project I find that the need of practical training. In the computer field is “Without practical, theory is meaningless”. It is easier to work with computerized system then manual system. I find that making software is helpful for user in saving their time, effort and space and also increase the efficiency by creating interest .

The utility of computer in the every field can hardly be overemphasized in the era of stiff competition and rapid industrialization. This essentially entails the need of most qualified in addition, skilled manpower in the field of computer.

In this project I have cover maximum points of related to system maintenance & performance. I have implemented a very simple and most efficient method for managing End-User system.

This project is developed in Microsoft Visual C# 2008 and Windows Presentation Foundation (WPF) by its’ various functionality.

This software is quite easy in operating so that any End-User is able to handles it nicely.

Your co-operation in form of suggestions and comments are most welcome, to improve my knowledge and project.

It is very important for us to know how to make project documentation so that it contains all important aspects of real system.

-- AAddeessaarraa JJaayyddeeeepp HH..

Page 3: BoostUp Utilities

BoostUp Utilities

Acknowledgement

An understanding of the study like this never outcome of the efforts of a

single person, rather it bears the imprint of number of persons who directly or indirectly helped me in completing the present study. I would be failing in my duty if I don’t say a word of thanks to all those whose sincere advice made this documentation of my project a real educative, effective & pleasurable one. It is a matter of great pleasure of mine to get this opportunity expressing my deep and sincere of gratitude to all for giving me precious guidance, inspiration and great support while developing the project.

I thankful to our reserved and learned Mr.shailesh M. Jani (Director) & Mr. Brijesh Shah (H.O.D.), whose inspiration, guidance and generous support gave me sufficient strength to prepare the project. During the long period it looks to complete it is with profound feeling of gratitude, I place on record my extreme indebtedness to them for providing me technical input in the form of manuscript, books and study material and influencing my thinking. I acknowledge the kind assistance and encouragement extended by them for giving information and clarifying doubts.

Once again I wish to acknowledge my gratitude to Mr. Vyanktesh Raval (Project Guide) and all college faculties for their kind consent for this project. I am having immense pleasure in expressing my wholehearted gratitude for providing help & guidance of project. The token of “Thanks” can’t appreciate of project valuable contribution and assistance provides by these wonderful people by this token gesture is least I can do. I am also thankful to my best friends especially for their moral and confidential support and well wishers whom due to those wish my dream come true in form of project.

Finally I express our thanks to department of library for providing us various books and information on many topics that were necessary for our project.

Page 4: BoostUp Utilities

BoostUp Utilities

Project Profile

Project Title: BoostUp Utilities.

Prepared By: Jaydeep H. Adesara.

Tools Used:

Front-End Technology: Microsoft Visual C# 2008. WPF (Windows Presentation Foundation).

Graphics:

Adobe Photoshop CS4. Developer Experience.

Documentation: Microsoft Word 2007.

Help File: WinCHM 4.15.

Duration of Project: 125 days.

Developed At: R. P. Bhalodia College.

Project Guide: Mr. Raviraj Vaghela.

Submitted At: Saurashtra University.

Page 5: BoostUp Utilities

BoostUp Utilities

Project Overview

Introduction :- The BoostUp Utilities is system software which is developed in C# that maintains your computers and checks each and every process performance. It provides rich GUI environment with user friendly features.

BoostUp Utilities is easier and user-friendly, providing central access to all functions. The main aim behind developing BoostUp Utilities is to increase system performance, check performance and remove unnecessary files from the system. User can easily scan any logical or removable drive.

Functionality:- 1. Cleaner

It removes unnecessary files and improves your system performance. Gain Disk Space :-

It scans and also clears unnecessary files from your computer’s logical drive or removable media or from multiple folder (i.e. *.tmp,*.bak, *.chk, *.??~ etc.). You can also scan particular folder or drive in right click of windows context menu.

Shortcut Cleaner :- It scans unusable short cuts (whose target path is not available) from logical

drive or removable drive or specified multiple folder. You can also scan and clear unusable short cuts from particular folder or drive in right click of windows context menu.

Page 6: BoostUp Utilities

BoostUp Utilities

2. Manager It manages system as per requirements.

Process Manager :- It gives performance of each process in detailed with a bar chart. It displays

all module names which are used by running process. You can also set process manager as your default Task Manger (Ctrl + Alt + Del).

Startup Manager :- It helps you to manage startup programs of system. Here you can add,

remove, turn off, and turn on startup programs easily.

Mass Storage Manager :- It manages removable media (USB pen drive) attached in your system. It

gives description of hidden files, archive files, system files, and temporary files in grouping. You can also rename, format and eject the removable media.

3. Advanced It provides extra utilities suited for your system.

File Integrator :- Helps you to create your own extensions with specified icons and

application path. You can also view or remove available extension.

System Information :- Shows the system information of your system like BIOS, Memory, Computer,

Hardware, Logical Drives etc.

Advanced Features :- Provides advanced functionality of windows as follows,

o Enable/Disable - USB Drives - Registry Editor - Folder Option - Task Manager

o Hide/Unhide - Logical Drives - Removable Drives

o Monitor - Turnoff Monitor - Set Brightness

o Color Picker and Magnifier

Page 7: BoostUp Utilities

BoostUp Utilities

Project Diagram

Main Form

Cleaner

Gain Disk Space

Shortcut Cleaner

Manager

Process Manager

Mass Storage Manager

StartUp Manager

Advanced

File Integrator System Information

Advanced Features

Page 8: BoostUp Utilities

BoostUp Utilities

Hardware & Software Requirement

Main Configuration :

CPU: Intel Pentium 2.79 GHz

RAM : 2 GB

Hard disk : 160 GB

Monitor : 15” with 256+color at 1024*768 Resolution

Minimum Configuration :

CPU: Intel Pentium

RAM : 512 MB or more

Hard disk : 20 GB recommended

Monitor : 15” (1024*768 resolution required)

Software Specification :

Microsoft .Net Framework 3.5

Operating System Windows XP, Windows Vista, Windows 7 (32 bit)

Page 9: BoostUp Utilities

BoostUp Utilities

About Microsoft Visual C# 2008

Introduction :

C# is a multi-paradigm programming language encompassing imperative, declarative, functional, generic, object-oriented (class-based), and component-oriented programming disciplines. It was introduced in 2001 and developed by Microsoft within the .NET initiative and later approved as a standard by ECMA and ISO. C# is one of the programming languages designed for the Common Language Infrastructure. C# is intended to be a simple, modern, general-purpose, object-oriented programming language. The most recent version is C# 4.0, which was released on April 12, 2010.

Design Goals:

C# language is intended to be a simple, modern, general-purpose, object-oriented programming language.

The language is intended for use in developing software components suitable for deployment in distributed environments.

Source code portability is very important, as is programmer portability, especially for those programmers already familiar with C and C++.

C# is intended to be suitable for writing applications for both hosted and embedded systems, ranging from the very large that use sophisticated operating systems, down to the very small having dedicated functions.

Page 10: BoostUp Utilities

BoostUp Utilities Features:

There are no global variables or functions. All methods and members must be declared within classes. Static members of public classes can substitute for global variables and functions.

Local variables cannot shadow variables of the enclosing block, unlike C and C++. Variable shadowing is often considered confusing by C++ texts.

C# supports a strict Boolean data type, bool. Statements that take conditions, such as while and if, require an expression of a type that implements the true operator, such as the Boolean type.

In addition to the try...catch construct to handle exceptions, C# has a try...finally construct to guarantee execution of the code in the finally block.

In C#, memory address pointers can only be used within blocks specifically marked as unsafe, and programs with unsafe code need appropriate permissions to run.

Managed memory cannot be explicitly freed; instead, it is automatically garbage collected. Garbage collection addresses the problem of memory leaks by freeing the programmer of responsibility for releasing memory which is no longer needed.

Multiple inheritances are not supported, although a class can implement any number of interfaces. This was a design decision by the language's lead architect to avoid complication and simplify architectural requirements throughout CLI.

Enumeration members are placed in their own scope.

C# provides properties as syntactic sugar for a common pattern in which a pair of methods encapsulates operations on a single attribute of a class.

C# currently (as of version 4.0) has 77 reserved words.

Checked exceptions are not present in C#. This has been a conscious decision based on the issues of scalability and version ability.

Page 11: BoostUp Utilities

BoostUp Utilities Common Type System (CTS):

C# has a unified type system. This unified type system is called Common Type System (CTS).

A unified type system implies that all types, including primitives such as integers, are subclasses of the System.Object class. For example, every type inherits a ToString() method. For performance reasons, primitive types (and value types in general) are internally allocated on the stack.

CTS separate data types into two categories:

1. Value types 2. Reference types

Page 12: BoostUp Utilities

BoostUp Utilities

About Windows Presentation Foundation (WPF)

Developed by Microsoft, the Windows Presentation Foundation (or WPF) is a graphical subsystem for rendering user interfaces in Windows-based applications. WPF, previously known as "Avalon", was initially released as part of .NET Framework 3.0. Rather than relying on the older GDI subsystem, WPF utilizes DirectX. WPF attempts to provide a consistent programming model for building applications and provides a separation between the user interface and the business logic. It has resemblance to similar XML-oriented object models, such as those implemented in XUL and SVG.

WPF employs XAML, a derivative of XML, to define and link various UI elements. WPF applications can also be deployed as standalone desktop programs, or hosted as an embedded object in a website. It aims to unify a number of common user interface elements, such as 2D/3D rendering, fixed and adaptive documents, typography, vector graphics, runtime animation, and pre-rendered media. These elements can then be linked and manipulated based on various events, user interactions, and data bindings.

WPF runtime libraries are included with all versions of Windows since Windows Vista and Windows Server 2008. Users of Windows XP SP2/SP3 and Windows Server 2003 can optionally install the necessary libraries.

WPF has released 4 major versions to date: WPF 3.0 (Nov 2006), WPF 3.5 (Nov 2007), WPF 3.5sp1 (Aug 2008), and WPF 4 (April 2010).

Microsoft Silver light utilizes WPF to provide embedded web controls comparable to Adobe Flash, but with more focus on a UI object model and less on animation. 3D runtime rendering is unsupported in Silver light, but available to embedded WPF applications.

Page 13: BoostUp Utilities

BoostUp Utilities Features:

Direct3D

Graphics, including desktop items like windows, are rendered using Direct3D. This provides an avenue for displaying more complex graphics and custom themes, at the cost of GDI's wider range of support and uniform control theme. It allows Windows to offload some graphics tasks to the GPU. This reduces the workload on the computer's CPU. GPUs are optimized for parallel pixel computations.

Data binding WPF has a built-in set of data services to enable application developers to

bind and manipulate data within applications. There exists support for three types of data binding (One time, One Way, Two Ways).

LINQ queries, including LINQ to XML, can also act as data sources for data binding.

Binding of data has no bearing on its presentation. WPF provides data templates to control presentation of data.

A set of built-in controls is provided as part of WPF, containing items such as button, menu, grids, and list box.

Animations

WPF supports time-based animations, in contrast to the frame-based

approach. WPF supports low level animation via timers and higher level abstractions

of animations via the Animation classes. Any WPF element property can be animated as long as it is registered as a

Dependency Property. Animations can be grouped into Storyboards. Storyboards are the primary way to start, stop, pause and otherwise

manipulate the animations. Animations can be triggered by external events, including user action. Presentation timers are initialized and managed by WPF. Animation effects can be defined on a per-object basis, which can be

accessed directly from XAML markup.

Page 14: BoostUp Utilities

BoostUp Utilities

Screen Shots Home

Page 15: BoostUp Utilities

BoostUp Utilities

Screen Shots About Software

Page 16: BoostUp Utilities

BoostUp Utilities

Screen Shots

Contact Us

Page 17: BoostUp Utilities

BoostUp Utilities

Screen Shots Cleaner Group

It removes unnecessary files and gives best performance to your

system.

Page 18: BoostUp Utilities

BoostUp Utilities

Screen Shots Gain Disk Space

Scan Drive or any folder with BoostUp Gain Disk Space in right click

of windows context menu.

Page 19: BoostUp Utilities

BoostUp Utilities

Screen Shots Gain Disk Space

It scans and also clears unnecessary files from your computer’s logical

drive or removable media or from multiple folder (i.e. *.tmp,*.bak, *.chk, *.??~ etc.).

Page 20: BoostUp Utilities

BoostUp Utilities

Screen Shots Gain Disk Space

You can also scan particular folder or drive in right click of windows

context menu.

Page 21: BoostUp Utilities

BoostUp Utilities

Screen Shots Shortcut Cleaner

Scan broken shortcuts with BoostUp Shortcut Cleaner in right click of

windows context menu.

Page 22: BoostUp Utilities

BoostUp Utilities

Screen Shots Shortcut Cleaner

It scans unusable short cuts (whose target path is not available) from

logical drive or removable drive or specified multiple folder.

Page 23: BoostUp Utilities

BoostUp Utilities

Screen Shots Shortcut Cleaner

You can also scan and clear unusable short cuts from particular folder

or drive in right click of windows context menu.

Page 24: BoostUp Utilities

BoostUp Utilities

Screen Shots Manager Group

It manages our system according to your requirements.

Page 25: BoostUp Utilities

BoostUp Utilities

Screen Shots Process Manager

Shows current running process running in windows taskbar.

Page 26: BoostUp Utilities

BoostUp Utilities

Screen Shots Process Manager

Shows currently running process behind windows operation system.

Page 27: BoostUp Utilities

BoostUp Utilities

Screen Shots Process Manager

Shows all the running modules behind Windows Operating System.

Page 28: BoostUp Utilities

BoostUp Utilities

Screen Shots Process Manager

Gives graphical representation of running process as well as CPU

usage and page file (PF) usage.

Page 29: BoostUp Utilities

BoostUp Utilities

Screen Shots StartUp Manager

It helps you to manage startup programs of system. Here you can

add, remove, turn off, and turn on startup programs easily.

Page 30: BoostUp Utilities

BoostUp Utilities

Screen Shots Mass Storage Manager

It manages removable media (USB pen drive) attached in your system.

It gives description of hidden files, archive files, system files, and temporary files in grouping. You can also rename, format and eject the removable media.

Page 31: BoostUp Utilities

BoostUp Utilities

Screen Shots Mass Storage Manager

Page 32: BoostUp Utilities

BoostUp Utilities

Screen Shots Advanced Group

It provides extra utilities suited for your system.

Page 33: BoostUp Utilities

BoostUp Utilities

Screen Shots File Integrator

It helps you to create your own extensions with specified icons.

Page 34: BoostUp Utilities

BoostUp Utilities

Screen Shots File Integrator

You can also view or remove available extension.

Page 35: BoostUp Utilities

BoostUp Utilities

Screen Shots System Information

Shows overview of the system and gives advanced information of the

system.

Page 36: BoostUp Utilities

BoostUp Utilities

Screen Shots System Information

Shows information related to windows operating system.

Page 37: BoostUp Utilities

BoostUp Utilities

Screen Shots System Information

Shows graphical representation of running process in 3d Pie chart.

Page 38: BoostUp Utilities

BoostUp Utilities

Screen Shots System Information

Shows information related to CPU, Motherboard and Bios.

Page 39: BoostUp Utilities

BoostUp Utilities

Screen Shots System Information

Shows graphical representation of logical drives in 3d Pie chart.

Page 40: BoostUp Utilities

BoostUp Utilities

Screen Shots Advanced Features

Provides advanced functionality for the user.

Page 41: BoostUp Utilities

BoostUp Utilities

Coding Gain Disk Space

using System.IO; namespace GainDiskSpace { public partial class FrmGainDiskSpace : DevExpress.XtraBars.Ribbon.RibbonForm { private ListViewSorter.ListViewColumnSorter lvwColumnSorter = null; TotalMemoryClass ObjTotalMemory = new TotalMemoryClass(); string[] DriveNames, FileTypes,DeleteFile; ArrayList ListOfFiles = new ArrayList(); Hashtable FileTypeTable = new Hashtable(); static string[] FileExtention; bool IsScanRunning = false; long TotalMemory; bool IsDeleteSelected=false; bool IsFromCmdLine=false; string[] CommandArgs; string[] AllArgs; string TmpFileName = ""; string OccupiedMemory; public FrmGainDiskSpace() { InitializeComponent(); myInitializeComponent(); TotalMemory = 0; } private void myInitializeComponent() { lvwColumnSorter = new ListViewSorter.ListViewColumnSorter(); this.ListFiles.ListViewItemSorter = lvwColumnSorter; this.ListFiles.Sorting = SortOrder.Ascending; this.ListFiles.AutoArrange = true; } private void Form1_Load(object sender, EventArgs e) { this.Visible = false; AllArgs=Environment.GetCommandLineArgs(); FileExtention = new string[20]; CheckForIllegalCrossThreadCalls = false; FileExtention[0] = ".tmp"; FileExtention[1] = ".bak"; FileExtention[2] = "*.~*"; FileExtention[3] = "0???????.nch"; FileExtention[4] = "*.??~"; FileExtention[5] = ".chk"; FileExtention[6] = "chklist.*"; FileExtention[7] = ".ftg"; FileExtention[8] = ".fts"; FileExtention[9] = ".gid"; FileExtention[10] = "*._mp"; FileExtention[11] = ".syd"; FileExtention[12] = ".wdk"; FileExtention[13] = ".xlk";

Page 42: BoostUp Utilities

BoostUp Utilities FileExtention[14] = "*.cdr_"; FileExtention[15] = "*.#Res"; FileExtention[16] = ".@@@"; FileExtention[17] = ".---"; FileExtention[18] = "mscreate.dir"; } public string GetFileType(string Extention) { Microsoft.Win32.RegistryKey tmp = Microsoft.Win32.Registry.ClassesRoot; string default_string = ""; string file_type = ""; try { default_string = tmp.GetValue(null).ToString(); } catch { } tmp = tmp.OpenSubKey(Extention); tmp = Microsoft.Win32.Registry.ClassesRoot; tmp = tmp.OpenSubKey(default_string); try { file_type = tmp.GetValue(null).ToString(); } catch { return "Unknown File Type"; } return file_type; } private void BtnDeleteAll_Click(object sender, EventArgs e) { if (ListFiles.Items.Count != 0) { if (DevExpress.XtraEditors.XtraMessageBox.Show("Do you really want to delete all the files from your system ?", "Gain Disk Space : Delete All", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { CheckUncheck(true); DeleteFile = new string[ListFiles.Items.Count]; for (int i = 0; i < ListFiles.Items.Count; i++) DeleteFile[i] = ListFiles.Items[i].SubItems[1].Text + "\\" + ListFiles.Items[i].SubItems[0].Text; BackgroundDelete.RunWorkerAsync(); } } else DevExpress.XtraEditors.XtraMessageBox.Show("There are no any file(s) to delete", "Gain Disk Space : Delete", MessageBoxButtons.OK, MessageBoxIcon.Information); } private void backgroundWorker2_DoWork(object sender, DoWorkEventArgs e) { ProgressBarDelete.Visible = true; int counter=0; bool flg = false; int cant_delete = 0; ArrayList cant_delete_list = new ArrayList(); if (DeleteFile.Length >= 101) { counter = 100 / DeleteFile.Length; } for (int i = 0; i < DeleteFile.Length; i++) { ProgressBarDelete.Position += counter; ListOfFiles.Remove(DeleteFile[i]); try { File.Delete(DeleteFile[i]); } catch { flg = true; cant_delete++; cant_delete_list.Add(DeleteFile[i]); } } ProgressBarDelete.Position = 100; ProgressBarDelete.Visible = false; StatusText.Caption =DeleteFile.Length.ToString()+ " File(s) Deleted successfully";

Page 43: BoostUp Utilities

BoostUp Utilities if (flg) DevExpress.XtraEditors.XtraMessageBox.Show(cant_delete.ToString() + " file(s) could not be deleted due to restriction", "Gain Disk Space : Delete", MessageBoxButtons.OK, MessageBoxIcon.Information); if (!IsDeleteSelected) { ListFiles.Items.Clear(); LblHeader.Text = "Select drive to scan"; } else { long tmp_totalmemory; string s; string[] tmp_s; for (int i = 0; i < ListFiles.Items.Count; i++) { if (ListFiles.Items[i].Checked && CantFileContains(cant_delete_list, ListFiles.Items[i].Text) != true) { s = ListFiles.Items[i].SubItems[2].Text; tmp_s = s.Split('K'); tmp_totalmemory=long.Parse(tmp_s[0]); tmp_totalmemory=long.Parse( ObjTotalMemory.TotalMemory)-tmp_totalmemory; ObjTotalMemory.TotalMemory = tmp_totalmemory.ToString(); ListFiles.Items[i].Remove(); i--; } } ListOfFiles.Clear(); for (int i = 0; i < ListFiles.Items.Count; i++) ListOfFiles.Add(ListFiles.Items[i]); LblHeader.Text = "Please select the files you wish to delete. You can delete a total of " + ListFiles.Items.Count.ToString() + " files, which occupy " + ObjTotalMemory.TotalMemory.ToString() + " KB of space on your system."; } if(flg) { if(!IsDeleteSelected) { FileInfo FI; string FullFileName; string[] s = new string[4]; double tmp_d = 0.0; for (int i = 0; i < cant_delete_list.Count; i++) { FullFileName = cant_delete_list[i].ToString(); FI = new FileInfo(FullFileName); s[0] = Path.GetFileName(FullFileName); s[1] = GetParent(FullFileName); tmp_d = FI.Length / 1024; tmp_d = (tmp_d == 0) ? (Math.Round((double)FI.Length / 1024, 3)) : (FI.Length / 1024); tmp_d = (tmp_d > 0 && tmp_d < 1) ? 1 : tmp_d; s[2] = tmp_d.ToString() + " KB"; TotalMemory += (long)tmp_d; ObjTotalMemory.TotalMemory = TotalMemory.ToString(); s[3] = (Path.GetExtension(FullFileName).TrimStart('.')).ToUpper() + " File"; ListFiles.Items.Add(new ListViewItem(s)); } } } AfterScan(); RemoveLabelValue(); }

Page 44: BoostUp Utilities

BoostUp Utilities private bool CantFileContains(ArrayList arr, string str) { bool flg=false; string s = ""; for (int i = 0; i < arr.Count; i++) { s=Path.GetFileName( arr[i].ToString()); if (str == s) { flg = true; break; } } if (flg) return true; else return false; } private void RemoveLabelValue() { LblCreatedOn.Text = ""; LblFileNm.Text = ""; LblFileSize.Text = ""; LblFileType.Text = ""; LblLastAccess.Text = ""; LblModifiedOn.Text = ""; } private void ListFiles_SelectedIndexChanged(object sender, EventArgs e) { if (ListFiles.SelectedItems.Count != 0) { GrpFileProperty.Enabled = true; string FileName = ListFiles.SelectedItems[0].SubItems[0].Text; string FilePath = ListFiles.SelectedItems[0].SubItems[1].Text; LblFileNm.Text = FileName; LblFileSize.Text = ListFiles.SelectedItems[0].SubItems[2].Text; LblFileType.Text = ListFiles.SelectedItems[0].SubItems[3].Text; FileInfo tmp_info = new FileInfo(FilePath + "\\" + FileName); LblCreatedOn.Text = tmp_info.CreationTime.ToString(); LblModifiedOn.Text = tmp_info.LastWriteTime.ToString(); LblLastAccess.Text = tmp_info.LastAccessTime.ToString(); } } private void HyperOpenFile_OpenLink(object sender, DevExpress.XtraEditors.Controls.OpenLinkEventArgs e) { if (ListFiles.SelectedItems.Count != 0) { string FileName = ""; string FilePath = ""; for (int i = 0; i < ListFiles.SelectedItems.Count; i++) { FileName = ListFiles.SelectedItems[i].SubItems[0].Text; FilePath = ListFiles.SelectedItems[i].SubItems[1].Text; SelectDestination(FilePath + "\\" + FileName); } ListFiles.Focus(); } } public void SelectDestination(String AbsolutePath) { System.Diagnostics.Process.Start("explorer.exe", "/select," + AbsolutePath); }

Page 45: BoostUp Utilities

BoostUp Utilities private void HyperProperty_OpenLink(object sender, DevExpress.XtraEditors.Controls.OpenLinkEventArgs e) { if (ListFiles.SelectedItems.Count != 0) { string FileName = ""; string FilePath = ""; for (int i = 0; i < ListFiles.SelectedItems.Count; i++) { FileName = ListFiles.SelectedItems[i].SubItems[0].Text; FilePath = ListFiles.SelectedItems[i].SubItems[1].Text; RJM.FileSystemInfo.PropertyWindow.Show(FilePath + "\\" + FileName); } ListFiles.Focus(); } } private void BtnScan_Click(object sender, EventArgs e) { if (BtnScan.Text == "Stop Scan") { BackgroundTime.CancelAsync(); BtnScan.Text = "Canceling..."; BtnScan.Enabled = false; BackgroundThread.CancelAsync(); } else { if (IsFromCmdLine) { FrmCmdLineScan tmp = new FrmCmdLineScan(); if (tmp.ShowDialog() == DialogResult.OK) { if (ListFiles.Items.Count != 0) { GrpCheckUncheck.Enabled = false; GrpFileProperty.Enabled = false; LblHeader.Text = "Select drive to scan"; StatusText.Caption = "Done !!!"; StatusTime.Caption = "Elapsed Time : 00:00:00"; } if (tmp.FileTypes.Length != 0) { BackgroundTime.RunWorkerAsync(); BeforeScan(CommandArgs, tmp.FileTypes); } } } else { FrmScanOption tmp = new FrmScanOption(); if (tmp.ShowDialog() == DialogResult.OK) { if (ListFiles.Items.Count != 0) { GrpCheckUncheck.Enabled = false; GrpFileProperty.Enabled = false; LblHeader.Text = "Select drive to scan"; StatusText.Caption = "Done !!!"; StatusTime.Caption = "Elapsed Time : 00:00:00"; ListFiles.Items.Clear(); }

Page 46: BoostUp Utilities

BoostUp Utilities if (tmp.DriveNames.Length != 0 && tmp.FileTypes.Length != 0) { BackgroundTime.RunWorkerAsync(); BeforeScan(tmp.DriveNames, tmp.FileTypes); } } } } } private void BeforeScan(string[] FullPath,string[]FileTypes) { BtnScan.Text = "Stop Scan"; BtnDeleteAll.Enabled = false; BtnDelSelected.Enabled = false; LblHeader.Text = "Scan Started..."; DriveNames = FullPath; this.FileTypes = FileTypes; CheckForIllegalCrossThreadCalls = false; ListFiles.Items.Clear(); BackgroundThread.Dispose(); BackgroundThread.RunWorkerAsync(); } private void AfterScan() { BackgroundTime.CancelAsync(); try { BtnScan.Text = "&Scan"; BtnScan.Enabled = true; BtnScan.Focus(); } catch { } int TotalFile = ListFiles.Items.Count; OccupiedMemory = GetFormatedValue(decimal.Parse(ObjTotalMemory.TotalMemory)); if (ListFiles.Items.Count != 0) { long a = TotalMemory; GrpCheckUncheck.Enabled = true; GrpFileProperty.Enabled = true; LblHeader.Text = "Please select the files you wish to delete. You can delete a total of " + TotalFile.ToString() + " files, which occupy " +OccupiedMemory +" of space on your system."; BtnDelSelected.Enabled = true; BtnDeleteAll.Enabled = true; } else { LblHeader.Text = "Select drive to scan"; GrpCheckUncheck.Enabled = false; GrpFileProperty.Enabled = false; } IsFromCmdLine = false; IsScanRunning = true; CheckUncheck(true); IsScanRunning = false; CheckedStatus(); NotifyGainDiskSpace.BalloonTipTitle = "Gain Disk Space"; NotifyGainDiskSpace.BalloonTipText = "Scan Completed. Found " + TotalFile + " Files of " + OccupiedMemory; NotifyGainDiskSpace.ShowBalloonTip(1000); ListFiles.Focus(); } private void CheckedStatus() { int count = 0; string[] s = new string[2];

Page 47: BoostUp Utilities

BoostUp Utilities for (int i = 0; i < ListFiles.Items.Count; i++) { if (ListFiles.Items[i].Checked) { s = ListFiles.Items[i].SubItems[2].Text.Split('K'); count += Int32.Parse(s[0]); } } if (!IsScanRunning) if (ListFiles.Items.Count != 0) StatusText.Caption = "Checked " + ListFiles.CheckedItems.Count.ToString() + " files of size " + GetFormatedValue((decimal)count); else StatusText.Caption = "Done !!!"; } private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e) { IsScanRunning = true; GrpCheckUncheck.Enabled = false; GrpFileProperty.Enabled = false; ListFiles.Items.Clear(); AddFilesIntoListBox(e); IsScanRunning = false; AfterScan(); } public void AddFilesIntoListBox(DoWorkEventArgs e) { ArrayList a = new ArrayList(); FrmScanOption FrmScan=new FrmScanOption(); string Tmp_Extention; string FullFileName; string OnlyFileName; FileInfo FI; string[] s = new string[4]; bool Flg = false; foreach (string DName in DriveNames) { StatusText.Caption = "Loading " + DName + " ..."; ListOfFiles.Clear(); TmpGetFiles(DName, "*.*"); double tmp_d=0.0; Flg = false; for (double j = 0; j < ListOfFiles.Count; j++) { if (BackgroundThread.CancellationPending) { e.Cancel = true; break; } if (IsScanRunning) { FullFileName = ListOfFiles[(int)j].ToString(); OnlyFileName = Path.GetFileName(FullFileName); Tmp_Extention = Path.GetExtension(OnlyFileName); try { if (Tmp_Extention != "") { if (ExtContains(Tmp_Extention)) { Flg=true; }

Page 48: BoostUp Utilities

BoostUp Utilities if (Flg == false) { if (Tmp_Extention.Substring(1, 1) == "~" && ExtContains("*.~*")) Flg = true; else if (OnlyFileName.Substring(0, 1) == "~" && ExtContains("~*.*")) Flg = true; if (OnlyFileName == "chklist" && ExtContains("chklist.*")) Flg = true; else if (FullFileName == "mscreate.dir" && ExtContains("mscreate.dir")) Flg = true; else if (Tmp_Extention.Substring(3, 1) == "~" && ExtContains("*.??~")) Flg = true; } if(Flg==true) { FI = new FileInfo(FullFileName); s[0] = Path.GetFileName(FullFileName); s[1] = GetParent(FullFileName); tmp_d = FI.Length / 1024; tmp_d = (tmp_d == 0) ? (Math.Round((double)FI.Length / 1024, 3)) : (FI.Length / 1024); tmp_d = (tmp_d > 0 && tmp_d < 1) ? 1 : tmp_d; s[2] = tmp_d.ToString() + " KB"; TotalMemory += (long)tmp_d; ObjTotalMemory.TotalMemory = TotalMemory.ToString(); s[3] = (Path.GetExtension(FullFileName).TrimStart('.')).ToUpper() + " File"; ListFiles.Items.Add(new ListViewItem(s)); StatusText.Caption = FullFileName; Flg = false; } } } catch { } } } } CheckUncheckListBox(true); IsScanRunning = false; } private void CheckFile(string OriginalFileName) { ArrayList a = new ArrayList(); FrmScanOption FrmScan = new FrmScanOption(); string Tmp_Extention; string FullFileName; string OnlyFileName; FileInfo FI; string[] s = new string[4]; bool Flg = false; double tmp_d = 0.0; Flg = false; if (IsScanRunning) { FullFileName = OriginalFileName; OnlyFileName = Path.GetFileName(FullFileName); Tmp_Extention = Path.GetExtension(OnlyFileName);

Page 49: BoostUp Utilities

BoostUp Utilities try { if (Tmp_Extention != "") { if (ExtContains(Tmp_Extention)) { Flg = true; } if (Flg == false) { if (Tmp_Extention.Substring(1, 1) == "~" && ExtContains("*.~*")) Flg = true; else if (OnlyFileName.Substring(0, 1) == "~" && ExtContains("~*.*")) Flg = true; if (OnlyFileName == "chklist" && ExtContains("chklist.*")) Flg = true; else if (FullFileName == "mscreate.dir" && ExtContains("mscreate.dir")) Flg = true; else if (Tmp_Extention.Substring(3, 1) == "~" && ExtContains("*.??~")) Flg = true; } if (Flg == true) { FI = new FileInfo(FullFileName); s[0] = Path.GetFileName(FullFileName); s[1] = GetParent(FullFileName); tmp_d = FI.Length / 1024; tmp_d = (tmp_d == 0) ? (Math.Round((double)FI.Length / 1024, 3)) : (FI.Length / 1024); tmp_d = (tmp_d > 0 && tmp_d < 1) ? 1 : tmp_d; s[2] = tmp_d.ToString() + " KB"; TotalMemory += (long)tmp_d; ObjTotalMemory.TotalMemory = TotalMemory.ToString(); s[3] = (Path.GetExtension(FullFileName).TrimStart('. ')).ToUpper() + " File"; ListFiles.Items.Add(new ListViewItem(s)); StatusText.Caption = FullFileName; Flg = false; } } } catch { } } } private void TmpGetFiles(string dir, string Patern) { bool IsCanceled=false; try { foreach (string f in Directory.GetFiles(dir, Patern)) { if (!BackgroundThread.CancellationPending) { StatusText.Caption = f; ListOfFiles.Add(f); }

Page 50: BoostUp Utilities

BoostUp Utilities else { IsCanceled = true; break; } } if (!IsCanceled) { foreach (string d in Directory.GetDirectories(dir)) { TmpGetFiles(d, Patern); } } } catch { } } private bool ExtContains(string ExtName) { for (int i = 0; i < FileTypes.Length; i++) { if (FileTypes[i] == ExtName) return true; } return false; } private void BtnDelSelected_Click(object sender, EventArgs e) { if (ListFiles.CheckedItems.Count != 0) { if (DevExpress.XtraEditors.XtraMessageBox.Show("Do you really want to delete selected the file(s) from your system ?", "Gain Disk Space : Delete Selected", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { IsDeleteSelected=true; DeleteFile = new string[ListFiles.CheckedItems.Count]; for (int i = 0; i < ListFiles.CheckedItems.Count; i++) DeleteFile[i] = ListFiles.CheckedItems[i].SubItems[1].Text + "\\" + ListFiles.CheckedItems[i].SubItems[0].Text; BackgroundDelete.RunWorkerAsync(); } } else DevExpress.XtraEditors.XtraMessageBox.Show("There are no any file(s) to delete", "Gain Disk Space : Delete Selected", MessageBoxButtons.OK, MessageBoxIcon.Information); } private void BtnLeave_Click(object sender, EventArgs e) { if (TmpFileName != "") System.IO.File.Delete(TmpFileName); BackgroundTime.CancelAsync(); BackgroundThread.CancelAsync(); BackgroundDelete.CancelAsync(); this.Dispose(); } private void FrmGainDiskSpace_Shown(object sender, EventArgs e) { CommandArgs = Environment.GetCommandLineArgs(); if (CommandArgs.Length >1) { FrmCmdLineScan f = new FrmCmdLineScan();

Page 51: BoostUp Utilities

BoostUp Utilities if (f.ShowDialog() == DialogResult.OK) { string[] tmp = f.FileTypes; IsFromCmdLine = true; BackgroundTime.RunWorkerAsync(); BeforeScan(AllArgs, tmp); } } } private void ListFiles_ColumnClick(object sender, ColumnClickEventArgs e) { ListView myListView = (ListView)sender; // Determine if clicked column is already the column that is being sorted. if (e.Column == lvwColumnSorter.SortColumn) { // Reverse the current sort direction for this column. if (lvwColumnSorter.Order == SortOrder.Ascending) { lvwColumnSorter.Order = SortOrder.Descending;} else{ lvwColumnSorter.Order = SortOrder.Ascending;} } else { // Set the column number that is to be sorted; default to ascending. lvwColumnSorter.SortColumn = e.Column; lvwColumnSorter.Order = SortOrder.Ascending; } // Perform the sort with these new sort options. myListView.Sort(); } private void BackgroundTime_DoWork(object sender, DoWorkEventArgs e) { StatusTime.Caption = "Elapsed Time : 00:00:00"; int Sec = 0; int Min = 0; int Hour = 0; while (BtnScan.Text != "&Scan") { if (BackgroundTime.CancellationPending) break; System.Threading.Thread.Sleep(1000); if (Sec == 59) { Sec = 0; Min++; } if (Min == 60) { Sec = Min = 0; Hour++; } Sec++; StatusTime.Caption = "Elapsed Time : " + CheckZero(Hour) + ":" + CheckZero( Min) + ":" + CheckZero( Sec); } } private void FrmGainDiskSpace_HelpButtonClicked(object sender, CancelEventArgs e) { Help.ShowHelp(this, GetAppPath() + "BoostUp Utilities\\BoostUpHelp.chm", HelpNavigator.KeywordIndex, "Gain Disk Space"); }

Page 52: BoostUp Utilities

BoostUp Utilities private string GetAppPath() { string[] s = Application.CommonAppDataPath.Split('\\'); int i = 0; for (i = 0; i < s.Length; i++) { if (s[i] == "RJM") break; } string new_str = ""; for (int j = 0; j < i; j++) { new_str += s[j] + "\\"; } return new_str; } } public class TotalMemoryClass { private long TmpTotalMemory; public string TotalMemory { set { TmpTotalMemory = long.Parse( value); } get { return TmpTotalMemory.ToString(); } } } }

Page 53: BoostUp Utilities

BoostUp Utilities

Coding Shortcut Cleaner

using System.IO; using IWshRuntimeLibrary; namespace ShortcutCleaner { public partial class FrmShortcutCleaner : DevExpress.XtraBars.Ribbon.RibbonForm { private ListViewSorter.ListViewColumnSorter lvwColumnSorter = null; bool AddFlg = false; public bool IsFromCmdLine; string[] CommandArg=null; bool IsScanRunning = false; bool IsRightClick = false; public FrmShortcutCleaner() { InitializeComponent(); myInitializeComponent(); } private void myInitializeComponent() { lvwColumnSorter = new ListViewSorter.ListViewColumnSorter(); this.LstShortCut.ListViewItemSorter = lvwColumnSorter; this.LstShortCut.Sorting = SortOrder.Ascending; this.LstShortCut.AutoArrange = true; } private void Form1_Load(object sender, EventArgs e) { IsFromCmdLine = false; CommandArg = Environment.GetCommandLineArgs(); if (CommandArg.Length > 1) { IsFromCmdLine = true; } CheckForIllegalCrossThreadCalls = false; RJM.SystemInfo.SysDriveInfo s = new RJM.SystemInfo.SysDriveInfo(); int i = 0; foreach (string item in s.GetLogicalDrives()) { DevExpress.XtraEditors.Controls.ImageComboBoxItem imgcmbitem = new DevExpress.XtraEditors.Controls.ImageComboBoxItem(s.GetDriveLabel(item) + " (" + item.Substring(0, 2) + ") [ " + GetFreeSpace(item) + " free of " + Math.Round(s.GetDriveSize(item) / 1073741824, 2) + " GB ]", 0); i++; LogicalDriveName.Properties.Items.Add(imgcmbitem); } foreach (string item in s.GetRemovableDrives()) { try { DevExpress.XtraEditors.Controls.ImageComboBoxItem imgcmbitem = new DevExpress.XtraEditors.Controls.ImageComboBoxItem(s.GetDriveLabel(item) + " (" + item.Substring(0, 2) + ") [ " + GetFreeSpace(item) + " free of " + Math.Round(s.GetDriveSize(item) / 1073741824, 2) + " GB ]", 0); i++;

Page 54: BoostUp Utilities

BoostUp Utilities LogicalDriveName.Properties.Items.Add(imgcmbitem); } catch { } } LogicalDriveName.Properties.Items.Add(new DevExpress.XtraEditors.Controls.ImageComboBoxItem("Custom Folder", 0)); if (!IsFromCmdLine) LogicalDriveName.SelectedIndex = 0; else LogicalDriveName.SelectedIndex = LogicalDriveName.Properties.Items.Count - 1; } public string GetFreeSpace(string DriveName) { RJM.SystemInfo.SysDriveInfo s = new RJM.SystemInfo.SysDriveInfo(); decimal d = s.GetFreeSpace(DriveName); if (d >= 1073741824) return Math.Round(d/1073741824, 2).ToString() + " GB"; else if(d>=1048576) return Math.Round(d/1048576, 2).ToString() + " MB"; else if(d>=1024) return Math.Round(d/1024, 3).ToString() + " KB"; else return Math.Round(d, 2).ToString() + " Byte"; } private void BtnCleanUp_Click(object sender, EventArgs e) { if (BtnCleanUp.Text == "&Cancel") { BtnCleanUp.Enabled = false; BtnCleanUp.Text = "Canceling..."; BackgroundThread.CancelAsync(); } else { if (LstShortCut.CheckedItems.Count == 0) { DevExpress.XtraEditors.XtraMessageBox.Show("Select one or more files to clean up", "BoostUp! : Shortcut Cleaner", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { if (DevExpress.XtraEditors.XtraMessageBox.Show("Are you sure you want to clean up ?", "BoostUp! : Shortcut Cleaner", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { int count = 0; for (int i = 0; i < LstShortCut.Items.Count; i++) { if (LstShortCut.Items[i].Checked) { string tmp_s1 = LstShortCut.Items[i].SubItems[1].Text + "\\" + LstShortCut.Items[i].SubItems[0].Text; System.IO.File.Delete(tmp_s1); count++; } } for (int i = 0; i < LstShortCut.Items.Count; i++) { if (LstShortCut.Items[i].Checked) { LstShortCut.Items[i].Remove(); i--; } }

Page 55: BoostUp Utilities

BoostUp Utilities string tmp_s = LogicalDriveName.Properties.Items[LogicalDriveName.SelectedIndex].ToString(); StatusText.Caption = count.ToString() + " file(s) have been successfully deleted from " + tmp_s.Substring(tmp_s.LastIndexOf('(') + 1, 2)+"\\"; BtnCleanUp.Enabled = false; GrpLnk.Enabled = false; ClearField(); LblCheckedShortcut.Text=""; } } } } private void LogicalDriveName_SelectedIndexChanged(object sender, EventArgs e) { ClearField(); LogicalDriveName.Enabled = false; IsScanRunning = true; GrpLnk.Enabled = false; string tmp_s = LogicalDriveName.Properties.Items[LogicalDriveName.SelectedIndex].ToString(); tmp_s=tmp_s.Substring(tmp_s.LastIndexOf('(') + 1, 2) + "\\"; if (tmp_s.ToLower() != "cu\\") { BtnCleanUp.Enabled = true; BtnCleanUp.Text = "&Cancel"; } LogicalDriveName.Enabled = false; BackgroundThread.RunWorkerAsync(); } public void GetMissingShortcuts(String DriveName,DoWorkEventArgs e) { StatusText.Caption = "Searching For Missing Shortcuts in " + DriveName + " ..."; TotalShortcutInfo tmp = new TotalShortcutInfo(DriveName,BackgroundThread,StatusText); string[] s = new string[3]; for (int i = 0; i < tmp.TotalShortcutDetails[0].Count; i++) { if (BackgroundThread.CancellationPending) { e.Cancel = true; break; } StatusText.Caption = tmp.TotalShortcutDetails[3][i].ToString() + "\\" + tmp.TotalShortcutDetails[0][i].ToString(); if ((string)tmp.TotalShortcutDetails[5][i] == "File") { if ((!System.IO.File.Exists(tmp.TotalShortcutDetails[4][i].ToString()))) { if (tmp.TotalShortcutDetails[4][i].ToString() != "") { s[0] = tmp.TotalShortcutDetails[0][i].ToString(); s[1] = tmp.TotalShortcutDetails[3][i].ToString(); s[2] = tmp.TotalShortcutDetails[1][i].ToString()+ " KB"; LstShortCut.Items.Add(new ListViewItem(s)); } } } else { if ((!System.IO.Directory.Exists(tmp.TotalShortcutDetails[4][i].ToString()))) {

Page 56: BoostUp Utilities

BoostUp Utilities if (tmp.TotalShortcutDetails[4][i].ToString() != "") { s[0] = tmp.TotalShortcutDetails[0][i].ToString(); s[1] = tmp.TotalShortcutDetails[3][i].ToString(); s[2] = tmp.TotalShortcutDetails[1][i].ToString()+" KB"; LstShortCut.Items.Add(new ListViewItem(s)); } } } } if (LstShortCut.Items.Count != 0) { StatusText.Caption = "Found Total " + LstShortCut.Items.Count + " Missing Shortcut(s)"; CheckUncheckListBox(true); BtnCleanUp.Enabled = true; GrpLnk.Enabled = true; } else { StatusText.Caption = "No shortcut found "; BtnCleanUp.Enabled = false; GrpLnk.Enabled = false; } } private void BackgroundThread_DoWork(object sender, DoWorkEventArgs e) { if (IsFromCmdLine) { BtnCleanUp.Text = "&Cancel"; BtnCleanUp.Enabled = true; BackgroundTime.RunWorkerAsync(); GetMissingShortcuts(CommandArg[CommandArg.Length - 1], e); IsFromCmdLine = false; //FeelOriginalCombo(); } else { if (LogicalDriveName.SelectedIndex < LogicalDriveName.Properties.Items.Count - 1) { BackgroundTime.RunWorkerAsync(); string tmp_s = LogicalDriveName.Properties.Items[LogicalDriveName.SelectedIndex].ToString(); GetMissingShortcuts(tmp_s.Substring(tmp_s.LastIndexOf('(') + 1, 2) + "\\", e); } else { WindowsFolderDialogBox tmp = new WindowsFolderDialogBox(); if (tmp.ShowDialog(this) == DialogResult.OK) { ClearField(); LstShortCut.Items.Clear(); BtnCleanUp.Enabled = true; GrpLnk.Enabled = false; BtnCleanUp.Text = "&Cancel"; BackgroundTime.RunWorkerAsync(); LogicalDriveName.Enabled = false; foreach (string FolderName in tmp.FolderName) GetMissingShortcuts(FolderName, e); } } }

Page 57: BoostUp Utilities

BoostUp Utilities BtnCleanUp.Text = "&Clean Up"; LogicalDriveName.Enabled = true; if (IsScanRunning) { NotifyShortcutCleaner.BalloonTipTitle = "Shortcut Cleaner"; NotifyShortcutCleaner.BalloonTipText = "Scan Completed. Found Total " + LstShortCut.Items.Count + " Missing Shortcut(s)"; NotifyShortcutCleaner.ShowBalloonTip(1000); IsScanRunning = false; } if (LstShortCut.Items.Count != 0) { CheckUncheckListBox(true); BtnCleanUp.Enabled = true; GrpLnk.Enabled = true; } else { BtnCleanUp.Enabled = false; GrpLnk.Enabled = false; } } private void FeelOriginalCombo() { CheckForIllegalCrossThreadCalls = false; IsFromCmdLine = false; RJM.SystemInfo.SysDriveInfo s = new RJM.SystemInfo.SysDriveInfo(); int i = 0; LogicalDriveName.Properties.Items.Clear(); foreach (string item in s.GetLogicalDrives()) { DevExpress.XtraEditors.Controls.ImageComboBoxItem imgcmbitem = new DevExpress.XtraEditors.Controls.ImageComboBoxItem(s.GetDriveLabel(item) + " (" + item.Substring(0, 2) + ") [ " + GetFreeSpace(item) + " free of " + Math.Round(s.GetDriveSize(item) / 1073741824, 2) + " GB ]", 0); i++; LogicalDriveName.Properties.Items.Add(imgcmbitem); } foreach (string item in s.GetRemovableDrives()) { try { DevExpress.XtraEditors.Controls.ImageComboBoxItem imgcmbitem = new DevExpress.XtraEditors.Controls.ImageComboBoxItem(s.GetDriveLabel(item) + " (" + item.Substring(0, 2) + ") [ " + GetFreeSpace(item) + " free of " + Math.Round(s.GetDriveSize(item) / 1073741824, 2) + " GB ]", 0); i++; LogicalDriveName.Properties.Items.Add(imgcmbitem); } catch { } } LogicalDriveName.Properties.Items.Add(new DevExpress.XtraEditors.Controls.ImageComboBoxItem("Custom Folder", 0)); } private string GetSortPath(string Path) { string[] tmp_arr = Path.Split(' '); string FullPath=""; if (Path.Length > 50) { for (int i = 0; i < tmp_arr.Length; i++) FullPath += tmp_arr[i]; }

Page 58: BoostUp Utilities

BoostUp Utilities else return Path; string tmp = FullPath.Substring(0, 3); tmp += "..."; string tmp_last_str = FullPath.Substring(FullPath.LastIndexOf('\\')); tmp += tmp_last_str; return tmp; } private void LstShortCut_ColumnClick(object sender, ColumnClickEventArgs e) { ListView myListView = (ListView)sender; // Determine if clicked column is already the column that is being sorted. if (e.Column == lvwColumnSorter.SortColumn) { // Reverse the current sort direction for this column. if (lvwColumnSorter.Order == SortOrder.Ascending) { lvwColumnSorter.Order = SortOrder.Descending; } else { lvwColumnSorter.Order = SortOrder.Ascending; } } else { // Set the column number that is to be sorted; default to ascending. lvwColumnSorter.SortColumn = e.Column; lvwColumnSorter.Order = SortOrder.Ascending; } // Perform the sort with these new sort options. myListView.Sort(); } private void BackgroundTime_DoWork(object sender, DoWorkEventArgs e) { StatusTime.Caption = "Elapsed Time : 00:00:00"; int Sec = 0; int Min = 0; int Hour = 0; while (BtnCleanUp.Text.ToLower() != "&clean up") { if (BackgroundTime.CancellationPending) break; System.Threading.Thread.Sleep(1000); if (Sec == 59) { Sec = 0; Min++; } if (Min == 60) { Sec = Min = 0; Hour++; } Sec++; StatusTime.Caption = "Elapsed Time : " + CheckZero(Hour) + ":" + CheckZero(Min) + ":" + CheckZero(Sec); } }

Page 59: BoostUp Utilities

BoostUp Utilities private void FrmShortcutCleaner_HelpButtonClicked(object sender, CancelEventArgs e) { Help.ShowHelp(this, GetAppPath() + "BoostUp Utilities\\BoostUpHelp.chm", HelpNavigator.KeywordIndex, "Shortcut Cleaner"); } private string GetAppPath() { string[] s = Application.CommonAppDataPath.Split('\\'); int i = 0; for (i = 0; i < s.Length; i++) { if (s[i] == "RJM") break; } string new_str = ""; for (int j = 0; j < i; j++) { new_str += s[j] + "\\"; } return new_str; } } ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// public partial class TotalShortcutInfo { public ArrayList[] TotalShortcutDetails; public static bool Tmp_Flg; public ulong TotalShortcutsCount; public BackgroundWorker e; public DevExpress.XtraBars.BarStaticItem StatusText; public TotalShortcutInfo(String DriveName,BackgroundWorker tmp_e,DevExpress.XtraBars.BarStaticItem StatusText1) { Tmp_Flg = false; StatusText = StatusText1; e = tmp_e; TotalShortcutDetails = new ArrayList[6]; for (int i = 0; i < 6; i++) TotalShortcutDetails[i] = new ArrayList(); getDirsFiles(new System.IO.DirectoryInfo(DriveName)); } private void getDirsFiles(DirectoryInfo d) { FileInfo[] files = null; string fileName, fileSize, fileCreated, fileDir, fileTargetPath, fileType; bool tmpfileType = false; if (!e.CancellationPending) { try { files = d.GetFiles("*.lnk"); foreach (FileInfo file in files) { fileName = file.FullName; fileSize = file.Length.ToString(); fileCreated = file.LastWriteTime.ToString(); fileDir = file.Directory.ToString(); fileTargetPath = GetTargetPath(fileName).ToString(); TotalShortcutDetails[0].Add(Path.GetFileName(fileName)); StatusText.Caption = fileName;

Page 60: BoostUp Utilities

BoostUp Utilities TotalShortcutDetails[1].Add(fileSize); TotalShortcutDetails[2].Add(fileCreated); TotalShortcutDetails[3].Add(fileDir); TotalShortcutDetails[4].Add(fileTargetPath); try { tmpfileType = ShortcutIsFile(fileTargetPath); } catch { } if (tmpfileType == true) fileType = "File"; else fileType = "Directory"; TotalShortcutDetails[5].Add(fileType); TotalShortcutsCount++; } } catch { } try { System.IO.DirectoryInfo[] dirs = d.GetDirectories("*.*"); foreach (DirectoryInfo dir in dirs) { getDirsFiles(dir); } } catch { } } else Tmp_Flg = true; } public static string GetTargetPath(string ShortcutPath) { string linkPathName = ShortcutPath; WshShell shell = new WshShell(); IWshShortcut link = (IWshShortcut)shell.CreateShortcut(linkPathName); return link.TargetPath; } private static bool ShortcutIsFile(String ShortcutTargetPath) { FileAttributes attr = System.IO.File.GetAttributes(ShortcutTargetPath); if ((attr & FileAttributes.Directory) == FileAttributes.Directory) return false; else return true; } } }

Page 61: BoostUp Utilities

BoostUp Utilities

Coding Process Manager

using System.Runtime.InteropServices; using System.Threading; using CustomUIControls.Graphing; using Microsoft.Win32; using RJM.ProcessInfo; using System.IO; using System.Diagnostics; namespace ProcessManager { public partial class FrmProcessManager : DevExpress.XtraBars.Ribbon.RibbonForm { #region Constants , Member Variable & Function Declaration [DllImport("user32.dll")] static extern int GetWindowThreadProcessId(IntPtr hWnd, out int processId); [DllImport("user32.dll")] static extern bool DestroyWindow(IntPtr hWnd); [DllImport("user32.dll")] static extern int TileWindows(IntPtr hwndParent, int wHow, IntPtr lpRect, int cKids,[MarshalAs(UnmanagedType.LPArray)]IntPtr[] lpKids); [DllImport("user32.dll")] static extern ushort CascadeWindows(IntPtr hwndParent, uint wHow,IntPtr lpRect, uint cKids, IntPtr[] lpKids); [DllImport("user32.dll")] public static extern IntPtr FindWindow(string lpClassName, string lpWindowName); [DllImport("user32.dll")] static extern bool ShowWindow(IntPtr hWnd, int nCmdShow); [DllImport("user32.dll")] static extern bool SetForegroundWindow(IntPtr hWnd); [DllImport("user32.dll", EntryPoint = "SendMessage", SetLastError = true)] static extern IntPtr SendMessage(IntPtr hWnd, Int32 Msg, IntPtr wParam, IntPtr lParam); public delegate void DispProcessMgrItems(); RJM.SystemInfo.SystemInfo RAMInfo = new RJM.SystemInfo.SystemInfo(); Processes SysProcessInfo = new Processes(); NativeMethods ApplicationList = new NativeMethods(); DispProcessMgrItems DispItems; C2DPushGraph.LineHandle LineHandleState; Process SelectedProcessInfo; Icon AppIcon; //========================Graphics Variables===========================// Bitmap CpuBitmapObj = new Bitmap(128, 128); Bitmap PFBitmapObj = new Bitmap(128, 128); Pen CpuPenObj,PFPenObj; Brush CpuBrushObj, PFBrushObj; Graphics GrpObj; //====================================================================//

Page 62: BoostUp Utilities

BoostUp Utilities int i = 0; ulong TotalRAM = 0; bool IsRightClick = false; private ListViewSorter.ListViewColumnSorter lvwColumnSorter = null; const int SC_MINIMIZE = 0xF020; const int SC_MAXIMIZE = 0xF030; const int SC_RESTORE = 0xF120; const int WM_COMMAND = 0x0112; const uint SC_SKIPDISABLED = 0x00002; #endregion #region PerformanceCounter Objects private PerformanceCounter TotalCPUPerformance = new PerformanceCounter("Processor", "% Processor Time", "_Total"); private PerformanceCounter TotalCPUPerformanceForStatus = new PerformanceCounter("Processor", "% Processor Time", "_Total"); private PerformanceCounter TotalCPUPerformanceForCPUGraph = new PerformanceCounter("Processor", "% Processor Time", "_Total"); private PerformanceCounter CommitedChargePerformanceForStatus = new PerformanceCounter("Memory", "Committed Bytes"); private PerformanceCounter CommitedChargePerformance = new PerformanceCounter("Memory", "Committed Bytes"); private PerformanceCounter CommitedChargePerformanceForPFGraph = new PerformanceCounter("Memory", "Committed Bytes"); private PerformanceCounter MemoryPerformance = new PerformanceCounter("Memory", "Available MBytes"); private PerformanceCounter TotalPageFileForPFGraph = new PerformanceCounter("Memory", "Commit Limit"); private PerformanceCounter ProcessCPUPerformance; #endregion public FrmProcessManager() { CheckForIllegalCrossThreadCalls = false; InitializeComponent(); PopMenuItemInsert(); myInitializeComponent(); } private void myInitializeComponent() { lvwColumnSorter = new ListViewSorter.ListViewColumnSorter(); this.LstOpenFiles.ListViewItemSorter = lvwColumnSorter; this.LstOpenFiles.Sorting = SortOrder.Ascending; this.LstOpenFiles.AutoArrange = true; } private void FrmProcessManager_Load(object sender, EventArgs e) { if (BackgroundThreadApplication.IsBusy == false) DispItems = new DispProcessMgrItems(BackgroundThreadApplication.RunWorkerAsync); else BackgroundThreadApplication.CancelAsync(); if (BackgroundThreadProcess.IsBusy == false) BackgroundThreadProcess.RunWorkerAsync(); else BackgroundThreadProcess.CancelAsync(); if (RJM.RegistryInfo.RegistryHandle.CheckMyTaskManager()) BtnReplaceTaskManager.Down = true;

Page 63: BoostUp Utilities

BoostUp Utilities if (RJM.RegistryInfo.RegistryHandle.CheckAlwaysOnTop()) BtnAlwaysOnTop.Down = true; switch (RJM.RegistryInfo.RegistryHandle.CheckRefreshRate()) { case 500: ChkRRNormal.Checked = true; TmrRefreshRate.Interval = 750; break; case 1000: ChkRRLow.Checked = true; TmrRefreshRate.Interval = 1000; break; case 100: ChkRRHigh.Checked = true; TmrRefreshRate.Interval = 500; break; default: ChkRRNormal.Checked = true; TmrRefreshRate.Interval = 750; break; } if (RJM.RegistryInfo.RegistryHandle.CheckDetailPane()) { BtnDetailPane.Down = true; GrpDetailPane.Visible = true; LstProcesses.Dock = DockStyle.Top; LstProcesses.Height = 262; } System.Threading.Thread.Sleep(1000); PFUsageOriginalGraphDraw(); CpuUsageOriginalGraphDraw(); } private void TmrRefreshRate_Tick(object sender, EventArgs e) { StatusProcessCount.Caption = "Processes: " + LstProcesses.Items.Count.ToString() + " "; StatusCPUUsage.Caption = "CPU Usage : " + Math.Round(TotalCPUPerformanceForStatus.NextValue(), 0) + "%"; RJM.SystemInfo.SystemInfo TotalCommmitCharge = new RJM.SystemInfo.SystemInfo(); StatusCommitCharge.Caption = "Commit Charge : " + (Math.Round((float)CommitedChargePerformanceForStatus.NextValue() / 1048576, 0)).ToString() + "M / " + TotalCommmitCharge.GetTotalPageFileMemory().ToString() + "M"; try { DispItems.Invoke(); } catch (NullReferenceException ne) { } catch (InvalidOperationException ie) { } } private void BackgroundThreadProcess_DoWork(object sender, DoWorkEventArgs e) { if (BackgroundThreadProcess.CancellationPending == true) e.Cancel = true; else DispProcesses(); } private void BackgroundThreadApplication_DoWork(object sender, DoWorkEventArgs e) { if (BackgroundThreadApplication.CancellationPending == true) e.Cancel = true; else DispApplication(); }

Page 64: BoostUp Utilities

BoostUp Utilities private void BackgroundThreadOpenFiles_DoWork(object sender, DoWorkEventArgs e) { if (BackgroundThreadOpenFiles.CancellationPending == true) e.Cancel = true; else DispOpenFiles(); } private void PMTabControl_SelectedPageChanged(object sender, DevExpress.XtraTab.TabPageChangedEventArgs e) { if (e.Page.TabControl.SelectedTabPageIndex == 0) RibbonApplicationCategory.Visible = true; else RibbonApplicationCategory.Visible = false; switch (PMTabControl.SelectedTabPageIndex) { case 0: DispItems = new DispProcessMgrItems(BackgroundThreadApplication.RunWorkerAsync); RibbonThreadSettings.Visible = false; RibbonProcesses.Visible = false; LstApplication.Focus(); BtnAppRefresh.Visibility = DevExpress.XtraBars.BarItemVisibility.Never; break; case 1: DispItems = new DispProcessMgrItems(BackgroundThreadProcess.RunWorkerAsync); StatusProcessCount.Caption = "Processes: " + LstProcesses.Items.Count.ToString(); RibbonThreadSettings.Visible = true; RibbonProcesses.Visible = true; LstProcesses.Focus(); BtnAppRefresh.Visibility = DevExpress.XtraBars.BarItemVisibility.Never; break; case 2: if (LstOpenFiles.Items.Count == 0) BackgroundThreadOpenFiles.RunWorkerAsync(); RibbonThreadSettings.Visible = true; RibbonProcesses.Visible = false; BtnAppRefresh.Visibility = DevExpress.XtraBars.BarItemVisibility.Always; LstOpenFiles.Focus(); break; case 3: foreach (Process TmpProcessDetail in Process.GetProcesses(".")) { DevExpress.XtraEditors.Controls.ImageComboBoxItem ImgCmbItem = new DevExpress.XtraEditors.Controls.ImageComboBoxItem(TmpProcessDetail.ProcessName, TmpProcessDetail.ProcessName.ToString(), 0); ImgCmbProcessLst.Properties.Items.Add(ImgCmbItem); } ImgCmbProcessLst.SelectedIndex = 0; DispItems = new DispProcessMgrItems(DispPerformance); RibbonProcesses.Visible = false; RibbonThreadSettings.Visible = false; BtnAppRefresh.Visibility = DevExpress.XtraBars.BarItemVisibility.Never; break; } TmrRefreshRate.Enabled = true; } private void BtnAlwaysOnTop_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { if (BtnAlwaysOnTop.Down) { this.TopMost = true; try { Registry.LocalMachine.OpenSubKey("Software\\BoostUp", true).SetValue("AlwaysOnTop", "true"); } catch { } }

Page 65: BoostUp Utilities

BoostUp Utilities else { this.TopMost = false; try { Registry.LocalMachine.OpenSubKey("Software\\BoostUp", true).SetValue("AlwaysOnTop", "false"); } catch { } } } private void BtnReplaceTaskManager_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { if (BtnReplaceTaskManager.Down) { RJM.RegistryInfo.RegistryHandle.SetMyTaskManager(Application.ExecutablePath); } else { RJM.RegistryInfo.RegistryHandle.SetDefaultTaskManager(); } } private void BtnCascade_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { IntPtr[] SelectedApplication = new IntPtr[LstApplication.SelectedItems.Count]; for (int i = 0; i < LstApplication.SelectedItems.Count; i++) { SelectedApplication[i] = ApplicationList.GetApplicationHandleByName(LstApplication.SelectedItems[i].SubItems[0].Text); } CascadeWindows(IntPtr.Zero,SC_SKIPDISABLED, IntPtr.Zero, (uint)LstApplication.SelectedItems.Count,SelectedApplication); } private void BtnTileVertically_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { IntPtr[] SelectedApplication = new IntPtr[LstApplication.SelectedItems.Count]; for (int i = 0; i < LstApplication.SelectedItems.Count; i++) { SelectedApplication[i] = ApplicationList.GetApplicationHandleByName(LstApplication.SelectedItems[i].SubItems[0].Text); } TileWindows(IntPtr.Zero,0, (IntPtr)0,(int)LstApplication.SelectedItems.Count, SelectedApplication); } private void BtnTileHorizantally_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { IntPtr[] SelectedApplication = new IntPtr[LstApplication.SelectedItems.Count]; for (int i = 0; i < LstApplication.SelectedItems.Count; i++) { SelectedApplication[i] = ApplicationList.GetApplicationHandleByName(LstApplication.SelectedItems[i].SubItems[0].Text); } TileWindows(IntPtr.Zero, 0, (IntPtr)1, (int)LstApplication.SelectedItems.Count, SelectedApplication); } private void BtnDetailPane_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { if (BtnDetailPane.Down == true) { GrpDetailPane.Visible = true; LstProcesses.Dock = DockStyle.Top; LstProcesses.Height = 262; try { Registry.LocalMachine.OpenSubKey("Software\\BoostUp", true).SetValue("DetailPane", "true"); } catch { } }

Page 66: BoostUp Utilities

BoostUp Utilities else { GrpDetailPane.Visible = false; LstProcesses.Dock = DockStyle.Fill; LstProcesses.Height = 381; try { Registry.LocalMachine.OpenSubKey("Software\\BoostUp", true).SetValue("DetailPane", "false"); } catch { } } } private void BtnMinimize_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { for (int i = 0; i < LstApplication.SelectedItems.Count; i++) SendMessage(ApplicationList.GetApplicationHandleByName (LstApplication.SelectedItems[i].SubItems[0].Text),WM_COMMAND, (IntPtr)SC_MINIMIZE, IntPtr.Zero); } private void ImgCmbProcessLst_SelectedIndexChanged(object sender, EventArgs e) { if (SysProcessInfo.IsProcessRunning(ImgCmbProcessLst.EditValue.ToString())) ProcessCPUPerformance = new PerformanceCounter("Process", "% Processor Time", GetSelectedProcessInstanceName(ImgCmbProcessLst.EditValue.ToString())); else { ImgCmbProcessLst.Properties.Items.Remove(ImgCmbProcessLst.SelectedItem); ImgCmbProcessLst.SelectedIndex -= 1; } } private void BtnMaximize_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { for (int i = 0; i < LstApplication.SelectedItems.Count; i++) SendMessage(ApplicationList.GetApplicationHandleByName (LstApplication.SelectedItems[i].SubItems[0].Text), WM_COMMAND, (IntPtr)SC_MAXIMIZE, IntPtr.Zero); } private void BtnRestore_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { for (int i = 0; i < LstApplication.SelectedItems.Count; i++) SendMessage(ApplicationList.GetApplicationHandleByName (LstApplication.SelectedItems[i].SubItems[0].Text), WM_COMMAND, (IntPtr)SC_RESTORE, IntPtr.Zero); } private void BtnBringToFront_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) {

SetForegroundWindow(ApplicationList.GetApplicationHandleByName(LstApplication.SelectedItems[0].SubItems[0].Text));

System.Threading.Thread.Sleep(200); SendMessage(ApplicationList.GetApplicationHandleByName(LstApplication.SelectedItems[0].SubItems[0].Text), WM_COMMAND, (IntPtr)0xF160, IntPtr.Zero); } private void BtnSwitchTo_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { this.WindowState = FormWindowState.Minimized; System.Threading.Thread.Sleep(10); SetForegroundWindow(ApplicationList.GetApplicationHandleByName (LstApplication.SelectedItems[0].SubItems[0].Text)); } private void ChkSPRealTime_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { SetPriority(LstProcesses.SelectedItems[0].SubItems[0].Text.Substring(0, LstProcesses.SelectedItems[0].SubItems[0].Text.Length - 4),

Page 67: BoostUp Utilities

BoostUp Utilities

int.Parse(LstProcesses.SelectedItems[0].SubItems[1].Text), ProcessPriorityClass.RealTime, ChkSPRealTime); } private void ChkSPHigh_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { SetPriority(LstProcesses.SelectedItems[0].SubItems[0].Text.Substring(0, LstProcesses.SelectedItems[0].SubItems[0].Text.Length - 4), int.Parse(LstProcesses.SelectedItems[0].SubItems[1].Text), ProcessPriorityClass.High,ChkSPHigh); } private void ChkSPAboveNormal_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { SetPriority(LstProcesses.SelectedItems[0].SubItems[0].Text.Substring(0, LstProcesses.SelectedItems[0].SubItems[0].Text.Length - 4), int.Parse(LstProcesses.SelectedItems[0].SubItems[1].Text), ProcessPriorityClass.AboveNormal,ChkSPAboveNormal); } private void ChkSPNormal_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { SetPriority( LstProcesses.SelectedItems[0].SubItems[0].Text.Substring(0, LstProcesses.SelectedItems[0].SubItems[0].Text.Length - 4), int.Parse(LstProcesses.SelectedItems[0].SubItems[1].Text),ProcessPriorityClass.Normal,ChkSPNormal); } private void ChkSPBelowNormal_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { SetPriority(LstProcesses.SelectedItems[0].SubItems[0].Text.Substring(0, LstProcesses.SelectedItems[0].SubItems[0].Text.Length - 4), int.Parse(LstProcesses.SelectedItems[0].SubItems[1].Text), ProcessPriorityClass.BelowNormal,ChkSPBelowNormal); } private void ChkSPLow_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { SetPriority(LstProcesses.SelectedItems[0].SubItems[0].Text.Substring(0, LstProcesses.SelectedItems[0].SubItems[0].Text.Length - 4), int.Parse(LstProcesses.SelectedItems[0].SubItems[1].Text),ProcessPriorityClass.Idle,ChkSPLow); } private void BtnAppRefresh_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { if (GrpProgressBar.Visible == false) { GrpProgressBar.Visible = true; LstOpenFiles.Items.Clear(); ImgOpenFilesList.Images.Clear(); BackgroundThreadOpenFiles.RunWorkerAsync(); } } private void BtnEndTask_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { for (int i = 0; i < LstApplication.SelectedItems.Count; i++) { IntPtr hWnd =ApplicationList.GetApplicationHandleByName(LstApplication.SelectedItems[i].SubItems[0].Text DestroyWindow(hWnd); } }

Page 68: BoostUp Utilities

BoostUp Utilities private void BtnGoToProcess_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { int GoToProcessId = 0; GetWindowThreadProcessId(ApplicationList.GetApplicationHandleByName (LstApplication.SelectedItems[i].SubItems[0].Text), out GoToProcessId); Process GoToProcessInfo = Process.GetProcessById(GoToProcessId); LstProcesses.FindItemWithText(GoToProcessInfo.Id.ToString()).Focused = true; LstProcesses.FindItemWithText(GoToProcessInfo.Id.ToString()).Selected = true; PMTabControl.SelectedTabPageIndex = 1; } private void SetRefreshRate(int RefreshRate) { TmrRefreshRate.Interval = RefreshRate; try { Registry.LocalMachine.OpenSubKey("Software\\BoostUp", true).SetValue("RefreshRate", RefreshRate.ToString()); } catch { } } private void CpuUsageOriginalGraphDraw() { Pen PenObj = new Pen(Color.Green); Brush BrushObj = Brushes.Green; GrpObj = Graphics.FromImage((Image)CpuBitmapObj); for (int i = 4; i <= 40; i += 4) { GrpObj.DrawRectangle(PenObj, 12, 10 + i, 25, 1); GrpObj.FillRectangle(BrushObj, 12, 10 + i, 25, 1); GrpObj.DrawRectangle(PenObj, 40, 10 + i, 25, 1); GrpObj.FillRectangle(BrushObj, 40, 10 + i, 25, 1); ImgCpuGraph.Image = (Image)CpuBitmapObj; } } private void CpuUsageGraphDraw() { int CpuPer = (int)Math.Round((float)TotalCPUPerformanceForCPUGraph.NextValue(), 0); LblCpuPer.Text = CpuPer.ToString() + " %"; int i = 0, EndPoint = (44 - (40 * CpuPer) / 100); CpuPenObj = new Pen(Color.Lime); CpuBrushObj = Brushes.Lime; CpuUsageOriginalGraphDraw(); for (i = 40; i >= EndPoint; i -= 4) { GrpObj.DrawRectangle(CpuPenObj, 12, 10 + i, 25, 1); GrpObj.FillRectangle(CpuBrushObj, 12, 10 + i, 25, 1); GrpObj.DrawRectangle(CpuPenObj, 40, 10 + i, 25, 1); GrpObj.FillRectangle(CpuBrushObj, 40, 10 + i, 25, 1); ImgCpuGraph.Image = (Image)CpuBitmapObj; } if (i < EndPoint) { GrpObj.DrawRectangle(CpuPenObj, 12, 11 + i, 25, (float)0.5); GrpObj.FillRectangle(CpuBrushObj, 12, 11 + i, 25, (float)0.5); GrpObj.DrawRectangle(CpuPenObj, 40, 11 + i, 25, (float)0.5); GrpObj.FillRectangle(CpuBrushObj, 40, 11 + i, 25, (float)0.5); ImgCpuGraph.Image = (Image)CpuBitmapObj; } Thread.Sleep(250); }

Page 69: BoostUp Utilities

BoostUp Utilities private void PageFileUsageGraphDraw() { int PageFileUsage = (int)Math.Round((float)CommitedChargePerformance.NextValue() / 1048576, 0); int TotalRAM = (int)Math.Round((float)TotalPageFileForPFGraph.NextValue() / 1048576, 0); int PageFilePer = (100 * PageFileUsage) / TotalRAM; LblPageFilePer.Text = PageFileUsage + " MB"; int i = 0, EndPoint = (44 - (40 * PageFilePer) / 100); PFPenObj = new Pen(Color.Lime); PFBrushObj = Brushes.Lime; PFUsageOriginalGraphDraw(); for (i = 40; i >= EndPoint; i -= 4) { GrpObj.DrawRectangle(PFPenObj, 12, 10 + i, 25, 1); GrpObj.FillRectangle(PFBrushObj, 12, 10 + i, 25, 1); GrpObj.DrawRectangle(PFPenObj, 40, 10 + i, 25, 1); GrpObj.FillRectangle(PFBrushObj, 40, 10 + i, 25, 1); ImgPageFileGraph.Image = (Image)PFBitmapObj; } if (i < EndPoint) { GrpObj.DrawRectangle(PFPenObj, 12, 11 + i, 25, (float)0.5); GrpObj.FillRectangle(PFBrushObj, 12, 11 + i, 25, (float)0.5); GrpObj.DrawRectangle(PFPenObj, 40, 11 + i, 25, (float)0.5); GrpObj.FillRectangle(PFBrushObj, 40, 11 + i, 25, (float)0.5); ImgPageFileGraph.Image = (Image)PFBitmapObj; } Thread.Sleep(250); } private void PFUsageOriginalGraphDraw() { Pen PenObj = new Pen(Color.Green); Brush BrushObj = Brushes.Green; GrpObj = Graphics.FromImage((Image)PFBitmapObj); for (int i = 4; i <= 40; i += 4) { GrpObj.DrawRectangle(PenObj, 12, 10 + i, 25, 1); GrpObj.FillRectangle(BrushObj, 12, 10 + i, 25, 1); GrpObj.DrawRectangle(PenObj, 40, 10 + i, 25, 1); GrpObj.FillRectangle(BrushObj, 40, 10 + i, 25, 1); ImgPageFileGraph.Image = (Image)PFBitmapObj; } } private void SetPriority(string ProcessName, int ProcessId, ProcessPriorityClass Priority, DevExpress.XtraBars.BarCheckItem ChkBoxObj) { if (SysProcessInfo.IsProcessRunning(ProcessName)) { SelectedProcessInfo = Process.GetProcessById(ProcessId); try { SelectedProcessInfo.PriorityClass = Priority; CheckedFalse(); ChkBoxObj.Checked = true; } catch { DevExpress.XtraEditors.XtraMessageBox.Show("The operation could not be completed", "Unable To Change Priority", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }

Page 70: BoostUp Utilities

BoostUp Utilities private string GetSelectedProcessInstanceName(string ProcessName) { Process[] proc = Process.GetProcessesByName(ProcessName); int pid = proc[0].Id; return GetProcessInstanceName(pid); } private string GetProcessInstanceName(int pid) { PerformanceCounterCategory cat = new PerformanceCounterCategory("Process"); string[] instances = cat.GetInstanceNames(); foreach (string instance in instances) { using (PerformanceCounter cnt = new PerformanceCounter("Process", "ID Process", instance, true)) { int val = (int)cnt.RawValue; if (val == pid) { return instance; } } } throw new Exception("Could not find performance counter " + "instance name for current process. This is truly strange ..."); } private void SetPerformanceCounterVal() { //--------------Totals--------------- LblHandlesVal.Text = TotalHandles.NextValue().ToString(); LblThreadsVal.Text = TotalThreads.NextValue().ToString(); LblEventsVal.Text = TotalEvents.NextValue().ToString(); LblProcessesVal.Text = TotalProcesses.NextValue().ToString(); TimeSpan UpTmSpan = new TimeSpan(0, 0, 0, int.Parse(Math.Round(SystemUpTime.NextValue(), 0).ToString())); LblUpTimeVal.Text = UpTmSpan.Hours + " hrs. " + UpTmSpan.Minutes + " min. " + UpTmSpan.Seconds + " sec."; //--------------System Kernel Memory--------------- ulong UlongKernelPagedMemory = (ulong)Math.Round((float)KernalMemoryPaged.NextValue() / 1024, 0); ulong UlongKernelNonPagedMemory = (ulong)Math.Round((float)KernalMemoryNonPaged.NextValue() / 1024); LblPagedVal.Text = UlongKernelPagedMemory.ToString() + " KB"; LblNonPagedVal.Text = UlongKernelNonPagedMemory.ToString() + " KB"; LblSKTotalVal.Text = (UlongKernelPagedMemory + UlongKernelNonPagedMemory).ToString() + " KB"; //--------------Physical Memory--------------- ulong UlongSystemRAM = (ulong)Math.Round((float)RAMInfo.GetTotalRAM() / 1024, 0); ulong UlongSystemPhMemory = (ulong)Math.Round((float)SystemMemory.NextValue() / 1024, 0); ulong UlongCatchPhMemory = (ulong)Math.Round((float)CacheMemory.NextValue() / 1024, 0); ulong UlongAvailableMemory = (ulong)AvailableMemory.NextValue(); LblPhTotalVal.Text = UlongSystemRAM.ToString() + " KB"; LblSystemVal.Text = UlongSystemPhMemory.ToString() + " KB"; LblCacheVal.Text = UlongCatchPhMemory.ToString() + " KB"; LblOtherVal.Text = (UlongSystemRAM - (UlongAvailableMemory +UlongSystemPhMemory)).ToString()+“ KB"; LblPhAvailableVal.Text = UlongAvailableMemory.ToString() + " KB"; //--------------Commit Charge--------------- ulong UlongTotPageFile = (ulong)Math.Round((float)TotalPageFile.NextValue() / 1024, 0); ulong UlongPageFileUsed = (ulong)Math.Round((float)PageFileUsed.NextValue() / 1024, 0); LblMaxSizeVal.Text = UlongTotPageFile.ToString() + " KB"; LblCCUsedVal.Text = UlongPageFileUsed.ToString() + " KB"; LblCCAvailableVal.Text = (UlongTotPageFile - UlongPageFileUsed).ToString() + " KB"; }

Page 71: BoostUp Utilities

BoostUp Utilities private void DispApplication() { string[] AppStr = new string[2]; int AppProcessId; int CountApp = 0; Process AppProcessDetail; if (LstApplication.Items.Count == 0) { foreach (var AppTitle in ApplicationList.GetAllWindows()) { if (AppTitle.Title.Length != 0) { AppStr[0] = AppTitle.Title; GetWindowThreadProcessId(AppTitle.Handle, out AppProcessId); if (AppProcessId != 0) { AppProcessDetail = Process.GetProcessById(AppProcessId); AppStr[1] = AppProcessDetail.Responding == false ? "Not Responding" : "Running"; } AppIcon = SysProcessInfo.GetIconFromFile(Process.GetProcessById(AppProcessId).MainModule.FileName, 3); ImgAppList.Images.Add(AppIcon.ToBitmap()); LstApplication.Items.Add(new ListViewItem(AppStr, ImgAppList.Images.Count - 1)); } } } else { List<RJM.ProcessInfo.WindowWrapper> CurrentApplst = ApplicationList.GetAllWindows(); bool IsExist = false; foreach (var Apps in CurrentApplst) { IsExist = false; foreach (ListViewItem LstItem in LstApplication.Items) { if (LstItem.SubItems[0].Text.ToLower() == Apps.Title.ToLower()) { IsExist = true; break; } } if (IsExist == false) { AppStr[0] = Apps.Title; GetWindowThreadProcessId(Apps.Handle, out AppProcessId); if (AppProcessId != 0) { AppProcessDetail = Process.GetProcessById(AppProcessId); AppStr[1] = AppProcessDetail.Responding == false ? "Not Responding" : "Running"; } AppIcon = SysProcessInfo.GetIconFromFile(Process.GetProcessById(AppProcessId).MainModule.FileName, 3); ImgAppList.Images.Add(AppIcon.ToBitmap()); LstApplication.Items.Add(new ListViewItem(AppStr, ImgAppList.Images.Count - 1)); } } foreach (ListViewItem LstItem in LstApplication.Items) { IsExist = false; foreach (var Apps in CurrentApplst) { if (Apps.Title.ToLower() == LstItem.Text.ToLower()) {

Page 72: BoostUp Utilities

BoostUp Utilities IsExist = true; break; } } if (IsExist == false) { LstItem.Remove(); } } } } private void DispProcesses() { string[] ProcessesLst = SysProcessInfo.GetRunningProcessesDetails(); string[] ProcessesStr; string[] ProcessDetail = new string[6]; ListViewItem LstItems; ImgProcessIcon.Images.Clear(); if (LstProcesses.Items.Count == 0) { for (int i = 0; i < ProcessesLst.Length; i++) { ProcessesStr = null; ProcessesStr = ProcessesLst[i].Split('|'); ProcessDetail[0] = ProcessesStr[2] + ".exe"; ProcessDetail[1] = ProcessesStr[1]; ProcessDetail[2] = ProcessesStr[15]; ProcessDetail[3] = ProcessesStr[11]; ProcessDetail[4] = ProcessesStr[12]; ProcessDetail[5] = ProcessesStr[8]; AppIcon = SysProcessInfo.GetIconFromFile(ProcessesStr[0], 2); ImgProcessIcon.Images.Add(AppIcon.ToBitmap()); LstItems = new ListViewItem(ProcessDetail, ImgProcessIcon.Images.Count - 1); LstProcesses.Items.Add(LstItems); } } else { string TmpProcessesLst = null, AvailableProcessesLst = null; for (int i = 0; i < LstProcesses.Items.Count; i++) TmpProcessesLst += LstProcesses.Items[i].SubItems[0].Text + "|"; for (int i = 0; i < ProcessesLst.Length; i++) AvailableProcessesLst += ProcessesLst[i] + ".exe"; for (int i = 0; i < ProcessesLst.Length; i++) { ProcessesStr = null; ProcessesStr = ProcessesLst[i].Split('|'); if (LstProcesses.Items.Count > ProcessesLst.Length) LstProcesses.Items.RemoveAt(LstProcesses.Items.Count - 1); if (TmpProcessesLst.Contains(ProcessesStr[2] + ".exe")) { AppIcon = SysProcessInfo.GetIconFromFile(ProcessesStr[0], 2); ImgProcessIcon.Images.Add(AppIcon.ToBitmap()); LstProcesses.Items[i].ImageIndex = ImgProcessIcon.Images.Count - 1; LstProcesses.RedrawItems((i - 1) == -1 ? 0 : i - 1, i, true); using (PerformanceCounter pcProcess = new PerformanceCounter("Process", "% Processor Time", ProcessesStr[2])) { try { pcProcess.NextValue(); LstProcesses.Items[i].SubItems[3].Text = Math.Round(pcProcess.NextValue(), 0) + "%"; }

Page 73: BoostUp Utilities

BoostUp Utilities catch { LstProcesses.Items[i].SubItems[3].Text = "0%"; } } LstProcesses.Items[i].SubItems[4].Text = ProcessesStr[12]; LstProcesses.Items[i].SubItems[5].Text = ProcessesStr[8]; LstProcesses.Items[i].SubItems[0].Text = ProcessesStr[2] + ".exe"; LstProcesses.Items[i].SubItems[1].Text = ProcessesStr[1]; LstProcesses.Items[i].SubItems[2].Text = ProcessesStr[15]; } else { ProcessDetail[0] = ProcessesStr[2] + ".exe"; ProcessDetail[1] = ProcessesStr[1]; ProcessDetail[2] = ProcessesStr[15]; ProcessDetail[3] = ProcessesStr[11]; ProcessDetail[4] = ProcessesStr[12]; ProcessDetail[5] = ProcessesStr[8]; try { LstProcesses.Items[i].SubItems[4].Text = ProcessesStr[12]; LstProcesses.Items[i].SubItems[5].Text = ProcessesStr[8]; LstProcesses.Items[i].SubItems[0].Text = ProcessesStr[2] + ".exe"; LstProcesses.Items[i].SubItems[1].Text = ProcessesStr[1]; LstProcesses.Items[i].SubItems[2].Text = ProcessesStr[15]; using (PerformanceCounter pcProcess = new PerformanceCounter("Process", "% Processor Time", ProcessesStr[2])) { try { pcProcess.NextValue(); LstProcesses.Items[i].SubItems[3].Text = Math.Round(pcProcess.NextValue(), 0) + "%"; } catch { LstProcesses.Items[i].SubItems[3].Text = "0%"; } } } catch (ArgumentOutOfRangeException e) { } AppIcon = SysProcessInfo.GetIconFromFile(ProcessesStr[0], 2); ImgProcessIcon.Images.Add(AppIcon.ToBitmap()); LstItems = new ListViewItem(ProcessDetail, ImgProcessIcon.Images.Count - 1); LstProcesses.Items.Add(LstItems); } } } } private void DispOpenFiles() { LstOpenFiles.Items.Clear(); string[] ModulesCollection; string[][] ModeulesItem = null; ProcessProgress.Properties.Maximum = Process.GetProcesses(".").Length * 10; ProcessProgress.Position = 0;

Page 74: BoostUp Utilities

BoostUp Utilities foreach (Process ProcessDetail in Process.GetProcesses(".")) { LblProcessName.Text = ProcessDetail.ProcessName; try { LblProcessDetail.Text = ProcessDetail.MainModule.FileVersionInfo.FileDescription; } catch { LblProcessDetail.Text = "Not Found"; } try { CurrentProcessImage.Image = SysProcessInfo.GetIconFromFile(ProcessDetail.MainModule.FileName, 2).ToBitmap(); } catch { CurrentProcessImage.Image = SysProcessInfo.GetIconFromFile("", 2).ToBitmap(); } ModulesCollection = SysProcessInfo.GetProcessModules(ProcessDetail.Id); if (ModulesCollection != null) { ModeulesItem = new string[ModulesCollection.Length][]; for (int i = 0; i < ModulesCollection.Length; i++) { ModeulesItem[i] = new string[3]; ModeulesItem[i][0] = Path.GetFileName(ModulesCollection[i]); ModeulesItem[i][1] = Path.GetDirectoryName(ModulesCollection[i]); ModeulesItem[i][2] = ProcessDetail.ProcessName; AppIcon = SysProcessInfo.GetIconFromFile(ModulesCollection[i], 2); ImgOpenFilesList.Images.Add(AppIcon.ToBitmap()); ListViewItem LstViewItem = new ListViewItem(ModeulesItem[i], ImgOpenFilesList.Images.Count - 1); LstOpenFiles.Items.Add(LstViewItem); } } ProcessProgress.Position += 10; } GrpProgressBar.Visible = false; LstOpenFiles.Items[0].Selected = true; } private void DispPerformance() { ulong UsedMemory = 0, UsedMemoryInPer = 0; byte SystemCpuUsage = 0, ProcessCpuUSage = 0; if (i == 0) { LineHandleState = MemoryUsageHistoryGraph.AddLine(i + 1, Color.Yellow); TotalRAM = (ulong)Math.Round((float)RAMInfo.GetTotalRAM() / 1048576, 0); MemoryUsageHistoryGraph.MaxLabel = (Math.Round((float)TotalRAM / 1024, 0)).ToString() + " GB"; LineHandleState = ProcessGraph.GetLineHandle(1); ProcessGraph.AddLine(i + 1, Color.Yellow); LineHandleState.Thickness = UInt32.Parse(2.ToString()); LineHandleState = CPUUsageHistoryGraph.GetLineHandle(1); CPUUsageHistoryGraph.AddLine(i + 1, Color.Yellow); LineHandleState.Thickness = UInt32.Parse(2.ToString()); } UsedMemory = (ulong)Math.Round((float)CommitedChargePerformance.NextValue() / 1048576, 0); UsedMemoryInPer = (ulong)Math.Round((decimal)((100 * UsedMemory) / TotalRAM), 0); MemoryUsageHistoryGraph.Push(int.Parse(UsedMemoryInPer.ToString()), 1); MemoryUsageHistoryGraph.UpdateGraph(); SystemCpuUsage = (byte)Math.Round((double)TotalCPUPerformance.NextValue(), 0); ProcessCpuUSage = (byte)Math.Round((double)ProcessCPUPerformance.NextValue(), 0); if (ProcessCpuUSage > SystemCpuUsage) ProcessCpuUSage = SystemCpuUsage; ProcessGraph.Push(ProcessCpuUSage, 1); ProcessGraph.UpdateGraph();

Page 75: BoostUp Utilities

BoostUp Utilities CPUUsageHistoryGraph.Push(SystemCpuUsage, 1); CPUUsageHistoryGraph.UpdateGraph(); SetPerformanceCounterVal(); CpuUsageGraphDraw(); PageFileUsageGraphDraw(); i++; } private void PopMenuItemInsert() { ApplicationPopUpMnu.ItemLinks.Add(BtnBringToFront); ApplicationPopUpMnu.ItemLinks.Add(BtnSwitchTo); ApplicationPopUpMnu.ItemLinks.Add(BtnMinimize, true); ApplicationPopUpMnu.ItemLinks.Add(BtnMaximize); ApplicationPopUpMnu.ItemLinks.Add(BtnRestore); ApplicationPopUpMnu.ItemLinks.Add(BtnTileVertically, true); ApplicationPopUpMnu.ItemLinks.Add(BtnTileHorizantally); ApplicationPopUpMnu.ItemLinks.Add(BtnCascade); //ApplicationPopUpMnu.ItemLinks.Add(BtnEndTask, true); ApplicationPopUpMnu.ItemLinks.Add(BtnGoToProcess,true); ProcessPopUpMnu.ItemLinks.Add(BtnShowDetail); ProcessPopUpMnu.ItemLinks.Add(BtnTerminateProcess, true); ProcessPopUpMnu.ItemLinks.Add(BtnSetPriority); ProcessPopUpMnu.ItemLinks.Add(BtnOpenFileLocation, true); ProcessPopUpMnu.ItemLinks.Add(BtnProperty, true); OpenFilePopUpMnu.ItemLinks.Add(BtnOpenFileLocation); OpenFilePopUpMnu.ItemLinks.Add(BtnProperty, true); } private void FrmProcessManager_HelpButtonClicked(object sender, CancelEventArgs e) { Help.ShowHelp(this, GetAppPath() + "BoostUp Utilities\\BoostUpHelp.chm", HelpNavigator.KeywordIndex, "Process Manager"); } private string GetAppPath() { string[] s = Application.CommonAppDataPath.Split('\\'); int i = 0; for (i = 0; i < s.Length; i++) { if (s[i] == "RJM") break; } string new_str = ""; for (int j = 0; j < i; j++) { new_str += s[j] + "\\"; } return new_str; } } }

Page 76: BoostUp Utilities

BoostUp Utilities ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// public partial class FrmProcessDetail : DevExpress.XtraBars.Ribbon.RibbonForm { Process DispProcessInfo; RJM.ProcessInfo.Processes SysProcessInfo = new RJM.ProcessInfo.Processes(); public FrmProcessDetail(int ProcessId) { InitializeComponent(); DispProcessInfo = Process.GetProcessById(ProcessId); } private void FrmProcessDetail_Load(object sender, EventArgs e) { DispInformation(); } private void BtnFileProperty_Click(object sender, EventArgs e) { RJM.FileSystemInfo.PropertyWindow.Show(DispProcessInfo.MainModule.FileName); } private void LblFolderVal_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { Process.Start("explorer", "/select," + LblFileVal.Text); } private void DispInformation() { // = ================================== TAB General ==================================// try { ProcessImg.Image = SysProcessInfo.GetIconFromFile(DispProcessInfo.MainModule.FileName, 2).ToBitmap(); } catch { ProcessImg.Image = ProcessImg.ErrorImage; } try { LblProcessName.Text = DispProcessInfo.ProcessName + ".exe"; } catch { LblProcessName.Text = "Not Found"; } try { LblProcessManufacturar.Text = DispProcessInfo.MainModule.FileVersionInfo.CompanyName; } catch { LblProcessManufacturar.Text = "Not Found"; } try { LblProcessVersion.Text = DispProcessInfo.MainModule.FileVersionInfo.FileVersion; } catch { LblProcessVersion.Text = "Not Found"; } try { LblFileVal.Text = DispProcessInfo.MainModule.FileName; } catch { LblFileVal.Text = "Not Found"; } try { LblFolderVal.Text = Path.GetDirectoryName(DispProcessInfo.MainModule.FileName); } catch { LblFolderVal.Text = "Not Found"; } try { LblMemoryVal.Text = (Math.Round((float)DispProcessInfo.WorkingSet64 / 1048576, 2)).ToString() + " MB"; } catch { LblMemoryVal.Text = "Not Found"; } try { LblPriorityVal.Text = DispProcessInfo.PriorityClass.ToString(); } catch { LblPriorityVal.Text = "Not Found"; } try { LblStartedOnVal.Text = DispProcessInfo.StartTime.ToString(); } catch { LblStartedOnVal.Text = "Not Found"; } // Parent Process PerformanceCounter ParentProcessID = new PerformanceCounter("Process", "Creating Process ID", DispProcessInfo.ProcessName); float parentPID = ParentProcessID.NextValue(); try { LblStartedByVal.Text = Process.GetProcessById((int)parentPID).ProcessName; } catch { LblStartedByVal.Text = "Not Found"; } // ================================= TAB Advanced ==================================// // Process Information try { LstProcessDetail.Items.Add(new ListViewItem(GetData("ID", DispProcessInfo.Id.ToString()), 0, LstProcessDetail.Groups[0])); } catch { } try { LstProcessDetail.Items.Add(new ListViewItem(GetData("File Name", DispProcessInfo.ProcessName + ".exe"), 0, LstProcessDetail.Groups[0])); } catch { }

Page 77: BoostUp Utilities

BoostUp Utilities try { LstProcessDetail.Items.Add(new ListViewItem(GetData("File Path", Path.GetDirectoryName(DispProcessInfo.MainModule.FileName)), 0, LstProcessDetail.Groups[0])); } catch { } try { LstProcessDetail.Items.Add(new ListViewItem(GetData("Threads", DispProcessInfo.Threads.Count.ToString()), 0, LstProcessDetail.Groups[0])); } catch { } try { LstProcessDetail.Items.Add(new ListViewItem(GetData("Priority", DispProcessInfo.PriorityClass.ToString()), 0, LstProcessDetail.Groups[0])); } catch { } try { LstProcessDetail.Items.Add(new ListViewItem(GetData("Memory Usage", DispProcessInfo.WorkingSet64.ToString() + " Bytes"), 0, LstProcessDetail.Groups[0])); } catch { } // Version Information try { LstProcessDetail.Items.Add(new ListViewItem(GetData("Company Name", DispProcessInfo.MainModule.FileVersionInfo.CompanyName), 0, LstProcessDetail.Groups[2])); } catch { } try { LstProcessDetail.Items.Add(new ListViewItem(GetData("Description", DispProcessInfo.MainModule.FileVersionInfo.FileDescription), 0, LstProcessDetail.Groups[2])); } catch { } try { LstProcessDetail.Items.Add(new ListViewItem(GetData("Version", DispProcessInfo.MainModule.FileVersionInfo.FileVersion), 0, LstProcessDetail.Groups[2])); } catch { } try { LstProcessDetail.Items.Add(new ListViewItem(GetData("Internal Name", DispProcessInfo.MainModule.FileVersionInfo.InternalName), 0, LstProcessDetail.Groups[2])); } catch { } try { LstProcessDetail.Items.Add(new ListViewItem(GetData("Legal Copyright", DispProcessInfo.MainModule.FileVersionInfo.LegalCopyright), 0, LstProcessDetail.Groups[2])); } catch { } try { LstProcessDetail.Items.Add(new ListViewItem(GetData("Legal Treadmarks", DispProcessInfo.MainModule.FileVersionInfo.LegalTrademarks), 0, LstProcessDetail.Groups[2])); } catch { } try { LstProcessDetail.Items.Add(new ListViewItem(GetData("Original File Name", DispProcessInfo.MainModule.FileVersionInfo.OriginalFilename), 0, LstProcessDetail.Groups[2])); } catch { } try { LstProcessDetail.Items.Add(new ListViewItem(GetData("Product Name", DispProcessInfo.MainModule.FileVersionInfo.ProductName), 0, LstProcessDetail.Groups[2])); } catch { } try { LstProcessDetail.Items.Add(new ListViewItem(GetData("Product Version", DispProcessInfo.MainModule.FileVersionInfo.ProductVersion), 0, LstProcessDetail.Groups[2])); } catch { } try { LstProcessDetail.Items.Add(new ListViewItem(GetData("Comments", DispProcessInfo.MainModule.FileVersionInfo.Comments), 0,LstProcessDetail.Groups[2])); } catch { } try { LstProcessDetail.Items.Add(new ListViewItem(GetData("Language", DispProcessInfo.MainModule.FileVersionInfo.Language),0, LstProcessDetail.Groups[2])); } catch { } // Module Information foreach (string ModuleName in SysProcessInfo.GetProcessModules(DispProcessInfo.Id)) LstProcessDetail.Items.Add(new ListViewItem(GetData(Path.GetFileName(ModuleName), Path.GetDirectoryName(ModuleName)),1, LstProcessDetail.Groups[1])); } private string[] GetData(string str1, string str2) { string[] StrProcess = new string[2]; StrProcess[0] = str1; StrProcess[1] = str2; return StrProcess; } }

Page 78: BoostUp Utilities

BoostUp Utilities

Coding StartUp Manager

using System.IO; using System.Diagnostics; using Microsoft.Win32; namespace StartupManager { public partial class FrmStartUpManager : DevExpress.XtraBars.Ribbon.RibbonForm { private ListViewSorter.ListViewColumnSorter lvwColumnSorter = null; private bool IsContextMenuOpen = false; private bool IsFromContextTray = false; private bool IsLeftMouseClicked = false; RJM.RegistryInfo.RegistryHandle f; Icon AppIcon; public FrmStartUpManager() { InitializeComponent(); myInitializeComponent(); ListContextMenuStrip.ImageList = ImgLst; } private void myInitializeComponent() { lvwColumnSorter = new ListViewSorter.ListViewColumnSorter(); this.LstStartUpItems.ListViewItemSorter = lvwColumnSorter; this.LstStartUpItems.Sorting = SortOrder.Ascending; this.LstStartUpItems.AutoArrange = true; } private void Form1_Load(object sender, EventArgs e) { CheckForIllegalCrossThreadCalls = false; f = new RJM.RegistryInfo.RegistryHandle(); } public void dispData() { string[] str = f.GetStartupPrograms(); int TurnOnCounter=0; ImgLst.Images.Clear(); if (LstStartUpItems.Items.Count != str.Length) { string[] tmp_arr = new string[4]; string[] tmp_arr1 = new string[4]; ListViewItem invitem; int k = 0; for (int i = 0; i < str.Length; i++) { tmp_arr = str[i].Split('|'); tmp_arr1[0] = tmp_arr[0]; tmp_arr1[1] = tmp_arr[3]; tmp_arr1[2] = GetPath(tmp_arr[1].Replace("\"", "").TrimStart(null)); tmp_arr1[3] = tmp_arr[2]; if (File.Exists(tmp_arr1[2])) { AppIcon = Icon.ExtractAssociatedIcon(GetPath(tmp_arr1[2])); ImgLst.Images.Add(AppIcon.ToBitmap());

Page 79: BoostUp Utilities

BoostUp Utilities invitem = new ListViewItem(tmp_arr1, k); k++; LstStartUpItems.Items.Add(invitem); TurnOnCounter++; } } str = f.GetTurnOffPrograms(); for (int i = 0; i < str.Length; i++) { try { tmp_arr = str[i].Split('|'); tmp_arr1[0] = tmp_arr[0]; tmp_arr1[1] = tmp_arr[3]; tmp_arr1[2] = tmp_arr[1].Replace("\"", "").TrimStart(null); tmp_arr1[3] = tmp_arr[2]; AppIcon = Icon.ExtractAssociatedIcon(GetPath(tmp_arr1[2])); ImgLst.Images.Add(AppIcon.ToBitmap()); invitem = new ListViewItem(tmp_arr1, ImgLst.Images.Count - 1); LstStartUpItems.Items.Add(invitem); } catch { } } } StatusText.Caption= TurnOnCounter+" of "+ LstStartUpItems.Items.Count+ " StartUp Programs in this view are Turned On"; } public string GetPath(string path) { string a = path; try { if (a.LastIndexOf(".") == -1) a = a.Substring(0, a.IndexOf(' ')) + ".exe"; else a = a.Substring(0, a.LastIndexOf(".") + 4); if (a.Contains(":")) a = a.Substring(a.IndexOf(":") - 1); else a = "C:\\Windows\\" + path; } catch { } return a; } private void listView1_ColumnClick(object sender, ColumnClickEventArgs e) { ListView myListView = (ListView)sender; // Determine if clicked column is already the column that is being sorted. if (e.Column == lvwColumnSorter.SortColumn) { // Reverse the current sort direction for this column. if (lvwColumnSorter.Order == SortOrder.Ascending) { lvwColumnSorter.Order = SortOrder.Descending; } else { lvwColumnSorter.Order = SortOrder.Ascending; }

Page 80: BoostUp Utilities

BoostUp Utilities } else { // Set the column number that is to be sorted; default to ascending. lvwColumnSorter.SortColumn = e.Column; lvwColumnSorter.Order = SortOrder.Ascending; } // Perform the sort with these new sort options. myListView.Sort(); } private void BtnDelete_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { RJM.RegistryInfo.RegistryHandle R1 = new RJM.RegistryInfo.RegistryHandle(); if (LstStartUpItems.SelectedItems.Count == 0) DevExpress.XtraEditors.XtraMessageBox.Show("Please select atleast one item to delete", "BoostUp! : Delete Program", MessageBoxButtons.OK, MessageBoxIcon.Information); else { if (DevExpress.XtraEditors.XtraMessageBox.Show("Are you sure you want to delete selected program(s) from the StartUp ?", "BoostUp! : Delete Program", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { string path=""; for (int i = 0; i < LstStartUpItems.SelectedItems.Count; i++) { if(LstStartUpItems.SelectedItems[i].SubItems[1].Text=="On") path = @"Software\Microsoft\Windows\CurrentVersion\Run"; else path = @"Software\Microsoft\Windows\CurrentVersion\Run+"; R1.DeleteValue(path, LstStartUpItems.SelectedItems[i].SubItems[0].Text, LstStartUpItems.SelectedItems[i].SubItems[3].Text.Contains("All Users") ? Registry.LocalMachine : Registry.CurrentUser); } LstStartUpItems.Items.Clear(); dispData(); } } LstStartUpItems.Focus(); } private void BtnTurnOnOff_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { if (LstStartUpItems.SelectedItems.Count != 0) { if (BtnTurnOnOff.Caption == "Turn Off") { if (DevExpress.XtraEditors.XtraMessageBox.Show("Are you sure you want to Turn Off selected program(s) from the StartUp ?", "BoostUp! : Turn Off Program", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { for (int i = 0; i < LstStartUpItems.SelectedItems.Count; i++) f.TurnOffApplication(LstStartUpItems.SelectedItems[i].SubItems[0].Text, LstStartUpItems.SelectedItems[i].SubItems[2].Text, LstStartUpItems.SelectedItems[i].SubItems[3].Text.Contains("All Users") ? Registry.LocalMachine : Registry.CurrentUser); } }

Page 81: BoostUp Utilities

BoostUp Utilities else { if (DevExpress.XtraEditors.XtraMessageBox.Show("Are you sure you want to Turn On selected program(s) from the StartUp ?", "BoostUp! : Turn On Program", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { for (int i = 0; i < LstStartUpItems.SelectedItems.Count; i++) f.TurnOnApplication(LstStartUpItems.SelectedItems[i].SubItems[0].Text, LstStartUpItems.SelectedItems[i].SubItems[2].Text, LstStartUpItems.SelectedItems[i].SubItems[3].Text.Contains("All Users") ? Registry.LocalMachine : Registry.CurrentUser); } } LstStartUpItems.Items.Clear(); dispData(); } LstStartUpItems.Focus(); } private void frmMain_Shown(object sender, EventArgs e) { dispData(); } private void BtnAddProgram_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { OpenAppDialog.Filter="Executable File (*.exe,*.bat,*.cmd,*.com)|*.exe;*.bat;*.cmd;*.com|All Files(*.*)|*.*"; OpenAppDialog.Title = "StartUp Manager : Application"; OpenAppDialog.FileName = ""; OpenAppDialog.InitialDirectory = Environment.SystemDirectory; OpenAppDialog.Multiselect = true; OpenAppDialog.CheckPathExists = true; OpenAppDialog.CheckFileExists = true; if (OpenAppDialog.ShowDialog() == DialogResult.OK) { string path=@"Software\Microsoft\Windows\CurrentVersion\Run"; string[] fileNames = OpenAppDialog.FileNames; string fileName = ""; foreach(string tmp in fileNames) { fileName = Path.GetFileName(tmp); fileName=fileName.Substring(0, fileName.Length - 4); f.CreateValue(path, fileName, tmp, Registry.CurrentUser); } LstStartUpItems.Items.Clear(); dispData(); } } private void Btn_Refresh_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { LstStartUpItems.Items.Clear(); dispData(); }

Page 82: BoostUp Utilities

BoostUp Utilities private void listView1_Click(object sender, EventArgs e) { if (LstStartUpItems.SelectedItems.Count == 1) { if (LstStartUpItems.SelectedItems[0].SubItems[1].Text.ToString().Contains("On")) { BtnTurnOnOff.Caption = "Turn Off"; ContextTurnOff.Text = "Turn Off"; ContextTurnOff.Image = ImgStartUpManager.Images[4]; BtnTurnOnOff.ImageIndex = 4; } else { BtnTurnOnOff.Caption = "Turn On"; ContextTurnOff.Text = "Turn On"; ContextTurnOff.Image = ImgStartUpManager.Images[5]; BtnTurnOnOff.ImageIndex = 5; } } } private void listView1_KeyUp(object sender, KeyEventArgs e) { if (LstStartUpItems.Items.Count > 0) { if (e.KeyCode == Keys.Enter) { if(!IsContextMenuOpen) BtnTurnOnOff_ItemClick(null, null); IsContextMenuOpen = false; } if (e.KeyCode == Keys.Delete) { BtnDelete_ItemClick(null, null); } } if (e.KeyCode == Keys.Apps) ListContextMenuStrip.Show(this.Left,this.Top+149+22); } private void BtnRun_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { if (LstStartUpItems.SelectedItems.Count == 1) { try { Process.Start(GetPath(LstStartUpItems.SelectedItems[0].SubItems[2].Text), new ProcessStartInfo(LstStartUpItems.SelectedItems[0].SubItems[2].Text).Arguments); } catch { DevExpress.XtraEditors.XtraMessageBox.Show("File can not be Executed", "BoostUp! Program : Can not Execute", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else DevExpress.XtraEditors.XtraMessageBox.Show("Please Select only one Item", "BoostUp! : Run Program", MessageBoxButtons.OK, MessageBoxIcon.Information); LstStartUpItems.Focus(); } private void BtnProperty_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { if (LstStartUpItems.SelectedItems.Count > 0) RJM.FileSystemInfo.PropertyWindow.Show(GetPath(LstStartUpItems.SelectedItems[0].SubItems[2].Text)); else DevExpress.XtraEditors.XtraMessageBox.Show("Select any item", "BoostUp! : Open Property", MessageBoxButtons.OK, MessageBoxIcon.Information); LstStartUpItems.Focus(); }

Page 83: BoostUp Utilities

BoostUp Utilities private void BtnOpenFile_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { if (LstStartUpItems.SelectedItems.Count != 0) SelectDestination(LstStartUpItems.SelectedItems[0].SubItems[2].Text); LstStartUpItems.Focus(); } public void SelectDestination(String AbsolutePath) { System.Diagnostics.Process.Start("explorer.exe", "/select," + AbsolutePath); } private void openFileToolStripMenuItem_Click(object sender, EventArgs e) { IsContextMenuOpen = true; BtnOpenFile_ItemClick(null, null); } private void propertyToolStripMenuItem_Click(object sender, EventArgs e) { IsContextMenuOpen = true; BtnProperty_ItemClick(null, null); } private void LstStartUpItems_SelectedIndexChanged(object sender, EventArgs e) { if (LstStartUpItems.SelectedItems.Count == 1) { if (LstStartUpItems.SelectedItems[0].SubItems[1].Text.ToString().Contains("On")) { BtnTurnOnOff.Caption = "Turn Off"; ContextTurnOff.Text = "Turn Off"; ContextTurnOff.Image = ImgStartUpManager.Images[4]; BtnTurnOnOff.ImageIndex = 4; } else { BtnTurnOnOff.Caption = "Turn On"; ContextTurnOff.Text = "Turn On"; ContextTurnOff.Image = ImgStartUpManager.Images[5]; BtnTurnOnOff.ImageIndex = 5; } } } private void openBoostUpStartUpManagerToolStripMenuItem_Click(object sender, EventArgs e) { IsFromContextTray = true; this.Visible = true; NotifyTray.Visible = !this.Visible; this.WindowState = FormWindowState.Normal; } private void NotifyTray_DoubleClick(object sender, EventArgs e) { openBoostUpStartUpManagerToolStripMenuItem_Click(null, null); } private void BtnTray_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { NotifyTray.Visible = true; NotifyTray.BalloonTipTitle = "Startup Manager"; NotifyTray.BalloonTipText = "Startup Manager is in minimize mode now"; NotifyTray.ShowBalloonTip(1000); this.WindowState = FormWindowState.Minimized; this.Hide(); } private void FrmStartUpManager_HelpButtonClicked(object sender, System.ComponentModel.CancelEventArgs e)

Page 84: BoostUp Utilities

BoostUp Utilities { Help.ShowHelp(this, GetAppPath() + "BoostUp Utilities\\BoostUpHelp.chm", HelpNavigator.KeywordIndex, "Startup Manager"); } private string GetAppPath() { string[] s = Application.CommonAppDataPath.Split('\\'); int i = 0; for (i = 0; i < s.Length; i++) { if (s[i] == "RJM") break; } string new_str = ""; for (int j = 0; j < i; j++) { new_str += s[j] + "\\"; } return new_str; } } }

Page 85: BoostUp Utilities

BoostUp Utilities

Coding Mass Storage Manager

using System.IO; using System.Diagnostics; using UsbEject.Library; namespace MassStorageManager { public partial class FrmMassStorageDeviceManager : DevExpress.XtraBars.Ribbon.RibbonForm { #region Variable Declaration FrmShowItem ShowItem; ArrayList TempFilesLst=new ArrayList(); ArrayList SystemFileFolderLst = new ArrayList(); ArrayList HiddenFileFolderLst = new ArrayList(); ArrayList ArchiveFileFolderLst = new ArrayList(); bool IsTmpFinish, IsSysFinish, IsHiddenFinish, IsArchiveFinish = false; RJM.SystemInfo.SysDriveInfo RemovableDriveInfo = new RJM.SystemInfo.SysDriveInfo(); #endregion private void FrmMassStorageDeviceManager_Load(object sender, EventArgs e) { CheckForIllegalCrossThreadCalls = false; } private void FrmMassStorageDeviceManager_Shown(object sender, EventArgs e) { DispRemovableDrives(); } private void ImgCmbUSBDrive_SelectedIndexChanged(object sender, EventArgs e) { System.Threading.Thread.Sleep(10); IsTmpFinish = false; IsSysFinish = false; IsHiddenFinish = false; IsArchiveFinish = false; if (ImgCmbUSBDrive.Properties.Items[0].Description != "No Mass Storage Device Attached") { if (BtnRefresh.Text == "&Stop Scan") { BackgroundWorkerTempFiles.CancelAsync(); BackgroundWorkerSystemFiles.CancelAsync(); BackgroundWorkerArchiveFiles.CancelAsync(); BackgroundWorkerHiddenFiles.CancelAsync(); //CheckAllFinish(); IsTmpFinish = true; IsArchiveFinish = true; IsHiddenFinish = true; IsSysFinish = true; } else { try { CloseAllThread(); LblTempFiles.Text = "0 File Found"; while(LblTempFiles.Text!="0 File Found") LblTempFiles.Text = "0 File Found";

Page 86: BoostUp Utilities

BoostUp Utilities LblSysFileFolder.Text = "0 Item Found"; while (LblSysFileFolder.Text != "0 Item Found") LblSysFileFolder.Text = "0 Item Found"; LblArchiveFileFolder.Text = "0 Item Found"; while (LblArchiveFileFolder.Text != "0 Item Found") LblArchiveFileFolder.Text = "0 Item Found"; LblHiddenFileFolder.Text = "0 Item Found"; while (LblHiddenFileFolder.Text != "0 Item Found") LblHiddenFileFolder.Text = "0 Item Found"; BtnTempFiles.Enabled = BtnSysFiles.Enabled = BtnHiddenFiles.Enabled = BtnArchiveFiles.Enabled = TxtDriveRename.Enabled=BtnRename.Enabled= false; BtnRefresh.Text = "&Stop Scan"; BtnFormat.Enabled = BtnEject.Enabled = BtnEjectAll.Enabled = false; BackgroundWorkerTempFiles.RunWorkerAsync(); ImgCmbUSBDrive.Enabled = false; TxtDriveRename.Text = ""; } catch { } } } else StatusText.Caption = "Attach a Removable Media"; if(File.Exists(ImgCmbUSBDrive.EditValue.ToString()+"\\autorun.inf")) { LblAutorun.Visible=true; BtnDelete.Visible=true; } } private void CloseAllThread() { bool SysThread,TmpThread,HiddenThread,ArchiveThread; SysThread = BackgroundWorkerSystemFiles.IsBusy; TmpThread = BackgroundWorkerTempFiles.IsBusy; HiddenThread = BackgroundWorkerHiddenFiles.IsBusy; ArchiveThread = BackgroundWorkerArchiveFiles.IsBusy; while (SysThread == true && TmpThread == true && HiddenThread == true && ArchiveThread == true) { SysThread = BackgroundWorkerSystemFiles.IsBusy; TmpThread = BackgroundWorkerTempFiles.IsBusy; HiddenThread = BackgroundWorkerHiddenFiles.IsBusy; ArchiveThread = BackgroundWorkerArchiveFiles.IsBusy; if (SysThread == false && TmpThread == false && HiddenThread == false && ArchiveThread == false) break; } } private void AfterScan() { try { BackgroundWorkerTempFiles.CancelAsync(); BackgroundWorkerSystemFiles.CancelAsync(); BackgroundWorkerHiddenFiles.CancelAsync(); BackgroundWorkerArchiveFiles.CancelAsync(); }

Page 87: BoostUp Utilities

BoostUp Utilities catch { } BtnFormat.Enabled = BtnEject.Enabled = BtnEjectAll.Enabled =TxtDriveRename.Enabled=true; //BtnTempFiles.Enabled = BtnSysFiles.Enabled = BtnHiddenFiles.Enabled = BtnArchiveFiles.Enabled = true; BtnRefresh.Text = "&Re-Scan"; BtnRefresh.Enabled = true; ImgCmbUSBDrive.Enabled = true; StatusText.Caption = "Scan Completed"; } private void TxtDriveRename_TextChanged(object sender, EventArgs e) { if (TxtDriveRename.Text.Length > 0) BtnRename.Enabled = true; else BtnRename.Enabled = false; } private void BtnRename_Click(object sender, EventArgs e) { DriveInfo DriveRename = new DriveInfo(ImgCmbUSBDrive.EditValue.ToString()); DriveRename.VolumeLabel = TxtDriveRename.Text; TxtDriveRename.Clear(); DispRemovableDrives(); } private void BtnEject_Click(object sender, EventArgs e) { try { VolumeDeviceClass volumeDeviceClass = new VolumeDeviceClass(); Volume RemovableDevicesName = null; foreach (Volume devices in volumeDeviceClass.Devices) { if (devices.IsUsb) { if (ImgCmbUSBDrive.EditValue.ToString().ToLower() == devices.LogicalDrive.ToLower()+"\\") { try { RemovableDevicesName = devices; Device DeviceDetail = (Device)RemovableDevicesName; DeviceDetail.Eject(true); } catch { } } } } } catch { } DispRemovableDrives(); } private void BtnEjectAll_Click(object sender, EventArgs e) { VolumeDeviceClass volumeDeviceClass = new VolumeDeviceClass(); Volume RemovableDevicesName = null; foreach (Volume devices in volumeDeviceClass.Devices) { if (devices.IsUsb) { try { RemovableDevicesName = devices; Device DeviceDetail = (Device)RemovableDevicesName; DeviceDetail.Eject(true); }

Page 88: BoostUp Utilities

BoostUp Utilities catch { } } } DispRemovableDrives(); } private void BtnFormat_Click(object sender, EventArgs e) { if (DevExpress.XtraEditors.XtraMessageBox.Show("Do you really want to format " + ImgCmbUSBDrive.EditValue.ToString()+"\\", "Mass Storage Device Manager : Format", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { string VolumeLabel = ImgCmbUSBDrive.SelectedItem.ToString().Substring(0, ImgCmbUSBDrive.SelectedItem.ToString().IndexOf('(') - 1); string Arguments = ImgCmbUSBDrive.EditValue + " /v:" + VolumeLabel + " /q /x"; ProcessStartInfo ProcessInfo = new ProcessStartInfo("format", Arguments); ProcessInfo.WindowStyle = ProcessWindowStyle.Normal; System.Diagnostics.Process.Start(ProcessInfo); SendKeys.Send("{ENTER}"); } } private void BackgroundWorkerTempFiles_DoWork(object sender, DoWorkEventArgs e) { IsTmpFinish = false; TempFilesLst.Clear(); LblTempFiles.Text ="0 File found"; GetTempFiles(ImgCmbUSBDrive.EditValue.ToString(), "*.tmp",BackgroundWorkerTempFiles); IsTmpFinish = true; CheckAllFinish(); BtnTempFiles.Enabled =(TempFilesLst.Count>0)? true:false; BackgroundWorkerSystemFiles.RunWorkerAsync(); ImgCmbUSBDrive.Enabled = false; } private void BackgroundWorkerSystemFiles_DoWork(object sender, DoWorkEventArgs e) { IsSysFinish = false; SystemFileFolderLst.Clear(); LblSysFileFolder.Text ="0 Item found"; GetSystemFileFolder(ImgCmbUSBDrive.EditValue.ToString(), BackgroundWorkerSystemFiles); IsSysFinish = true; CheckAllFinish(); BtnSysFiles.Enabled = (SystemFileFolderLst.Count > 0) ? true : false; BackgroundWorkerHiddenFiles.RunWorkerAsync(); } private void BackgroundWorkerHiddenFiles_DoWork(object sender, DoWorkEventArgs e) { IsHiddenFinish = false; HiddenFileFolderLst.Clear(); LblHiddenFileFolder.Text ="0 Item found"; GetHiddenFileFolder(ImgCmbUSBDrive.EditValue.ToString(), BackgroundWorkerHiddenFiles); IsHiddenFinish = true; CheckAllFinish(); BtnHiddenFiles.Enabled = (HiddenFileFolderLst.Count > 0) ? true : false; BackgroundWorkerArchiveFiles.RunWorkerAsync(); }

Page 89: BoostUp Utilities

BoostUp Utilities private void BackgroundWorkerArchiveFiles_DoWork(object sender, DoWorkEventArgs e) { IsArchiveFinish = false; ArchiveFileFolderLst.Clear(); System.Threading.Thread.Sleep(100); LblArchiveFileFolder.Text = "0 Item found"; GetArchiveFileFolder(ImgCmbUSBDrive.EditValue.ToString(), BackgroundWorkerArchiveFiles); IsArchiveFinish = true; BtnArchiveFiles.Enabled = (ArchiveFileFolderLst.Count>0)? true:false; CheckAllFinish(); } private void CheckAllFinish() { if (IsTmpFinish && IsSysFinish && IsHiddenFinish && IsArchiveFinish) AfterScan(); } private void CheckForBackgroundThread() { if (BackgroundWorkerTempFiles.IsBusy == false && BackgroundWorkerSystemFiles.IsBusy == false && BackgroundWorkerHiddenFiles.IsBusy == false && BackgroundWorkerArchiveFiles.IsBusy == false) { StatusText.Caption = "Scan Completed"; ImgCmbUSBDrive.Enabled = true; ImgCmbUSBDrive.SelectedIndex = 0; if (TempFilesLst.Count == 0) BtnTempFiles.Enabled = false; else BtnTempFiles.Enabled = true; if (SystemFileFolderLst.Count == 0) BtnSysFiles.Enabled = false; else BtnSysFiles.Enabled = true; if (HiddenFileFolderLst.Count == 0) BtnHiddenFiles.Enabled = false; else BtnHiddenFiles.Enabled = true; if (ArchiveFileFolderLst.Count == 0) BtnArchiveFiles.Enabled = false; else BtnArchiveFiles.Enabled = true; } } protected override void WndProc(ref Message m) { byte CountDrives = 0; string[] Drives = RemovableDriveInfo.GetRemovableDrives(); string RemovableDrives = ""; if (StatusText.Caption != "Scan Completed" && StatusText.Caption != "Attach a Removable Media") CheckForBackgroundThread(); if (Drives != null && Drives.Length > 0 && ImgCmbUSBDrive.Enabled) {

Page 90: BoostUp Utilities

BoostUp Utilities

foreach (string item in Drives) { RemovableDrives += item.Substring(0, 2) + ","; } RemovableDrives = RemovableDrives.Substring(0, RemovableDrives.Length - 1); if (ImgCmbUSBDrive.Properties.Items.Count != RemovableDriveInfo.GetRemovableDrives().Length) DispRemovableDrives(); else { for (int i = 0; i < ImgCmbUSBDrive.Properties.Items.Count; i++) { if (RemovableDrives.Contains(ImgCmbUSBDrive.Properties.Items[i].Value.ToString())) CountDrives += 1; } if (ImgCmbUSBDrive.Properties.Items.Count != CountDrives) DispRemovableDrives(); } } else DispRemovableDrives(); base.WndProc(ref m); } private void DispRemovableDrives() { ImgCmbUSBDrive.Properties.Items.Clear(); if (RemovableDriveInfo.GetRemovableDrives().Length == 0) { DevExpress.XtraEditors.Controls.ImageComboBoxItem ImgCmbItem = new DevExpress.XtraEditors.Controls.ImageComboBoxItem("No Mass Storage Device Attached", 0); ImgCmbUSBDrive.Properties.Items.Add(ImgCmbItem); LblArchiveFileFolder.Text="0 Item Found"; LblHiddenFileFolder.Text="0 Item Found"; LblSysFileFolder.Text="0 Item Found"; LblTempFiles.Text = "0 File Found"; StatusText.Caption = "Attach a Removable Media to scan."; GrpMassStorageDevice.Enabled = false; BtnRefresh.Enabled = false; BtnFormat.Enabled = false; BtnEject.Enabled = false; BtnEjectAll.Enabled = false; } else { GrpMassStorageDevice.Enabled = true; BtnRefresh.Enabled = true; BtnFormat.Enabled = true; BtnEject.Enabled = true; BtnEjectAll.Enabled = true; int i = 0; foreach (string item in RemovableDriveInfo.GetRemovableDrives()) { try { DevExpress.XtraEditors.Controls.ImageComboBoxItem imgcmbitem = new DevExpress.XtraEditors.Controls.ImageComboBoxItem(RemovableDriveInfo.GetDriveLabel(item) + " (" + item.Substring(0, 2) + ") [ " + GetFreeSpace(item) + " free of " + Math.Round(RemovableDriveInfo.GetDriveSize(item) / 1073741824, 2) + " GB ]", item, 0); i++; ImgCmbUSBDrive.Properties.Items.Add(imgcmbitem); } catch { }

Page 91: BoostUp Utilities

BoostUp Utilities } } ImgCmbUSBDrive.SelectedIndex = 0; } private void GetTempFiles(string DriveName, string Pattern,BackgroundWorker e) { StatusText.Caption = "Scaning " + DriveName.Substring(0, 2) + "\\ ..."; try { foreach (string TmpFiles in Directory.GetFiles(DriveName, Pattern)) { if (!e.CancellationPending) { TempFilesLst.Add(TmpFiles); LblTempFiles.Text = TempFilesLst.Count.ToString() + " File(s) Found"; } else { BtnRefresh.Enabled = false; BtnRefresh.Text = "Canceling..."; } } foreach (string SubDirs in Directory.GetDirectories(DriveName)) { if(!e.CancellationPending) GetTempFiles(SubDirs, Pattern,e); } } catch { } if(!e.CancellationPending) CheckForBackgroundThread(); } private void GetSystemFileFolder(string DriveName,BackgroundWorker e) { StatusText.Caption = "Scaning " + DriveName.Substring(0, 2) + "\\ ..."; try { foreach (string SystemFiles in Directory.GetFiles(DriveName)) { if (!e.CancellationPending) { FileInfo FileAttrib = new FileInfo(SystemFiles); if (FileAttrib.Attributes.ToString().Contains("System")) { SystemFileFolderLst.Add(SystemFiles); } LblSysFileFolder.Text = SystemFileFolderLst.Count.ToString() + " Item(s) Found"; } else { BtnRefresh.Enabled = false; BtnRefresh.Text = "Canceling..."; } } foreach (string SubDirs in Directory.GetDirectories(DriveName)) { if (!e.CancellationPending) { DirectoryInfo DirAttrib = new DirectoryInfo(SubDirs); if (DirAttrib.Attributes.ToString().Contains("System")) SystemFileFolderLst.Add(SubDirs); LblSysFileFolder.Text = SystemFileFolderLst.Count.ToString() + " Item(s) Found";

Page 92: BoostUp Utilities

BoostUp Utilities GetSystemFileFolder(SubDirs, e); } } } catch { } if(!e.CancellationPending) CheckForBackgroundThread(); } private void GetHiddenFileFolder(string DriveName,BackgroundWorker e) { StatusText.Caption = "Scaning " + DriveName.Substring(0, 2) + "\\ ..."; try { foreach (string HiddenFiles in Directory.GetFiles(DriveName)) { if (!e.CancellationPending) { FileInfo FileAttrib = new FileInfo(HiddenFiles); if (FileAttrib.Attributes.ToString().Contains("Hidden")) { HiddenFileFolderLst.Add(HiddenFiles); } LblHiddenFileFolder.Text = HiddenFileFolderLst.Count.ToString() + " Item(s) Found"; } else { BtnRefresh.Enabled = false; BtnRefresh.Text = "Canceling..."; } } foreach (string SubDirs in Directory.GetDirectories(DriveName)) { if (!e.CancellationPending) { DirectoryInfo DirAttrib = new DirectoryInfo(SubDirs); if (DirAttrib.Attributes.ToString().Contains("Hidden")) HiddenFileFolderLst.Add(SubDirs); LblHiddenFileFolder.Text = HiddenFileFolderLst.Count.ToString() + " Item(s) Found"; GetHiddenFileFolder(SubDirs, e); } } } catch { } CheckForBackgroundThread(); } private void GetArchiveFileFolder(string DriveName, BackgroundWorker e) { StatusText.Caption = "Scaning " + DriveName.Substring(0, 2) + "\\ ..."; try { foreach (string ArchiveFiles in Directory.GetFiles(DriveName)) { if (!e.CancellationPending) { FileInfo FileAttrib = new FileInfo(ArchiveFiles); if (FileAttrib.Attributes.ToString().Contains("Archive")) { ArchiveFileFolderLst.Add(ArchiveFiles); } LblArchiveFileFolder.Text = ArchiveFileFolderLst.Count.ToString() + " Item(s) Found"; } else {

Page 93: BoostUp Utilities

BoostUp Utilities BtnRefresh.Enabled = false; BtnRefresh.Text = "Canceling..."; } } foreach (string SubDirs in Directory.GetDirectories(DriveName)) { if (!e.CancellationPending) { DirectoryInfo DirAttrib = new DirectoryInfo(SubDirs); if (DirAttrib.Attributes.ToString().Contains("Archive")) ArchiveFileFolderLst.Add(SubDirs); LblArchiveFileFolder.Text = ArchiveFileFolderLst.Count.ToString() + " Item(s) Found"; GetArchiveFileFolder(SubDirs, e); } } } catch { } CheckForBackgroundThread(); } public string GetFreeSpace(string DriveName) { RJM.SystemInfo.SysDriveInfo s = new RJM.SystemInfo.SysDriveInfo(); decimal d = s.GetFreeSpace(DriveName); if (d >= 1073741824) return Math.Round(d / 1073741824, 2).ToString() + " GB"; else if (d >= 1048576) return Math.Round(d / 1048576, 2).ToString() + " MB"; else if (d >= 1024) return Math.Round(d / 1024, 3).ToString() + " KB"; else return Math.Round(d, 2).ToString() + " Byte"; } private void FrmMassStorageDeviceManager_HelpButtonClicked(object sender, CancelEventArgs e) { Help.ShowHelp(this, GetAppPath() + "BoostUp Utilities\\BoostUpHelp.chm", HelpNavigator.KeywordIndex, "Mass Storage Manager"); } private string GetAppPath() { string[] s = Application.CommonAppDataPath.Split('\\'); int i = 0; for (i = 0; i < s.Length; i++) { if (s[i] == "RJM") break; } string new_str = ""; for (int j = 0; j < i; j++) { new_str += s[j] + "\\"; } return new_str; }

Page 94: BoostUp Utilities

BoostUp Utilities

Coding File Integrator

using System.IO; using Microsoft.Win32; using TAFactory.IconPack;

namespace FileIntegrator { public partial class FrmFileIntegrator : DevExpress.XtraBars.Ribbon.RibbonForm { bool HasKey = false; string ExtKey = ""; public FrmFileIntegrator() { InitializeComponent(); } private void AppBrowse_Click(object sender, EventArgs e) { if (BtnAppBrowse.Text.ToLower() == "&browse") { OpenDialogBoxStatus(BrowseDialog, "File Integrator - Application Path", "Executable File (*.exe) |*.exe",

"*.exe"); if (BrowseDialog.ShowDialog() == DialogResult.OK) { //LblAppPath.Text = BrowseDialog.FileName; LblAppPath.Text = GetSortPath(BrowseDialog.FileName); BtnAppBrowse.Text = "&Clear"; } } else { BtnAppBrowse.Text = "&Browse"; LblAppPath.Text = "Path : Not Selected"; BrowseDialog = null; BrowseDialog = new OpenFileDialog(); } } public void OpenDialogBoxStatus(OpenFileDialog OpenDlg, string DlgTitle, string FilterString, string DefaultExtention) { OpenDlg.DefaultExt = DefaultExtention; OpenDlg.Title = DlgTitle; OpenDlg.Filter = FilterString; OpenDlg.FileName = ""; OpenDlg.CheckFileExists = true; OpenDlg.CheckPathExists = true; OpenDlg.ValidateNames = true; OpenDlg.SupportMultiDottedExtensions = false; OpenDlg.InitialDirectory = Environment.SystemDirectory; }

Page 95: BoostUp Utilities

BoostUp Utilities private bool IsAvailable(string Extention) { RegistryKey tmp_key = Registry.ClassesRoot; tmp_key = tmp_key.OpenSubKey(Extention); if (tmp_key == null) return true; else return false; } private void SetExtention_Click(object sender, EventArgs e) { if (TxtExtention.Text.Length == 0 || LblAppPath.Text == "Path : Not Selected") DevExpress.XtraEditors.XtraMessageBox.Show("Some fields are empty", "File Integrator : Required ", MessageBoxButtons.OK, MessageBoxIcon.Error); else { if (IsAvailable("." + TxtExtention.Text)) { if (DevExpress.XtraEditors.XtraMessageBox.Show("Do you really want to create your own extention ?", "File Integrator : Create", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { try { if (IntegrateExtenatation("." + TxtExtention.Text, TxtArgs.Text, TxtExtention.Text, BrowseDialog.FileName, IconDialog.FileName)) { DevExpress.XtraEditors.XtraMessageBox.Show("Your extention is created. A sample file with your extention has been created on the desktop", "File Integrator : Success", MessageBoxButtons.OK, MessageBoxIcon.Information); File.AppendAllText(Environment.GetFolderPath(Environment.SpecialFolder.Desktop) + "\\sample." + TxtExtention.Text, "File Integrator - your extention is successfully set."); this.Dispose(); } } catch { DevExpress.XtraEditors.XtraMessageBox.Show("You do not have sufficient rights to create your own extension", "File Integrator : Insufficient Rights", MessageBoxButtons.OK, MessageBoxIcon.Error); } } } else { RegistryKey tmp_key1 = Registry.ClassesRoot.OpenSubKey("." + TxtExtention.Text); string tmp_str = tmp_key1.GetValue(null).ToString(); tmp_key1 = Registry.ClassesRoot.OpenSubKey(tmp_str); string[] FileName = Path.GetFileName(tmp_key1.OpenSubKey("Shell\\Open\\Command").GetValue(null).ToString()).Split(' '); DevExpress.XtraEditors.XtraMessageBox.Show("This extention already exists." + Environment.NewLine + "Integrated with : " + FileName[0], "File Integrator : Already Exists", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }

Page 96: BoostUp Utilities

BoostUp Utilities public bool IntegrateExtenatation(string Extention,string Args, string KeyName, string ApplicationPath, string IconPath) { Args += " %1"; if(Args!=" %1") Args = " " + Args; RegistryKey RegExtentation = Registry.ClassesRoot; RegistryKey TempReg = Registry.ClassesRoot; TempReg = RegExtentation.CreateSubKey(Extention); TempReg.SetValue(null, KeyName); TempReg = RegExtentation.CreateSubKey(KeyName); TempReg.SetValue(null, KeyName); TempReg.CreateSubKey("DefaultIcon").SetValue(null, IconPath); TempReg.CreateSubKey("shell").CreateSubKey("open").CreateSubKey("command").SetValue(null, ApplicationPath+Args); return true; } private void Cancel_Click(object sender, EventArgs e) { Dispose(); } private void frmMain_Load(object sender, EventArgs e) { ImgIconPreview.Image = IconHelper.ExtractIcon(@"%SystemRoot%\system32\shell32.dll", 0).ToBitmap(); BtnAdd.Caption="Add"; BtnClear.Caption="Clear"; IconMenu.ItemLinks.Add(BtnAdd); IconMenu.ItemLinks.Add(BtnClear); this.BtnAdd.ItemClick +=new DevExpress.XtraBars.ItemClickEventHandler(BtnAdd_ItemClick); this.BtnClear.ItemClick += new DevExpress.XtraBars.ItemClickEventHandler(BtnClear_ItemClick); } private void BtnAdd_ItemClick(object sender, EventArgs e) { OpenDialogBoxStatus(IconDialog, "File Integrator - Icon", "Icon File (*.ico,*.png) |*.ico;*.png", "*.ico"); if (IconDialog.ShowDialog() == DialogResult.OK) { LblIcon.Text = "Icon : " + IconDialog.SafeFileName; LblIconPath.Text = "Path : " + Path.GetDirectoryName(IconDialog.FileName); Icon AppIcon = Icon.ExtractAssociatedIcon(IconDialog.FileName); ImgIconPreview.Image = AppIcon.ToBitmap(); } } private void BtnClear_ItemClick(object sender, EventArgs e) { IconDialog = null; LblIcon.Text = "Icon : Not Selected "; LblIconPath.Text = "Path : Not Selected"; IconDialog = new OpenFileDialog(); ImgIconPreview.Image = IconHelper.ExtractIcon(@"%SystemRoot%\system32\shell32.dll", 0).ToBitmap(); }

Page 97: BoostUp Utilities

BoostUp Utilities private void BtnCheck_Click(object sender, EventArgs e) { if (!IsAvailable("." + TxtExtention.Text)) { RegistryKey tmp_key1 = Registry.ClassesRoot.OpenSubKey("." + TxtExtention.Text); try { string tmp_str = tmp_key1.GetValue(null).ToString(); tmp_key1 = Registry.ClassesRoot.OpenSubKey(tmp_str); string[] FileName =

Path.GetFileName(tmp_key1.OpenSubKey("Shell\\Open\\Command").GetValue(null).ToString()).Split(' '); DevExpress.XtraEditors.XtraMessageBox.Show("." + TxtExtention.Text + " already exists." + Environment.NewLine + "Integrated with : " + FileName[0], "File Integrator : Check Extention", MessageBoxButtons.OK, MessageBoxIcon.Information); } catch { DevExpress.XtraEditors.XtraMessageBox.Show("." + TxtExtention.Text + " already exists." + Environment.NewLine + "Integrated with : None" , "File Integrator : Check Extention", MessageBoxButtons.OK, MessageBoxIcon.Information); } TxtExtention.Focus(); } else { DevExpress.XtraEditors.XtraMessageBox.Show("." + TxtExtention.Text + " is available.", "File Integrator : Check Extention", MessageBoxButtons.OK, MessageBoxIcon.Information); BtnAppBrowse.Focus(); } } private void TxtExtention_TextChanged(object sender, EventArgs e) { if (TxtExtention.Text.Length > 0) BtnCheck.Enabled = true; else BtnCheck.Enabled = false; BtnSetExtention.Enabled = IsAvailable("." + TxtExtention.Text); } private void BtnLeave_Click(object sender, EventArgs e) { this.Dispose(); } private void BtnAvailableExt_Click(object sender, EventArgs e) { FrmAvailableExt frm = new FrmAvailableExt(); frm.ShowDialog(); } public string GetSortPath(string Path) { string []tmp_arr = Path.Split(' '); string FullPath = tmp_arr[0]; string tmp = FullPath.Substring(0, 3); tmp += "..."; string tmp_last_str = FullPath.Substring(FullPath.LastIndexOf('\\')); tmp += tmp_last_str; return tmp; }

Page 98: BoostUp Utilities

BoostUp Utilities private void TxtExtention_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar == (char)46)//dot prevent e.Handled = true; } private void FrmFileIntegrator_HelpButtonClicked(object sender, System.ComponentModel.CancelEventArgs e) { Help.ShowHelp(this, GetAppPath() + "BoostUp Utilities\\BoostUpHelp.chm", HelpNavigator.KeywordIndex, "File Integrator"); } private string GetAppPath() { string[] s = Application.CommonAppDataPath.Split('\\'); int i = 0; for (i = 0; i < s.Length; i++) { if (s[i] == "RJM") break; } string new_str = ""; for (int j = 0; j < i; j++) { new_str += s[j] + "\\"; } return new_str; } } } ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// public partial class FrmAvailableExt : DevExpress.XtraBars.Ribbon.RibbonForm { string[] files; private ListViewSorter.ListViewColumnSorter lvwColumnSorter = null; public FrmAvailableExt() { InitializeComponent(); myInitializeComponent(); } private void myInitializeComponent() { lvwColumnSorter = new ListViewSorter.ListViewColumnSorter(); this.LstAvailableExt.ListViewItemSorter = lvwColumnSorter; this.LstAvailableExt.Sorting = SortOrder.Ascending; this.LstAvailableExt.AutoArrange = true; } public bool contains(string tmp_ss) { bool flg = false; for (int i = 0; i < files.Length; i++) { if (files[i] == tmp_ss) { flg = true; break; } } if (flg == true) return true; else return false; }

Page 99: BoostUp Utilities

BoostUp Utilities private void Form1_Load(object sender, EventArgs e) { CheckForIllegalCrossThreadCalls = false; BackgroundThread.RunWorkerAsync(); } public string GetPath(string path) { string a = path; a = a.Substring(0, a.LastIndexOf(".") + 4); a = a.Substring(a.IndexOf(":") - 1); return a; } private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e) { RegistryKey r; string[] tmp_files; string tmp_s; r = Registry.ClassesRoot; files = r.GetSubKeyNames(); ListViewItem lstitem; tmp_files = new string[2]; for (int i = 0; i < files.Length; i++) { StatusText.Caption = "Registry\\ClassRoot\\" + files[i]; try { tmp_s = r.OpenSubKey(files[i]).GetValue(null).ToString(); if (tmp_s != null) { if (files[i][0] == '.') { if (contains(tmp_s)) { tmp_files[0] = files[i]; tmp_files[1] = GetPath(Registry.ClassesRoot.OpenSubKey(tmp_s + "\\shell\\open\\command").GetValue(null, "Not Found").ToString()); lstitem = new ListViewItem(tmp_files); LstAvailableExt.Items.Add(lstitem); } } } } catch { } } StatusText.Caption = "Total available extentions are : " + LstAvailableExt.Items.Count.ToString(); } private void gotoProcessToolStripMenuItem_Click(object sender, EventArgs e) { if (LstAvailableExt.SelectedItems.Count == 0) DevExpress.XtraEditors.XtraMessageBox.Show("Select any item to open", "BoostUp! : Open File Location", MessageBoxButtons.OK, MessageBoxIcon.Error); else SelectDestination(LstAvailableExt.SelectedItems[0].SubItems[1].Text); } public void SelectDestination(String AbsolutePath) { System.Diagnostics.Process.Start("explorer.exe", "/select," + AbsolutePath); }

Page 100: BoostUp Utilities

BoostUp Utilities private void listView1_ColumnClick(object sender, ColumnClickEventArgs e) { ListView myListView = (ListView)sender; // Determine if clicked column is already the column that is being sorted. if (e.Column == lvwColumnSorter.SortColumn) { // Reverse the current sort direction for this column. if (lvwColumnSorter.Order == SortOrder.Ascending) { lvwColumnSorter.Order = SortOrder.Descending; } else { lvwColumnSorter.Order = SortOrder.Ascending; } } else { // Set the column number that is to be sorted; default to ascending. lvwColumnSorter.SortColumn = e.Column; lvwColumnSorter.Order = SortOrder.Ascending; } // Perform the sort with these new sort options. myListView.Sort(); } private void removeExtentionToolStripMenuItem_Click(object sender, EventArgs e) { if (DevExpress.XtraEditors.XtraMessageBox.Show("Are you sure you want to remove this extension from your system ?", "File Integrator : Remove Extension", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { string ext = LstAvailableExt.SelectedItems[0].SubItems[0].Text; RegistryKey tmp_key = Registry.ClassesRoot.OpenSubKey(ext, true); string ext_key = tmp_key.GetValue(null).ToString(); Registry.ClassesRoot.DeleteSubKey(ext); try { Registry.ClassesRoot.DeleteSubKey(ext_key); } catch { Registry.ClassesRoot.DeleteSubKeyTree(ext_key); } LstAvailableExt.Items[(int)GetIndex(LstAvailableExt.SelectedItems[0].SubItems[0].Text)].Remove(); StatusText.Caption = "Total available extentions are : " + LstAvailableExt.Items.Count.ToString(); DevExpress.XtraEditors.XtraMessageBox.Show("'" + ext + "' Extention has successfully been removed from your system", "File Integrator : Remove", MessageBoxButtons.OK, MessageBoxIcon.Information); } } private long GetIndex(string str) { for (int i = 0; i < LstAvailableExt.Items.Count; i++) if (str == LstAvailableExt.Items[i].SubItems[0].Text) return i; return -1; } private void integrateWithAnotherApplicationToolStripMenuItem_Click(object sender, EventArgs e) { if (DevExpress.XtraEditors.XtraMessageBox.Show("Are you sure you want to integrate this extension with another applicaion ?", "File Integrator : Chnge Application", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { OpenFileDialog OpenFileDiog = new OpenFileDialog();

Page 101: BoostUp Utilities

BoostUp Utilities OpenFileDiog.DefaultExt = "*.exe"; OpenFileDiog.Title = "File Integrator : Select application for '"+LstAvailableExt.SelectedItems[0].SubItems[0].Text+"' extension"; OpenFileDiog.Filter = "Executable File (*.exe) |*.exe"; OpenFileDiog.FileName = ""; OpenFileDiog.CheckFileExists = true; OpenFileDiog.CheckPathExists = true; OpenFileDiog.ValidateNames = true; OpenFileDiog.SupportMultiDottedExtensions = false; OpenFileDiog.InitialDirectory = Environment.SystemDirectory; if(OpenFileDiog.ShowDialog()==DialogResult.OK) { string ExtensionName = LstAvailableExt.SelectedItems[0].SubItems[0].Text; string FileName = OpenFileDiog.FileName; string GetValue = Registry.ClassesRoot.OpenSubKey(ExtensionName, true).GetValue(null).ToString(); Registry.ClassesRoot.OpenSubKey(GetValue, true).OpenSubKey("shell", true).OpenSubKey("open", true).OpenSubKey("command",true).SetValue(null,FileName+" %1"); DevExpress.XtraEditors.XtraMessageBox.Show(ExtensionName + " has been successfully integrated with " + FileName); LstAvailableExt.SelectedItems[0].SubItems[1].Text = FileName; } } } } }

Page 102: BoostUp Utilities

BoostUp Utilities

Coding System Information

using System.Threading; using TAFactory.IconPack; namespace SystemInformation { public partial class FrmSysInfo : DevExpress.XtraBars.Ribbon.RibbonForm { private ListViewSorter.ListViewColumnSorter lvwColumnSorter = null; RJM.SystemInfo.MotherBoardInfo SysMotherBoard = new RJM.SystemInfo.MotherBoardInfo(); RJM.SystemInfo.SysBiosInfo SysBios = new RJM.SystemInfo.SysBiosInfo(); RJM.SystemInfo.SystemInfo SysInfo = new RJM.SystemInfo.SystemInfo(); RJM.SystemInfo.WindowsInfo SysWindows = new RJM.SystemInfo.WindowsInfo(); RJM.SystemInfo.SysDriveInfo SysDrive = new RJM.SystemInfo.SysDriveInfo(); RJM.SystemInfo.CPUinfo SysCpu = new RJM.SystemInfo.CPUinfo(); RJM.SystemInfo.CacheInfo SysCache = new RJM.SystemInfo.CacheInfo(); RJM.ProcessInfo.Processes SysProcess = new RJM.ProcessInfo.Processes(); Thread tab0Thread, tab1Thread, tab2Thread,tab4Thread; Thread tab0_1Thread, tab0_2Thread, tab0_3Thread; Thread tab3_1Thread, tab3_2Thread, tab3_3Thread; Thread tab3_1_1Thread, tab3_1_2Thread, tab3_1_3Thread, tab3_1_4Thread, tab3_1_5Thread, tab3_1_6Thread; ulong SectionMemory, AppMemory, TotalPageFileMemory,TotalPhysicalMemory; private void myInitializeComponent() { lvwColumnSorter = new ListViewSorter.ListViewColumnSorter(); this.ListMemory.ListViewItemSorter = lvwColumnSorter; this.ListMemory.Sorting = SortOrder.Ascending; this.ListMemory.AutoArrange = true; } public FrmSysInfo() { InitializeComponent(); myInitializeComponent(); CheckForIllegalCrossThreadCalls = false; tab0Thread = new Thread(new ThreadStart(myTab1)); tab0_1Thread = new Thread(new ThreadStart(myTab0_1)); tab0_2Thread = new Thread(new ThreadStart(myTab0_2)); tab0_3Thread = new Thread(new ThreadStart(myTab0_3)); tab1Thread = new Thread(new ThreadStart(myTab2)); tab2Thread = new Thread(new ThreadStart(myTab3)); tab4Thread = new Thread(new ThreadStart(myTab5)); tab3_1Thread = new Thread(new ThreadStart(myTab3_1)); tab3_2Thread = new Thread(new ThreadStart(myTab3_2)); tab3_3Thread = new Thread(new ThreadStart(myTab3_3)); tab3_1_1Thread = new Thread(new ThreadStart(myTab3_1_1)); tab3_1_2Thread = new Thread(new ThreadStart(myTab3_1_2)); tab3_1_3Thread = new Thread(new ThreadStart(myTab3_1_3)); tab3_1_4Thread = new Thread(new ThreadStart(myTab3_1_4)); tab3_1_5Thread = new Thread(new ThreadStart(myTab3_1_5)); tab3_1_6Thread = new Thread(new ThreadStart(myTab3_1_6));

Page 103: BoostUp Utilities

BoostUp Utilities tab3_1Thread.Start(); tab3_1_1Thread.Start(); tab3_1_2Thread.Start(); tab3_1_3Thread.Start(); tab3_1_4Thread.Start(); tab3_1_5Thread.Start(); tab3_1_6Thread.Start(); tab0Thread.Start(); tab0_1Thread.Start(); tab0_2Thread.Start(); tab0_3Thread.Start(); tab1Thread.Start(); tab2Thread.Start(); tab4Thread.Start(); tab3_2Thread.Start(); tab3_3Thread.Start(); } public void myTab0_1() { LblProcessorName.Text = SysInfo.GetProcesserName(); } public void myTab0_2() { LblVideoCard.Text = SysInfo.GetVideoCardName(); } public void myTab0_3() { LblMode.Text = SysWindows.GetCurrentResolution() + " with " + SysCpu.GetCpuDataWidth() + " bit color depth"; } public void myTab1() { dispPage(0); CheckValue(LblProcessorName); CheckValue(LblProcessorCount); CheckValue(LblMemory); CheckValue(LblMotherBoard); CheckValue(LblVideoCard); CheckValue(LblSoundCard); CheckValue(LblDirectX); CheckValue(LblMode); } public void myTab2() { dispPage(1); CheckValue(LblWindows); CheckValue(LblInstalled); CheckValue(LblLastBootUp); CheckValue(LblLastShutdown); CheckValue(LblIeVersion);

Page 104: BoostUp Utilities

BoostUp Utilities CheckValue(LblSystemDir); CheckValue(LblIPAdd); CheckValue(LblSerial_No); CheckValue(LblMachineName); CheckValue(LblOrganization); CheckValue(LblProductId); } public void myTab3() { dispPage(2); ListMemory.Items[0].Selected = true; } public void myTab3_1() { CheckValue(LblCpu_Manuf); CheckValue(LblCpu_Caption); CheckValue(LblCpu_ClockSpeed); CheckValue(LblCpu_DataWidth); CheckValue(LblCpu_LogicalProcessor); CheckValue(LblCpu_SerialNo); } public void myTab3_1_1() { LblCpu_Caption.Text = SysCpu.GetCpuCaption(); } public void myTab3_1_2() { LblCpu_ClockSpeed.Text = SysCpu.GetCpuClockSpeed().ToString(); } public void myTab3_1_3() { LblCpu_DataWidth.Text = SysCpu.GetCpuDataWidth() + " bit"; } public void myTab3_1_4() { LblCpu_LogicalProcessor.Text = SysCpu.GetCpuNumberOfLogicalProcessors().ToString(); } public void myTab3_1_5() { LblCpu_Manuf.Text = SysCpu.GetCpuManufacturer(); } public void myTab3_1_6() { LblCpu_SerialNo.Text = SysCpu.GetCpuSerialNo(); } public void myTab3_2() { LblMot_ProductId.Text = SysMotherBoard.GetBoardProductId(); LblMot_Manuf.Text = SysMotherBoard.GetBoardMaker(); LblMot_SerialNo.Text = SysMotherBoard.GetBoardSerNo(); CheckValue(LblMot_Manuf); CheckValue(LblMot_ProductId); CheckValue(LblMot_SerialNo); }

Page 105: BoostUp Utilities

BoostUp Utilities public void myTab3_3() { LblBios_Version.Text = SysBios.GetBIOSVersion(); LblBios_Manuf.Text = SysBios.GetBIOSmaker(); LblBios_SerialNo.Text = SysBios.GetBIOSserNo(); CheckValue(LblBios_Version); CheckValue(LblBios_Manuf); CheckValue(LblBios_SerialNo); } public void myTab5() { dispPage(4); } public void dispPage(int pageno) { switch (pageno) { case 0: OverViewInfoMethod(); break; case 1: WindowsInfoMethod(); break; case 2: MemoryInfoMethod(); break; case 4: SystemDrivesInfoMethod(); break; } } public void CheckValue(object o) { if (((Label)o).Text.Length == 0) ((Label)o).Text = "Not Found"; } public void OverViewInfoMethod() { // overview LblSoundCard.Text = SysInfo.GetSoundDriverName(); LblDirectX.Text = SysWindows.GetDirectXVersion(); LblMotherBoard.Text = SysMotherBoard.GetBoardMaker(); LblMemory.Text = GetFormatedTotalRam((decimal)(SysInfo.GetTotalRAM())); LblProcessorCount.Text = SysInfo.GetProcessorCount().ToString(); LblKeyBoard.Text = SysInfo.GetKeyBoardName(); LblMouse.Text = SysInfo.GetMouseName(); LblMonitor.Text = SysInfo.GetMonitorName(); } private string GetFormatedTotalRam(decimal TotalMemory) { if (TotalMemory >= 1073741827) return Math.Round((TotalMemory / 1073741824), 2) + " GB"; else return TotalMemory + " MB"; }

Page 106: BoostUp Utilities

BoostUp Utilities public void WindowsInfoMethod() { /// windows LblWindows.Text = SysInfo.GetWindowsName(); LblInstalled.Text = SysWindows.GetWindowsInstallationDateTime(); try { LblLastShutdown.Text = SysInfo.GetLastSystemShutdown().ToString(); } catch { LblLastShutdown.Text = ""; } LblLastBootUp.Text = SysInfo.GetLastBootTime(); LblIeVersion.Text = SysWindows.GetIEVersion(); LblSystemDir.Text = SysInfo.GetSystemDirectory(); LblIPAdd.Text = SysInfo.GetIpAddress(); LblSerial_No.Text = SysWindows.GetSerialNo(); LblMachineName.Text = SysInfo.GetMachinName(); LblOrganization.Text = SysInfo.GetOrganization(); LblProductId.Text = SysInfo.GetWindowsKey(); } public void MemoryInfoMethod() { string []ProcessesLst= SysProcess.GetRunningProcessesDetails(); ListMemory.Items.Clear(); string[] ProcessDetail; ListViewItem invitem; Icon AppIcon; for (int i = 0; i < ProcessesLst.Length; i++) { ProcessDetail = ProcessesLst[i].Split('|'); string[] tmp = new string[2]; tmp[0] = ProcessDetail[2] + ".exe"; tmp[1] = ProcessDetail[12]; try { AppIcon = Icon.ExtractAssociatedIcon(ProcessDetail[0]); } catch { AppIcon = IconHelper.ExtractIcon(@"%SystemRoot%\system32\shell32.dll", 2); } ImgList.Images.Add(AppIcon.ToBitmap()); invitem = new ListViewItem(tmp,ImgList.Images.Count-1); ListMemory.Items.Add(invitem); } TotalPhysicalMemory = SysInfo.GetTotalRAM(); AppMemory = SysProcess.GetTotalProcessMemoryUsed(); TotalPageFileMemory = SysInfo.GetTotalPageFileMemory(); ListMemory.Focus(); MemoryUsageChart.Visible = true; } public void SystemDrivesInfoMethod() { string[] temp_drive_name = SysDrive.GetLogicalDrives(); ComboSysDrive.Items.AddRange((object[])temp_drive_name); } private void BtnSysFolder_Click(object sender, EventArgs e) { FrmSysFolders tmp = new FrmSysFolders(); tmp.ShowDialog(); } private void BtnSysVar_Click(object sender, EventArgs e) { FrmEnvironmentVariables tmp = new FrmEnvironmentVariables(); tmp.ShowDialog(); }

Page 107: BoostUp Utilities

BoostUp Utilities private void frmMain_FormClosed(object sender, FormClosedEventArgs e) { tab0Thread.Abort(); tab0_1Thread.Abort(); tab0_2Thread.Abort(); tab0_3Thread.Abort(); tab1Thread.Abort(); tab2Thread.Abort(); tab3_1Thread.Abort(); tab3_1_1Thread.Abort(); tab3_1_2Thread.Abort(); tab3_1_3Thread.Abort(); tab3_1_4Thread.Abort(); tab3_1_5Thread.Abort(); tab3_1_6Thread.Abort(); tab3_2Thread.Abort(); tab3_3Thread.Abort(); tab4Thread.Abort(); } private void BtnSysFolder_Click_1(object sender, EventArgs e) { FrmSysFolders tmp = new FrmSysFolders(); tmp.ShowDialog(); } private void BtnEvnVar_Click(object sender, EventArgs e) { FrmEnvironmentVariables tmp = new FrmEnvironmentVariables(); tmp.ShowDialog(); } private void ComboSysDrive_SelectedIndexChanged(object sender, EventArgs e) { string DriveName=ComboSysDrive.SelectedItem.ToString(); DriveUsageChart.Visible = true; DriveUsageChart.Series[0].Points.Clear(); decimal FreeSpace, UsedSpace, TotalSpace; FreeSpace = SysDrive.GetFreeSpace(DriveName); UsedSpace = SysDrive.GetUsedSpace(DriveName); TotalSpace = SysDrive.GetDriveSize(DriveName); object[] o = new object[2]; DevExpress.XtraCharts.SeriesPoint s; o[0] = FreeSpace/TotalSpace; s=new DevExpress.XtraCharts.SeriesPoint((object)"Free Space",o); DriveUsageChart.Series[0].Points.Add(s); o[0] = UsedSpace / TotalSpace; s = new DevExpress.XtraCharts.SeriesPoint("Used Space", o); DriveUsageChart.Series[0].Points.Add(s); LblTotalSize.Text = "Total Size: " + Math.Round(TotalSpace / 1073741824, 2).ToString() + " GB"; ListViewItem invItem; string[] tmp_str = new string[2]; ListDriveInfo.Items.Clear(); tmp_str[0]="Device Type"; tmp_str[1] = "Hard Disk"; invItem= new ListViewItem(tmp_str); ListDriveInfo.Items.Add(invItem);

Page 108: BoostUp Utilities

BoostUp Utilities tmp_str[0] = "Volumn Name"; tmp_str[1] = SysDrive.GetDriveLabel( DriveName); invItem = new ListViewItem(tmp_str); ListDriveInfo.Items.Add(invItem); tmp_str[0] = "Serial No"; tmp_str[1] = SysDrive.GetDriveSerialNo(DriveName); invItem = new ListViewItem(tmp_str); ListDriveInfo.Items.Add(invItem); tmp_str[0] = "File System"; tmp_str[1] = SysDrive.GetDriveFormat(DriveName); invItem = new ListViewItem(tmp_str); ListDriveInfo.Items.Add(invItem); tmp_str[0] = "Total Bytes"; tmp_str[1] = SysDrive.GetDriveSize(DriveName).ToString(); ; invItem = new ListViewItem(tmp_str); ListDriveInfo.Items.Add(invItem); tmp_str[0] = "Bytes Used"; tmp_str[1] = SysDrive.GetUsedSpace(DriveName).ToString(); invItem = new ListViewItem(tmp_str); ListDriveInfo.Items.Add(invItem); tmp_str[0] = "Bytes Free"; tmp_str[1] = SysDrive.GetFreeSpace(DriveName).ToString(); invItem = new ListViewItem(tmp_str); ListDriveInfo.Items.Add(invItem); } private void BtnRefresh_Click(object sender, EventArgs e) { BtnRefresh.Enabled = false; BtnRefresh.Text = "&Wait..."; MemoryInfoMethod(); BtnRefresh.Enabled = true; BtnRefresh.Text = "&Refresh"; } private void ListMemory_SelectedIndexChanged(object sender, EventArgs e) { if (ListMemory.SelectedItems.Count > 0) { string ProcessName = ListMemory.SelectedItems[0].SubItems[0].Text; DriveUsageChart.Series[0].Points.Clear(); string tmp_str = ListMemory.SelectedItems[0].SubItems[1].Text; tmp_str = tmp_str.Substring(0, tmp_str.Length - 1).ToString(); SectionMemory = (ulong)Math.Round((float)int.Parse(tmp_str) / 1024, 0); object[] o = new object[1]; DevExpress.XtraCharts.SeriesPoint s; MemoryUsageChart.Series[0].Points.Clear(); o[0] = TotalPageFileMemory-AppMemory; s = new DevExpress.XtraCharts.SeriesPoint("Free ", o); MemoryUsageChart.Series[0].Points.Add(s);

Page 109: BoostUp Utilities

BoostUp Utilities o[0] = AppMemory; s = new DevExpress.XtraCharts.SeriesPoint("Used", o); MemoryUsageChart.Series[0].Points.Add(s); o[0] = SectionMemory; s = new DevExpress.XtraCharts.SeriesPoint("Selection", o); MemoryUsageChart.Series[0].Points.Add(s); } } private void SystemInfoTab_SelectedPageChanged(object sender, DevExpress.XtraTab.TabPageChangedEventArgs e) { switch (SystemInfoTab.SelectedTabPageIndex) { case 0: StatusText.Caption = "Displays Overview of Computer"; break; case 1: StatusText.Caption = "Displays Information of Windows"; break; case 2: StatusText.Caption = "Displays Information of Running Process"; break; case 3: StatusText.Caption = "Displays Information of Computer Hardware"; break; case 4: StatusText.Caption = "Displays Information of Drive"; break; } } private void ListMemory_ColumnClick(object sender, ColumnClickEventArgs e) { ListView myListView = (ListView)sender; // Determine if clicked column is already the column that is being sorted. if (e.Column == lvwColumnSorter.SortColumn) { // Reverse the current sort direction for this column. if (lvwColumnSorter.Order == SortOrder.Ascending) { lvwColumnSorter.Order = SortOrder.Descending; } else { lvwColumnSorter.Order = SortOrder.Ascending; } } else { // Set the column number that is to be sorted; default to ascending. lvwColumnSorter.SortColumn = e.Column; lvwColumnSorter.Order = SortOrder.Ascending; } // Perform the sort with these new sort options. myListView.Sort(); } private void FrmSysInfo_HelpButtonClicked(object sender, CancelEventArgs e) { Help.ShowHelp(this, GetAppPath() + "BoostUp Utilities\\BoostUpHelp.chm", HelpNavigator.KeywordIndex, "System Information"); }

Page 110: BoostUp Utilities

BoostUp Utilities private string GetAppPath() { string[] s = Application.CommonAppDataPath.Split('\\'); int i = 0; for (i = 0; i < s.Length; i++) { if (s[i] == "RJM") break; } string new_str = ""; for (int j = 0; j < i; j++) { new_str += s[j] + "\\"; } return new_str; } } }

Page 111: BoostUp Utilities

BoostUp Utilities

Coding Advanced Features

using System.Runtime.InteropServices; using Microsoft.Win32; namespace AdvanceFeatures {

public partial class FrmAdvancedFeature : DevExpress.XtraBars.Ribbon.RibbonForm { [DllImport("user32.dll", CharSet = CharSet.Auto)] static extern IntPtr SendMessage(IntPtr hWnd, UInt32 Msg, IntPtr wParam, IntPtr lParam); bool State_Changed = false; RJM.RegistryInfo.RegistryTweaks RegTweak; bool IsFromContextTray = false;

public FrmAdvancedFeature() {

InitializeComponent(); this.MagnifyingGlass.DisplayUpdated += new DesktopColorPicker.MagnifyingGlass.DisplayUpdatedDelegate(this.magnifyingGlass1_DisplayUpdated); this.Deactivate += new System.EventHandler(this.GUI_Deactivate); MagnifyingGlass.UpdateTimer.Start(); MagnifyingGlass.MovingGlass.MagnifyingGlass.Click += new EventHandler(MagnifyingGlass_Click); MagnifyingGlass.MovingGlass.VisibleChanged += new EventHandler(MovingGlass_VisibleChanged); MagnifyingGlass.MovingGlass.MagnifyingGlass.BeforeMakingScreenshot += new DesktopColorPicker.MagnifyingGlass.MakingScreenshotDelegate(MagnifyingGlass_BeforeMakingScreenshot); MagnifyingGlass.MovingGlass.MagnifyingGlass.AfterMakingScreenshot += new DesktopColorPicker.MagnifyingGlass.MakingScreenshotDelegate(MagnifyingGlass_AfterMakingScreenshot);

} private void Form1_Load(object sender, EventArgs e) { GetStatus(); MagnifyingGlass.ShowPixel = true; RBtnUSBFull.Focus(); } public void GetStatus()

{ RegTweak = new RJM.RegistryInfo.RegistryTweaks(); Status_TopMost(); Status_USB(); Status_RegEdit(); Status_TaskMgr(); Status_FolderOption(); Status_CheckDrives(); Status_AutoUpdate(); Status_Brightness(); Status_CurPos(); BtnApply.Enabled = false; } public void Status_TopMost()

{ string GetValue = GetValueFromReg("TopMost"); if (GetValue == "")

this.TopMost = false; else

Page 112: BoostUp Utilities

BoostUp Utilities

{ try { this.TopMost = bool.Parse(GetValue); }

catch { } }

} public void Status_USB()

{ int tmp=RegTweak.CheckUSB(); switch (tmp) { case 1:

RBtnUSBFull.Checked = true; break; case 2: RBtnUSBReadOnly.Checked=true; break; case 3 : RBtnUSBDisabled.Checked = true; break;

} } public void Status_CurPos() { string Tmp_Value= GetValueFromReg("CurPos"); if (Tmp_Value != "") ChkShowPos.Checked = bool.Parse( Tmp_Value); MagnifyingGlass.ShowPosition = ChkShowPos.Checked; } public void Status_RegEdit() { ChkRegistry.Checked = RegTweak.CheckRegEdit(); } public void Status_TaskMgr() { ChkTaskManager.Checked = !RegTweak.CheckTaskMgr(); } public void Status_FolderOption() { ChkFolderOption.Checked = !RegTweak.CheckFolderOption(); }

public void Status_AutoUpdate() { CmbAutoUpdate.SelectedIndex = RegTweak.CheckAutomaticUpdate()-1; } public void Status_CheckDrives() { ChkLstDrives.Items.Clear();

string[] FindAllDrives = Environment.GetLogicalDrives(); for (int i = 0; i < FindAllDrives.Length; i++) ChkLstDrives.Items.Add((object)FindAllDrives[i].Substring(0, 2).Trim(' '), false); string[] s = RegTweak.GetHiddenDriveNames();

Page 113: BoostUp Utilities

BoostUp Utilities

int count = ChkLstDrives.Items.Count; if (s != null) { for (int i = 0; i < s.Length; i++) { for (int j = 0; j < ChkLstDrives.Items.Count; j++) {

if (ChkLstDrives.Items[j].ToString() == s[i]) ChkLstDrives.Items[j].CheckState = CheckState.Checked; } } } } public void Status_Brightness() { string Tmp_Get_Value = GetValueFromReg("Brightness"); TrackBarBrightness.Value = (Tmp_Get_Value == "") ? 0 : int.Parse(Tmp_Get_Value); } public void Handle_Drive() { string[] tmp_s = new string[ChkLstDrives.CheckedItems.Count]; for (int i = 0; i < ChkLstDrives.CheckedItems.Count; i++) { tmp_s[i] = ChkLstDrives.CheckedItems[i].ToString().Substring(0, 1); } RegTweak.HideDrives(tmp_s); } private void BtnLeave_Click(object sender, EventArgs e) { SetValueToReg("Brightness", TrackBarBrightness.Value.ToString()); this.Dispose(); } private void BtnApply_Click(object sender, EventArgs e) { if (State_Changed == true) { // USB if(RBtnUSBFull.Checked==true) { RegTweak.EnableUSB(); RegTweak.DisableWriteProtectUSB(); } else if(RBtnUSBReadOnly.Checked==true) { RegTweak.EnableUSB(); RegTweak.EnableWriteProtectUSB(); } else if (RBtnUSBDisabled.Checked == true) { RegTweak.DisableUSB(); } // Registry Editor if (ChkRegistry.Checked == true) RegTweak.DisableRegedit(); else RegTweak.EnableRegedit();

Page 114: BoostUp Utilities

BoostUp Utilities // Task Manager if (ChkTaskManager.Checked == true) RegTweak.DisableTaskMgr(); else RegTweak.EnableTaskMgr(); // Folder Option if (ChkFolderOption.Checked == true) RegTweak.DisableFolderOption(); else RegTweak.EnableFolderOption(); //Brightness SetValueToReg("Brightness", TrackBarBrightness.Value.ToString()); // Drives string[] temp_s=new string[ChkLstDrives.CheckedItems.Count]; for (int i = 0; i < ChkLstDrives.CheckedItems.Count; i++) { temp_s[i] = ChkLstDrives.CheckedItems[i].ToString().Substring(0,1); } RegTweak.HideDrives(temp_s); // Automatic Update RegTweak.AutomaticUpdate(CmbAutoUpdate.SelectedIndex + 1);

DevExpress.XtraEditors.XtraMessageBox.Show("Settings have been successfully applied. Please Logoff your system", "Extra Feature : Settings ", MessageBoxButtons.OK, MessageBoxIcon.Information);

if (DevExpress.XtraEditors.XtraMessageBox.Show("Would you like to Logoff your system now ? ", "Extra

Feature : Logoff", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { System.Diagnostics.Process.Start(new ProcessStartInfo("shutdown.exe", "/l")); this.Dispose(); } else { State_Changed = false; BtnApply.Enabled = false; } } private void BtnTurnOff_Click(object sender, EventArgs e) { SendMessage((IntPtr)0xFFFF, (uint)0x0112, (IntPt)0xF170, (IntPtr)2); } private void trackBar1_Scroll(object sender, EventArgs e) { RJM.Monitor.Brightness.SetBrightness((short)TrackBarBrightness.Value); StateChanged(); } //////////////////////////////////////////////////////////// MAGNIFY GLASS //////////////////////////////////////////////////////////////////////// private void MovingGlass_VisibleChanged(object sender, EventArgs e) { // Make this not the top window if the moving glass is shown because it will hide the glass display otherwise TopMost = !MagnifyingGlass.MovingGlass.Visible; }

Page 115: BoostUp Utilities

BoostUp Utilities private void MagnifyingGlass_Click(object sender, EventArgs e) { // Select the color trough the moving glass } private void magnifyingGlass1_DisplayUpdated(DesktopColorPicker.MagnifyingGlass sender) { // Update the current color preview panels background color Color c = new Color(); c= MagnifyingGlass.PixelColor; PanelCurrentRGB.BackColor = c; LblCurrR.Text = "Red : "+c.R.ToString(); LblCurrG.Text = "Green : "+c.G.ToString(); LblCurrB.Text = "Blue : "+c.B.ToString(); } private void MagnifyingGlass_AfterMakingScreenshot(object sender) { Show(); } private void MagnifyingGlass_BeforeMakingScreenshot(object sender) { Hide(); } private void ChkLstDrives_ItemCheck(object sender, DevExpress.XtraEditors.Controls.ItemCheckEventArgs e) { StateChanged(); } private void ChkShowPos_CheckedChanged(object sender, EventArgs e) { StateChanged(); MagnifyingGlass.ShowPosition = ChkShowPos.Checked; SetValueToReg("CurPos", ChkShowPos.Checked.ToString()); } private string GetValueFromReg(string Value) { Microsoft.Win32.RegistryKey tmp_r; tmp_r = Microsoft.Win32.Registry.LocalMachine.OpenSubKey("Software\\BoostUp Utilities\\Advanced Features", true); if (tmp_r != null) { object tmp_get_value = tmp_r.GetValue(Value); if (tmp_get_value != null) return tmp_get_value.ToString(); else return ""; } return ""; } private void SetValueToReg(string Key, string Value) { Microsoft.Win32.RegistryKey r = Microsoft.Win32.Registry.LocalMachine; r = r.OpenSubKey("Software", true); Microsoft.Win32.RegistryKey tmp_r; tmp_r = r; r = r.OpenSubKey("BoostUp Utilities", true); if (r == null) { tmp_r.CreateSubKey("BoostUp Utilities"); r = tmp_r.OpenSubKey("BoostUp Utilities", true); } tmp_r=r; r = r.OpenSubKey("Advanced Features", true);

Page 116: BoostUp Utilities

BoostUp Utilities if (r == null) { tmp_r.CreateSubKey("Advanced Features"); r = tmp_r.OpenSubKey("Advanced Features",true); } r.SetValue(Key,Value); r.Close(); } private void openBoostUpAdvancedFeaturesToolStripMenuItem_Click(object sender, EventArgs e) { IsFromContextTray = true; this.Visible = true; NotifyTray.Visible = !this.Visible; this.WindowState = FormWindowState.Normal; } private void FrmAdvancedFeature_Resize(object sender, EventArgs e) { if (!IsFromContextTray) { try { this.Visible = !bool.Parse(GetValueFromReg("SystemTray")); NotifyTray.Visible =bool.Parse( GetValueFromReg("SystemTray")); } catch { } } IsFromContextTray = false; } private void leaveToolStripMenuItem_Click(object sender, EventArgs e) { this.Dispose(); } private void NotifyTray_DoubleClick(object sender, EventArgs e) { openBoostUpAdvancedFeaturesToolStripMenuItem_Click(null, null); } private void FrmAdvancedFeature_HelpButtonClicked(object sender, System.ComponentModel.CancelEventArgs e) { Help.ShowHelp(this, GetAppPath() + "BoostUp Utilities\\BoostUpHelp.chm", HelpNavigator.KeywordIndex, "Advanced Features"); } private string GetAppPath() { string []s=Application.CommonAppDataPath.Split('\\'); int i = 0; for (i = 0; i < s.Length; i++) { if (s[i] == "RJM") break; } string new_str=""; for (int j = 0; j < i; j++) { new_str += s[j]+"\\"; } return new_str; }

Page 117: BoostUp Utilities

BoostUp Utilities

Conclusion

“Vision without Action is Dream, Action without Vision is Time pass But Action with Vision can change the world”

“Success is the ABC – Ability, Breaks and Courage”

“Success is a Process, Not a Destination”

“To get profit without risk, experience without danger, and reward

without hard work, is as impossible as it is to live without being born”

Page 118: BoostUp Utilities

BoostUp Utilities

Bibliography

Pro WPF in C# 2008 – Matthew MacDonald

C# .Net Programming Black Book – Steven Holzner

C# the Complete Reference – McGraw Hill

Online Help -

www.msdn.microsoft.com www.codeproject.com www.c-sharpcorner.com www.pinvoke.net www.stackoverflow.com