private IEnumerator LoadSprite(CampaignListViewController viewController, string spritePath, bool isBackground) { if (!loadedTextures.ContainsKey(spritePath)) { using (var web = UnityWebRequestTexture.GetTexture(APITools.EncodePath(spritePath), true)) { yield return(web.SendWebRequest()); if (web.isNetworkError || web.isHttpError) { icon = null; } else { Texture2D tex = DownloadHandlerTexture.GetContent(web); //Sprite sprite = ; loadedTextures.Add(spritePath, tex); if (isBackground) { background = Sprite.Create(tex, new Rect(0, 0, tex.width, tex.height), Vector2.one * 0.5f, 100, 1); } else { icon = tex; } } } } else { Texture2D tex = loadedTextures[spritePath]; if (isBackground) { background = Sprite.Create(tex, new Rect(0, 0, tex.width, tex.height), Vector2.one * 0.5f, 100, 1); } else { icon = tex; } } if (!isBackground) { viewController.customListTableData.tableView.ReloadData(); } }
public static void ExecuteAnalysis() { Message.Info("--------------"); Message.Info("Start analysis"); Message.Info("--------------"); try { int numberUsersToAnalyce = 7777; //string querySearchLarge = "Madrid, Spain";//12002362 //string querySearchLarge = "Pozuelo de Alarcón, Madrid";//101331 //string querySearchLarge = "Madrid, España";//62588 //string querySearchLarge = "Plaza Mayor, Madrid";//256867 //string querySearchLarge = "Puerta del Sol Madrid";//988566 //string querySearchLarge = "Alcobendas, Spain";//109674 //string querySearchLarge = "La Moraleja";//34261 //string querySearchLarge = "San Sebastián de los Reyes";//102697 //string querySearchLarge = "Centro Comercial Plaza Norte 2";//18935 //string querySearchLarge = "Moncloa-Aravaca";//2199 //string querySearchLarge = "Gran Vía, Madrid, España";//93997 //string querySearchLarge = "Tres Cantos, Madrid, Spain";// //string querySearchLarge = "Majadahonda, Madrid, Spain";//126502 //string querySearchLarge = "Hortaleza, Madrid, Spain";//14793 // string querySearchLarge = "Aravaca, Madrid, Spain";//21118//***** // string querySearchLarge = "Ciudad Universitaria";//1813 //string querySearchLarge = ;// //string querySearchLarge = ;// //string querySearchLarge = ;// //string querySearchLarge = ;// //string querySearchLarge = ;// //string querySearchLarge = ;// //string querySearchLarge = ;// //string querySearchLarge = ;// //string querySearchLarge = ;// #region Declarations string databaseName = "azureFaceInstagram"; List <User> usersList = new List <User>(); var watch = System.Diagnostics.Stopwatch.StartNew(); Requeriment requeriments = new Requeriment(); Random rnd = new Random(); #endregion //todo parameterize in app-config or mvc and get all block to another method, //todo especify others accounts #region Search parameters var minFollows = "0"; var minFollowers = "0"; var maxFollows = "99999999"; var maxFollowers = "9999999"; var maxEngagement = "99.9"; var minEngagement = "0"; string searchType = "Location"; string hashtagsRequired = ""; List <string> searchQueryList = querySearchLarge.Split(',').ToList(); string querySearch = searchQueryList[rnd.Next(0, searchQueryList.Count() - 1)]; Message.Info(string.Format("Location founded ({0}). [()]", querySearch)); var tttttt = 0; #endregion #region Set parameters to Requeriment object requeriments.MinNumberFollows = Int32.Parse(minFollows); requeriments.MaxNumberFollows = Int32.Parse(maxFollows); requeriments.MinNumberFollowers = Int32.Parse(minFollowers); requeriments.MaxNumberFollowers = Int32.Parse(maxFollowers); requeriments.NumberUsersToAnalyce = numberUsersToAnalyce; requeriments.MaxEngagement = Double.Parse(maxEngagement); requeriments.MinEngagement = Double.Parse(minEngagement); requeriments.HashtagsRequired = hashtagsRequired.Split(',').ToList(); requeriments.QuerySearch = querySearch; requeriments.SearchType = searchType; #endregion CRUDMongo.CreateRequeriment(requeriments, databaseName); if (requeriments.SearchType == "Location") { requeriments.IsLocationSearch = true; Message.Info("- Trying to get Location users. [()]"); usersList = APITools.GetUsersByLocation(requeriments); #region Preparing the return user list List <User> UsersToShow = new List <User>(); foreach (var user in usersList) { if (user.IsGirl && !user.IsBusinessAccount) { UsersToShow.Add(user); } } #endregion HtmlGenerationTools.GenerateHtmlFileForShowUsers(UsersToShow, requeriments); Message.Info(string.Format("{0} users showed in html file. [()]", UsersToShow.Count())); CRUDMongo.CreateUser(usersList, "location", databaseName); Message.Info(string.Format("{0} users inserted in database. [()]", usersList.Count())); } else if (requeriments.SearchType == "Hashtag") { requeriments.IsHashtagSearch = true; usersList = APITools.GetUsersByHashtag(requeriments); CRUDMongo.CreateUser(usersList, "hashtag", databaseName); } else if (requeriments.SearchType == "UserName") { requeriments.IsUserNameSearch = true; CRUDMongo.CreateUser(usersList, "userName", databaseName); } #region Printing to log file Message.Info("---------------Finish process--------------------"); #endregion } catch (Exception e) { #region Printing to log file Message.Info(string.Format("Exception ocurred. Message: {0}", e.Message)); #endregion } }