Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Best way to convert C# to Delphi.NET code...

3,240 views
Skip to first unread message

mamcx

unread,
Apr 25, 2005, 7:48:07 PM4/25/05
to
I'm converting a c# project to Delphi... I build a first step with
BabelCode then manual tweak. However, that is costing time and a LOT of
things are repetitive work. I cut times doing global search&replaces but
still feel is not enough.

So, I'm considering build a tool for the future to have this. I know
about CodeDom but obviously is not enough... I first think in use
CodeDom to get the class hierachy then go for each file and extract with
regular expresions and convert line to line.

However, I have to build some parsers with MUTIS and wonder... if I get
a C# parser, and can rewrite the output with Delphi syntax?

I don't know how a parser work, but I imagine that proceduce event where
say "Start a if..then clause" then I inject here the code...

--
Mario A. Montoya
Delphi, MCP, .NET

MUTIS: The open source, full features Indexing, searching engine for Delphi
http://mutis.sourceforge.net/
(ALPHA Stage... developers wanted)

Jim Cooper

unread,
Apr 25, 2005, 9:33:42 PM4/25/05
to

> I'm converting a c# project to Delphi... I build a first step with
> BabelCode then manual tweak.

You can also try Reflector with the File Disassembler add-in. That'll do
a whole project at once.

Cheers,
Jim Cooper

__________________________________________

Jim Cooper jco...@tabdee.ltd.uk
Tabdee Ltd http://www.tabdee.ltd.uk

TurboSync - Connecting Delphi to your Palm
__________________________________________

Chris Burrows

unread,
Apr 25, 2005, 10:18:29 PM4/25/05
to
"Jim Cooper" <jco...@tabdee.ltd.uk> wrote in message
news:426d9a75$1...@newsgroups.borland.com...

>
> You can also try Reflector with the File Disassembler add-in. That'll do a
> whole project at once.
>

I second Jim's suggestion - much easier than reinventing the wheel.
Furthermore, if you want to modify its behaviour you can download the source
code to the Delphi Decompiler that is used in Reflector from Peter
Sawatzki's site:

http://www.sawatzki.de/download.htm

--
Chris Burrows
CFB Software
http://www.cfbsoftware.com/gpcp


Chris Brooksbank

unread,
Apr 26, 2005, 6:40:24 AM4/26/05
to
"I'm converting a c# project to Delphi..."
Is it a possibility to keep the C# code in its own assembly. Then develop
new code in Delphi to use this assembly.
A major selling point of dotnet is language interoperability.

Maybe you could gradually convert the C# later ( if your maintenance
programmers have higher Delphi than C# skillset )


mamcx

unread,
Apr 26, 2005, 11:33:12 AM4/26/05
to
Chris Brooksbank wrote:
> "I'm converting a c# project to Delphi..."
> Is it a possibility to keep the C# code in its own assembly. Then develop
> new code in Delphi to use this assembly.
> A major selling point of dotnet is language interoperability.

Across languages yes, not across plataforms. I want/need have it in
Win32... also, I have converted almost 70% by now but still consider the
idea good (for later)...


--
Mutis: The open source indexing/search engine for Delphi
http://mutis.sourceforge.net/
(Alpha stage: Developers Wanted!)

mamcx

unread,
Apr 27, 2005, 12:49:07 PM4/27/05
to
You can, please, say me how this can be used? I read the code but still
not understand it...

--
Mutis: The open source indexing/search engine for Delphi
http://mutis.sourceforge.net/
(Alpha stage: Developers Wanted!)

Chris Burrows

unread,
Apr 27, 2005, 9:21:14 PM4/27/05
to
"mamcx" <this...@notexist.com> wrote in message
news:426f...@newsgroups.borland.com...

> You can, please, say me how this can be used? I read the code but still
> not understand it...
>

It is used as a plugin to Lutz Roeder's Reflector for .NET:

http://www.aisto.com/roeder/dotnet/

The Delphi decompiler is installed by default when you install Reflector.
The way you use it is to open a .NET dll or exe file with Reflector. Then
using the Tools > Disassembler menu item, inspect the decompiled source code
in your choice of language. Reflector is supplied with plugins for C#,
Visual Basic, MC++, Delphi. There is also a plugin available for Chrome, and
I have done some work on a plugin for Component Pascal.

Jim Cooper

unread,
Apr 28, 2005, 4:10:41 AM4/28/05
to

> It is used as a plugin to Lutz Roeder's Reflector for .NET:
>
> http://www.aisto.com/roeder/dotnet/

This plugin

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


will enable you to save the results of the disassembler, and indeed
apply it to whole projects at once. I would just install it into
reflector and use it from there, rather than read the source code to
find out how it works though :-)

mamcx

unread,
Apr 28, 2005, 11:26:58 AM4/28/05
to
Excelent!

And can convert rigth the switch and other things that BabelCode not
convert rigth.

However the plugin write the code like in C# (ie: Put the code in the
interface and not in the implementation) but anyaway is best than expected

Thanks

0 new messages