public RunParams()
        {
            OldTestFolders = null;
            NewTestFolders = null;

            AppExecutableFolder = "";
            PathTestsKonfigFXML = "";
        }
        public void SetDirectoryVariables(string[] args)
        {
            AppExecutableFolder = ExecutableAppFolder(args);

            PathTestsKonfigFXML = System.IO.Path.Combine(AppExecutableFolder, fileTestsKonfigFXML);

            OldTestFolders = new TestInitParams("OLD_VERSION", "OLD_TEST_DATA");
            OldTestFolders.NastavTestsFolders(AppExecutableFolder);

            NewTestFolders = new TestInitParams("NEW_VERSION", "NEW_TEST_DATA");
            NewTestFolders.NastavTestsFolders(AppExecutableFolder);
        }
        private static string CreateImportFileXJSON(JsonDataParams data, TestInitParams folders, string fileImportPref, int archivaceRun)
        {
            const long PRE_IMPORT_ARCHIVACE = 0;

            string sRokMesFrom = data.RokMesFrom;
            string sRokMesUpto = data.RokMesUpto;

            string scriptFileName = fileImportPref + "RUN_IMPORT_MAIN.BAT";

            string testScriptImportFile = System.IO.Path.Combine(folders.PathTestsNodeFolder, scriptFileName);

            string suiteFileName = fileImportPref + "_IMPORT_JSON_MAIN.TXT";

            string testSuiteImportFile = System.IO.Path.Combine(folders.PathImportTxtFolder, suiteFileName);



            using (TextWriter writerBatFile = new StreamWriter(testScriptImportFile, false, Encoding.GetEncoding("windows-1250")))
            {
                string testRelBatchCommandLine = RunTestImportOKmzdyTarget("", "C:\\Program Files (x86)\\OKsystem\\OKmzdy pro Windows\\", "OKPRIJMY", testSuiteImportFile, "OKmzdy160.exe");
                string testDevBatchCommandLine = RunTestImportOKmzdyTarget("", "C:\\PROJEKTY_OKM\\A1300-01-2005\\vers.app\\Release\\", "OKPRIJMY", testSuiteImportFile, "OKmzdy160.exe");

                writerBatFile.WriteLine(testDevBatchCommandLine);

                writerBatFile.Close();
            }

            long nRokMesFrom = UtilsTable.RokMes(sRokMesFrom);
            long nRokMesUpto = UtilsTable.RokMes(sRokMesUpto);

            using (TextWriter writerSuite = new StreamWriter(testSuiteImportFile, false, Encoding.GetEncoding("windows-1250")))
            {
                AddCreateFirmaDavka(writerSuite, UtilsTable.RokNumber(sRokMesFrom), UtilsTable.MesNumber(sRokMesFrom), "TEST_XCSV_2015");

                foreach (var vyuct in data.Vyuct)
                {
                    if (nRokMesFrom <= vyuct.RokMesPocitany() && nRokMesUpto >= vyuct.RokMesPocitany())
                    {
                        var importListMesRokPPrac = data.PPrac.Where((c) => (c.RokMesicZaznamu == vyuct.RokMesicZaznamu)).ToList();

                        var importListMesRokUPPom = data.UPPom.Where((c) => (c.RokMesicZaznamu == vyuct.RokMesicZaznamu)).ToList();

                        var importListMesRokDDeti = data.DDeti.Where((c) => (c.RokMesicZaznamu == vyuct.RokMesicZaznamu)).ToList();

                        var importListMesRokMMzda = data.MMzda.Where((c) => (c.RokMesicZaznamu == vyuct.RokMesicZaznamu && c.RokMesicZadani == vyuct.RokMesicZaznamu)).ToList();

                        var importListMesRokMNepr = data.MNepr.Where((c) => (c.RokMesicZaznamu == vyuct.RokMesicZaznamu && c.RokMesicZadani == vyuct.RokMesicZaznamu)).ToList();

                        var importListMesRokORMes = data.MMzda
                                                    .Where((c) => (c.RokMesicZaznamu == vyuct.RokMesicZaznamu && c.RokMesicZadani != vyuct.RokMesicZaznamu))
                                                    .Select((v) => (v.RokMesicZadani))
                                                    .OrderBy((o) => (o)).ToList();

                        var importListMesRokSestR = data.SestR.Where((c) => (c.RokMesicZaznamu == vyuct.RokMesicZaznamu)).ToList();

                        string fileNamePPrac = fileImportPref + "_" + vyuct.RokMesicZaznamu + "_IMPORT_PRAC.TXT";

                        string filePathPPrac = System.IO.Path.Combine(folders.PathImportTxtFolder, fileNamePPrac);

                        string fileNameMMzda = fileImportPref + "_" + vyuct.RokMesicZaznamu + "_IMPORT_MZDA.TXT";

                        string filePathMMzda = System.IO.Path.Combine(folders.PathImportTxtFolder, fileNameMMzda);

                        if (importListMesRokPPrac.Count > 0 || importListMesRokUPPom.Count > 0 || importListMesRokDDeti.Count > 0)
                        {
                            using (TextWriter writer = new StreamWriter(filePathPPrac, false, Encoding.GetEncoding("windows-1250")))
                            {
                                foreach (var pprac in importListMesRokPPrac)
                                {
                                    pprac.CreateImportRecord01(writer);
                                    pprac.CreateImportRecord02(writer);
                                    pprac.CreateImportRecord03(writer);
                                    pprac.CreateImportRecord05(writer);
                                    pprac.CreateImportRecord07(writer);
                                    pprac.CreateImportRecord08(writer);
                                    pprac.CreateImportRecord17(writer);
                                    pprac.CreateImportRecord18(writer);
                                }
                                foreach (var uppom in importListMesRokUPPom)
                                {
                                    uppom.CreateImportRecord17(writer);
                                    uppom.CreateImportRecord18(writer);
                                }
                                foreach (var ddeti in importListMesRokDDeti)
                                {
                                    ddeti.CreateImportRecord09(writer);
                                }
                                writer.Close();
                            }
                            AddImportFDavka(writerSuite, vyuct.RokPocitany(), vyuct.MesPocitany(), filePathPPrac, vyuct.ArchivNazev + vyuct.RokMesicZaznamu, PRE_IMPORT_ARCHIVACE);
                        }

                        if (importListMesRokMMzda.Count > 0 || importListMesRokMNepr.Count > 0)
                        {
                            using (TextWriter writer = new StreamWriter(filePathMMzda, false, Encoding.GetEncoding("windows-1250")))
                            {
                                foreach (var mmzda in importListMesRokMMzda)
                                {
                                    mmzda.CreateImportRecord19(writer);
                                }
                                foreach (var mnepr in importListMesRokMNepr)
                                {
                                    mnepr.CreateImportRecord20(writer);
                                }
                                writer.Close();
                            }
                            AddImportFDavka(writerSuite, vyuct.RokPocitany(), vyuct.MesPocitany(), filePathMMzda, vyuct.ArchivNazev + vyuct.RokMesicZaznamu, PRE_IMPORT_ARCHIVACE);
                        }

                        foreach (var ormes in importListMesRokORMes)
                        {
                            string fileNameOMzda = fileImportPref + "_" + vyuct.RokMesicZaznamu + ormes + "_IMPORT_OMIN.TXT";

                            string filePathOMzda = System.IO.Path.Combine(folders.PathImportTxtFolder, fileNameOMzda);

                            var importListMesRokOMzda = data.MMzda.Where((c) => (c.RokMesicZaznamu == vyuct.RokMesicZaznamu && c.RokMesicZadani == ormes)).ToList();

                            if (importListMesRokOMzda.Count > 0)
                            {
                                using (TextWriter writer = new StreamWriter(filePathOMzda, false, Encoding.GetEncoding("windows-1250")))
                                {
                                    foreach (var mmzda in importListMesRokOMzda)
                                    {
                                        mmzda.CreateImportRecord19(writer);
                                    }
                                    writer.Close();
                                }
                                AddImportFDavka(writerSuite, UtilsTable.RokNumber(ormes), UtilsTable.MesNumber(ormes), filePathOMzda, vyuct.ArchivNazev + vyuct.RokMesicZaznamu, PRE_IMPORT_ARCHIVACE);
                            }
                        }

                        foreach (var sestr in importListMesRokSestR)
                        {
                            sestr.CreateImportRecord154(writerSuite);
                        }

                        AddVyuctovDavka(writerSuite, vyuct.RokPocitany(), vyuct.MesPocitany(), vyuct.ArchivNazev, vyuct.IsArchivRun(), vyuct.IsReportRun());
                    }
                }
                AddUploadFirmaDavka(writerSuite, UtilsTable.RokNumber(sRokMesFrom), UtilsTable.MesNumber(sRokMesFrom), RunParams.TEST_OSOBUTVAR_DAVKA);

                writerSuite.Close();
            }

            return(testSuiteImportFile);
        }