static void setTarget() { target = new ServerMetaData(name, address, root, date, datetimeoffset, uptime, version, license, licenseIp, caseSensitive, unicodeEnabled, moveEnabled); }
public void Sync() { try { // new connection for every thread. Perforce.P4.Server server = new Perforce.P4.Server(new Perforce.P4.ServerAddress(options.Server)); Perforce.P4.Repository rep = new Perforce.P4.Repository(server); Perforce.P4.Connection con = rep.Connection; con.UserName = options.User; con.Client = new Perforce.P4.Client(); con.Client.Name = options.ClientSpec; con.Connect(null); Perforce.P4.Credential Creds = con.Login(options.Passwd, null, null); con.InfoResultsReceived += new P4Server.InfoResultsDelegate(con_InfoResultsReceived); con.ErrorReceived += new P4Server.ErrorDelegate(con_ErrorReceived); con.TextResultsReceived += new P4Server.TextResultsDelegate(con_TextResultsReceived); // get server metadata and check version // (using null for options parameter) ServerMetaData p4info = rep.GetServerMetaData(); ServerVersion version = p4info.Version; string release = version.Major; // lets get all the files which need to be synced. SyncFilesCmdOptions syncOpts = new SyncFilesCmdOptions(SyncFilesCmdFlags.None, -1); IList <FileSpec> syncedFiles = con.Client.SyncFiles(syncOpts, FilesToSync.ToArray()); } catch (Exception ex) { System.Console.WriteLine("Perforce error - Thread exiting "); } }
public void GetServerMetaDataTest() { bool unicode = false; string uri = "localhost:6666"; string user = "******"; string pass = string.Empty; string ws_client = "admin_space"; for (int i = 0; i < 2; i++) // run once for ascii, once for unicode { Process p4d = Utilities.DeployP4TestServer(TestDir, 8, unicode); var serverRoot = Utilities.TestServerRoot(TestDir, unicode); Server server = new Server(new ServerAddress(uri)); try { Repository rep = new Repository(server); using (Connection con = rep.Connection) { con.UserName = user; con.Client = new Client(); con.Client.Name = ws_client; bool connected = con.Connect(null); Assert.IsTrue(connected); Assert.AreEqual(con.Status, ConnectionStatus.Connected); #pragma warning disable 612 ServerMetaData s = rep.GetServerMetaData(); #pragma warning restore 612 Assert.IsNotNull(s); if (unicode == true) { Assert.AreEqual(s.UnicodeEnabled, true); } Assert.AreEqual(s.Root, serverRoot); Assert.AreEqual(s.CaseSensitive, false); Assert.AreEqual(s.MoveEnabled, true); } } finally { Utilities.RemoveTestServer(p4d, TestDir); } unicode = !unicode; } }
/// <summary> ///A test for GetServerMetaDatajob076750 ///</summary> public void GetServerMetaDataTestjob076750(bool unicode) { string uri = "localhost:6666"; string user = "******"; string pass = string.Empty; string ws_client = "admin_space"; Process p4d = Utilities.DeployP4TestServer(TestDir, 8, unicode); var serverRoot = Utilities.TestServerRoot(TestDir, unicode); Server server = new Server(new ServerAddress(uri)); try { Repository rep = new Repository(server); using (Connection con = rep.Connection) { con.UserName = user; con.Client = new Client(); con.Client.Name = ws_client; bool connected = con.Connect(null); Assert.IsTrue(connected); Assert.AreEqual(con.Status, ConnectionStatus.Connected); #pragma warning disable 612 ServerMetaData s = rep.GetServerMetaData(); #pragma warning restore 612 Assert.IsNotNull(s); DateTime dt = new DateTime(1, 1, 1, 0, 0, 0); //(1 / 1 / 0001 12:00:00 AM) Assert.AreNotEqual(s.Version.Date, dt); if (unicode == true) { Assert.AreEqual(s.UnicodeEnabled, true); } Assert.AreEqual(s.Root, serverRoot); Assert.AreEqual(s.CaseSensitive, false); Assert.AreEqual(s.MoveEnabled, true); } } finally { Utilities.RemoveTestServer(p4d, TestDir); } }
public void ServerInfoTest() { bool unicode = false; string uri = "localhost:6666"; for (int i = 0; i < 3; i++) // run once for ascii, once for unicode, once // for the security level 3 server { String zippedFile = "a.exe"; if (i == 1) { zippedFile = "u.exe"; } if (i == 2) { zippedFile = "s3.exe"; } Process p4d = Utilities.DeployP4TestServer(TestDir, 10, zippedFile, unicode); Server server = new Server(new ServerAddress(uri)); try { Repository rep = new Repository(server); using (Connection target = rep.Connection) { Assert.AreEqual(target.Status, ConnectionStatus.Disconnected); Assert.AreEqual(target.Server.State, ServerState.Unknown); target.Connect(null); Assert.AreEqual(target.Status, ConnectionStatus.Connected); Assert.AreEqual(target.Server.State, ServerState.Online); ServerMetaData p4info = rep.GetServerMetaData(null); Assert.IsNotNull(p4info); } } finally { Utilities.RemoveTestServer(p4d, TestDir); } unicode = !unicode; } }
private ServerMetaData GetMetaData() { var Meta = new ServerMetaData { AcceptsGuests = Config.MetaAcceptsGuests, AcceptsRegistration = Config.MetaAcceptsRegistration, AccountsInstantlyActivated = Config.MetaAccountsInstantlyActivated, GuestsCanChooseName = Config.MetaGuestsCanChooseName, Language = Config.ServerLanguage, Name = Config.MetaServerName, OperatorWebsiteUrl = Config.MetaWebsiteUrl, OwnerId = Config.MetaOwnerId, RequiredClientVersion = Config.MetaRequiredClientVersion, RequiresAuthentification = Config.MetaRequiresAuthentification, RequiresInvitation = Config.MetaRequiresInvitation }; return(Meta); }