示例#1
0
        /// <summary>
        /// Sets the rootdirectory and all Bronbestanden.
        /// </summary>
        /// <param name="projectId"></param>
        /// <param name="rootDir"></param>
        /// <param name="sof"></param>
        /// <param name="saf"></param>
        public void InitializeInputDirectories(int projectId, string rootDir, bool sof, bool saf)
        {
            Debug.Assert(rootDir != null);
            Debug.Assert(DeploymentDirectory != null);

            IsSaf = saf;
            IsSof = sof;
            RootDirectory = rootDir;
            DeploymentDirectory = Utility.GetAssemblyRootPath();
            MyAccess target = new MyAccess { DeploymentDirectory = DeploymentDirectory };
            BronBestanden = target.GetPathBronBestanden(projectId, RootDirectory, sof, saf);
            ProjectId = projectId;
            ImplicDirectory = target.ImplicDirectory;
            FaalkansDirectory = target.FaalkansDirectory;
            TnoDirectory = target.TnoDirectory;
            ToetsPeilenDirectory = target.ToetsPeilenDirectory;            
            ResultDir = RootDirectory + "\\Resultaten";
            OutputDir = ResultDir + "\\ProjectId_" + projectId;
            LocatieNamen = GetLocatieNamen(MyAccess.Project.GegevensSet.GegevensSetId);
            SetImplicNamen();
            SetTnoFileName();
            SetScenFileName();
            SetToetspeilenFileName();
            Tpeilen = GetToetspeilen();
        }
示例#2
0
    private void HandleBronBestanden(bool sof, bool saf, Collection<string> bronPaden, bool createFiles)
    {
        BronBestanden = new CollectionBronPaden();

        Debug.Assert(DeploymentDirectory != null);
        string datadirDirSource = DeploymentDirectory + "\\datadir";
        string dirTarget = "";
        int i = 0;
        string shortName;
        string sourceFileName;
        string destFileName;

        foreach (var path in bronPaden)
        {

            if (Directory.Exists(path))
            {
                switch (i)
                {
                    case 0:
                        #region copy implic files

                        dirTarget = path;//implic-dir
                        ImplicDirectory = path;

                        if (createFiles)
                        {
                            string[] listDatadir = Directory.GetFiles(datadirDirSource);
                            //listDatadir.Dump();

                            int countFiles = listDatadir.Length;

                            for (int j = 0; j < countFiles; j++)
                            {
                                bool toBeCopied = true;

                                shortName = Path.GetFileName(listDatadir[j]);
                                bool isSof = shortName.ToLower(CultureInfo.InvariantCulture).StartsWith("sof");
                                bool isSaf = shortName.ToLower(CultureInfo.InvariantCulture).StartsWith("saf");
                                if (isSof && sof) { /*always true*/} else toBeCopied = false;
                                if (isSaf && saf) toBeCopied = true; ///else copy always.
                                if (!isSaf && !isSof) toBeCopied = true; ///else copy always.
                                ///
                                ///Log.ConsoleWriteline(shortName);
                                sourceFileName = datadirDirSource + @"\" + shortName;
                                destFileName = dirTarget + @"\" + shortName;
                                if (createFiles && File.Exists(destFileName))
                                    File.Delete(destFileName);

                                if (toBeCopied && createFiles)
                                {
                                    File.Copy(sourceFileName, destFileName);
                                }
                                BronBestanden.Add(new DataResource.DesignPatterns.BronBestand
                                {
                                    Naam = shortName,
                                    Pad = destFileName
                                });
                                //TODO: InitData.UniqueInstance.ImplicNamen.Add(shortName);//

                            }
                        }
                        #endregion
                        break;
                    case 1:
                        dirTarget = path;//Faalkansen.
                        FaalkansDirectory = path;

                        if (createFiles)
                        {
                            shortName = "Scenariokansen.txt";
                            CopyBronFile(shortName, dirTarget);
                            BronBestanden.Add(new DataResource.DesignPatterns.BronBestand
                            {
                                Naam = shortName,
                                Pad = path
                            });
                        }
                        break;
                    case 2:
                        dirTarget = path;//tno.
                        TnoDirectory = path;

                        if (createFiles)
                        {
                            shortName = "TNOkansen.txt";
                            CopyBronFile(shortName, dirTarget);
                            BronBestanden.Add(new DataResource.DesignPatterns.BronBestand
                            {
                                Naam = shortName,
                                Pad = path
                            });
                            shortName = "WenWTzV.dat";
                            CopyBronFile(shortName, dirTarget);
                            BronBestanden.Add(new DataResource.DesignPatterns.BronBestand
                            {
                                Naam = shortName,
                                Pad = path
                            });
                        }
                        break;
                    case 3:
                        dirTarget = path;//toetspeil.
                        ToetsPeilenDirectory = path;

                        if (createFiles)
                        {
                            shortName = "Toetspeilen.txt";
                            CopyBronFile(shortName, dirTarget);
                            BronBestanden.Add(new DataResource.DesignPatterns.BronBestand
                            {
                                Naam = shortName,
                                Pad = path
                            });
                        }
                        break;
                    default:
                        throw new NotImplementedException();
                }

            }

            i++;
        }

        ///Copy results
        CopyResults();
    }