/// <summary> /// Check if app is valid and load. /// </summary> /// <param name="appId">Application ID</param> /// <param name="filePath">Path on file system.</param> private void LoadApp(long appId, string filePath) { FileInfo file = new FileInfo(Path.Combine(Local.Folder, filePath)); ModuleHeader moduleHeader = ModuleHeaderReader.AppHeader(Local.Folder, file.FullName); if (moduleHeader != null) { if (apps.ContainsKey(appId)) { ModuleInstance app = apps[appId]; app.Load(); currentApp = app; } else { ModuleInstance app = new ModuleInstance(file.FullName, "Module.App", new object[] { Frame, Networking, PlatformFunctions, Platform, UserGroups.ToArray() }); bool result = app.Load(); apps.Add(appId, app); currentApp = app; } CurrentlyRunningAppName = moduleHeader.Name; } }
public void PageTest() { ModuleInstance m; PageInstance pi; Package package; // // Setup the test. // package = new Package(); pi = new PageInstance(); package.Pages.Add(pi); m = new ModuleInstance(); pi.Modules.Add(m); // // Test automatically runs during verification. // // // Verify the test. // Assert.AreSame(pi, m.Page); }
static void Main() { ModuleInstance module = Marshal.GetHINSTANCE(typeof(Program).Module); WindowClass wndclass = new WindowClass { Style = ClassStyle.HorizontalRedraw | ClassStyle.VerticalRedraw, WindowProcedure = WindowProcedure, Instance = module, Icon = IconId.Application, Cursor = CursorId.Arrow, Background = StockBrush.White, ClassName = "SysMets3" }; Windows.RegisterClass(ref wndclass); WindowHandle window = Windows.CreateWindow( module, "SysMets3", "Get System Metrics No. 3", WindowStyles.OverlappedWindow | WindowStyles.VerticalScroll | WindowStyles.HorizontalScroll); window.ShowWindow(ShowWindow.Normal); window.UpdateWindow(); while (Windows.GetMessage(out MSG message)) { Windows.TranslateMessage(ref message); Windows.DispatchMessage(ref message); } }
/// <summary> /// Add a new module to the currently selected page. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnPagesAddModule_Click(object sender, EventArgs e) { TreeNode node; ModuleInstance module; PageInstance parentPage = SelectedPageInstance(); // // If there is no selected page, ignore this request. // if (parentPage == null) { return; } // // Create the new tree node and the module, then add the // module to the page. // node = new TreeNode(); module = new ModuleInstance(); parentPage.Modules.Add(module); // // Set some values and select the new node. // node.Text = module.ModuleTitle; node.Tag = module; tvPages.SelectedNode.Nodes.Insert(parentPage.Modules.Count - 1, node); tvPages.SelectedNode = node; }
public WindowClass(string registeredClassName) { _windowProcedure = WindowProcedure; _className = registeredClassName; _menuName = string.Empty; ModuleInstance = ModuleInstance.Null; }
private ShaderBytecode AssembleVertexShader(Module shaderLibrary, ModuleInstance shaderLibraryInstance) { var vertexShaderGraph = new FunctionLinkingGraph(); // create input node - parameter name, semantic and size in bytes var vertexShaderInputNode = vertexShaderGraph.SetInputSignature(CreateInParam("inputPos", "SV_POSITION", 4), CreateInParam("inputTex", "COLOR", 4)); // create the function call node var vertexFunctionCallNode = vertexShaderGraph.CallFunction(shaderLibrary, "VertexFunction"); // bind input parameters to the function call vertexShaderGraph.PassValue(vertexShaderInputNode, 0, vertexFunctionCallNode, 0); vertexShaderGraph.PassValue(vertexShaderInputNode, 1, vertexFunctionCallNode, 1); // create the output parameters node var vertexShaderOutputNode = vertexShaderGraph.SetOutputSignature(CreateOutParam("outputTex", "SV_POSITION", 4), CreateOutParam("outputNorm", "COLOR", 4)); // bind function call parameters to the output node vertexShaderGraph.PassValue(vertexFunctionCallNode, 0, vertexShaderOutputNode, 0); vertexShaderGraph.PassValue(vertexFunctionCallNode, 1, vertexShaderOutputNode, 1); // create the library instance for the shader var vertexShaderGraphInstance = vertexShaderGraph.CreateModuleInstance(); var linker = new Linker(); // bind linker to the function library linker.UseLibrary(shaderLibraryInstance); // link the shader return(linker.Link(vertexShaderGraphInstance, "main", "vs_5_0", 0)); }
public static WindowHandle CreateWindow( Atom className, string windowName, WindowStyles style, ExtendedWindowStyles extendedStyle, int x, int y, int width, int height, WindowHandle parentWindow, IntPtr menuHandle, ModuleInstance instance, IntPtr parameters) { WindowHandle window = Imports.CreateWindowExW( extendedStyle, className, windowName, style, x, y, width, height, parentWindow, menuHandle, instance ?? ModuleInstance.Null, parameters); if (window == WindowHandle.Null) { throw Errors.GetIoExceptionForLastError(); } return(window); }
/// <summary> /// A value is about to be displayed in the module instance settings /// datagrid, retrieve the appropriate value. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void dgModuleInstanceSettings_CellValueNeeded(object sender, DataGridViewCellValueEventArgs e) { ModuleInstance module = SelectedModuleInstance(); if (module == null || e.RowIndex == module.Settings.Count) { return; } if (e.ColumnIndex == 0) { e.Value = module.Settings[e.RowIndex].Name; } else if (e.ColumnIndex == 1) { e.Value = module.Settings[e.RowIndex].Type.ToString(); } else if (e.ColumnIndex == 2) { e.Value = module.Settings[e.RowIndex].Value; } else if (e.ColumnIndex == 3) { e.Value = module.Settings[e.RowIndex].Guid; } }
static void Main() { const string szAppName = "Environ"; ModuleInstance module = Marshal.GetHINSTANCE(typeof(Program).Module); WindowClass wndclass = new WindowClass { Style = ClassStyle.HorizontalRedraw | ClassStyle.VerticalRedraw, WindowProcedure = WindowProcedure, Instance = module, Icon = IconId.Application, Cursor = CursorId.Arrow, Background = StockBrush.White, ClassName = szAppName }; Windows.RegisterClass(ref wndclass); WindowHandle window = Windows.CreateWindow( module, szAppName, "Environment List Box", WindowStyles.OverlappedWindow); window.ShowWindow(ShowWindow.Normal); window.UpdateWindow(); while (Windows.GetMessage(out MSG message)) { Windows.TranslateMessage(ref message); Windows.DispatchMessage(ref message); } }
public void TemplateFrameOrderTest() { ModuleInstance m; PageInstance pi; Package package; // // Setup the test. // package = new Package(); pi = new PageInstance(); package.Pages.Add(pi); m = new ModuleInstance(); pi.Modules.Add(new ModuleInstance()); pi.Modules.Add(m); // // Test automatically runs during verification. // // // Verify the test. // Assert.AreEqual(1, m.TemplateFrameOrder); }
/// <summary> /// Runs the named macro. /// </summary> public void RunMacro(string s) { try { string sFile = GetMacroFile(); VM vm = new VM(); vm.InitializeVM(); vm.RegisterDotNetType(typeof(HeronEditor)); vm.RegisterDotNetType(typeof(CodeEditControl)); vm.RegisterDotNetType(typeof(Preferences)); //vm.RegisterAssembly(Assembly.GetExecutingAssembly()); vm.RegisterCommonWinFormTypes(); ModuleDefn m = vm.LoadModule(sFile); vm.LoadDependentModules(sFile); vm.ResolveTypes (); ModuleInstance mi = m.Instantiate(vm, new HeronValue[] { }, null) as ModuleInstance; vm.RunMeta(mi); HeronValue f = mi.GetFieldOrMethod("RunMacro"); if (f == null) { throw new Exception("Could not find a 'Main' method to run"); } f.Apply(vm, new HeronValue[] { DotNetObject.Marshal(this), DotNetObject.Marshal(s) }); } catch (Exception e) { MessageBox.Show("Error during macro: " + e.Message); } }
private async Task InitContextRoomAsync() { try { if (PageState.QueryString.ContainsKey("roomid")) { this.roomId = Int32.Parse(PageState.QueryString["roomid"]); ChatHubRoom room = await this.ChatHubService.GetChatHubRoomAsync(roomId, ModuleState.ModuleId); if (room != null) { this.title = room.Title; this.content = room.Content; this.type = room.Type; this.imageUrl = room.ImageUrl; this.createdby = room.CreatedBy; this.createdon = room.CreatedOn; this.modifiedby = room.ModifiedBy; this.modifiedon = room.ModifiedOn; } else { await logger.LogError("Error Loading Room {ChatHubRoomId} {Error}", roomId); ModuleInstance.AddModuleMessage("Error Loading ChatHub", MessageType.Error); } } } catch (Exception ex) { await logger.LogError(ex, "Error Loading Room {ChatHubRoomId} {Error}", roomId, ex.Message); ModuleInstance.AddModuleMessage("Error Loading Room", MessageType.Error); } }
public void BadPdb_DotInAlias() { var source = @" public class C { public static void Main() { } } "; var comp = CreateCompilation(source); var peImage = comp.EmitToArray(); var symReader = ExpressionCompilerTestHelpers.ConstructSymReaderWithImports( peImage, "Main", "USystem", // Valid. "AMy.Alias TSystem.Globalization.CultureInfo, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089", // Invalid - skipped. "ASI USystem.IO"); // Valid. var module = ModuleInstance.Create(peImage, symReader); var runtime = CreateRuntimeInstance(module, new[] { MscorlibRef }); var evalContext = CreateMethodContext(runtime, "C.Main"); var compContext = evalContext.CreateCompilationContext(); // Used to throw. var imports = compContext.NamespaceBinder.ImportChain.Single(); Assert.Equal("System", imports.Usings.Single().NamespaceOrType.ToTestDisplayString()); Assert.Equal("SI", imports.UsingAliases.Keys.Single()); Assert.Equal(0, imports.ExternAliases.Length); }
/// <summary> /// Unregisters the given class Atom. /// </summary> public static void UnregisterClass(Atom atom, ModuleInstance module) { if (!Imports.UnregisterClassW(atom, module ?? ModuleInstance.Null)) { throw Errors.GetIoExceptionForLastError(); } }
public void ModuleSettingsTest() { ModuleInstanceSetting s; ModuleInstance m; String settings; // // Setup the test. // m = new ModuleInstance(); s = new ModuleInstanceSetting("Setting1"); s.Value = "Value 1"; m.Settings.Add(s); m.Settings.Add(new ModuleInstanceSetting("Setting2")); s = new ModuleInstanceSetting("Setting3"); s.Value = "25"; m.Settings.Add(s); // // Run the test. // settings = m.ModuleSettings(); // // Verify the test. // Assert.AreEqual("Setting1=Value 1;Setting3=25", settings); }
public void Init(HttpApplication context) { var moduleInstance = new ModuleInstance(); context.AuthenticateRequest += moduleInstance.AuthenticateRequest; context.EndRequest += moduleInstance.EndRequest; }
// Start is called before the first frame update void Start() { // wasmファイルを読み込む string path = Application.streamingAssetsPath + "/something.wasm"; WasmFile file = WasmFile.ReadBinary(path); // importerを生成 var importer = new PredefinedImporter(); // 関数定義情報の注入 importer.DefineFunction( "GetParam", // 関数名 new DelegateFunctionDefinition( // 関数の定義 new WasmValueType[] { }, new[] { WasmValueType.Int32, }, GetParam ) ); // wasmをインスタンス化 ModuleInstance module = ModuleInstance.Instantiate(file, importer); // インスタンスから、定義済み関数の取得を試みる if (module.ExportedFunctions.TryGetValue("Something", out FunctionDefinition funcDef)) { // 関数が見つかったらそれを実行 IReadOnlyList <object> results = funcDef.Invoke(new object[] { 1, }); Debug.Log("定義があったよ==〜" + results[0]); } }
protected override async Task OnInitializedAsync() { try { this.BlazorColorPickerSelectionItems.Add(BlazorColorPickerType.HTML5ColorPicker.ToString()); this.BlazorColorPickerSelectionItems.Add(BlazorColorPickerType.CustomColorPicker.ToString()); this.BlazorColorPickerActiveType = BlazorColorPickerType.CustomColorPicker; this.SelectionItems.Add(ChatHubRoomType.Public.ToString()); this.SelectionItems.Add(ChatHubRoomType.Protected.ToString()); this.SelectionItems.Add(ChatHubRoomType.Private.ToString()); this.type = ChatHubRoomType.Public.ToString(); this.BlazorColorPickerService.OnBlazorColorPickerContextColorChangedEvent += OnBlazorColorPickerContextColorChangedExecute; this.ChatHubService.OnUpdateUI += (object sender, EventArgs e) => UpdateUIStateHasChanged(); await this.InitContextRoomAsync(); } catch (Exception ex) { await logger.LogError(ex, "Error Loading Room {ChatHubRoomId} {Error}", roomId, ex.Message); ModuleInstance.AddModuleMessage("Error Loading Room", MessageType.Error); } }
public async Task EnableArchiveRoom(ChatHubRoom room) { try { if (room.Status == ChatHubRoomStatus.Archived.ToString()) { room.Status = ChatHubRoomStatus.Enabled.ToString(); } else if (room.Status == ChatHubRoomStatus.Enabled.ToString()) { room.Status = ChatHubRoomStatus.Archived.ToString(); } await ChatHubService.UpdateChatHubRoomAsync(room); await logger.LogInformation("Room Archived {ChatHubRoom}", room); NavigationManager.NavigateTo(NavigateUrl()); } catch (Exception ex) { await logger.LogError(ex, "Error Archiving Room {ChatHubRoom} {Error}", room, ex.Message); ModuleInstance.AddModuleMessage("Error Archiving Room", MessageType.Error); } }
public void InsertItemTest() { ModuleInstanceCollection mic; ModuleInstance mi; Package package; // // Setup the test. // package = new Package(); mic = new ModuleInstanceCollection(package); mic.Add(new ModuleInstance()); mi = new ModuleInstance(); // // Run the test. // mic.Insert(0, mi); // // Verify the test. // Assert.AreSame(mi, mic[0]); }
public unsafe static WindowHandle CreateWindow( Atom classAtom, string windowName = null, WindowStyles style = WindowStyles.Overlapped, ExtendedWindowStyles extendedStyle = ExtendedWindowStyles.Default, Rectangle bounds = default, WindowHandle parentWindow = default, MenuHandle menuHandle = default, ModuleInstance instance = null, IntPtr parameters = default) { WindowHandle window = Imports.CreateWindowExW( extendedStyle, (char *)classAtom.ATOM, windowName, style, bounds.X, bounds.Y, bounds.Width, bounds.Height, parentWindow, menuHandle, instance ?? ModuleInstance.Null, parameters); if (window.IsInvalid) { throw Error.GetExceptionForLastError(); } return(window); }
public void SetPackageTest() { ModuleInstanceCollection mic; ModuleInstance mi; Package package; // // Setup the test. // package = new Package(); mic = new ModuleInstanceCollection(null); mi = new ModuleInstance(); mic.Add(mi); // // Run the test. // mic.Owner = package; // // Verify the test. // Assert.AreSame(package, mi.Package); }
public void RemoveItemTest() { ModuleInstanceCollection mic; ModuleInstance mi; Package package; // // Setup the test. // package = new Package(); mic = new ModuleInstanceCollection(package); mi = new ModuleInstance(); mic.Add(mi); // // Run the test. // mic.Remove(mi); // // Verify the test. // Assert.AreEqual(null, mi.Package); Assert.AreEqual(0, mic.Count); }
public void SetItemTest() { ModuleInstanceCollection mic; ModuleInstance mi1, mi2; Package package, package2; // // Setup the test. // package = new Package(); package2 = new Package(); mic = new ModuleInstanceCollection(package); mi1 = new ModuleInstance(); mi1.Package = package2; mi2 = new ModuleInstance(); mic.Add(mi1); // // Run the test. // mic[0] = mi2; // // Verify the test. // Assert.AreSame(mi2, mic[0]); Assert.AreEqual(1, mic.Count); Assert.AreEqual(null, mi1.Package); Assert.AreEqual(package, mi2.Package); }
private static object EvaluateConstExpr(WasmType resultType, string expr) { var asm = AssembleModule($"(module (memory 1) (global $five (mut i32) (i32.const 5)) (func $f (export \"f\") (result {DumpHelpers.WasmTypeToString(resultType)}) {expr}) (func $constant_five (result i32) i32.const 5))"); var instance = ModuleInstance.Instantiate(asm, new PredefinedImporter()); return(instance.ExportedFunctions["f"].Invoke(Array.Empty <object>())[0]); }
protected override async Task OnParametersSetAsync() { try { this.ChatHubService.ModuleId = ModuleState.ModuleId; this.settings = await this.SettingService.GetModuleSettingsAsync(ModuleState.ModuleId); maxUserNameCharacters = int.Parse(this.SettingService.GetSetting(settings, "MaxUserNameCharacters", "500")); if (PageState.QueryString.ContainsKey("moduleid") && PageState.QueryString.ContainsKey("roomid") && int.Parse(PageState.QueryString["moduleid"]) == ModuleState.ModuleId) { this.contextRoom = await this.ChatHubService.GetChatHubRoomAsync(int.Parse(PageState.QueryString["roomid"]), ModuleState.ModuleId); } else { await this.ChatHubService.GetLobbyRooms(ModuleState.ModuleId); } } catch (Exception ex) { await logger.LogError(ex, "Error Loading Rooms {Error}", ex.Message); ModuleInstance.AddModuleMessage("Error Loading Rooms", MessageType.Error); } await base.OnParametersSetAsync(); }
protected void btnVerify_Click(object sender, EventArgs e) { if (txtPasscode.Text == PasscodeSetting) { bool isNext = false; ModuleInstance protectedModule = null; foreach (ModuleInstance m in CurrentPortalPage.Modules) { if (isNext) { protectedModule = m; break; } else if (m.ModuleInstanceID == CurrentModule.ModuleInstanceID) { isNext = true; } } if (protectedModule != null) { phContent.Controls.Clear(); phContent.Controls.Add(new LiteralControl(Server.HtmlDecode(protectedModule.Details))); pnlPasscode.Visible = false; } } }
private static void Main() { const string szAppName = "OwnDraw"; ModuleInstance module = ModuleInstance.GetModuleForType(typeof(Program)); WindowClassInfo wndclass = new WindowClassInfo { Style = ClassStyle.HorizontalRedraw | ClassStyle.VerticalRedraw, WindowProcedure = WindowProcedure, Instance = module, Icon = IconId.Application, Cursor = CursorId.Arrow, Background = StockBrush.White, ClassName = szAppName }; Windows.RegisterClass(ref wndclass); WindowHandle window = Windows.CreateWindow( szAppName, "Owner-Draw Button Demo", WindowStyles.OverlappedWindow, bounds: Windows.DefaultBounds, instance: module); window.ShowWindow(ShowWindowCommand.Normal); window.UpdateWindow(); while (Windows.GetMessage(out WindowMessage message)) { Windows.TranslateMessage(ref message); Windows.DispatchMessage(ref message); } }
/// <summary> /// Send service command to active service. /// </summary> /// <param name="serviceId">The service identifier.</param> /// <param name="command">The command to send.</param> /// <returns>The result from the service.</returns> public string ExecuteServiceCommand(long serviceId, string command) { string commandResult = ""; if (services.ContainsKey(serviceId)) { ModuleInstance service = services[serviceId]; Module module = moduleRepository.Get(serviceId); if (module.type == (int)ModuleType.Service && module.enabled == 1) { commandResult = service.ExecuteServiceCommand(command); } else { commandResult = "Service is not enabled."; } } else { commandResult = "Service does not exist."; } return(commandResult); }
public ActionResult DeleteConfirmed(int id) { ModuleInstance moduleInstance = db.ModuleInstances.Find(id); db.ModuleInstances.Remove(moduleInstance); db.SaveChanges(); return(RedirectToAction("Index")); }
// For concerns and side-effects //[DebuggerStepThrough] ////[DebuggerHidden] public InjectionContext(ModuleInstance moduleInstance, object next, ProxyReferenceInvocationHandler proxyHandler) { this.CompositeInstance = null; this.ModuleInstance = moduleInstance; this.Uses = null; this.Next = next; this.State = null; this.ProxyHandler = proxyHandler; }
private ModuleInstance CreateInstanceInternal() { lock (instances) { bool commit = false; owner.ManagementConnectionProvider.BeginTransaction(); try { Module module = owner.ModuleStore.Add(null, assemblyInfo.AssemblyGuid, rxPrefixExtractor.Match(assemblyInfo.Assembly.GetName().Name).Value, assemblyInfo.Assembly.FullName); Debug.Assert(!module.SchemaExists); string moduleSchema = module.Schema; owner.CreateInstanceDatabaseSchema(assemblyInfo.Inventory, moduleSchema); owner.ModuleStore.Update(module.Id, assemblyInfo.Assembly.FullName, assemblyInfo.Inventory.GetInventoryHash(owner.ManagementConnectionProvider.Engine), assemblyInfo.Inventory.UpdateVersion); ModuleInstance instance = new ModuleInstance(this, module); instances.Add(moduleSchema, instance); LoadModules(true); commit = true; return instance; } finally { owner.ManagementConnectionProvider.EndTransaction(commit); } } }
//[DebuggerStepThrough] ////[DebuggerHidden] public ServiceInstance(ServiceModel compositeModel, ModuleInstance moduleInstance, object[] mixins) : base(compositeModel, moduleInstance, mixins, null) { }
public EntitiesInstance(EntitiesModel model, ModuleInstance instance) { }
public TransientsInstance(TransientsModel model, ModuleInstance instance) { }
internal RuntimeInstance CreateRuntimeInstance( ModuleInstance module, IEnumerable<MetadataReference> references) { var instance = RuntimeInstance.Create(module, references, DebugInformationFormat.Pdb); _runtimeInstances.Add(instance); return instance; }
public ValuesInstance(ValuesModel model, ModuleInstance instance) { }
public TransientInstance(AbstractCompositeModel compositeModel, ModuleInstance moduleInstance, object[] mixins, StateHolder state) : base(compositeModel, moduleInstance, mixins, state) { }
public ObjectsInstance(ObjectsModel model, ModuleInstance instance) { }