<?xml version="1.0" encoding="utf-8" ?> <Library> <Namespace name="P4API"> <Forms> <remarks> Forms are the things that pop-up in an editor when run from a command line. In P4.Net (and most other Perforce APIs), you do not need to parse/format the text manually. Instead, you can get/set the fields using the Fields and ArrayFields collections. <P>The following is a list of common form commands:</P> <list> <li>client</li> <li>branch</li> <li>label</li> <li>job</li> <li>user</li> <li>group</li> <li>protect</li> <li>triggers</li> <li>branch</li> </list> <P> When fetching or saving a form, <B>do not use the '-o' and '-i' flags</B>. P4.Net will automatically include them. </P> <example> The following example updates the current client. It changes the client root, and adds a line to the view. <code language="C#" escaped="true"> P4Connection p4 = new P4Connection(); p4.Connect(); P4Form MyClient = p4.Fetch_Form("client"); //Change the root and properties MyClient["Root"] = @"C:\p4\P4.NetClient"; MyClient["Description"] = "Created from P4.Net!"; //Fetch the clientName (for use later in building the view spec). string clientName = MyClient["Client"]; // Build a new array, that has one more element than the current view string[] NewView = new string[MyClient.ArrayFields["View"].Length + 1]; // Copy the existing view lines to the new array MyClient.ArrayFields["View"].CopyTo(NewView,0); // Set the new view line NewView[NewView.Length - 1] = string.Format("//depot/newpath/... //{0}/newpath/...", clientName); MyClient.ArrayFields["View"] = NewView; // Save the form P4UnParsedRecordSet MyResult = p4.Save_Form(MyClient); p4.Disconnect(); </code> </example> </remarks> </Forms> </Namespace> </Library>
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#4 | 5830 | Shawn Hladky | P4.Net: reorg to support release branches | ||
#3 | 5824 | Shawn Hladky | P4.Net: Last bits of documentation for 0.9 | ||
#2 | 5812 | Shawn Hladky | P4.Net: More documentation. | ||
#1 | 5798 | Shawn Hladky |
P4.Net... still not ready for beta Added license to all files Added several doc files Misc bugs |