<commit_before>﻿using Amazon.S3;
using Amazon.S3.Model;
using System;
using System.Net;
using System.Threading.Tasks;
using static Heroes.ReplayParser.DataParser;

namespace HeroesParserData.HotsLogs
{
    public class HotsLogsUploader
    {
        public static async Task<ReplayParseResult> UploadReplay(string filePath)
        {
            AmazonS3Client client = new AmazonS3Client("<KEY>", "<KEY>", Amazon.RegionEndpoint.USEast1);

            string fileGuidName = $"{Guid.NewGuid()}.StormReplay";

            PutObjectRequest request = new PutObjectRequest
            {
                BucketName = "heroesreplays",
                Key = fileGuidName,
                FilePath = filePath
            };

            PutObjectResponse response = await client.PutObjectAsync(request);

            if (response.HttpStatusCode != HttpStatusCode.OK)
                throw new Exception("Failed to upload");

            using (WebClient webClient = new WebClient())
            {
                string result = webClient.DownloadString("https://www.hotslogs.com/UploadFile?FileName=" + fileGuidName);

                if (result == "Maintenance")
                    throw new MaintenanceException("Maintenance");

                return Utilities.GetReplayParseResultFromString(result);
            }
        }
    }


    [Serializable]
    public class MaintenanceException : Exception
    {
        public MaintenanceException(string message, Exception ex)
            :base(message, ex)
        {

        }

        public MaintenanceException(string message)
            : base(message)
        {
<commit_msg>Updated uploader credentials<commit_after>﻿using Amazon.S3;
using Amazon.S3.Model;
using System;
using System.Net;
using System.Threading.Tasks;
using static Heroes.ReplayParser.DataParser;

namespace HeroesParserData.HotsLogs
{
    public class HotsLogsUploader
    {
        public static async Task<ReplayParseResult> UploadReplay(string filePath)
        {
            AmazonS3Client client = new AmazonS3Client("<KEY>", "LJUzeVlvw1WX1TmxDqSaIZ9ZU04WQGcshPQyp21x", Amazon.RegionEndpoint.USEast1);

            string fileGuidName = $"{Guid.NewGuid()}.StormReplay";

            PutObjectRequest request = new PutObjectRequest
            {
                BucketName = "heroesreplays",
                Key = fileGuidName,
                FilePath = filePath
            };

            PutObjectResponse response = await client.PutObjectAsync(request);

            if (response.HttpStatusCode != HttpStatusCode.OK)
                throw new Exception("Failed to upload");

            using (WebClient webClient = new WebClient())
            {
                webClient.Headers["UserAgent"] = $"HeroesParserData {HPDVersion.GetVersionAsString()}; Replay Parser Uploader";
                string source = "HeroesParserData";
                string result = webClient.DownloadString($"https://www.hotslogs.com/UploadFile?FileName={fileGuidName}&Source={source}");


                if (result == "Maintenance")
                    throw new MaintenanceException("Maintenance");

                return Utilities.GetReplayParseResultFromString(result);
            }
        }
    }


    [Serializable]
    public class MaintenanceException : Exception
    {
        public MaintenanceException(string message, Exception ex)
            :base(message, ex)
        {

        }

        public MaintenanceException(string message)
            : base(message)
        {

{'fraction_non_alphanumeric': 0.08635973691735774, 'fraction_numerical': 0.004861309694023448, 'mean_word_length': 2.253953488372093, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 8, 'https://': 2, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2484795', 'n_tokens_mistral': 931, 'n_tokens_neox': 870, 'n_words': 186}