Пример #1
0
        public static bool IsTemplateAvaliable()
        {
            try
            {
                var templatePath = DatabaseApi.GetTemplatePaths();
                if (string.IsNullOrEmpty(templatePath))
                {
                    return(false);
                }
                if (!Directory.Exists(templatePath))
                {
                    Directory.CreateDirectory(templatePath);
                    return(false);
                }

                var templatedir = Directory.CreateDirectory(templatePath);
                if (templatedir != null)
                {
                    if (Directory.GetFiles(templatedir.FullName, "*.template").ToList().Count > 0)
                    {
                        return(true);
                    }
                }

                return(false);
            }
            catch (Exception e)
            {
                Log.Error(e, "IsTemplateAvaliable");
                return(false);
            }
        }
Пример #2
0
        public static string GetTemplateDir()
        {
            var templatePath = DatabaseApi.GetTemplatePaths();

            if (string.IsNullOrEmpty(templatePath))
            {
                return(string.Empty);
            }
            if (!Directory.Exists(templatePath))
            {
                Directory.CreateDirectory(templatePath);
            }

            return(templatePath);
        }