Exemplo n.º 1
0
        private string GetLanguageModifyScript(ExternalLanguage language, List <ExternalLanguageContent> contents, Dictionary <string, object> parameters, ModifyType modifyType, ContentModifyType contentModifyType = ContentModifyType.Add)
        {
            string contentScript = string.Empty;

            for (int i = 0; i < contents.Count; i++)
            {
                var    content   = contents[i];
                string seperator = contentScript == string.Empty ? "" : ",";
                contentScript = $"{contentScript}{seperator}{GetLanguageContent(content, i, parameters)}";
            }

            string ownerScript   = string.IsNullOrWhiteSpace(language.Owner) ? "" : $"AUTHORIZATION [{CUtils.EscapeStringCBracket(language.Owner)}]";
            string scriptAction  = modifyType == ModifyType.Create ? CreateScript : AlterScript;
            string contentAction = "FROM";

            if (modifyType == ModifyType.Alter)
            {
                switch (contentModifyType)
                {
                case ContentModifyType.Modify:
                    contentAction = SetContentScript;
                    break;

                case ContentModifyType.Add:
                    contentAction = AddContentScript;
                    break;

                case ContentModifyType.Remove:
                    contentAction = RemoveContentScript;
                    break;
                }
            }
            return($@"
{scriptAction} [{CUtils.EscapeStringCBracket(language.Name)}]
{ownerScript}
{contentAction} {contentScript}
");
        }
Exemplo n.º 2
0
 private string GetDropScript(string languageName)
 {
     return($@"{DropScript} [{CUtils.EscapeStringCBracket(languageName)}]");
 }