Skip to content

Commit 101c8bd

Browse files
committed
refactor
1 parent 076aed3 commit 101c8bd

File tree

140 files changed

+235
-560
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

140 files changed

+235
-560
lines changed

CADPythonShell.sln

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
1414
README.md = README.md
1515
RPS LICENSE.txt = RPS LICENSE.txt
1616
.github\workflows\Workflow.yml = .github\workflows\Workflow.yml
17-
PackageContents.xml = PackageContents.xml
17+
CADPythonShell\PackageContents.xml = CADPythonShell\PackageContents.xml
1818
EndProjectSection
1919
EndProject
2020
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CADPythonShell", "CADPythonShell\CADPythonShell.csproj", "{7E37F14E-D840-42F8-8CA6-90FFC5497972}"

CADPythonShell/App/CADPythonShellApplication.cs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
using CADRuntime;
2-
using System.IO;
1+
using System.IO;
32
using System.Windows.Media;
43
using System.Windows.Media.Imaging;
54
using System.Xml.Linq;
5+
using CADRuntime;
66
using Forms = System.Windows.Forms;
77

8-
namespace CADPythonShell
8+
namespace CADPythonShell.App
99
{
1010
internal static class CADPythonShellApplication
1111
{

CADPythonShell/App/IronPythonConsoleApp.cs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
using Autodesk.AutoCAD.Runtime;
22
using Autodesk.Windows;
3-
using MgdDbg;
3+
using CADPythonShell.Command;
44
using Orientation = System.Windows.Controls.Orientation;
55

6-
namespace CADPythonShell
6+
namespace CADPythonShell.App
77
{
88
public class IronPythonConsoleApp : ICadCommand
99
{
@@ -164,7 +164,7 @@ private static RibbonPanel AddPanelTwo()
164164
"CADPythonShell.Resources.handle-16.png"),
165165
LargeImage =
166166
CADPythonShellApplication.GetEmbeddedPng(addinAssembly, "CADPythonShell.Resources.handle-32.png"),
167-
CommandHandler = new RelayCommand(new SnoopByHanderCommand().Execute),
167+
CommandHandler = new RelayCommand(new SnoopByHandleCommand().Execute),
168168
AllowInToolBar = true,
169169
KeyTip = "Snoop By Handle",
170170
};

CADPythonShell/Command/CommandLoaderBase.cs

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
using CADRuntime;
2-
using System.IO;
1+
using System.IO;
2+
using CADPythonShell.App;
3+
using CADRuntime;
34

4-
namespace CADPythonShell
5+
namespace CADPythonShell.Command
56
{
67
/// <summary>
78
/// Starts up a ScriptOutput window for a given canned command.

CADPythonShell/Command/ConfigureCommand.cs

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
using Autodesk.AutoCAD.Runtime;
2+
using CADPythonShell.App;
23
using Application = Autodesk.AutoCAD.ApplicationServices.Core.Application;
34

4-
namespace CADPythonShell
5+
namespace CADPythonShell.Command
56
{
67
/// <summary>
78
/// Open the configuration dialog.

CADPythonShell/Command/ICadCommand.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
namespace CADPythonShell;
1+
namespace CADPythonShell.Command;
22

33
public abstract class ICadCommand
44
{

CADPythonShell/Command/IronPythonConsoleCommand.cs

+6-5
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
1-
using Autodesk.AutoCAD.ApplicationServices;
1+
using System.Windows;
2+
using System.Windows.Interop;
3+
using System.Windows.Threading;
4+
using Autodesk.AutoCAD.ApplicationServices;
25
using Autodesk.AutoCAD.Runtime;
6+
using CADPythonShell.App;
37
using CADRuntime;
48
using Microsoft.Scripting;
5-
using System.Windows;
6-
using System.Windows.Interop;
7-
using System.Windows.Threading;
89
using Application = Autodesk.AutoCAD.ApplicationServices.Core.Application;
910
using Exception = System.Exception;
1011
using Forms = System.Windows.Forms;
1112

12-
namespace CADPythonShell
13+
namespace CADPythonShell.Command
1314
{
1415
public class IronPythonConsoleCommand : ICadCommand
1516
{
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
using Application = Autodesk.AutoCAD.ApplicationServices.Application;
1+
using MgdDbg.App;
22

3-
namespace CADPythonShell;
3+
namespace CADPythonShell.Command;
44

5-
public class SnoopByHanderCommand : ICadCommand
5+
public class SnoopByHandleCommand : ICadCommand
66
{
77
public override void Execute()
88
{
9-
string fullCmdLine = $"_{nameof(MgdDbgAction.SnoopByHandle)}\n";
10-
Autodesk.AutoCAD.ApplicationServices.Core.Application.DocumentManager.MdiActiveDocument.SendStringToExecute(fullCmdLine, false, false, true);
9+
TestCmds testCmds = new TestCmds();
10+
testCmds.SnoopEntityByHandle();
1111
}
1212
}

CADPythonShell/Command/SnoopCommand.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
using Autodesk.AutoCAD.Runtime;
22

3-
namespace CADPythonShell
3+
namespace CADPythonShell.Command
44
{
55
public class SnoopCommand : ICadCommand
66
{

CADPythonShell/Command/SnoopDBCommand.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
using MgdDbg.Test;
1+
using MgdDbg.App;
22

3-
namespace CADPythonShell;
3+
namespace CADPythonShell.Command;
44

55
public class SnoopDBCommand : ICadCommand
66
{

CADPythonShell/Command/SnoopEditorCommand.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
using MgdDbg.Test;
1+
using MgdDbg.App;
22

3-
namespace CADPythonShell;
3+
namespace CADPythonShell.Command;
44

55
public class SnoopEditorCommand : ICadCommand
66
{

CADPythonShell/Command/SnoopEntitiesCommand.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
using MgdDbg.Test;
1+
using MgdDbg.App;
22

3-
namespace CADPythonShell;
3+
namespace CADPythonShell.Command;
44

55
public class SnoopEntitiesCommand : ICadCommand
66
{

CADPythonShell/Command/SnoopEntitiesNestedCommand.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
using MgdDbg.Test;
1+
using MgdDbg.App;
22

3-
namespace CADPythonShell;
3+
namespace CADPythonShell.Command;
44

55
public class SnoopEntitiesNestedCommand : ICadCommand
66
{

CADPythonShell/Command/SnoopEventsCommand.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
using MgdDbg.Test;
1+
using MgdDbg.App;
22

3-
namespace CADPythonShell;
3+
namespace CADPythonShell.Command;
44

55
public class SnoopEventsCommand : ICadCommand
66
{

CADPythonShell/Command/TestFrameworkCommand.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
using MgdDbg.Test;
1+
using MgdDbg.App;
22

3-
namespace CADPythonShell;
3+
namespace CADPythonShell.Command;
44

55
public class TestFrameworkCommand : ICadCommand
66
{

CADPythonShell/ConfigureCommandsForm.cs

+7-6
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
using System.IO;
2+
using CADPythonShell.App;
23

34
namespace CADPythonShell
45
{
56
public partial class ConfigureCommandsForm : Form
67
{
7-
private List<Command> _commands;
8+
private List<App.Command> _commands;
89
private List<string> _searchPaths;
910
private List<KeyValuePair<string, string>> _variables;
1011

@@ -50,7 +51,7 @@ private void ConfigureCommandsForm_Load(object sender, EventArgs e)
5051
/// </summary>
5152
private void lstCommands_SelectedIndexChanged(object sender, EventArgs e)
5253
{
53-
var command = (Command)lstCommands.SelectedItem;
54+
var command = (App.Command)lstCommands.SelectedItem;
5455
txtCommandName.Text = command.Name;
5556
txtCommandPath.Text = command.Source;
5657
txtCommandGroup.Text = command.Group;
@@ -61,15 +62,15 @@ private void lstCommands_SelectedIndexChanged(object sender, EventArgs e)
6162
/// </summary>
6263
private void txtCommandName_TextChanged(object sender, EventArgs e)
6364
{
64-
var command = (Command)lstCommands.SelectedItem;
65+
var command = (App.Command)lstCommands.SelectedItem;
6566
command.Name = txtCommandName.Text;
6667

6768
RefreshBindingContext(lstCommands, _commands);
6869
}
6970

7071
private void txtCommandGroup_TextChanged(object sender, EventArgs e)
7172
{
72-
var command = (Command)lstCommands.SelectedItem;
73+
var command = (App.Command)lstCommands.SelectedItem;
7374
command.Group = txtCommandGroup.Text;
7475

7576
RefreshBindingContext(lstCommands, _commands);
@@ -80,7 +81,7 @@ private void txtCommandGroup_TextChanged(object sender, EventArgs e)
8081
/// </summary>
8182
private void txtCommandPath_TextChanged(object sender, EventArgs e)
8283
{
83-
var command = (Command)lstCommands.SelectedItem;
84+
var command = (App.Command)lstCommands.SelectedItem;
8485
command.Source = txtCommandPath.Text;
8586

8687
RefreshBindingContext(lstCommands, _commands);
@@ -120,7 +121,7 @@ private void btnCommandAdd_Click(object sender, EventArgs e)
120121

121122
if (dialog.ShowDialog(this) == DialogResult.OK)
122123
{
123-
var command = new Command();
124+
var command = new App.Command();
124125
command.Name = "";
125126
command.Group = "";
126127
command.Source = dialog.FileName;

MgdDbgLibrary/App/App.cs

+17-19
Original file line numberDiff line numberDiff line change
@@ -22,18 +22,16 @@
2222
//
2323

2424

25-
using System;
26-
using System.IO;
2725
using System.Collections;
28-
using System.Diagnostics;
29-
using System.Reflection;
3026
using Autodesk.AutoCAD.Runtime;
31-
using Autodesk.AutoCAD.ApplicationServices;
27+
using MgdDbg.App;
28+
using MgdDbg.ObjTests;
29+
using MgdDbg.ObjTests.TestFramework;
3230

33-
[assembly:ExtensionApplication(typeof(MgdDbg.App))]
34-
[assembly:CommandClass(typeof(MgdDbg.Test.TestCmds))]
31+
[assembly:ExtensionApplication(typeof(App))]
32+
[assembly:CommandClass(typeof(TestCmds))]
3533

36-
namespace MgdDbg
34+
namespace MgdDbg.App
3735
{
3836

3937
public class App : IExtensionApplication
@@ -91,16 +89,16 @@ public void
9189
private void
9290
CreateAndAddTestFuncs()
9391
{
94-
m_tests.Add(new MgdDbg.Test.DbTests());
95-
m_tests.Add(new MgdDbg.Test.MakeEntTests());
96-
m_tests.Add(new MgdDbg.Test.MakeSymTblRecTests());
97-
m_tests.Add(new MgdDbg.Test.ModifyEntTests());
98-
m_tests.Add(new MgdDbg.Test.QueryCurveTests());
99-
m_tests.Add(new MgdDbg.Test.QueryEntTests());
100-
m_tests.Add(new MgdDbg.Test.CategoryTests());
92+
m_tests.Add(new DbTests());
93+
m_tests.Add(new MakeEntTests());
94+
m_tests.Add(new MakeSymTblRecTests());
95+
m_tests.Add(new ModifyEntTests());
96+
m_tests.Add(new QueryCurveTests());
97+
m_tests.Add(new QueryEntTests());
98+
m_tests.Add(new CategoryTests());
10199

102-
foreach (MgdDbg.Test.MgdDbgTestFuncs testFunc in m_tests) {
103-
MgdDbg.Test.MgdDbgTestFuncs.AddTestFuncsToFramework(testFunc);
100+
foreach (MgdDbgTestFuncs testFunc in m_tests) {
101+
MgdDbgTestFuncs.AddTestFuncsToFramework(testFunc);
104102
}
105103
}
106104

@@ -112,8 +110,8 @@ private void
112110
private void
113111
RemoveAndFreeTestFuncs()
114112
{
115-
foreach (MgdDbg.Test.MgdDbgTestFuncs testFunc in m_tests) {
116-
MgdDbg.Test.MgdDbgTestFuncs.RemoveTestFuncsFromFramework(testFunc);
113+
foreach (MgdDbgTestFuncs testFunc in m_tests) {
114+
MgdDbgTestFuncs.RemoveTestFuncsFromFramework(testFunc);
117115
}
118116
}
119117

MgdDbgLibrary/App/AppContextMenu.cs

+1-2
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,10 @@
2222
//
2323

2424
using System;
25-
using Autodesk.AutoCAD.Runtime;
2625
using Autodesk.AutoCAD.ApplicationServices;
2726
using Autodesk.AutoCAD.Windows;
2827

29-
namespace MgdDbg
28+
namespace MgdDbg.App
3029
{
3130
/// <summary>
3231
/// Simple derived MenuItem class to keep a command name so that we can have

MgdDbgLibrary/App/AppDocReactor.cs

+1-7
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,9 @@
2121
// (Rights in Technical Data and Computer Software), as applicable.
2222
//
2323

24-
using System;
25-
using System.Collections;
26-
using System.Collections.Generic;
27-
using System.Text;
28-
2924
using AcApp = Autodesk.AutoCAD.ApplicationServices;
30-
using AcRx = Autodesk.AutoCAD.Runtime;
3125

32-
namespace MgdDbg {
26+
namespace MgdDbg.App {
3327

3428
class AppDocReactor {
3529

MgdDbgLibrary/App/AssemblyInfo.cs

-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
//
2424

2525
using System.Reflection;
26-
using System.Runtime.CompilerServices;
2726

2827
//
2928
// General Information about an assembly is controlled through the following

MgdDbgLibrary/App/TestCmds.cs

+8-6
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,18 @@
2222

2323
using System;
2424
using System.Windows.Forms;
25-
using System.Collections;
26-
using Autodesk.AutoCAD.Runtime;
27-
using Autodesk.AutoCAD.ApplicationServices;
2825
using Autodesk.AutoCAD.DatabaseServices;
29-
using Autodesk.AutoCAD.Geometry;
3026
using Autodesk.AutoCAD.EditorInput;
27+
using Autodesk.AutoCAD.Geometry;
28+
using Autodesk.AutoCAD.Runtime;
29+
using MgdDbg.CompBuilder;
30+
using MgdDbg.ObjTests.TestFramework;
31+
using MgdDbg.Throwaway;
3132
using MgdDbg.Utils;
3233
using AcadApp = Autodesk.AutoCAD.ApplicationServices.Application;
34+
using TestForm = MgdDbg.ObjTests.TestFramework.TestForm;
3335

34-
namespace MgdDbg.Test
36+
namespace MgdDbg.App
3537
{
3638
/// <summary>
3739
/// Summary description for TestCmds.
@@ -221,7 +223,7 @@ public void Events()
221223
[CommandMethod("SnoopTests", CommandFlags.Modal)]
222224
public void TestDb()
223225
{
224-
MgdDbg.Test.TestForm dbox = new MgdDbg.Test.TestForm(MgdDbgTestFuncs.RegisteredTestFuncs());
226+
TestForm dbox = new TestForm(MgdDbgTestFuncs.RegisteredTestFuncs());
225227
if (AcadApp.ShowModalDialog(dbox) == DialogResult.OK)
226228
dbox.DoTest();
227229
}

MgdDbgLibrary/CompBuilder/CompBldr.cs

+2-3
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,12 @@
2121
// (Rights in Technical Data and Computer Software), as applicable.
2222
//
2323

24-
using System;
25-
using System.Diagnostics;
2624
using System.Collections;
25+
using System.Diagnostics;
2726
using Autodesk.AutoCAD.DatabaseServices;
2827
using Autodesk.AutoCAD.Geometry;
2928

30-
namespace MgdDbg
29+
namespace MgdDbg.CompBuilder
3130
{
3231
/// <summary>
3332
/// This class is intended to ease the creation of multiple entities that

MgdDbgLibrary/CompBuilder/CompBldrAnonBlkDef.cs

+1-2
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,10 @@
2121
// (Rights in Technical Data and Computer Software), as applicable.
2222
//
2323

24-
using System;
2524
using System.Diagnostics;
2625
using Autodesk.AutoCAD.DatabaseServices;
2726

28-
namespace MgdDbg
27+
namespace MgdDbg.CompBuilder
2928
{
3029
/// <summary>
3130
/// Derived component builder to direct the made entities into an

0 commit comments

Comments
 (0)