Пример #1
0
        public LauncherApp()
        {
            clock = Stopwatch.StartNew();

            // TODO: Add a way to clear the cache more othen than the default nuget (>= 200 files)

            // Check config file
            DebugStep("Load store");

            // Get the package name and executable to launch/update
            var thisExeDirectory = Path.GetDirectoryName(typeof(LauncherApp).Assembly.Location);

            store = new NugetStore(thisExeDirectory);
            store.Manager.Logger          = this;
            store.SourceRepository.Logger = this;

            mainPackage = store.Settings.GetConfigValue(MainPackageKey);
            if (string.IsNullOrWhiteSpace(mainPackage))
            {
                throw new LauncherAppException("Invalid configuration. Expecting [{0}] in config", MainPackageKey);
            }
            store.DefaultPackageId = mainPackage;

            mainExecutable = store.Settings.GetConfigValue(MainExecutableKey);
            if (string.IsNullOrWhiteSpace(mainExecutable))
            {
                throw new LauncherAppException("Invalid configuration. Expecting [{0}] in config", MainExecutableKey);
            }

            var aggregateRepo = (AggregateRepository)store.Manager.SourceRepository;

            foreach (var repo in aggregateRepo.Repositories)
            {
                var progressProvider = repo as IProgressProvider;
                if (progressProvider != null)
                {
                    progressProvider.ProgressAvailable += OnProgressAvailable;
                }
            }

            downloadThreads = new List <Thread>();

            // Update the targets everytime the launcher is used in order to make sure targets are up-to-date
            // with packages installed (rewrite for example after a self-update)
            store.UpdateTargets();
        }
Пример #2
0
 private static bool CreateTargetFilesIfMissing(NugetStore store)
 {
     // If target files doesn't exist, create it
     if (!File.Exists(store.TargetFile) || !File.Exists(store.TargetFileOld))
     {
         try
         {
             store.UpdateTargets();
         }
         catch
         {
             // TODO: localize
             Launcher.DisplayError("Target file was missing and couldn't be updated. Please re-install Xenko");
             return(false);
         }
     }
     return(true);
 }