- /*
- * P4.Net *
- Copyright (c) 2007 Shawn Hladky
- Permission is hereby granted, free of charge, to any person obtaining a copy of this software
- and associated documentation files (the "Software"), to deal in the Software without
- restriction, including without limitation the rights to use, copy, modify, merge, publish,
- distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the
- Software is furnished to do so, subject to the following conditions:
- The above copyright notice and this permission notice shall be included in all copies or
- substantial portions of the Software.
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
- BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
- #pragma once
- #include "Error_m.h"
- #include "ClientUser_m.h"
- #include "KeepAlive_m.h"
- #include "ClientUserDelegate.h"
- #include "Spec_m.h"
- using namespace System::Runtime::InteropServices;
- namespace p4dn {
- //================================================================
- //
- // class for callbacks into the KeepAlive interfaces
- //
- class KeepAliveDelegate : public ::KeepAlive
- {
- private:
- // handle to managed KeepAlive class
- gcroot<p4dn::KeepAlive^> _KeepAlive;
- public:
- KeepAliveDelegate()
- {
- _KeepAlive = NULL;
- }
- void SetKeepAlive(gcroot<p4dn::KeepAlive^> mKeepAlive)
- {
- _KeepAlive = mKeepAlive;
- }
- ~KeepAliveDelegate()
- {
- // Free the GC refererence
- delete _KeepAlive;
- }
- int IsAlive() {
- if ((p4dn::KeepAlive^)_KeepAlive == nullptr){
- return 1;
- }
- bool b = _KeepAlive->IsAlive();
- return ( b ? 1 : 0 );
- }
- };
- public ref class ClientApi : public System::IDisposable
- {
- public:
- ClientApi();
- ~ClientApi();
- void __clrcall SetTrans( int output, int content, int fnames, int dialog );
- void __clrcall SetProtocol( System::String^ p, System::String^ v );
- void __clrcall SetProtocolV( System::String^ p );
- System::String^ __clrcall GetProtocol( System::String^ v );
- void __clrcall Init( p4dn::Error^ e );
- void __clrcall Run(System::String^ func, p4dn::ClientUser^ ui );
- int __clrcall Final(p4dn::Error^ e );
- int __clrcall Dropped();
- p4dn::Error^ __clrcall CreateError();
- p4dn::Spec^ __clrcall CreateSpec(System::String^ specDef);
- void __clrcall SetVar(System::String^ var, System::String^ val);
- void __clrcall SetTag();
- void __clrcall SetCharset( System::String^ c );
- void __clrcall SetClient( System::String^ c );
- void __clrcall SetCwd( System::String^ c );
- void __clrcall SetHost( System::String^ c );
- void __clrcall SetLanguage( System::String^ c );
- void __clrcall SetPassword( System::String^ c );
- void __clrcall SetPort( System::String^ c );
- void __clrcall SetProg( System::String^ c );
- void __clrcall SetVersion( System::String^ c );
- void __clrcall SetTicketFile( System::String^ c );
- void __clrcall SetUser( System::String^ c );
- void __clrcall SetArgv( array<System::String^>^ args );
- void __clrcall SetBreak( p4dn::KeepAlive^ keepAlive );
- void __clrcall SetMaxResults(int maxResults);
- void __clrcall SetMaxScanRows(int maxScanRows);
- void __clrcall SetMaxLockTime(int maxLockTime);
- void __clrcall DefineCharset( System::String^ c, p4dn::Error^ e );
- void __clrcall DefineClient( System::String^ c, p4dn::Error^ e );
- void __clrcall DefineHost( System::String^ c, p4dn::Error^ e );
- void __clrcall DefineLanguage( System::String^ c, p4dn::Error^ e );
- void __clrcall DefinePassword( System::String^ c, p4dn::Error^ e );
- void __clrcall DefinePort( System::String^ c, p4dn::Error^ e );
- void __clrcall DefineUser( System::String^ c, p4dn::Error^ e );
- property System::String^ Charset
- {
- System::String^ get()
- {
- return gcnew System::String(_clientApi->GetCharset().Text());
- }
- }
- property System::String^ Client
- {
- System::String^ get()
- {
- return gcnew System::String(_clientApi->GetClient().Text());
- }
- }
- property System::String^ Cwd
- {
- System::String^ get()
- {
- return gcnew System::String(_clientApi->GetCwd().Text());
- }
- }
- property System::String^ Host
- {
- System::String^ get()
- {
- return gcnew System::String(_clientApi->GetHost().Text());
- }
- }
- property System::String^ Language
- {
- System::String^ get()
- {
- return gcnew System::String(_clientApi->GetLanguage().Text());
- }
- }
- property System::String^ Os
- {
- System::String^ get()
- {
- return gcnew System::String(_clientApi->GetOs().Text());
- }
- }
- property System::String^ Password
- {
- System::String^ get()
- {
- return gcnew System::String(_clientApi->GetPassword().Text());
- }
- }
- property System::String^ Port
- {
- System::String^ get()
- {
- return gcnew System::String(_clientApi->GetPort().Text());
- }
- }
- property System::String^ User
- {
- System::String^ get()
- {
- return gcnew System::String(_clientApi->GetUser().Text());
- }
- }
- property System::Text::Encoding^ Encoding
- {
- System::Text::Encoding^ get()
- {
- return _encoding;
- }
- }
- private:
- ::ClientApi* __clrcall getClientApi();
- void __clrcall CleanUp();
- ::ClientApi* _clientApi;
- System::Text::Encoding^ _encoding;
- bool _Disposed;
- KeepAliveDelegate* _keepAliveDelegate;
- };
- }
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#1 | 7608 | Sergey Klibanov | Making a sandbox of p4dn to vendor-drop to my work machine | 15 years ago | |
//guest/shawn_hladky/P4.Net/main/src/p4dn/ClientApi_m.h | |||||
#10 | 6457 | Shawn Hladky | P4.Net: Added form_save overload to allow arbitrary arguments (primarily for -u flag on su...bmitted changelists) Added unit tests for Resolve workflow. Still need work on this and test partially fails. Updated some internal data structures to use generics Added documentation comments « |
17 years ago | |
#9 | 6387 | Shawn Hladky |
P4.net: Upgrade to C++/CLI. Changes merged from Jim Gomes. |
17 years ago | |
#8 | 6386 | Shawn Hladky | P4.Net: Optimized connections by not reconnecting between tagged/untagged transitions. | 17 years ago | |
#7 | 6238 | Shawn Hladky | P4.Net: More work on callback interface. Run and RunUnparsed now use the callback... interface under the covers. « |
17 years ago | |
#6 | 6102 | Shawn Hladky | P4.Net: Documentation. Fixed SetTicketFile bug. Added form processing with Sp...ecDef. Stubbed-out code for launching external merge tool, but is disabled since it's too difficult to use. « |
17 years ago | |
#5 | 5915 | Shawn Hladky | p4.net Fixed diff2 bug. Re-worked array field logic More unit tests Organized P4Connecti...on w/ #region blocks, and moved methods around « |
18 years ago | |
#4 | 5902 | Shawn Hladky |
P4.net. More unit tests and bug fixes |
18 years ago | |
#3 | 5878 | Shawn Hladky | P4.Net: 1.0, support for raw spec processing. Update copyright. Fix bu...ild script. Bugs found along the way. « |
18 years ago | |
#2 | 5838 | Shawn Hladky | P4.Net: WIP support for unicode server | 18 years ago | |
#1 | 5830 | Shawn Hladky | P4.Net: reorg to support release branches | 18 years ago | |
//guest/shawn_hladky/P4.Net/src/p4dn/ClientApi_m.h | |||||
#3 | 5798 | Shawn Hladky | P4.Net... still not ready for beta Added license to all files Added several doc fi...les Misc bugs « |
18 years ago | |
#2 | 5373 | Shawn Hladky | P4.Net: Still WIP, but some things starting to work | 19 years ago | |
#1 | 5348 | Shawn Hladky | Re-organizing, for the improved API | 19 years ago | |
//guest/shawn_hladky/PerforceDotNet/p4dn/ClientApi_m.h | |||||
#3 | 5064 | Shawn Hladky | WIP -- Added ability to parse forms. Added new tester application. ** not ready for huma...n consumption, needs more review and testing. « |
20 years ago | |
#2 | 4545 | Shawn Hladky | Several Fixes: Updated solution to Visual Studio 2003 Implemented InputData Implemente...d OutPutBinary Changed ClientAPI and Error objects to implement the IDisposable interface to improve Garbage Collection Changed header files so you don't need to add #pragma once to the p4 api headers. Refactored the ClientUserDelagate class Fixed a few minor memory leaks « |
21 years ago | |
#1 | 4328 | Shawn Hladky | Branching from //guest/jacob_gladish/PerforceDotNet/... | 21 years ago | |
//guest/jacob_gladish/PerforceDotNet/p4dn/ClientApi_m.h | |||||
#1 | 3787 | Jacob Gladish | initial code submission | 21 years ago |