C#을 사용한 빠른 툴 개발
-
Upload
- -
Category
Technology
-
view
2.766 -
download
10
description
Transcript of C#을 사용한 빠른 툴 개발
1
C# CQ
: E-Mail : [email protected] : http://blog.naver.com/jacking75 : http://jacking.springnote.com
Agenda
C#
: DB
: .
4
.
C++ . C++ . C++(MFC) . C++(MFC) .
7
C++ MFC . C++ MFC .!!8 . Microsoft C# .
9C++ (C++ ) MSDN C#MS LINQ, WPF( ), ( )
10DB Tool Bridge C#
C# . DB Tool, , , .
C# .11C# C++
C++( ) .C# Pointer .C++ C# , ..NET Win32 API .
12C#C+++1. C# class(struct)
class Item{ intItemCd; char Level; BuyMoneyint;}14: class(struct) C++ .
: .152. C# C++
struct Packet_Login : public PacketHead{ characID[21]; char acPW[21];};
Send( (char*)Pakcet_Login );
Void PacketProcess( char* RecvData ){ Packet_Login* pkLogin = (Packet_Login*)RecvData; }
: C# , C++ C# .
:1. Marshaling
17 [StructLayout(LayoutKind.Sequential, Pack = 1)] public class ConnectBridgeRq { public ConnectBridgeRq() { Header = new HEADER(); acIP = new byte[17]; }
public void GetBuffer(byte[] outBuffer) { if (0 == outBuffer.Length) outBuffer = new byte[Protocol.MAX_PACKET_DATA];
unsafe { fixed (byte* fixed_buffer = outBuffer) { Marshal.StructureToPtr(this, (IntPtr)fixed_buffer, false); } } }
public HEADER Header; //
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 17)] public byte[] acIP; // } void Send() { LoginAuthorRet LoginPacket = new LoginAuthorRet(); LoginPacket.Header.a1 = (ushort)(Marshal.SizeOf(LoginPacket) - Marshal.SizeOf(LoginPacket.Header)); LoginPacket.Header.a2 = ClientNetworkLib.PACKET_DEFINE.PK_LOGIN_AUTHOR_REQ; int iIPLen = strIP.Length; Buffer.BlockCopy(Encoding.ASCII.GetBytes(strID), 0, LoginPacket.acIP, 0, iIPLen); byte[] packet1 = new byte[Protocol.MAX_PACKET_DATA]; LoginPacket.GetBuffer(packet1); ClientSock.SendPacket(packet1, Marshal.SizeOf(LoginPacket));
} .
.:2. , Encoder.InitEncoding();Encoder.PushInt16(ServerCd);Encoder.PushInt16(UserCount);Encoder.PushSByte(Status);Encoder.SetPakcetDataSize(Protocol.BTSM_NOTICE_SERVER_STATUS_MSG);
Sock.SendPacket(Encoder.GetBuffer(), Encoder.GetPacketBodySize()); struct . . .Decoder.SetBuffer( RecvPacket );byte cGroupNum = Decoder.PopByte();byte cKindNum = Decoder.PopByte();byte cSeqNum = Decoder.PopByte();int iReMindSecTime = Decoder.PopInt32();:3. struct PACKET_LOGIN_RQ : public PACKET_HEAD{ characUserID[ 21 ]; characUserPW[ 21 ];};
22public class CTL_LOGIN_RQ;{ public string acUserID; public string acUserPW;
public void Encoding( EnDecoder Encoder, ushort PacketIndex ) { Encoder.InitEncoding(); Encoder.PushBytes(Encoding.ASCII.GetBytes(acUserID), 0, acUserID.Length, ProtocolDef.MAX_USERID); Encoder.PushBytes(Encoding.ASCII.GetBytes(acUserPW), 0, acUserPW.Length, ProtocolDef.MAX_USERPW); Encoder.SetPacketDataSize(PacketIndex); }
public void Decoding( EnDecoder Decoder ) { Decoder.GetString(out acUserID, ProtocolDef.MAX_USERID); Decoder.GetString(out acUserPW, ProtocolDef.MAX_USERPW); }}C++ packet.h C# struct . XML struct // [[LoginServer ]]// [- CTL_LOGIN_RQ]struct PACKET_LOGIN_RQ : public PACKET_HEAD{characUserID[ 21 ];characUserPW[ 21 ];};3. C# WM_COPYDATA
:.NET WM_COPYDATA
:
URL
http://www.codeproject.com/KB/cs/ipc_wmcopy.aspxhttp://www.codeproject.com/KB/threads/InterprocessCommunicator.aspxhttp://www.codeproject.com/KB/cs/wm_copydata_use.aspx274. C# C++ C++ DLL C++/CLI WrapingC# URL
http://sj21.wo.to/tt/483http://sj21.wo.to/tt/484http://blogs.msdn.com/junfeng/archive/2006/05/20/599434.aspx
DB Tool
DB Data Import
DB Data Export
DB DB DB Tool DB xml DataSet ResultDataSet = new DataSet();string strQuery = "SELECT * FROM " + TableName;
DbCommand cmd = ConnectionInstance.CreateCommand();cmd.CommandText = strQuery;
DataAdapter.SelectCommand = cmd;DataAdapter.Fill(ResultDataSet, strTable);
ResultDataSet.WriteXml(ItemTable.xml);
XML XML
DB
Table http://jacking75.cafe24.com/Tip/TinyXml_SimpleUse.htm
Table XML C++ ..xml DB DataSet ResultDataSet = new DataSet(); string strQuery = "SELECT * FROM " + ;
DataSet ds = new DataSet();ds.ReadXml(XML );
..DataAdapter.Update(dataset, TableName); .( )
( 3 1 2, 2 3 .
40 .
. 41 4
1.
Windows IIS .
2.
100
SharpZibLib ( ) API
string[] Cur_AllFiles = Directory.GetFiles(textBox1.Text, "*.*", SearchOption.AllDirectories);
FileInfo Cur_fileinfo = new FileInfo(CurVerFile);Cur_fileinfo.LastWriteTimeCur_fileinfo.Length46SharpZipLib
SharpZipLib : http://icsharpcode.net/OpenSource/SharpZipLib/Default.aspx
http://dobon.net/vb/dotnet/links/createzipfile.html3.
200 ~ 300
AutoIt API
WebBrowser
webBrowser.Navigate(http://blog.naver.com/jacking75");
WebRequest myWebRequest = WebRequest.Create( );
WebResponse myWebResponse = myWebRequest.GetResponse();
Stream ReceiveStream = myWebResponse.GetResponseStream();StreamReader sr = new StreamReader(ReceiveStream);
WebClient myWebClient = new WebClient();
myStringWebResource = remoteUri + fileName;
myWebClient.DownloadFile( myStringWebResource, fileName);
http://blog.naver.com/jacking75/140054848037 AutoIt
MsgBox( 0, " ", " . " )
; 1.5Sleep( 1500 )
ProcessClose("CQGame.exe")
; 1.5Sleep( 1500 )
; FileDelete( CQGame.exe" )
; FileMove( "New_CQGame.exe", "CQGame.exe", 1 )FileDelete( "New_CQGame.exe" )
; Run( "CQGame.exe" )PostBuilder .NET Framework C# http://www.xenocode.com/Products/Postbuild/
C++C#RubyPython , C++ () .C# . C# .Python Ruby .56C# MSDN : C#, , ADO
MSDNEffective C# : C# 50
C#.LINQ
: Subversion, Trac, CruiseControl.NET
C# , 58