Here's an interesting tidbit that I just learned. I'm not sure why, but the installer (as it is now) will not update the Visual Studio Add-ins if they already exist.
I was certain that I had included them in the newest installer, but installing here at work gave me a copy of the add-ins from 1/15/08 (or so I thought). I deleted the SOS.VSA.dll file, re-ran the installer, chose "Repair", and the new version was right there.
I will need to investigate this further, but until then, you may need to do something similar if installing newer versions of the SOS.VSA. Sorry for the inconvenience, I will keep you updated.
Wednesday, January 30, 2008
Installer vs. SOS.VSA
Posted by
Lance "ji" May
at
1:38 PM
0
comments
Labels: Info
Wednesday, January 9, 2008
Arguments on antidepressants...
I was coming into a few problems with backslashes and quotes not playing consistently nice for snippet input. So I set out to find out why. I ran across a few interesting facts about command line arguments while trying to figure out the best (most reliable) way to escape them for snippet input. The following is an excerpt from tenouk.com...
- For information, Microsoft uses Microsoft C Runtime (CRT) for C codes; that is Microsoft C version (mix of standard C and Microsoft C).
- Microsoft C startup code uses the following rules when interpreting arguments given on the operating system command line:
- Arguments are delimited by white space, which is either a space or a tab.
- A string surrounded by double quotation marks is interpreted as a single argument, regardless of white space contained within. A quoted string can be embedded in an argument. Note that the caret (^) is not recognized as an escape character or delimiter.
- A double quotation mark preceded by a backslash, \", is interpreted as a literal double quotation mark (").
- Backslashes are interpreted literally, unless they immediately precede a double quotation mark.
- If an even number of backslashes is followed by a double quotation mark, then one backslash (\) is placed in the argv array for every pair of backslashes (\\), and the double quotation mark (") is interpreted as a string delimiter.
- If an odd number of backslashes is followed by a double quotation mark, then one backslash (\) is placed in the argv array for every pair of backslashes (\\) and the double quotation mark is interpreted as an escape sequence by the remaining backslash, causing a literal double quotation mark (") to be placed in argv.
This is quite interesting. I knew there must be a better way, however. Fortunately, I was correct. I found the following frustration post on the MSDN forums shortly after. Here's the juicy stuff...
The static System.Environment.CommandLine will provide the original untampered cmdline - should be straight forward to use this.
there is also System.Environment.GetCommandLineArgs() method but this is used to create the args parameter passed to main and suffers the same problem , I mention it because, when you use it the element 0 of the array contains the path to the excutable which you can use to strip the exe name from the System.Environment.CommandLine
Awesome! What this gives us is a good clean way to get all of our input directly from the command line call to the snippet. The biggest problem is that I (currently) can do nothing to eliminate this problem for you. I will however be trying to come up with a better answer than that. Until then, it's the snippet developer's job to be sure that the input being given to the snippet is clean. Here is a pretty decent GetInput() method that should do the trick. Oh, the code below also allows the snippet to be "piped"-to, so it really is a good idea to consider using it as your input standard. The key is making sure it's implemented. ;)
private static String GetInput()
{
System.IO.Stream stream = Console.OpenStandardInput();
System.IO.StreamReader reader =
new System.IO.StreamReader(stream);
String input = reader.ReadToEnd();
if (String.IsNullOrEmpty(input))
{
String application = Environment.GetCommandLineArgs()[0];
input = Environment.CommandLine
.Substring(
Environment.CommandLine.LastIndexOf(application)
+ application.Length + 2)
.Trim().Trim('\"');
}
return input;
}
Posted by
Lance "ji" May
at
8:06 PM
2
comments
Thursday, December 27, 2007
SOS.Tray v0.8
So here is the download link to the installer for the SOS.Tray application. It will also install a "My SOS" folder into your "My Documents". This is crucial.
The SOS application looks at directories under the "My SOS" folder as categories for snippets (e.g. "My Documents\My SOS\Development"). Under these categories, it looks for ".sos" files (the console applications).
The installer does not contain any snippets by default, but I have a few that I will be posting soon. They are simply ".zip" files that you will need to extract into a category prior to use.
After installing any new snippets (until I write a bit more code), you will need to restart the SOS.Tray application to see the menus and trees rebuild.
Here is the download link for the SOS application...
Click here to download Snippets on Steroids (S·O·S) v0.8
Posted by
Lance "ji" May
at
10:37 AM
0
comments