public async Task InitializeAsync()
        {
            Environment.SetEnvironmentVariable(LanguageWorkerConstants.FunctionWorkerRuntimeSettingName, _functionsWorkerRuntime);

            _copiedRootPath = Path.Combine(Path.GetTempPath(), "FunctionsE2E", DateTime.UtcNow.ToString("yyMMdd-HHmmss"));
            FileUtility.CopyDirectory(_rootPath, _copiedRootPath);

            var extensionsToInstall = GetExtensionsToInstall();

            if (extensionsToInstall != null && extensionsToInstall.Length > 0)
            {
                TestFunctionHost.WriteNugetPackageSources(_copiedRootPath, "http://www.myget.org/F/azure-appservice/api/v2", "https://www.myget.org/F/azure-appservice-staging/api/v2", "https://api.nuget.org/v3/index.json");
                var options = new OptionsWrapper <ScriptJobHostOptions>(new ScriptJobHostOptions
                {
                    RootScriptPath = _copiedRootPath
                });

                var manager = new ExtensionsManager(options, NullLogger <ExtensionsManager> .Instance);
                await manager.AddExtensions(extensionsToInstall);
            }

            string logPath = Path.Combine(Path.GetTempPath(), @"Functions");

            Host = new TestFunctionHost(_copiedRootPath, logPath, ConfigureJobHost);

            string connectionString            = Host.JobHostServices.GetService <IConfiguration>().GetWebJobsConnectionString(ConnectionStringNames.Storage);
            CloudStorageAccount storageAccount = CloudStorageAccount.Parse(connectionString);

            QueueClient = storageAccount.CreateCloudQueueClient();
            BlobClient  = storageAccount.CreateCloudBlobClient();
            TableClient = storageAccount.CreateCloudTableClient();

            await CreateTestStorageEntities();
        }
        public async Task InitializeAsync()
        {
            _copiedRootPath = Path.Combine(Path.GetTempPath(), "FunctionsE2E", DateTime.UtcNow.ToString("yyMMdd-HHmmss"));
            FileUtility.CopyDirectory(_rootPath, _copiedRootPath);

            var extensionsToInstall = GetExtensionsToInstall();

            if (extensionsToInstall != null && extensionsToInstall.Length > 0)
            {
                TestFunctionHost.WriteNugetPackageSources(_copiedRootPath, "http://www.myget.org/F/azure-appservice/api/v2", "https://www.myget.org/F/azure-appservice-staging/api/v2", "https://api.nuget.org/v3/index.json");
                var options = new OptionsWrapper <ScriptJobHostOptions>(new ScriptJobHostOptions
                {
                    RootScriptPath = _copiedRootPath
                });

                var manager = new ExtensionsManager(options, NullLogger <ExtensionsManager> .Instance, new TestExtensionBundleManager());
                await manager.AddExtensions(extensionsToInstall);
            }

            string logPath = Path.Combine(Path.GetTempPath(), @"Functions");

            if (!string.IsNullOrEmpty(_functionsWorkerRuntime))
            {
                Environment.SetEnvironmentVariable(RpcWorkerConstants.FunctionWorkerRuntimeSettingName, _functionsWorkerRuntime);
                Environment.SetEnvironmentVariable(RpcWorkerConstants.FunctionsWorkerProcessCountSettingName, _workerProcessCount.ToString());
            }
            if (!string.IsNullOrEmpty(_functionsWorkerRuntimeVersion))
            {
                Environment.SetEnvironmentVariable(RpcWorkerConstants.FunctionWorkerRuntimeVersionSettingName, _functionsWorkerRuntimeVersion);
            }

            FunctionsSyncManagerMock = new Mock <IFunctionsSyncManager>(MockBehavior.Strict);
            FunctionsSyncManagerMock.Setup(p => p.TrySyncTriggersAsync(It.IsAny <bool>())).ReturnsAsync(new SyncTriggersResult {
                Success = true
            });

            Host = new TestFunctionHost(_copiedRootPath, logPath,
                                        configureScriptHostWebJobsBuilder: webJobsBuilder =>
            {
                ConfigureScriptHost(webJobsBuilder);
            },
                                        configureScriptHostServices: s =>
            {
                s.AddSingleton <IFunctionsSyncManager>(_ => FunctionsSyncManagerMock.Object);
                s.AddSingleton <IMetricsLogger>(_ => MetricsLogger);
            },
                                        configureWebHostServices: s =>
            {
                s.AddSingleton <IEventGenerator>(_ => EventGenerator);
            });

            string connectionString            = Host.JobHostServices.GetService <IConfiguration>().GetWebJobsConnectionString(ConnectionStringNames.Storage);
            CloudStorageAccount storageAccount = CloudStorageAccount.Parse(connectionString);

            QueueClient = storageAccount.CreateCloudQueueClient();
            BlobClient  = storageAccount.CreateCloudBlobClient();
            TableClient = storageAccount.CreateCloudTableClient();

            await CreateTestStorageEntities();
        }
Exemplo n.º 3
0
        public static async Task RunAsync(UniversalPackage package, string script, bool simulate)
        {
            PackageId      = new UniversalPackageId(package.Group, package.Name);
            PackageVersion = package.Version;

            await ExtensionsManager.WaitForInitializationAsync().ConfigureAwait(false);

            var tempPath = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString("N"));

            try
            {
                Directory.CreateDirectory(tempPath);
                Console.WriteLine("Extracting package...");
                await package.ExtractAllItemsAsync(tempPath, default);

                var installScriptFileName = Path.Combine(tempPath, script);
                var installScript         = Compile(installScriptFileName);
                if (installScript == null)
                {
                    throw new RompException($"Unable to compile {script}.");
                }

                PackageRootPath = tempPath;
                await RunPlanAsync(installScript, simulate);
            }
            finally
            {
                Console.WriteLine("Cleaning up...");
                try { Directory.Delete(tempPath, true); }
                catch { }
            }
        }
Exemplo n.º 4
0
 public EditSitePage(Site site) : this()
 {
     this._site                  = site;
     this.txtSiteName.Text       = _site.SiteName;
     this.txtWebLocation.Content = _site.SiteLocation;
     this.txtPort.Text           = _site.SitePort.ToString();
     extensionsManager           = new ExtensionsManager(_site);
 }
 /// <summary>
 /// Called when the inspector of the Editor is drawn.
 /// This implementation calls OnBeforeInspectorGUI() on all the editor extensions, draws the original inspector, and ends by
 /// calling OnInspectorGUI on all the editor extensions.
 /// </summary>
 public override void OnInspectorGUI()
 {
     ExtensionsManager.DrawCustomEditorsBeforeInspectorGUI();
     if (NativeEditor != null)
     {
         NativeEditor.OnInspectorGUI();
     }
     ExtensionsManager.DrawCustomEditorsInspectorGUI();
 }
Exemplo n.º 6
0
 void Update()
 {
     if (hasParameter)
     {
         if (emitter.IsPlaying())
         {
             parameter.setValue(ExtensionsManager.GetOcclusionAmout(transform.position));
         }
     }
 }
 public WebKitPage(WallbinSiteControl siteContainer, string url) : this()
 {
     _siteContainer       = siteContainer;
     _startUrl            = url;
     pbProgressLogo.Image = _siteContainer.ParentBundle.SplashLogo;
     ExtensionsManager.MakeUrlTrusted(_startUrl);
     InitSiteLoading();
     InitDownloading();
     InitExternalBrowsersCommandIds();
     InitExtensions();
 }
Exemplo n.º 8
0
        protected override void OnHeaderGUI()
        {
            GUILayout.Space(IMPORTED_OBJECT_NOTE_OFFSET);
            GUIStyle header = new GUIStyle("AC BoldHeader");

            GUILayout.Box("", header, GUILayout.ExpandWidth(true));

            GUILayout.Space(HEADER_CONTENT_OFFSET);
            ExtensionsManager.DrawCustomEditorsBeforeHeaderGUI();
            ExtensionsManager.DrawCustomEditorsHeaderGUI();
        }
 /// <summary>
 /// Called when the header of the Editor is drawn.
 /// This implementation calls OnBeforeHeaderGUI() on all the editor extensions, draws the original header, and ends by calling
 /// OnHeaderGUI on all the editor extensions.
 /// </summary>
 protected override void OnHeaderGUI()
 {
     ExtensionsManager.DrawCustomEditorsBeforeHeaderGUI();
     if (NativeEditor != null)
     {
         NativeEditor.DrawHeader();
         if (ApplyHeaderOffset)
         {
             GUILayout.Space(MultipleEditorsUtility.COMMON_HEADER_OFFSET);
         }
     }
     ExtensionsManager.DrawCustomEditorsHeaderGUI();
 }
Exemplo n.º 10
0
 private static ExtendedRichDescription GetStatementDescription(ActionStatement statement)
 {
     try
     {
         var operationType = ExtensionsManager.TryGetOperation(statement.ActionName.Namespace, statement.ActionName.Name);
         return(Operation.GetDescription(operationType, statement));
     }
     catch
     {
         return(new ExtendedRichDescription(
                    new RichDescription(statement.ActionName.ToString())
                    ));
     }
 }
Exemplo n.º 11
0
        private ExtensionComponent GetFunction(RuntimeVariableName functionName)
        {
            if (functionName == null)
            {
                throw new ArgumentNullException(nameof(functionName));
            }

            var functionType = (from c in ExtensionsManager.GetComponentsByBaseClass <VariableFunction>()
                                let aliases = from a in c.ComponentType.GetCustomAttributes <ScriptAliasAttribute>()
                                              select a.Alias
                                              where aliases.Contains(functionName.Name, StringComparer.OrdinalIgnoreCase)
                                              select c).FirstOrDefault();

            return(functionType);
        }
        public GameControl(Game game)
            : base(game)
        {
            input = new InputProvider(game);
            particles = new ParticleProvider();
            Stars = new StarField(game, 2, 1, 0.5f);
            FrontPlotter = new PrimitiveDraw(game);
            BackPlotter = new PrimitiveDraw(game);

            Hud = new Hud(game);
            text = new TextInterface(game, new Vector2(1360, 730));

            extensions = new ExtensionsManager();
            
        }
        public override void OnInspectorGUI()
        {
            ExtensionsManager.DrawCustomEditorsBeforeInspectorGUI();
            if (NativeEditor != null)
            {
                NativeEditor.OnInspectorGUI();
            }

#if UNITY_2019_1_OR_NEWER
            ExtensionsManager.DrawCustomEditorsInspectorGUI();
#else
            EditorGUILayout.EndHorizontal();
            ExtensionsManager.DrawCustomEditorsInspectorGUI();
            //EditorGUILayout.EndVertical();
            EditorGUILayout.EndScrollView();
            EditorGUIUtility.ExitGUI();
#endif
        }
        protected override void OnHeaderGUI()
        {
#if UNITY_2019_1_OR_NEWER
#else
            if (target.IsAsset())
            {
                GUILayout.Space(ROOT_PREFAB_NOTE_OFFSET);
                GUIStyle header = new GUIStyle("AC BoldHeader");
                GUILayout.Box("", header, GUILayout.ExpandWidth(true));

                GUILayout.Space(ASSET_HEADER_CONTENT_OFFSET);
            }
#endif
            ExtensionsManager.DrawCustomEditorsBeforeHeaderGUI();
            NativeEditor.DrawHeader();
            GUILayout.Space(HEADER_CONTENT_OFFSET);
            ExtensionsManager.DrawCustomEditorsHeaderGUI();
        }
Exemplo n.º 15
0
        private void InitExtensions()
        {
            _extensionDownloadView         = new WebControl();
            _extensionDownloadView.WebView = new WebView();
            _extensionDownloadView.WebView.ShouldForceDownload += OnExtensionWebViewShouldForceDownload;
            _extensionDownloadView.WebView.BeforeDownload      += OnExtensionWebViewBeforeDownload;
            _extensionDownloadView.WebView.DownloadCompleted   += OnExtensionsWebViewDownloadCompleted;
            _extensionDownloadView.WebView.DownloadUpdated     += OnWebViewDownloadUpdated;
            _extensionDownloadView.WebView.DownloadCanceled    += OnWebViewDownloadCanceled;
            _extensionDownloadView.WebView.LoadFailed          += OnExtensionWebViewLoadFailed;
            Controls.Add(_extensionDownloadView);

            _extensionsManager = new ExtensionsManager(_startUrl);
            _webKit.WebView.RegisterJSExtensionFunction(ExtensionsManager.ActivateFunctionName, _extensionsManager.OnJavaScriptCall);
            _webKit.WebView.RegisterJSExtensionFunction(LinkOpenExtension.OpenLinkFunctionName, _extensionsManager.OnJavaScriptCall);

            InitSalesLibraryViewContentExtensions();
            InitSalesLibraryLinkOpenExtensions();
        }
Exemplo n.º 16
0
        private static void Validate(ActionStatement statement, ValidateStatementEventArgs e)
        {
            Type operationType;

            try
            {
                operationType = ExtensionsManager.TryGetOperation(statement.ActionName.Namespace, statement.ActionName.Name);
                if (operationType == null)
                {
                    e.AddError($"Unknown operation \"{statement.ActionName.FullName}\".");
                    return;
                }
            }
            catch (Exception ex)
            {
                e.AddError($"Unknowable operation \"{statement.ActionName.FullName}\": {ex.Message}.");
                return;
            }

            var defaultPropertyName = operationType.GetCustomAttribute <DefaultPropertyAttribute>()?.Name;

            var properties = from p in operationType.GetProperties()
                             where Attribute.IsDefined(p, typeof(RequiredAttribute)) && !Attribute.IsDefined(p, typeof(DefaultValueAttribute))
                             let aliases = p.GetCustomAttributes <ScriptAliasAttribute>().Select(a => a.Alias).ToList()
                                           where aliases.Count > 0
                                           select new
            {
                Property = p,
                Aliases  = aliases
            };

            foreach (var p in properties)
            {
                if (!p.Aliases.Any(a => statement.Arguments.ContainsKey(a)))
                {
                    if (p.Property.Name != defaultPropertyName || statement.PositionalArguments.Count == 0)
                    {
                        e.AddError($"Missing required \"{p.Aliases[0]}\" argument for \"{statement.ActionName.FullName}\" operation.");
                    }
                }
            }
        }
        public async Task InitializeAsync()
        {
            if (!string.IsNullOrEmpty(_functionsWorkerRuntime))
            {
                Environment.SetEnvironmentVariable(LanguageWorkerConstants.FunctionWorkerRuntimeSettingName, _functionsWorkerRuntime);
            }

            _copiedRootPath = Path.Combine(Path.GetTempPath(), "FunctionsE2E", DateTime.UtcNow.ToString("yyMMdd-HHmmss"));
            FileUtility.CopyDirectory(_rootPath, _copiedRootPath);

            // We can currently only support a single extension.
            if (_extensionName != null && _extensionVersion != null)
            {
                TestFunctionHost.WriteNugetPackageSources(_copiedRootPath, "http://www.myget.org/F/azure-appservice/api/v2", "https://api.nuget.org/v3/index.json");
                var options = new OptionsWrapper <ScriptJobHostOptions>(new ScriptJobHostOptions
                {
                    RootScriptPath = _copiedRootPath
                });

                var manager = new ExtensionsManager(options, NullLogger <ExtensionsManager> .Instance);
                await manager.AddExtensions(new[]
                {
                    new ExtensionPackageReference
                    {
                        Id      = _extensionName,
                        Version = _extensionVersion
                    }
                });
            }

            Host = new TestFunctionHost(_copiedRootPath, ConfigureJobHost);

            string connectionString            = Host.JobHostServices.GetService <IConfiguration>().GetWebJobsConnectionString(ConnectionStringNames.Storage);
            CloudStorageAccount storageAccount = CloudStorageAccount.Parse(connectionString);

            QueueClient = storageAccount.CreateCloudQueueClient();
            BlobClient  = storageAccount.CreateCloudBlobClient();
            TableClient = storageAccount.CreateCloudTableClient();

            await CreateTestStorageEntities();
        }
Exemplo n.º 18
0
        private async void App_Startup(object sender, StartupEventArgs e)
        {
            try
            {
                Parameters = e.Args;

                if (Current.Dispatcher != null)
                {
                    await Current.Dispatcher.BeginInvoke(DispatcherPriority.Background,
                                                         new Action(async() => await ExtensionsManager.LoadExtension()));
                }

                Mutex(Config.Informations.Extension.Name);

                await Task.Run(UpdateHelper.BackgroundProgrammUpdate);

                Window window = new MainWindow();
                window.Show();

                await Task.Run(() => UpdateHelper.Update(false));

                if (!string.IsNullOrEmpty(Config.ExtensionDirectoryName))
                {
                    await Task.Run(() => UpdateHelper.Update(true));
                }

                if (!string.IsNullOrEmpty(Config.ExtensionDirectoryName))
                {
                    SettingsHelper.CreateSettingsWatcher();
                }

                LogFile.DeleteOldLogFiles();
            }
            catch (Exception ex)
            {
                LogFile.WriteLog(ex);
                Current.Shutdown();
            }
        }
        private void OnSlideContentWebViewDownloadCompleted(object sender, DownloadEventArgs e)
        {
            if (!_extensionsManager.LinkViewContentExtension.ContentEnabled)
            {
                return;
            }
            switch (_afterDownloadAction)
            {
            case AfterDownloadAction.Print:
                ExtensionsManager.PrintFile(
                    e.Item.FullPath,
                    (_extensionsManager.LinkViewContentExtension.CurrentPrintableContent.CurrentPage + 1) ?? 1);
                break;

            default:
                _siteContainer.ParentBundle.ShowFloater(new FloaterRequestedEventArgs
                {
                    AfterShow = () =>
                    {
                        if (_extensionsManager.LinkViewContentExtension.CurrentLinkViewContent?.ContentType == LinkContentType.Video)
                        {
                            FormProgress.SetTitle("Chill-Out for a few seconds...\nGenerating slides so your presentation can look AWESOME!");
                            FormProgress.ShowOutputProgress();
                            _siteContainer.ParentBundle.PowerPointSingleton.InsertVideoIntoActivePresentation(e.Item.FullPath);
                            FormProgress.CloseProgress();
                        }
                        else if (_extensionsManager.LinkViewContentExtension.CurrentLinkViewContent?.ContentType == LinkContentType.PowerPoint)
                        {
                            FormProgress.SetTitle("Chill-Out for a few seconds...\nGenerating slides so your presentation can look AWESOME!");
                            FormProgress.ShowOutputProgress();
                            _siteContainer.ParentBundle.PowerPointSingleton.AppendSlidesFromFile(e.Item.FullPath);
                            FormProgress.CloseProgress();
                        }
                    }
                });
                break;
            }
        }
Exemplo n.º 20
0
        private App()
        {
            AppManager.Instance.Initialize(this);

            extensions = ExtensionsManager.LoadAllExtensions(System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location));
        }
Exemplo n.º 21
0
 void loadLayout()
 {
     ExtensionsManager.LoadAllExtensions(ViewerApplication.Extensions, onExtensionsLoadComplete, onExtensionsLoadFail);
 }
Exemplo n.º 22
0
        public async Task <ActionExecutionResult> ExecuteActionAsync(ActionStatement actionStatement, IExecuterContext context)
        {
            var metric = new OtterScriptOperationEventMetric(actionStatement.ActionName.FullName);

            try
            {
                var rompContext = ((RompExecutionContext)context.ExternalContext).WithExecuterContext(context);

                var operationType = ExtensionsManager.TryGetOperation(actionStatement.ActionName.Namespace, actionStatement.ActionName.Name);
                if (operationType == null)
                {
                    context.LogScope.Log(LogLevel.Error, $"Unable to resolve operation \"{actionStatement.ActionName}\". A Hedgehog extension may be missing.");
                    return(ExecutionStatus.Fault);
                }

                var operation = (Operation)Activator.CreateInstance(operationType);
                await ScriptPropertyMapper.SetPropertiesAsync(operation, actionStatement, rompContext, context);

                var loggedStatus = ExecutionStatus.Normal;
                var logScopeName = Operation.GetLogScopeName(operationType, actionStatement);
                var scopedLogger = new RompScopedLogger(this, context.LogScope.Current.Push(logScopeName), context.LogScope);
                scopedLogger.BeginScope();

                operation.MessageLogged +=
                    (s, e) =>
                {
                    if (e.Level >= MessageLevel.Warning && loggedStatus < ExecutionStatus.Error)
                    {
                        if (e.Level == MessageLevel.Error)
                        {
                            loggedStatus = ExecutionStatus.Error;
                        }
                        else if (e.Level == MessageLevel.Warning)
                        {
                            loggedStatus = ExecutionStatus.Warning;
                        }
                    }

                    scopedLogger.Log(e.Level, e.Message);
                };

                try
                {
                    var asyncOperation = operation as IExecutingOperation ?? throw new InvalidOperationException();

                    context.SetReportProgressDelegate(() => operation.GetProgress()?.StatementProgress ?? default);
                    await asyncOperation.ExecuteAsync(rompContext).ConfigureAwait(false);

                    ScriptPropertyMapper.ReadOutputs(operation, actionStatement.OutArguments, context);

                    return(loggedStatus);
                }
                catch (ExecutionFailureException ex)
                {
                    if (!string.IsNullOrEmpty(ex.Message))
                    {
                        operation.LogError(ex.Message);
                    }

                    throw new ExecutionFailureException(ex.Message);
                }
                catch (Exception ex)
                {
                    if (ex is OperationCanceledException)
                    {
                        operation.LogError("Operation canceled or timeout expired.");
                        return(ExecutionStatus.Fault);
                    }

                    metric.Error = ex;
                    operation.LogError("Unhandled exception: " + ex.ToString());
                    return(ExecutionStatus.Error);
                }
                finally
                {
                    scopedLogger.EndScope();
                }
            }
            finally
            {
                if (RompConfig.CeipEnabled)
                {
                    EventMetric.Write(metric);
                }
            }
        }
Exemplo n.º 23
0
 void Start()
 {
     geometry = ExtensionsManager.CreateGeometryObject(polygons.Length, ExtensionsUtils.GetTotalVerticesInPolygons(polygons));
     ExtensionsManager.AddPolygon(geometry, polygons);
 }
Exemplo n.º 24
0
        public async Task <IDirective> RenderVisualDocumentDirectiveAsync <T>(Properties <T> properties, IAlexaSession session) where T : class
        {
            var sourcesTemplate = new SourcesTemplate();

            //Button click effect
            sourcesTemplate.Add("buttonPressEffectApla", new Alexa.Presentation.APLA.Document()
            {
                mainTemplate = new MainTemplate()
                {
                    parameters = new List <string>()
                    {
                        "payload"
                    },
                    item = new Audio()
                    {
                        source = "soundbank://soundlibrary/camera/camera_15",
                        filter = new List <IFilter>()
                        {
                            new Volume()
                            {
                                amount = 0.2
                            }
                        }
                    }
                }
            });

            var dataSourceTemplate = new DataSourceTemplate();

            dataSourceTemplate.Add(properties);

            switch (properties?.documentType)
            {
            case RenderDocumentType.MEDIA_ITEM_DETAILS_TEMPLATE:
                dataSourceTemplate.Add(new TextToSpeechTransformer()
                {
                    inputPath  = "item.overview",
                    outputName = "readOverview"
                });
                dataSourceTemplate.Add(new AplaSpeechTransformer()
                {
                    template   = "buttonPressEffectApla",
                    outputName = "buttonPressEffect"
                });
                break;

            case RenderDocumentType.MEDIA_ITEM_LIST_SEQUENCE_TEMPLATE:
                dataSourceTemplate.Add(new AplaSpeechTransformer()
                {
                    template   = "buttonPressEffectApla",
                    outputName = "buttonPressEffect"
                });
                break;

            case RenderDocumentType.HELP_TEMPLATE:
                dataSourceTemplate.Add(new TextToSpeechTransformer()
                {
                    inputPath  = "values[*].value",
                    outputName = "helpPhrase"
                });
                break;

            case RenderDocumentType.GENERIC_VIEW_TEMPLATE:
                break;

            case RenderDocumentType.ROOM_SELECTION_TEMPLATE:
                break;

            default: return(null);
            }

            return(await Task.FromResult(new AplRenderDocumentDirective()
            {
                token = properties.documentType.ToString(),
                // ReSharper disable once RedundantNameQualifier
                document = new Alexa.Presentation.APL.Document()
                {
                    theme = "${payload.templateData.properties.theme}",
                    extensions = ExtensionsManager.RenderExtensionsList(session.context),
                    settings = SettingsManager.RenderSettings(session.context),
                    import = ImportsManager.RenderImportsList,
                    resources = ResourcesManager.RenderResourcesList,
                    graphics = VectorGraphicsManager.RenderVectorGraphicsDictionary,
                    commands = new Dictionary <string, ICommand>()
                    {
                        { nameof(Animations.ScaleInOutOnPress), await Animations.ScaleInOutOnPress() },
                        { nameof(Animations.FadeIn), await Animations.FadeIn() },
                        { "ShakesHead", new PlayNamedChoreo()
                          {
                              name = Choreo.MixedExpressiveShakes
                          } }
                    },
                    mainTemplate = new MainTemplate()
                    {
                        parameters = new List <string>()
                        {
                            "payload"
                        },
                        items = await Layouts.RenderLayoutComponents(properties, session)
                    }
                },
                datasources = new DataSource()
                {
                    templateData = await dataSourceTemplate.BuildTemplateData()
                },
                sources = await sourcesTemplate.BuildSources()
            }));
        }
Exemplo n.º 25
0
 public CoreManagement(log4net.ILog logger)
 {
     Logger = logger;
     InitializeEmbedded();
     ExtensionsManager.Load(PLUGIN_DIRECTORY, PLUGIN_FILTER);
 }
        public void Play(string audioFile)
        {
            if (String.IsNullOrEmpty(audioFile))
            {
                return;
            }

            if (TriggerOnce && hasTriggered)
            {
                return;
            }

            if (String.IsNullOrEmpty(Event))
            {
                return;
            }

            if (!eventDescription.isValid())
            {
                Lookup();
            }

            bool isOneshot = false;

            if (!Event.StartsWith("snapshot", StringComparison.CurrentCultureIgnoreCase))
            {
                eventDescription.isSnapshot(out isOneshot);
            }

            bool is3D = false;

            eventDescription.is3D(out is3D);

            if (!instance.isValid())
            {
                instance.clearHandle();
            }

            if (isOneshot && instance.isValid())
            {
                instance.release();
                instance.clearHandle();
            }

            if (!instance.isValid())
            {
                eventDescription.createInstance(out instance);

                if (is3D)
                {
                    var rigidBody   = GetComponent <Rigidbody>();
                    var rigidBody2D = GetComponent <Rigidbody2D>();
                    var transform   = GetComponent <Transform>();
                    if (rigidBody)
                    {
                        instance.set3DAttributes(RuntimeUtils.To3DAttributes(gameObject, rigidBody));
                        RuntimeManager.AttachInstanceToGameObject(instance, transform, rigidBody);
                    }
                    else
                    {
                        instance.set3DAttributes(RuntimeUtils.To3DAttributes(gameObject, rigidBody2D));
                        RuntimeManager.AttachInstanceToGameObject(instance, transform, rigidBody2D);
                    }
                }
            }

            foreach (var param in Params)
            {
                instance.setParameterValue(param.Name, param.Value);
            }

            if (is3D && OverrideAttenuation)
            {
                instance.setProperty(FMOD.Studio.EVENT_PROPERTY.MINIMUM_DISTANCE, OverrideMinDistance);
                instance.setProperty(FMOD.Studio.EVENT_PROPERTY.MAXIMUM_DISTANCE, OverrideMaxDistance);
            }
            ExtensionsManager.PlayProgrammerSound(audioFile, this.instance);

            hasTriggered = true;
        }
Exemplo n.º 27
0
 public void Dispose()
 {
     DeinitializeEmbedded();
     ExtensionsManager.Unload();
     ZipManager.Dispose();
 }