Ejemplo n.º 1
0
 private void UpdateInstallations(RealmDownloadConfig[] configs)
 {
     RiotAccount[] all = Instances.AccountBag.GetAll();
     IEnumerable<string> strs = (
         from account in (IEnumerable<RiotAccount>)all
         where !account.IsBlocked
         select account.RealmId).Distinct<string>().Where<string>(new Func<string, bool>(this.CanUpdate));
     RealmDownloadConfig[] array = (
         from x in configs
         where strs.Any<string>((string y) => y.Equals(x.RealmId, StringComparison.OrdinalIgnoreCase))
         select x).ToArray<RealmDownloadConfig>();
     RealmDownloadConfig[] realmDownloadConfigArray = array;
     for (int i = 0; i < (int)realmDownloadConfigArray.Length; i++)
     {
         RealmDownloadConfig realmDownloadConfig = realmDownloadConfigArray[i];
         string str = Path.Combine(LaunchData.RiotContainerDirectory, this.GetGameInstallationDirectory(realmDownloadConfig.RealmId));
         string str1 = Path.Combine(str, "rads");
         string temporaryFolder = LaunchData.GetTemporaryFolder("league-update");
         RealmDownloadParameter[] realmDownloadParameter = new RealmDownloadParameter[] { new RealmDownloadParameter("rads-directory", str1), new RealmDownloadParameter("temporary-directory", temporaryFolder) };
         RealmDownloadParameter[] realmDownloadParameterArray = realmDownloadParameter;
         RealmDownloadParameter[] array1 = realmDownloadParameterArray.Concat<RealmDownloadParameter>(realmDownloadConfig.Parameters).ToArray<RealmDownloadParameter>();
         string[] strArrays = (
             from x in (IEnumerable<RealmDownloadParameter>)array1
             select string.Format("{0}:{1}", x.Name, x.Value)).ToArray<string>();
         this.DoLocalUpdate(realmDownloadConfig.RealmId, strArrays);
     }
 }
 private void UpdateInstallations(RealmDownloadConfig[] configs)
 {
   IEnumerable<string> nonBusyRealms = Enumerable.Where<string>(Enumerable.Distinct<string>(Enumerable.Select<RiotAccount, string>(Enumerable.Where<RiotAccount>((IEnumerable<RiotAccount>) Instances.AccountBag.GetAll(), (Func<RiotAccount, bool>) (account => !account.IsBlocked)), (Func<RiotAccount, string>) (account => account.RealmId))), new Func<string, bool>(this.CanUpdate));
   foreach (RealmDownloadConfig realmDownloadConfig in Enumerable.ToArray<RealmDownloadConfig>(Enumerable.Where<RealmDownloadConfig>((IEnumerable<RealmDownloadConfig>) configs, (Func<RealmDownloadConfig, bool>) (x => Enumerable.Any<string>(nonBusyRealms, (Func<string, bool>) (y => y.Equals(x.RealmId, StringComparison.OrdinalIgnoreCase)))))))
   {
     string[] arguments = Enumerable.ToArray<string>(Enumerable.Select<RealmDownloadParameter, string>((IEnumerable<RealmDownloadParameter>) Enumerable.ToArray<RealmDownloadParameter>(Enumerable.Concat<RealmDownloadParameter>((IEnumerable<RealmDownloadParameter>) new RealmDownloadParameter[2]
     {
       new RealmDownloadParameter("rads-directory", Path.Combine(Path.Combine(LaunchData.RiotContainerDirectory, this.GetGameInstallationDirectory(realmDownloadConfig.RealmId)), "rads")),
       new RealmDownloadParameter("temporary-directory", LaunchData.GetTemporaryFolder("league-update"))
     }, (IEnumerable<RealmDownloadParameter>) realmDownloadConfig.Parameters)), (Func<RealmDownloadParameter, string>) (x => string.Format("{0}:{1}", (object) x.Name, (object) x.Value))));
     this.DoLocalUpdate(realmDownloadConfig.RealmId, arguments);
   }
 }
Ejemplo n.º 3
0
 private void RemoveUnusedInstallations(RealmDownloadConfig[] configs)
 {
     string[] array = (
         from x in configs
         select this.GetGameInstallationDirectory(x.RealmId)).ToArray<string>();
     DirectoryInfo[] directories = (new DirectoryInfo(LaunchData.RiotContainerDirectory)).GetDirectories("league#*");
     for (int i = 0; i < (int)directories.Length; i++)
     {
         DirectoryInfo directoryInfo = directories[i];
         string name = directoryInfo.Name;
         if (!array.Any<string>((string x) => name.Equals(x, StringComparison.OrdinalIgnoreCase)))
         {
             try
             {
                 directoryInfo.Delete(true);
             }
             catch
             {
             }
         }
     }
 }
 private void RemoveUnusedInstallations(RealmDownloadConfig[] configs)
 {
   string[] strArray = Enumerable.ToArray<string>(Enumerable.Select<RealmDownloadConfig, string>((IEnumerable<RealmDownloadConfig>) configs, (Func<RealmDownloadConfig, string>) (x => this.GetGameInstallationDirectory(x.RealmId))));
   foreach (DirectoryInfo directoryInfo in new DirectoryInfo(LaunchData.RiotContainerDirectory).GetDirectories("league#*"))
   {
     string directoryName = directoryInfo.Name;
     if (!Enumerable.Any<string>((IEnumerable<string>) strArray, (Func<string, bool>) (x => directoryName.Equals(x, StringComparison.OrdinalIgnoreCase))))
     {
       try
       {
         directoryInfo.Delete(true);
       }
       catch
       {
       }
     }
   }
 }