Commit cba15236 authored by 潘栩锋's avatar 潘栩锋 🚴

改进XMind转Unity配置

parent f9a1629c
......@@ -43,7 +43,7 @@ namespace WpfApp1
{
string xmindPath = openFileDialog.FileName;
string outDirPath = System.IO.Path.GetDirectoryName(xmindPath);
if (Xmind2UnityConfigCore.TopicExt.ToUnity(openFileDialog.FileName, null) == 0) {
if (Xmind2UnityConfigCore.XMindTypeExt.ToUnity(openFileDialog.FileName, null, true) == 0) {
MessageBox.Show($@"完成 输出到{outDirPath}\unity");
}
}
......
......@@ -5,7 +5,7 @@
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{840673C1-3705-42EC-A3EB-6A7F803590CF}</ProjectGuid>
<OutputType>WinExe</OutputType>
<OutputType>Exe</OutputType>
<RootNamespace>Xmind2UnityConfigUI</RootNamespace>
<AssemblyName>Xmind2UnityConfigUI</AssemblyName>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
......
......@@ -17,11 +17,15 @@ namespace Xmind2UnityConfig
}
else if (args.Length == 1)
{
return Xmind2UnityConfigCore.TopicExt.ToUnity(args[0], null);
return Xmind2UnityConfigCore.XMindTypeExt.ToUnity(args[0], null, true);
}
else
else if (args.Length == 2)
{
return Xmind2UnityConfigCore.TopicExt.ToUnity(args[0], args[1]);
return Xmind2UnityConfigCore.XMindTypeExt.ToUnity(args[0], args[1], true);
}
else// if (args.Length == 2)
{
return Xmind2UnityConfigCore.XMindTypeExt.ToUnity(args[0], args[1], bool.Parse(args[2]));
}
}
}
......
......@@ -39,6 +39,12 @@ namespace Xmind2UnityConfigCore
string filePath = System.IO.Path.Combine(tempPath, "content.json");
string json = File.ReadAllText(filePath);
//var xmind = JsonConvert.DeserializeObject<XMindRootTopic[]>(json);
//转义title
//string unescape = System.Text.RegularExpressions.Regex.Unescape(str);
JArray jArray = JsonConvert.DeserializeObject(json) as JArray;
var jobject_topic = jArray.First() as JObject;
......@@ -82,6 +88,7 @@ namespace Xmind2UnityConfigCore
return topic;
}
static void ToUnity(Topic rootTopic, string path)
{
path = System.IO.Path.Combine(path, "unity");
......@@ -97,6 +104,8 @@ namespace Xmind2UnityConfigCore
File.WriteAllText(System.IO.Path.Combine(path, "relationship.json"), json);
}
static RelationShip ToRelationShip(Topic topic, string path)
{
RelationShip relationShip = new RelationShip();
......@@ -291,4 +300,6 @@ namespace Xmind2UnityConfigCore
xdoc.Save(filepath);
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Xmind2UnityConfigCore
{
public class XMindRootTopic
{
public XMindTopic rootTopic;
public override string ToString()
{
return rootTopic.ToString();
}
}
public class XMindTopic
{
public string title;
public XMindChildren children;
public override string ToString()
{
return title;
}
}
public class XMindChildren
{
public List<XMindTopic> attached;
}
}
This diff is collapsed.
......@@ -46,6 +46,8 @@
<Compile Include="Topic.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="TopicExt.cs" />
<Compile Include="XMindType.cs" />
<Compile Include="XMindTypeExt.cs" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Newtonsoft.Json">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment