<commit_before>﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace RelhaxModpack
{
    class Logging
    {
        private const int all = 0;
        private const int manager = 1;
        private const int installer = 2;

        private const int iMaxLogLength = 1500000; // Probably should be bigger, say 2,000,000
        private const int iTrimmedLogLength = -300000; // minimum of how much of the old log to leave

        private static FileStream mfs;             // Manager stream
        private static FileStream ifs;             // Installer stream
        private static string InstalledFilesLogPath = null;
        private static string ManagerLogPath = null;

        private static object _locker = new object();

        public static void stubsManager(string s)
        {
            // create fielstream if not exists
            // - and write "fileheader"
            // - check once if the file exceeds a certain size
            // bei default, write the given string to file
        }

        public static void Manager(string s)
        {
            try
            {
                lock (_locker)              // avoid that 2 or more threads calling the Log function and writing lines in a mess
                {
                    //the method should automaticly make the file if it's not there
                    if (mfs == null)
                    {
                        if (ManagerLogPath == null) DefineManagerLogFile();
                        CutLogfile(ManagerLogPath);
                        mfs = new FileStream(ManagerLogPath, FileMode.Append, FileAccess.Write);
                    }
                    //if the info text is containing any linefeed/carrieage return, intend the next line with 26 space char
                    s = s.Replace("\n", "\n" + string.Concat(Enumerable.Repeat(" ", 26)));
                    s = string.Format("{0:yyyy-MM-dd HH:mm:ss.fff}   {1}\n", DateTime.Now, s);
                    mfs.Write(Encoding.UTF8.GetBytes(s), 0, Encoding.UTF8.GetByteCount(s));
                    mfs.Flush();        // to get every entry directly is important
                }
            }
            catch
            {
                // no target to write to .... create a window?
            }
        }

        public static void stubsInstaller(string s)
        {
            // if no filestream exists
            // create the filename to write with path
            // backup old install.logs
            // create filestream
            // - and write "fileheader"
            // bei default, write the given string to file
        }<commit_msg>fixed typing at comments<commit_after>﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace RelhaxModpack
{
    class Logging
    {
        private const int all = 0;
        private const int manager = 1;
        private const int installer = 2;

        private const int iMaxLogLength = 1500000; // Probably should be bigger, say 2,000,000
        private const int iTrimmedLogLength = -300000; // minimum of how much of the old log to leave

        private static FileStream mfs;             // Manager stream
        private static FileStream ifs;             // Installer stream
        private static string InstalledFilesLogPath = null;
        private static string ManagerLogPath = null;

        private static object _locker = new object();

        public static void stubsManager(string s)
        {
            // create fielstream if not exists
            // - and write "fileheader"
            // - check once if the file exceeds a certain size
            // by default, write the given string to file
        }

        public static void Manager(string s)
        {
            try
            {
                lock (_locker)              // avoid that 2 or more threads calling the Log function and writing lines in a mess
                {
                    //the method should automaticly make the file if it's not there
                    if (mfs == null)
                    {
                        if (ManagerLogPath == null) DefineManagerLogFile();
                        CutLogfile(ManagerLogPath);
                        mfs = new FileStream(ManagerLogPath, FileMode.Append, FileAccess.Write);
                    }
                    //if the info text is containing any linefeed/carrieage return, intend the next line with 26 space char
                    s = s.Replace("\n", "\n" + string.Concat(Enumerable.Repeat(" ", 26)));
                    s = string.Format("{0:yyyy-MM-dd HH:mm:ss.fff}   {1}\n", DateTime.Now, s);
                    mfs.Write(Encoding.UTF8.GetBytes(s), 0, Encoding.UTF8.GetByteCount(s));
                    mfs.Flush();        // to get every entry directly is important
                }
            }
            catch
            {
                // no target to write to .... create a window?
            }
        }

        public static void stubsInstaller(string s)
        {
            // if no filestream exists
            // create the filename to write with path
            // backup old install.logs
            // create filestream
            // - and write "fileheader"
            // by default, write the given string to file
        }
{'fraction_non_alphanumeric': 0.07520737327188941, 'fraction_numerical': 0.01216589861751152, 'mean_word_length': 1.4867094408799266, '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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4988842', 'n_tokens_mistral': 1384, 'n_tokens_neox': 1278, 'n_words': 489}