// Copyright (c) 2014, Outercurve Foundation. // All rights reserved. // // Redistribution and use in source and binary forms, with or without modification, // are permitted provided that the following conditions are met: // // - Redistributions of source code must retain the above copyright notice, this // list of conditions and the following disclaimer. // // - Redistributions in binary form must reproduce the above copyright notice, // this list of conditions and the following disclaimer in the documentation // and/or other materials provided with the distribution. // // - Neither the name of the Outercurve Foundation nor the names of its // contributors may be used to endorse or promote products derived from this // software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED // WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE // DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR // ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES // (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; // LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON // ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. using System.Xml.Serialization; using System; namespace WebsitePanel.Providers.WebAppGallery { [Flags] public enum DeploymentParameterValidationKind { None = 0, AllowEmpty = 1, RegularExpression = 2, Enumeration = 4, Boolean = 8, } [Flags] public enum DeploymentParameterWellKnownTag : long { None = 0L, AppHostConfig = 1L, AppPoolConfig = 2L, Boolean = 4L, ComObject32 = 8L, ComObject64 = 16L, DBAdminPassword = 32L, DBAdminUserName = 64L, DBConnectionString = 128L, DBName = 256L, DBServer = 512L, DBUserName = 1024L, DBUserPassword = 2048L, FlatFile = 4096L, Hidden = 8192L, IisApp = 16384L, MetaKey = 32768L, MySql = 65536L, MySqlConnectionString = 131072L, New = 262144L, RegKey = 524288L, SetAcl = 1048576L, Sql = 2097152L, SqLite = 4194304L, SqlConnectionString = 8388608L, Password = 16777216L, PhysicalPath = 33554432L, VistaDB = 67108864L, Validate = 134217728L, SqLiteConnectionString = 268435456L, SqlCE = 536870912L, NoStore = 1073741824L, AppURL = 2147483648L, NoProtocol = 4294967296L, DBUserConnectionString = 8589934592L, DBAdminConnectionString = 17179869184L, WebPIApplicationID = 34359738368L, Ignore = 68719476736L, AutoGenerated = 137438953472L, SingleLineConnectionString = 274877906944L, //SiteUserPassword = 549755813888, AllKnown = AppHostConfig | AppPoolConfig | Boolean | ComObject32 | ComObject64 | DBAdminPassword | DBAdminUserName | DBConnectionString | DBName | DBServer | DBUserName | DBUserPassword | FlatFile | Hidden | IisApp | MetaKey | MySql | MySqlConnectionString | New | RegKey | SetAcl | Sql | SqLite | SqlConnectionString | Password | PhysicalPath | VistaDB | Validate | SqLiteConnectionString | SqlCE | NoStore | AppURL | NoProtocol | DBUserConnectionString | DBAdminConnectionString | WebPIApplicationID | Ignore | AutoGenerated | SingleLineConnectionString } [Serializable] public class DeploymentParameter { #region Constants public const string ResourceGroupParameterName = "WSPResourceGroup"; #endregion #region Properties public string FriendlyName { get; set; } public string Name { get; set; } public string Description { get; set; } public string Value { get; set; } public string DefaultValue { get; set; } public DeploymentParameterValidationKind ValidationKind { get; set; } public string ValidationString { get; set; } public DeploymentParameterWellKnownTag WellKnownTags { get; set; } public string ValuePrefix { get; set; } public string ValueSuffix { get; set; } #endregion #if DEBUG public override string ToString() { return String.Format("{0}=\"{1}\", Tags={2}", Name, Value, WellKnownTags.ToString()); } #endif public void SetWellKnownTagsFromRawString(string rawTags) { string[] tags = rawTags.Split(new[] {','}, StringSplitOptions.RemoveEmptyEntries); DeploymentParameterWellKnownTag wellKnownTags = DeploymentParameterWellKnownTag.None; foreach (string tag in tags) { try { wellKnownTags |= (DeploymentParameterWellKnownTag)Enum.Parse(typeof(DeploymentParameterWellKnownTag), tag, true); } catch(Exception){} } WellKnownTags = wellKnownTags & DeploymentParameterWellKnownTag.AllKnown; } } }