private static string SetConnectionString(string connectionName)
        {
            var connectionString = new StringBuilder();
            connectionString.Append(System.Configuration.ConfigurationManager.ConnectionStrings[connectionName].ConnectionString);

            if (!connectionString.to_string().EndsWith(";"))
            {
                connectionString.Append(";");
            }

            connectionString.Append("Max Pool Size=300");

            return connectionString.to_string();
        }
        private void process_rejection(RejectPackageMessage message)
        {
            var resultsMessage = new StringBuilder();

            resultsMessage.AppendLine("Unfortunately there has not been progress to move {0} v{1} towards an approved status within 15 days after the last review message, so we need to close (reject) the package version at this time. If you want to pick this version up and move it towards approval in the future, use the contact site admins link on the package page and we can move it back into a submitted status so you can submit updates.".format_with(message.PackageId, message.PackageVersion));
 
            EventManager.publish(new FinalResultMessage(message.PackageId, message.PackageVersion, resultsMessage.to_string(), reject: true));
        }
        private void process_reminder(ReminderPackageMessage message)
        {
            var resultsMessage = new StringBuilder();

            resultsMessage.AppendLine("We've found {0} v{1} in a submitted status and waiting for your next actions. It has had no updates for 20 or more days since a reviewer has asked for corrections. Please note that if there is no response or fix of the package within 15 days of this message, this package version will automatically be closed (rejected) due to being stale.".format_with(message.PackageId,message.PackageVersion));
            resultsMessage.AppendFormat("{0}Take action:{0}".format_with(Environment.NewLine));
            resultsMessage.AppendLine(" * Log in to the site and respond to the review comments.");
            resultsMessage.AppendLine(" * Resubmit fixes for this version.");
            resultsMessage.AppendLine(" * If the package version is failing automated checks, you can self-reject the package.");
            resultsMessage.AppendLine("{0}If your package is failing automated testing, you can use the [chocolatey test environment](https://github.com/chocolatey/chocolatey-test-environment) to manually run the verification and determine what may need to be fixed.".format_with(Environment.NewLine));
            resultsMessage.AppendLine("{0}**Note**: We don't like to see packages automatically rejected. It doesn't mean that we don't value your contributions, just that we can not continue to hold packages versions in a waiting status that have possibly been abandoned. If you don't believe you will be able to fix up this version of the package within 15 days, we strongly urge you to log in to the site and respond to the review comments until you are able to.".format_with(Environment.NewLine));

            EventManager.publish(new FinalResultMessage(message.PackageId, message.PackageVersion, resultsMessage.to_string(), reject: false));
        }
Example #4
0
        private static string append_process_items(string currentValues, IEnumerable<string> originalValues)
        {
            var additionalItems = new StringBuilder();
            var items = currentValues.Split(
                new[] { ApplicationParameters.Environment.EnvironmentSeparator },
                StringSplitOptions.RemoveEmptyEntries
                );

            foreach (string originalValue in originalValues.or_empty_list_if_null())
            {
                if (!items.Contains(originalValue, StringComparer.InvariantCultureIgnoreCase))
                {
                    additionalItems.AppendFormat("{0};", originalValue);
                }
            }

            return additionalItems.to_string();
        }
        private string GetUrl(string filePath, string articleName = null)
        {
            if (!string.IsNullOrWhiteSpace(articleName)) return articleName;
            if (string.IsNullOrWhiteSpace(filePath)) return filePath;

            var fileName = Path.GetFileNameWithoutExtension(filePath);
            var hyphenatedValue = new StringBuilder();

            Char previousChar = '^';
            foreach (var valueChar in fileName)
            {
                if (Char.IsUpper(valueChar) && hyphenatedValue.Length != 0)
                {
                    hyphenatedValue.Append("-");
                }

                if (Char.IsDigit(valueChar) && !Char.IsDigit(previousChar) && hyphenatedValue.Length != 0)
                {
                    hyphenatedValue.Append("-");
                }

                previousChar = valueChar;
                hyphenatedValue.Append(valueChar.to_string());
            }

            return hyphenatedValue.to_string().to_lower();
        }