コード例 #1
0
        public Dictaat CreateDictaat(string name, string template = null)
        {
            //Default value van template is 'default'
            string pathTemplate  = _pathHelper.DirectoryTemplatePath(template == null ? "default" : template);
            string pathNew       = _pathHelper.DictaatPath(name);
            string pathNewConfig = _pathHelper.DictaatConfigPath(name);

            if (_directory.Exists(pathNew))
            {
                return(null);
            }

            //copy template
            _directory.CopyDirectory(pathNew, pathTemplate);

            //edit custom files
            var dictaatConfig = _json.ReadFile(pathNewConfig);

            dictaatConfig["name"] = name;
            _json.EditFile(pathNewConfig, dictaatConfig);

            return(this.GetDictaat(name));
        }