Fixed difficult merge

This commit is contained in:
Shannon Deminick
2012-08-22 05:57:34 +06:00
parent 1cbd355a2a
commit e9c793cede
11 changed files with 61 additions and 76 deletions

View File

@@ -34,7 +34,7 @@ namespace Umbraco.Core.Dynamics
candidates = candidates.Concat(typeof(IEnumerable).GetMethods(BindingFlags.Static | BindingFlags.Public));
//}
//filter by name
//filter by name
var methodsByName = candidates.Where(m => m.Name == name);
var isGenericAndRightParamCount = methodsByName.Where(m => m.GetParameters().Length == argumentCount + (argsContainsThis ? 0 : 1));

View File

@@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using Umbraco.Core.Configuration;
using umbraco;
namespace Umbraco.Core.IO

View File

@@ -1,27 +1,3 @@
namespace Umbraco.Core
{
public static class ObjectExtensions
{
internal static T As<T>(this object realObject) where T : class
{
if (realObject is T)
return realObject as T;
return DynamicWrapper.CreateWrapper<T>(realObject);
}
internal static T AsReal<T>(this object wrapper) where T : class
{
if (wrapper is T)
return wrapper as T;
if (wrapper is DynamicWrapper.DynamicWrapperBase)
return (T)(wrapper as DynamicWrapper.DynamicWrapperBase).RealObject;
return null;
}
}
}
using System;
using System.Collections;
using System.Collections.Concurrent;
@@ -41,6 +17,25 @@ namespace Umbraco.Core
{
internal static class ObjectExtensions
{
internal static T As<T>(this object realObject) where T : class
{
if (realObject is T)
return realObject as T;
return DynamicWrapper.CreateWrapper<T>(realObject);
}
internal static T AsReal<T>(this object wrapper) where T : class
{
if (wrapper is T)
return wrapper as T;
if (wrapper is DynamicWrapper.DynamicWrapperBase)
return (T)(wrapper as DynamicWrapper.DynamicWrapperBase).RealObject;
return null;
}
//private static readonly ConcurrentDictionary<Type, Func<object>> ObjectFactoryCache = new ConcurrentDictionary<Type, Func<object>>();
public static IEnumerable<T> AsEnumerableOfOne<T>(this T input)

View File

@@ -19,14 +19,6 @@ namespace Umbraco.Core
? Activator.CreateInstance(t)
: null;
}
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
namespace Umbraco.Core
{
public static class TypeExtensions
{
internal static MethodInfo GetGenericMethod(this Type type, string name, params Type[] parameterTypes)
{
var methods = type.GetMethods().Where(method => method.Name == name);
@@ -112,8 +104,7 @@ namespace Umbraco.Core
from method in type.GetMethods()
select method;
}
}
}
/// <returns>
/// <c>true</c> if the specified type is enumerable; otherwise, <c>false</c>.
/// </returns>
@@ -228,27 +219,27 @@ namespace Umbraco.Core
return TypeHelper.IsTypeAssignableFrom<T>(actualType);
}
public static string GetCacheKeyFromParameters(this MemberInfo info)
{
var methodInfo = info as MethodInfo;
if (methodInfo != null)
return GetCacheKeyFromParameters(methodInfo.GetParameters());
return string.Empty;
}
//internal static string GetCacheKeyFromParameters(this MemberInfo info)
//{
// var methodInfo = info as MethodInfo;
// if (methodInfo != null)
// return GetCacheKeyFromParameters(methodInfo.GetParameters());
// return string.Empty;
//}
public static string GetCacheKeyFromParameters(IEnumerable<ParameterInfo> parameters)
{
var sb = new StringBuilder();
sb.Append("(");
foreach (var parameter in parameters)
{
sb.Append(parameter.ParameterType);
sb.Append(" ");
sb.Append(parameter.Name);
sb.Append(",");
}
sb.Append(")");
return sb.ToString();
}
//internal static string GetCacheKeyFromParameters(IEnumerable<ParameterInfo> parameters)
//{
// var sb = new StringBuilder();
// sb.Append("(");
// foreach (var parameter in parameters)
// {
// sb.Append(parameter.ParameterType);
// sb.Append(" ");
// sb.Append(parameter.Name);
// sb.Append(",");
// }
// sb.Append(")");
// return sb.ToString();
//}
}
}

View File

@@ -31,8 +31,8 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="businesslogic">
<HintPath>..\Umbraco.Web\bin\businesslogic.dll</HintPath>
<Reference Include="log4net">
<HintPath>..\packages\log4net.2.0.0\lib\net40-full\log4net.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Configuration" />
@@ -82,6 +82,11 @@
<Compile Include="Dynamics\ExtensionMethodFinder.cs" />
<Compile Include="Dynamics\ExtensionMethods.cs" />
<Compile Include="Dynamics\Grouping.cs" />
<Compile Include="DynamicWrapper.cs" />
<Compile Include="IO\FileSystemProviderAttribute.cs" />
<Compile Include="IO\IFileSystemExtensions.cs" />
<Compile Include="IO\IMediaFileSystem.cs" />
<Compile Include="IO\IMediaFileSystemExtensions.cs" />
<Compile Include="PropertyEditors\DatePickerPropertyEditorValueConverter.cs" />
<Compile Include="PropertyEditors\IPropertyEditorValueConverter.cs" />
<Compile Include="HtmlTagWrapper.cs" />
@@ -138,20 +143,14 @@
<Compile Include="TypeHelper.cs" />
<Compile Include="UpgradeableReadLock.cs" />
<Compile Include="DelegateEqualityComparer.cs" />
<Compile Include="DynamicWrapper.cs" />
<Compile Include="EnumerableExtensions.cs" />
<Compile Include="IfExtensions.cs" />
<Compile Include="PluginManager.cs" />
<Compile Include="IO\FileSystemProvider.cs" />
<Compile Include="IO\FileSystemProviderAttribute.cs" />
<Compile Include="IO\FileSystemProviderManager.cs" />
<Compile Include="IO\IFileSystem.cs" />
<Compile Include="IO\IFileSystemExtensions.cs" />
<Compile Include="IO\IMediaFileSystem.cs" />
<Compile Include="IO\IMediaFileSystemExtensions.cs" />
<Compile Include="IO\PhysicalFileSystem.cs" />
<Compile Include="IThumbnailProvider.cs" />
<Compile Include="ObjectExtensions.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="StringAliasCaseType.cs" />
<Compile Include="StringExtensions.cs" />

View File

@@ -581,7 +581,7 @@ namespace umbraco.cms.businesslogic
{
if (p.PropertyType.DataTypeDefinition.DataType.Id == uploadField.Id
&& p.Value.ToString() != ""
&& File.Exists(IOHelper.MapPath(p.Value.ToString())))
&& File.Exists(global::Umbraco.Core.IO.IOHelper.MapPath(p.Value.ToString())))
{
isUploadField = true;
}

View File

@@ -73,7 +73,7 @@ namespace umbraco.editorControls.tinyMCE3.webcontrol
base.Attributes.Add("style", "visibility: hidden");
config.Add("mode", "exact");
config.Add("theme", "umbraco");
config.Add("umbraco_path", IOHelper.ResolveUrl(SystemDirectories.Umbraco));
config.Add("umbraco_path", global::Umbraco.Core.IO.IOHelper.ResolveUrl(global::Umbraco.Core.IO.SystemDirectories.Umbraco));
CssClass = "tinymceContainer";
plugin.ConfigSection configSection = (plugin.ConfigSection)System.Web.HttpContext.Current.GetSection("TinyMCE");
@@ -218,8 +218,8 @@ namespace umbraco.editorControls.tinyMCE3.webcontrol
suffix = "_" + this.mode;
outURI = this.InstallPath + "/tiny_mce_src" + suffix + ".js";
if (!File.Exists(IOHelper.MapPath(outURI)))
throw new Exception("Could not locate TinyMCE by URI:" + outURI + ", Physical path:" + IOHelper.MapPath(outURI) + ". Make sure that you configured the installPath to a valid location in your web.config. This path should be an relative or site absolute URI to where TinyMCE is located.");
if (!File.Exists(global::Umbraco.Core.IO.IOHelper.MapPath(outURI)))
throw new Exception("Could not locate TinyMCE by URI:" + outURI + ", Physical path:" + global::Umbraco.Core.IO.IOHelper.MapPath(outURI) + ". Make sure that you configured the installPath to a valid location in your web.config. This path should be an relative or site absolute URI to where TinyMCE is located.");
// Collect themes, languages and plugins and build gzip URI
// TODO: Make sure gzip is re-enabled
@@ -332,7 +332,7 @@ namespace umbraco.editorControls.tinyMCE3.webcontrol
// Find the original filename, by removing the might added width and height
// NH, 4.8.1 - above replaced by loading the right media file from the db later!
orgSrc =
IOHelper.ResolveUrl(orgSrc.Replace("%20", " "));
global::Umbraco.Core.IO.IOHelper.ResolveUrl(orgSrc.Replace("%20", " "));
// Check for either id or guid from media
string mediaId = getIdFromSource(orgSrc, rootMediaUrl);
@@ -364,7 +364,7 @@ namespace umbraco.editorControls.tinyMCE3.webcontrol
// Format the tag
tempTag = tempTag + " rel=\"" +
imageMedia.getProperty("umbracoWidth").Value.ToString() + "," +
imageMedia.getProperty("umbracoHeight").Value.ToString() + "\" src=\"" + IOHelper.ResolveUrl(imageMedia.getProperty("umbracoFile").Value.ToString()) +
imageMedia.getProperty("umbracoHeight").Value.ToString() + "\" src=\"" + global::Umbraco.Core.IO.IOHelper.ResolveUrl(imageMedia.getProperty("umbracoFile").Value.ToString()) +
"\"";
tempTag += "/>";

View File

@@ -122,7 +122,7 @@ namespace umbraco.editorControls.tinymce
{
string src = helper.FindAttribute(ht, "src");
//get the media folder, minus the starting '~'
string mediaRoot = SystemDirectories.Media.Replace("~", string.Empty);
string mediaRoot = global::Umbraco.Core.IO.SystemDirectories.Media.Replace("~", string.Empty);
// update orgSrc to remove umbraco reference
int mediaRootIndex = src.IndexOf(mediaRoot);

View File

@@ -12,7 +12,6 @@ EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Build", "Build", "{2849E9D4-3B4E-40A3-A309-F3CB4F0E125F}"
ProjectSection(SolutionItems) = preProject
..\build\Build.bat = ..\build\Build.bat
..\build\Build.proj = ..\build\Build.proj
umbraco.presentation.targets = umbraco.presentation.targets
EndProjectSection
EndProject

View File

@@ -122,9 +122,9 @@ namespace umbraco.webservices.media
{
Authenticate(username, password);
filename = filename.Replace("/", IOHelper.DirSepChar.ToString());
filename = filename.Replace(@"\", IOHelper.DirSepChar.ToString());
filename = filename.Substring(filename.LastIndexOf(IOHelper.DirSepChar) + 1, filename.Length - filename.LastIndexOf(IOHelper.DirSepChar) - 1).ToLower();
filename = filename.Replace("/", global::Umbraco.Core.IO.IOHelper.DirSepChar.ToString());
filename = filename.Replace(@"\", global::Umbraco.Core.IO.IOHelper.DirSepChar.ToString());
filename = filename.Substring(filename.LastIndexOf(global::Umbraco.Core.IO.IOHelper.DirSepChar) + 1, filename.Length - filename.LastIndexOf(global::Umbraco.Core.IO.IOHelper.DirSepChar) - 1).ToLower();
Media m = new Media(id);

View File

@@ -121,7 +121,7 @@
<Name>umbraco.cms</Name>
</ProjectReference>
<ProjectReference Include="..\Umbraco.Core\Umbraco.Core.csproj">
<Project>{31785bc3-256c-4613-b2f5-a1b0bdded8c1}</Project>
<Project>{31785BC3-256C-4613-B2F5-A1B0BDDED8C1}</Project>
<Name>Umbraco.Core</Name>
</ProjectReference>
<ProjectReference Include="..\Umbraco.Web\Umbraco.Web.csproj">