示例#1
0
        public PredefinedMods()
        {
            if (_log.IsDebugEnabled)
            {
                _log.DebugFormat("Starting {0}", MethodBase.GetCurrentMethod().ToString());
            }
            Definitions = new ObservableCollection <ModConfiguration>();


            foreach (ModConfiguration config in ModManagement.GetPredefinedMods().Values)
            {
                AppendConfig(config);
            }



            InitializeComponent();
            if (Definitions.Count < 1)
            {
                this.Visibility = System.Windows.Visibility.Collapsed;
            }
            if (_log.IsDebugEnabled)
            {
                _log.DebugFormat("Ending {0}", MethodBase.GetCurrentMethod().ToString());
            }
        }
        private void ModUninstalled(object sender, RoutedEventArgs e)
        {
            //if (_log.IsDebugEnabled) { _log.DebugFormat("Starting {0}", MethodBase.GetCurrentMethod().ToString()); }
            //Only if a pre-defined mod.

            ModConfiguration mod = e.OriginalSource as ModConfiguration;

            if (ModManagement.GetPredefinedMods().ContainsKey(mod.ID))
            {
                predefinedMods.AppendConfig(mod);
            }
            //if (_log.IsDebugEnabled) { _log.DebugFormat("Ending {0}", MethodBase.GetCurrentMethod().ToString()); }
        }
示例#3
0
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            string             id    = null;
            string             title = string.Empty;
            IList <StringItem> l     = value as IList <StringItem>;

            if (l != null)
            {
                if (l.Count > 0)
                {
                    id = l[0].Text;
                }
            }
            else
            {
                id = value as string;
            }


            if (!string.IsNullOrEmpty(id))
            {
                title = AMLResources.Properties.Resources.DependsOnNotInstalled;
                bool found = false;
                foreach (ModConfiguration config in InstalledModConfigurations.Current.Configurations.Configurations)
                {
                    if (config.ID == id)
                    {
                        title = string.Format(CultureInfo.CurrentCulture, AMLResources.Properties.Resources.DependsOn, config.Title);
                        found = true;
                        break;
                    }
                }
                if (!found)
                {
                    foreach (ModConfiguration configID in ModManagement.GetPredefinedMods().Values)
                    {
                        if (configID.ID == id)
                        {
                            found = true;
                            title = string.Format(CultureInfo.CurrentCulture, AMLResources.Properties.Resources.DependsOn, configID.Title);
                            break;
                        }
                    }
                }
            }

            return(title);
        }
示例#4
0
 private void TestAllDownloads()
 {
     TestConfigs = new List <ModConfiguration>();
     foreach (ModConfiguration config in ModManagement.GetPredefinedMods().Values)
     {
         if (config.ID != DataStrings.StockID)
         {
             if (!string.IsNullOrEmpty(config.Download.Source))
             {
                 if (ModManagement.StartDownload(config))
                 {
                     TestConfigs.Add(config);
                 }
             }
         }
     }
     //ModManagement.Downloaded -= new EventHandler<System.ComponentModel.AsyncCompletedEventArgs>(ModManagement_Downloaded);
     //ModManagement.DownloadFailed -= new EventHandler<System.ComponentModel.AsyncCompletedEventArgs>(ModManagement_DownloadFailed);
 }