Search Results

Search found 14 results on 1 pages for 'nightsevil'.

Page 1/1 | 1 

  • delete all files and folders in multiple directory but leave the directoy

    - by NightsEVil
    well i like this nice of code right here it seems to work awsome but i cant seem to add any more directories to it DirectoryInfo dir = new DirectoryInfo(@"C:\temp"); foreach(FileInfo files in dir.GetFiles()) { files.Delete(); } foreach (DirectoryInfo dirs in dir.GetDirectories()) { dirs.Delete(true); } i would also like to add in special folders aswell like History and cookies and such how would i go about doing that (i would like to include atleast 4-5 different folders)

    Read the article

  • C# delete all files and folders in multiple directory but leave the directoy

    - by NightsEVil
    well i like this nice of code right here it seems to work awsome but i cant seem to add any more directories to it { DirectoryInfo dir = new DirectoryInfo(@"C:\temp"); foreach(FileInfo files in dir.GetFiles()) { files.Delete(); } foreach (DirectoryInfo dirs in dir.GetDirectories()) { dirs.Delete(true); } } i would also like to add in special folders aswell like History and cookies and such how would i go about doing that (i would like to include atleast 4-5 different folders)

    Read the article

  • How to Make my application handle Errors for a few different scenarios?

    - by NightsEVil
    so i have this code to extract a program to the temp directory then run it, the problem is it doesn't work perfectly on every computer (for some reason it hits a error or exception sometimes) string tempFolder = System.IO.Path.Combine(System.IO.Path.GetTempPath(), ""); System.Diagnostics.Process defrag1 = System.Diagnostics.Process.Start(@"Programs\Optimize\AusLogics_Defrag.exe", string.Format(" -o{0} -y", tempFolder)); defrag1.WaitForExit(); string executableDirectoryName = Path.GetDirectoryName(Application.ExecutablePath); System.Diagnostics.Process defrag2 = System.Diagnostics.Process.Start(tempFolder + "\\" + "AusLogics_Defrag" + "\\" + "DiskDefrag.exe", ""); defrag2.WaitForExit(); System.IO.Directory.Delete(tempFolder + "\\" + "AusLogics_Defrag", true); and what i wanna know is there a way that say if it starts to extract but hits a error (no matter what it is) it will automatically change and go to this code, but if it DOESN'T hit a error it continues as it was meant to? string tempFolder = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData); System.Diagnostics.Process defrag1 = System.Diagnostics.Process.Start(@"Programs\Optimize\AusLogics_Defrag.exe", string.Format(" -o{0} -y", tempFolder)); defrag1.WaitForExit(); string executableDirectoryName = Path.GetDirectoryName(Application.ExecutablePath); System.Diagnostics.Process defrag2 = System.Diagnostics.Process.Start(tempFolder + "\\" + "AusLogics_Defrag" + "\\" + "DiskDefrag.exe", ""); defrag2.WaitForExit(); System.IO.Directory.Delete(tempFolder + "\\" + "AusLogics_Defrag", true); with the path going to the application data folder? and if THAT hits a error it would change that path to this, but if it DOESN'T hit a error it continues as it was meant to? string tempFolder = System.Environment.GetEnvironmentVariable("HomeDrive");

    Read the article

  • in c# a label that displays info, then when clicked it opens firefox and searches for the info displ

    - by NightsEVil
    hey i have a label that displays graphics card name and make and stuff and i'm working on having it so that when its clicked, it opens Firefox and searches Google for the info found by "name" i tried using let met Google that for you but it searches for like each work individually well this is what iv tried so far and it kinda works but there's something wrong private void label13_Click(object sender, EventArgs e) { ManagementObjectSearcher Vquery = new ManagementObjectSearcher("SELECT * FROM Win32_VideoController"); ManagementObjectCollection Vcoll = Vquery.Get(); foreach (ManagementObject mo in Vcoll) { System.Diagnostics.Process CcleanerA = System.Diagnostics.Process.Start(@"C:\Program Files (x86)\Mozilla Firefox\firefox.exe", "http://google.com/?q="+(mo["name"].ToString())); } }

    Read the article

  • errors when trying to delete a key in the registry

    - by NightsEVil
    i'm trying to delete a registry from the Local_Machine\Software in the registry i made a key titles "DeleteMe" as a test to try it out but i cant get it to work iv tried multiple options and they all say that the "subkey" "subkeytree" and "value" do not exist BUT IT DOES! and i hope i'm using the right terminology here to its HKEY_LOCAL_MACHINE\SOFTWARE\DeleteMe i want it and all the sub keys/values deleted.. (i hope key is the right terminology they look just like folders but when right clicked on they have the option "copy key name")

    Read the article

  • how do i check if multiple folders exist if so delete them on button click?

    - by NightsEVil
    hi i have a few folders created by my application and id like that when they click a button named "clean up" that it would check to see if any of the predetermined folders exist, if they do then delete them, this is what i have tried so far whats wrong with it? string tempFolder = Environment.GerFolderPath(Environment.SpecialFolder.ApplicationData); if (Directory.Exists(tempFolder + "//" + "temp1")) if (Directory.Exists(tempFolder + "//" + "temp2")) if (Directory.Exists(tempFolder + "//" + "temp3")) if (Directory.Exists(tempFolder + "//" + "temp4")) { System.IO.Directory.Delete(tempFolder + "\\" + "temp1", true); System.IO.Directory.Delete(tempFolder + "\\" + "temp2", true); System.IO.Directory.Delete(tempFolder + "\\" + "temp3", true); System.IO.Directory.Delete(tempFolder + "\\" + "temp4", true); } else { MessageBox.Show("No Cleanup Needed"); } so whats wrong? i tested it and it seemed to with 2 folder but not 4 or more

    Read the article

  • in Visual C# 2010 express what is the most reliable way to detect windows OS Architecture (x86,x64)

    - by NightsEvil
    i am using Visual C# 2010 express and i need the most reliable way (on button click) and in .NET 2.0 framework to detect if windows is currently x86 or x64 in a message box.. up till now i have been using this code but i need to know if there is a more accurate way? string target = @"C:\Windows\SysWow64"; { if (Directory.Exists(target)) { MessageBox.Show("x64"); } else { MessageBox.Show("x86"); }

    Read the article

  • What is the most reliable way to detect windows OS Architecture (x86,x64) on .NET 2.0

    - by NightsEvil
    i am using Visual C# 2010 express and i need the most reliable way (on button click) and in .NET 2.0 framework to detect if windows is currently x86 or x64 in a message box.. up till now i have been using this code but i need to know if there is a more accurate way? string target = @"C:\Windows\SysWow64"; { if (Directory.Exists(target)) { MessageBox.Show("x64"); } else { MessageBox.Show("x86"); }

    Read the article

  • label to display graphics card or total system ram through registry possibly?

    - by NightsEVil
    hi all i have this great code that i love that will display the kind of processor model and speed like so RegistryKey Rkey = Registry.LocalMachine; Rkey = Rkey.OpenSubKey("HARDWARE\\DESCRIPTION\\System\\CentralProcessor\\0"); Labelproc.Text = (string)Rkey.GetValue("ProcessorNameString"); and i was wondering if theres a way to do this for the kind of graphics card and the total installed system ram (in separate labels)

    Read the article

  • C# if no error contiune.. if error occurse do else

    - by NightsEVil
    hi i have a question i have some code that works good on like 70% of the computers i use it on but.. for some reason theres a few that are pesky and id like to do something like this (keep in mind this is a hypothetical) private void test_click(object sender, EventArgs e) { MessageBox.Show("hi"); //if it works ok without a error it continues to MessageBox.Show("worked ok"); //if it encountered a error of some kind it would go to MessageBox.Show("DID NOT WORK OK"); }

    Read the article

  • in Virtual C# 2010 express what is the most reliable way to detect windows OS Architecture (x86,x64)

    - by NightsEvil
    hi i am using Virtual C# 2010 express and i need the most reliable way (on button click) and in .NET 2.0 framework to detect if windows is currently x86 or x64 in a message box.. up till now i have been using this code but i need to know if there is a more accurate way? string target = @"C:\Windows\SysWow64"; { if (Directory.Exists(target)) { MessageBox.Show("x64"); } else { MessageBox.Show("x86"); }

    Read the article

  • .NET 2.0 Framework in C# check if 64bit os if so do this? if not do this? better answer?

    - by NightsEVil
    hi i have this little snippet of code i wrote that checks to see if a folder is present (only exists in x64) if so it does "X" commands, if not (i.e x86) does "Z" commands (x,Z are just markers for code) but what i wanna know is there a better or more reliable way to do this using only the 2.0 .net Framework? string target = @"C:\Windows\SysWow64"; { if (Directory.Exists(target)) { //do x64 stuff } else { //do x86 stuff }

    Read the article

1