/// <summary>
        /// Read the properties from the project configuration.
        /// </summary>
        public void ReadProperties( ProjectProperties properties )
        {
            applicationNameInput.Text = GetProperty( properties, "ApplicationName", "M-Files Application" );
            packageNameInput.Text = GetProperty( properties, "AssemblyName", "MFilesApplication" );
            defaultNamespaceInput.Text = GetProperty( properties, "RootNamespace", "MFilesApplication" );

            var environments = GetProperty( properties, "DefaultEnvironments", "shellui;vaultui;vaultcore" ).ToLower().Split( ';' );

            environmentShellUiInput.Checked = environments.Contains( "shellui" );
            environmentVaultUiInput.Checked = environments.Contains( "vaultui" );
            environmentVaultCoreInput.Checked = environments.Contains( "vaultcore" );

            publisherInput.Text = GetProperty( properties, "Publisher", "" );

            var applicationVersion = GetVersionSegments( GetProperty( properties, "ApplicationVersion", "1.0.0.0" ) );
            applicationVersionMajor.Text = applicationVersion[ 0 ];
            applicationVersionMinor.Text = applicationVersion[ 1 ];
            applicationVersionRevision.Text = applicationVersion[ 2 ];
            applicationVersionBuild.Text = applicationVersion[ 3 ];

            var mfilesVersion = GetVersionSegments( GetProperty( properties, "MFilesVersion", "9.0.3372.0" ) );
            mfilesVersionMajor.Text = mfilesVersion[ 0 ];
            mfilesVersionMinor.Text = mfilesVersion[ 1 ];
            mfilesVersionRevision.Text = mfilesVersion[ 2 ];
            mfilesVersionBuild.Text = mfilesVersion[ 3 ];

            descriptionInput.Text = GetProperty( properties, "Description", "An M-Files application." );
            enabledDefaultInput.Checked = GetProperty( properties, "EnabledByDefault", "true" ).ToLower() != "false";
        }
        public void ReadProperties( ProjectProperties properties )
        {
            outputPath.Text = properties.GetConfigProperty( "OutputPath" );

            RefreshVaults();
            vaultInput.Text = properties.GetConfigProperty( "TestVault" );

            var launchMode = (properties.GetConfigProperty( "LaunchMode" ) ?? "").ToLowerInvariant();
            if( launchMode == "powershell" )
                launchPowerShellInput.Checked = true;
            else
                launchMFilesInput.Checked = true;

            mfilesPathInput.Text = properties.GetConfigProperty( "LaunchMFilesPath" );
            var psScript = properties.GetConfigProperty( "LaunchPSScript" );
            if( psScript != null ) powerShellScriptInput.Text = psScript;

            UpdateControlStates();
        }
        public void WriteProperties( ProjectProperties properties )
        {
            properties.SetConfigProperty( "OutputPath", outputPath.Text );
            properties.SetConfigProperty( "TestVault", (string)this.vaultInput.Text );

            if( launchMFilesInput.Checked )
                properties.SetConfigProperty( "LaunchMode", "MFiles" );
            else if( launchPowerShellInput.Checked )
                properties.SetConfigProperty( "LaunchMode", "PowerShell" );

            properties.SetConfigProperty( "LaunchMFilesPath", mfilesPathInput.Text );
            properties.SetConfigProperty( "LaunchPSScript", powerShellScriptInput.Text );
        }
        /// <summary>
        /// Write properties to the project configuration.
        /// </summary>
        public void WriteProperties( ProjectProperties properties )
        {
            properties.SetProperty( "ApplicationName", applicationNameInput.Text );
            properties.SetProperty( "AssemblyName", packageNameInput.Text );
            properties.SetProperty( "RootNamespace", defaultNamespaceInput.Text );

            List<string> environments = new List<string>();
            if( environmentShellUiInput.Checked ) environments.Add( "ShellUI" );
            if( environmentVaultUiInput.Checked ) environments.Add( "VaultUI" );
            if( environmentVaultCoreInput.Checked ) environments.Add( "VaultCore" );
            properties.SetProperty( "DefaultEnvironments", string.Join( ";", environments.ToArray() ) );

            properties.SetProperty( "Publisher", publisherInput.Text );

            properties.SetProperty( "ApplicationVersion", GetVersion(
                    applicationVersionMajor.Text,
                    applicationVersionMinor.Text,
                    applicationVersionRevision.Text,
                    applicationVersionBuild.Text ) );

            properties.SetProperty( "MFilesVersion", GetVersion(
                    mfilesVersionMajor.Text,
                    mfilesVersionMinor.Text,
                    mfilesVersionRevision.Text,
                    mfilesVersionBuild.Text ) );

            properties.SetProperty( "Description", descriptionInput.Text );
            properties.SetProperty( "EnabledByDefault", enabledDefaultInput.Checked ? "true" : "false" );
        }
 private string GetProperty( ProjectProperties properties, string name, string defaultValue )
 {
     return properties.GetProperty( name ) ?? defaultValue;
 }
Пример #6
0
 private string GetProperty(ProjectProperties properties, string name, string defaultValue)
 {
     return(properties.GetProperty(name) ?? defaultValue);
 }