All pastes #382835 Raw Edit

Mine

public text v1 · immutable
·published 2007-03-05 23:02 UTC
rendered paste body


Start of Setharian buffer: Mon Mar 05 16:29:30 2007

Session Ident: Setharian (~adrian.se@icm3-orange.orange.sk)
[16:16] <Setharian> hope I won't get DCed
[16:17] <Setharian> procedure YNwWorldSocket.ProcessInputBuffer;
[16:17] <Setharian> var
[16:17] <Setharian>   cInPkt: YNwClientPacket;
[16:17] <Setharian>   pPktHeader: PWorldClientHeader;
[16:17] <Setharian>   wSize: UInt16;
[16:17] <Setharian> begin
[16:17] <Setharian>   repeat
[16:17] <Setharian>     if fRecvBuffer.DataSize < 6 then Exit;
[16:17] <Setharian>     if not fHeaderDone then
[16:17] <Setharian>     begin
[16:17] <Setharian>       if fKeySet then HdrXorDecrypt(fHdrXorData, fRecvBuffer[fRecvBuffer.ReadPosition]);
[16:17] <Setharian>       fHeaderDone := True;
[16:17] <Setharian>     end;
[16:17] <Setharian>     pPktHeader := PWorldClientHeader(fRecvBuffer[fRecvBuffer.ReadPosition]);
[16:17] <Setharian>     if not fKeySet then
[16:17] <Setharian>     begin
[16:17] <Setharian>       if (pPktHeader^.Opcode <> CMSG_AUTH_SESSION) and
[16:17] <Setharian>          (pPktHeader^.Opcode <> CMSG_PING) then
[16:17] <Setharian>       begin
[16:17] <Setharian>         fRecvBuffer.Clear;
[16:17] <Setharian>         Disconnect;
[16:17] <Setharian>         Exit;
[16:17] <Setharian>       end;
[16:17] <Setharian>     end;
[16:17] <Setharian>     wSize := EndianSwap16(pPktHeader^.Size) + 2;
[16:17] <Setharian>     if fRecvBuffer.DataSize >= wSize then
[16:17] <Setharian>     begin
[16:17] <Setharian>       cInPkt := YNwClientPacket.Create(fRecvBuffer, wSize);
[16:18] <Setharian>       try
[16:18] <Setharian>         ProcessOpCode(cInPkt, cInPkt.Header^.Opcode);
[16:18] <Setharian>       finally
[16:18] <Setharian>         cInPkt.Free;
[16:18] <Setharian>         fHeaderDone := False;
[16:18] <Setharian>       end;
[16:18] <Setharian>     end else Exit;
[16:18] <Setharian>   until False;
[16:18] <Setharian> end;
[16:18] <Setharian> that's all
[16:18] <Setharian> it should look something like this, but in C# styke
[16:18] <Setharian> style*
[16:20] <Iron_Mala> hum... it your "PacketIn" stuff
[16:20] <Iron_Mala> hum
[16:20] <Iron_Mala> i will save it and take a look
[16:20] <Iron_Mala> it is Delphi?
[16:20] <Iron_Mala> :) long time i dont see it
[16:20] <Iron_Mala> :)
[16:21] <Setharian> yes
[16:22] <Setharian> fRecvBuffer - circular buffer containg all the incoming data
[16:22] <Setharian> I guess you have an equivalent for that
[16:22] <Setharian> that packet_something :)
[16:22] <Setharian> I closed the bastebin, so not sure how it was named
[16:22] <Setharian> it performed .MarshalRead or something
[16:24] <Iron_Mala> http://pastebin.ca/382565
[16:24] <Iron_Mala> i think is it
[16:24] <Setharian> wth did you add to the sources
[16:24] <Setharian> they are 4-times as big
[16:24] <Setharian> as last time I've checked
[16:24] <Setharian> yeah, right
[16:24] <Setharian> packetbuffer
[16:26] <Setharian> I'll paste you one more thing
[16:26] <Setharian> a class decl
[16:26] <Setharian> in Delphi
[16:26] <Setharian> actually in C++ it would be similiar
[16:26] <Iron_Mala> ok
[16:26] <Setharian> but that is what I miss
[16:26] <Setharian> in C#
[16:26] <Setharian>   TTickGenerator = class(TBaseInterfacedObject)
[16:26] <Setharian>     private
[16:26] <Setharian>       fThreads: array of TTickThreadHandle;
[16:26] <Setharian>       fSleepTimeDefault: UInt32;
[16:26] <Setharian>       fTerminated: Longbool;
[16:27] <Setharian>       fLock: TReaderWriterLock;
[16:27] <Setharian>       fEventMap: TStrPtrHashMap;
[16:27] <Setharian>       fDisabledEventCount: Int32;
[16:27] <Setharian>       fOnEventRegister: TEventRegisterEvent;
[16:27] <Setharian>       fOnEventUnregister: TEventUnregisterEvent;
[16:27] <Setharian>       fOnEventError: TEventExceptionEvent;
[16:27] <Setharian>       function SpawnThread(ExGroup: Int32; SleepTime: UInt32): TTickThreadHandle;
[16:27] <Setharian>       function GetEventCount: Int32;
[16:27] <Setharian>       function GetDisEventCount: Int32;
[16:27] <Setharian>       procedure ClearEventList;
[16:27] <Setharian>       function GenerateEventName(Event: TEventHandle): string;
[16:27] <Setharian>       function LookupEventByName(const Name: string): TEventHandle;
[16:27] <Setharian>       function LookupThreadInfoByExGroup(ExGroup: Int32): TTickThreadHandle;
[16:27] <Setharian>       function GetThreadHandle(Index: Int32): TTickThreadHandle;
[16:27] <Setharian>       procedure Execute(Thread: TThreadHandle);
[16:27] <Setharian>       procedure DoOnEventRegister(Event: TEventHandle);
[16:27] <Setharian>       procedure DoOnEventUnregister(Event: TEventHandle);
[16:27] <Setharian>       procedure DoOnEventException(Event: TEventHandle; ExcObject: Exception);
[16:27] <Setharian>     public
[16:27] <Setharian>       constructor Create(SleepTime: UInt32);
[16:27] <Setharian>       destructor Destroy; override;
[16:27] <Setharian>       procedure StartActivity;
[16:27] <Setharian>       procedure StopActivity;
[16:27] <Setharian>       { Creates and registers a new event using the params specified. }
[16:27] <Setharian>       function RegisterEvent(Method: TTimedMethod; WaitTime: Int32; Repeats: Int32;  Name: 
  string = '';
[16:27] <Setharian>         ActivationDelay: Int32 = 0; Flags: TEventFlags = [];
[16:27] <Setharian>         ExecutionGroup: Int32 = TICK_EXGROUP_DEFAULT; Priority: TEventPriority = epNormal): 
  TEventHandle;
[16:27] <Setharian>       function RegisterEventEx(Method: TTimedMethod; WaitTime: Int32; Repeats: Int32;
[16:27] <Setharian>         HandleClass: TEventHandleClass; Name: string = ''; ActivationDelay: Int32 = 0; Flags: 
  TEventFlags = [];
[16:27] <Setharian>         ExecutionGroup: Int32 = TICK_EXGROUP_DEFAULT; Priority: TEventPriority = epNormal): 
  TEventHandle;
[16:27] <Setharian>       { Unregisters and destroys an event identified by a valid handle. }
[16:27] <Setharian>       procedure UnregisterEvent(Event: TEventHandle);
[16:27] <Setharian>       procedure Terminate;
[16:28] <Setharian>       property Events[const Name: string]: TEventHandle read LookupEventByName;
[16:28] <Setharian>       property EventCount: Int32 read GetEventCount;
[16:28] <Setharian>       property DisabledEvents: Int32 read GetDisEventCount;
[16:28] <Setharian>       property Terminated: Longbool read fTerminated;
[16:28] <Setharian>       property Threads[ExecutionGroup: Int32]: TTickThreadHandle read GetThreadHandle;
[16:28] <Setharian>       property OnEventRegister: TEventRegisterEvent read fOnEventRegister write 
  fOnEventRegister;
[16:28] <Setharian>       property OnEventUnregister: TEventUnregisterEvent read fOnEventUnregister write 
  fOnEventUnregister;
[16:28] <Setharian>       property OnEventException: TEventExceptionEvent read fOnEventError write fOnEventError;
[16:28] <Setharian>     end; 
[16:28] <Setharian> well
[16:28] <Setharian> as you may have noticed
[16:28] <Setharian> all the declaration is without implementation
[16:28] <Setharian> so you just see
[16:28] <Setharian> the method prototypes
[16:28] <Setharian> all at one place
[16:28] <Iron_Mala> ok
[16:28] <Setharian> that's just soooo nice and clean
End of Setharian buffer    Mon Mar 05 16:29:30 2007