Beispiel #1
0
 public BillerFactory(IResourceLoader resourceLoader, Uniject.ILogger logger,
                      IStorage storage, IRawBillingPlatformProvider platformProvider,
                      UnibillConfiguration config, IUtil util, IUnityAnalytics analytics)
 {
     this.loader           = resourceLoader;
     this.logger           = logger;
     this.storage          = storage;
     this.platformProvider = platformProvider;
     this.config           = config;
     this.util             = util;
     this.analytics        = analytics;
 }
 public GooglePlayBillingService(IRawGooglePlayInterface rawInterface,
                                 UnibillConfiguration config,
                                 ProductIdRemapper remapper,
                                 Uniject.ILogger logger)
 {
     this.rawInterface = rawInterface;
     this.publicKey    = config.GooglePlayPublicKey;
     this.remapper     = remapper;
     this.db           = config;
     this.logger       = logger;
     #if UNITY_ANDROID
     this.cryptoProvider = PEMKeyLoader.CryptoServiceProviderFromPublicKeyInfo(publicKey);
     #endif
 }
 public RemoteConfigManager(IResourceLoader loader, IStorage storage, Uniject.ILogger logger, RuntimePlatform platform, List <ProductDefinition> runtimeProducts = null)
 {
     this.storage  = storage;
     logger.prefix = "Unibill.RemoteConfigManager";
     this.XML      = loader.openTextFile("unibillInventory.json").ReadToEnd();
     Config        = new UnibillConfiguration(XML, platform, logger, runtimeProducts);
     if (Config.UseHostedConfig)
     {
         string val = storage.GetString(CACHED_CONFIG_PATH, string.Empty);
         if (string.IsNullOrEmpty(val))
         {
             logger.Log("No cached config available. Using bundled");
         }
         else
         {
             logger.Log("Cached config found, attempting to parse");
             try {
                 Config = new UnibillConfiguration(val, platform, logger, runtimeProducts);
                 if (Config.inventory.Count == 0)
                 {
                     logger.LogError("No purchasable items in cached config, ignoring.");
                     Config = new UnibillConfiguration(XML, platform, logger, runtimeProducts);
                 }
                 else
                 {
                     logger.Log(string.Format("Using cached config with {0} purchasable items", Config.inventory.Count));
                     XML = val;
                 }
             } catch (Exception e) {
                 logger.LogError("Error parsing inventory: {0}", e.Message);
                 Config = new UnibillConfiguration(XML, platform, logger, runtimeProducts);
             }
         }
         refreshCachedConfig(Config.HostedConfigUrl, logger);
     }
     else
     {
         logger.Log("Not using cached inventory, using bundled.");
         Config = new UnibillConfiguration(XML, platform, logger, runtimeProducts);
     }
 }
 private void refreshCachedConfig(string url, Uniject.ILogger logger)
 {
     logger.Log("Trying to fetch remote config...");
     new GameObject().AddComponent <RemoteConfigFetcher> ().Fetch(storage, Config.HostedConfigUrl, CACHED_CONFIG_PATH);
 }