Lancelotlink's Profile User Rating: -----

Reputation: 0 Apprentice
Group:
New Members
Active Posts:
3 (0 per day)
Joined:
04-October 12
Profile Views:
120
Last Active:
User is offline Oct 05 2012 08:30 AM
Currently:
Offline

Previous Fields

Dream Kudos:
0
Icon   Lancelotlink has not set their status

Posts I've Made

  1. In Topic: C# webclient Issue

    Posted 5 Oct 2012

    View PostJackOfAllTrades, on 05 October 2012 - 06:01 AM, said:

    Writing to Program Files requires elevated permissions. Are you running as Administrator? Does the file exist already?


    I'm admin on the computer but I haven't added a manifest requiring elevated permissions. I can add that. Yes, the file does already exist.
  2. In Topic: C# webclient Issue

    Posted 4 Oct 2012

    View PostSkydiver, on 04 October 2012 - 12:57 PM, said:

    Get rid of that goto. You can accomplish the same thing using a while or do-while loop.

    Then is no need to call Application.Exit(). Your program will exit by itself after the finally clause.

    What is the exact error you are getting when you instantiate the WebClient object?

    And I'd rather not bare with you. My preferences are towards the opposite sex and I'd rather bare with them. Unfortunately, my significant other has claimed exclusive rights so I'm only allow to bare with her. On the other hand, I am willing to bear with you.



    Yes, please "bear" with me as I'm not interested in you "baring" anything for me whatsoever. Keep that :bananaman: to your wife please.

    Are you suggesting something along the lines of this?
    using System;
    	using System.Linq;
    	using System.IO;
    	using System.Net;
    	using System.Windows.Forms;
    	using System.Diagnostics;
    	 
    	namespace Config_Updater
    	{
    	    class Program
    	    {
    	        [STAThread]
    	        static void Main(string[] args)
    	        {
    	            Uri uri = new Uri("https://myupdatedconfigfile.com");
    
    	            string filename = @"C:\Program Files\OpenVPN\config";
    	            {
    	            begin:
    	                Process[] pname = Process.GetProcessesByName("OpenVPN"); 
    	 
    	                if (pname.Length == 1)
    	                {
    	                    //string processName = "OpenVPN";
    	 
    	                    foreach (Process proc in Process.GetProcessesByName("OpenVPN"))
    	                        proc.Kill();
    	                    While(process.exist = true)
                                {
                                Thread.Sleep(10);
                                }
    	                    try
    	                    {
    	                    if (File.Exists(filename))
    	                    {
    	                        File.Delete(filename);
    	                    }
    	                    else
    	                    {
    	                        WebClient wc = new WebClient();
    	                        wc.DownloadFile(uri, filename);
    	                     }
    	                 finally
    	              }
    	            }
    	          }
    

    As for the exact error msg I'll post it up shortly once I get back in front of my computer with Visual Studio on it. I'm working through notepad at the moment.

My Information

Member Title:
New D.I.C Head
Age:
Age Unknown
Birthday:
Birthday Unknown
Gender:

Contact Information

E-mail:
Private

Friends

Lancelotlink hasn't added any friends yet.

Comments

Lancelotlink has no profile comments yet. Why not say hello?