示例#1
0
        public COMClass NewClass(string Name)
        {
            COMClass c = new COMClass(Name);

            c.createGUIDs();
            classes.Add(Name, c);
            return(c);
        }
示例#2
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new Form1());

            //COMNamespace ns = new COMNamespace("COM_MSMQ");
            //ns.NewClass("Message");
            //ns.classes["Message"].createGUIDs();
            //ns.classes["Message"].ProgId = "COM_MSMQ.Message";
            //ns.classes["Message"].NewMethod("Message");
            //ns.classes["Message"].NewMethod("ToString");
            //
            //System.IO.File.WriteAllLines("D:\\Users\\Robert\\Desktop\\Temp\\COM_MSMQ.cs", ns.ToString().Split('\n'));

            COMNamespace sock = new COMNamespace("COM_Sockets");
            COMClass     c    = sock.NewClass("COMSocket");
            COMMethod    m    = c.NewMethod("Accept");

            m.returnType = "COMSocket";
            m            = c.NewMethod("Connect");
            m.NewArgument("string", "IPAddress");
            m.NewArgument("int", "port");
            m = c.NewMethod("Disconnect");
            m = c.NewMethod("Listen");
            m.NewArgument("string", "IPAddress");
            m.NewArgument("int", "port");
            m.NewArgument("int", "backlog");
            m = c.NewMethod("Receive");
            m.NewArgument("byte[]", "buffer");
            m.returnType = "int";
            m            = c.NewMethod("Send");
            m.returnType = "int";
            m.NewArgument("byte[]", "buffer");
            COMProperty p = c.NewProperty("Connected");

            p.returnType = "bool";
            p            = c.NewProperty("Available");
            p.returnType = "int";

            System.IO.File.WriteAllLines("D:\\Users\\Robert\\Desktop\\Temp\\COM_Sockets.cs", sock.ToString().Split('\n'));
        }