// // Copyright 2010 Jacob Gladish. All rights reserved. // // Redistribution and use in source and binary forms, with or without modification, are // permitted provided that the following conditions are met: // // 1. Redistributions of source code must retain the above copyright notice, this list of // conditions and the following disclaimer. // // 2. Redistributions in binary form must reproduce the above copyright notice, this list // of conditions and the following disclaimer in the documentation and/or other materials // provided with the distribution. // // THIS SOFTWARE IS PROVIDED BY Jacob Gladish ``AS IS'' AND ANY EXPRESS OR IMPLIED // WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND // FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> OR // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR // SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON // ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF // ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // // The views and conclusions contained in the software and documentation are those of the // authors and should not be interpreted as representing official policies, either expressed // or implied, of <copyright holder>. // #pragma once #using <mscorlib.dll> #include "Error_m.h" #include "ClientUser_m.h" #include "KeepAlive_m.h" using namespace System; using namespace System::Runtime::InteropServices; System::String* ToDotNetString( const StrPtr& p ); namespace p4dn { __gc public class ClientApi { public: ClientApi(); ~ClientApi(); void SetTrans( int output, int content, int fnames, int dialog ); void SetProtocol( String *p, String *v ); void SetProtocolV( String *p ); String* GetProtocol( String *v ); void Init( p4dn::Error *e ); void Run( String* func, p4dn::ClientUser *ui ); int Final( p4dn::Error *e ); int Dropped(); void RunTag( String* func, p4dn::ClientUser *ui ); void WaitTag( p4dn::ClientUser *ui ); void SetCharset( String* c ); void SetClient( String* c ); void SetCwd( String* c ); void SetHost( String* c ); void SetLanguage( String* c ); void SetPassword( String* c ); void SetPort( String* c ); void SetUser( String* c ); void SetArgv( String* args[] ); void SetBreak( p4dn::KeepAlive *keepAlive ); void DefineCharset( String* c, p4dn::Error* e ); void DefineClient( String* c, p4dn::Error* e ); void DefineHost( String* c, p4dn::Error* e ); void DefineLanguage( String* c, p4dn::Error* e ); void DefinePassword( String* c, p4dn::Error* e ); void DefinePort( String* c, p4dn::Error* e ); void DefineUser( String* c, p4dn::Error* e ); __property String* get_Charset() { return ToDotNetString(_clientApi->GetCharset()); } __property String* get_Client() { return ToDotNetString(_clientApi->GetClient()); } __property String* get_Cwd() { return ToDotNetString(_clientApi->GetCwd()); } __property String* get_Host() { return ToDotNetString(_clientApi->GetHost()); } __property String* get_Language() { return ToDotNetString(_clientApi->GetLanguage()); } __property String* get_Os() { return ToDotNetString(_clientApi->GetOs()); } __property String* get_Password() { return ToDotNetString(_clientApi->GetPassword()); } __property String* get_Port() { return ToDotNetString(_clientApi->GetPort()); } __property String* get_User() { return ToDotNetString(_clientApi->GetUser()); } private: ::ClientApi* _clientApi; private: //================================================================ // // class for callbacks into the KeepAlive interfaces // __nogc class KeepAliveDelegate : ::KeepAlive { private: // handle to managed KeepAlive class int _keepAliveHandle; public: KeepAliveDelegate( int handle ) : _keepAliveHandle(handle) { } ~KeepAliveDelegate() { GCHandle h = GCHandle::op_Explicit( IntPtr(_keepAliveHandle) ); h.Free(); } virtual int IsAlive() { GCHandle h = GCHandle::op_Explicit( IntPtr(_keepAliveHandle) ); p4dn::KeepAlive* keepAlive = static_cast< p4dn::KeepAlive* >( h.Target ); bool b = keepAlive->IsAlive(); return ( b ? 1 : 0 ); } }; KeepAliveDelegate* _keepAliveDelegate; }; }
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#3 | 7712 | Jacob Gladish |
Removed license. Need to ensure proper assignment first. |
||
#2 | 7704 | Jacob Gladish | Updated license to freebsd | ||
#1 | 3787 | Jacob Gladish | initial code submission |