Skip to content

Commit

Permalink
implemented temporary environment variable for advanced debug
Browse files Browse the repository at this point in the history
  • Loading branch information
koechlm committed Jan 11, 2021
1 parent bd4594a commit 2672a70
Show file tree
Hide file tree
Showing 6 changed files with 59 additions and 100 deletions.
4 changes: 2 additions & 2 deletions Autodesk.VltInvSrv.iLogicSampleJob/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2021.0.2.1")]
[assembly: AssemblyFileVersion("2021.0.2.1")]
[assembly: AssemblyVersion("2021.0.3.0")]
[assembly: AssemblyFileVersion("2021.0.3.0")]

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 0 additions & 6 deletions Autodesk.VltInvSrv.iLogicSampleJob/iLogicJobAdminForm.resx
Original file line number Diff line number Diff line change
Expand Up @@ -117,12 +117,6 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="lblDebugInfo.Text" xml:space="preserve">
<value>Enabling extended debugging expects the environment variable
"iLogicRuleFolderForVS" and an available path's value.
The installer added the path C:\WINDOWS\TEMP.
Check that you have access to the location.</value>
</data>
<metadata name="toolTip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>336, 14</value>
</metadata>
Expand Down
56 changes: 48 additions & 8 deletions Autodesk.VltInvSrv.iLogicSampleJob/iLogicJobExtension.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ public class iLogicJobExtension : IJobHandler
private Int32 mRuleSuccess = -1;
private List<string> mAllRules = new List<string>();
private string mAllRulesTextWrp = "";
private string mRuleTmp = "\\iLogicVaultJobRules";

#region IJobHandler Implementation
public bool CanProcess(string jobType)
Expand All @@ -44,8 +45,6 @@ public JobOutcome Execute(IJobProcessorServices context, IJob job)

try
{
Inventor.InventorServer mInv = context.InventorObject as InventorServer;

#region validate execution rules

//pick up this job's context
Expand Down Expand Up @@ -144,6 +143,28 @@ public JobOutcome Execute(IJobProcessorServices context, IJob job)
}
}

//enable advanced debug break
if (mSettings.ActivateDebugBreak == "True")
{
try
{
System.IO.DirectoryInfo mRuleTempInfo = new System.IO.DirectoryInfo(System.IO.Path.GetTempPath() + mRuleTmp);
if (mRuleTempInfo.Exists == false)
{
mRuleTempInfo = System.IO.Directory.CreateDirectory(System.IO.Path.GetTempPath() + mRuleTmp);
}
System.Environment.SetEnvironmentVariable("iLogicRuleFolderForVS", mRuleTempInfo.FullName);
}
catch (Exception e)
{
{
context.Log(null, "Advanced Debug Break tried to create a temporary system variable but failed with the error: " + e.Message);
return JobOutcome.Failure;
}
}
}

Inventor.InventorServer mInv = context.InventorObject as InventorServer;
ApplicationAddIns mInvSrvAddIns = mInv.ApplicationAddIns;
ApplicationAddIn iLogicAddIn = mInvSrvAddIns.ItemById["{3BDD8D79-2179-4B11-8A5A-257B1C0263AC}"];

Expand Down Expand Up @@ -352,16 +373,24 @@ public JobOutcome Execute(IJobProcessorServices context, IJob job)
string mILogicLogFileFullName = "";
if (mLogCtrl.Level != 0)
{
string mLogName = job.Id + "_" + mFile.Name + "_iLogicSampleJob.log";
System.IO.DirectoryInfo mLogDirInfo = new System.IO.DirectoryInfo(mSettings.iLogicLogDir);
if (mLogDirInfo.Exists == false)
//validate that a log path is configured and exists
if (mSettings.iLogicLogDir != "")
{
string mLogName = job.Id + "_" + mFile.Name + "_iLogicSampleJob.log";
System.IO.DirectoryInfo mLogDirInfo = new System.IO.DirectoryInfo(mSettings.iLogicLogDir);
if (mLogDirInfo.Exists == false)
{
mLogDirInfo = System.IO.Directory.CreateDirectory(mSettings.iLogicLogDir);
}
mILogicLogFileFullName = System.IO.Path.Combine(mLogDirInfo.FullName, mLogName);
}
else
{
mLogDirInfo = System.IO.Directory.CreateDirectory(mSettings.iLogicLogDir);
context.Log(null, "The configured log level requires a path and exited because no valid path exists. Review and correct the JobExtension's iLogic Configuration.");
return JobOutcome.Failure;
}
mILogicLogFileFullName = System.IO.Path.Combine(mLogDirInfo.FullName, mLogName);
}


//read rule execution settings
string mExtRule = null;
string mExtRuleFullLocalName = null;
Expand Down Expand Up @@ -615,6 +644,17 @@ public JobOutcome Execute(IJobProcessorServices context, IJob job)
mInvDfltProject.Activate();
//delete temporary working folder if imlemented here

//delete the temporary rule debug variable and related folder
if (System.Environment.GetEnvironmentVariable("iLogicRuleFolderForVS") != null)
{
System.IO.DirectoryInfo mRuleTempInfo = new System.IO.DirectoryInfo(System.Environment.GetEnvironmentVariable("iLogicRuleFolderForVS"));
if (mRuleTempInfo.Exists)
{
System.IO.Directory.Delete(mRuleTempInfo.FullName, true);
}
System.Environment.SetEnvironmentVariable("iLogicRuleFolderForVS", null);
}

#endregion reset

return JobOutcome.Success;
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ relationship are not supported.

VERSION HISTORY / RELEASE NOTES:
---------------------------------
2021.0.3.0 - Resolved logging and advanced debugging issues; see project '2021.0.3 Update' for details.
2021.0.2.1 - All dialogs are user resizeable; fixed several issues, see commits for details
2021.0.1.4 - Job Administration Dialog, new Options tab
2021.0.1.0 - Renamed tabs in iLogic Job Administration Dialog, Added MSI Installer Project
Expand Down
86 changes: 4 additions & 82 deletions Setup1/Setup1.vdproj
Original file line number Diff line number Diff line change
Expand Up @@ -1961,15 +1961,15 @@
{
"Name" = "8:Microsoft Visual Studio"
"ProductName" = "8:Autodesk Vault iLogicJobExtension SampleApp 2021"
"ProductCode" = "8:{8FF10DFD-194A-4F36-956A-BEF6277B8BF5}"
"PackageCode" = "8:{B7BF8810-88E1-4D40-A8AA-7485AB560A24}"
"ProductCode" = "8:{57A08A24-AE2D-4873-B398-5DA5C231ECD5}"
"PackageCode" = "8:{05B1344A-E12C-47C9-82D4-02AE50B731F3}"
"UpgradeCode" = "8:{99F32B73-324F-4D8B-B249-BC735D036446}"
"AspNetVersion" = "8:4.0.30319.0"
"RestartWWWService" = "11:FALSE"
"RemovePreviousVersions" = "11:TRUE"
"DetectNewerInstalledVersion" = "11:TRUE"
"InstallAllUsers" = "11:TRUE"
"ProductVersion" = "8:2.1.2021"
"ProductVersion" = "8:3.0.2021"
"Manufacturer" = "8:Autodesk"
"ARPHELPTELEPHONE" = "8:"
"ARPHELPLINK" = "8:https://github.com/koechlm/Vault-Job-Processor---iLogic-Extension/issues"
Expand All @@ -1994,84 +1994,6 @@
{
"Keys"
{
"{60EA8692-D2D5-43EB-80DC-7906BF13D6EF}:_B11564E660AF44869F0316BBCD8E117E"
{
"Name" = "8:SYSTEM"
"Condition" = "8:"
"AlwaysCreate" = "11:FALSE"
"DeleteAtUninstall" = "11:FALSE"
"Transitive" = "11:FALSE"
"Keys"
{
"{60EA8692-D2D5-43EB-80DC-7906BF13D6EF}:_202F70A3EFB54F2FBD4EB33A01F2C98B"
{
"Name" = "8:CurrentControlSet"
"Condition" = "8:"
"AlwaysCreate" = "11:FALSE"
"DeleteAtUninstall" = "11:FALSE"
"Transitive" = "11:FALSE"
"Keys"
{
"{60EA8692-D2D5-43EB-80DC-7906BF13D6EF}:_85E40A12293D4F4B80AA2CEBE699DA97"
{
"Name" = "8:Control"
"Condition" = "8:"
"AlwaysCreate" = "11:FALSE"
"DeleteAtUninstall" = "11:FALSE"
"Transitive" = "11:FALSE"
"Keys"
{
"{60EA8692-D2D5-43EB-80DC-7906BF13D6EF}:_BA932380B57C4A87AEA2D695C014C5EC"
{
"Name" = "8:Session Manager"
"Condition" = "8:"
"AlwaysCreate" = "11:FALSE"
"DeleteAtUninstall" = "11:FALSE"
"Transitive" = "11:FALSE"
"Keys"
{
"{60EA8692-D2D5-43EB-80DC-7906BF13D6EF}:_5DB898208A3343F684CAAD267FFED2A6"
{
"Name" = "8:Environment"
"Condition" = "8:"
"AlwaysCreate" = "11:TRUE"
"DeleteAtUninstall" = "11:FALSE"
"Transitive" = "11:FALSE"
"Keys"
{
}
"Values"
{
"{ADCFDA98-8FDD-45E4-90BC-E3D20B029870}:_DBC79008F7964EBA9855236B1640B8D4"
{
"Name" = "8:iLogicRuleFolderForVS"
"Condition" = "8:"
"Transitive" = "11:FALSE"
"ValueTypes" = "3:1"
"Value" = "8:C:\\WINDOWS\\TEMP"
}
}
}
}
"Values"
{
}
}
}
"Values"
{
}
}
}
"Values"
{
}
}
}
"Values"
{
}
}
}
}
"HKCU"
Expand Down Expand Up @@ -2505,7 +2427,7 @@
{
"{5259A561-127C-4D43-A0A1-72F10C7B3BF8}:_839FAA723C0A4CDDBE6F856FA92F8E74"
{
"SourcePath" = "8:"
"SourcePath" = "8:..\\Autodesk.VltInvSrv.iLogicSampleJob\\obj\\x64\\Debug\\Autodesk.VltInvSrv.iLogicSampleJob.dll"
"TargetName" = "8:"
"Tag" = "8:"
"Folder" = "8:_82DFAA786EAF42B8B444014ADD0F8A21"
Expand Down

0 comments on commit 2672a70

Please sign in to comment.