Click here to Skip to main content
16,012,223 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have created a editor like application in c#.
so this application will create a project which will have some custom file types.
and i need to open this files in my editor application.
but i am able to get the executable file path but facing problem while getting the custom file path, and how i get my custom file path while loading the file to editor
Posted
Comments
DamithSL 4-Nov-14 3:48am    
which custom file paths? can you elaborate more?
Richard MacCutchan 4-Nov-14 3:51am    
There is no such thing as a custom file path, there are only file paths. It looks like your code is wrong, but since we cannot see it it is difficult to suggest anything.

1.Your "project file" should be a text file, recommended to be an XML, that will contains inside the details about all custom files used in your project.

2.All custom files that belong to the project should be by stored into the same folder (project folder).

3.When you will open an "project file" you should use the system OpenFileDialog class.[^]. Then by using the property FileDialog.FileName you will find the file full name, including its path and you will can use it to access the other "custom files".
 
Share this answer
 
Hello,

I am not sure if I understand what You mean, but i assume You have created the application. You have some files which are associated with your application. When you double click on the file, your custom editor starts, but you don't know how to get the file that was double clicked. Am I right? If so, then look below.

Double clicked file path is beeing sent to the application via the startup arguments.
So if You have custom editor for exapmle C:\editor.exe and custom file in example C:\file.cus the parameters to the application will look like below:
C:\editor.exe C:\file.cus

As You see, the file path is sent as first argument. The code below will show You the details, if You associate the file with this application. It just simply prits the number of arguments sent to the program and each of the arguments below.

C#
class Program
{
    static void Main(string[] args)
    {
        Console.WriteLine(String.Format("Args.Length: {0}", args.Length));
            
        foreach (String s in args)
            Console.WriteLine(s);

        Console.ReadKey();
    }
}


Hope it helps.

Greetings,
BJ
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900