This is a Code help to deploy user control to EP server automatically. You can get hints here to implement in your customization.
xSession session = new xSession();
int pointerSize = 0;
; pointerSize = System.IntPtr::get_Size();
if (session.clientKind() != ClientType::Client &&pointerSize != 4)
return SysEPDeployment::getSharepointTemplatePathDotNet();
return SysEPDeployment::getSharepointTemplatePathWin32();