Exemple #1
0
        private Dictionary <CompilerProperty, string> GetCompilerPropertiesValues(string line)
        {
            Dictionary <CompilerProperty, string> propertiesValues = new Dictionary <CompilerProperty, string>();

            // Formateo la linea sacando informacion no relacionada con las propiedades
            line = line.Trim().Replace("<!--", string.Empty).Replace("-->", string.Empty).Replace(StartTag, string.Empty).Replace(EndTag, string.Empty);

            // Separa todas las propiedades ej: [ {isSection}, {fileName="\modules\header\default.html"}, { type="WrappedBy" } ]
            List <string> propertiesAndValues = line.Split(new string [] { "\" " }, StringSplitOptions.RemoveEmptyEntries).ToList();

            foreach (var propertyAndValue in propertiesAndValues)
            {
                // separo en nombre de la propiedad y valor
                string sProperty = propertyAndValue.Split('=')[0].Trim();
                string pValue    = string.Empty;
                if (!string.IsNullOrWhiteSpace(sProperty))
                {
                    try
                    {
                        // la convierto a una propiedad definida
                        CompilerProperty property = (CompilerProperty)Enum.Parse(typeof(CompilerProperty), sProperty, true);
                        // la agrego a la lista de kv que devulevo si corresponde
                        if (propertyAndValue.Split('=').Length > 1)
                        {
                            pValue = propertyAndValue.Split('=')[1].Trim().Trim('"');
                        }
                        propertiesValues.Add(property, pValue);
                    }
                    catch { /* TODO: Do Something?? */ }
                }
            }
            return(propertiesValues);
        }
 SetValue(CompilerProperty, value);