Example #1
0
        /// <summary>
        ///     Clears / deletes all relevant crawler information from Azure Storage upon command.
        ///     Sets the XML & URL Queue sizes to 0, clears the XML & URL Queues, and deletes
        ///     the URL Table and Error Table. URL and Error Tables must be reinitialized for crawler
        ///     to function again (handled in worker role).
        /// </summary>
        public void ClearAll()
        {
            TableOperation clearQueue =
                TableOperation.InsertOrReplace(new CrawlrQueueSize(0, 0));

            StatusTable.Execute(clearQueue);
            XmlQueue.Clear();
            UrlQueue.Clear();
            UrlTable.Delete();
            ErrorTable.Delete();
        }
Example #2
0
        private void OnClickCancelButton()
        {
            onDisable = null;
            var gameRoom = gameManager.GameRoom;

            netManager.GetRequest(UrlTable.GetExitGameUrl(gameRoom.GameCode, gameRoom.UserId)
                                  , (response) =>
            {
                SceneManager.LoadScene("LobbyScene");
            });
        }
Example #3
0
        private void Awake()
        {
#if UNITY_EDITOR
            gameObject.SetActive(false);
#else
            NetworkManager.Get().GetRequest(UrlTable.GetContentLockCheckUrl(Application.productName, Application.version, name)
                                            , (response) =>
            {
                bool isLock = bool.Parse(response);
                gameObject.SetActive(!isLock);
            });
#endif
        }
Example #4
0
        private IEnumerator UpdateGameRoomCoroutine()
        {
            string gameCode = gameManager.GameRoom.GameCode;

            while (isRunning)
            {
                netManager.GetRequest(UrlTable.GetFindGameUrl(gameCode)
                                      , (response) =>
                {
                    var game = GameRoomModel.Parse(response);
                    SetGameRoom(game);
                });
                yield return(new WaitForSecondsRealtime(.5f));
            }
        }
Example #5
0
        public void OnClickCreateGameButton()
        {
            int maxUserCount = int.Parse(maxUserCountText.text);

            netManager.GetRequest(UrlTable.GetCreateGameUrl(maxUserCount),
                                  (response) =>
            {
                var game = GameRoomModel.Parse(response);
                if (null != game)
                {
                    gameManager.GameRoom   = game;
                    gameManager.GameUserId = game.OwnerUserId;
                    gameCodeText.text      = game.GameCode;
                    StartCoroutine(StartGame());
                }
            });
        }
Example #6
0
        public void OnClickConfirmButton()
        {
            string gameCode = gameManager.GameRoom.GameCode;

            netManager.GetRequest(UrlTable.GetStartGameUrl(gameCode)
                                  , (response) =>
            {
                var gameRoom = GameRoomModel.Parse(response);
                if (true == gameRoom.IsOpen)
                {
                    Log.Info("NOT READY");
                }
                else
                {
                    Close();
                }
            });
        }
        public static async Task <UrlTable> InsertLongUrl(string longUrl)
        {
            try
            {
                UrlTable record = new UrlTable
                {
                    LongUrl    = longUrl,
                    ExpiryDate = DateTime.Now,
                    IsExpired  = false
                };
                using (var ctx = new urlshortnerContext())
                {
                    var  rcd = ctx.Add(record);
                    long id  = await ctx.SaveChangesAsync();

                    var ID = record.Id;

                    var shorturl = Util.GetBase62(ID);


                    record.ShorlUrl = shorturl;
                    ctx.SaveChanges();

                    //  var recordd = ctx.UrlTable.Where(e => e.Id == (int)id).Single();



                    return(record);
                }

                // logging & aaplication Insights
                // dependecy injection
                // Disponse contetx
            }
            catch (Exception e)
            {
                throw;
            }
        }
Example #8
0
        public void OnClickJoinGameButton()
        {
            string gameCode = inputGameCode.text;

            Log.Info(gameCode);
            netManager.GetRequest(UrlTable.GetJoinGameUrl(gameCode)
                                  , (response) =>
            {
                var game = GameRoomModel.Parse(response);
                if (null != game)
                {
                    gameManager.GameRoom   = game;
                    gameManager.GameUserId = game.UserId;
                    joinGameButton.GetComponentInChildren <Text>().color = Color.green;

                    StartCoroutine(StartGame());
                }
                else
                {
                    joinGameButton.GetComponentInChildren <Text>().color = Color.red;
                }
            });
        }
Example #9
0
        private void EnsureChildSiteMapProviderUpToDate(SiteMapProvider childProvider)
        {
            SiteMapNode oldNode = (SiteMapNode)ChildProviderTable[childProvider];

            SiteMapNode newNode = childProvider.GetRootNodeCore();

            if (newNode == null)
            {
                throw new ProviderException(SR.GetString(SR.XmlSiteMapProvider_invalid_sitemapnode_returned, childProvider.Name));
            }

            // child providers have been updated.
            if (!oldNode.Equals(newNode))
            {
                // If the child provider table has been updated, simply return null.
                // This will happen when the current provider's sitemap file is changed or Clear() is called;
                if (oldNode == null)
                {
                    return;
                }

                lock (_lock) {
                    oldNode = (SiteMapNode)ChildProviderTable[childProvider];
                    // If the child provider table has been updated, simply return null. See above.
                    if (oldNode == null)
                    {
                        return;
                    }

                    newNode = childProvider.GetRootNodeCore();
                    if (newNode == null)
                    {
                        throw new ProviderException(SR.GetString(SR.XmlSiteMapProvider_invalid_sitemapnode_returned, childProvider.Name));
                    }

                    if (!oldNode.Equals(newNode))
                    {
                        // If the current provider does not contain any nodes but one child provider
                        // ie. _siteMapNode == oldNode
                        // the oldNode needs to be removed from Url table and the new node will be added.
                        if (_siteMapNode.Equals(oldNode))
                        {
                            UrlTable.Remove(oldNode.Url);
                            KeyTable.Remove(oldNode.Key);

                            UrlTable.Add(newNode.Url, newNode);
                            KeyTable.Add(newNode.Key, newNode);

                            _siteMapNode = newNode;
                        }

                        // First find the parent node
                        SiteMapNode parent = (SiteMapNode)ParentNodeTable[oldNode];

                        // parent is null when the provider does not contain any static nodes, ie.
                        // it only contains definition to include one child provider.
                        if (parent != null)
                        {
                            // Update the child nodes table
                            SiteMapNodeCollection list = (SiteMapNodeCollection)ChildNodeCollectionTable[parent];

                            // Add the newNode to where the oldNode is within parent node's collection.
                            int index = list.IndexOf(oldNode);
                            if (index != -1)
                            {
                                list.Remove(oldNode);
                                list.Insert(index, newNode);
                            }
                            else
                            {
                                list.Add(newNode);
                            }

                            // Update the parent table
                            ParentNodeTable[newNode] = parent;
                            ParentNodeTable.Remove(oldNode);

                            // Update the Url table
                            UrlTable.Remove(oldNode.Url);
                            KeyTable.Remove(oldNode.Key);

                            UrlTable.Add(newNode.Url, newNode);
                            KeyTable.Add(newNode.Key, newNode);
                        }
                        else
                        {
                            // Notify the parent provider to update its child provider collection.
                            XmlSiteMapProvider provider = ParentProvider as XmlSiteMapProvider;
                            if (provider != null)
                            {
                                provider.EnsureChildSiteMapProviderUpToDate(this);
                            }
                        }

                        // Update provider nodes;
                        ChildProviderTable[childProvider] = newNode;
                        _childProviderList = null;
                    }
                }
            }
        }
Example #10
0
 private void Start()
 {
     netManager.GetRequest(UrlTable.GetCreateGameUrl(2));
 }