All Projects → ying32 → DDNRuntime-examples

ying32 / DDNRuntime-examples

Licence: other
DDNRuntime(Delphi .NET Framework/.NET Core Runtime) example. DDNRuntime is a library for Delphi to call .net dll. Support the assembly written by c#, vb.net. Support importing .net dll to delphi, can create .net wrapper automatically.

Programming Languages

pascal
1382 projects

Projects that are alternatives of or similar to DDNRuntime-examples

dotnet
.NET Community Toolkit is a collection of helpers and APIs that work for all .NET developers and are agnostic of any specific UI platform. The toolkit is maintained and published by Microsoft, and part of the .NET Foundation.
Stars: ✭ 865 (+5666.67%)
Mutual labels:  wpf, netcore, netframework
Oxyplot
A cross-platform plotting library for .NET
Stars: ✭ 2,466 (+16340%)
Mutual labels:  wpf, netcore
Wpfcontrib
A collection of WPF controls and utility classes I've accumulated over the years.
Stars: ✭ 106 (+606.67%)
Mutual labels:  wpf, netcore
hazelcast-csharp-client
Hazelcast .NET Client
Stars: ✭ 98 (+553.33%)
Mutual labels:  netframework, netcore2
H.NotifyIcon.WPF
NotifyIcon for .Net Core 3.1 and .Net 5 WPF.
Stars: ✭ 44 (+193.33%)
Mutual labels:  wpf, netcore
ModernWpf
Modern styles and controls for your WPF applications without need WinRT
Stars: ✭ 65 (+333.33%)
Mutual labels:  wpf, netcore
MQTTnet
MQTTnet is a high performance .NET library for MQTT based communication. It provides a MQTT client and a MQTT server (broker). The implementation is based on the documentation from http://mqtt.org/.
Stars: ✭ 3,309 (+21960%)
Mutual labels:  netcore, netframework
Genvue
GenVue is a hostable, web application that lets confidential users upload and share private files. Tech stack: Net Core 2.0 + Vue.js + Vuex + OpenIddict + Vuetifyjs + EF + SQLServer/Postgress
Stars: ✭ 116 (+673.33%)
Mutual labels:  netcore, netcore2
Taskban
A personal productivity tool developed with C# and XAML.
Stars: ✭ 56 (+273.33%)
Mutual labels:  wpf, netcore
wpf-propertygrid
Repackaging of Workflow Foundation's property grid for general use in WPF applications
Stars: ✭ 55 (+266.67%)
Mutual labels:  wpf, netframework
SocketHook
Socket hook is an injector based on EasyHook (win only) which redirect the traffic to your local server.
Stars: ✭ 38 (+153.33%)
Mutual labels:  wpf, netcore31
jQuery-datatable-server-side-net-core
A simple Visual Studio solution using jQuery DataTable with Server-Side processing using .NET 5
Stars: ✭ 71 (+373.33%)
Mutual labels:  netcore2, netcore31
Mqttnet
MQTTnet is a high performance .NET library for MQTT based communication. It provides a MQTT client and a MQTT server (broker). The implementation is based on the documentation from http://mqtt.org/.
Stars: ✭ 2,486 (+16473.33%)
Mutual labels:  netcore, netframework
Egorozh.ColorPicker
🎨🎨🎨 Best of the best ColorPicker on WPF and AvaloniaUI
Stars: ✭ 39 (+160%)
Mutual labels:  wpf, netcore
Abot
Cross Platform C# web crawler framework built for speed and flexibility. Please star this project! +1.
Stars: ✭ 1,961 (+12973.33%)
Mutual labels:  netcore, netcore2
Opentouryo
”Open棟梁”は、長年の.NETアプリケーション開発実績にて蓄積したノウハウに基づき開発した.NET用アプリケーション フレームワークです。 (”OpenTouryo” , is an application framework for .NET which was developed using the accumulated know-how with a long track record in .NET application development.)
Stars: ✭ 233 (+1453.33%)
Mutual labels:  wpf, netcore
Adonetcore.aseclient
AdoNetCore.AseClient - a .NET Core DB Provider for SAP ASE
Stars: ✭ 72 (+380%)
Mutual labels:  netcore, netcore2
Ng Alain .netcore
ng-alain 与 .net core 搭配
Stars: ✭ 82 (+446.67%)
Mutual labels:  netcore, netcore2
SimpleDialogs
💬 A simple framework to help displaying dialogs on a WPF app
Stars: ✭ 24 (+60%)
Mutual labels:  wpf, netframework
Tomlet
Zero-Dependency, model-based TOML De/Serializer for .NET
Stars: ✭ 56 (+273.33%)
Mutual labels:  netcore, netframework

中文 | English


DDNRuntime

DDNRuntime(Delphi .NET Framework/.NET Core Runtime)


Latest version: v0.1.30

What's news

Go to view


This is not an open source and free project. Only examples are stored here.

Features

  • No need for COM support.
  • It is very simple to use, just declare the type and method of .NET in Delphi.
  • Dedicated translation tool, input one or more .NET assembly DLL, output one or two Delphi import units.
  • Support interface types.
  • Support dynamic array (one-dimensional array).
  • Support Delegate type.
  • Support Event.
  • Generic type (Limited support. Only XE8 and above are supported and nested generics are not supported yet, such as: DNICollection<DNKeyValuePair<TKey, TValue>> such multi-level nesting).

Requires

Not supported

  • Two-dimensional array.
  • Nested generics.

Implementing features

  • Nothing.

Trial

Get DDNRuntime trial file, copy the DUC file of the Delphi version you are using to src directory.

Buy

Subscription type Price / 1 Year(US dollar) Renewal price/1 year explain
Personal Edition $???? / 1 developer $???? Only DCU and DLL, no source code
Enterprise Edition $???? / 10 developers $???? Only DCU and DLL, no source code

**Note: ??????? **

Exported public functions or class attributes and methods

  • DDN.Runtime (No source code)
  IID_IDN_Name = '{B130231B-447A-48F5-B476-43FB07E99457}';
  IID_IDN: TGUID = '{B130231B-447A-48F5-B476-43FB07E99457}';

  IID_IDNClass_Name = '{E0CE1E32-5502-4F10-B263-6490F332E340}';
  IID_IDNClass: TGUID = '{E0CE1E32-5502-4F10-B263-6490F332E340}';

  IID_IDNInstance_Name = '{152F4F46-D220-423A-8135-FE6DF52A7932}';
  IID_IDNInstance: TGUID = '{152F4F46-D220-423A-8135-FE6DF52A7932}';

  IID_ILocalObject_Name = '{C4A9BE07-6DF9-448A-856F-9323768D36FE}';
  IID_ILocalObject: TGUID = '{C4A9BE07-6DF9-448A-856F-9323768D36FE}';

  IID_DNObject_Name = '{81C5FE01-027C-3E1C-98D5-DA9C9862AA21}';
  IID_DNObjectClass_Name = '{52839F0D-B981-46B3-8A5C-5C7B1449E1EB}';
  DNObject_FullName = 'System.Object';

  /// <summary>
  ///   The native pointer in DotNet is actually defined as a class to prevent being GC.
  /// </summary>
  DNNObject = type Pointer;

  IDN = interface
    [IID_IDN_Name]
  end;

  IDNClass = interface(IDN)
    [IID_IDNClass_Name]
  end;

  IDNInstance = interface(IDN)
    [IID_IDNInstance_Name]
  end;

  /// <summary>
  ///   Used to get the saved DotNet instance
  /// </summary>
  ILocalObject = interface(IDN)
    [IID_ILocalObject_Name]
    function GetObjectID: DNNObject;
  end;

  /// <summary>
  ///   Load assembly
  /// </summary>
  /// <param name="AFileName">An assembly qualified name or an absolute assembly file name (full path)</param>
  function LoadAssemblyModule(const AFileName: string): Boolean;
  
  /// <summary>
  ///   Set whether to display the detailed information of .NET exceptions
  /// </summary>
  procedure SetShowDetailedExceptionMessage(AValue: Boolean);
  • DDN.mscorlib.TDNGenericImport
  /// <summary>
  /// Return instance objects from DotNet native objects
  /// </summary>
  class function Wrap(ADNObjectID: DNNObject): T; overload; static;
  /// <summary>
  /// Return an object from an interface instance
  /// </summary>
  class function Wrap(const AInstance: IDNInstance): T; overload; static;
  /// <summary>
  /// Call the constructor or static method in DotNet.
  /// </summary>
  class property DNClass: C read GetDNClass;
  /// <summary>
  /// Create a DotNet instance object, call the default constructor
  /// </summary>
  class function Create: T; static;
  /// <summary>
  /// clsID means the native pointer of the instance in DotNet
  /// </summary>
  class function GetClsID: DNNObject; static;
  /// <summary>
  /// .NET type information
  /// </summary>
  class property typeid: DNType read GetTypeId;

Note: All imported .NET types start with DN, such as DNType, and non-interface type importers start with TDN+.NET type, such as: TDNType. If the enumeration value name in .NET has the same name as the Delphi keyword, add _ at the end of the name.

Usage:

unit DDNTest;

interface

uses
  System.SysUtils,
  DDN.Runtime,
  DDN.mscorlib;
  
implementation

procedure TestMemoryStream;
var
  LMem: DNMemoryStream;
  LBytes: TArray<Byte>;
  B: Byte;
  LReadLen: Integer;
begin
  LMem := TDNMemoryStream.Create;
  
  LMem.Write([1,2,3,4,5], 0, 5);
  LMem.WriteByte(121);
  LMem.Flush;
  LMem.Position := 0;

  Writeln('data Length: ', LMem.Length);
  SetLength(LBytes, LMem.Length);
  LReadLen :=  LMem.Read(LBytes, 0, Length(LBytes));
  Writeln('len: ', LReadLen);
  for b in LBytes do
    Write(b, ' ');
  Writeln;
end;

procedure TestReflection;
var
  LType: DNType;
  LMethods: TArray<DNMethodInfo>;
  LM: DNMethodInfo;
  LParams: TArray<DNParameterInfo>;
  LP: DNParameterInfo;
  I: Integer;
begin
  LType := TDNMemoryStream.typeid;
 // LType := TDNType.DNClass.GetType('System.IO.MemoryStream');
  Writeln('LType ptr=', NativeUint(LType));
  if LType <> nil then
  begin
    LMethods := LType.GetMethods;
    Writeln('method Count: ', Length(LMethods));
    for LM in Lmethods do
    begin
      Writeln(Format('method Name:%s', [LM.Name]));
      LParams := LM.GetParameters;
      I := 0;
      for LP in LParams do
      begin
        if I > 0 then
          write('; ');
        Write(Format('%s: %s', [LP.Name, LP.ParameterType.FullName]));
        Inc(I);
      end;
      Writeln('');
    end;
  end;
end;


end.
  
  • Delegate
type
  TDelegateClass = class
  public
    // A method can be an instance method or a class method.
    class function CheckValidationResult(sender: DNObject; certificate: DNX509Certificate; chain: DNX509Chain;  errors: DNSslPolicyErrors): Boolean;
  end;
  
class function TDelegateClass.CheckValidationResult(
  sender: DNObject;
  certificate: DNX509Certificate;
  chain: DNX509Chain;
  errors: DNSslPolicyErrors): Boolean;
begin
  Writeln('call TDelegateTest.CheckValidationResult: ');
  Writeln('sender: ', sender.ToString);
  Writeln('certificate: ',  certificate.ToString);
  Writeln('chain: ', chain.ToString);
  Writeln('errors: ', errors);
  Result := True;
end; 
  
TDNServicePointManager.DNClass.ServerCertificateValidationCallback := TDelegateClass.CheckValidationResult;
  • Event
type
  // test
  TEventClass = class
  public
    // A method can be an instance method or a class method.
   class procedure OnButtonClick(sender: DNObject; e: DNEventArgs);
  end;
  
class procedure TEventClass.OnButtonClick(sender: DNObject; e: DNEventArgs);
begin
  TDNMessageBox.DNClass.Show('Button.Click: ' + sender.ToString);
//  TDNButton.Wrap(Sender).remove_Click(TDelegateTest.OnButtonClick);
end;
  
function CreateMainForm(): DNForm;
var
  LButton: DNButton;
  LR: DNRectangle;
  //LEdit: DNTextBox;
begin
  LR := TDNScreen.DNClass.PrimaryScreen.Bounds;

  Result := TDNForm.Create;
  Result.Text := 'Delphi .NET Runtime';

  LButton := TDNButton.Create;
  LButton.Text := 'Hello';
  LButton.add_Click(TEventClass.OnButtonClick);
  LButton.Location := TDNPoint.DNClass.init(100, 100);
  Result.Controls.Add(LButton);

  //Result.StartPosition := DNFormStartPosition.Manual;
  Result.StartPosition := DNFormStartPosition.CenterScreen;
  //Result.Location :=  TDNPoint.DNClass.init((LR.Width - Result.Width) div 2, (LR.Height - Result.Height) div 2);
end;

 
begin
  TDNApplication.DNClass.EnableVisualStyles();
  TDNApplication.DNClass.SetCompatibleTextRenderingDefault(False);
  TDNApplication.DNClass.Run(CreateMainForm());
end.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].