示例#1
0
            public void Load(MSBuildBasedProject project, string configuration, string platform)
            {
                PropertyStorageLocations newLocation;
                string v;

                if (treatPropertyValueAsLiteral)
                {
                    v = project.GetProperty(configuration, platform, propertyName, out newLocation);
                }
                else
                {
                    v = project.GetUnevalatedProperty(configuration, platform, propertyName, out newLocation);
                }

                if (newLocation == PropertyStorageLocations.Unknown)
                {
                    newLocation = defaultLocation;
                }

                isLoading = true;
                try {
                    this.Value    = GenericConverter.FromString(v, defaultValue);
                    this.Location = newLocation;
                } finally {
                    isLoading = false;
                }
            }
示例#2
0
        public T GetProperty <T>(string propertyName, T defaultValue,
                                 bool treatPropertyValueAsLiteral)
        {
            string v;

            if (treatPropertyValueAsLiteral)
            {
                v = project.GetProperty(configuration, platform, propertyName);
            }
            else
            {
                v = project.GetUnevalatedProperty(configuration, platform, propertyName);
            }
            return(GenericConverter.FromString(v, defaultValue));
        }
 /// <summary>
 /// Gets the value of the metadata item with the specified name.
 /// Returns defaultValue for non-existing meta data items.
 /// </summary>
 public T GetEvaluatedMetadata <T>(string metadataName, T defaultValue)
 {
     return(GenericConverter.FromString(GetEvaluatedMetadata(metadataName), defaultValue));
 }