How to Make a Launcher

How to create a launcher project for ASP.Net MVC Project

For most projects, this is the wrong approach.

You should create a composition root near to the entry point of the application (in an MVC project that would be somewhere in the Application_Start event). It should not be moved into a library of its own because you are not going to reuse it anyway. The composition root is the application's configuration, so you wouldn't move it to a separate project any more than you would move the .config file to a separate project.

Also, unless you have specific requirements to late-bind DLLs to your AppDomain (for example, uploading a plugin and launching it without restarting the application), the type of architecture really doesn't matter as far as IoC is concerned. Architecture is a logical arrangement of layers, which may or may not result in a physical separation of layers. However, from the composition root's perspective, the application should be a flat set of DLL references that contain loosely-coupled components that are coupled together in the composition root (the only part of the application that should be tightly-coupled together).

Note this doesn't preclude you from using several classes to organize your DI registration in your composition root - it just means that you should keep that code in the main project, where it can be edited easily.

Finally, this question gets asked in one form or another quite often on StackOverflow. For those looking for a definitive answer about the benefits of using DI correctly and the drawbacks of using it incorrectly, I recommend reading the book Dependency Injection in .NET. Once you understand what DI is and how it should be used, the architecture part becomes much more clear.

Can anyone tell me how to create an stand alone SWF launcher that loads the SWF

Option 1: Use Web Browser component (a .NET Control). See page from manual. A good tutorial #1.

this.webBrowser1.Navigate("https://yoursite.com/YourFlashFile.swf");

You can set width and height to be 100% of the window size.

Option 2: Use Flash component (a COM object). A good tutorial #2.

Find and selectShockwave Flash Object in COM components. By default it's called axShockwaveFlash1.

this.axShockwaveFlash1.Movie = "https://yoursite.com/YourFlashFile.swf";

How would one create a custom JVM launcher?

How JavaFX Implements its Application Execution Model

JavaFX applications which contain no main method can be launched because of the implementation of JEP 153: Enhance the java command-line launcher to launch JavaFX applications.

This was modification of the openjdk launcher logic to check if the class to be launched extends Application, and, if so, call out to a JavaFX specific launcher which started up the Java runtime and associated threads, created a GUI window (in JavaFX terms a Stage), then, created an instance of the avaFX application and invoked init and start methods on the application as per the the JavaFX application lifecycle rules.

Tracing the implementation through in code:

  1. main.c for JVM invokes JLILaunch in java.c
  2. java.c looks for a Java class sun.launcher.LauncherHelper and calls into the java class using JNI, invoking the checkAndLoadMain function.
  3. If the class to be launched has no main method, but does extend the JavaFX application class, a FXHelper class is created holding the launch parameters.
  4. A reference to the FXHelper is returned to java.c via JNI.
  5. java.c invokes the main method on the FXHelper via JNI.
  6. The FXHelper uses reflection to invoke com.sun.javafx.application.LauncherImpl.launchApplication().
  7. The JavaFX LauncherImpl will setup the application classloader, then first try to invoke a main() method on the main class of the application.
  8. If there is no main() method, the JavaFX LauncherImpl will start up the JavaFX launcher thread.
  9. On the launcher thread, the LauncherImpl will call init() on the JavaFX application.
  10. On the JavaFX application thread, the LauncherImpl will create a new Stage (window) and pass it to the start method of the application.
  11. When the last stage is closed or the JavaFX platform is exited, the stop method on the application is called by the LauncherImpl.
  12. All the call traces return and the application exits because there is nothing more to do.

How you could customize the launcher

  1. Grab a copy of the sun.launcher.LauncherHelper code.
  2. Ignore the warning at the top of the code "This is NOT part of any API supported by Sun Microsystems. If you write code that depends on this, you do so at your own risk. This code and its internal interfaces are subject to change or deletion without notice." and start modifying the code anyway.
  3. Create your own version of the FXHelper which will invoke your own LauncherImpl rather than the JavaFX one (in the case that the target main application class extends your application framework class rather than the JavaFX one).
  4. Write your own LauncherImpl that sets up the classloader for your application, creates an instance of your application class and invokes whatever launch entry points you want on your application type.
  5. Run your applications, placing the hacked version of the sun.launcher.LauncherHelper and your LauncherImpl on the boot class path, so they get picked up instead of the default versions which ship the JDK.

Sample launch command, assuming the target application to be launched is com.mycompany.MyApplication:

java -Xbootclasspath/p <launcher class directory> com.mycompany.MyApplication

How do I create a launcher that updates my python game given a google drive url?

Nowadays many games do have some kind of a launcher.

I'd start with the following approach. We need URL:
- https://googledrive.com/version. Here you will store the latest version number and the difference in files which need to be updated and for previous updates. Like:

[{ 
"version": "1.21.1",
"files": [
"path":"game_file_1.data", "checksum": '1289f81',
"path":"game_file_2.data", "checksun": '321321'
]
},
{
"version": "1.21.0",
"files": [...],
}
...]
  1. Save version to one on the game files.
  2. Save the url of the server. When the launcher starts send the request to this url and in the response give back the version number and files for each 'patch'
  3. On the launcher side check whether the version number matches the one on the server. If it does not match download the file from the list. Before doing the actual download calculate checksum to make sure you won't download file twice if download process breaks.

How to create a launcher to group my Jumplists

It is not possible to implement such a feature in UWP apps. The Jumplist feature in UWP apps is used to provide quick access to recently or frequently-used documents.

Based on your requirements, I'd suggest you take a look at WinUI 3 app. WinUI3 app is a desktop C# .NET app with a WinUI-based user interface at the same time. You should still be able to use the same desktop API in the WinUI3 app and you could update your layout with a WinUI-based UI.



Related Topics



Leave a reply



Submit