예제 #1
0
파일: ASUP.cs 프로젝트: pnolin/LiveSplit
        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));
        }
예제 #2
0
파일: ASUP.cs 프로젝트: Rezura/LiveSplit
        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);
        }