Skip to content
Snippets Groups Projects
Commit f6f2725a authored by Reeves, David E's avatar Reeves, David E
Browse files

* trying to figure out best way to read cxxi data that isn't tied to a scenario

parent fc669d16
No related branches found
No related tags found
No related merge requests found
No preview for this file type
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ScenarioTreeList
{
public static class CXXIData
{
public static Dictionary<string, List<string>> eventMap;
public static void LoadEvents()
{
eventMap = new Dictionary<string, List<string>>();
string path = "D:/code_base/gitlab/CXXI/combatxxi-wsmr-bin/cxxi/res/properties";
string[] files = Directory.GetFiles(path);
foreach(string filePath in files)
{
string file = Path.GetFileName(filePath);
string[] lines = null;
if (file.StartsWith("events")&&file.EndsWith("properties"))
lines = File.ReadAllLines(filePath);
if (lines!=null)
{
string fm = "";
List<string> events = new List<string>();
foreach(string line in lines)
{
if (line.Trim().Length == 0||
line.StartsWith("#")||
line.StartsWith("@"))
continue;
if (line.StartsWith("FM"))
{
string[] fms = line.Split('=');
string[] fmp = fms[1].Split('.');
fm = fmp[fmp.Length - 1];
}
else if (line.StartsWith("event"))
{
string[] evnts = line.Split('=');
events.Add(evnts[1]);
}
}
eventMap[fm] = events;
}
}
}
}
}
...@@ -42,6 +42,7 @@ ...@@ -42,6 +42,7 @@
<Reference Include="System.Xml" /> <Reference Include="System.Xml" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="CXXIData.cs" />
<Compile Include="ScenarioTreeListUC.cs"> <Compile Include="ScenarioTreeListUC.cs">
<SubType>UserControl</SubType> <SubType>UserControl</SubType>
</Compile> </Compile>
......
...@@ -199,6 +199,9 @@ namespace ScenarioTreeList ...@@ -199,6 +199,9 @@ namespace ScenarioTreeList
scenario.Name = name; scenario.Name = name;
scenario.Text = scenario.Name; scenario.Text = scenario.Name;
// read any extra data
CXXIData.LoadEvents();
return scenario; return scenario;
} }
......
add_goal|Add a goal to an entity. Goal is added to the "default" stack. add_goal|Add a goal to an entity. Goal is added to the "default" stack.
UtilityFuncsExp.addGoal( UtilityFuncsExp.addGoal(
%NAME, # entity name string %ENTITY_NAME, # entity name string
%DELAY, # delay double %DELAY, # delay double
%GOALPATH, # goal path string %GOALPATH, # goal path string
%ARGS, # arguments to tree hashable list %ARGS, # arguments to tree hashable list
%VARS) # variables to pass to the tree usually None %VARS) # variables to pass to the tree usually None
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment