file saving

This commit is contained in:
AzaezelX 2023-12-24 12:03:48 -06:00
parent ca31e4c2c9
commit ace243171e
2 changed files with 37 additions and 24 deletions

View file

@ -68,7 +68,7 @@ $guiContent = new GuiControl(classPrototyping) {
extent = "22 22"; extent = "22 22";
horizSizing = "left"; horizSizing = "left";
profile = "ToolsGuiButtonProfile"; profile = "ToolsGuiButtonProfile";
command = "SelectAssetPath.showDialog(AssetBrowser.dirHandler.currentAddress, \"setAssetTargetUpdatePath\");\nSelectAssetPathWindow.selectWindow();"; command = "SelectAssetPath.showDialog(AssetBrowser.dirHandler.currentAddress, \"setProtoTypeFilePath\");\nSelectAssetPathWindow.selectWindow();";
tooltipProfile = "GuiToolTipProfile"; tooltipProfile = "GuiToolTipProfile";
tooltip = "New Module"; tooltip = "New Module";
}; };

View file

@ -20,7 +20,6 @@ function PrototypeClass(%classInstance)
function classPrototyping::fillClasslist(%this, %classInstance) function classPrototyping::fillClasslist(%this, %classInstance)
{ {
ClassInheritanceListCtrl.deleteAllObjects(); ClassInheritanceListCtrl.deleteAllObjects();
%this.inst = %classInstance;
%this.instanceName = %classInstance.getName(); %this.instanceName = %classInstance.getName();
//get potentially scripted namespaces //get potentially scripted namespaces
@ -86,6 +85,11 @@ function classPrototyping::fillMethodlist(%this, %nameSpaceUsed)
} }
} }
function setProtoTypeFilePath(%targetPath)
{
classPrototyping-->targetPath.text = %targetPath;
}
function classPrototyping::writeResults(%this) function classPrototyping::writeResults(%this)
{ {
%namespaceUsed = ""; %namespaceUsed = "";
@ -96,33 +100,42 @@ function classPrototyping::writeResults(%this)
if (%obj.isStateOn()) if (%obj.isStateOn())
%namespaceUsed = getWord(%this.classlist,%inheritanceOrder); %namespaceUsed = getWord(%this.classlist,%inheritanceOrder);
} }
echo(%namespaceUsed); %file = new FileObject();
for (%i=0; %i<%this.methodCount; %i++) %filename = classPrototyping-->targetPath.text @"/"@ %namespaceUsed @"."@ $TorqueScriptFileExtension;
if(%file.openForWrite(%filename))
{ {
%obj = "ProtoMethodSelect"@ %i; for (%i=0; %i<%this.methodCount; %i++)
if (%obj.isStateOn())
echo(strreplace(%this.methodArray.getValue(%i),%this.instanceName,%namespaceUsed));
}
if (ReportCommands.isStateOn())
{
%this.commandArray = getMethodSigsNS(%this.nameSpaceUsed,true);
%this.commandCount = %this.commandArray.count();
echo("/* Available Commands:");
for (%i=0; %i< %this.commandCount; %i++)
{ {
echo(getRecord(%this.commandArray.getValue(%i),0)); %obj = "ProtoMethodSelect"@ %i;
if (%obj.isStateOn())
%file.writeLine(strreplace(%this.methodArray.getValue(%i),%this.instanceName,%namespaceUsed));
} }
echo("*/");
}
if (ReportVariables.isStateOn()) if (ReportCommands.isStateOn())
{
echo("/* HardCoded Variables");
for (%i=0; %i< getFieldCountNS(%this.nameSpaceUsed); %i++)
{ {
echo(getFieldNS(%this.nameSpaceUsed,%i)); %this.commandArray = getMethodSigsNS(%this.nameSpaceUsed,true);
%this.commandCount = %this.commandArray.count();
%file.writeLine("/* Available Commands:");
for (%i=0; %i< %this.commandCount; %i++)
{
%file.writeLine(getRecord(%this.commandArray.getValue(%i),0));
}
%file.writeLine("*/");
}
if (ReportVariables.isStateOn())
{
%file.writeLine("/* HardCoded Variables");
for (%i=0; %i< getFieldCountNS(%this.nameSpaceUsed); %i++)
{
%file.writeLine(getFieldNS(%this.nameSpaceUsed,%i));
}
%file.writeLine("*/");
} }
echo("*/");
} }
else
{
error( "Failed to open " @ %filename @ " for writing" );
}
%file.delete();
} }