Example #1
0
        //TODO (DYN-2118) remove this method in 3.0 and unify this method with the overload above.
        public static DynamoModel MakeModel(bool CLImode)
        {
            var geometryFactoryPath = string.Empty;
            var preloaderLocation   = string.Empty;

            try
            {
                PreloadShapeManager(ref geometryFactoryPath, ref preloaderLocation);
            }
            catch (Exception e)
            {
                ASMPreloadFailure?.Invoke(e.Message);
            }

            return(StartDynamoWithDefaultConfig(CLImode, geometryFactoryPath, preloaderLocation));
        }
Example #2
0
        private static void PreloadASM(string asmPath, out string geometryFactoryPath, out string preloaderLocation)
        {
            if (string.IsNullOrEmpty(asmPath))
            {
                geometryFactoryPath = string.Empty;
                preloaderLocation   = string.Empty;
                try
                {
                    PreloadShapeManager(ref geometryFactoryPath, ref preloaderLocation);
                }
                catch (Exception e)
                {
                    ASMPreloadFailure?.Invoke(e.Message);
                }
                return;
            }

            // get sandbox executing location - this is where libG will be located.
            var rootFolder = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);

            // defaults - preload these will fail.
            preloaderLocation   = "libg_0_0_0";
            geometryFactoryPath = Path.Combine(preloaderLocation, DynamoShapeManager.Utilities.GeometryFactoryAssembly);

            try
            {
                if (!Directory.Exists(asmPath))
                {
                    throw new FileNotFoundException($"{nameof(asmPath)}:{asmPath}");
                }
                Version asmBinariesVersion = DynamoShapeManager.Utilities.GetVersionFromPath(asmPath);

                //get version of libG that matches the asm version that was supplied from geometryLibraryPath.
                preloaderLocation   = DynamoShapeManager.Utilities.GetLibGPreloaderLocation(asmBinariesVersion, rootFolder);
                geometryFactoryPath = Path.Combine(preloaderLocation, DynamoShapeManager.Utilities.GeometryFactoryAssembly);

                //load asm and libG.
                DynamoShapeManager.Utilities.PreloadAsmFromPath(preloaderLocation, asmPath);
            }
            catch (Exception e)
            {
                Console.WriteLine("A problem occured while trying to load ASM or LibG");
                Console.WriteLine($"{e?.Message} : {e?.StackTrace}");
            }
        }