sharinganthief / tvrename

Automatically exported from code.google.com/p/tvrename
Other
0 stars 0 forks source link

Convert to C# #69

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Since starting this project in C++, I've become a fan on C#.

Anyone got any good ideas or techniques for turning C++/.NET code into C# ?

The best I've seen so far is using a reverse-compiler, that'll output C#. 
I've tried it, combined with the pdb file, and it looks quite good.

This would also help with cross platform efforts using Mono.

Original issue reported on code.google.com by tvren...@tvrename.com on 13 Sep 2009 at 11:59

GoogleCodeExporter commented 9 years ago
A simple google search yielded this place
http://code2code.net/

Not sure on the quality of the output - but it was recommended in a few places.

I'd be interested in some more specifics of the reverse compiler that you 
mentioned
(the name of the tool would be good).

I had a look at the C++ code and I remember why I moved off to the Java world 
so long
ago. C# I can handle.

Original comment by ToddLMor...@gmail.com on 24 Sep 2009 at 1:09

GoogleCodeExporter commented 9 years ago
Just to answer my own question (for anyone else's benefit) I used the following 
to
achieve a nice decompilation and disassembly

Dot Net Reflector http://www.red-gate.com/products/reflector/

in conjunction with 

Denis Bauers Reflector.FileDisassembler

http://www.denisbauer.com/NETTools/FileDisassembler.aspx

I have attached the result of disassembling the 2.2.0a7 binary

Original comment by ToddLMor...@gmail.com on 26 Sep 2009 at 6:26

Attachments:

GoogleCodeExporter commented 9 years ago
I tried the red-gate one, and also gave this one a try:

  http://netdecompiler.com/

That disassembled source of yours looks quite nice.  I'd just go through and 
turn
some of the "goto" statements back into "break"s, and tidy up some of the odd 
things
that have probably come from C++.

Some disassemblers can also read the .pdb file (generated during compilation of 
the
C++ source), then it'll get all the local function variable names as they 
originally
were.

I'll have a play with this a bit more when I get some free time, but if you 
want to
try with the pdb file (for 2.2.0a7), it is attached.

Did you try re-compiling the decompiled code?

Original comment by tvren...@tvrename.com on 27 Sep 2009 at 1:32

Attachments:

GoogleCodeExporter commented 9 years ago
I could not find a means of using the .pdb to get the useful local vars etc ... 
that
doesn't mean it isn't possible. Only that my C++ / C# skills are not that 
great...
nor my familiarity with the tooling.

I would be keen to get this working on Mac / Mono should the transition to C# go
successfully.

Original comment by ToddLMor...@gmail.com on 15 Feb 2010 at 9:33

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
(logged in as the right google user this time...)

A few days ago I made a couple of unsuccessful attempts at the C# conversion.  
I've 
found:

1) The decompiled stuff (through redgate reflector + FileDisassembler) doesn't 
compile straight away.

2) It doesn't compile after three hours of massaging it.  You'll get rid of the 
300 
or so compiler 
errors (all of the same sort of thing), then the C# compiler will get onto its 
next 
stage of 
compilation and find you another 300 errors.

3) What few comments I had in the original source are lost (as you would 
expect).

4) Some stuff gets decompiled really strangely.  Really really strange.  One 
line of 
source becomes 
about 20 lines.  I think this is a side-effect of C++.NET again, and C++ 
exception 
vs. C# exception 
handling.  Grab the original line of source code, change one "->" to a "." and 
you 
can replace those 
20 lines.

5) The decompiled classes don't load in Visual Studio's GUI dialog editor.  Not 
even 
if you remove all 
the lines it complains about (and they look perfectly fine, too).

6) There's a bit of other weird stuff that shows up (in classes of their own), 
which 
I think is 
related to supporting C++ stuff, but that's easy enough to nuke in the new .cs 
source.

7) Enumerated types lose their names, and get referenced by their (int) value 
in case 
statements, etc

Points #5, #2, and #3 have pretty much put me off this approach for now.

The next thing I'm going to try is a search-and-replace in the C++ source code. 
"::" 
becomes ".", "->" 
becomes ".", all "^" removed, "gcnew" becomes "new", rename the .h and cpp 
files to 
.cs, make a new 
project, cross my fingers and try compiling.

Original comment by tvren...@tvrename.com on 15 Feb 2010 at 11:05

GoogleCodeExporter commented 9 years ago
It's definitely disappointing that the automated conversion tools can't get a 
working
codebase :-( I remember M$ saying how easy it was to convert from legacy code 
to .Net
at the time of switchover. I'd have thought 8years later it would be a 
perfected art.

The find / replace approach seems reasonable given that C# has C++ as one of 
it's
ancestor languages. 

RE #5 - would it be "quicker" to relayout the GUI using the new MS GUI Tooling 
(I
assume there's a GUI builder) than attempting to migrate the old one. Then you 
could
reconnect all the event handling to the buttons, menu's and other widgets. In 
java
the layout of the GUI can be done by lotsa different builders so it's not a big 
deal.
Not sure how well this would go with your thirdparty lib (Sourcegrid).

Alternately ... how about decoupling the GUI from the backend processing. Then 
you
can kill 2 birds with one stone ... u could get a commandline version of TV 
rename
for free (well almost) and you'd have a clean C# GUI using the latest and 
greatest
features of Dot Net. It would certainly make (unit) testing a whole lot easier. 
I
would guess that it's the GUI code that is the most problematic from what you 
said
about the dialog editor (and my own experience migrating code over the years).

*fingers crossed* 

I'd like to offer more than moral support but 13 years of not touching C++ have 
left
me ... "rusty" ;-)

Original comment by ToddLMor...@gmail.com on 17 Feb 2010 at 10:38

GoogleCodeExporter commented 9 years ago
Hurrah!  Screenshot!

http://stuff2web.com/d/vfybcs/tvrenamesharp.png

Using Tangible C++ to C# converter, from  
http://www.tangiblesoftwaresolutions.com, 
which processes the original source code, got it about 80% of the way there.  
Then, 
about 4 hours of massaging later, filling in the bits it missed and sorting out 
a few 
other mistakes it made, the C# code now compiles and runs, and doesn't crash 
for at 
least 10 seconds :)

There's still a few things to sort out, e.g. dialogs refusing to open, and a 
few 
other exceptions happening, but the worst of the job is done.

The dialogs open in the GUI UI editor, too.

Very pleased :)

I'll do some more bug squashing over the next few days, rename the project to 
something sensible, and (probably in 1-2 weeks) move it to the trunk, replacing 
the 
C++ source.

If you're super-keen to have a look at the C# source, it is in the SVN 
repository 
under http://code.google.com/p/tvrename/source/browse/#svn/experimental/C# (or 
do a 
SVN checkout from the URL: 
https://tvrename.googlecode.com/svn/experimental/C%23).  
If you give it a day or so, it'll be more stable and less crashy.

Original comment by tvren...@tvrename.com on 19 Feb 2010 at 7:40

GoogleCodeExporter commented 9 years ago
I've just run MoMA (the Mono Migration Analyser) over the C# binary, and it 
looks 
fairly favourable for getting it to work under Mono.  Only a small handful of 
functions 
are not supported, and should be able to be done in some other way, or even run 
without 
those functions.  It might be interesting to try Mono's C# compiler against the 
source 
some time, too.

Original comment by tvren...@tvrename.com on 19 Feb 2010 at 8:00

GoogleCodeExporter commented 9 years ago
Congratulations on the successful conversion ... and the almost Mono 
compatibility.

I tried to checkout the source to give it a looksee ... but I think you have the
repository setup so that only authorised users can get to the source as my 
access was
rejected both with my gmail credentials and as anonymous.

Whilst you are in the mood for big scale changes (and I'm pushing my luck I 
know) ..
have you considered using the google mercurial repository instead of the SVN 
one? We
recently changed over to Mercurial at work from CVS/SVN/ClearCase and have 
found it
extremely light but powerful. It's just an "out there" thought ... and of 
course the
most important thing is getting the code converted (which you have almost done).

Thanks again :-)

Original comment by ToddLMor...@gmail.com on 19 Feb 2010 at 11:57

GoogleCodeExporter commented 9 years ago
The C# version of the source (still under the "experimental" branch) is now 
pretty 
good.  

The basic functionality all works fine, all the dialogs open, and there are no 
crashes that I know of.

I don't anticipate any major changes (apart from bugfixes) to the C# code now, 
so if 
you want to check it out and work on it, it should now be safe.

Six hours to port 26100 lines of code from C++ to C# isn't too bad!

Looks like it might only be possible to check out the trunk anonymously. To 
find out  
your SVN password, go to "Profile" in the top right of any google code page, 
then 
"Settings".  The "googlecode.com password" is the password for SVN checkouts 
(for me, 
the SVN username is the email address I sign into code.google.com with).

I think I'll stick with SVN for now.  I've only recently converted to SVN after 
many 
years of CVS. :)

Original comment by tvren...@tvrename.com on 19 Feb 2010 at 12:13

GoogleCodeExporter commented 9 years ago
Thanks for that ... I'll claim the PEBKAC award on this one ;-) I had assumed 
that
the google code authentication details were the same as all the other google
resources (apparently that isn't the case). ie I was able to check out the code 
AOK
now :-)

Original comment by ToddLMor...@gmail.com on 19 Feb 2010 at 12:40

GoogleCodeExporter commented 9 years ago
I've justed checked in a few changes that'll makes it work much better on Mono. 
 Have a 
look at issue #70 for more details and a screenshot.

Original comment by tvren...@tvrename.com on 20 Feb 2010 at 6:26

GoogleCodeExporter commented 9 years ago
I've just had some time to play with this now. I got everything working "out of 
the
box" on Visual C# 2008 Express edition on Win7. I was able to scan for shows 
download
artwork, summaries, use the When to watch :-) I like it when things work like 
that. 

Given your work on Mono compatibility I may see if I can get it working in Mono
Develop on OS X (given that I try not to use Windoze these days if I can help 
it).

Original comment by ToddLMor...@gmail.com on 21 Feb 2010 at 12:10

GoogleCodeExporter commented 9 years ago
Just wondering (and sorry for not really contributing but my coding knowledge is
essentially nil outside of Lisp):
While you are rewriting the code from C++ to C# and removing some of the 
"windows
only paths" are you also making the program portable for usb devices?

Thank you for all your effort on a fantastic program.

Original comment by another....@gmail.com on 21 Feb 2010 at 6:57

GoogleCodeExporter commented 9 years ago
Excellent to hear it compiles with the free express version.. I was wondering 
if it 
would or not.  It means people can get into it, without having to pay for 
Visual 
Studio.  Win7 is nice too, since I develop on XP and only briefly tried it on 
Vista. 
:)

If you start making progress into the Mono compatibility side of things, let me 
know 
and I'll give you check-in permissions on the repository.   I'm open to 
suggestions 
on how to manage it, but you could have your own branch, do whatever you wanted 

there, and I'd merge it into the main branch when you tell me its ready.

Regarding the path separators, it won't help for running from removable media.  
It 
was just making sure I didn't assume that a path has a "\" between each 
subdirectory.  
e.g. on Linux/Unix it is a "/", and on a Mac it is a ":".  Before doing that, 
it 
crashed in a few places for my initial attempts at running it on Linux.

Original comment by tvren...@tvrename.com on 22 Feb 2010 at 10:14

GoogleCodeExporter commented 9 years ago
As you suggested it doesn't "just work" on the Mac using Mono

Loaded assembly: /Users/todd/Projects/TVRename#/bin/Debug/TVRename.exe
Loaded assembly:
/Library/Frameworks/Mono.framework/Versions/2.6.1/lib/mono/gac/System.Windows.Fo
rms/2.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
[External]
Loaded assembly:
/Library/Frameworks/Mono.framework/Versions/2.6.1/lib/mono/gac/System/2.0.0.0__b
77a5c561934e089/System.dll
[External]
Loaded assembly:
/Library/Frameworks/Mono.framework/Versions/2.6.1/lib/mono/gac/System.Drawing/2.
0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
[External]
Loaded assembly:
/Library/Frameworks/Mono.framework/Versions/2.6.1/lib/mono/gac/Accessibility/2.0
.0.0__b03f5f7f11d50a3a/Accessibility.dll
[External]
Loaded assembly:
/Library/Frameworks/Mono.framework/Versions/2.6.1/lib/mono/gac/Mono.Posix/2.0.0.
0__0738eb9f132ed756/Mono.Posix.dll
[External]
Loaded assembly:
/Library/Frameworks/Mono.framework/Versions/2.6.1/lib/mono/gac/System.Xml/2.0.0.
0__b77a5c561934e089/System.Xml.dll
[External]
Loaded assembly:
/Library/Frameworks/Mono.framework/Versions/2.6.1/lib/mono/gac/Mono.WebBrowser/0
.5.0.0__0738eb9f132ed756/Mono.WebBrowser.dll
[External]
libgluezilla not found. To have webbrowser support, you need libgluezilla 
installed

Unhandled Exception: System.NullReferenceException: Object reference not set to 
an
instance of an object
  at System.Windows.Forms.WebBrowser.Navigate (System.String urlString) [0x0000e] in
/private/tmp/monobuild/build/BUILD/mono-2.6.1/mcs/class/Managed.Windows.Forms/Sy
stem.Windows.Forms/WebBrowser.cs:298

  at (wrapper remoting-invoke-with-check) System.Windows.Forms.WebBrowser:Navigate
(string)
  at TVRename.UI.ShowQuickStartGuide () [0x00011] in
/Users/todd/Projects/TVRename#/Forms/UI.cs:1877 
  at TVRename.UI.FillEpGuideHTML () [0x00015] in
/Users/todd/Projects/TVRename#/Forms/UI.cs:1883 
  at TVRename.UI.UpdateSearchButton () [0x0003e] in
/Users/todd/Projects/TVRename#/Forms/UI.cs:1555 
  at TVRename.UI..ctor (System.String[] args) [0x001ec] in
/Users/todd/Projects/TVRename#/Forms/UI.cs:1472 
  at (wrapper remoting-invoke-with-check) TVRename.UI:.ctor (string[])
  at GlobalMembersTVRename.Main (System.String[] args) [0x00029] in
/Users/todd/Projects/TVRename#/App/Program.cs:47 

Looking around it seems that there is and isn't support for libgluezilla on OS 
X.
http://stackoverflow.com/questions/468906/how-to-instal-libgluezilla-for-mac-os-
x

http://www.mono-project.com/WebBrowser doesn't say anything either way nor does
http://www.mono-project.com/Release_Notes_Mono_2.6.1

I'm uncertain if I should see about getting WebBrowser workng (waiting for a new
release??) or attempting to disable all the WebBrowser bits for the Mac. I 
guess time
will tell

Original comment by ToddLMor...@gmail.com on 28 Feb 2010 at 11:53

GoogleCodeExporter commented 9 years ago
Hopefully Mono will do a good webbrowser for OSX soon.

As a temporary workaround (to stop crashing, but not give functionality), maybe 
do 
something like:
- Make a new custom control, e.g. "FakeBrowser".  Give it the same methods and 
properties that TVRename uses in System.Windows.Forms.WebBrowser.
- Make a new class, say "MyBrowser" and either:
  - On Windows+Linux: derive it from the standard web browser class
  - On Mac: derive it from FakeBrowser
- Use the MyBrowser class instead of the "real" browser in UI.cs (line 175-ish)

I think that'll achieve a balance between easy switching between 
Mac/Linux/Windows 
builds, yet having something that'll show up OK in, and survive manipulation by 
the 
UI designer.

If you find some other .NET browser component that works on OSX (e.g. using 
Safari), 
then you can use that instead of FakeBrowser, or use FakeBrowser to translate 
between 
the functions & properties in WebBrowser and the one that works on OSX.

If you can find out how in C# to make compile/runtime choices based on 
 (a) Current host OS, or
 (b) Compiler (e.g. Mono vs. Microsoft C#)
..let me know.

The only place that WebBrowser control is used is that episode guide, and for 
displaying the intitial quickstart guide (which is a URL on tvrename.com).  You 
could 
maybe take it out, and replace it with a number of image controls, and 
textboxes, or 
even a System.Windows.Forms.RichTextBox control.  I only used the webbrowser 
because 
I was feeling lazy, and generating HTML to make the episode guide was easy.

If the richtextbox control works on Mono, that might be a good way to go.  It 
can 
then generate pretty text, and be cross-platform.

http://msdn.microsoft.com/en-us/library/system.windows.forms.richtextbox.aspx
(note: there is system.windows.controls.richtextbox, but that is .NET 3.0)

If you need it, I've extracted WebBrowser's methods and properties here:
http://stuff2web.com/d/jdytrw/system.windows.forms.webbrowser-metadata.txt

Original comment by tvren...@tvrename.com on 1 Mar 2010 at 12:36

GoogleCodeExporter commented 9 years ago
Thanks for the suggestions :-) I will have a play around at them later in the 
week.
Stubbing out a Fake browser seems like a reasonable first option. Using the 
other UI
controls may make more sense in the long run if the Mac Browser option 
continues to
Yoyo on the Mono front.

Original comment by ToddLMor...@gmail.com on 1 Mar 2010 at 12:55

GoogleCodeExporter commented 9 years ago
The good news. I was able to get it compiling and running as per the screen 
shots 
(unfortunately for the Mac purists out there it's using X11 and not AQUA)

http://img18.imageshack.us/i/tvrenamemacmonitorfolde.png/
http://img31.imageshack.us/i/tvrenamemacmainframe.png/

I took the easy approach and did as you suggested - stubbing out the 
WebBrowser, 
with FakeBrowser as the Parent Class (extending the Control Class) and then 
Subclassing that with "MyBrowser" ... I know ... very literal ... but hey it's 
Sunday and 
I have a cold so my creativity is at a minimum (ie I went with your class names)

Then I came across a couple of wrinkles. I wasn't able to browse anything other 
than 
my home folder. My Network had nothing in it, none of my mapped drives were 
displayed. I tried to copy some content to my home folder and attempt to 
process 
that with TVRename. The stack trace below was the result.

I will have a further look another day when I am feeling more clear headed.

FakeBrowser Constructor ()
MyBrowser Constructor
Fake Navigate(string urlString)
Fake Navigate(string urlString)
Fake Navigate(string urlString)
Fake Navigate(string urlString)
System.NotImplementedException: The requested feature is not implemented.
  at System.Net.WebClient.set_CachePolicy (System.Net.Cache.RequestCachePolicy 
value) [0x00000] in /private/tmp/monobuild/build/BUILD/mono-
2.6.1/mcs/class/System/System.Net/WebClient.cs:149 
  at (wrapper remoting-invoke-with-check) System.Net.WebClient:set_CachePolicy 
(System.Net.Cache.RequestCachePolicy)
  at TVRename.TheTVDB.GetPage (System.String url, Boolean useKey, typeMaskBits 
mirrorType, Boolean forceReload) [0x000df] in 
/Users/todd/Projects/TVRename#/Utility/TheTVDB.cs:949 
  at TVRename.TheTVDB.Search (System.String text) [0x00038] in 
/Users/todd/Projects/TVRename#/Utility/TheTVDB.cs:1677 
  at TVRename.TheTVDBCodeFinder.bnGoSearch_Click (System.Object sender, 
System.EventArgs e) [0x0001b] in /Users/todd/Projects/TVRename#/Custom 
Controls/TheTVDBCodeFinder.cs:261 
  at System.Windows.Forms.Control.OnClick (System.EventArgs e) [0x0001c] in 
/private/tmp/monobuild/build/BUILD/mono-
2.6.1/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Control.cs:6031 
  at System.Windows.Forms.Button.OnClick (System.EventArgs e) [0x00024] in 
/private/tmp/monobuild/build/BUILD/mono-
2.6.1/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Button.cs:106 
  at System.Windows.Forms.ButtonBase.OnMouseUp 
(System.Windows.Forms.MouseEventArgs mevent) [0x00081] in 
/private/tmp/monobuild/build/BUILD/mono-
2.6.1/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ButtonBase.cs:63
4 
  at System.Windows.Forms.Button.OnMouseUp 
(System.Windows.Forms.MouseEventArgs mevent) [0x00000] in 
/private/tmp/monobuild/build/BUILD/mono-
2.6.1/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Button.cs:128 
  at System.Windows.Forms.Control.WmLButtonUp (System.Windows.Forms.Message& 
m) [0x0007e] in /private/tmp/monobuild/build/BUILD/mono-
2.6.1/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Control.cs:5592 
  at System.Windows.Forms.Control.WndProc (System.Windows.Forms.Message& m) 
[0x0017b] in /private/tmp/monobuild/build/BUILD/mono-
2.6.1/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Control.cs:5329 
  at System.Windows.Forms.ButtonBase.WndProc (System.Windows.Forms.Message& 
m) [0x00054] in /private/tmp/monobuild/build/BUILD/mono-
2.6.1/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ButtonBase.cs:69
6 
  at System.Windows.Forms.Button.WndProc (System.Windows.Forms.Message& m) 
[0x00000] in /private/tmp/monobuild/build/BUILD/mono-
2.6.1/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Button.cs:150 
  at System.Windows.Forms.Control+ControlWindowTarget.OnMessage 
(System.Windows.Forms.Message& m) [0x00000] in 
/private/tmp/monobuild/build/BUILD/mono-
2.6.1/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Control.cs:234 
  at System.Windows.Forms.Control+ControlNativeWindow.WndProc 
(System.Windows.Forms.Message& m) [0x00000] in 
/private/tmp/monobuild/build/BUILD/mono-
2.6.1/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Control.cs:215 
  at System.Windows.Forms.NativeWindow.WndProc (IntPtr hWnd, Msg msg, IntPtr 
wParam, IntPtr lParam) [0x00085] in /private/tmp/monobuild/build/BUILD/mono-
2.6.1/mcs/class/Managed.Windows.Forms/System.Windows.Forms/NativeWindow.cs:
242 
System.NotImplementedException: The requested feature is not implemented.
  at System.Windows.Forms.XplatUICarbon.AudibleAlert () [0x00000] in 
/private/tmp/monobuild/build/BUILD/mono-
2.6.1/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUICarbon.cs
:795 
  at System.Windows.Forms.XplatUI.AudibleAlert () [0x00000] in 
/private/tmp/monobuild/build/BUILD/mono-
2.6.1/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUI.cs:471 
  at System.Windows.Forms.MessageBox+MessageBoxForm.RunDialog () [0x00034] 
in /private/tmp/monobuild/build/BUILD/mono-
2.6.1/mcs/class/Managed.Windows.Forms/System.Windows.Forms/MessageBox.cs:1
93 
  at (wrapper remoting-invoke-with-check) 
System.Windows.Forms.MessageBox/MessageBoxForm:RunDialog ()
  at System.Windows.Forms.MessageBox.Show (System.String text, System.String 
caption, MessageBoxButtons buttons, MessageBoxIcon icon) [0x0000b] in 
/private/tmp/monobuild/build/BUILD/mono-
2.6.1/mcs/class/Managed.Windows.Forms/System.Windows.Forms/MessageBox.cs:6
32 
  at TVRename.UI.UI_FormClosing (System.Object sender, 
System.Windows.Forms.FormClosingEventArgs e) [0x00010] in 
/Users/todd/Projects/TVRename#/Forms/UI.cs:1783 
  at System.Windows.Forms.Form.OnFormClosing 
(System.Windows.Forms.FormClosingEventArgs e) [0x0001c] in 
/private/tmp/monobuild/build/BUILD/mono-
2.6.1/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Form.cs:3251 
  at System.Windows.Forms.Form.FireClosingEvents (CloseReason reason, Boolean 
cancel) [0x0001b] in /private/tmp/monobuild/build/BUILD/mono-
2.6.1/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Form.cs:155 
  at (wrapper remoting-invoke-with-check) 
System.Windows.Forms.Form:FireClosingEvents 
(System.Windows.Forms.CloseReason,bool)
  at System.Windows.Forms.Application.Exit 
(System.ComponentModel.CancelEventArgs e) [0x0002f] in 
/private/tmp/monobuild/build/BUILD/mono-
2.6.1/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Application.cs:66
7 
  at System.Windows.Forms.Application.Exit () [0x00000] in 
/private/tmp/monobuild/build/BUILD/mono-
2.6.1/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Application.cs:64
9 
  at System.Windows.Forms.Application.OnThreadException (System.Exception t) 
[0x00063] in /private/tmp/monobuild/build/BUILD/mono-
2.6.1/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Application.cs:72
0 
  at System.Windows.Forms.NativeWindow.OnThreadException (System.Exception e) 
[0x00000] in /private/tmp/monobuild/build/BUILD/mono-
2.6.1/mcs/class/Managed.Windows.Forms/System.Windows.Forms/NativeWindow.cs:
208 
  at System.Windows.Forms.NativeWindow.WndProc (IntPtr hWnd, Msg msg, IntPtr 
wParam, IntPtr lParam) [0x00141] in /private/tmp/monobuild/build/BUILD/mono-
2.6.1/mcs/class/Managed.Windows.Forms/System.Windows.Forms/NativeWindow.cs:
264 
  at System.Windows.Forms.XplatUICarbon.DispatchMessage 
(System.Windows.Forms.MSG& msg) [0x00000] in 
/private/tmp/monobuild/build/BUILD/mono-
2.6.1/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUICarbon.cs
:1258 
  at System.Windows.Forms.XplatUI.DispatchMessage (System.Windows.Forms.MSG& 
msg) [0x00000] in /private/tmp/monobuild/build/BUILD/mono-
2.6.1/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUI.cs:605 
  at System.Windows.Forms.Application.RunLoop (Boolean Modal, 
System.Windows.Forms.ApplicationContext context) [0x0036a] in 
/private/tmp/monobuild/build/BUILD/mono-
2.6.1/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Application.cs:98
4 
  at System.Windows.Forms.Form.ShowDialog (IWin32Window owner) [0x00124] in 
/private/tmp/monobuild/build/BUILD/mono-
2.6.1/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Form.cs:1800 
  at System.Windows.Forms.Form.ShowDialog () [0x00000] in 
/private/tmp/monobuild/build/BUILD/mono-
2.6.1/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Form.cs:1721 
  at (wrapper remoting-invoke-with-check) System.Windows.Forms.Form:ShowDialog 
()
  at TVRename.UI.folderMonitorToolStripMenuItem_Click (System.Object sender, 
System.EventArgs e) [0x0000c] in 
/Users/todd/Projects/TVRename#/Forms/UI.cs:3897 
  at System.Windows.Forms.ToolStripItem.OnClick (System.EventArgs e) [0x0001c] in 
/private/tmp/monobuild/build/BUILD/mono-
2.6.1/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ToolStripItem.cs:
1002 
  at System.Windows.Forms.ToolStripMenuItem.OnClick (System.EventArgs e) 
[0x000a5] in /private/tmp/monobuild/build/BUILD/mono-
2.6.1/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ToolStripMenuIte
m.cs:267 
  at System.Windows.Forms.ToolStripMenuItem.HandleClick (System.EventArgs e) 
[0x00000] in /private/tmp/monobuild/build/BUILD/mono-
2.6.1/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ToolStripMenuIte
m.cs:538 
  at System.Windows.Forms.ToolStripItem.FireEvent (System.EventArgs e, 
ToolStripItemEventType met) [0x00042] in 
/private/tmp/monobuild/build/BUILD/mono-
2.6.1/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ToolStripItem.cs:
1776 
  at (wrapper remoting-invoke-with-check) 
System.Windows.Forms.ToolStripItem:FireEvent 
(System.EventArgs,System.Windows.Forms.ToolStripItemEventType)
  at System.Windows.Forms.ToolStrip.OnMouseUp 
(System.Windows.Forms.MouseEventArgs mea) [0x00047] in 
/private/tmp/monobuild/build/BUILD/mono-
2.6.1/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ToolStrip.cs:960 
  at System.Windows.Forms.ToolStripDropDown.OnMouseUp 
(System.Windows.Forms.MouseEventArgs mea) [0x00000] in 
/private/tmp/monobuild/build/BUILD/mono-
2.6.1/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ToolStripDropDo
wn.cs:630 
  at System.Windows.Forms.Control.WmLButtonUp (System.Windows.Forms.Message& 
m) [0x0007e] in /private/tmp/monobuild/build/BUILD/mono-
2.6.1/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Control.cs:5592 
  at System.Windows.Forms.Control.WndProc (System.Windows.Forms.Message& m) 
[0x0017b] in /private/tmp/monobuild/build/BUILD/mono-
2.6.1/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Control.cs:5329 
  at System.Windows.Forms.ScrollableControl.WndProc 
(System.Windows.Forms.Message& m) [0x00000] in 
/private/tmp/monobuild/build/BUILD/mono-
2.6.1/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ScrollableControl
.cs:807 
  at System.Windows.Forms.ToolStrip.WndProc (System.Windows.Forms.Message& m) 
[0x00000] in /private/tmp/monobuild/build/BUILD/mono-
2.6.1/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ToolStrip.cs:121
3 
  at System.Windows.Forms.ToolStripDropDown.WndProc 
(System.Windows.Forms.Message& m) [0x0001a] in 
/private/tmp/monobuild/build/BUILD/mono-
2.6.1/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ToolStripDropDo
wn.cs:722 
  at System.Windows.Forms.Control+ControlWindowTarget.OnMessage 
(System.Windows.Forms.Message& m) [0x00000] in 
/private/tmp/monobuild/build/BUILD/mono-
2.6.1/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Control.cs:234 
  at System.Windows.Forms.Control+ControlNativeWindow.WndProc 
(System.Windows.Forms.Message& m) [0x00000] in 
/private/tmp/monobuild/build/BUILD/mono-
2.6.1/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Control.cs:215 
  at System.Windows.Forms.NativeWindow.WndProc (IntPtr hWnd, Msg msg, IntPtr 
wParam, IntPtr lParam) [0x00085] in /private/tmp/monobuild/build/BUILD/mono-
2.6.1/mcs/class/Managed.Windows.Forms/System.Windows.Forms/NativeWindow.cs:
242 

Unhandled Exception: System.NotImplementedException: The requested feature is 
not implemented.
  at System.Windows.Forms.XplatUICarbon.AudibleAlert () [0x00000] in 
/private/tmp/monobuild/build/BUILD/mono-
2.6.1/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUICarbon.cs
:795 
  at System.Windows.Forms.XplatUI.AudibleAlert () [0x00000] in 
/private/tmp/monobuild/build/BUILD/mono-
2.6.1/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUI.cs:471 
  at System.Windows.Forms.MessageBox+MessageBoxForm.RunDialog () [0x00034] 
in /private/tmp/monobuild/build/BUILD/mono-
2.6.1/mcs/class/Managed.Windows.Forms/System.Windows.Forms/MessageBox.cs:1
93 
  at (wrapper remoting-invoke-with-check) 
System.Windows.Forms.MessageBox/MessageBoxForm:RunDialog ()
  at System.Windows.Forms.MessageBox.Show (System.String text, System.String 
caption, MessageBoxButtons buttons, MessageBoxIcon icon) [0x0000b] in 
/private/tmp/monobuild/build/BUILD/mono-
2.6.1/mcs/class/Managed.Windows.Forms/System.Windows.Forms/MessageBox.cs:6
32 
  at TVRename.UI.UI_FormClosing (System.Object sender, 
System.Windows.Forms.FormClosingEventArgs e) [0x00010] in 
/Users/todd/Projects/TVRename#/Forms/UI.cs:1783 
  at System.Windows.Forms.Form.OnFormClosing 
(System.Windows.Forms.FormClosingEventArgs e) [0x0001c] in 
/private/tmp/monobuild/build/BUILD/mono-
2.6.1/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Form.cs:3251 
  at System.Windows.Forms.Form.FireClosingEvents (CloseReason reason, Boolean 
cancel) [0x0001b] in /private/tmp/monobuild/build/BUILD/mono-
2.6.1/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Form.cs:155 
  at (wrapper remoting-invoke-with-check) 
System.Windows.Forms.Form:FireClosingEvents 
(System.Windows.Forms.CloseReason,bool)
  at System.Windows.Forms.Application.Exit 
(System.ComponentModel.CancelEventArgs e) [0x0002f] in 
/private/tmp/monobuild/build/BUILD/mono-
2.6.1/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Application.cs:66
7 
  at System.Windows.Forms.Application.Exit () [0x00000] in 
/private/tmp/monobuild/build/BUILD/mono-
2.6.1/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Application.cs:64
9 
  at System.Windows.Forms.Application.OnThreadException (System.Exception t) 
[0x00063] in /private/tmp/monobuild/build/BUILD/mono-
2.6.1/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Application.cs:72
0 
  at System.Windows.Forms.NativeWindow.OnThreadException (System.Exception e) 
[0x00000] in /private/tmp/monobuild/build/BUILD/mono-
2.6.1/mcs/class/Managed.Windows.Forms/System.Windows.Forms/NativeWindow.cs:
208 
  at System.Windows.Forms.NativeWindow.WndProc (IntPtr hWnd, Msg msg, IntPtr 
wParam, IntPtr lParam) [0x00141] in /private/tmp/monobuild/build/BUILD/mono-
2.6.1/mcs/class/Managed.Windows.Forms/System.Windows.Forms/NativeWindow.cs:
264 
  at System.Windows.Forms.XplatUICarbon.DispatchMessage 
(System.Windows.Forms.MSG& msg) [0x00000] in 
/private/tmp/monobuild/build/BUILD/mono-
2.6.1/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUICarbon.cs
:1258 
  at System.Windows.Forms.XplatUI.DispatchMessage (System.Windows.Forms.MSG& 
msg) [0x00000] in /private/tmp/monobuild/build/BUILD/mono-
2.6.1/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUI.cs:605 
  at System.Windows.Forms.Application.RunLoop (Boolean Modal, 
System.Windows.Forms.ApplicationContext context) [0x0036a] in 
/private/tmp/monobuild/build/BUILD/mono-
2.6.1/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Application.cs:98
4 
  at System.Windows.Forms.Application.Run 
(System.Windows.Forms.ApplicationContext context) [0x00014] in 
/private/tmp/monobuild/build/BUILD/mono-
2.6.1/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Application.cs:76
3 
  at System.Windows.Forms.Application.Run (System.Windows.Forms.Form mainForm) 
[0x00000] in /private/tmp/monobuild/build/BUILD/mono-
2.6.1/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Application.cs:74
2 
  at GlobalMembersTVRename.Main (System.String[] args) [0x00029] in 
/Users/todd/Projects/TVRename#/App/Program.cs:47 
The application was terminated by a signal: SIGHUP

Original comment by ToddLMor...@gmail.com on 7 Mar 2010 at 7:18

Attachments:

GoogleCodeExporter commented 9 years ago
Cool.. Nice progress!

Looks like it's using some other class not implemented in Mono, causing a 
System.NotImplementedException .. Something to do with 
System.Net.Cache.RequestCachePolicy, one of which is created and passed to the 
WebClient class that gets pages from thetvdb, when forcing a reload.

You could try running the "MoMA" tool your compiled TVRename binary..

  http://www.mono-project.com/MoMA

..it should find any other stuff that will explode in the same way.

Original comment by tvren...@tvrename.com on 8 Mar 2010 at 11:48

GoogleCodeExporter commented 9 years ago
The C# source code has now been moved from 'experimental' into the main 'trunk'.

Original comment by tvren...@tvrename.com on 10 Mar 2010 at 9:39

GoogleCodeExporter commented 9 years ago
I ran the MoMa analyser and there were several failure points. I've attached the
report as a MS IE all-in-one web archive.

TVRename calls

void CopyMachine () FileSecurity FileInfo.GetAccessControl () 

void CopyMachine () void FileInfo.SetAccessControl (FileSecurity) 

Byte[] GetPage (string, bool, typeMaskBits, bool) void WebClient.set_CachePolicy
(RequestCachePolicy) 

Original comment by ToddLMor...@gmail.com on 10 Mar 2010 at 12:25

Attachments:

GoogleCodeExporter commented 9 years ago
GetAccessControl and SetAccessControl were needed to make sure that the 
original 
file's permissions were being copied across correctly (NTFS filesystem 
specific, I 
think).  It was in response to this forum post here: 
http://tvrename.com/bb/viewtopic.php?f=3&t=146&p=603

The CachePolicy is being used to do a "force refresh", to make sure that a 
fresh copy 
of the page is fetched from the thetvdb server, rather than anything cached 
locally 
on the user's PC, or by their ISP's (transparent) proxies.  This is only for 
when the 
user does a right-click and "force refresh" on a show in "My Shows".

Original comment by tvren...@tvrename.com on 24 Mar 2010 at 4:55