More content refactoring (WIP, barely builds)

This commit is contained in:
Stephan
2017-11-07 19:49:14 +01:00
parent 6ce23ee8fd
commit 09f499d5d6
90 changed files with 2706 additions and 2769 deletions

View File

@@ -344,21 +344,21 @@ namespace Umbraco.Core.IO
public void SetUploadFile(IContentBase content, string propertyTypeAlias, string filename, Stream filestream)
{
var property = GetProperty(content, propertyTypeAlias);
var svalue = property.Value as string;
var svalue = property.GetValue() as string;
var oldpath = svalue == null ? null : GetRelativePath(svalue);
var filepath = StoreFile(content, property.PropertyType, filename, filestream, oldpath);
property.Value = GetUrl(filepath);
property.SetValue(GetUrl(filepath));
SetUploadFile(content, property, filepath, filestream);
}
public void SetUploadFile(IContentBase content, string propertyTypeAlias, string filepath)
{
var property = GetProperty(content, propertyTypeAlias);
var svalue = property.Value as string;
var svalue = property.GetValue() as string;
var oldpath = svalue == null ? null : GetRelativePath(svalue); // FIXME DELETE?
if (string.IsNullOrWhiteSpace(oldpath) == false && oldpath != filepath)
DeleteFile(oldpath);
property.Value = GetUrl(filepath);
property.SetValue(GetUrl(filepath));
using (var filestream = OpenFile(filepath))
{
SetUploadFile(content, property, filepath, filestream);