Removes lots of Dead Code - thanks NDepend!

This commit is contained in:
Shannon
2016-03-23 10:58:06 +01:00
parent fb104004e0
commit 7d3ba43816
29 changed files with 12 additions and 807 deletions

View File

@@ -1,32 +0,0 @@
using System;
using System.ComponentModel;
namespace Umbraco.Core.Configuration.UmbracoSettings
{
/// <summary>
/// Allows for converting string representations of 0 and 1 to boolean
/// </summary>
internal class CustomBooleanTypeConverter : BooleanConverter
{
public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType)
{
if (sourceType == typeof(string))
{
return true;
}
return base.CanConvertFrom(context, sourceType);
}
public override object ConvertFrom(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value)
{
if (value is string)
{
var str = (string)value;
if (str == "1") return true;
if (str == "0" || str == "") return false;
}
return base.ConvertFrom(context, culture, value);
}
}
}

View File

@@ -1,62 +0,0 @@
using System.Configuration;
namespace Umbraco.Core.Configuration.UmbracoSettings
{
internal class LinkElement : ConfigurationElement, ILink
{
[ConfigurationProperty("application")]
internal string Application
{
get { return (string)base["application"]; }
}
[ConfigurationProperty("applicationUrl")]
internal string ApplicationUrl
{
get { return (string)base["applicationUrl"]; }
}
[ConfigurationProperty("language")]
internal string Language
{
get { return (string)base["language"]; }
}
[ConfigurationProperty("userType")]
internal string UserType
{
get { return (string)base["userType"]; }
}
[ConfigurationProperty("helpUrl")]
internal string HelpUrl
{
get { return (string)base["helpUrl"]; }
}
string ILink.Application
{
get { return Application; }
}
string ILink.ApplicationUrl
{
get { return ApplicationUrl; }
}
string ILink.Language
{
get { return Language; }
}
string ILink.UserType
{
get { return UserType; }
}
string ILink.HelpUrl
{
get { return HelpUrl; }
}
}
}

View File

@@ -1,34 +0,0 @@
using System.Collections.Generic;
using System.Configuration;
namespace Umbraco.Core.Configuration.UmbracoSettings
{
internal class LinksCollection : ConfigurationElementCollection, IEnumerable<ILink>
{
protected override ConfigurationElement CreateNewElement()
{
return new LinkElement();
}
protected override object GetElementKey(ConfigurationElement element)
{
return ((LinkElement)element).Application
+ ((LinkElement)element).ApplicationUrl
+ ((LinkElement)element).Language
+ ((LinkElement)element).UserType;
}
IEnumerator<ILink> IEnumerable<ILink>.GetEnumerator()
{
for (var i = 0; i < Count; i++)
{
yield return BaseGet(i) as ILink;
}
}
System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
{
return GetEnumerator();
}
}
}

View File

@@ -4,7 +4,7 @@ using System.ComponentModel;
namespace Umbraco.Core
{
public static partial class Constants
{
{
/// <summary>
/// Defines the identifiers for Umbraco system nodes.
/// </summary>
@@ -54,5 +54,10 @@ namespace Umbraco.Core
public const string SessionIdClaimType = "http://umbraco.org/2015/02/identity/claims/backoffice/sessionid";
}
public static class IO
{
public const string MediaFileSystemProvider = "media";
}
}
}

View File

@@ -1,46 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.UI;
namespace Umbraco.Core
{
internal static class ControlExtensions
{
/// <summary>
/// Recursively finds a control with the specified identifier.
/// </summary>
/// <typeparam name="T">
/// The type of control to be found.
/// </typeparam>
/// <param name="parent">
/// The parent control from which the search will start.
/// </param>
/// <param name="id">
/// The identifier of the control to be found.
/// </param>
/// <returns>
/// The control with the specified identifier, otherwise <see langword="null"/> if the control
/// is not found.
/// </returns>
public static T FindControlRecursive<T>(this Control parent, string id) where T : Control
{
if ((parent is T) && (parent.ID == id))
{
return (T)parent;
}
foreach (Control control in parent.Controls)
{
var foundControl = FindControlRecursive<T>(control, id);
if (foundControl != null)
{
return foundControl;
}
}
return default(T);
}
}
}

View File

@@ -1,69 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Umbraco.Core.Models;
namespace Umbraco.Core.Dynamics
{
[Obsolete("This class should not be used, it is just referenced by already obsoleted code and will be removed in the future")]
internal static class ExtensionMethods
{
//public static IEnumerable<TSource> Map<TSource>(
// this IEnumerable<TSource> source,
// Func<TSource, bool> selectorFunction,
// Func<TSource, IEnumerable<TSource>> getChildrenFunction)
//{
// if (!source.Any())
// {
// return source;
// }
// // Add what we have to the stack
// var flattenedList = source.Where(selectorFunction);
// // Go through the input enumerable looking for children,
// // and add those if we have them
// foreach (TSource element in source)
// {
// var secondInner = getChildrenFunction(element);
// if (secondInner.Any())
// {
// secondInner = secondInner.Map(selectorFunction, getChildrenFunction);
// }
// flattenedList = flattenedList.Concat(secondInner);
// }
// return flattenedList;
//}
[Obsolete("This method should not be used and will be removed in the future")]
public static bool ContainsAny(this string haystack, IEnumerable<string> needles)
{
return StringExtensions.ContainsAny(haystack, needles);
}
[Obsolete("This method should not be used and will be removed in the future")]
public static bool ContainsAny(this string haystack, params string[] needles)
{
return StringExtensions.ContainsAny(haystack, needles);
}
[Obsolete("This method should not be used and will be removed in the future")]
public static bool ContainsAny(this string haystack, StringComparison comparison, IEnumerable<string> needles)
{
return StringExtensions.ContainsAny(haystack, needles, comparison);
}
[Obsolete("This method should not be used and will be removed in the future")]
public static bool ContainsAny(this string haystack, StringComparison comparison, params string[] needles)
{
return StringExtensions.ContainsAny(haystack, needles, comparison);
}
[Obsolete("This method should not be used and will be removed in the future")]
public static bool ContainsInsensitive(this string haystack, string needle)
{
if (haystack == null) throw new ArgumentNullException("haystack");
return haystack.IndexOf(needle, StringComparison.CurrentCultureIgnoreCase) >= 0;
}
[Obsolete("This method should not be used and will be removed in the future")]
public static bool HasValue(this string s)
{
return !string.IsNullOrWhiteSpace(s);
}
}
}

View File

@@ -1,13 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Umbraco.Core.CodeAnnotations;
namespace Umbraco.Core.IO
{
internal class FileSystemProviderConstants
{
public const string Media = "media";
}
}

View File

@@ -1,68 +0,0 @@
using System;
using System.Collections;
namespace Umbraco.Core.Macros
{
/// <summary>
/// NOTE: This is legacy code, might require a cleanup
/// </summary>
[Serializable]
internal class PersistableMacroProperty
{
#region Private Fields
private string _name;
private string _alias;
private string _value;
private string _assemblyName;
private string _typeName;
#endregion
#region Properties
/// <summary>
/// Macro Caption
/// </summary>
public string Name
{
get { return _name; }
set { _name = value; }
}
/// <summary>
/// Macro Alias
/// </summary>
public string Alias
{
get { return _alias; }
set { _alias = value; }
}
/// <summary>
/// Macro Value
/// </summary>
public string Value
{
get { return _value; }
set { _value = value; }
}
/// <summary>
/// AssemblyName of the Property of teh Macro
/// </summary>
public string AssemblyName
{
get { return _assemblyName; }
set { _assemblyName = value; }
}
/// <summary>
/// TypeName of the property of the macro
/// </summary>
public string TypeName
{
get { return _typeName; }
set { _typeName = value; }
}
#endregion
}
}

View File

@@ -19,25 +19,7 @@ namespace Umbraco.Core.Media.Exif
{
;
}
}
/// <summary>
/// The exception that is thrown when the IFD section ID could not be understood.
/// </summary>
internal class UnknownIFDSectionException : Exception
{
public UnknownIFDSectionException()
: base("Unknown IFD section.")
{
;
}
public UnknownIFDSectionException(string message)
: base(message)
{
;
}
}
}
/// <summary>
/// The exception that is thrown when an invalid enum type is given to an
@@ -57,22 +39,4 @@ namespace Umbraco.Core.Media.Exif
;
}
}
/// <summary>
/// The exception that is thrown when the 0th IFD section does not contain any fields.
/// </summary>
internal class IFD0IsEmptyException : Exception
{
public IFD0IsEmptyException()
: base("0th IFD section cannot be empty.")
{
;
}
public IFD0IsEmptyException(string message)
: base(message)
{
;
}
}
}

View File

@@ -2,24 +2,6 @@
namespace Umbraco.Core.Media.Exif
{
/// <summary>
/// The exception that is thrown when the format of the image file
/// could not be understood.
/// </summary>
internal class UnknownImageFormatException : Exception
{
public UnknownImageFormatException()
: base("Unkown image format.")
{
;
}
public UnknownImageFormatException(string message)
: base(message)
{
;
}
}
/// <summary>
/// The exception that is thrown when the format of the image file

View File

@@ -1,15 +0,0 @@
using AutoMapper;
namespace Umbraco.Core
{
/// <summary>
/// Helper class for static model mapping with automapper
/// </summary>
internal static class ModelMapperHelper
{
internal static IMappingExpression<TSource, TSource> SelfMap<TSource>(this IMapperConfiguration config)
{
return config.CreateMap<TSource, TSource>();
}
}
}

View File

@@ -1,28 +0,0 @@
namespace Umbraco.Core.Models
{
/// <summary>
/// Defines a PropertyType (plugin) for a Macro
/// </summary>
internal interface IMacroPropertyType
{
/// <summary>
/// Gets the unique Alias of the Property Type
/// </summary>
string Alias { get; }
/// <summary>
/// Gets the name of the Assembly used to render the Property Type
/// </summary>
string RenderingAssembly { get; }
/// <summary>
/// Gets the name of the Type used to render the Property Type
/// </summary>
string RenderingType { get; }
/// <summary>
/// Gets the Base Type for storing the PropertyType (Int32, String, Boolean)
/// </summary>
MacroPropertyTypeBaseTypes BaseType { get; }
}
}

View File

@@ -1,20 +0,0 @@
using System;
using System.Runtime.Serialization;
namespace Umbraco.Core.Models
{
/// <summary>
/// Enum for the three allowed BaseTypes
/// </summary>
[Serializable]
[DataContract(IsReference = true)]
internal enum MacroPropertyTypeBaseTypes
{
[EnumMember]
Int32,
[EnumMember]
Boolean,
[EnumMember]
String
}
}

View File

@@ -1,20 +0,0 @@
using AutoMapper;
namespace Umbraco.Core.Models.Mapping
{
internal static class MappingExpressionExtensions
{
/// <summary>
/// Ignores all unmapped members by default - Use with caution!
/// </summary>
/// <typeparam name="TSource"></typeparam>
/// <typeparam name="TDest"></typeparam>
/// <param name="expression"></param>
/// <returns></returns>
public static IMappingExpression<TSource, TDest> IgnoreAllUnmapped<TSource, TDest>(this IMappingExpression<TSource, TDest> expression)
{
expression.ForAllMembers(opt => opt.Ignore());
return expression;
}
}
}

View File

@@ -1,20 +0,0 @@
using System;
using System.Runtime.Serialization;
using Umbraco.Core.Models.EntityBase;
namespace Umbraco.Core.Models.Membership
{
/// <summary>
/// Represents a Group for a Backoffice User
/// </summary>
/// <remarks>
/// Should be internal until a proper user/membership implementation
/// is part of the roadmap.
/// </remarks>
[Serializable]
[DataContract(IsReference = true)]
internal class UserGroup : Entity
{
//Add UserCollection ?
}
}

View File

@@ -1,18 +0,0 @@
using Umbraco.Core.Services;
namespace Umbraco.Core.Packaging
{
internal interface IPackageBuilding
{
}
internal class PackageBuilding : IPackageBuilding
{
private readonly IPackagingService _packagingService;
public PackageBuilding(IPackagingService packagingService)
{
_packagingService = packagingService;
}
}
}

View File

@@ -1,35 +0,0 @@
using System.Collections.Generic;
using System.Linq;
using AutoMapper;
using Umbraco.Core.Models;
using Umbraco.Core.Models.Membership;
using Umbraco.Core.Models.Rdbms;
namespace Umbraco.Core.Persistence.Factories
{
internal class UserSectionFactory
{
private readonly IUser _user;
public UserSectionFactory(IUser user)
{
_user = user;
}
public IEnumerable<string> BuildEntity(IEnumerable<User2AppDto> dto)
{
return dto.Select(x => x.AppAlias);
}
public IEnumerable<User2AppDto> BuildDto(IEnumerable<string> entity)
{
return entity.Select(x => new User2AppDto
{
//NOTE: We're force casting to int here! this might not work in the future
UserId = (int)_user.Id,
AppAlias = x
});
}
}
}

View File

@@ -174,9 +174,9 @@
<Compile Include="Cache\DeepCloneRuntimeCacheProvider.cs" />
<Compile Include="CodeAnnotations\FriendlyNameAttribute.cs" />
<Compile Include="CodeAnnotations\UmbracoObjectTypeAttribute.cs" />
<Compile Include="CodeAnnotations\UmbracoProposedPublicAttribute.cs" />
<Compile Include="CodeAnnotations\UmbracoWillObsoleteAttribute.cs" />
<Compile Include="CodeAnnotations\UmbracoExperimentalFeatureAttribute.cs" />
<Compile Include="CodeAnnotations\UmbracoProposedPublicAttribute.cs" />
<Compile Include="Collections\DeepCloneableList.cs" />
<Compile Include="Collections\ListCloneBehavior.cs" />
<Compile Include="ConcurrentHashSet.cs" />
@@ -225,7 +225,6 @@
<Compile Include="Configuration\UmbracoSettings\ImagingAutoFillUploadFieldElement.cs" />
<Compile Include="Configuration\UmbracoSettings\ContentImagingElement.cs" />
<Compile Include="Configuration\UmbracoSettings\ContentScriptEditorElement.cs" />
<Compile Include="Configuration\UmbracoSettings\CustomBooleanTypeConverter.cs" />
<Compile Include="Configuration\UmbracoSettings\DeveloperElement.cs" />
<Compile Include="Configuration\UmbracoSettings\DisabledLogTypesCollection.cs" />
<Compile Include="Configuration\UmbracoSettings\DistributedCallElement.cs" />
@@ -253,8 +252,6 @@
<Compile Include="Configuration\UmbracoSettings\ITemplatesSection.cs" />
<Compile Include="Configuration\UmbracoSettings\IUmbracoSettingsSection.cs" />
<Compile Include="Configuration\UmbracoSettings\IWebRoutingSection.cs" />
<Compile Include="Configuration\UmbracoSettings\LinkElement.cs" />
<Compile Include="Configuration\UmbracoSettings\LinksCollection.cs" />
<Compile Include="Configuration\UmbracoSettings\LoggingElement.cs" />
<Compile Include="Configuration\UmbracoSettings\LogTypeElement.cs" />
<Compile Include="Configuration\UmbracoSettings\NotificationsElement.cs" />
@@ -281,7 +278,6 @@
<Compile Include="Attempt.cs" />
<Compile Include="Constants-Examine.cs" />
<Compile Include="Constants-Icons.cs" />
<Compile Include="ControlExtensions.cs" />
<Compile Include="CoreBootManager.cs" />
<Compile Include="DatabaseContext.cs" />
<Compile Include="DataTableExtensions.cs" />
@@ -363,7 +359,6 @@
<Compile Include="Models\IMigrationEntry.cs" />
<Compile Include="Models\IPublishedContentWithKey.cs" />
<Compile Include="Models\IServerRegistration.cs" />
<Compile Include="Models\Mapping\MappingExpressionExtensions.cs" />
<Compile Include="Models\MigrationEntry.cs" />
<Compile Include="Models\PartialViewType.cs" />
<Compile Include="Models\PublicAccessEntry.cs" />
@@ -543,7 +538,6 @@
<Compile Include="Manifest\PropertyEditorConverter.cs" />
<Compile Include="Media\ImageHelper.cs" />
<Compile Include="Media\MediaSubfolderCounter.cs" />
<Compile Include="ModelMapperHelper.cs" />
<Compile Include="Models\ContentBase.cs" />
<Compile Include="Models\ContentExtensions.cs" />
<Compile Include="Enum.cs" />
@@ -594,7 +588,6 @@
<Compile Include="Packaging\Models\InstallationSummary.cs" />
<Compile Include="Packaging\Models\MetaData.cs" />
<Compile Include="Packaging\Models\PackageAction.cs" />
<Compile Include="Packaging\PackageBuilding.cs" />
<Compile Include="Packaging\PackageExtraction.cs" />
<Compile Include="Packaging\PackageInstallation.cs" />
<Compile Include="Packaging\PackageBinaryInspector.cs" />
@@ -672,7 +665,6 @@
<Compile Include="Models\ILanguage.cs" />
<Compile Include="Models\IMacro.cs" />
<Compile Include="Models\IMacroProperty.cs" />
<Compile Include="Models\IMacroPropertyType.cs" />
<Compile Include="Models\ITag.cs" />
<Compile Include="Models\Macro.cs" />
<Compile Include="Models\PublishedContent\PublishedContentExtended.cs" />
@@ -680,7 +672,6 @@
<Compile Include="Models\PublishedContent\PublishedContentExtensionsForModels.cs" />
<Compile Include="Models\MacroProperty.cs" />
<Compile Include="Models\MacroPropertyCollection.cs" />
<Compile Include="Models\MacroPropertyTypeBaseTypes.cs" />
<Compile Include="Models\MacroTypes.cs" />
<Compile Include="Models\PublishedContent\PublishedContentWrapped.cs" />
<Compile Include="Models\PublishedContent\PublishedContentType.cs" />
@@ -710,7 +701,6 @@
<Compile Include="Models\Membership\IUser.cs" />
<Compile Include="Models\Membership\IUserType.cs" />
<Compile Include="Models\Membership\User.cs" />
<Compile Include="Models\Membership\UserGroup.cs" />
<Compile Include="Models\Membership\UserType.cs" />
<Compile Include="Models\PropertyExtensions.cs" />
<Compile Include="Models\PublishedItemType.cs" />
@@ -743,7 +733,6 @@
<Compile Include="Persistence\Factories\ServerRegistrationFactory.cs" />
<Compile Include="Persistence\Factories\TagFactory.cs" />
<Compile Include="Persistence\Factories\UmbracoEntityFactory.cs" />
<Compile Include="Persistence\Factories\UserSectionFactory.cs" />
<Compile Include="Persistence\FaultHandling\ITransientErrorDetectionStrategy.cs" />
<Compile Include="Persistence\FaultHandling\RetryingEventArgs.cs" />
<Compile Include="Persistence\FaultHandling\RetryLimitExceededException.cs" />
@@ -1094,7 +1083,6 @@
<Compile Include="Dynamics\DynamicQueryableGetMemberBinder.cs" />
<Compile Include="Dynamics\DynamicXml.cs" />
<Compile Include="Dynamics\ExtensionMethodFinder.cs" />
<Compile Include="Dynamics\ExtensionMethods.cs" />
<Compile Include="Dynamics\PropertyResultType.cs" />
<Compile Include="IO\FileSystemProviderAttribute.cs" />
<Compile Include="IO\FileSystemExtensions.cs" />
@@ -1185,7 +1173,6 @@
<Compile Include="Logging\AsynchronousRollingFileAppender.cs" />
<Compile Include="Logging\LoggingTaskExtension.cs" />
<Compile Include="Logging\LogHelper.cs" />
<Compile Include="Macros\PersistableMacroProperty.cs" />
<Compile Include="ObjectExtensions.cs" />
<Compile Include="ObjectResolution\ManyObjectsResolverBase.cs" />
<Compile Include="ObjectResolution\ObjectLifetimeScope.cs" />
@@ -1356,7 +1343,6 @@
<Compile Include="IfExtensions.cs" />
<Compile Include="PluginManager.cs" />
<Compile Include="IO\FileSecurityException.cs" />
<Compile Include="IO\FileSystemProviderConstants.cs" />
<Compile Include="IO\FileSystemProviderManager.cs" />
<Compile Include="IO\IFileSystem.cs" />
<Compile Include="IO\IOHelper.cs" />