PERF: Replacing YAML parser with a simpler implementation.

All external YAML references have been removed from Orchard.

--HG--
branch : perf
This commit is contained in:
Suha Can
2010-11-19 18:41:38 -08:00
parent 8e2497ffbf
commit e5aef055cf
12 changed files with 283 additions and 483 deletions

View File

@@ -93,8 +93,8 @@ Name: Module1
Version: 0.1
OrchardVersion: 1
Features:
Feature1:
Description: Feature
Feature1:
Description: Feature
");
}
@@ -108,8 +108,7 @@ Features:
public IEnumerable<ExtensionDescriptor> AvailableExtensions() {
foreach (var e in Manifests) {
string name = e.Key;
var parseResult = ExtensionFolders.ParseManifest(Manifests[name]);
yield return ExtensionFolders.GetDescriptorForExtension("~/", name, "Module", parseResult);
yield return ExtensionFolders.GetDescriptorForExtension("~/", name, "Module", Manifests[name]);
}
}
}

View File

@@ -20,7 +20,6 @@ using Orchard.Environment.Extensions.Models;
using Orchard.Tests.ContentManagement;
using Orchard.Data.Providers;
using Orchard.Tests.Stubs;
using Orchard.Tests.Utility;
namespace Orchard.Tests.DataMigration {
[TestFixture]
@@ -91,8 +90,7 @@ namespace Orchard.Tests.DataMigration {
public IEnumerable<ExtensionDescriptor> AvailableExtensions() {
foreach (var e in Manifests) {
string name = e.Key;
var parseResult = ExtensionFolders.ParseManifest(Manifests[name]);
yield return ExtensionFolders.GetDescriptorForExtension("~/", name, "Module", parseResult);
yield return ExtensionFolders.GetDescriptorForExtension("~/", name, "Module", Manifests[name]);
}
}
}
@@ -235,8 +233,8 @@ Name: Module2
Version: 0.1
OrchardVersion: 1
Features:
Feature1:
Description: Feature
Feature1:
Description: Feature
");
_dataMigrationManager.Update("Feature1");
@@ -252,8 +250,8 @@ Name: Module1
Version: 0.1
OrchardVersion: 1
Features:
Feature1:
Description: Feature
Feature1:
Description: Feature
");
_dataMigrationManager.Update("Feature1");
@@ -269,8 +267,8 @@ Name: Module1
Version: 0.1
OrchardVersion: 1
Features:
Feature1:
Description: Feature
Feature1:
Description: Feature
");
_dataMigrationManager.Update("Feature1");
@@ -288,8 +286,8 @@ Name: Module1
Version: 0.1
OrchardVersion: 1
Features:
Feature1:
Description: Feature
Feature1:
Description: Feature
");
_dataMigrationManager.Update("Feature1");
@@ -306,8 +304,8 @@ Name: Module1
Version: 0.1
OrchardVersion: 1
Features:
Feature1:
Description: Feature
Feature1:
Description: Feature
");
_repository.Create(new DataMigrationRecord {
Version = 42,
@@ -329,9 +327,9 @@ Name: Module1
Version: 0.1
OrchardVersion: 1
Features:
Feature1:
Description: Feature
Dependencies: Feature2
Feature1:
Description: Feature
Dependencies: Feature2
");
_folders.Manifests.Add("Module2", @"
@@ -339,8 +337,8 @@ Name: Module2
Version: 0.1
OrchardVersion: 1
Features:
Feature2:
Description: Feature
Feature2:
Description: Feature
");
_dataMigrationManager.Update("Feature1");
Assert.That(_repository.Table.Count(), Is.EqualTo(2));
@@ -358,8 +356,8 @@ Name: Module1
Version: 0.1
OrchardVersion: 1
Features:
Feature1:
Description: Feature
Feature1:
Description: Feature
");
_dataMigrationManager.Update("Feature1");
@@ -376,14 +374,14 @@ Name: Module1
Version: 0.1
OrchardVersion: 1
Features:
Feature1:
Description: Feature
Feature2:
Description: Feature
Feature3:
Description: Feature
Feature4:
Description: Feature
Feature1:
Description: Feature
Feature2:
Description: Feature
Feature3:
Description: Feature
Feature4:
Description: Feature
");
// even if there is a data migration class, as it is empty there should me no migration to do
@@ -425,8 +423,8 @@ Name: Module1
Version: 0.1
OrchardVersion: 1
Features:
Feature1:
Description: Feature
Feature1:
Description: Feature
");
_dataMigrationManager.Update("Feature1");

View File

@@ -45,8 +45,7 @@ namespace Orchard.Tests.Environment.Extensions {
public IEnumerable<ExtensionDescriptor> AvailableExtensions() {
foreach (var e in Manifests) {
string name = e.Key;
var parseResult = ExtensionFolders.ParseManifest(Manifests[name]);
yield return ExtensionFolders.GetDescriptorForExtension("~/", name, _extensionType, parseResult);
yield return ExtensionFolders.GetDescriptorForExtension("~/", name, _extensionType, Manifests[name]);
}
}
}
@@ -157,8 +156,8 @@ Name: SuperWiki
Version: 1.0.3
OrchardVersion: 1
Features:
SuperWiki:
Description: My super wiki module for Orchard.
SuperWiki:
Description: My super wiki module for Orchard.
");
var descriptor = _manager.AvailableExtensions().Single();
@@ -181,22 +180,22 @@ Website: http://anotherwiki.codeplex.com
Version: 1.2.3
OrchardVersion: 1
Features:
AnotherWiki:
Description: My super wiki module for Orchard.
Dependencies: Versioning, Search
Category: Content types
AnotherWiki Editor:
Description: A rich editor for wiki contents.
Dependencies: TinyMCE, AnotherWiki
Category: Input methods
AnotherWiki DistributionList:
Description: Sends e-mail alerts when wiki contents gets published.
Dependencies: AnotherWiki, Email Subscriptions
Category: Email
AnotherWiki Captcha:
Description: Kills spam. Or makes it zombie-like.
Dependencies: AnotherWiki, reCaptcha
Category: Spam
AnotherWiki:
Description: My super wiki module for Orchard.
Dependencies: Versioning, Search
Category: Content types
AnotherWiki Editor:
Description: A rich editor for wiki contents.
Dependencies: TinyMCE, AnotherWiki
Category: Input methods
AnotherWiki DistributionList:
Description: Sends e-mail alerts when wiki contents gets published.
Dependencies: AnotherWiki, Email Subscriptions
Category: Email
AnotherWiki Captcha:
Description: Kills spam. Or makes it zombie-like.
Dependencies: AnotherWiki, reCaptcha
Category: Spam
");
var descriptor = _manager.AvailableExtensions().Single();
@@ -262,10 +261,10 @@ Name: TestModule
Version: 1.0.3
OrchardVersion: 1
Features:
TestModule:
Description: My test module for Orchard.
TestFeature:
Description: Contains the Phi type.
TestModule:
Description: My test module for Orchard.
TestFeature:
Description: Contains the Phi type.
");
IExtensionManager extensionManager = new ExtensionManager(new[] { extensionFolder }, new[] { extensionLoader }, new StubCacheManager());
@@ -288,10 +287,10 @@ Name: TestModule
Version: 1.0.3
OrchardVersion: 1
Features:
TestModule:
Description: My test module for Orchard.
TestFeature:
Description: Contains the Phi type.
TestModule:
Description: My test module for Orchard.
TestFeature:
Description: Contains the Phi type.
");
IExtensionManager extensionManager = new ExtensionManager(new[] { extensionFolder }, new[] { extensionLoader }, new StubCacheManager());
@@ -323,10 +322,10 @@ Name: TestModule
Version: 1.0.3
OrchardVersion: 1
Features:
TestModule:
Description: My test module for Orchard.
TestFeature:
Description: Contains the Phi type.
TestModule:
Description: My test module for Orchard.
TestFeature:
Description: Contains the Phi type.
");
IExtensionManager extensionManager = new ExtensionManager(new[] { extensionFolder }, new[] { extensionLoader }, new StubCacheManager());
@@ -353,10 +352,10 @@ Name: TestModule
Version: 1.0.3
OrchardVersion: 1
Features:
TestModule:
Description: My test module for Orchard.
TestFeature:
Description: Contains the Phi type.
TestModule:
Description: My test module for Orchard.
TestFeature:
Description: Contains the Phi type.
");
IExtensionManager extensionManager = new ExtensionManager(new[] { extensionFolder }, new[] { extensionLoader }, new StubCacheManager());
@@ -381,10 +380,10 @@ Name: TestModule
Version: 1.0.3
OrchardVersion: 1
Features:
TestModule:
Description: My test module for Orchard.
TestFeature:
Description: Contains the Phi type.
TestModule:
Description: My test module for Orchard.
TestFeature:
Description: Contains the Phi type.
");
IExtensionManager extensionManager = new ExtensionManager(new[] { extensionFolder }, new[] { extensionLoader }, new StubCacheManager());

View File

@@ -49,8 +49,7 @@ namespace Orchard.Tests.Environment.Extensions {
public IEnumerable<ExtensionDescriptor> AvailableExtensions() {
foreach (var e in Manifests) {
string name = e.Key;
var parseResult = ExtensionFolders.ParseManifest(Manifests[name]);
yield return ExtensionFolders.GetDescriptorForExtension("~/", name, _extensionType, parseResult);
yield return ExtensionFolders.GetDescriptorForExtension("~/", name, _extensionType, Manifests[name]);
}
}
}
@@ -161,8 +160,8 @@ Name: SuperWiki
Version: 1.0.3
OrchardVersion: 1
Features:
SuperWiki:
Description: My super wiki module for Orchard.
SuperWiki:
Description: My super wiki module for Orchard.
");
var descriptor = _manager.AvailableExtensions().Single();
@@ -185,22 +184,22 @@ Website: http://anotherwiki.codeplex.com
Version: 1.2.3
OrchardVersion: 1
Features:
AnotherWiki:
Description: My super wiki module for Orchard.
Dependencies: Versioning, Search
Category: Content types
AnotherWiki Editor:
Description: A rich editor for wiki contents.
Dependencies: TinyMCE, AnotherWiki
Category: Input methods
AnotherWiki DistributionList:
Description: Sends e-mail alerts when wiki contents gets published.
Dependencies: AnotherWiki, Email Subscriptions
Category: Email
AnotherWiki Captcha:
Description: Kills spam. Or makes it zombie-like.
Dependencies: AnotherWiki, reCaptcha
Category: Spam
AnotherWiki:
Description: My super wiki module for Orchard.
Dependencies: Versioning, Search
Category: Content types
AnotherWiki Editor:
Description: A rich editor for wiki contents.
Dependencies: TinyMCE, AnotherWiki
Category: Input methods
AnotherWiki DistributionList:
Description: Sends e-mail alerts when wiki contents gets published.
Dependencies: AnotherWiki, Email Subscriptions
Category: Email
AnotherWiki Captcha:
Description: Kills spam. Or makes it zombie-like.
Dependencies: AnotherWiki, reCaptcha
Category: Spam
");
var descriptor = _manager.AvailableExtensions().Single();
@@ -266,10 +265,10 @@ Name: TestModule
Version: 1.0.3
OrchardVersion: 1
Features:
TestModule:
Description: My test module for Orchard.
TestFeature:
Description: Contains the Phi type.
TestModule:
Description: My test module for Orchard.
TestFeature:
Description: Contains the Phi type.
");
IExtensionManager extensionManager = new ExtensionManager(new[] { extensionFolder }, new[] { extensionLoader }, new StubCacheManager());
@@ -292,10 +291,10 @@ Name: TestModule
Version: 1.0.3
OrchardVersion: 1
Features:
TestModule:
Description: My test module for Orchard.
TestFeature:
Description: Contains the Phi type.
TestModule:
Description: My test module for Orchard.
TestFeature:
Description: Contains the Phi type.
");
IExtensionManager extensionManager = new ExtensionManager(new[] { extensionFolder }, new[] { extensionLoader }, new StubCacheManager());
@@ -327,10 +326,10 @@ Name: TestModule
Version: 1.0.3
OrchardVersion: 1
Features:
TestModule:
Description: My test module for Orchard.
TestFeature:
Description: Contains the Phi type.
TestModule:
Description: My test module for Orchard.
TestFeature:
Description: Contains the Phi type.
");
IExtensionManager extensionManager = new ExtensionManager(new[] { extensionFolder }, new[] { extensionLoader }, new StubCacheManager());
@@ -357,10 +356,10 @@ Name: TestModule
Version: 1.0.3
OrchardVersion: 1
Features:
TestModule:
Description: My test module for Orchard.
TestFeature:
Description: Contains the Phi type.
TestModule:
Description: My test module for Orchard.
TestFeature:
Description: Contains the Phi type.
");
IExtensionManager extensionManager = new ExtensionManager(new[] { extensionFolder }, new[] { extensionLoader }, new StubCacheManager());
@@ -385,10 +384,10 @@ Name: TestModule
Version: 1.0.3
OrchardVersion: 1
Features:
TestModule:
Description: My test module for Orchard.
TestFeature:
Description: Contains the Phi type.
TestModule:
Description: My test module for Orchard.
TestFeature:
Description: Contains the Phi type.
");
IExtensionManager extensionManager = new ExtensionManager(new[] { extensionFolder }, new[] { extensionLoader }, new StubCacheManager());
@@ -433,8 +432,8 @@ Name: Alpha
Version: 1.0.3
OrchardVersion: 1
Features:
Alpha:
Dependencies: Gamma
Alpha:
Dependencies: Gamma
");
extensionFolder.Manifests.Add("Beta", @"
@@ -447,8 +446,8 @@ Name: Gamma
Version: 1.0.3
OrchardVersion: 1
Features:
Gamma:
Dependencies: Beta
Gamma:
Dependencies: Beta
");
IExtensionManager extensionManager = new ExtensionManager(new[] { extensionFolder }, new[] { extensionLoader }, new StubCacheManager());
@@ -467,8 +466,8 @@ Name: Alpha
Version: 1.0.3
OrchardVersion: 1
Features:
Alpha:
Dependencies: Gamma
Alpha:
Dependencies: Gamma
");
moduleExtensionFolder.Manifests.Add("Beta", @"
@@ -481,8 +480,8 @@ Name: Gamma
Version: 1.0.3
OrchardVersion: 1
Features:
Gamma:
Dependencies: Beta
Gamma:
Dependencies: Beta
");
moduleExtensionFolder.Manifests.Add("Classic", @"
@@ -507,8 +506,8 @@ Name: Alpha
Version: 1.0.3
OrchardVersion: 1
Features:
Alpha:
Dependencies: Gamma
Alpha:
Dependencies: Gamma
");
moduleExtensionFolder.Manifests.Add("Beta", @"
@@ -521,8 +520,8 @@ Name: Gamma
Version: 1.0.3
OrchardVersion: 1
Features:
Gamma:
Dependencies: Beta
Gamma:
Dependencies: Beta
");
moduleExtensionFolder.Manifests.Add("Classic", @"
@@ -530,8 +529,8 @@ Name: Classic
Version: 1.0.3
OrchardVersion: 1
Features:
Classic:
Dependencies: Alpha
Classic:
Dependencies: Alpha
");
IExtensionManager extensionManager = new ExtensionManager(new[] { moduleExtensionFolder, themeExtensionFolder }, new[] { extensionLoader }, new StubCacheManager());

View File

@@ -7,15 +7,8 @@ using Orchard.Environment.Extensions.Models;
using Orchard.FileSystems.WebSite;
using Orchard.Localization;
using Orchard.Logging;
using Yaml.Grammar;
namespace Orchard.Environment.Extensions.Folders {
public class ParseResult {
public string Location { get; set; }
public string Name { get; set; }
public YamlDocument YamlDocument { get; set; }
}
public class ExtensionFolders : IExtensionFolders {
private readonly IEnumerable<string> _paths;
private readonly string _manifestName;
@@ -73,11 +66,31 @@ namespace Orchard.Environment.Extensions.Folders {
return list;
}
public static ExtensionDescriptor GetDescriptorForExtension(string locationPath, string extensionName, string extensionType, string manifestText) {
Dictionary<string, string> manifest = ParseManifest(manifestText);
var extensionDescriptor = new ExtensionDescriptor {
Location = locationPath,
Name = extensionName,
ExtensionType = extensionType,
DisplayName = GetValue(manifest, "Name") ?? extensionName,
Description = GetValue(manifest, "Description"),
Version = GetValue(manifest, "Version"),
OrchardVersion = GetValue(manifest, "OrchardVersion"),
Author = GetValue(manifest, "Author"),
WebSite = GetValue(manifest, "Website"),
Tags = GetValue(manifest, "Tags"),
AntiForgery = GetValue(manifest, "AntiForgery"),
Zones = GetValue(manifest, "Zones"),
BaseTheme = GetValue(manifest, "BaseTheme"),
};
extensionDescriptor.Features = GetFeaturesForExtension(GetValue(manifest, "Features"), extensionDescriptor);
return extensionDescriptor;
}
private ExtensionDescriptor GetExtensionDescriptor(string locationPath, string extensionName, string manifestPath) {
return _cacheManager.Get(manifestPath, context => {
context.Monitor(_webSiteFolder.WhenPathChanges(manifestPath));
var manifestText = _webSiteFolder.ReadFile(manifestPath);
if (manifestText == null) {
if (_manifestIsOptional) {
@@ -88,84 +101,128 @@ namespace Orchard.Environment.Extensions.Folders {
}
}
return GetDescriptorForExtension(locationPath, extensionName, ParseManifest(manifestText));
return GetDescriptorForExtension(locationPath, extensionName, manifestText);
});
}
private ExtensionDescriptor GetDescriptorForExtension(string locationPath, string extensionName, ParseResult parseResult) {
return GetDescriptorForExtension(locationPath, extensionName, _extensionType, parseResult);
private ExtensionDescriptor GetDescriptorForExtension(string locationPath, string extensionName, string manifestText) {
return GetDescriptorForExtension(locationPath, extensionName, _extensionType, manifestText);
}
public static ParseResult ParseManifest(string manifestText) {
bool success;
var yamlStream = new YamlParser().ParseYamlStream(new TextInput(manifestText), out success);
if (yamlStream == null || !success) {
return null;
}
return new ParseResult {
Name = manifestText,
YamlDocument = yamlStream.Documents.Single()
};
}
private static Dictionary<string, string> ParseManifest(string manifestText) {
var manifest = new Dictionary<string, string>();
public static ExtensionDescriptor GetDescriptorForExtension(string locationPath, string extensionName, string extensionType, ParseResult parseResult) {
var mapping = (Mapping)parseResult.YamlDocument.Root;
var fields = mapping.Entities
.Where(x => x.Key is Scalar)
.ToDictionary(x => ((Scalar)x.Key).Text, x => x.Value);
var extensionDescriptor = new ExtensionDescriptor {
Location = locationPath,
Name = extensionName,
ExtensionType = extensionType,
DisplayName = GetValue(fields, "Name") ?? extensionName,
Description = GetValue(fields, "Description"),
Version = GetValue(fields, "Version"),
OrchardVersion = GetValue(fields, "OrchardVersion"),
Author = GetValue(fields, "Author"),
WebSite = GetValue(fields, "Website"),
Tags = GetValue(fields, "Tags"),
AntiForgery = GetValue(fields, "AntiForgery"),
Zones = GetValue(fields, "Zones"),
BaseTheme = GetValue(fields, "BaseTheme"),
};
extensionDescriptor.Features = GetFeaturesForExtension(GetMapping(fields, "Features"), extensionDescriptor);
return extensionDescriptor;
}
private static IEnumerable<FeatureDescriptor> GetFeaturesForExtension(Mapping features, ExtensionDescriptor extensionDescriptor) {
var featureDescriptors = new List<FeatureDescriptor>();
if (features != null) {
foreach (var entity in features.Entities) {
var featureDescriptor = new FeatureDescriptor {
Extension = extensionDescriptor,
Name = entity.Key.ToString(),
};
if (featureDescriptor.Name == extensionDescriptor.Name) {
featureDescriptor.DisplayName = extensionDescriptor.DisplayName;
using (StringReader reader = new StringReader(manifestText)) {
string line;
while ((line = reader.ReadLine()) != null) {
string[] field = line.Split(new[] {":"}, 2, StringSplitOptions.None);
int fieldLength = field.Length;
if (fieldLength != 2)
continue;
for (int i = 0; i < fieldLength; i++) {
field[i] = field[i].Trim();
}
var featureMapping = (Mapping)entity.Value;
foreach (var featureEntity in featureMapping.Entities) {
if (featureEntity.Key.ToString() == "Description") {
featureDescriptor.Description = featureEntity.Value.ToString();
}
else if (featureEntity.Key.ToString() == "Category") {
featureDescriptor.Category = featureEntity.Value.ToString();
}
else if (featureEntity.Key.ToString() == "Name") {
featureDescriptor.DisplayName = featureEntity.Value.ToString();
}
else if (featureEntity.Key.ToString() == "Dependencies") {
featureDescriptor.Dependencies = ParseFeatureDependenciesEntry(featureEntity.Value.ToString());
}
switch (field[0]) {
case "Name":
manifest.Add("Name", field[1]);
break;
case "Description":
manifest.Add("Description", field[1]);
break;
case "Version":
manifest.Add("Version", field[1]);
break;
case "OrchardVersion":
manifest.Add("OrchardVersion", field[1]);
break;
case "Author":
manifest.Add("Author", field[1]);
break;
case "Website":
manifest.Add("Website", field[1]);
break;
case "Tags":
manifest.Add("Tags", field[1]);
break;
case "AntiForgery":
manifest.Add("AntiForgery", field[1]);
break;
case "Zones":
manifest.Add("Zones", field[1]);
break;
case "BaseTheme":
manifest.Add("BaseTheme", field[1]);
break;
case "Features":
manifest.Add("Features", reader.ReadToEnd());
break;
}
featureDescriptors.Add(featureDescriptor);
}
}
return manifest;
}
private static IEnumerable<FeatureDescriptor> GetFeaturesForExtension(string featuresText, ExtensionDescriptor extensionDescriptor) {
var featureDescriptors = new List<FeatureDescriptor>();
if (featuresText != null) {
FeatureDescriptor featureDescriptor = null;
using (StringReader reader = new StringReader(featuresText)) {
string line;
while ((line = reader.ReadLine()) != null) {
if (IsFeatureDeclaration(line)) {
if (featureDescriptor != null) {
featureDescriptors.Add(featureDescriptor);
featureDescriptor = null;
}
featureDescriptor = new FeatureDescriptor {
Extension = extensionDescriptor
};
string[] featureDeclaration = line.Split(new[] {":"}, StringSplitOptions.RemoveEmptyEntries);
featureDescriptor.Name = featureDeclaration[0].Trim();
if (featureDescriptor.Name == extensionDescriptor.Name) {
featureDescriptor.DisplayName = extensionDescriptor.DisplayName;
}
}
else if (IsFeatureFieldDeclaration(line)) {
if (featureDescriptor != null) {
string[] featureField = line.Split(new[] {":"}, 2, StringSplitOptions.None);
int featureFieldLength = featureField.Length;
if (featureFieldLength != 2)
continue;
for (int i = 0; i < featureFieldLength; i++) {
featureField[i] = featureField[i].Trim();
}
switch (featureField[0]) {
case "Name":
featureDescriptor.DisplayName = featureField[1];
break;
case "Description":
featureDescriptor.Description = featureField[1];
break;
case "Category":
featureDescriptor.Category = featureField[1];
break;
case "Dependencies":
featureDescriptor.Dependencies = ParseFeatureDependenciesEntry(featureField[1]);
break;
}
}
else {
string message = string.Format("The line {0} in manifest for extension {1} was ignored", line, extensionDescriptor.Name);
throw new ArgumentException(message);
}
}
else {
string message = string.Format("The line {0} in manifest for extension {1} was ignored", line, extensionDescriptor.Name);
throw new ArgumentException(message);
}
}
if (featureDescriptor != null)
featureDescriptors.Add(featureDescriptor);
}
}
if (!featureDescriptors.Any(fd => fd.Name == extensionDescriptor.Name)) {
featureDescriptors.Add(new FeatureDescriptor {
Name = extensionDescriptor.Name,
@@ -174,9 +231,31 @@ namespace Orchard.Environment.Extensions.Folders {
Extension = extensionDescriptor
});
}
return featureDescriptors;
}
private static bool IsFeatureFieldDeclaration(string line) {
if (line.StartsWith("\t\t") ||
line.StartsWith("\t ") ||
line.StartsWith(" ") ||
line.StartsWith(" \t"))
return true;
return false;
}
private static bool IsFeatureDeclaration(string line) {
int lineLength = line.Length;
if (line.StartsWith("\t") && lineLength >= 2) {
return !Char.IsWhiteSpace(line[1]);
}
if (line.StartsWith(" ") && lineLength >= 5)
return !Char.IsWhiteSpace(line[4]);
return false;
}
private static string[] ParseFeatureDependenciesEntry(string dependenciesEntry) {
var dependencies = new List<string>();
foreach (var s in dependenciesEntry.Split(',')) {
@@ -185,14 +264,9 @@ namespace Orchard.Environment.Extensions.Folders {
return dependencies.ToArray();
}
private static Mapping GetMapping(IDictionary<string, DataItem> fields, string key) {
DataItem value;
return fields.TryGetValue(key, out value) ? (Mapping)value : null;
}
private static string GetValue(IDictionary<string, DataItem> fields, string key) {
DataItem value;
return fields.TryGetValue(key, out value) ? value.ToString() : null;
private static string GetValue(IDictionary<string, string> fields, string key) {
string value;
return fields.TryGetValue(key, out value) ? value : null;
}
}
}

View File

@@ -1,6 +1,5 @@
using System.Collections.Generic;
using Orchard.Environment.Extensions.Models;
using Yaml.Grammar;
namespace Orchard.Environment.Extensions.Folders {
public interface IExtensionFolders {

View File

@@ -1,5 +1,4 @@
using System;
using System.Collections.Generic;
using System.Collections.Generic;
namespace Orchard.Environment.Extensions.Models {
public class ExtensionDescriptor {

View File

@@ -149,10 +149,6 @@
</Reference>
<Reference Include="System.Xml" />
<Reference Include="System.Xml.Linq" />
<Reference Include="Yaml, Version=1.0.3370.39839, Culture=neutral, PublicKeyToken=187a3d240e44a135, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\lib\yaml\Yaml.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="ContentManagement\DefaultContentDisplay.cs" />