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

namespace CueToOgg
{
    public class CueDirectoryConverter
    {

        public List<Track> tracks;

        public LoggerForm app;

        public CueDirectoryConverter(LoggerForm aApp)
        {
            app = aApp;
        }

        private void Log(string message)
        {
            if(app.Created)
                app.Invoke(app.Log, new object[] { (string)message });
        }

        private void Exit()
        {
            if (app.Created)
                app.Invoke(app.Exit);
        }

        private void FatalExit(string message)
        {
            if (app.Created)
                app.Invoke(app.FatalExit, new object[] { (string)message });
        }

        private void Alert(string message)
        {
            if (app.Created)
                app.Invoke(app.Alert, new object[] { (string)message });
        }

        private void ReportProgress(int message)
        {
            if (app.Created)
                app.Invoke(app.ReportProgress, new object[] { (int)message });
        }

        public void StartProcessing()
        {
            try
            {
                if (!File.Exists(Path.GetDirectoryName(Application.ExecutablePath) + "\\bin\\ffmpeg.exe"))
                    throw new Exception("FFMPEG not found. Cannot continue.\n");

                string[] files;
                files =
                    Directory.GetFiles(Path.GetDirectoryName(Application.ExecutablePath), "*.cue").Concat(
                    Directory.GetFiles(Path.GetDirectoryName(Application.ExecutablePath), "*.inst")).ToArray()
                    ;

                if (files == null || files.Length == 0)
                {

                    Log("No cue sheet found in current directory. Please select the directory containing them.\n");

                    var pathFinder = new FolderBrowserDialog();
                    var result = pathFinder.ShowDialog();
                    if (result != DialogResult.OK || pathFinder.SelectedPath == null || pathFinder.SelectedPath == "" || !Directory.Exists(pathFinder.SelectedPath))<commit_msg>Added "--path" option.<commit_after>﻿using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Text.RegularExpressions;
using System.Windows.Forms;

namespace CueToOgg
{
    public class CueDirectoryConverter
    {

        public List<Track> tracks;

        public LoggerForm app;

        public CueDirectoryConverter(LoggerForm aApp)
        {
            app = aApp;
        }

        private void Log(string message)
        {
            if(app.Created)
                app.Invoke(app.Log, new object[] { (string)message });
        }

        private void Exit()
        {
            if (app.Created)
                app.Invoke(app.Exit);
        }

        private void FatalExit(string message)
        {
            if (app.Created)
                app.Invoke(app.FatalExit, new object[] { (string)message });
        }

        private void Alert(string message)
        {
            if (app.Created)
                app.Invoke(app.Alert, new object[] { (string)message });
        }

        private void ReportProgress(int message)
        {
            if (app.Created)
                app.Invoke(app.ReportProgress, new object[] { (int)message });
        }

        public void StartProcessing()
        {
            try
            {
                if (!File.Exists(Path.GetDirectoryName(Application.ExecutablePath) + "\\bin\\ffmpeg.exe"))
                    throw new Exception("FFMPEG not found. Cannot continue.\n");

                string[] files;

                if (Program.cmdArgs.ContainsKey("--path") && Directory.Exists(Program.cmdArgs["--path"])){
                    files =
                    Directory.GetFiles(Program.cmdArgs["--path"], "*.cue").Concat(
                    Directory.GetFiles(Program.cmdArgs["--path"], "*.inst")).ToArray();
                }
                else { 
                    files =
                    Directory.GetFiles(Path.GetDirectoryName(Application.ExecutablePath), "*.cue").Concat(
                    Directory.GetFiles(Path.GetDirectoryName(Application.ExecutablePath), "*.inst")).ToArray()
                    ;
                }

                if (files == null || files.Length == 0)
                {

                    Log("No cue sheet found in current directory. Please select the directory containing them.\n");

                    var pathFinder = new FolderBrowserDialog();
                    var result = pathFinder.ShowDialog();
                    if (result != DialogResult.OK || pathFinder.SelectedPath == null || pathFinder.SelectedPath == "" || !Directory.Exists(pathFinder.SelectedPath))
{'fraction_non_alphanumeric': 0.10969180859691809, 'fraction_numerical': 0.00040551500405515005, 'mean_word_length': 1.6751626898047722, 'pattern_counts': {'":': 0, '<': 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': '4704669', 'n_tokens_mistral': 1292, 'n_tokens_neox': 1206, 'n_words': 268}