• R/O
  • SSH
  • HTTPS

Commit

Frequently used words (click to add to your profile)

javaandroidc++linuxc#objective-ccocoa誰得qtrubybathyscaphegamephpguicwindows翻訳pythonomegattwitterframeworkbtronarduinovb.net計画中(planning stage)directxpreviewertestゲームエンジンdom

FreeTrainの進化系を目指す


Commit MetaInfo

Revision73 (tree)
Zeit2017-05-21 20:16:38
Autorc477

Log Message

VPluginID の側にパス変換をカプセル化

Ändern Zusammenfassung

Diff

--- trunk/framework/framework/plugin/PluginManager.cs (revision 72)
+++ trunk/framework/framework/plugin/PluginManager.cs (revision 73)
@@ -359,7 +359,7 @@
359359 List<Plugin> a = new List<Plugin>();
360360 foreach (ParamsReader depend in _reader.EnumChildren("depend")) {
361361 string name = depend["on"].InnerText;
362- Plugin p2 = GetPlugin(new VPluginId(name));
362+ Plugin p2 = GetPlugin(VPluginId.FromString(name));
363363 if (p2 == null) {
364364 string msg = I18n.F("Dependent plug-in:{1} (required for the plug-in:{0}) is not found.", p.ID, name);
365365 throw new Exception(msg);
--- trunk/framework/framework/plugin/PluginUtil.cs (revision 72)
+++ trunk/framework/framework/plugin/PluginUtil.cs (revision 73)
@@ -154,15 +154,6 @@
154154 return t;
155155 }
156156
157- public static string GetPluginDirName(ParamsReader node) {
158- return Path.GetFileName(node.SourceURI);
159- }
160-
161- public static string GetPluginFullPath( XmlNode node )
162- {
163- return Path.GetDirectoryName(node.OwnerDocument.BaseURI);
164- }
165-
166157 public static ParamsReader LoadAnotherXml(ParamsReader source)
167158 {
168159 IFileSource fs = source.GetFileSource(source.InnerText);
--- trunk/framework/framework/plugin/PluginXmlException.cs (revision 72)
+++ trunk/framework/framework/plugin/PluginXmlException.cs (revision 73)
@@ -40,8 +40,7 @@
4040 {
4141 if (plugin != null) return true;
4242
43- string pname = Path.GetFileName(Path.GetDirectoryName(node.SourceURI)+"");
44- plugin = PluginManager.theInstance.GetPlugin(new VPluginId(pname));
43+ plugin = PluginManager.theInstance.GetPlugin(new VPluginId(new Uri(node.SourceURI)));
4544 return plugin != null;
4645 }
4746
--- trunk/framework/framework/plugin/VContributionId.cs (revision 72)
+++ trunk/framework/framework/plugin/VContributionId.cs (revision 73)
@@ -24,8 +24,8 @@
2424 templ, "contribution", "name", contribRootReader.SourceURI));
2525 }
2626
27- string pname = PluginUtil.GetPluginDirName(contribRootReader);
28- return new VContributionId(new VPluginId(pname), short_id);
27+ Uri uri = new Uri(contribRootReader.SourceURI);
28+ return new VContributionId(new VPluginId(uri), short_id);
2929 }
3030
3131 internal static VContributionId CreateUsingOrigin(string pathorid, Plugin origin)
--- trunk/framework/framework/plugin/VPluginId.cs (revision 72)
+++ trunk/framework/framework/plugin/VPluginId.cs (revision 73)
@@ -13,12 +13,23 @@
1313 {
1414 public static readonly VPluginId System = new VPluginId("system");
1515
16- public VPluginId(Uri path) : this(Path.GetFileName(path.LocalPath.Replace("/", "\\")))
16+ public static VPluginId FromString(string idstr)
17+ {
18+ return new VPluginId(idstr);
19+ }
20+
21+ public VPluginId(Uri path) : this(MakeIdStr(path))
1722 {}
1823
19- public VPluginId(string pluginId) : base(WithValidation(pluginId))
24+ private VPluginId(string pluginId) : base(WithValidation(pluginId))
2025 {}
2126
27+ private static string MakeIdStr(Uri path)
28+ {
29+ String str = path.LocalPath.Replace("/", "\\");
30+ String dirpath = Path.GetExtension(str).ToLower() == ".xml" ? Path.GetDirectoryName(str) : str;
31+ return Path.GetFileName(dirpath);
32+ }
2233
2334 private static string WithValidation(string testStr)
2435 {