Ejemplo n.º 1
0
        private void HandleAdSourcesResponse(HTTPResponse response)
        {
            Dictionary <string, object> data;

            try {
                data = ParseResponse(response);
            }
            catch (Exception) {
                return;
            }

            if (data == null)
            {
                return;
            }

            Utils.LogDebug("Received ad sources response");

            globalIntervals = new IntervalManager((List <object>)data["adIntervals"]);

            Utils.LogDebug("Got " + globalIntervals + " intervals for global");

            serverTimestamp = (long)data["serverTimestamp"];
            localTimestamp  = (long)Math.Round(Time.realtimeSinceStartup);

            ZoneManager.Instance.UpdateIntervals((Dictionary <string, object>)data["adSources"]);

            _requestingAdSources = false;
            isInitialized        = true;
        }
Ejemplo n.º 2
0
 public void UpdateIntervals(List<object> adSources) {
   foreach(object entry in adSources) {
     Dictionary<string, object> data = (Dictionary<string, object>)entry;
     string adapterId = (string)data["id"];
     if(_adapterIntervals.ContainsKey(adapterId)) {
       _adapterConsumeTimes[adapterId].Clear();
       _adapterIntervals[adapterId] = new IntervalManager((List<object>)data["adIntervals"]);
       Utils.LogDebug("Got intervals " + _adapterIntervals[adapterId] + " for " + adapterId);
     }
   }
 }
 private bool AllAdaptersConsumed()
 {
     foreach (KeyValuePair <string, IntervalManager> entry in _adapterIntervals)
     {
         IntervalManager adapterIntervals = entry.Value;
         if (!adapterIntervals.IsEmpty())
         {
             return(false);
         }
     }
     return(true);
 }
 public void UpdateIntervals(List <object> adSources)
 {
     foreach (object entry in adSources)
     {
         Dictionary <string, object> data = (Dictionary <string, object>)entry;
         string adapterId = (string)data["id"];
         if (_adapterIntervals.ContainsKey(adapterId))
         {
             _adapterConsumeTimes[adapterId].Clear();
             _adapterIntervals[adapterId] = new IntervalManager((List <object>)data["adIntervals"]);
             Utils.LogDebug("Got intervals " + _adapterIntervals[adapterId] + " for " + adapterId);
         }
     }
 }
        private HashSet <string> NonCappedAdapters()
        {
            HashSet <string> nonCappedAdapters = new HashSet <string>();

            foreach (KeyValuePair <string, IntervalManager> entry in _adapterIntervals)
            {
                IntervalManager adapterIntervals = entry.Value;
                if (adapterIntervals.IsAvailable())
                {
                    nonCappedAdapters.Add(entry.Key);
                }
            }
            return(nonCappedAdapters);
        }
Ejemplo n.º 6
0
    private void HandleAdSourcesResponse(HTTPResponse response) {
      Dictionary<string, object> data;
      try {
        data = ParseResponse(response);
      }
      catch(Exception) {
        return;
      }

      if(data == null) {
        return;
      }

      Utils.LogDebug("Received ad sources response");

      globalIntervals = new IntervalManager((List<object>)data["adIntervals"]);

      Utils.LogDebug("Got " + globalIntervals + " intervals for global");

      serverTimestamp = (long)data["serverTimestamp"];
      localTimestamp = (long)Math.Round(Time.realtimeSinceStartup);

      ZoneManager.Instance.UpdateIntervals((Dictionary<string, object>)data["adSources"]);

      _requestingAdSources = false;
    }
Ejemplo n.º 7
0
 public void UpdateIntervals(Dictionary<string, object> adSources) {
   _zoneIntervals = new IntervalManager((List<object>)adSources["adIntervals"]);
   Utils.LogDebug("Got " + _zoneIntervals + " intervals for " + Id);
   _adapterManager.UpdateIntervals((List<object>)adSources["adapters"]);
 }
Ejemplo n.º 8
0
 public void UpdateIntervals(Dictionary <string, object> adSources)
 {
     _zoneIntervals = new IntervalManager((List <object>)adSources["adIntervals"]);
     Utils.LogDebug("Got " + _zoneIntervals + " intervals for " + Id);
     _adapterManager.UpdateIntervals((List <object>)adSources["adapters"]);
 }