public EnvDictionary() { // get the dictionary from appdomain _envData = (PythonDictionary)AppDomain.CurrentDomain.GetData(EnvDictionaryKeys.root); if (_envData.Contains(EnvDictionaryKeys.addonVersion)) { addonVersion = (string)_envData[EnvDictionaryKeys.addonVersion]; } if (_envData.Contains(EnvDictionaryKeys.sessionUUID)) { sessionUUID = (string)_envData[EnvDictionaryKeys.sessionUUID]; } if (_envData.Contains(EnvDictionaryKeys.usageLogState)) { usageLogState = (bool)_envData[EnvDictionaryKeys.usageLogState]; } if (_envData.Contains(EnvDictionaryKeys.usageLogFilePath)) { usageLogFilePath = (string)_envData[EnvDictionaryKeys.usageLogFilePath]; } if (_envData.Contains(EnvDictionaryKeys.usageLogServerUrl)) { usageLogServerUrl = (string)_envData[EnvDictionaryKeys.usageLogServerUrl]; } }
Dispose(bool disposing) { if (!this.alive) { return; } this.alive = false; while (this.exitfuncs.Count > 0) { this.exitfuncs.Pop()(); } PythonDictionary modules = (PythonDictionary)this.python.SystemState.Get__dict__()["modules"]; if (!modules.Contains("numpy")) { // TODO: FIXME? // I don't know what it is about numpy, but using it heavily // makes this step extremely flaky: that's, like, BSOD flaky. // OTOH, even attempting this operation is very optimistic // indeed, and it's only really here so that I can repeatedly // construct/destroy mappers -- without leaking *too* much -- // during test runs. In the wild, all this will be reclaimed // by the operating system at process shutdown time anyway. this.map.MapOverBridgePtrs(new PtrFunc(this.DumpPtr)); } this.allocator.FreeAll(); foreach (IntPtr FILE in this.FILEs.Values) { Unmanaged.fclose(FILE); } if (this.stub != null) { PythonCalls.Call(this.removeSysHacks); modules.Remove("mmap"); modules.Remove("posix"); modules.Remove("_csv"); if (modules.Contains("csv")) { modules.Remove("csv"); } this.importer.Dispose(); this.stub.Dispose(); } }
public IEnumerable <string> AnnotationLibraries() { //if (_getAnnotationLibsFunc != null) //{ // List list = _getAnnotationLibsFunc(); // List<string> csharplist = new List<string>(); // foreach (string lib in list) // csharplist.Add(lib); // return csharplist; //} List <string> libraries = new List <string>(); if (_parameters.Contains("libraries")) { foreach (string lib in (IEnumerable <string>)_parameters["libraries"]) { libraries.Add(lib); } } return(libraries); }
public EnvDictionary() { // get the dictionary from appdomain _envData = (PythonDictionary)AppDomain.CurrentDomain.GetData(DomainStorageKeys.EnvVarsDictKey); // base info if (_envData.Contains(EnvDictionaryKeys.SessionUUID)) { SessionUUID = (string)_envData[EnvDictionaryKeys.SessionUUID]; } if (_envData.Contains(EnvDictionaryKeys.RevitVersion)) { RevitVersion = (string)_envData[EnvDictionaryKeys.RevitVersion]; } if (_envData.Contains(EnvDictionaryKeys.Version)) { PyRevitVersion = (string)_envData[EnvDictionaryKeys.Version]; } if (_envData.Contains(EnvDictionaryKeys.Clone)) { PyRevitClone = (string)_envData[EnvDictionaryKeys.Clone]; } if (_envData.Contains(EnvDictionaryKeys.IPYVersion)) { PyRevitIPYVersion = (string)_envData[EnvDictionaryKeys.IPYVersion]; } if (_envData.Contains(EnvDictionaryKeys.CPYVersion)) { PyRevitCPYVersion = (string)_envData[EnvDictionaryKeys.CPYVersion]; } // logging if (_envData.Contains(EnvDictionaryKeys.LoggingLevel)) { LoggingLevel = (int)_envData[EnvDictionaryKeys.LoggingLevel]; } if (_envData.Contains(EnvDictionaryKeys.FileLogging)) { FileLogging = (bool)_envData[EnvDictionaryKeys.FileLogging]; } // assemblies if (_envData.Contains(EnvDictionaryKeys.LoadedAssms)) { LoadedAssemblies = ((string)_envData[EnvDictionaryKeys.LoadedAssms]).Split(Path.PathSeparator); } if (_envData.Contains(EnvDictionaryKeys.RefedAssms)) { ReferencedAssemblies = ((string)_envData[EnvDictionaryKeys.RefedAssms]).Split(Path.PathSeparator); } // telemetry if (_envData.Contains(EnvDictionaryKeys.TelemetryUTCTimeStamps)) { TelemetryUTCTimeStamps = (bool)_envData[EnvDictionaryKeys.TelemetryUTCTimeStamps]; } // script telemetry if (_envData.Contains(EnvDictionaryKeys.TelemetryState)) { TelemetryState = (bool)_envData[EnvDictionaryKeys.TelemetryState]; } if (_envData.Contains(EnvDictionaryKeys.TelemetryFilePath)) { TelemetryFilePath = (string)_envData[EnvDictionaryKeys.TelemetryFilePath]; } if (_envData.Contains(EnvDictionaryKeys.TelemetryServerUrl)) { TelemetryServerUrl = (string)_envData[EnvDictionaryKeys.TelemetryServerUrl]; } if (_envData.Contains(EnvDictionaryKeys.TelemetryIncludeHooks)) { TelemetryIncludeHooks = (bool)_envData[EnvDictionaryKeys.TelemetryIncludeHooks]; } // app events telemetry if (_envData.Contains(EnvDictionaryKeys.AppTelemetryState)) { AppTelemetryState = (bool)_envData[EnvDictionaryKeys.AppTelemetryState]; } if (_envData.Contains(EnvDictionaryKeys.AppTelemetryServerUrl)) { AppTelemetryServerUrl = (string)_envData[EnvDictionaryKeys.AppTelemetryServerUrl]; } if (_envData.Contains(EnvDictionaryKeys.AppTelemetryEventFlags)) { AppTelemetryEventFlags = (string)_envData[EnvDictionaryKeys.AppTelemetryEventFlags]; } // hooks if (_envData.Contains(EnvDictionaryKeys.Hooks)) { EventHooks = (Dictionary <string, Dictionary <string, string> >)_envData[EnvDictionaryKeys.Hooks]; } else { _envData[EnvDictionaryKeys.Hooks] = EventHooks; } // misc if (_envData.Contains(EnvDictionaryKeys.AutoUpdating)) { AutoUpdate = (bool)_envData[EnvDictionaryKeys.AutoUpdating]; } if (_envData.Contains(EnvDictionaryKeys.OutputStyleSheet)) { ActiveStyleSheet = (string)_envData[EnvDictionaryKeys.OutputStyleSheet]; } }