core.Core.Core C# (CSharp) Method

Core() public method

Constructs an instance of Core Registers handlers to catch ChatMessage events
public Core ( ) : System
return System
        public Core()
        {
            CommHandler = new CommHandler();
            CommHandler.CoreListener += MessageHandler;

            MessageQueue = new Queue<ChatMessage>();
            ServerMessages = new Dictionary<string, DateTime>();

            // Create chatMessage table if it does not exist
            var storageAccount =
                CloudStorageAccount.Parse(RoleEnvironment.GetConfigurationSettingValue("StorageConnectionString"));
            var tableClient = storageAccount.CreateCloudTableClient();
            MessageTable = tableClient.GetTableReference("chatMessages");
            MessageTable.CreateIfNotExists();

            // Create log table if it does not exist
            LogTable = tableClient.GetTableReference("serverLogs");
            LogTable.CreateIfNotExists();

            // Create cred table if it does not exist
            CredTable = tableClient.GetTableReference("serverSettings");
            CredTable.CreateIfNotExists();
        }