<commit_before>﻿using OfflineServer.Data;
using System;
using System.IO;
using System.Text;

namespace OfflineServer.Servers.Http.Classes
{
    // Normally, this is false and should not ever be done. However,
    // NFS:W sends requests for each product entry even though it knows
    // there should be a database waiting to run a query on the 'categoryName'.
    // Though, since NFS:W does the requests for us, I'm just abusing it for:
    // 1. Easy management in code, and, 2. Easy installation of mods.
    public static class Catalog
    {
        public static String categories()
        {
            String targetCategoryName = Access.sHttp.request.Params.Get("categoryName");
            if (!String.IsNullOrWhiteSpace(targetCategoryName))
                return "<ArrayOfCategoryTrans/>";

            String targetLocalFile = Path.Combine(DataEx.dir_CurrentHttpServerCategories, targetCategoryName + ".xml");
            if (File.Exists(targetLocalFile))
                return File.ReadAllText(targetLocalFile, Encoding.UTF8);

            return "<ArrayOfCategoryTrans/>";
        }

        public static String productsInCategory()
        {
            String targetProductName = Access.sHttp.request.Params.Get("categoryName");
            if (!String.IsNullOrWhiteSpace(targetProductName))
                return "<ArrayOfProductTrans/>";

            String targetLocalFile = Path.Combine(DataEx.dir_CurrentHttpServerProducts, targetProductName + ".xml");
            if (File.Exists(targetLocalFile))
                return File.ReadAllText(targetLocalFile, Encoding.UTF8);
            
            return "<ArrayOfProductTrans/>";
        }
    }
}<commit_msg>Fixed catalog<commit_after>﻿using OfflineServer.Data;
using System;
using System.IO;
using System.Text;

namespace OfflineServer.Servers.Http.Classes
{
    // Normally, this is false and should not ever be done. However,
    // NFS:W sends requests for each product entry even though it knows
    // there should be a database waiting to run a query on the 'categoryName'.
    // Though, since NFS:W does the requests for us, I'm just abusing it for:
    // 1. Easy management in code, and, 2. Easy installation of mods.
    public static class Catalog
    {
        public static String categories()
        {
            String targetCategoryName = Access.sHttp.request.Params.Get("categoryName");
            if (String.IsNullOrWhiteSpace(targetCategoryName))
                return "<ArrayOfCategoryTrans/>";

            String targetLocalFile = Path.Combine(DataEx.dir_CurrentHttpServerCategories, targetCategoryName + ".xml");
            if (File.Exists(targetLocalFile))
                return File.ReadAllText(targetLocalFile, Encoding.UTF8);

            return "<ArrayOfCategoryTrans/>";
        }

        public static String productsInCategory()
        {
            String targetProductName = Access.sHttp.request.Params.Get("categoryName");
            if (String.IsNullOrWhiteSpace(targetProductName))
                return "<ArrayOfProductTrans/>";

            String targetLocalFile = Path.Combine(DataEx.dir_CurrentHttpServerProducts, targetProductName + ".xml");
            if (File.Exists(targetLocalFile))
                return File.ReadAllText(targetLocalFile, Encoding.UTF8);
            
            return "<ArrayOfProductTrans/>";
        }
    }
}
{'fraction_non_alphanumeric': 0.0903149138443256, 'fraction_numerical': 0.0023767082590612004, 'mean_word_length': 2.6049250535331905, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 4}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5704709', 'n_tokens_mistral': 872, 'n_tokens_neox': 844, 'n_words': 239}