예제 #1
0
 /// <summary>
 /// Test to see if the StringList is null or empty (has no elements)
 /// </summary>
 /// <param name="s"></param>
 /// <returns></returns>
 public static bool IsNullOrEmpy(StringList s)
 {
     return((s == null) || (s.Count <= 0));
 }
예제 #2
0
파일: Group.cs 프로젝트: perforce/p4api.net
        /// <summary>
        /// Read the fields from the tagged output of a group command
        /// </summary>
        /// <param name="objectInfo">Tagged output from the 'user' command</param>
        public void FromGroupCmdTaggedOutput(TaggedObject objectInfo)
        {
            _baseForm = new FormBase();

            _baseForm.SetValues(objectInfo);

            if (objectInfo.ContainsKey("Group"))
            {
                Id = objectInfo["Group"];
            }

            if (objectInfo.ContainsKey("MaxResults"))
            {
                int v = -1;
                int.TryParse(objectInfo["MaxResults"], out v);
                MaxResults = v;
            }

            if (objectInfo.ContainsKey("MaxScanRows"))
            {
                int v = -1;
                int.TryParse(objectInfo["MaxScanRows"], out v);
                MaxScanRows = v;
            }

            if (objectInfo.ContainsKey("MaxLockTime"))
            {
                int v = -1;
                int.TryParse(objectInfo["MaxLockTime"], out v);
                MaxLockTime = v;
            }

            if (objectInfo.ContainsKey("MaxOpenFiles"))
            {
                int v = -1;
                int.TryParse(objectInfo["MaxOpenFiles"], out v);
                MaxOpenFiles = v;
            }

            if (objectInfo.ContainsKey("Timeout"))
            {
                int v = -1;
                int.TryParse(objectInfo["Timeout"], out v);
                TimeOut = v;
            }

            if (objectInfo.ContainsKey("PasswordTimeout"))
            {
                int v = -1;
                int.TryParse(objectInfo["PasswordTimeout"], out v);
                PasswordTimeout = v;
            }
            String key = "Users0";

            if (objectInfo.ContainsKey(key))
            {
                int idx = 1;
                UserNames = new StringList();
                while (objectInfo.ContainsKey(key))
                {
                    UserNames.Add(objectInfo[key]);
                    key = String.Format("Users{0}", idx++);
                }
            }
            key = "Owners0";
            if (objectInfo.ContainsKey(key))
            {
                int idx = 1;
                OwnerNames = new StringList();
                while (objectInfo.ContainsKey(key))
                {
                    OwnerNames.Add(objectInfo[key]);
                    key = String.Format("Owners{0}", idx++);
                }
            }
            key = "Subgroups0";
            if (objectInfo.ContainsKey(key))
            {
                int idx = 1;
                SubGroups = new StringList();
                while (objectInfo.ContainsKey(key))
                {
                    SubGroups.Add(objectInfo[key]);
                    key = String.Format("Subgroups{0}", idx++);
                }
            }
        }