DynamoVisualProgramming.ZeroTouchLibrary by Autodesk

<PackageReference Include="DynamoVisualProgramming.ZeroTouchLibrary" Version="2.0.0-beta2536" />

 Application

using Autodesk.DesignScript.Geometry.Properties; using Autodesk.DesignScript.Interfaces; using Autodesk.DesignScript.Runtime; using System; using System.Collections.Generic; namespace Autodesk.DesignScript.Geometry { [SupressImportIntoVM] public class Application { private static Application mInstance; private List<IDisposable> mToBeDisposedObjects = new List<IDisposable>(); private IExecutionSession mSession; internal IExecutionSession Session => mSession; public static Application Instance { get { if (mInstance == null) mInstance = new Application(); return mInstance; } } public bool IsExecuting => mSession != null; private Application() { mInstance = this; } private void ToBeDisposed(IDisposable obj) { if (obj != null) { lock (mToBeDisposedObjects) { mToBeDisposedObjects.Add(obj); } } } void OnBeginExecution(IExecutionSession session) { mSession = session; if (HostFactory.Instance != null && !HostFactory.ExtensionApplicationStarted) { foreach (IExtensionApplication extensionApplication in HostFactory.ExtensionApplications) { if (extensionApplication != null) extensionApplication.OnBeginExecution(session); } HostFactory.ExtensionApplicationStarted = true; } GeometrySettings.Reset(); GeometrySettings.RootModulePath = session.get_Configuration().get_RootModulePath(); object configValue = session.get_Configuration().GetConfigValue(ConfigurationKeys.GeometryXmlProperties); if (configValue != null) GeometrySettings.GeometryXmlProperties = (bool)configValue; configValue = session.get_Configuration().GetConfigValue(ConfigurationKeys.GeometryFactory); if (configValue != null) GeometrySettings.GeometryFactoryFilePath = (string)configValue; configValue = session.get_Configuration().GetConfigValue(ConfigurationKeys.PersistentManager); if (configValue != null) GeometrySettings.PersistenceManagerFilePath = (string)configValue; } void OnEndExecution(IExecutionSession session) { if (HostFactory.Instance != null && HostFactory.ExtensionApplicationStarted) { foreach (IExtensionApplication extensionApplication in HostFactory.ExtensionApplications) { if (extensionApplication != null) extensionApplication.OnEndExecution(session); } HostFactory.ExtensionApplicationStarted = false; } if (mSession != null && mSession != session) throw new InvalidOperationException(Resources.SessionMismatchException); IDisposable[] array = null; lock (mToBeDisposedObjects) { array = mToBeDisposedObjects.ToArray(); mToBeDisposedObjects.Clear(); } IDisposable[] array2 = array; for (int i = 0; i < array2.Length; i++) { array2[i].Dispose(); } mSession = null; } void OnSuspendExecution(IExecutionSession session) { } void OnResumeExecution(IExecutionSession session) { } public void StartUp() { } public void ShutDown() { } public void PreloadAsmLibraries(string baseDirectory) { } } }