Skip to content

Commit 5d766af

Browse files
committed
clean up
1 parent cb44997 commit 5d766af

File tree

5 files changed

+15
-15
lines changed

5 files changed

+15
-15
lines changed

CADPythonShell/CADPythonShellApplication.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public static void OnLoaded()
2929
//var dllfullpath = Path.Combine(dllfolder, assemblyName + ".dll");
3030
//CreateCommandLoaderAssembly(settings, dllfolder, assemblyName);
3131
//seems like I need to pre-load my dependencies
32-
AppDomain.CurrentDomain.Load(typeof(NpsConfig).Assembly.GetName());
32+
AppDomain.CurrentDomain.Load(typeof(CpsConfig).Assembly.GetName());
3333

3434
ExecuteStartupScript();
3535
return;
@@ -70,9 +70,9 @@ public static ImageSource GetEmbeddedPng(System.Reflection.Assembly app, string
7070
return source.Frames[0];
7171
}
7272

73-
public static IRpsConfig GetConfig()
73+
public static ICpsConfig GetConfig()
7474
{
75-
return new NpsConfig(GetSettingsFile());
75+
return new CpsConfig(GetSettingsFile());
7676
}
7777

7878
/// <summary>
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ namespace CADRuntime
55
{
66
/// <summary>
77
/// Provides access functions to those parts of the CADPythonShell.xml file
8-
/// that are also used in RpsAddin deployments.
8+
/// that are also used in CPS Plugin deployments.
99
/// </summary>
10-
public class NpsConfig : IRpsConfig
10+
public class CpsConfig : ICpsConfig
1111
{
1212
/// <summary>
1313
/// The full path to the settings file used
@@ -17,7 +17,7 @@ public class NpsConfig : IRpsConfig
1717
private readonly XDocument _settings;
1818
private readonly SettingsDictionary _dict;
1919

20-
public NpsConfig(string settingsFilePath)
20+
public CpsConfig(string settingsFilePath)
2121
{
2222
_settingsPath = settingsFilePath;
2323
_settings = XDocument.Load(_settingsPath);

CADRuntime/INpsConfig.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
namespace CADRuntime
44
{
5-
public interface IRpsConfig
5+
public interface ICpsConfig
66
{
77
/// <summary>
88
/// Returns a list of string variables that the Runtime will add to

CADRuntime/ScriptExecutor.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ namespace CADRuntime
1414
public class ScriptExecutor
1515
{
1616
private string _message;
17-
private readonly IRpsConfig _config;
17+
private readonly ICpsConfig _config;
1818

19-
public ScriptExecutor(IRpsConfig config)
19+
public ScriptExecutor(ICpsConfig config)
2020
{
2121
_config = config;
2222

CADRuntime/SettingsDictionary.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,35 +12,35 @@ public class SettingsDictionary : IDictionary<string, string>
1212
private readonly IDictionary<string, string> _dict;
1313
private readonly string _settingsPath;
1414
private XDocument _settings;
15-
15+
private string nameVariable = "StringVariable";
1616
public SettingsDictionary(string settingsPath)
1717
{
1818
_settingsPath = settingsPath;
1919
_settings = XDocument.Load(_settingsPath);
2020

21-
_dict = _settings.Root.Descendants("StringVariable").ToDictionary(
21+
_dict = _settings.Root.Descendants(nameVariable).ToDictionary(
2222
v => v.Attribute("name").Value,
2323
v => v.Attribute("value").Value);
2424
}
2525

2626
private void SetVariable(string name, string value)
2727
{
28-
var variable = _settings.Root.Descendants("StringVariable").Where(x => x.Attribute("name").Value == name).FirstOrDefault();
28+
var variable = _settings.Root.Descendants(nameVariable).Where(x => x.Attribute("name").Value == name).FirstOrDefault();
2929
if (variable != null)
3030
{
3131
variable.Attribute("value").Value = value.ToString();
3232
}
3333
else
3434
{
3535
_settings.Root.Descendants("Variables").First().Add(
36-
new XElement("StringVariable", new XAttribute("name", name), new XAttribute("value", value)));
36+
new XElement(nameVariable, new XAttribute("name", name), new XAttribute("value", value)));
3737
}
3838
_settings.Save(_settingsPath);
3939
}
4040

4141
private void RemoveVariable(string name)
4242
{
43-
var variable = _settings.Root.Descendants("StringVariable").Where(x => x.Attribute("name").Value == name).FirstOrDefault();
43+
var variable = _settings.Root.Descendants(nameVariable).Where(x => x.Attribute("name").Value == name).FirstOrDefault();
4444
if (variable != null)
4545
{
4646
variable.Remove();
@@ -50,7 +50,7 @@ private void RemoveVariable(string name)
5050

5151
private void ClearVariables()
5252
{
53-
var variables = _settings.Root.Descendants("StringVariable");
53+
var variables = _settings.Root.Descendants(nameVariable);
5454
foreach (var variable in variables)
5555
{
5656
variable.Remove();

0 commit comments

Comments
 (0)