c# program how to open file with double click - file-association

I have a C# program which works with files created by itself. The file can be opened by running the program and then accessing it via the GUI.
How can I open the file without having to run the program explicitly and just by double clicking on the concerned file?

You have to add registry entries in your installer to associate your program's file extension with your application.
Here is an article in MSDN that will tell you what you need to know about file associations: How File Associations Work

Typically you'd do this with your install, if you're not using an installer or ClickOnce, then you can do it from code, but you have to muck about in the registry: http://mel-green.com/2009/04/c-set-file-type-association/

You're asking how to associate a file type with your application. You can do this by adding entries to the registry using C#.

Related

'gitlab-runner' is not recognized as an internal or external command,

I'm using Windows 10 and installed gitlab-runner using the Gitlab's doc.
After a successful installation and registration, I try to leave the folderI used to install (C:\Gitlab-Runner in my instance) and try to run gitlab-runner. I get the response: 'gitlab-runner' is not recognized as an internal or external command, operable program or batch file.
I am able to run without issue in the C:\Gitlab-Runner folder, but nowhere else.
Based on the documentation and tutorials I looked at, I wouldn't expect this behavior; am I supposed to?
Did you check to ensure that it was added to The windows environment. You will likely need to update the path variable to include the path that you are using to run the command.
On windows, you add to the PATH variable with the following steps (yanked from google search page):
On the Windows taskbar, right-click the Windows icon and select System.
In the Settings window, under Related Settings, click Advanced system settings. ...
On the Advanced tab, click Environment Variables. ...
Click New to create a new environment variable.
Once you've added C:/Gitlab-runner/ to PATH, I believe you should be able to invoke with gitlab-runner.
The only thing I'll add is that, for setting PATH, the last step above is most likely unnecessary, as there will already be a variable named PATH with a list of directories stored in it. Just click EDIT and add your directory to the end of the list. Be sure to add the separator that is used for the others (I believe it's a semicolon on Windows...)
Solved. I need to call C:/Gitlab-runner/gitlab-runner rather than just gitlab-runner in other directories.
Please make sure the name of the exe is correct in the folder C:\GitLab-Runner
In my situation, I have the gilab-runner.exe.exe, there was an extra .exe in the file name though its not showing in the directory.
enter image description here

Texture Packer won't run

I downloaded texture packer here https://code.google.com/p/libgdx-texturepacker-gui/downloads/detail?name=gdx-texturepacker-3.2.0.zip&can=2&q=
When I run the .jar file it just shuts down before even displaying the gui. Is anyone experiencing a similar problem? I am running OSX El Capitan.
The project is quite old so you can try it's successor: gdx-texture-packer-gui.
[The] project is a successor of Aurelien Ribon's project with whole new
GUI and features.
You can download the tool here:
https://github.com/crashinvaders/gdx-texture-packer-gui/releases
Do you have the Java runtime environment installed on your computer or just the Java development kit? I don't use the texture packer, but I had a similar problem with the Android SDK manager (it shut down before displaying the GUI) on a new computer where I had only installed the Java JDK. After installing the JRE then it worked fine.
Try this: Create a txt file and change its extension to ".bat". Right click to file and select modify. Copy this into file:
"java -jar "C:\Users\fat2019\Desktop\gdx-texturepacker-3.2.0\gdx-texturepacker.jar" Change path to your own where gdx-texturepacker.jar file is. Then save and close. Double click file.
edit: this is for windows.
I have the same problem. Using Windows 7 I have to do this:
Go to your java directory and copy your java path
C:\Program Files\Java\jdk1.8.0_40\bin
Right click on my computer,
Click properties
Go to "Advanced system settings" click ,
Click on Environment variables.
Go to System variables section, and you will find an entry called path.
Double click on path
Add a semicolon (;) to the end of that line
After the semicolon paste your path previously copied: C:\Program Files\Java\jdk1.8.0_40\bin
Apply
It must be enough. Your file should run at this point.
Double click it and go to the end, put a semicolon and paste your path, apply and ok. It should run now.
For Mac I downloaded the free version of https://www.codeandweb.com/texturepacker/download
This saves as .txt rather than .atlas for some reason.
After adding the animation I got errors in batch.draw ... casting to TextureRegion fixed that.
As always, I have no idea if this will cause problems later but there you go. Looks good so far. :)

Using mergJSON in a LiveCode Standalone - no functionality?

I'm using the mergJSON external in LiveCode and all is working fine in the IDE but not in the standalone application.
I use LiveCode 6.0.1 Community Edition for Mac OSX 10.8.3 with mergJSON (https://github.com/montegoulding/mergJSON)
When I create a standalone application (Mac) the mergJSON functionality doesn't seem to exist any more. There are no errors messages, simply that nothing works.
I have a button that grabs a piece of JSON data, converts it into a LiveCode array and populates a DataGrid. This works fine in the IDE. It does nothing when I press it in the standalone application.
Stand alone generator settings
LiveCode > Standalone Settings > Select Inclusions
should make sure that for the standalone application the mergJSON script libraries are visible, which they are. Currently I'm using "Search for required inclusions when saving the standalone..." option the Standalone Settings.
Anyone have any suggestions?
Thanks,
Steve
Have you followed this tutorial on setting up the user extensions folder for a third party extension. Note that the standalone builder will show an external if it's in the Externals folder but look for it in the Runtime folder so you need to add it there too.
http://lessons.runrev.com/s/lessons/m/4071/l/6347-how-to-install-3rd-party-externals-for-use-in-the-ide-and-standalone-builder
Also note that there's no Universal or PowerPC build so you need to build your app for x86 only.

WINRT How to declare a file type association for a file without extension

How can i access a file "without" extension in metro application?
Normally you would need to declare the capabilities of the application incl. a declaration which filetype/extension you wanna access, if the file is located in the document library. The problem is the file i wanna access dont have an extension.
Im trying to access some files within a git directory.
Windows has always used the file extension for association with a program. A file without an extension cannot be associated with a program.

Writing/Reading User-Defined settings in app.config file

I am trying to read and write into app.config file of user-settings. I found a snippet of a code for working with confige file. I finally got it compiling and running, but it absolutely seems to be doing nothing to the App.config file.
Here is the code:
Method MainForm1.Button1.Click(sender: System.Object; e: System.EventArgs);
var
config : System.Configuration.Configuration;
begin
config:=ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
config.AppSettings.Settings.Add('PreferenceToRemember','value1');
config.Save(ConfigurationSaveMode.Modified);
ConfigurationManager.RefreshSection('appSettings');
end;
It is compiling without any errors, but I don't know if it is doing anything.
Is there anything wrong with the code? I need to be able to write/read a section and write/read a key/value. Thanks in advance.
UPDATE: Instead of using ConfigurationManager, I simply use Properties.Settings.Default. However, I am having bit of a problem writing into it and reading back from it, although program complies with without any errors and the code seems simple.
How do you read and write to Properties.Settings.Default from within your code?
Maybe you're looking at the wrong file?
The app.config you have in your solution will be copied to YourProgramFile.exe.config in the bin/Debug or bin/Release folder. When running your program it will update this file, not the app.config file in your solution.
Then perhaps you also should check write permissions on your application folder. Normally (Win Vista, Win 7) the User executing an application does not have write permissions in the Program Files folder where your application should reside, so updating the .config will most probably fail due to the lack of write permissions. This is even more true for Linux/Unix systems.
You should try to separate the elements you need to write and write an additional config file in a user-specific folder. You can take the defaults from the normal application config for that initially and just update the user-specific config file, this way you are not hindered by file permissions and every user can update their settings specifically.