<commit_before>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Hadouken.Http;
using Hadouken.BitTorrent;

namespace Hadouken.Impl.Http.Api
{
    [ApiAction("getprops")]
    public class GetProperties : ApiAction
    {
        private readonly IBitTorrentEngine _torrentEngine;

        public GetProperties(IBitTorrentEngine torrentEngine)
        {
            _torrentEngine = torrentEngine;
        }

        public override ActionResult Execute()
        {
            string hash = Context.Request.QueryString["hash"];

            if(_torrentEngine.Managers.ContainsKey(hash))
            {
                var manager = _torrentEngine.Managers[hash];
                return Json(new[]
                                {
                                    new
                                        {
                                            hash = manager.InfoHash,
                                            trackers = "",
                                            //ulrate = manager.Settings
                                        }
                                });
            }

            return Json(new { props = new [] {new {}} });
        }
    }
}<commit_msg>Improved `getprops`<commit_after>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Hadouken.Http;
using Hadouken.BitTorrent;

namespace Hadouken.Impl.Http.Api
{
    [ApiAction("getprops")]
    public class GetProperties : ApiAction
    {
        private readonly IBitTorrentEngine _torrentEngine;

        public GetProperties(IBitTorrentEngine torrentEngine)
        {
            _torrentEngine = torrentEngine;
        }

        public override ActionResult Execute()
        {
            string hash = Context.Request.QueryString["hash"];

            if (_torrentEngine.Managers.ContainsKey(hash))
            {
                var manager = _torrentEngine.Managers[hash];
                return Json(new
                                {
                                    props = new[]
                                                {
                                                    new
                                                        {
                                                            hash = manager.InfoHash,
                                                            trackers = "",
                                                            ulrate = manager.Settings.MaxUploadSpeed,
                                                            dlrate = manager.Settings.MaxDownloadSpeed,
                                                            superseed = manager.IsInitialSeeding,
                                                            dht = manager.Settings.UseDht,
                                                            pex = manager.Settings.EnablePeerExchange,
                                                            seed_override = false,
                                                            seed_ratio = 0,
                                                            seed_time = 0,
                                                            ulslots = manager.Settings.UploadSlots,
                                                            seed_num = 0
                                                        }
                                                }
                                });
            }

            return Json(new { props = new [] {new {}} });
        }
    }
}
{'fraction_non_alphanumeric': 0.061934389140271495, 'fraction_numerical': 0.0008484162895927602, 'mean_word_length': 0.7782805429864253, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 45, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5392', 'n_tokens_mistral': 652, 'n_tokens_neox': 627, 'n_words': 126}