public void Initialize() { if (options == null) { InitializeConfig(); } string baseDir = Path.GetDirectoryName(AppDomain.CurrentDomain.BaseDirectory); Log("Base Directory: " + baseDir); baseSavePath = Path.Combine(baseDir, options.SaveDirectory); Log("Base Save Path: " + baseSavePath); if (options.SaveToDisk && !Directory.Exists(baseSavePath)) { Directory.CreateDirectory(baseSavePath); Log("Created directory " + baseSavePath); } CompileCommonScripts(); // Register extension methods foreach (Assembly assembly in options.AssembliesToReference) { if (assembly.GetCustomAttributes(typeof(ExtensionAttribute), true).Length > 0) { foreach (var type in assembly.GetTypes()) { foreach (string nmespace in options.NamespacesToImport) { if (type != null && type.Namespace != null && type.Namespace.Equals(nmespace)) { RuntimeServices.RegisterExtensions(type); } } } } } // ViewSourceLoader.ViewChanged += OnViewChanged; }
static UnityRuntimeServices() { $static_initializer$(); RuntimeServices.RegisterExtensions(typeof(Extensions)); Initialized = true; }