🙂 İNSANLARIN EN HAYIRLISI INSANLARA FAYDALI OLANDIR 🙂

Ramazan HABER / C# RMOS / dll oluşturma ve kullanma

1-) C# RMOS - dll oluşturma ve kullanma

 

 

oluşturma kodu

 

namespace lisanss

{

    public class Class1

    {

        public static void lisansBasKontrol(string server, string users, string pwd, string database)

        {

            lisansKey.lisansBasKontrol(server, users, pwd, database); //lisans Biterse Uygulamayı Kapatır

        }

    }

}

 

 

KULLANMA KODU

 

using System;

using System.Reflection;

using System.Windows.Forms;

 

namespace lisansKontrol

{

    public partial class Form1 : Form

    {

        public Form1()

        {

            InitializeComponent();

        }

 

        private void button1_Click(object sender, EventArgs e)

        {           

            try

            {

                string getPath = AppDomain.CurrentDomain.BaseDirectory + "lisanss.dll";

                var DLL = Assembly.LoadFile(getPath);

                foreach (Type type in DLL.GetExportedTypes())

   {

                    var c = Activator.CreateInstance(type);

                    type.InvokeMember("lisansBasKontrol", BindingFlags.InvokeMethod, null, c, new object[] { "RAMBO", "sa", "123", "Demo01Crm" });

                }

            }

            catch(Exception ex)

            {

 

            }

           

        }

    }

}

 

 2021 Mart 08 Pazartesi
 548