<commit_before>
#pragma once

#include "idemowriter.h"
#include "netmessages/nethandlers.h"
#include "demotypes.h"
#include <cstdio>
#include <iostream>

class ConLogWriter: public IDemoWriter
{
public:
    ConLogWriter(FILE* outputFp);

    virtual void StartWriting(demoheader_t& header) override final;
    virtual void EndWriting() override final;

    virtual void StartCommandPacket(CommandPacket& packet) override final;
    virtual void EndCommandPacket() override final;

    virtual void WriteNetPacket(NetPacket& packet) override final;

private:
    FILE* m_outputFp;
};

IDemoWriter* IDemoWriter::CreateConLogWriter(void* outputFp)
{
    return new ConLogWriter(reinterpret_cast<FILE*>(outputFp));
}

ConLogWriter::ConLogWriter(FILE* outputFp):
    m_outputFp(outputFp)
{
}

void ConLogWriter::StartWriting(demoheader_t& header)
{
    //std::ostringstream ss;
    //ss << "Playing demo from " <<  << ".\n";
    //fputs(ss.str().c_str(), m_outputFp);
    //std::clog << ss.str() << std::endl;
}

void ConLogWriter::EndWriting()
{
}

void ConLogWriter::StartCommandPacket(CommandPacket& packet)
{
}

void ConLogWriter::EndCommandPacket()
{
}

void ConLogWriter::WriteNetPacket(NetPacket& packet)
{
    std::ostringstream ss;
    NetHandlers::NetMsg_ToString(packet.type, ss, packet.data);
    ss << "\n";
    fputs(ss.str().c_str(), m_outputFp);
    std::clog << ss.str();
}
<commit_msg>Fixed net_nop causing empty lines in output<commit_after>
#pragma once

#include "idemowriter.h"
#include "netmessages/nethandlers.h"
#include "demotypes.h"
#include <cstdio>
#include <iostream>

class ConLogWriter: public IDemoWriter
{
public:
    ConLogWriter(FILE* outputFp);

    virtual void StartWriting(demoheader_t& header) override final;
    virtual void EndWriting() override final;

    virtual void StartCommandPacket(CommandPacket& packet) override final;
    virtual void EndCommandPacket() override final;

    virtual void WriteNetPacket(NetPacket& packet) override final;

private:
    FILE* m_outputFp;
};

IDemoWriter* IDemoWriter::CreateConLogWriter(void* outputFp)
{
    return new ConLogWriter(reinterpret_cast<FILE*>(outputFp));
}

ConLogWriter::ConLogWriter(FILE* outputFp):
    m_outputFp(outputFp)
{
}

void ConLogWriter::StartWriting(demoheader_t& header)
{
    //std::ostringstream ss;
    //ss << "Playing demo from " <<  << ".\n";
    //fputs(ss.str().c_str(), m_outputFp);
    //std::clog << ss.str() << std::endl;
}

void ConLogWriter::EndWriting()
{
}

void ConLogWriter::StartCommandPacket(CommandPacket& packet)
{
}

void ConLogWriter::EndCommandPacket()
{
}

void ConLogWriter::WriteNetPacket(NetPacket& packet)
{
    std::ostringstream ss;
    NetHandlers::NetMsg_ToString(packet.type, ss, packet.data);
    if (ss.tellp() > 0)
    {
        ss << "\n";
        fputs(ss.str().c_str(), m_outputFp);
        std::clog << ss.str();
    }
}

{'fraction_non_alphanumeric': 0.13778705636743216, 'fraction_numerical': 0.0003479471120389701, 'mean_word_length': 4.796370967741935, 'pattern_counts': {'":': 0, '<': 37, '<?xml version=': 0, '>': 10, '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': '888068', 'n_tokens_mistral': 1006, 'n_tokens_neox': 974, 'n_words': 201}