public override CollectedData OnAcquire()
        {
            Tuple <Dictionary <string, ulong>, bool> dict = this.QueryDatabase();

            // Don't report the COMMON DB unless we're the server
            if (IsServer)
            {
                COMMONDBSizeRequest common_db_request = new COMMONDBSizeRequest();
                RequestBus.Instance.MakeRequest(common_db_request);
                if (common_db_request.IsHandled)
                {
                    dict.Item1[common_db_request.Filename] = common_db_request.SizeInMB;
                }
            }

            ListData <Dictionary <string, string> > data = new ListData <Dictionary <string, string> >(Context);

            foreach (KeyValuePair <string, ulong> database in dict.Item1)
            {
                Dictionary <string, string> size = new Dictionary <string, string>
                {
                    ["Name"] = database.Key,
                    ["Size"] = database.Value.ToString()
                };

                data.Data.Add(size);
            }

            return(new CollectedData(Context, dict.Item2, data));
        }
Example #2
0
        public override void HandleRequest(Request request)
        {
            if (request is COMMONDBSizeRequest)
            {
                COMMONDBSizeRequest db_request = request as COMMONDBSizeRequest;
                Database            db         = new Database();
                COMMONDatabaseInfo  dbinfo     = new COMMONDatabaseInfo(db);

                Tuple <string, uint> info = dbinfo.GetDatabaseInformation();
                if (info != null)
                {
                    db_request.Filename = info.Item1;
                    db_request.SizeInMB = info.Item2;

                    request.Handled();
                }
            }
        }