ILSpy xsproj

Deutschsprachiges X#-Forum – German language forum

Moderator: wriedmann

lagraf
Posts: 417
Joined: Thu Jan 18, 2018 9:03 am

ILSpy xsproj

Post by lagraf »

Im ILSpy kann ich den Sourcecode einer DLL mit "Save Code" speichern, bekomme dann ein *.xsproj File, AppOrdner und Properties Ordner. Kann ich dieses *,xsproj File in X# importieren? Projekte sind in X# mit der Endung *.xiproj, Apps *.viapp.
Wie bekomme ich das File hinein und als was?
User avatar
wriedmann
Posts: 3644
Joined: Mon Nov 02, 2015 5:07 pm
Location: Italy

ILSpy xsproj

Post by wriedmann »

Hallo Franz,
ich habe das jetzt bei mir ausprobiert.
Zumindestens bei mir wurde nur die XSProj-Datei erstellt, aber kein X# Sourcecode.
Hast Du in den Unterverzeichnissen .prg-Dateien?
Ob man diese XSProj-Dateien auch in XIDE öffnen kann, da muss Dir der Chris helfen.
Wolfgang
P.S. bitte beachten: in X# kannst Du gar nichts importieren, da das Produkt X# keine grafische Oberfläche mitbringt mit Ausnahme des XPorters. Was Du wahrscheinlich meinst, ist XIDE - eine IDE, die mit X# ausgeliefert wird, mit der aber nur eine Minderheit der X#-Benutzer arbeitet, weil die meisten Visual Studio vorziehen.
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
User avatar
Chris
Posts: 4562
Joined: Thu Oct 08, 2015 7:48 am
Location: Greece

ILSpy xsproj

Post by Chris »

Hi Franz,

I think as Wolfgagng said, that you want to use the code in XIDE. Unfortunately the plugin creates a project for VS only, but moving it also to
XIDE is easy enough. Just create an empty new app in a project in XIDE and then simply add the .prg files that the plugin generated.

.
Chris Pyrgas

XSharp Development Team test
chris(at)xsharp.eu
User avatar
Chris
Posts: 4562
Joined: Thu Oct 08, 2015 7:48 am
Location: Greece

ILSpy xsproj

Post by Chris »

Hi Wolfgang,
wriedmann wrote:Was Du wahrscheinlich meinst, ist XIDE - eine IDE, die mit X# ausgeliefert wird, mit der aber nur eine Minderheit der X#-Benutzer arbeitet, weil die meisten Visual Studio vorziehen.
Actually apparently X# programmers using XIDE are not that much of a minority. I'm surprised also myself, but most of the reports/support requests I'm getting privately, consists usually of XIDE projects! I now have a large collection of (fairly large) XIDE projects with a lot of code X# which are extremely helpful in testing the new compiler versions that Roberts creates and make as sure as possible than no (much at least!) existing code is broken.

.
Chris Pyrgas

XSharp Development Team test
chris(at)xsharp.eu
User avatar
wriedmann
Posts: 3644
Joined: Mon Nov 02, 2015 5:07 pm
Location: Italy

ILSpy xsproj

Post by wriedmann »

Hi Chris,
yes, I have seen all of your team using XIDE: Robert, Fabrice and Nikos..... so I know you are using it internally.
For people coming from VO XIDE is the natural choice, and I feel much more productive with it that with Visual Studio (of course, that is a personal choice), even with its missing support for XAML.
Many people may speak about "X#" and really mean "XIDE"..... because they see XIDE as an integral part of the X# package.
Wolfgang
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
lagraf
Posts: 417
Joined: Thu Jan 18, 2018 9:03 am

ILSpy xsproj

Post by lagraf »

Hi Wolfgang and Chris,
yes you're right: I meant XIDE instead of X#, because for a VO User XIDE is much better to understand than VS and I see XIDE and X# as one product like VO and it's compiler.

Meanwhile I also imported the ILSpy C# *.prg files in an empty C# lib and after adding some references and changed the syntax of a get statement it compiled without errors. Is it possible to compile every C# project with XIDE or does XIDE only include rudimentary support for C#? The next step should be to create a com module now to use it with VO.

I also got an AssemblyInfo.cs file from ILSpy. What do I have to do with it, do I need it?

I also tested to export the C# code of ILSpy as X# code, but there are many errors compiling it so I think that this way of translating C# to X# is not really suitable.
User avatar
Chris
Posts: 4562
Joined: Thu Oct 08, 2015 7:48 am
Location: Greece

ILSpy xsproj

Post by Chris »

Hi Franz,

In .Net, compilers and IDEs are completely separated, so code that is possible to write it in c#, you can write and/or compile it also using XIDE, you just need to point Tools/Preferences/Compiler/c# to the appropriate c# compiler version you want to use.

What is very limited regarding c# in XIDE is intellisense features and integration with tools, for example you cannot design windows in the form designer and have it generate c# code. It's not actually difficult to implement it, it's just not the scope of XIDE.

.
Chris Pyrgas

XSharp Development Team test
chris(at)xsharp.eu
lagraf
Posts: 417
Joined: Thu Jan 18, 2018 9:03 am

ILSpy xsproj

Post by lagraf »

Ok, copy that Chris!
lagraf
Posts: 417
Joined: Thu Jan 18, 2018 9:03 am

ILSpy xsproj

Post by lagraf »

Eine Frage zum ILSpy X# Plugin:
Ich habe mir einen simplen C# Code übersetzen lassen und finde darin einige Codeteile, die der X# Compiler bemängelt. Ist das Plugin noch in den Kinderschuhen oder erstellt es nur eine rudimentäre Übersetzung, die danach noch eine manuelle Nachbearbeitung erfordert? Ich habe mal die komplette Übersetzung gepostet:

Code: Select all

public class Frames01 inherit Form
	public constructor()
		local panel as Panel
		local qrEncoder as QrEncoder
		local qrCode as QrCode
		local renderer as GraphicsRenderer
		local padding as Point
		local dSize as DrawingSize
		local textBox1 as TextBox
		local label1 as Label
		//
		Text := "e""C# - einfaches Form"
		super:Size := Size{900, 600} 
		panel := Panel{}
		super:Controls:Add(panel)
		qrEncoder := QrEncoder{ErrorCorrectionLevel.H}
		qrCode := qrEncoder:Encode("e""Hello World!")
		renderer := GraphicsRenderer{FixedModuleSize{5, QuietZoneModules.Two}, (Brush)(Object)Brushes.Black, (Brush)(Object)Brushes.White}
		padding := Point{10, 16}
		dSize := renderer:SizeCalculator:GetSize(qrCode:Matrix:Width)
		panel:AutoSize := false
		panel:Size := Size{dSize:CodeWidth, dSize:CodeWidth} + Size{2 * padding:X, 2 * padding:Y}
		begin using graphics := panel:CreateGraphics()
			renderer:Draw((Graphics)(Object)graphics, qrCode:Matrix, (Point)padding)
		end using
		textBox1 := TextBox{}
		label1 := Label{};
			{Location := Point{16, 16},;
			Text := "e""label1",;
			Size := Size{104, 16};
			}
		textBox1:Location := Point{16, 32}
		textBox1:Text := "e""TextBox"
		textBox1:Size := Size{152, 20}
		panel:Controls:Add(label1)
		panel:Controls:Add(textBox1)


end class
Text := "e""C# - einfaches Form" -> Text gibt es nicht, sollte wohl self:text sein?
super:Size := Size{900, 600} -> super sollte wohl self sein?
renderer:Draw((Graphics)(Object)graphics, qrCode:Matrix, (Point)padding) -> soll (Graphics)(Object) ein Platzhalter sein, als realen Code erscheint mir das nicht?

Ich hab den Code schon ausgebessert, also bitte keine Zeit dafür verschwenden! Es würde mich nur interessieren, welchen Zweck die vom X# Plugin Übersetzung erfüllen soll, denn ein 1:1 compilieren mit X# geht wohl nicht und das, obwohl es hier ein simples Beispiel ist. Wie wird die Übersetzung dann erst bei komplexen C# Apps aussehen?
User avatar
wriedmann
Posts: 3644
Joined: Mon Nov 02, 2015 5:07 pm
Location: Italy

ILSpy xsproj

Post by wriedmann »

Hallo Franz,
dieses Plugin ist die Arbeit vom Fabrice und sollte das Lesen von C#-Code erleichtern.
Ich denke nicht, dass es angedacht ist, den erzeugten Code 1:1 kompilieren zu lassen.
Mit C#-Code ist das weitgehend möglich - ich denke aber auch nicht zu 100%. So wird wahrscheinlich LinQ-Code nicht als solcher angezeigt, und auch andere Konstrukte nicht, die der Compiler verarbeitet.
Ich habe keine Ahnung, wie viel Zeit Fabrice hier reinstecken kann und möchte.
Das mit dem String sollte man vielleicht korrigieren - das macht den Code sehr viel schwerer lesbar.
Wolfgang
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
Post Reply