internal static void DownloadExpansion(Expansion expansion) { List<Expansion> expansions; if (!downloadingExpansions.TryGetValue(expansion.Id, out expansions)) { expansions = new List<Expansion>(); downloadingExpansions[expansion.Id] = expansions; } expansions.Add(expansion); Plugin.DownloadExpansion(expansion); }
public static bool DeleteExpansion(Expansion expansion) { return Plugin.DeleteExpansion(expansion); }
internal static void RaiseExpansionsToUpdate(Expansion[] expansions) { if (OnExpansionsToUpdate != null) { OnExpansionsToUpdate(expansions); } }
internal static void RaiseServerExpansions(Expansion[] expansions) { if (OnServerExpansions != null) { OnServerExpansions(expansions); } }
internal static void RaiseExpansion(Expansion expansion) { if (OnExpansion != null) { OnExpansion(expansion); } }
private void ShowExpansions(string tag, Expansion[] expansions) { if (expansions == null) { SetStatus("No expansions"); } var names = string.Join(", ", (from e in expansions select string.Format("{0}(id={1} v={2}]", e.Name, e.Id, e.Version)).ToArray()); SetStatus(string.Format("{0} {1} expansions: {2}", expansions.Length, tag, names)); }
private void OnExpansionDownloaded(bool success) { SetStatus("Expansion downloaded: " + success); downloadingExpansion.IsDownloaded = success; downloadingExpansion.OnProgress -= OnExpansionProgress; downloadingExpansion.OnDownloaded -= OnExpansionDownloaded; downloadingExpansion = null; }
private void DownloadFirstServerExpansionWithProgress() { if (serverExpansions != null && serverExpansions.Length > 0) { if (downloadingExpansion != null) { SetStatus("Another expansion is downloading. Please wait"); } else { downloadingExpansion = serverExpansions.FirstOrDefault(e => !e.IsDownloaded); if (downloadingExpansion == null) { SetStatus("All server expansions downloaded"); } else { SetStatus("Downloading started..."); downloadingExpansion.OnDownloaded += OnExpansionDownloaded; downloadingExpansion.OnProgress += OnExpansionProgress; downloadingExpansion.Download(); } } } else { SetStatus("No available server expansions. Try to get server expansions."); } }
public Usage(Expansion expansion) { Expansion = expansion; }