Question on the ps1 files

Sep 22, 2009 at 4:52 PM

I'm pretty new to Powershell, but I'm gonna ask anyway: the ConvertFrom file declares itself a function, while the ConvertTo file declares itself a filter. Why are they not both filters or functions?

Coordinator
Sep 22, 2009 at 8:43 PM

Great question. I wrote the two many months apart.

My need for ConvertFrom did not require me to pipe data into it.

When I built ConvertTo it was more natural to pipe the data so I used Filter.

 

hth

Doug

Sep 22, 2009 at 9:57 PM

Thanks for the quick reply.

By the way, I downloaded the source files and made a small app to test if I still know how C# works :P

 

http://i637.photobucket.com/albums/uu91/Vordreller/JSON-Powershell.png

 

Insert JSON left, get Powershell right. Pretty fun.

Coordinator
Sep 22, 2009 at 10:09 PM

Nice. Are you hosting PowerShell in the Winform app?

Sep 22, 2009 at 11:03 PM
Edited Sep 22, 2009 at 11:04 PM

Sadly not, what you see are 2 textarea's.

Enter JSON on the left, hit transform and the Powershell code shows up on the right.

I made this up real quick with VS2008.

 

Hosting Powershell inside the winform? To be honest, I would have never even considered such a thing to be possible.

Coordinator
Sep 23, 2009 at 12:24 AM

http://dougfinke.com/blog/index.php/2009/09/02/how-to-host-powershell-in-a-wpf-application/

 

Sep 23, 2009 at 12:47 AM

That site is now in my Google Reader. Awesome stuff.

 

TBH, never worked with WPF before. When I said "to see if I still know how C# works", I meant that it's been summer vacation. Back to college now :P