<?xml version="1.0"?><?xml-stylesheet type="text/xsl" href="/rss.xsl"?><rss version="2.0"><channel><title>bcl Discussions Rss Feed</title><link>http://bcl.codeplex.com/Thread/List.aspx</link><description>bcl Discussions Rss Description</description><item><title>New Post: BigRational ToDecimalString(int digits),Parse and TryParse</title><link>http://bcl.codeplex.com/discussions/443201</link><description>&lt;div style="line-height: normal;"&gt;I'd like to see the addition of NaN, PositiveInfinity and NegativeInfinity as per double.&lt;br /&gt;
Also the functions Parse and TryParse&lt;br /&gt;
&lt;br /&gt;
I use BigRational to create c++ defines for quad precision floating point number constants so please add a ToDecimalString(int digits)&lt;br /&gt;
e.g. something like below&lt;br /&gt;
public string ToDecimalString(int digits)&lt;br /&gt;
{&lt;br /&gt;
&lt;pre&gt;&lt;code&gt;       string bigTenS = &amp;quot;1&amp;quot;.PadRight(digits + 1, '0');
        BigInteger bigTen = BigInteger.Parse(bigTenS);
        BigInteger num = BigInteger.Divide(BigInteger.Multiply(this.Numerator, bigTen), this.Denominator);
        var sign = string.Empty;
        if (num &amp;lt; 0)
        {
            sign = &amp;quot;-&amp;quot;;
            num = -num;
        }

        var numString = num.ToString();
        numString = numString.PadLeft(digits, '0');
        numString = numString.Substring(0, numString.Length - digits) + &amp;quot;.&amp;quot; + numString.Substring(numString.Length - digits, digits);
        if (numString.StartsWith(&amp;quot;.&amp;quot;))
        {
            numString = &amp;quot;0&amp;quot; + numString;
        }
        return sign + numString;&lt;/code&gt;&lt;/pre&gt;

}&lt;br /&gt;
&lt;/div&gt;</description><author>moozoo</author><pubDate>Fri, 10 May 2013 04:34:42 GMT</pubDate><guid isPermaLink="false">New Post: BigRational ToDecimalString(int digits),Parse and TryParse 20130510043442A</guid></item><item><title>New Post: Timestamp skew in TraceEvent?</title><link>http://bcl.codeplex.com/discussions/439571</link><description>&lt;div style="line-height: normal;"&gt;I will be updating the source but exactly when I don't exactly know at the moment.    I will see what I can do, but no promises&lt;br /&gt;
&lt;br /&gt;
In the mean time you can apply the fix without too much grief.   The basic problem is that TraceEvent uses the QueryPerformanceCounter (QPC) counter in the events.  This has to be converted to normal DateTIme 100ns ticks (QPCTimeToFileTime).  To do this properly, you need a time where you know the QPC tick number and the corresponding DateTime tick.    I was assuming that the session start time and the first event timestamp were the same (they are for files), but that does not work for real-time providers. &lt;br /&gt;
&lt;br /&gt;
The fix is in the 'ETWTraceEventSource constructor.  There is already a call to DateTime.Now to get the FileTime, you aslo need to call Stopwatch.GetTImesamp() to get the QPC time right after this.   Then set the 'sessionStartTimeQPC' variable to that timestamp if a real time session is being opened (if you leave it 0, it will be set on the first event). &lt;br /&gt;
&lt;br /&gt;
TDHDynamicTraceEventParser has been renamed to RegisteredTraceEventParser.  However if you apply the fix yourself, you won't care (for now).&lt;br /&gt;
&lt;/div&gt;</description><author>vancem</author><pubDate>Tue, 16 Apr 2013 17:23:54 GMT</pubDate><guid isPermaLink="false">New Post: Timestamp skew in TraceEvent? 20130416052354P</guid></item><item><title>New Post: Timestamp skew in TraceEvent?</title><link>http://bcl.codeplex.com/discussions/439571</link><description>&lt;div style="line-height: normal;"&gt;Looks resolved, I am not seeing any more inconsistencies with the system clock. Thanks!  A couple of follow up questions:&lt;br /&gt;
&lt;br /&gt;
1.) Will you be making the source available for this sometime soon?  (i'd like to implement pruning of the fileIDToName table, it can grow large in a long running real-time scenario like mine)&lt;br /&gt;
2.) Looks like TDHDynamicTraceEventParser was removed in this version? I was using that to parse non-kernel events, what should I now be using instead?&lt;br /&gt;
&lt;br /&gt;
Thanks again&lt;br /&gt;
&lt;/div&gt;</description><author>morecoffee</author><pubDate>Mon, 15 Apr 2013 18:52:27 GMT</pubDate><guid isPermaLink="false">New Post: Timestamp skew in TraceEvent? 20130415065227P</guid></item><item><title>New Post: Timestamp skew in TraceEvent?</title><link>http://bcl.codeplex.com/discussions/439571</link><description>&lt;div style="line-height: normal;"&gt;This is likely a bug in TraceEvent.   I have a fix, but I have not tested it.    You can get the new TraceEvent.dll from &lt;a href="http://sdrv.ms/12Ub95y" rel="nofollow"&gt;http://sdrv.ms/12Ub95y&lt;/a&gt; to try it out&lt;br /&gt;
&lt;/div&gt;</description><author>vancem</author><pubDate>Fri, 12 Apr 2013 15:45:48 GMT</pubDate><guid isPermaLink="false">New Post: Timestamp skew in TraceEvent? 20130412034548P</guid></item><item><title>New Post: Timestamp skew in TraceEvent?</title><link>http://bcl.codeplex.com/discussions/439571</link><description>&lt;div style="line-height: normal;"&gt;I’m using the 1.2.7.1 version of TraceEvent in a real-time consumer project.  In my event handling code, I attempt to use the TimeStamp property of the received event object (for example: FileIoReadWriteTraceData) as the DateTime that the event occurred.  However, I sometimes get events with TimeStamp values many seconds ahead of the system clock.  It happens enough that I’ve gone to substituting receive time as event time in my project, but that has obvious drawbacks. I’d love to figure out what I’m doing wrong.   Has anyone seen this?  Is there some trick to getting event time from TraceEvent?&lt;br /&gt;
&lt;br /&gt;
Many thanks.&lt;br /&gt;
&lt;/div&gt;</description><author>morecoffee</author><pubDate>Mon, 08 Apr 2013 23:33:00 GMT</pubDate><guid isPermaLink="false">New Post: Timestamp skew in TraceEvent? 20130408113300P</guid></item><item><title>New Post: Capturing existing providers events</title><link>http://bcl.codeplex.com/discussions/434558</link><description>&lt;div style="line-height: normal;"&gt;Hi,&lt;br /&gt;
  I took the MySimpleMonitor and tried to replace the &lt;strong&gt;Microsoft-Demos-SimpleMonitor&lt;/strong&gt; with &lt;strong&gt;Microsoft-IEFRAME&lt;/strong&gt; .&lt;br /&gt;
&lt;ol&gt;
&lt;li&gt;The TraceEventSession.GetEventSourceGuidFromName(providerName) seems to return the wrong GUID (54368bef-c883-53bf-51c4-e4fa07de5e50).&lt;/li&gt;
&lt;li&gt;I tried to bypass this by placing the correct GUID (5C8BB950-959E-4309-8908-67961A1205D5) in call to session.EnableProvider.&lt;/li&gt;
&lt;li&gt;
With any of the GUIDs (returned or hardcoded) , I played with IE and I got no events.&lt;br /&gt;
&lt;/li&gt;
&lt;/ol&gt;
Am I doing anything wrong?&lt;br /&gt;
&lt;br /&gt;
Thanks,&lt;br /&gt;
  Doron&lt;br /&gt;
&lt;/div&gt;</description><author>doronlevi</author><pubDate>Tue, 26 Feb 2013 15:42:14 GMT</pubDate><guid isPermaLink="false">New Post: Capturing existing providers events 20130226034214P</guid></item><item><title>New Post: Bug Fixes in PerfMonitor V2.01 and TraceEvent 1.2.7.1</title><link>http://bcl.codeplex.com/discussions/429029</link><description>&lt;div style="line-height: normal;"&gt;
&lt;p&gt;There was a bug in TraceEvent 1.2.7 that caused the TraceLog class to fail when reading the ETLX file.&amp;nbsp;&amp;nbsp; This has been fixed in 1.2.7.1&lt;/p&gt;
&lt;p&gt;There were bugs in PerfMonitor V2.0 that caused an exception the very first time it was launched (would go away thereafter) and the 'Analyze' and 'runAnalyze' command would&amp;nbsp; not work.&amp;nbsp;&amp;nbsp;&amp;nbsp; This has been fixed in V2.01&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;/div&gt;</description><author>VanceMorrison</author><pubDate>Wed, 09 Jan 2013 16:00:34 GMT</pubDate><guid isPermaLink="false">New Post: Bug Fixes in PerfMonitor V2.01 and TraceEvent 1.2.7.1 20130109040034P</guid></item><item><title>New Post: Confusion about BigRational and Double</title><link>http://bcl.codeplex.com/discussions/217082</link><description>&lt;div style="line-height: normal;"&gt;
&lt;p&gt;Note... as of today this fix has still not made it into the BigRational class.&lt;/p&gt;
&lt;/div&gt;</description><author>TomSpilman</author><pubDate>Sat, 22 Dec 2012 01:55:57 GMT</pubDate><guid isPermaLink="false">New Post: Confusion about BigRational and Double 20121222015557A</guid></item><item><title>New Post: Problem getting payload from ETW event</title><link>http://bcl.codeplex.com/discussions/406425</link><description>&lt;div style="line-height: normal;"&gt;
&lt;p&gt;Thanks, very helpful.&lt;/p&gt;
&lt;p&gt;Paul&lt;/p&gt;
&lt;/div&gt;</description><author>paulspiteri</author><pubDate>Tue, 18 Dec 2012 16:52:00 GMT</pubDate><guid isPermaLink="false">New Post: Problem getting payload from ETW event 20121218045200P</guid></item><item><title>New Post: Problem getting payload from ETW event</title><link>http://bcl.codeplex.com/discussions/406425</link><description>&lt;div style="line-height: normal;"&gt;
&lt;p&gt;First, confirm that everything is OK with your generation of events by looking at the events in PerfView's Events view as described in
&lt;a href="http://blogs.msdn.com/b/vancem/archive/2012/07/09/logging-your-own-etw-events-in-c-system-diagnostics-tracing-eventsource.aspx"&gt;
this blog entry&lt;/a&gt;.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Because there are a potentially unbounded number of events that need to be parsed, an important design point for the TraceEvent library is that the TraceEventSource does NOT know how to parse event payloads.&amp;nbsp; Instead you have to attach one or more parsers
 to it.&amp;nbsp; Each parser knows how to parse particular events that that parser knows about.&amp;nbsp;&amp;nbsp;&amp;nbsp; In the case of EventSources, the 'DynamicTraceEventParser' knows how to decode EventSource data.&amp;nbsp;&amp;nbsp; You do this by doing&lt;/p&gt;
&lt;pre&gt;            var source = new EtwTraceEventSource(&amp;quot;myETLFile&amp;quot;);&lt;/pre&gt;
&lt;pre&gt;	   var parser = new DynamicTraceEventParser(source)&lt;/pre&gt;
&lt;pre&gt;	   parser.All += delegate(TraceEvent data) { Console.WriteLine(data); }&lt;/pre&gt;
&lt;p&gt;If you use the TraceLog class, has built in knowledge of many common parsers, including the Kernel, CLR and Dynamic (EventSource) parsers.&amp;nbsp;&amp;nbsp; Thus if you use that class to open ETL files, it will 'just work'.&amp;nbsp;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;The PerfMonitor project has examples of doing things like this (see the 'Listen' command).&amp;nbsp;&amp;nbsp;&lt;/p&gt;
&lt;div id="_mcePaste" style="overflow:hidden; height:1px; left:-10000px; top:0px; width:1px"&gt;
&amp;#65279;&lt;/div&gt;
&lt;/div&gt;</description><author>vancem</author><pubDate>Wed, 12 Dec 2012 15:46:47 GMT</pubDate><guid isPermaLink="false">New Post: Problem getting payload from ETW event 20121212034647P</guid></item><item><title>New Post: Problem getting payload from ETW event</title><link>http://bcl.codeplex.com/discussions/406425</link><description>&lt;div style="line-height: normal;"&gt;
&lt;p&gt;Hi&lt;/p&gt;
&lt;p&gt;I need some guidance on getting the args from an event written using EventSource.WriteEvent(int eventId, params object[] args)&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;On the consumer side (this is in real-time) I'm getting the TraceEvent object from the&amp;nbsp;ETWTraceEventSource.EveryEvent event, but this object doesn't seem to have the params array that was passed as the arguments. I've tried calling PayloadString(0)
 or PayloadValue(0) but no luck - returns null.&lt;/p&gt;
&lt;p&gt;Any help would be much appreciated. Thanks!&lt;/p&gt;
&lt;p&gt;Paul&lt;/p&gt;
&lt;/div&gt;</description><author>paulspiteri</author><pubDate>Tue, 11 Dec 2012 17:33:52 GMT</pubDate><guid isPermaLink="false">New Post: Problem getting payload from ETW event 20121211053352P</guid></item><item><title>New Post: etw trace event message</title><link>http://bcl.codeplex.com/discussions/405428</link><description>&lt;div style="line-height: normal;"&gt;
&lt;p&gt;What ETW processing DLL are you using?&amp;nbsp;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;/div&gt;</description><author>vancem</author><pubDate>Wed, 05 Dec 2012 19:29:21 GMT</pubDate><guid isPermaLink="false">New Post: etw trace event message 20121205072921P</guid></item><item><title>New Post: etw trace event message</title><link>http://bcl.codeplex.com/discussions/405428</link><description>&lt;div style="line-height: normal;"&gt;
&lt;p&gt;The scenario is simply setup a waiter for power transition event (I have the providerID and eventID). And when it occurs, capture it in real time and deliver the result (the value of event message) to another application.&lt;/p&gt;
&lt;p&gt;I talked to another guy yesterday. It seems like it is a bug for now that ETW processing dll I am using does not support filling in these payload properties in the event message, and therefore I see something like&amp;nbsp;&lt;span&gt;&amp;ldquo;Miniport %4 %1, had event
 %5&amp;rdquo;.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;/div&gt;</description><author>bobtail0925</author><pubDate>Tue, 04 Dec 2012 17:59:30 GMT</pubDate><guid isPermaLink="false">New Post: etw trace event message 20121204055930P</guid></item><item><title>New Post: etw trace event message</title><link>http://bcl.codeplex.com/discussions/405428</link><description>&lt;div style="line-height: normal;"&gt;
&lt;p&gt;What API set are you referring to?&amp;nbsp;&amp;nbsp;&amp;nbsp; I would have expected your question to be about the TraceEvent library, but it does not have any APIs like 'GetPayloadProperty.&lt;/p&gt;
&lt;p&gt;For what it is worth, TraceEvent DOES have the ability to do what you want, but depending on details of your scenario the details of how to do it change.&amp;nbsp;&amp;nbsp; Can you describe your scenario a bit more?&lt;/p&gt;
&lt;/div&gt;</description><author>vancem</author><pubDate>Tue, 04 Dec 2012 14:59:23 GMT</pubDate><guid isPermaLink="false">New Post: etw trace event message 20121204025923P</guid></item><item><title>New Post: etw trace event message</title><link>http://bcl.codeplex.com/discussions/405428</link><description>&lt;div style="line-height: normal;"&gt;
&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Does&amp;nbsp;anyone have any idea how to print out the event message in managed code?&amp;nbsp;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;PrintProperties() doesn’t have it. GetPayloadProperty(&amp;quot;EventMessage&amp;quot;) returns null. Simply printout the etwEvent.EventMessage gives something like “Miniport %4 %1, had event %5”, and cannot interpret the values in it.&lt;/p&gt;
&lt;p&gt;Thanks!&lt;/p&gt;
&lt;/div&gt;</description><author>bobtail0925</author><pubDate>Mon, 03 Dec 2012 20:32:15 GMT</pubDate><guid isPermaLink="false">New Post: etw trace event message 20121203083215P</guid></item><item><title>New Post: BigFloat needed</title><link>http://bcl.codeplex.com/discussions/401443</link><description>&lt;div style="line-height: normal;"&gt;
&lt;p&gt;Is there a BigFloat class coming? We need a way to have arbitrary precision calculations on numeric values that are not just whole numbers.&lt;/p&gt;
&lt;p&gt;And a math library that supports it.&lt;/p&gt;
&lt;p&gt;In laymen's terms, we need a way to make calculations in .Net that have the same outcomes as the windows calculator. Right now this is not possible and is very painful.&lt;/p&gt;
&lt;p&gt;&lt;br&gt;
Decimal is not an option as the math library does not fully support the decimal type.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Maybe there is something out there, but I haven't found a mature, well tested framework that does this. &amp;nbsp;I see them in other languages, but not in .Net.&lt;/p&gt;
&lt;/div&gt;</description><author>iperez</author><pubDate>Wed, 31 Oct 2012 15:58:05 GMT</pubDate><guid isPermaLink="false">New Post: BigFloat needed 20121031035805P</guid></item><item><title>New Post: Create a directory as Directory.CreateDirectory does.</title><link>http://bcl.codeplex.com/discussions/396028</link><description>&lt;div style="line-height: normal;"&gt;&lt;p&gt;Thank you for providing the free library but after spending a few hours with it, I found it is missing too many methods. After implementing some of the methods by myself, again and again I encountered with another barriers. I took a look at AlphaFS, and it seems it has almost everything I need. I will switch to that library.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;By the way, here is the method I have implemented. Might be useful to someone...&lt;/p&gt;
&lt;p&gt;&amp;nbsp;====== In the NativeMethods==============&lt;/p&gt;
&lt;pre&gt;&lt;div style="color: black; background-color: white;"&gt;&lt;pre&gt;        [DllImport(&lt;span style="color: #a31515;"&gt;"kernel32.dll"&lt;/span&gt;,SetLastError = &lt;span style="color: blue;"&gt;true&lt;/span&gt;,  CharSet = CharSet.Unicode)]
        &lt;span style="color: blue;"&gt;public&lt;/span&gt; &lt;span style="color: blue;"&gt;static&lt;/span&gt; &lt;span style="color: blue;"&gt;extern&lt;/span&gt; &lt;span style="color: blue;"&gt;int&lt;/span&gt; GetLongPathName(&lt;span style="color: blue;"&gt;string&lt;/span&gt; path, StringBuilder longPath,
            &lt;span style="color: blue;"&gt;int&lt;/span&gt; longPathLength);&lt;/pre&gt;
&lt;pre&gt;===========================&lt;/pre&gt;
&lt;pre&gt;&lt;div style="color: black; background-color: white;"&gt;&lt;pre&gt;&lt;span style="color: blue;"&gt;using&lt;/span&gt; System;
&lt;span style="color: blue;"&gt;using&lt;/span&gt; System.Collections.Generic;
&lt;span style="color: blue;"&gt;using&lt;/span&gt; System.IO;
&lt;span style="color: blue;"&gt;using&lt;/span&gt; System.Runtime.InteropServices;
&lt;span style="color: blue;"&gt;using&lt;/span&gt; Microsoft.Experimental.IO.Interop;
&lt;span style="color: blue;"&gt;using&lt;/span&gt; System.Text;

&lt;span style="color: blue;"&gt;namespace&lt;/span&gt; Microsoft.Experimental.IO
{
    &lt;span style="color: blue;"&gt;public&lt;/span&gt; &lt;span style="color: blue;"&gt;static&lt;/span&gt; &lt;span style="color: blue;"&gt;class&lt;/span&gt; LongPath
    {
        &lt;span style="color: blue;"&gt;public&lt;/span&gt; &lt;span style="color: blue;"&gt;static&lt;/span&gt; &lt;span style="color: blue;"&gt;string&lt;/span&gt; GetDirectoryName(&lt;span style="color: blue;"&gt;string&lt;/span&gt; longPath)
        {
            &lt;span style="color: blue;"&gt;int&lt;/span&gt; sep = longPath.LastIndexOf(Path.DirectorySeparatorChar);
            &lt;span style="color: blue;"&gt;if&lt;/span&gt; (sep == -1)
                sep = 0;
            &lt;span style="color: blue;"&gt;return&lt;/span&gt; longPath.Substring(0, sep);
        }

        &lt;span style="color: blue;"&gt;public&lt;/span&gt; &lt;span style="color: blue;"&gt;static&lt;/span&gt; &lt;span style="color: blue;"&gt;string&lt;/span&gt; GetPureDirectoryName(&lt;span style="color: blue;"&gt;string&lt;/span&gt; longPath)
        {
            &lt;span style="color: blue;"&gt;int&lt;/span&gt; firstSep = -1, secondSep = -1;

            secondSep = longPath.LastIndexOf(Path.DirectorySeparatorChar);
            &lt;span style="color: blue;"&gt;if&lt;/span&gt; (secondSep &amp;gt; 0)
            {
                secondSep--;
                firstSep = longPath.LastIndexOf(Path.DirectorySeparatorChar, secondSep);
            }
            &lt;span style="color: blue;"&gt;return&lt;/span&gt; longPath.Substring(firstSep + 1, secondSep - firstSep);
        }

        &lt;span style="color: blue;"&gt;public&lt;/span&gt; &lt;span style="color: blue;"&gt;static&lt;/span&gt; &lt;span style="color: blue;"&gt;string&lt;/span&gt; GetFileName(&lt;span style="color: blue;"&gt;string&lt;/span&gt; longPath)
        {
            &lt;span style="color: blue;"&gt;int&lt;/span&gt; firstSep = -1;

            firstSep = longPath.LastIndexOf(Path.DirectorySeparatorChar);
            &lt;span style="color: blue;"&gt;return&lt;/span&gt; longPath.Substring(firstSep+1);
        }

        &lt;span style="color: blue;"&gt;public&lt;/span&gt; &lt;span style="color: blue;"&gt;static&lt;/span&gt; &lt;span style="color: blue;"&gt;string&lt;/span&gt; GetLongPath(&lt;span style="color: blue;"&gt;string&lt;/span&gt; shortenedPath)
        {
            &lt;span style="color: blue;"&gt;const&lt;/span&gt; &lt;span style="color: blue;"&gt;int&lt;/span&gt; NTFSMaxPath = 32* 1024;

            StringBuilder longPath = &lt;span style="color: blue;"&gt;new&lt;/span&gt; StringBuilder(NTFSMaxPath);
            NativeMethods.GetLongPathName(shortenedPath, longPath, longPath.Capacity);
            &lt;span style="color: blue;"&gt;return&lt;/span&gt; longPath.ToString();
        }

        &lt;span style="color: blue;"&gt;public&lt;/span&gt; &lt;span style="color: blue;"&gt;static&lt;/span&gt; &lt;span style="color: blue;"&gt;string&lt;/span&gt; GetFileNameWithoutExtension(&lt;span style="color: blue;"&gt;string&lt;/span&gt; name)
        {
            &lt;span style="color: blue;"&gt;int&lt;/span&gt; sep = -1, dot = -1;

            dot = name.LastIndexOf(&lt;span style="color: #a31515;"&gt;'.'&lt;/span&gt;);
            &lt;span style="color: blue;"&gt;if&lt;/span&gt; (dot &amp;gt; 0)
            {
                dot--;
                sep = name.LastIndexOf(Path.DirectorySeparatorChar, dot);
            }
            &lt;span style="color: blue;"&gt;return&lt;/span&gt; name.Substring(sep + 1, dot - sep);
        }
    }
}

&lt;/pre&gt;
&lt;/div&gt;
&lt;br /&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/pre&gt;&lt;/div&gt;</description><author>typingcat</author><pubDate>Thu, 20 Sep 2012 02:30:17 GMT</pubDate><guid isPermaLink="false">New Post: Create a directory as Directory.CreateDirectory does. 20120920023017A</guid></item><item><title>New Post: Create a directory as Directory.CreateDirectory does.</title><link>http://bcl.codeplex.com/discussions/396028</link><description>&lt;div style="line-height: normal;"&gt;
&lt;p&gt;I wrote a method. I would like to share with others, because probably others would want this feature, too.Add this to LongPathDirectory.cs.&lt;/p&gt;
&lt;div style="color:black; background-color:white"&gt;
&lt;pre&gt;&lt;span style="background-color:white"&gt;        &lt;/span&gt;&lt;span style="color:gray"&gt;///&lt;/span&gt;&lt;span style="background-color:white"&gt; &lt;/span&gt;&lt;span style="color:gray"&gt;&amp;lt;summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;        &lt;span style="color:gray"&gt;///&lt;/span&gt;&lt;span style="color:green"&gt;     Creates the specified directory.&lt;/span&gt;
        &lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;/summary&amp;gt;&lt;/span&gt;
        &lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;param name=&amp;quot;path&amp;quot;&amp;gt;&lt;/span&gt;
        &lt;span style="color:gray"&gt;///&lt;/span&gt;&lt;span style="color:green"&gt;     A &amp;lt;see cref=&amp;quot;String&amp;quot;/&amp;gt; containing the path of the directory to create.&lt;/span&gt;
        &lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;/param&amp;gt;&lt;/span&gt;
        &lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;remarks&amp;gt;&lt;/span&gt;
        &lt;span style="color:gray"&gt;///&lt;/span&gt;&lt;span style="color:green"&gt;     Note: Unlike &amp;lt;see cref=&amp;quot;LongPathDirectory.Create(System.String)&amp;quot;/&amp;gt;, this method creates &lt;/span&gt;
        &lt;span style="color:gray"&gt;///&lt;/span&gt;&lt;span style="color:green"&gt;     all missing parent directories in &amp;lt;paramref name=&amp;quot;path&amp;quot;/&amp;gt;.&lt;/span&gt;
        &lt;span style="color:gray"&gt;///&lt;/span&gt; &lt;span style="color:gray"&gt;&amp;lt;/remarks&amp;gt;&lt;/span&gt;
        &lt;span style="color:blue"&gt;public&lt;/span&gt; &lt;span style="color:blue"&gt;static&lt;/span&gt; &lt;span style="color:blue"&gt;void&lt;/span&gt; CreateAll(&lt;span style="color:blue"&gt;string&lt;/span&gt; path)
        {
            &lt;span style="color:blue"&gt;int&lt;/span&gt; sep=0;
            &lt;span style="color:blue"&gt;string&lt;/span&gt; curDir;
            &lt;span style="color:blue"&gt;do&lt;/span&gt;
            {
                sep = path.IndexOf(Path.DirectorySeparatorChar, sep);
                &lt;span style="color:blue"&gt;if&lt;/span&gt; (sep == -1)
                {
                    curDir = path;
                }
                &lt;span style="color:blue"&gt;else&lt;/span&gt;
                {
                    sep&amp;#43;&amp;#43;;
                    curDir = path.Substring(0, sep);
                }
                &lt;span style="color:blue"&gt;if&lt;/span&gt; (Exists(curDir) == &lt;span style="color:blue"&gt;false&lt;/span&gt;)
                {
                    Create(curDir);
                }
            } &lt;span style="color:blue"&gt;while&lt;/span&gt; (sep &amp;gt; -1);
        }
&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;</description><author>typingcat</author><pubDate>Wed, 19 Sep 2012 06:07:31 GMT</pubDate><guid isPermaLink="false">New Post: Create a directory as Directory.CreateDirectory does. 20120919060731A</guid></item><item><title>New Post: Excellent Starting Platform! Patches Included!</title><link>http://bcl.codeplex.com/discussions/275022</link><description>&lt;div style="line-height: normal;"&gt;&lt;p&gt;Wait... if I want to delete the directory C:\temp\a\b, it will delete C:\temp\a too? And C:\temp as well? Why?&lt;/p&gt;&lt;/div&gt;</description><author>dutop</author><pubDate>Tue, 18 Sep 2012 08:46:36 GMT</pubDate><guid isPermaLink="false">New Post: Excellent Starting Platform! Patches Included! 20120918084636A</guid></item><item><title>New Post: Excellent Starting Platform! Patches Included!</title><link>http://bcl.codeplex.com/discussions/275022</link><description>&lt;div style="line-height: normal;"&gt;&lt;p&gt;
&lt;div style="color: black; background-color: white;"&gt;
&lt;pre&gt;Hi, I think the following part of LongPathDirectory.Create won't work:&lt;br /&gt;&lt;br /&gt;String[] pathComponents = path.Split(&lt;span style="color: blue;"&gt;new&lt;/span&gt; &lt;span style="color: blue;"&gt;char&lt;/span&gt;[] { &lt;span style="color: #a31515;"&gt;'\\', '&lt;/span&gt;/' }, StringSplitOptions.RemoveEmptyEntries);
  
!             &lt;span style="color: green;"&gt;// Get the first path component, either "c:" or "\\servername".&lt;/span&gt;
!             String partPath = pathComponents[0];
! 
!             &lt;span style="color: green;"&gt;// If the path is a UNC path, then add the share to the initial starting path.  &lt;/span&gt;
!             &lt;span style="color: blue;"&gt;if&lt;/span&gt; (partPath.StartsWith(&lt;span style="color: #a31515;"&gt;@"\\"&lt;/span&gt;))
&lt;/pre&gt;
&lt;/div&gt;
&lt;/p&gt;
&lt;p&gt;partPath will never start with two backslashes, because the split threw those away. So any UNC path is becoming a relative path.&lt;/p&gt;&lt;/div&gt;</description><author>dutop</author><pubDate>Fri, 07 Sep 2012 05:51:01 GMT</pubDate><guid isPermaLink="false">New Post: Excellent Starting Platform! Patches Included! 20120907055101A</guid></item></channel></rss>