예제 #1
0
        public override void Validate()
        {
            this.IsValid = false;

            if (this.Line.CountTokens() > 3 && !this.Line.GetTokenOn(3).ToLower().Equals("on"))
            {
                CommandProcessor.DisplayError(this.Syntax, "Invalid token {0}", this.Line.GetTokenOn(3));
                return;
            }

            var types = new[] { "instance", "domain" };

            if (this.Line.CountTokens() > 4 && !types.Contains(this.Line.GetTokenOn(4).ToLower()))
            {
                CommandProcessor.DisplayError(Empty, "Invalid token {0}", this.Line.GetTokenOn(4));
                return;
            }

            if (IsNullOrWhiteSpace(this.TemplateName))
            {
                CommandProcessor.DisplayError(Empty, "Template was not mentioned.");
                return;
            }

            if (IsNullOrWhiteSpace(this.InstanceName) && IsNullOrWhiteSpace(this.DomainName))
            {
                CommandProcessor.DisplayError(Empty, "Instance or domain is empty.");
            }

            this.IsValid = this.CheckInstance();
        }
예제 #2
0
        public override void Validate()
        {
            this.IsValid = false;

            if (this.Line.CountTokens() != 6)
            {
                CommandProcessor.DisplayError(this.Syntax, "Invalid command {0}", this.Line);
                return;
            }

            if (this.Line.GetTokenOn(2).ToLowerInvariant() != "schema")
            {
                CommandProcessor.DisplayError(this.Syntax, "Invalid token {0}", this.Line.GetTokenOn(2));
                return;
            }

            if (this.Line.GetTokenOn(3).ToLowerInvariant() != "on")
            {
                CommandProcessor.DisplayError(this.Syntax, "Invalid token {0}", this.Line.GetTokenOn(3));
                return;
            }

            if (this.Line.GetTokenOn(4).ToLowerInvariant() != "site")
            {
                CommandProcessor.DisplayError(this.Syntax, "Invalid token {0}", this.Line.GetTokenOn(4));
                return;
            }

            this.IsValid = true;
        }
예제 #3
0
        public override void Validate()
        {
            this.IsValid = false;

            if (this.Line.CountTokens() == 2)
            {
                this.IsValid = true;
                return;
            }

            if (this.OnToken.ToUpperInvariant() != "ON")
            {
                CommandProcessor.DisplayError(this.Syntax, $"Invalid token data {this.OnToken}");
                return;
            }

            string path      = @"{0}\Areas\{1}\AppInfo.json";
            string directory = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "..");

            if (this.AppName.ToUpperInvariant() == "FRAPID")
            {
                this.IsValid = true;
                return;
            }

            path = string.Format(path, directory, this.AppName);

            if (!File.Exists(path))
            {
                CommandProcessor.DisplayError(string.Empty, "Invalid application name \"{0}\".", this.AppName);
                return;
            }

            this.IsValid = true;
        }
예제 #4
0
        public override void Validate()
        {
            this.IsValid = false;

            if (this.Line.CountTokens() == 2)
            {
                this.IsValid = true;
                return;
            }

            if (this.ForToken.ToUpperInvariant() != "FOR")
            {
                CommandProcessor.DisplayError(this.Syntax, $"Invalid token data {this.ForToken}");
                return;
            }

            bool validCulture = CultureInfo.GetCultures(CultureTypes.AllCultures).Any(culture => string.Equals(culture.Name, this.Language, StringComparison.CurrentCultureIgnoreCase));

            if (!validCulture)
            {
                CommandProcessor.DisplayError(string.Empty, "Invalid culture name \"{0}\".", this.Language);
                return;
            }

            this.IsValid = true;
        }
예제 #5
0
        private bool CheckInstance()
        {
            string path      = @"{0}\Tenants\{1}";
            string directory = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "..");

            path = Format(path, directory, this.InstanceName);

            if (!Directory.Exists(path))
            {
                CommandProcessor.DisplayError(Empty, "The instance {0} was not found.", this.InstanceName);
                return(false);
            }

            return(true);
        }
예제 #6
0
        public override void Validate()
        {
            this.IsValid = false;

            if (this.Line.CountTokens() > 5 &&
                !this.CleanupWhenDone)
            {
                CommandProcessor.DisplayError(this.Syntax, "Invalid token {0}", this.Line.GetTokenOn(5));
                return;
            }

            if (this.Line.CountTokens() > 8 &&
                this.CleanupWhenDone)
            {
                CommandProcessor.DisplayError(this.Syntax, "Invalid token {0}", this.Line.GetTokenOn(8));
                return;
            }

            string type = this.Line.GetTokenOn(1);

            if (!type.ToUpperInvariant().Equals("SITE"))
            {
                CommandProcessor.DisplayError(this.Syntax, "{0} is not a well-known terminology. Expecting: \"site\".", type);
                return;
            }

            string provider = this.Line.GetTokenOn(3);

            if (!provider.ToUpperInvariant().Equals("PROVIDER"))
            {
                CommandProcessor.DisplayError(this.Syntax, "{0} is not a well-known terminology. Expecting: \"provider\".", provider);
                return;
            }

            if (string.IsNullOrWhiteSpace(this.DomainName))
            {
                CommandProcessor.DisplayError(this.Syntax, "Invalid domain name {0}.", this.DomainName);
                return;
            }

            if (string.IsNullOrWhiteSpace(this.ProviderName))
            {
                CommandProcessor.DisplayError(this.Syntax, "Invalid provider name {0}.", this.ProviderName);
                return;
            }

            this.IsValid = true;
        }
예제 #7
0
        public override void Validate()
        {
            this.IsValid = false;

            if (string.IsNullOrWhiteSpace(this.AppName))
            {
                CommandProcessor.DisplayError(this.Syntax, "App name was not given.");
                return;
            }

            string path      = @"{0}\Areas\{1}";
            string directory = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "..");

            path = string.Format(path, directory, this.AppName);

            if (Directory.Exists(path))
            {
                CommandProcessor.DisplayError(string.Empty, "The application {0} already exists.", this.AppName);
                return;
            }

            this.IsValid = true;
        }