Ejemplo n.º 1
0
 void DownloadStringCompleted(Object sender, DownloadStringCompletedEventArgs e)
 {
     availableAddOns = new AddOnSet(false);
     if (!e.Cancelled)
     {
         if (e.Error != null)
         {
             MessageBox.Show("Can't connect to server c-evo.org!\nOnly limited options will be available.", "No Internet Connection",
                             MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
         }
         else
         {
             try
             {
                 availableAddOns.AddXML(e.Result);
             }
             catch (Exception)
             {
                 MessageBox.Show("Error reading file 'index.xml'!", "Error");
             }
         }
     }
     downloader.DownloadStringCompleted -= DownloadStringCompleted;
     RaiseComplete();
 }
Ejemplo n.º 2
0
        static Installer()
        {
            programFolder = Path.GetDirectoryName(Application.ExecutablePath);
            appDataFolder = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);
            if (appDataFolder == "")
            {
                appDataFolder = programFolder;
            }
            else
            {
                appDataFolder += "\\C-evo";
                if (!Directory.Exists(appDataFolder))
                {
                    Directory.CreateDirectory(appDataFolder);
                }
            }

            downloadFolder = Path.GetTempPath().TrimEnd('\\');
            if (downloadFolder == "")
            {
                downloadFolder = appDataFolder + "\\Temp";
                if (!Directory.Exists(downloadFolder))
                {
                    Directory.CreateDirectory(downloadFolder);
                }
            }

            installedAddOns = new AddOnSet(true);
            if (File.Exists(appDataFolder + "\\addons.xml"))
            {
                try
                {
                    installedAddOns.AddXML(File.ReadAllText(appDataFolder + "\\addons.xml"));
                }
                catch (Exception)
                {
                    MessageBox.Show("Error reading file 'addons.xml' from AppData folder!", "Error");
                }
            }
            if (File.Exists(programFolder + "\\addons.xml"))
            {
                try
                {
                    installedAddOns.AddXML(File.ReadAllText(programFolder + "\\addons.xml"));
                }
                catch (Exception)
                {
                    MessageBox.Show("Error reading file 'addons.xml' from program folder!", "Error");
                }
            }
        }
Ejemplo n.º 3
0
 public void SetData(AddOnSet installed, AddOnSet available, AddOnType type)
 {
     this.type = type;
     foreach (AddOn addOn in installed)
     {
         if (addOn.Type == type)
         {
             AddListItem(addOn);
             AddOn current = available.Find(addOn);
             if (current != null && current.Version > addOn.Version)
             {
                 AddListItem(current);
             }
         }
     }
     foreach (AddOn addOn in available)
     {
         if (addOn.Type == type && installed.Find(addOn) == null)
         {
             AddListItem(addOn);
         }
     }
     enabled = Installer.CanInstall(type, out disabledMessage);
 }
Ejemplo n.º 4
0
 public void Uninstall(AddOnSet set)
 {
     uninstallSet.AddRange(set);
 }
Ejemplo n.º 5
0
 public void Install(AddOnSet set)
 {
     installSet.AddRange(set);
 }