Exemple #1
0
        private string GetPropertiesDeclaration()
        {
            var stringBuilder = new StringBuilder();

            if (Members != null)
            {
                Indentation.Level++;

                var propertyStringBuilder = new StringBuilder();

                foreach (var property in Members)
                {
                    if (propertyStringBuilder.Length > 0)
                    {
                        propertyStringBuilder.AppendLine(",");
                    }

                    propertyStringBuilder.Append(String.Concat(Indentation.ToString(), property.Name, " = ", property.Declaration));
                }

                Indentation.Level--;

                stringBuilder.AppendLine("{");
                stringBuilder.Append(propertyStringBuilder.ToString());
                stringBuilder.Append("}");
            }

            return(stringBuilder.ToString());
        }
        private string GetPropertiesInitialization()
        {
            var stringBuilder = new StringBuilder();

            var classProperties = ClassInitializationHelper.GetClassProperties(_variableName);

            if (classProperties != null)
            {
                Indentation.Level++;

                var propertyStringBuilder = new StringBuilder();

                foreach (var property in classProperties)
                {
                    if (propertyStringBuilder.Length > 0)
                    {
                        propertyStringBuilder.AppendLine(",");
                    }

                    propertyStringBuilder.Append(String.Concat(Indentation.ToString(), property.Name, " = ", property.Initialization));
                }

                Indentation.Level--;

                stringBuilder.AppendLine(String.Concat(Indentation.ToString(), "{"));
                stringBuilder.AppendLine(propertyStringBuilder.ToString());
                stringBuilder.Append(String.Concat(Indentation.ToString(), "}"));
            }

            return(stringBuilder.ToString());
        }
Exemple #3
0
        public void Encode(OutputStream output, Indentation indenter)
        {
            var psout = new PrintStream(output);
            var buf   = new StringBuilder();

            buf.Append(indenter.ToString());
            buf.Append("<AttributeAssignment AttributeId=\"");
            buf.Append(this._attributeId);
            buf.Append("\" ");
            if (this._category != null)
            {
                buf.Append("Category=\"");
                buf.Append(this._category);
                buf.Append("\" ");
            }
            if (this._issuer != null)
            {
                buf.Append("Issuer=\"");
                buf.Append(this._issuer);
                buf.Append("\" ");
            }
            buf.Append(">");
            psout.PrintLine(buf);
            indenter.Down();
            this._value.Encode(output, indenter);
            indenter.Up();
            psout.PrintLine(indenter + "</AttributeAssignment>");
        }
Exemple #4
0
        public string GetIncreasedIndentation()
        {
            string indentation = Indentation.ToString();

            string singleIndentation = GetSingleIndentation(indentation);

            return(indentation + singleIndentation);
        }
Exemple #5
0
        public void Encode(OutputStream output, Indentation indenter)
        {
            var str   = new StringBuilder();
            var psout = new PrintStream(output);

            str.Append(indenter.ToString());
            str.Append("<Policy PolicyId=\"");
            str.Append(this._policyId);
            str.Append("\" ");
            str.Append("Version=\"");
            str.Append(this._version);
            str.Append("\" ");
            str.Append("RuleCombiningAlgId=\"");
            str.Append(this._ruleCombiningAlgId);
            str.Append("\" ");
            if (this._maxDelegationDepth != null)
            {
                str.Append("MaxDelegationDepth=\"");
                str.Append(this._maxDelegationDepth);
                str.Append("\" ");
            }
            str.Append(">");
            psout.PrintLine(str.ToString());
            indenter.Down();

            foreach (VariableDefinition var in this._variableDefinitions.Values)
            {
                var.Encode(output, indenter);
            }

            this._target.Encode(output, indenter);
            if (this._policyDefaults != null)
            {
                this._policyDefaults.Encode(output, indenter);
            }
            if (this._description != null)
            {
                this._description.Encode(output, indenter);
            }
            if (this._policyIssuer != null)
            {
                this._policyIssuer.Encode(output, indenter);
            }
            foreach (IPolicyLanguageModel o in this._policyLanguageModels)
            {
                o.Encode(output, indenter);
            }
            if (this._obligationExpressions != null)
            {
                this._obligationExpressions.Encode(output, indenter);
            }
            if (this._adviceExpressions != null)
            {
                this._adviceExpressions.Encode(output, indenter);
            }
            indenter.Up();
            psout.PrintLine(indenter + "</Policy>");
        }
Exemple #6
0
        public string GetIncreasedIndentation()
        {
            int length1 = Indentation.Span.Length;

            if (length1 == 0)
            {
                return("");
            }

            string s = Indentation.ToString();

            return(s + new string(s[0], IndentSize));
        }
        protected override string GenerateInitialization()
        {
            var stringBuilder = new StringBuilder();

            var membersCount = int.Parse(DebuggerHelper.GetValue(ExpressionsHelper.ItemsCount(_variableName)));

            var type = DebuggerHelper.GetValue(ExpressionsHelper.TypeFullName(_variableName)).Replace("\"", String.Empty).Replace("+", ".").Replace("[]", "()");

            stringBuilder.AppendLine(String.Concat(Indentation.ToString(), "New ", type, " {"));

            var membersInitialization = MembersInitializationHelper.GetMembersInitialization(_variableName, membersCount);

            stringBuilder.Append(membersInitialization);
            stringBuilder.Append(String.Concat(Indentation.ToString(), "}"));

            return(stringBuilder.ToString());
        }
        protected override string GenerateInitialization()
        {
            var stringBuilder = new StringBuilder();

            var membersType = ListInitializationHelper.GetListMembersType(_variableName);

            var membersCount = int.Parse(DebuggerHelper.GetValue(ExpressionsHelper.ItemsCount(_variableName)));

            stringBuilder.AppendLine(string.Concat("new System.Collections.Generic.List<", membersType, ">()"));

            if (membersCount > 0)
            {
                stringBuilder.AppendLine(string.Concat(Indentation.ToString(), "{"));

                var membersInitialization = MembersInitializationHelper.GetMembersInitialization(_variableName, membersCount);

                stringBuilder.AppendLine(membersInitialization);
                stringBuilder.Append(string.Concat(Indentation.ToString(), "}"));
            }

            return(stringBuilder.ToString());
        }
Exemple #9
0
 public string GetSingleIndentation()
 {
     return(GetSingleIndentation(Indentation.ToString()));
 }