<commit_before>using System;
using System.IO;
using System.Threading;

namespace SilentOrbit.ProtocolBuffers
{
    class MainClass
    {
        public static int Main(string[] args)
        {
            if (args.Length == 0)
            {
                Console.Error.WriteLine("Usage:\n\tCodeGenerator.exe [--preserve-names] [--use-tabs] path-to.proto [path-to-second.proto [...]] [output.cs]");
                return -1;
            }

            ProtoCollection collection = new ProtoCollection();
            string outputPath = null;

            int argIndex = 0;

            while (args.Length > argIndex && args [argIndex].StartsWith("--"))
            {
                switch (args[argIndex])
                {
                    case "--preserve-names":
                        ProtoPrepare.ConvertToCamelCase = false;
                        break;
                    case "--use-tabs":
                        CodeWriter.IndentPrefix = "\t";
                        break;
                    default:
                        Console.Error.WriteLine("Unknown option: " + args[argIndex]);
                        return -1;
                }
                argIndex++;
            }

            while (argIndex < args.Length)
            {
                string protoPath = Path.GetFullPath(args[argIndex]);
                string protoBase = Path.Combine(
                        Path.GetDirectoryName(protoPath),
                        Path.GetFileNameWithoutExtension(protoPath));
                argIndex += 1;

                //First .proto filename is used as output unless specified later
                if (outputPath == null)
                    outputPath = protoBase + ".cs";
                //Handle last argument as the output .cs path
                if (argIndex == args.Length && protoPath.EndsWith(".cs"))
                {
                    outputPath = protoPath;
                    break;
                }

                // Handle custom output directory
                else if (argIndex == args.Length && protoPath.EndsWith("\\"))
                {
                    string outputDir = Path.GetDirectoryName(protoPath);

                    // Create the output directory if it doesn't exist
                    if (Directory.Exists(outputDir) == false)
                        Directory.CreateDirectory(outputDir);

                    // Replace the original output directory with the custom one
                    outputPath = Path.Combine(
                            outputDir,
                            Path.GetFileName(outputPath));<commit_msg>Simplified code for directory output argument.<commit_after>using System;
using System.IO;
using System.Threading;

namespace SilentOrbit.ProtocolBuffers
{
    class MainClass
    {
        public static int Main(string[] args)
        {
            if (args.Length == 0)
            {
                Console.Error.WriteLine("Usage:\n\tCodeGenerator.exe [--preserve-names] [--use-tabs] path-to.proto [path-to-second.proto [...]] [output.cs]");
                return -1;
            }

            ProtoCollection collection = new ProtoCollection();
            string outputPath = null;

            int argIndex = 0;

            while (args.Length > argIndex && args [argIndex].StartsWith("--"))
            {
                switch (args[argIndex])
                {
                    case "--preserve-names":
                        ProtoPrepare.ConvertToCamelCase = false;
                        break;
                    case "--use-tabs":
                        CodeWriter.IndentPrefix = "\t";
                        break;
                    default:
                        Console.Error.WriteLine("Unknown option: " + args[argIndex]);
                        return -1;
                }
                argIndex++;
            }

            while (argIndex < args.Length)
            {
                string protoPath = Path.GetFullPath(args[argIndex]);
                string protoBase = Path.Combine(
                        Path.GetDirectoryName(protoPath),
                        Path.GetFileNameWithoutExtension(protoPath));
                argIndex += 1;

                //First .proto filename is used as output unless specified later
                if (outputPath == null)
                    outputPath = protoBase + ".cs";

                //Handle last argument as the output .cs path
                if (argIndex == args.Length && protoPath.EndsWith(".cs"))
                {
                    outputPath = protoPath;
                    break;
                }

                //Handle last argument as the output path
                //Filename is taken from first .proto argument
                if (argIndex == args.Length && protoPath.EndsWith(Path.DirectorySeparatorChar.ToString()))
                {
                    Directory.CreateDirectory(protoPath);

                    // Replace the original output directory with the custom one
                    outputPath = Path.Combine(protoPath, Path.GetFileName(outputPath));
{'fraction_non_alphanumeric': 0.09221392056626032, 'fraction_numerical': 0.001966181675186787, 'mean_word_length': 1.2233391608391608, 'pattern_counts': {'":': 4, '<': 5, '<?xml version=': 0, '>': 5, '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': '1738134', 'n_tokens_mistral': 1205, 'n_tokens_neox': 1104, 'n_words': 280}