• Visit Rebornbuddy
  • Auto updater for CC by erenion

    Discussion in 'Archives' started by bossland, Jan 18, 2010.

    1. bossland

      bossland Administrator

      Joined:
      Jan 15, 2010
      Messages:
      14,882
      Likes Received:
      259
      Trophy Points:
      146
      I wrote an auto-updater for ePriest. Feel free to use it for all your CCs. My only requirement is it is turned off by default and users must be told that is turned off by default (to avoid headaches for Hawker and Bossland). This means that this function doesn't get called (no WebClient created). Please also include that it will be accessing your website (so that people know you may be able to track their IP etc).

      Code:
              private void autoUpdate()//Created by erenion
              {
                  try
                  {
                      string fileUrl = "http://www.gliderapps.com/ePriest/Priest.cs";
                      string localFile = "./CustomClasses/Priest.cs";
                      WebClient wc = new WebClient();
                      FileStream fs = new FileStream(localFile, FileMode.OpenOrCreate);
                      long localFileLength = fs.Length;
                      fs.Close();
                      if (wc.DownloadData(fileUrl).Length != localFileLength)
                      {
                          wc.DownloadFile(fileUrl, localFile);
                      }
                  }
                  catch
                  { 
                  }
      
              }
      Erenion
       
    2. erenion

      erenion DEVELOPER Buddy Core Dev

      Joined:
      Jan 15, 2010
      Messages:
      321
      Likes Received:
      6
      Trophy Points:
      0
      Keep in mind it only works for CCs that don't have a config inside the file as it checks file size.
       
    3. nET

      nET Member

      Joined:
      Jan 15, 2010
      Messages:
      77
      Likes Received:
      0
      Trophy Points:
      6
      Also shouldnt work with dll's cus they are write protected... know this from experience give its a restart every upgrade :(

      Would need to do a Get (with different name) then forced restart and a delete on old version or something wierd, all in all not advisable
       

    Share This Page