Porting existing C# app

12 views
Skip to first unread message

kngpengwin

unread,
Jan 3, 2008, 3:05:41 PM1/3/08
to cocoa-sharp-dev
I've got an existing application that's written in C# and I'm hoping
to port it to OS X. first I'm just hoping to ascertain how difficult
this might be (if I'll be capable of doing it successfully), what a
workable timeline would be for the project, potential pitfalls, etc.

the program accepts input from a USB webcam. it's about 3000 lines in
its current form.

I'm new to C# and OS X applications programming, but have lots of
other experience so am not a new programmer.

what kinds of things should I look for in the existing code to help me
determine the difficulty of the port? in general, are ports of this
kind relatively straightforward?

any advice or insight would be appreciated!

tia

Leauki

unread,
Jan 3, 2008, 6:13:56 PM1/3/08
to cocoa-sharp-dev
Hi,

Wait a few days. Manuel (posting here too) is working on a tutorial.
That will show us how difficult it will be.

I have no idea how the USB webcam will work with Mono You might have
to replace that code with native Mac code (probably Carbon or driver
toolkit, I don't know).

Assuming the USB webcam is no problem (either because Mono can access
USB or you can replace the driver part), you can keep the entire C#
code base and just fix a few platform-specific issues and run the
application under Mac OS X using Mono (Novell's .NET runtime) and X11
(from Apple).

The better but more complicated method is replacing the GUI with
Cocoa#. That's where the tutorial mentioned above comes in. Ideally
your application would have separate classes for domain logic and glue
(i.e. code that connects the domain logic with the GUI). You will have
to redraw the GUI in Interface Builder and replace the glue code.

Small C# programs, in my experience, simply run under Mono on the Mac,
but don't look nice.

Porting the GUI to Cocoa using Cocoa# will solve that problem.

As for the webcam, I don't know anything about USB access in .NET.

If your program currently runs under Linux, the port should be very
straightforward (except for the webcam bit, perhaps).

Anyway, wait until Sunday evening. Then we'll all know more.

Regards,
Andrew.

kngpengwin

unread,
Jan 4, 2008, 7:31:40 AM1/4/08
to cocoa-sharp-dev
Thanks for your response.

If I'm able to run the application under Mono, would other users need
to install Mono and X11 in order to run it? Sorry for my ignorance,
I've never used Mono. Cocoa# would produce a self-contained app,
correct? My goal is a distributable, simple application that could be
easily run by a novice user.

I look forward to seeing the tutorial as well.

Thanks again


Leauki

unread,
Jan 4, 2008, 8:11:48 AM1/4/08
to cocoa-sharp-dev
If the user should run the plain .exe, he would need both Mono and
X11.app.

But you can package the .exe, Mono, and all libraries into one app
bundle. In that case only X11.app would be needed.

Or you can package the .exe, Mono, and all libraries into one app
bundle and modify the bundle to use the new (buggy) native Winforms
driver. In that case the user would not need Mono or X11.app.

Or you can port the C# code to Cocoa# as described before and then
package the .exe, Mono, and all libraries into one bundle. It will not
require Mono or X11.app and look exactly like a native Cocoa
application to a user (except that it will be named "Mono" in the task
list, but maybe that can be fixed in the bundle by renaming the Mono
binary).

Ideally you would have three download options:

1. The plain .exe file for running in any .NET environment (including
Windows).

2. A Windows installer package for Windows.

3. A Cocoa#-based bundle for Mac OS.

I don't know if there is a recommended special format for UNIX and
Linux.

I will try out all these options myself this weekend, once I can get
Cocoa# for work properly. I will post the results.

kngpengwin

unread,
Jan 4, 2008, 10:39:08 AM1/4/08
to cocoa-sharp-dev
ah, I understand now. thanks for the clarification. Cocoa# will
definitely be the way to go, as I can't rely on users to have X11 and
(of course) don't want to rely on a buggy driver.

it sounds like what I want to do is *possible* so that's good news.
the webcam portion may be tricky, but I'm fairly sure there is some
way I can make it work.

I'm going to dive in this weekend and develop some tests...

Leauki

unread,
Jan 4, 2008, 10:42:52 AM1/4/08
to cocoa-sharp-dev
Yes,

Definitely stay in contact with the group. If you can't make it work
now, perhaps Cocoa# will allow a port of the next version or a later
port of the current version of your application.
Reply all
Reply to author
Forward
0 new messages