Пример #1
0
        public string ProvideLanguageContent(string languageId)
        {
            string languageFile =
                Path.Combine(this.LanguagesRegistration, $"{languageId}.xml");

            return(Development.ReadFileAsString(languageFile));
        }
Пример #2
0
        private static string ReadFileAsString(string fileLocation)
        {
            byte[] buffer = new byte[102400];

            Stream fileStream = null;

            try
            {
                fileStream = new FileStream(fileLocation, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);

                Encoding encoding =
                    Development.DetectEncoding(ref fileStream);
                StringBuilder fileContent = new StringBuilder();

                int rB;
                do
                {
                    rB = fileStream.Read(buffer, 0, buffer.Length);

                    if (rB > 0)
                    {
                        fileContent.Append(encoding.GetString(buffer, 0, rB));
                    }
                } while (rB != 0);

                return(fileContent.ToString());
            }
            finally
            {
                fileStream?.Close();
            }
        }
Пример #3
0
        public string ProvideTemplateContent(string serviceFullPath)
        {
            string templateFile =
                Path.Combine(this.TemplatesRegistration, $"{serviceFullPath}.xchtml");

            try
            {
                return(Development.ReadFileAsString(templateFile));
            }
            catch (FileNotFoundException)
            {
                throw new Exceptions.DeploymentException(string.Format(Global.SystemMessages.TEMPLATE_NOTFOUND + "!", serviceFullPath));
            }
        }
Пример #4
0
        public string ProvideConfigurationContent()
        {
            string configurationFile =
                Path.Combine(this.TemplatesRegistration, "Configuration.xml");

            try
            {
                return(Development.ReadFileAsString(configurationFile));
            }
            catch (FileNotFoundException ex)
            {
                throw new Exceptions.DeploymentException(Global.SystemMessages.ESSENTIAL_CONFIGURATIONNOTFOUND, ex);
            }
        }