예제 #1
0
        public static void httpPostLoggedMatch(LoggedMatch lm)
        {
            string api = GetApiUrl("LoggedMatch");

            if (api == null || api == "")
            {
                api = "v5-dev/MWArena/api/LoggedMatch";
            }
            HttpUtility.MakeRequest(api, lm, null, null, typeof(HttpResponseMessage));
        }
예제 #2
0
        public static void Publish(LoggedMatch match)
        {
            // Make sure someone is listening to event
            if (OnMatchCompleted == null)
            {
                return;
            }
            string publisher             = "MWA Overlay";
            MatchCompletedEventArgs args = new MatchCompletedEventArgs(match);

            OnMatchCompleted(publisher, args);
        }
예제 #3
0
        static void LogCSV()
        {
            string exePath       = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
            string playerCsvPath = Path.Combine(exePath, "player.csv");
            string matchCsvPath  = Path.Combine(exePath, "match.csv");

            apiUrl          = (System.Configuration.ConfigurationManager.AppSettings["ApiUrl"] == "" || System.Configuration.ConfigurationManager.AppSettings["ApiUrl"] == null) ? "http://mwarena.azurewebsites.net/api/" : System.Configuration.ConfigurationManager.AppSettings["ApiUrl"];
            associationName = (System.Configuration.ConfigurationManager.AppSettings["AssociationName"] == "" || System.Configuration.ConfigurationManager.AppSettings["AssociationName"] == null) ? "PUG" : System.Configuration.ConfigurationManager.AppSettings["AssociationName"];

            StringBuilder csv = new StringBuilder();

            if (!File.Exists(playerCsvPath))
            {
                csv.AppendLine(PlayerStat.GetFieldNames());
            }
            csv.AppendLine(playerStat.ToString());
            File.AppendAllText(playerCsvPath, csv.ToString());
            csv.Clear();
            if (!File.Exists(matchCsvPath))
            {
                csv.AppendLine(MatchStat.GetFieldNames());
            }


            foreach (MatchStat m in friendlyList)
            {
                //  httpPostMatchMetric(m);
                csv.AppendLine(m.ToString());
            }

            foreach (MatchStat m in enemyList)
            {
                //    httpPostMatchMetric(m);
                csv.AppendLine(m.ToString());
            }

            File.AppendAllText(matchCsvPath, csv.ToString());

            LoggedMatch lm = new LoggedMatch();

            lm.MatchHash          = "";//GetMatchHash();
            lm.FriendlyMatchStats = friendlyList;
            lm.EnemyMatchStats    = enemyList;
            lm.AssociationName    = associationName;
            lm.PublishingUserName = (playerNameSet) ? ((playerName == null | playerName == "") ? "UNKNOWN" : playerName) : "UNKNOWN";

            //MatchCompletedPublisher.Publish(lm);
            httpPostLoggedMatch(lm);
        }
예제 #4
0
        static void LogCSV()
        {
            string exePath       = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
            string playerCsvPath = Path.Combine(exePath, "player.csv");
            string matchCsvPath  = Path.Combine(exePath, "match.csv");

            StringBuilder csv = new StringBuilder();

            if (!File.Exists(playerCsvPath))
            {
                csv.AppendLine(PlayerStat.GetFieldNames());
            }
            csv.AppendLine(playerStat.ToString());
            File.AppendAllText(playerCsvPath, csv.ToString());
            csv.Clear();
            if (!File.Exists(matchCsvPath))
            {
                csv.AppendLine(MatchStat.GetFieldNames());
            }
            foreach (MatchStat m in friendlyList)
            {
                csv.AppendLine(m.ToString());
            }
            foreach (MatchStat m in enemyList)
            {
                csv.AppendLine(m.ToString());
            }
            File.AppendAllText(matchCsvPath, csv.ToString());
            LoggedMatch lm = new LoggedMatch
            {
                MatchHash          = "",
                FriendlyMatchStats = friendlyList,
                EnemyMatchStats    = enemyList,
                AssociationName    = "PUG",
                PublishingUserName =
                    (playerNameSet)
                        ? ((playerName == null | playerName == "")
                            ? "UNKNOWN"
                            : playerName)
                        : "UNKNOWN"
            };

            httpPostLoggedMatch(lm);
        }
예제 #5
0
        public static void httpPostLoggedMatch(LoggedMatch lm)
        {
            string api = "http://mwarena.azurewebsites.net/api/LoggedMatch";

            MakeRequest(api, lm, null, null, typeof(HttpResponseMessage));
        }
예제 #6
0
 public MatchCompletedEventArgs(LoggedMatch match)
 {
     Match = match;
 }