Пример #1
0
 /// <summary>
 /// Initializes an instance of this class, by formatting an error message.
 /// </summary>
 ///
 /// <param name="format">A <c>String.Format</c>-style format string.  If
 ///     <paramref name="args"/> is zero-length, <paramref name="format"/> is
 ///     returned without formatting.</param>
 ///
 /// <param name="args">Formatting arguments.</param>
 ///
 public SafeToDisplayException(string format, params object[] args)
     :
     base(
         (args != null && args.Length == 0) ?
         format : String.Format(SlkCulture.GetCulture(), format, args)
         )
 {
 }
Пример #2
0
        void SetUpDropBox(Guid id)
        {
            // Library is created, now need to set it up
            dropBoxList = web.Lists[id];
            bool okToContinue = false;

            try
            {
                AddFields();

                // Set up versioning
                dropBoxList.EnableVersioning = true;
                dropBoxList.Update();

                // Reached point at which list is usable, so any errors from now, just log but continue.
                okToContinue = true;

                ChangeToInternationalNames();

                ClearPermissions();
                CreateNoPermissionsFolder(dropBoxList);
                ModifyDefaultView();
            }
            catch (SPException e)
            {
                store.LogError(culture.Resources.DropBoxListCreateFailure, e);
                if (okToContinue == false)
                {
                    // Error creating list - delete it
                    dropBoxList.Delete();
                    web.AllProperties[DropBox.PropertyKey] = null;
                    dropBoxList = null;
                    throw new SafeToDisplayException(string.Format(SlkCulture.GetCulture(), culture.Resources.DropBoxListCreateFailure, e.Message));
                }
            }
            catch (Exception e)
            {
                store.LogError(culture.Resources.DropBoxListCreateFailure, e);
                throw;
            }
        }
Пример #3
0
        private Guid CreateLibrary(int recursiveNumber)
        {
            string name = dropBoxName;

            if (recursiveNumber > 0)
            {
                name = name + recursiveNumber.ToString(CultureInfo.InvariantCulture);
            }

            try
            {
                return(web.Lists.Add(name, dropBoxName, SPListTemplateType.DocumentLibrary));
            }
            catch (SPException e)
            {
                // Library already exists, add a number to make it unique
                Guid id = CheckIfCreatedInMeantime();
                if (id == Guid.Empty)
                {
                    if (recursiveNumber < 2)
                    {
                        return(CreateLibrary(recursiveNumber + 1));
                    }
                    else
                    {
                        throw new SafeToDisplayException(string.Format(SlkCulture.GetCulture(), culture.Resources.DropBoxListCreateFailure, e.Message));
                    }
                }
                else
                {
                    // The reload in objects should have given the other process time to complete setting up the list - at least adding the fields
                    alreadyCreated = true;;
                    return(id);
                }
            }
        }
Пример #4
0
 /// <summary>
 /// Initializes an instance of this class, by formatting an error message and prepending
 /// the line number within the XML file.
 /// </summary>
 ///
 /// <param name="lineNumber">The line number (within the XML file) to include in the
 ///     exception message.</param>
 ///
 /// <param name="format">A <c>String.Format</c>-style format string.</param>
 ///
 /// <param name="args">Formatting arguments.</param>
 ///
 internal SlkSettingsException(int lineNumber, string format, params object[] args) :
     base(String.Format(SlkCulture.GetCulture(), SlkCulture.GetResources().SlkUtilitiesSettingsException, lineNumber,
                        String.Format(SlkCulture.GetCulture(), format, args)))
 {
 }
Пример #5
0
 /// <summary>
 /// Initializes an instance of this class, by formatting an error message and prepending
 /// the line number within the XML file.
 /// </summary>
 ///
 /// <param name="xmlReader">The line number of the exception message will include the
 ///     current line number of this <c>XmlReader</c>.</param>
 ///
 /// <param name="format">A <c>String.Format</c>-style format string.</param>
 ///
 /// <param name="args">Formatting arguments.</param>
 ///
 internal SlkSettingsException(XmlReader xmlReader, string format, params object[] args) :
     base(String.Format(SlkCulture.GetCulture(), SlkCulture.GetResources().SlkUtilitiesSettingsException, ((IXmlLineInfo)xmlReader).LineNumber,
                        String.Format(SlkCulture.GetCulture(), format, args)))
 {
 }
Пример #6
0
 /// <summary>
 /// Initializes an instance of this class, by formatting an error message.
 /// </summary>
 ///
 /// <param name="format">A <c>String.Format</c>-style format string.</param>
 ///
 /// <param name="args">Formatting arguments.</param>
 ///
 internal SlkSettingsException(string format, params object[] args) : base(String.Format(SlkCulture.GetCulture(), format, args))
 {
 }
Пример #7
0
 /// <summary>
 /// Initializes an instance of this class.
 /// </summary>
 ///
 /// <param name="internalErrorCode">An internal error code, e.g. "APP1001".</param>
 ///
 internal InternalErrorException(string internalErrorCode) : base(String.Format(SlkCulture.GetCulture(), SlkCulture.GetResources().InternalError, internalErrorCode))
 {
 }