예제 #1
0
        public static string GetRestOfXMLTag(WixObject obj)
        {
            Type type = obj.GetType();
            List <PropertyInfo> properties = type.GetProperties().ToList();

            StringBuilder sb = new StringBuilder();

            PropertyInfo idP = null;

            foreach (PropertyInfo p in properties)
            {
                if (p.Name == "Id")
                {
                    idP = p;
                }
            }
            properties.Remove(idP);
            properties.Insert(0, idP);
            foreach (PropertyInfo property in properties)
            {
                object value = property.GetValue(obj, null);
                if (value != null)
                {
                    bool skip = false;
                    if (value is string strVal)
                    {
                        if (strVal.IsNullOrWhitespace())
                        {
                            skip = true;
                        }
                    }
                    //if(!skip)
                    sb.Append(property.Name + "=\"" + value + "\" ");
                }
            }
            sb.Append(">");
            return(sb.ToString());
        }
예제 #2
0
 public void AddObj(WixObject obj)
 {
     this.Objects.Add(obj);
 }