示例#1
0
 /// <summary>
 /// Load the category page for the specified character in a separate thread - this will pull out all pages for the specified character
 /// </summary>
 /// <param name="parametersObject"></param>
 private void LoadCharacterSubCateg(LoadSubCategParams parameters)
 {
     try
     {
         LoadThisCategory(parameters.ParentCategory, parameters.CurrentChar);
     }
     catch (Exception ex)
     {
         OnlineVideos.Log.Error(ex);
     }
 }
示例#2
0
        /// <summary>
        /// Use the api version of the Sky Go pages to load categories - we'll multi thread this to load the different alphabet characters simultaneously
        /// </summary>
        /// <param name="parentCategory"></param>
        private void LoadSubCategories(Category parentCategory, bool shouldRunThroughAllChars)
        {
            var tmpchar          = "%23";
            var currentAToZPos   = 0;
            var currThreadHandle = 0;

            try
            {
                if (shouldRunThroughAllChars)
                {
                    var pool = new List <Task>();

                    // Loop through the whole alphabet
                    while ((currentAToZPos + 64) <= 90)
                    {
                        var tmpParams = new LoadSubCategParams {
                            CurrentChar = tmpchar, ParentCategory = parentCategory, Index = currThreadHandle
                        };

                        pool.Add(Task.Factory.StartNew(() => LoadCharacterSubCateg(tmpParams)));

                        currentAToZPos++;

                        // Move to the next character
                        tmpchar = ((char)(currentAToZPos + 64)).ToString();
                    }
                    var timeout = OnlineVideoSettings.Instance.UtilTimeout <= 0 ? 30000 : OnlineVideoSettings.Instance.UtilTimeout * 1000;
                    Task.WaitAll(pool.ToArray(), timeout);
                }
                else
                {
                    var tmpParams = new LoadSubCategParams {
                        CurrentChar = "", ParentCategory = parentCategory, Index = 0
                    };

                    LoadCharacterSubCateg(tmpParams);
                }
            }
            catch (Exception ex)
            {
                OnlineVideos.Log.Error(ex);
            }
        }
        /// <summary>
        /// Use the api version of the Sky Go pages to load categories - we'll multi thread this to load the different alphabet characters simultaneously
        /// </summary>
        /// <param name="parentCategory"></param>
        private void LoadSubCategories(Category parentCategory, bool shouldRunThroughAllChars)
        {
            var tmpchar = "%23";
            var currentAToZPos = 0;
            var currThreadHandle = 0;
            try
            {
                if (shouldRunThroughAllChars)
                {
                    var pool = new List<Task>();

                    // Loop through the whole alphabet
                    while ((currentAToZPos + 64) <= 90)
                    {
                        var tmpParams = new LoadSubCategParams { CurrentChar = tmpchar, ParentCategory = parentCategory, Index = currThreadHandle };

                        pool.Add(Task.Factory.StartNew(() => LoadCharacterSubCateg(tmpParams)));

                        currentAToZPos++;

                        // Move to the next character
                        tmpchar = ((char)(currentAToZPos + 64)).ToString();

                    }
                    var timeout = OnlineVideoSettings.Instance.UtilTimeout <= 0 ? 30000 : OnlineVideoSettings.Instance.UtilTimeout * 1000;
                    Task.WaitAll(pool.ToArray(), timeout);
                }
                else
                {
                    var tmpParams = new LoadSubCategParams { CurrentChar = "", ParentCategory = parentCategory, Index = 0 };

                    LoadCharacterSubCateg(tmpParams);
                }
            }
            catch (Exception ex)
            {
                OnlineVideos.Log.Error(ex);
            }
        }
        /// <summary>
        /// Load the category page for the specified character in a separate thread - this will pull out all pages for the specified character 
        /// </summary>
        /// <param name="parametersObject"></param>
        private void LoadCharacterSubCateg(LoadSubCategParams parameters)
        {
            try
            {
                LoadThisCategory(parameters.ParentCategory, parameters.CurrentChar);
            }
            catch (Exception ex)
            {
                OnlineVideos.Log.Error(ex);
            }

        }