public async Task <IActionResult> GetAsync(string manufacturerGLN, string productCode)
        {
            var authenticationData = new AuthenticationManager().GetAccessToken();

            if (authenticationData == null || string.IsNullOrEmpty(authenticationData.AccessToken))
            {
                return(Unauthorized());
            }

            using var client = WebClientManager.GetWebHttpClient("Data", authenticationData.AccessToken);
            try
            {
                var url = HttpUtility.UrlEncode($"productdata/{manufacturerGLN}/{productCode}");

                using var response = await client.GetAsync(url).ConfigureAwait(false);

                var contentString = string.Empty;
                if (response.IsSuccessStatusCode)
                {
                    contentString = await response.Content.ReadAsStringAsync().ConfigureAwait(false);

                    var result = JsonConvert.DeserializeObject <CADProduct>(contentString);

                    return(new JsonResult(result));
                }
                else if (response.StatusCode == HttpStatusCode.NotFound)
                {
                    return(default);
        private async Task <IActionResult> GetTemplates(string application, string applicationVersion, List <CADProduct> cadProducts)
        {
            var authenticationData = new AuthenticationManager().GetAccessToken();

            if (authenticationData == null || string.IsNullOrEmpty(authenticationData.AccessToken))
            {
                return(Unauthorized());
            }

            using var client = WebClientManager.GetWebHttpClient("Template", authenticationData.AccessToken);
            try
            {
                var url     = $"export/{application}/{applicationVersion}";
                var content = new StringContent(JsonConvert.SerializeObject(cadProducts), Encoding.UTF8, "application/json");

                using var response = await client.PostAsync(url, content).ConfigureAwait(false);

                var contentString = string.Empty;
                if (response.IsSuccessStatusCode)
                {
                    using var contentStream = await response.Content.ReadAsStreamAsync().ConfigureAwait(false);

                    // When the HttpClient is disposed, the contentStream is no longer readable, seekable, etc. To
                    // fix this, we clone the contentStream into a copy that is returned instead of the contentStream.
                    var contentStreamClone = new MemoryStream();

                    await contentStream.CopyToAsync(contentStreamClone).ConfigureAwait(false);

                    contentStreamClone.Seek(0, SeekOrigin.Begin);
                    return(new FileStreamResult(contentStreamClone, "application/octet-stream"));
                }
                else if (response.StatusCode == HttpStatusCode.NotFound)
                {
                    return(default);
 public CmdBLL(WindownApplication _app)
 {
     cmd_ohtcDAO      = _app.CMD_OHTCDao;
     cmd_mcsDao       = _app.CMD_MCSDao;
     vcmd_mcsDao      = _app.VCMD_MCSDao;
     webClientManager = _app.GetWebClientManager();
 }
        private void Awake()
        {
            _user             = StreamClient.Instance;
            _webclientManager = WebClientManager.Instance as WebClientManager;
            _link             = GetComponentInParent <Link>();
            _animator         = GetComponent <Animator>();

            Observable.Merge(
                _user.SelectedIdRx,
                _user.SelectedTypeRx.Select(v => 0),
                _user.ZenModeRx.Select(v => 0),
                _user.LookingAtIdRx,
                _user.LookingAtTypeRx.Select(v => 0)
                )
            .TakeUntilDestroy(this)
            .BatchFrame()
            .ObserveOnMainThread()
            .Subscribe(_ => UpdateOutline());


            WebClient.AllModelChange()
            .TakeUntilDisable(this)
            .Where(ev => ev.ChangedProperties.Contains("Owner"))
            .ObserveOnMainThread()
            .Subscribe(ev => SearchCurrentWebclient());

            Observable.Merge(WebClient.ModelCreated(), WebClient.ModelDestroyed())
            .TakeUntilDisable(this)
            .Subscribe(m => SearchCurrentWebclient());
            SearchCurrentWebclient();
        }
Beispiel #5
0
        /// <summary>
        ///     Downloads the image from the configured image url and the image path found in the api
        /// </summary>
        /// <param name="sourceImage"></param>
        /// <param name="destinationImage"></param>
        /// <returns></returns>
        public void DownloadImage(string sourceImage, string destinationImage)
        {
            try
            {
                using (var webClient = new WebClientManager())
                {
                    var downloadUrl = $"{ADIWF_Config.MediaCloud}/{sourceImage}";

                    webClient.DownloadWebBasedFile(
                        downloadUrl,
                        false,
                        destinationImage);

                    _log.Info($"Successfully Downloaded Image: {sourceImage} as {destinationImage}");
                }
            }
            catch (Exception diEx)
            {
                _log.Error($"[DownloadImage] Error Downloading Image: {diEx.Message}");
                if (diEx.InnerException != null)
                {
                    _log.Error($"[DownloadImage] Inner Exception: {diEx.InnerException.Message}");
                }
            }
        }
        public bool GetGracenoteMappingData()
        {
            try
            {
                var mapUrl = $"{ADIWF_Config.OnApi}ProgramMappings?" +
                             $"providerId={OnapiProviderid}&" +
                             $"api_key={ADIWF_Config.ApiKey}";

                GracenoteMappingData = null;

                Log.Info($"Calling On API Mappings url with Provider Value: {OnapiProviderid}");
                var webClient = new WebClientManager();
                GracenoteMappingData = webClient.HttpGetRequest(mapUrl);
                Log.Debug($"RECEIVED MAPPING DATA FROM GRACENOTE: \r\n{GracenoteMappingData}");
                if (GracenoteMappingData != null & webClient.SuccessfulWebRequest)
                {
                    return(true);
                }

                throw new Exception($"Gracenote Mapping Data: {GracenoteMappingData}, " +
                                    $"Failed Web request: {webClient.SuccessfulWebRequest}," +
                                    $"Web request response code: {webClient.RequestStatusCode}");
            }
            catch (Exception ggmdEx)
            {
                Log.Error($"[GetGracenoteMappingData] Error obtaining Gracenote mapping data: {ggmdEx.Message}");
                if (ggmdEx.InnerException != null)
                {
                    Log.Error($"[GetGracenoteMappingData] Inner exception: {ggmdEx.InnerException.Message}");
                }
            }

            return(false);
        }
Beispiel #7
0
        private void OnEnable()
        {
            _cam        = Camera.main.transform;
            _user       = StreamClient.Instance;
            _links      = LinkManager.Instance as LinkManager;
            _plots      = PlotManager.Instance as PlotManager;
            _webclients = WebClientManager.Instance as WebClientManager;

            // use timeout when creating links
            Link.AllModelChange()
            .Where(ev => ev.Model.CreatedBy == _user.Id && ev.ChangedProperties.Contains("CreatedBy"))
            .Subscribe(ev =>
            {
                _isCreatingLink = true;
                ResetProgress();
                ev.Model.CreatedByRx
                .Where(v => v < 0)
                .Take(1)
                .Delay(TimeSpan.FromSeconds(1))
                .Subscribe(v => _isCreatingLink = false, () => _isCreatingLink = false);
            });

            _user.LookingAtIdRx
            .TakeUntilDisable(this)
            .ObserveOnMainThread()
            .Subscribe(_ => ResetProgress());

            _user.LookingAtTypeRx
            .TakeUntilDisable(this)
            .ObserveOnMainThread()
            .Subscribe(_ => ResetProgress());

            Link.AllModelChange()
            .TakeUntilDisable(this)
            .Where(ev => ev.Model.CreatedBy == _user.Id)
            .Subscribe(_ => ResetProgress());

            // disable & reset progress during zen mode
            _user.ZenModeRx
            .TakeUntilDisable(this)
            .Where(v => v && !(_tablet && _tablet.IsVoiceActive))
            .ObserveOnMainThread()
            .Subscribe(_ => ResetProgress());

            Plot.AllModelChange()
            .TakeUntilDisable(this)
            .Where(ev => ev.ChangedProperties.Contains("BoundTo") && _tablet != null && ev.Model.BoundTo == _tablet.Id)
            .Subscribe(_ => ResetProgress());


            WebClient.AllModelChange()
            .TakeUntilDisable(this)
            .Where(ev => ev.ChangedProperties.Contains("Owner"))
            .Subscribe(ev => SearchCurrentTablet());

            Observable.Merge(WebClient.ModelCreated(), WebClient.ModelDestroyed())
            .TakeUntilDisable(this)
            .Subscribe(m => SearchCurrentTablet());
        }
 protected override void OnEnable()
 {
     base.OnEnable();
     MaxSamples      = 50;
     _connection     = WebServerConnection.Instance;
     _clientManager  = WebClientManager.Instance as WebClientManager;
     _trackerManager = TrackerManager.Instance as TrackerManager;
 }
Beispiel #9
0
        /// <summary>
        /// Core initialization that must happen for Mefino's base features to operate.
        /// </summary>
        internal static void CoreInit()
        {
            AppDataManager.LoadConfig();

            WebClientManager.Initialize();

            // Local refresh (doesn't download new manifests)
            RefreshAllPackages();
        }
 private void OnEnable()
 {
     _streamClient                 = StreamClient.Instance;
     _webClientManager             = WebClientManager.Instance as WebClientManager;
     _hololensRoomscaleCalibration = FindObjectOfType <RoomscaleHololensCalibration>();
     _hololensSingleCalibration    = FindObjectOfType <LegacyHololensCalibration>();
     _webClientCalibration         = FindObjectOfType <WebClientCalibration>();
     _vuforiaBehaviour             = FindObjectOfType <VuforiaBehaviour>();
 }
Beispiel #11
0
        public Game()
        {
            this._clientManager    = new GameClientManager();
            this._clientWebManager = new WebClientManager();

            this._roleManager = new RoleManager();
            this._roleManager.Init();

            this._itemDataManager = new ItemDataManager();
            this._itemDataManager.Init();

            this._catalogManager = new CatalogManager();
            this._catalogManager.Init(this._itemDataManager);

            this._navigatorManager = new NavigatorManager();
            this._navigatorManager.Init();

            this._roleplayManager = new RoleplayManager();
            this._roleplayManager.Init();

            this._roomManager = new RoomManager();
            this._roomManager.LoadModels();

            this._groupManager = new GroupManager();
            this._groupManager.Init();

            this._moderationManager = new ModerationManager();
            this._moderationManager.LoadMessageTopics();
            this._moderationManager.LoadMessagePresets();
            this._moderationManager.LoadPendingTickets();
            this._moderationManager.LoadTicketResolution();

            this._questManager = new QuestManager();
            this._questManager.Initialize();

            this._hotelViewManager = new HotelViewManager();
            this._guideManager     = new GuideManager();
            this._packetManager    = new PacketManager();
            this._chatManager      = new ChatManager();

            this._effectsInventory = new EffectsInventoryManager();
            this._effectsInventory.Init();

            this._achievementManager = new AchievementManager();

            this._animationManager = new AnimationManager();
            this._animationManager.Init();

            this._notiftopManager = new NotifTopManager();
            this._notiftopManager.Init();

            DatabaseCleanup();
            LowPriorityWorker.Init();

            this.moduleWatch = new Stopwatch();
        }
Beispiel #12
0
        /// <summary>
        /// Function to initialize the application.
        /// </summary>
        private static void _initialize()
        {
            _processOSInit();

            Debug.Listeners.Clear();
            Trace.Listeners.Clear();

            CashLib.Console.Init();


            Debug.Listeners.Add(new ConsoleTraceListener());
            Debug.Listeners.Add(new CashLib.Diagnostics.ConsoleTraceListiner());
            //Trace.Listeners.Add(new ConsoleTraceListener());
            //Trace.Listeners.Add(new TortoiseConsoleTraceListiner());

            Trace.WriteLine(string.Format("CashCam Version {0}.{1}.{2}.{3}", Program.Version.Major, Program.Version.Minor, Program.Version.Build, Program.Version.Revision));

            DefaultLanguage.InitDefault();
            ModuleInfo.LoadModules(Assembly.GetExecutingAssembly(), true);

            SetupQuitFunction();

            Scheduler       = new CashLib.Tasks.Scheduler("CashCam Scheduler");
            SchedulerThread = new CashLib.Threading.Thread("SchedulerThread");
            SchedulerThread.AddTask(Scheduler);

            DiskThread = new CashLib.Threading.Thread("DiskThread");
            DiskThread.AddTask(new DiskController());

            CameraThread  = new CashLib.Threading.Thread("CameraThread");
            CameraManager = new CameraManager();
            CameraThread.AddTask(CameraManager);


            WebClientThread  = new CashLib.Threading.Thread("WebClientThread");
            WebClientManager = new WebClientManager();
            WebClientThread.AddTask(WebClientManager);

            WebListenThread = new CashLib.Threading.Thread("WebListenThread");
            WebListenThread.AddTask(new WebServer());


            //SchedulerThread.Start();
            CameraThread.Start();
            DiskThread.Start();
            WebListenThread.Start();
            WebClientThread.Start();

            //ThreadsStopped += SchedulerThread.Stop;
            ThreadsStopped += CameraThread.Stop;
            ThreadsStopped += DiskThread.Stop;
            ThreadsStopped += WebListenThread.Stop;
            ThreadsStopped += WebClientThread.Stop;
        }
Beispiel #13
0
        private void OnEnable()
        {
            _user       = StreamClient.Instance;
            _webclients = WebClientManager.Instance as WebClientManager;

            _image = GetComponent <Image>();
            _originalImageColor = _image.color;


            WebClient.AllModelChange()
            .TakeUntilDisable(this)
            .Where(ev => ev.ChangedProperties.Contains("Owner"))
            .Subscribe(ev => SearchCurrentTablet());
        }
        private void Awake()
        {
            _user       = StreamClient.Instance;
            _webclients = WebClientManager.Instance as WebClientManager;

            WebClient.AllModelChange()
            .TakeUntilDestroy(this)
            .Where(ev => ev.ChangedProperties.Contains("Owner"))
            .Subscribe(ev => SearchCurrentTablet());

            Observable.Merge(WebClient.ModelCreated(), WebClient.ModelDestroyed())
            .TakeUntilDestroy(this)
            .Subscribe(m => SearchCurrentTablet());

            UpdateCursor();
        }
        public int ParseForNetProductCountUnderCategory(HtmlDocument document, FoxeCategory category)
        {
            var pager = document.DocumentNode.SelectNodes("//ul[@class='pagination']");
            int firstPageProductCount = ParseForPageProductCountForCategory(document);
            int lastPageProductCount  = 0;
            int productCount          = 0;
            int pageCount             = 0;

            if (pager == null)
            {
                productCount = firstPageProductCount;
                pageCount    = 1;
            }
            else
            {
                var    pagerLastAnchor = document.DocumentNode.SelectNodes("//ul[@class='pagination']//li//a[@title='Last']");
                string pagerLastHref   = "";
                if (pagerLastAnchor != null)
                {
                    pagerLastHref = pagerLastAnchor[0].Attributes["href"].Value;
                }
                else
                {
                    var totalAnchors    = document.DocumentNode.SelectNodes("//ul[@class='pagination']//li//a").Count;
                    var pagerNextAnchor = document.DocumentNode.SelectNodes("//ul[@class='pagination']//li//a").Last();
                    pagerLastHref = pagerNextAnchor.Attributes["href"].Value;
                }

                string pattern = @"/page/(?<pageNo>\d+)/";
                Match  m       = Regex.Match(pagerLastHref, pattern);
                if (m.Success)
                {
                    pageCount = Int32.Parse(m.Groups["pageNo"].Value);
                }

                string       lastPageUrl      = CrawlerHelper.GetSchemeDomainUrl() + pagerLastHref;
                HtmlDocument lastPageDocument = new WebClientManager().DownloadHtmlDocument(lastPageUrl);
                lastPageProductCount = ParseForPageProductCountForCategory(lastPageDocument);
                productCount         = (firstPageProductCount * (pageCount - 1)) + lastPageProductCount;
            }

            category.PageCount             = pageCount;
            category.ProductCount          = productCount;
            category.FirstPageProductCount = firstPageProductCount;
            category.LastPageProductCount  = lastPageProductCount;
            return(productCount);
        }
Beispiel #16
0
        public async Task <List <RootObject> > GetPet(CancellationToken cToken)
        {
            Stopwatch sw = Stopwatch.StartNew();

            if (!cToken.IsCancellationRequested)
            {
                //instead of debug I can use log4net to either save as a log file or integrate with SumoLogic web service
                var result = WebClientManager.GetItemList().Result;
                Debug.WriteLine("elapsed ms:{0}", sw.ElapsedMilliseconds);

                return(result);
            }
            else
            {
                return(null);
            }
        }
Beispiel #17
0
        public async Task <IEnumerable <CategoryViewModel> > GetPet(CancellationToken cToken, string category)
        {
            Stopwatch sw = Stopwatch.StartNew();

            if (!cToken.IsCancellationRequested)
            {
                //log4net
                var result = WebClientManager.GetItemList().Result;
                Debug.WriteLine("elapsed ms:{0}", sw.ElapsedMilliseconds);
                foreach (var owner in result.ToList())
                {
                    List <Pet> removeList = new List <Pet>();

                    if (owner.pets != null)
                    {
                        for (int i = 0; i < owner.pets.Count; i++)
                        {
                            if (!owner.pets[i].type.Equals(category, StringComparison.OrdinalIgnoreCase))
                            {
                                owner.pets.RemoveAt(i);
                                i--;
                            }
                        }
                    }
                }

                var grouping = (from p in (from p in result
                                           where p.pets != null
                                           where
                                           (from t in p.pets
                                            where t.type.ToLower() == category
                                            select t
                                           ).Any()
                                           select p
                                           )
                                group p.pets by p.gender into g
                                select new CategoryViewModel()
                {
                    gender = g.Key,
                    pets = g.ToList()
                });
                return(grouping);
            }
            //basic validation if result is null
            throw new HttpResponseException(HttpStatusCode.NoContent);
        }
        public IList <FoxeProduct> ParseForProductsUnderCategory(HtmlDocument document, FoxeCategory category)
        {
            IList <FoxeProduct> products = new List <FoxeProduct>();

            HtmlNodeCollection productNodes = document.DocumentNode.SelectNodes("//div[@class='row book-top']");

            foreach (var productnode in productNodes)
            {
                FoxeProduct product = new FoxeProduct();
                product.CoverPageUrl = productnode.ChildNodes["div"].ChildNodes["img"].Attributes["src"].Value;
                var          productDetailsPageUrl     = CrawlerHelper.GetSchemeDomainUrl() + productnode.Descendants("a").Last().Attributes["href"].Value;
                HtmlDocument productDetailPageDocument = new WebClientManager().DownloadHtmlDocument(productDetailsPageUrl);
                ParseProductDetailPageUpdateProduct(productDetailPageDocument, product);
                product.Category = category;
                products.Add(product);
            }
            return(products);
        }
Beispiel #19
0
    private void Awake()
    {
        _webclients = WebClientManager.Instance as WebClientManager;

        _user = StreamClient.Instance;
        _user.ZenModeRx
        .TakeUntilDestroy(this)
        .ObserveOnMainThread()
        .Subscribe(val => gameObject.SetActive(!val));

        WebClient.AllModelChange()
        .TakeUntilDisable(this)
        .Where(ev => ev.ChangedProperties.Contains("Owner"))
        .Subscribe(ev => SearchCurrentWebclient());

        Observable.Merge(WebClient.ModelCreated(), WebClient.ModelDestroyed())
        .TakeUntilDisable(this)
        .Subscribe(m => SearchCurrentWebclient());
    }
Beispiel #20
0
        public void Config(IUnityContainer container)
        {
            container.RegisterType <ILoggerFactory, LoggerFactoryImpl>(new ContainerControlledLifetimeManager(), new InjectionConstructor("ErrorCategory"));
            LogManager.Factory = container.Resolve <ILoggerFactory>();

            container.RegisterType <IAuditor, GenericAuditor>(new ContainerControlledLifetimeManager());

            container.RegisterType <ICacheFactory, PermanentCacheFactory>("PermanentCacheFactory", new ContainerControlledLifetimeManager());
            container.RegisterType <CacheManager>("PermanentCacheManager", new ContainerControlledLifetimeManager(),
                                                  new InjectionConstructor(container.Resolve <ICacheFactory>("PermanentCacheFactory")));

            container.RegisterType <ICredentialsProvider, GenericCredentialsProvider>(new ContainerControlledLifetimeManager());

            WebClientManager webClientManager = new WebClientManager();

            container.RegisterInstance <IClientManager>(webClientManager);
            container.RegisterInstance <IClientFinder>(webClientManager);

            container.RegisterType <ServiceAuthorizationManager, WebServiceAuthorizationManager>(new ContainerControlledLifetimeManager());
        }
        public int ParseForNetProductCount(HtmlDocument document)
        {
            int    lastPageNo      = 0;
            var    pagerLastAnchor = document.DocumentNode.SelectNodes("//ul[@class='pagination']//li//a[@title='Last']");
            string pagerLastHref   = pagerLastAnchor[0].Attributes["href"].Value;
            string pattern         = @"/page/(?<pageNo>\d+)/";
            Match  m = Regex.Match(pagerLastHref, pattern);

            if (m.Success)
            {
                lastPageNo = Int32.Parse(m.Groups["pageNo"].Value);
            }

            var          firstPageProductCount = ParseForPageProductCount(document);
            string       lastPageUrl           = CrawlerHelper.GetSchemeDomainUrl() + pagerLastHref;
            HtmlDocument lastPageDocument      = new WebClientManager().DownloadHtmlDocument(lastPageUrl);
            var          lastPageProductCount  = ParseForPageProductCount(lastPageDocument);
            var          netProducts           = (firstPageProductCount * (lastPageNo - 1)) + lastPageProductCount;

            return(netProducts);
        }
        private void OnEnable()
        {
            _cam = Camera.main.transform;
            WebServerConnection.ServerMessagesAsync
            .TakeUntilDisable(this)
            .Where(p => p.channel == NetworkChannel.CONTROL)
            .Where(p => p.command == "action")
            .ObserveOnMainThread()
            .Subscribe(p => OnUserAction(p.payload));


            _client           = StreamClient.Instance;
            _webclientManager = WebClientManager.Instance as WebClientManager;

            WebClient.AllModelChange()
            .TakeUntilDisable(this)
            .Where(ev => ev.ChangedProperties.Contains("Owner"))
            .Subscribe(ev => SearchCurrentWebclient());

            Observable.Merge(WebClient.ModelCreated(), WebClient.ModelDestroyed())
            .TakeUntilDisable(this)
            .Subscribe(m => SearchCurrentWebclient());

            _client.ModelChange()
            .TakeUntilDisable(this)
            .Where(changes => changes.Contains("IndicatorPosition"))
            .ObserveOnMainThread()
            .Subscribe(_ => SetPosition());
            SetPosition();

            _client.ZenModeRx
            .TakeUntilDisable(this)
            .ObserveOnMainThread()
            .Subscribe(_ => UpdateScreenIndicators());

            SearchCurrentWebclient();
            ClearTextIcons();
        }
        public bool GetGraceNoteSeriesSeasonSpecialsData()
        {
            try
            {
                var requestUrl = $"{ADIWF_Config.OnApi}Programs?" +
                                 $"tmsId={GraceNoteConnectorId}&" +
                                 $"api_key={ADIWF_Config.ApiKey}";

                Log.Info($"Retrieving MetaData from On API using Connector ID: {GraceNoteConnectorId}");

                GraceNoteSeriesSeasonSpecialsData = null;

                var webClient = new WebClientManager();
                GraceNoteSeriesSeasonSpecialsData = webClient.HttpGetRequest(requestUrl);

                if (GraceNoteSeriesSeasonSpecialsData != null & webClient.SuccessfulWebRequest)
                {
                    return(true);
                }

                throw new Exception("[GetGraceNoteSeriesSeasonSpecialsData] Error during receive of GN Api data, " +
                                    $"Web request data: {webClient.SuccessfulWebRequest}," +
                                    $"Web request response code: {webClient.RequestStatusCode}");
            }
            catch (Exception ggpdEx)
            {
                Log.Error("[GetGraceNoteSeriesSeasonSpecialsData] Error obtaining " +
                          $"Gracenote Api data: {ggpdEx.Message}");

                if (ggpdEx.InnerException != null)
                {
                    Log.Error("[GetGraceNoteSeriesSeasonSpecialsData] " +
                              $"Inner exception: {ggpdEx.InnerException.Message}");
                }

                return(false);
            }
        }
        public bool GetGracenoteProgramData()
        {
            try
            {
                Log.Info($"Retrieving MetaData from On API using TMSId: {GraceNoteTmsId}");
                var programUrl = $"{ADIWF_Config.OnApi}Programs?" +
                                 $"tmsId={GraceNoteTmsId}&" +
                                 $"api_key={ADIWF_Config.ApiKey}";

                GracenoteProgramData = null;

                Log.Info($"Calling On API Programs url with TmsId Value: {GraceNoteTmsId}");
                var webClient = new WebClientManager();
                GracenoteProgramData = webClient.HttpGetRequest(programUrl);

                if (GracenoteProgramData != null & webClient.SuccessfulWebRequest)
                {
                    return(true);
                }

                throw new Exception("Error during receive of GN Api Program data, " +
                                    $"Web request data: {webClient.SuccessfulWebRequest}," +
                                    $"Web request response code: {webClient.RequestStatusCode}");
            }
            catch (Exception ggpdEx)
            {
                Log.Error("[GetGracenoteProgramData] Error obtaining " +
                          $"Gracenote Program data: {ggpdEx.Message}");

                if (ggpdEx.InnerException != null)
                {
                    Log.Error("[GetGracenoteProgramData] " +
                              $"Inner exception: {ggpdEx.InnerException.Message}");
                }

                return(false);
            }
        }
        private void OnEnable()
        {
            _propBlock = new MaterialPropertyBlock();
            _renderer  = GetComponent <Renderer>();

            _plotFilter = GetComponent <Filter>();
            _meshFilter = GetComponent <MeshFilter>();
            _tablets    = WebClientManager.Instance as WebClientManager;

            // avoid z-fighting for overlapping filters
            _renderer.GetPropertyBlock(_propBlock);
            _propBlock.SetFloat("_randomOffset", _zOffset);
            _renderer.SetPropertyBlock(_propBlock);
            _zOffset += Z_OFFSET_INCREMENT;
            if (_zOffset >= 0.01f)
            {
                _zOffset = Z_OFFSET_INCREMENT;
            }

            _plotFilter.PathRx
            .TakeUntilDisable(this)
            .Where(path => path != null && path.Length > 3)
            .Sample(TimeSpan.FromMilliseconds(100))
            .ObserveOnMainThread()
            .Subscribe(_ => RenderPath(_plotFilter.Path));

            _plotFilter.ColorRx
            .TakeUntilDisable(this)
            .Where(col => !string.IsNullOrEmpty(col))
            .ObserveOnMainThread()
            .Subscribe(col => RenderColor(col));

            _plotFilter.SelectedByRx
            .TakeUntilDisable(this)
            .ObserveOnMainThread()
            .Subscribe(val => UpdateSelection());
        }
        public bool GetGraceNoteUpdates(string updateId, string apiCall, string resultLimit)
        {
            try
            {
                //http://on-api.gracenote.com/v3/ProgramMappings?updateId=10938407543&limit=100&api_key=wgu7uhqcqyzspwxj28mxgy4b
                var updateUrl = $"{GN_UpdateTracker_Config.OnApi}{apiCall}" +
                                $"?updateId={updateId}" +
                                $"&limit={resultLimit}" +
                                $"&api_key={GN_UpdateTracker_Config.ApiKey}";

                GraceNoteUpdateData = null;

                Log.Info($"Calling On API url with Update Value: {updateId} and Limit: {resultLimit}");
                var webClient = new WebClientManager();
                GraceNoteUpdateData = webClient.HttpGetRequest(updateUrl);
                Log.Info("Successfully Called Gracenote OnApi");
                if (GraceNoteUpdateData != null & webClient.SuccessfulWebRequest)
                {
                    return(true);
                }

                throw new Exception($"Gracenote Update Data: {GraceNoteUpdateData}, " +
                                    $"Successful Web request: {webClient.SuccessfulWebRequest}," +
                                    $"Web request response code: {webClient.RequestStatusCode}");
            }
            catch (Exception ggnmuex)
            {
                Log.Error($"[GetGraceNoteUpdates] Error obtaining Gracenote Update data: {ggnmuex.Message}");
                if (ggnmuex.InnerException != null)
                {
                    Log.Error($"[GetGraceNoteUpdates] Inner exception: {ggnmuex.InnerException.Message}");
                }
            }

            return(false);
        }
Beispiel #27
0
        private void OnEnable()
        {
            _link = GetComponentInParent <Link>();

            var links = LinkManager.Instance;

            _user = StreamClient.Instance;



            _webclientManager = WebClientManager.Instance as WebClientManager;

            WebClient.AllModelChange()
            .TakeUntilDisable(this)
            .Where(ev => ev.ChangedProperties.Contains("Owner"))
            .Subscribe(ev => SearchCurrentWebclient());

            Observable.Merge(WebClient.ModelCreated(), WebClient.ModelDestroyed())
            .TakeUntilDisable(this)
            .Subscribe(m => SearchCurrentWebclient());
            SearchCurrentWebclient();


            Observable.Merge(
                Link.AllModelChange().Where(ev => ev.ChangedProperties.Contains("CreatedBy")).Select(ev => ev.Model),
                Link.ModelDestroyed()
                )
            .TakeUntilDisable(this)
            .Subscribe(_ =>
            {
                _isUserCreatingLine = links.Get().Any(l => l.CreatedBy == _user.Id);
                // workaround because hololens thinks user is standing in line??
                _isUserStandingInLine = false;
                UpdateTransparency();
            });
        }
Beispiel #28
0
 public SysExcuteQualityBLL(WindownApplication app)
 {
     webClientManager = app.GetWebClientManager();
     OlsonTimeZoneID  = WinFromUtility.TimeZoneInfoIDToOlsonTimeZoneID(TimeZoneInfo.Local);
 }
 public Web(WebClientManager _webClient)
 {
     webClientManager = _webClient;
 }
Beispiel #30
0
 public FoxEbookCrawler()
 {
     foxEbookParser   = new HtmlAgilityParser();
     webClientManager = new WebClientManager();
 }