コード例 #1
0
        private static string GetVariableReplaceText(string html, string[] propertyVariables, object objectToTemplate)
        {
            Type objectType = objectToTemplate.GetType();

            foreach (string propertyVariable in propertyVariables)
            {
                BoxVariable variable = new BoxVariable(propertyVariable, objectToTemplate);
                //PropertyInfo prop = objectType.GetProperty(propertyVariable.Replace(VariablePrefix, "").Replace(VariableSuffix, ""));
                //object value = prop.GetValue(objectToTemplate, null);
                //string stringValue = value == null ? "": value.ToString();
                if (html.Contains(propertyVariable))
                {
                    html = html.Replace(propertyVariable, variable.Value);
                }
            }


            return(html);
        }
コード例 #2
0
ファイル: BoxServer.cs プロジェクト: BryanApellanes/Naizari
        private static string GetVariableReplaceText(string html, string[] propertyVariables, object objectToTemplate)
        {
            Type objectType = objectToTemplate.GetType();
            foreach (string propertyVariable in propertyVariables)
            {
                BoxVariable variable = new BoxVariable(propertyVariable, objectToTemplate);
                //PropertyInfo prop = objectType.GetProperty(propertyVariable.Replace(VariablePrefix, "").Replace(VariableSuffix, ""));
                //object value = prop.GetValue(objectToTemplate, null);
                //string stringValue = value == null ? "": value.ToString();
                if (html.Contains(propertyVariable))
                    html = html.Replace(propertyVariable, variable.Value);
            }

            return html;
        }
コード例 #3
0
 public static string[] GetPropertyVariables(Type typeToGetVariablesFor)
 {
     return(BoxVariable.GetPropertyVariables(typeToGetVariablesFor));
 }