- Mar 8, 2003
- 38,416
- 4
- 0
(I am using Visual Studio 2005 and I basically copy / pasted this from an email I sent one of my professors, so I might have references to his class in there)
I have decided to start learning C# (I am best at VB.NET, although I have only been programming for a little under a year now, so I am still very novice). The way that I learn best is by a pet project. When I wanted to learn VB.NET better, I started working on a "bolt on" application that provides a GUI and extends the features of the sourceforge project StreamRipper, the result of my VB.NET learning experience can bee seen here:
http://streamripper.sourceforg...2/viewtopic.php?t=2683
I am currently "porting" it to C# in order to learn the language. But, I was hoping that you could help me solve a problem that has lingered in my VB.NET program and thus in my new C# port.
The problem lies after I read-in SRGUI.NET associated PLS files that are opened after downloading them from shoutcast.com.
It currently "processes" the information in the .pls files by using a background worker that monitors a predetermined folder that users download these files to. The background worker detects the new file and once it is downloaded, SRGUI.NET processes it, then sends the info from it to the proper functions and then it deletes the file. The problem with this method is obvious in that one has an extra background worker and it adds extra effort to the user who has to download the file to a predetermined folder in order to have it analyzed. It would be much easier for the user to just "open with SRGUI.NET" when they download the file.
Associating the file with my program is not a problem, I have also discovered how to properly read in this file if the program is not running already. The problem arises when the program is already running. I rigged the VB.NET program's 2nd instance to copy the pls file over to the folder being monitored (basically producing the same result as the user downloading it to that folder), but that never did work correctly.
In my C# port, I am planning on having the program associated with the file and use a better method than stated above to analyze the new files that are opened with my program. In the C# port, I have already figured out how to determine if an instance is already running and act accordingly and how to analyze a file if the program is not running yet. Currently, I am reading in the file into a System.IO.StreamReader within the 2nd instance and then saving it to a string variable, but I do not know how to send this information between the two instances of the same program. I would prefer not to use the method described above in the VB.NET program for this C# program.
(By the way, the code that I am using currently in C# is based on this guy's post, but I added code to determine if the program is already running or not, see my attached code below):
http://www.csharpfriends.com/F...Post.aspx?PostID=32627
Cliff Notes:
I have decided to start learning C# (I am best at VB.NET, although I have only been programming for a little under a year now, so I am still very novice). The way that I learn best is by a pet project. When I wanted to learn VB.NET better, I started working on a "bolt on" application that provides a GUI and extends the features of the sourceforge project StreamRipper, the result of my VB.NET learning experience can bee seen here:
http://streamripper.sourceforg...2/viewtopic.php?t=2683
I am currently "porting" it to C# in order to learn the language. But, I was hoping that you could help me solve a problem that has lingered in my VB.NET program and thus in my new C# port.
The problem lies after I read-in SRGUI.NET associated PLS files that are opened after downloading them from shoutcast.com.
It currently "processes" the information in the .pls files by using a background worker that monitors a predetermined folder that users download these files to. The background worker detects the new file and once it is downloaded, SRGUI.NET processes it, then sends the info from it to the proper functions and then it deletes the file. The problem with this method is obvious in that one has an extra background worker and it adds extra effort to the user who has to download the file to a predetermined folder in order to have it analyzed. It would be much easier for the user to just "open with SRGUI.NET" when they download the file.
Associating the file with my program is not a problem, I have also discovered how to properly read in this file if the program is not running already. The problem arises when the program is already running. I rigged the VB.NET program's 2nd instance to copy the pls file over to the folder being monitored (basically producing the same result as the user downloading it to that folder), but that never did work correctly.
In my C# port, I am planning on having the program associated with the file and use a better method than stated above to analyze the new files that are opened with my program. In the C# port, I have already figured out how to determine if an instance is already running and act accordingly and how to analyze a file if the program is not running yet. Currently, I am reading in the file into a System.IO.StreamReader within the 2nd instance and then saving it to a string variable, but I do not know how to send this information between the two instances of the same program. I would prefer not to use the method described above in the VB.NET program for this C# program.
(By the way, the code that I am using currently in C# is based on this guy's post, but I added code to determine if the program is already running or not, see my attached code below):
http://www.csharpfriends.com/F...Post.aspx?PostID=32627
Cliff Notes:
- Can you think of any way that I could go about sending a string variable between two different running instances of the same program and then triggering an event to send the newly arrived string to a function in the original program instance in C#?