using System; using System.Text; using System.Collections; using System.Collections.Specialized; namespace P4API { /// <summary> /// Subclass of Hashtable which provides additional methods for dealing with the psuedo-arrays passed from Perforce. /// </summary> public class P4Record : Hashtable { internal P4Record(Hashtable sd) { foreach (string s in sd.Keys) { base.Add(s, sd[s]); } } public string[] getArray(string var) { ArrayList al = new ArrayList(); int i = 0; while(base.ContainsKey(var + i.ToString())) { al.Add(base[var + i.ToString()]); i++; } return (string[])al.ToArray(typeof(string[])); } public void setArray(string Variable, string[] ArrayValues) { //First clear any variables that may already exist int i = 0; while (base.ContainsKey(Variable + i.ToString())) { base.Remove(Variable + i.ToString()); i++; } // Now add in all that we need i = 0; foreach (string val in ArrayValues) { base.Add(Variable + i.ToString(), val); i++; } } public override string ToString() { StringBuilder sb = new StringBuilder(); foreach (string s in this.Keys) { sb.Append(String.Format("{0} : {1}\n", s, this[s])); } return sb.ToString(); } /// <summary> /// If the underlying P4BaseRecordSet has a key of "var1", it is assumed that this variable is an array, and will return as such. /// </summary> public bool isArray(string var) { throw new System.NotImplementedException(); } } }
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#8 | 5830 | Shawn Hladky | P4.Net: reorg to support release branches | ||
#7 | 5824 | Shawn Hladky | P4.Net: Last bits of documentation for 0.9 | ||
#6 | 5812 | Shawn Hladky | P4.Net: More documentation. | ||
#5 | 5798 | Shawn Hladky |
P4.Net... still not ready for beta Added license to all files Added several doc files Misc bugs |
||
#4 | 5636 | Shawn Hladky |
1. Added test harness framework, and some initial tests 2. Fixed many bugs (oddly enough identified by the unit tests) 3. Fixes so will build 1.1 Framework (and build batch files actually work) 4. Pathetic attempt at documentation |
||
#3 | 5438 | Shawn Hladky | refactoring, and documentation code | ||
#2 | 5433 | Shawn Hladky | P4.Net More refactoring | ||
#1 | 5432 | Shawn Hladky | Refactoring step 2 -- rename source files | ||
//guest/shawn_hladky/P4.Net/src/P4API/P4ResultRecord.cs | |||||
#4 | 5431 | Shawn Hladky |
Refactoring... step 1. |
||
#3 | 5411 | Shawn Hladky | WIP -- forms are working now. | ||
#2 | 5373 | Shawn Hladky | P4.Net: Still WIP, but some things starting to work | ||
#1 | 5362 | Shawn Hladky | Chipping away at the API changes |