/*
csc.exe 사용하기. 옵션포함
*/

-----,----,---- 왠만한건,다 된다.
ex)csc.exe /reference:APMPublicLib.DLL,Newtonsoft.Json.Net20.DLL /out:GoodMorning.exe /recurse:*.cs
ex)csc.exe /reference:APMPublicLib.DLL,Newtonsoft.Json.Net20.DLL /out:GoodMorning.exe /recurse:*.cs
ex)csc.exe /reference:APMPublicLib.DLL,Newtonsoft.Json.Net20.DLL /out:GoodMorning.exe /recurse:*.cs
ex)csc.exe /reference:APMPublicLib.DLL,Newtonsoft.Json.Net20.DLL /out:GoodMorning.exe /recurse:*.cs
ex)csc.exe /reference:APMPublicLib.DLL,Newtonsoft.Json.Net20.DLL /out:GoodMorning.exe /recurse:*.cs

우선 c# 컴파일러의 주요 옵션들에 대해 알아보자.

입력 플래그 정의
/recurse 프로젝트의 하위 디렉터리 구조에 있는 C# 파일을 컴파일하도록 csc.exe에 알린다.
이 플래그는 와일드카드 구문을 지원한다.
/reference (/r) 현재 컴파일에서 참조할 외부 어셈블리를 지정하는 데 사용된다.
/addmodule 다중 파일 어셈블리에 포함할 모듈을 지정하는 데 사용된다.

[ 1]c# 컴파일러 입력 옵션

출력 플래그 정의
/out 생성할 어셈블리 이름을 지정한다. 이 플래그를 생략하면 출력 파일 이름은 *.dll 어셈블리의 경우에는 초기 입력 파일 이름을 기반으로, *.exe 어셈블리의 경우에는 Main() 메서드를 정의하는 클래스를 기반으로 지정된다.
/target (/t) 만들 어셈블리의 파일 형식을 지정한다.
/doc XML 문서 파일을 생성하는 데 사용된다.
/delaysign 강력한 이름의 서명 연기를 사용하여 어셈블리를 빌드할 수 있도록 한다.
/keyfile 어셈블리에 강력한 이름을 지정하는 데 사용되는 *.snk 파일 경로를 지정한다.

ComponentOne 프로젝트에 컨트롤 추가하고, 빌드하기
ComponentOne 프로젝트에 컨트롤 추가하고, 빌드하기
ComponentOne 프로젝트에 컨트롤 추가하고, 빌드하기


1.
본문에서는 새 프로젝트를 생성하고, ComponentOne 컨트롤을 도구상자로 불러온 후, 컨트롤을 폼 또는 프로젝트에 추가하는 과정을 설명하고 있습니다.

2.
도구상자에 컨트롤 추가하기

3.
ComponentOne 컨트롤들은 WinForms 에디션을 설치하는 동안 자동으로 비주얼 스튜디오 도구상자에 추가됩니다.
비고)
ComponentOne 컨트롤들은 WinForms 에디션을 설치는 ComponentOne 사이트에서 다운로드받을수 있습니다.

4.
도구모음에 컨트롤 추가하기

5.
컨트롤을 폼에서 사용후에 빌드하기

6. 
빌드가 안되면, 참조에 추가해서 다시 빌드하기




using System;
using System.Collections.Generic;
using System.Linq;

class Program
{
    public static void Main()
    {
        CalcManage nm = new CalcManage();
nm.running();
    }
}

class CalcManage
{
    public void running()
    {
        string[] arr = {""};
List<string> list = new List<string>(arr.ToList());

        list.Add("10.1.191.117");
list.Add("10.1.191.118");
list.Add("10.1.191.119");
list.Add("10.1.191.116");
list.Add("10.1.191.115");
list.Add("10.1.191.114");
list.Add("10.1.191.113");

        arr = list.ToArray();
        
foreach(var e in arr)
        {
            Console.WriteLine(e);
        }
/*------------------------------------------*/
display_packet(list, arr);
    }
    void display_packet(List<string> list, string[] arr)
    {
        foreach(var e in arr)
        {
            Console.WriteLine(e);
        }
    }

}

결과

10.1.191.117
10.1.191.118
10.1.191.119
10.1.191.116
10.1.191.115
10.1.191.114
10.1.191.113

10.1.191.117
10.1.191.118
10.1.191.119
10.1.191.116
10.1.191.115
10.1.191.114
10.1.191.113


/*
csc /reference:Newtonsoft.Json.Net20.dll,ServiceStack.dll,ServiceStack.Interfaces.dll,ServiceStack.ServiceInterface.dll /out:frm01.exe frm01.cs dbmsfrm9801.cs
csc /out:frm01.exe frm01.cs dbmsfrm9801.cs
*/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Runtime.InteropServices;//Marshal
using System.Timers;

class Program
{
    public static void Main(string[] args)
    {
        Application.Run(new CommonLibManage());
    }
}
class dbmsfrm9801 : Form
{
public IntPtr localHandle = IntPtr.Zero;
public IntPtr ____localHandle
{
get{ return localHandle;  }
set{ localHandle = value; }
}

public dbmsfrm9801()
{
localHandle = Handle;

this.Text = "[" + localHandle.ToString() + "]";
}
protected override bool ProcessCmdKey(ref Message m, Keys keyData)
{
const int WM_KEYDOWN = 0x0100;
if(m.Msg==WM_KEYDOWN)
{
switch(keyData.ToString())
{
case "Escape":
Close();
break;
}
}

return base.ProcessCmdKey(ref m, keyData);
}
}
class CommonLibManage : Form
{
public CommonLibManage()
{
//
}
protected override bool ProcessCmdKey(ref Message m, Keys keyData)
{
const int WM_KEYDOWN = 0x0100;
if(m.Msg==WM_KEYDOWN)
{
switch(keyData.ToString())
{
case "Return":
dbmsfrm9801 frm = new dbmsfrm9801();
Console.WriteLine(frm.____localHandle.ToString());
frm.Show();
break;
case "Escape":
Application.Exit();
break;
}
}

return base.ProcessCmdKey(ref m, keyData);
}
}

 



class WindowsManageFrm : Form
{
    System.Windows.Forms.ListBox listBox1 = null;
    System.Windows.Forms.ListBox listBox2 = null;

    void init()
    {
        this.listBox1 = new System.Windows.Forms.ListBox();
        this.listBox2 = new System.Windows.Forms.ListBox();
        this.SuspendLayout();
        this.Controls.Add(this.listBox1);
        this.Controls.Add(this.listBox2);
        this.ResumeLayout(false);

        this.listBox2.Items.Add("KKKKKKK");
        this.listBox2.Items.Add("MMMMMMMMMMMMMMM");
        this.listBox2.Items.Add("KKKKKKK");
    }
    protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
    {
const int WM_KEYDOWN = 0x0100, WM_SYSKEYDOWN = 0x0104;
if ((msg.Msg == WM_KEYDOWN) || (msg.Msg == WM_SYSKEYDOWN))
{
         switch (keyData.ToString())
         {
case "Return" :
Console.WriteLine(this.listBox2.SelectedItem.ToString());
break;
case "Escape" :
DialogResult dialogResult = MessageBox.Show("Quit!!", "Inform",
                    MessageBoxButtons.OKCancel, MessageBoxIcon.Information);
if (dialogResult == DialogResult.OK) Application.Exit();
break;
         default:
             break;
        }
    }

}

비고)
// 0->ID, 1->Handle, 2->Seq
string[] split = recv.id.Split('.');

ex40.cs
0.00MB
ex41.cs
0.00MB







//IntPtr.ToString 메서드

using System;
using System.Windows.Forms;

class Program
{
public static void Main()
{
Application.Run(new APMCommManage());
#if(false)
APMCommManage nm = new APMCommManage();
nm.running();
#endif
}
}
class DBMS2022FRM : Form
{
public DBMS2022FRM()
{
this.Text = "DBMS2022FRM";
}
protected override bool ProcessCmdKey(ref Message m, Keys keyData)
{
const int WM_KEYDOWN=0x0100;

if(m.Msg==WM_KEYDOWN)
{
switch(keyData.ToString())
{
case "Return":
break;
case "Right":
break;
case "Left":
break;
case "Space":
break;
case "Escape":
this.Close();
break;
default:
break;
}
}
return base.ProcessCmdKey(ref m, keyData);
}
}
class APMCommManage : Form
{
IntPtr currentHandle = IntPtr.Zero;

public APMCommManage()
        {
            currentHandle = Handle;
        }
protected override void WndProc(ref Message m)
{
const int WM_PAINT=0x000f;

base.WndProc(ref m);

switch(m.Msg)
{
case WM_PAINT:
break;
default:
break;
}
}
protected override bool ProcessCmdKey(ref Message m, Keys keyData)
{
const int WM_KEYDOWN=0x0100;

if(m.Msg==WM_KEYDOWN)
{
switch(keyData.ToString())
{
case "Return":
Console.WriteLine("HANDLE:" + "[" + currentHandle.ToString() + "]");
break;
case "Right":
break;
case "Left":
break;
case "Space":
DBMS2022FRM dbms2022frm  = new DBMS2022FRM();
dbms2022frm.ShowDialog();
break;
case "Escape":
Application.Exit();
break;
default:
break;
}
}
return base.ProcessCmdKey(ref m, keyData);
}
}

/*
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\csc.exe frm_01.cs
*/


 

 

Newtonsoft.Json.Net20.dll 을 이용한 파싱 sample

 

form_2.cs
0.00MB

/*
c# 프로그램 전체 종료*/

1. Console

Environment.Exit(0);

2. Windows Form

Application.Exit();

+ Recent posts