Exemplo n.º 1
0
        public dynamic SubmitRun(
            IRun run,
            String username, String password,
            String gameId, String categoryId,
            String version, String comment,
            String video,
            params String[] additionalParams)
        {
            var timeFormatter = new ASUPTimeFormatter();

            var splitsBuilder = new StringBuilder();

            splitsBuilder.Append("[");

            foreach (var segment in run)
            {
                splitsBuilder.Append(timeFormatter.Format(segment.PersonalBestSplitTime.RealTime));
                splitsBuilder.Append(", ");
            }

            splitsBuilder.Length -= 2;
            splitsBuilder.Append("]");

            var elements = new String[]
            {
                "type", "submitrun",
                "username", username,
                "password", password,
                "game", gameId,
                "category", categoryId,
                "version", version,
                "runtime", timeFormatter.Format(run.Last().PersonalBestSplitTime.RealTime),
                "comment", comment,
                "video", video,
                "splits", splitsBuilder.ToString(),
            }.Concat(additionalParams).ToArray();

            return(JSON.FromUriPost(ServerUri, elements));
        }
Exemplo n.º 2
0
        public dynamic SubmitRun(
            IRun run,
            string username, string password,
            string gameId, string categoryId,
            string version, string comment,
            string video,
            params string[] additionalParams)
        {
            var timeFormatter = new ASUPTimeFormatter();

            var splitsBuilder = new StringBuilder();

            splitsBuilder.Append("[");

            foreach (var segment in run)
            {
                splitsBuilder.Append(timeFormatter.Format(segment.PersonalBestSplitTime.RealTime));
                splitsBuilder.Append(", ");
            }

            splitsBuilder.Length -= 2;
            splitsBuilder.Append("]");

            var elements = new string[]
            {
                "type", "submitrun", 
                "username", username,
                "password", password,
                "game", gameId,
                "category", categoryId,
                "version", version,
                "runtime", timeFormatter.Format(run.Last().PersonalBestSplitTime.RealTime),
                "comment", comment,
                "video", video,
                "splits", splitsBuilder.ToString(),
            }.Concat(additionalParams).ToArray();

            return JSON.FromUriPost(ServerUri, elements);
        }