コード例 #1
0
        bool CheckEntryName(string name, int limit)
        {
            limit--;

            if (name == string.Empty)
            {
                MessageBox.Show(this, DevStringTable.Instance["Error:CSFEmptyName"], DevStringTable.Instance["GUI:Error"], MessageBoxButtons.OK, MessageBoxIcon.Error);
                return(false);
            }

            int times = 0;

            for (int i = 0; i < fileData.Count; i++)
            {
                for (int j = 0; j < fileData[i].data.Count; j++)
                {
                    if (CaseInsensitiveStringComparer.Compare(fileData[i].data[j].name, name))
                    {
                        times++;
                        if (times > limit)
                        {
                            MessageBox.Show(this, DevStringTable.Instance["Error:CSFDupName"].Replace("{0}", name), DevStringTable.Instance["GUI:Error"], MessageBoxButtons.OK, MessageBoxIcon.Error);
                            return(false);
                        }
                    }
                }
            }
            return(true);
        }
コード例 #2
0
            public IDictionary<string, string> ToStringList(Encoding enc = null)
            {
                enc = enc ?? Encoding.UTF8;

                var comparer = new CaseInsensitiveStringComparer();

                return this.Parameters
                           .OrderBy(x => x.Key, comparer)
                           .ToDictionary(x => x.Key,
                                         x => enc.GetString(x.Value),
                                         comparer);
            }
コード例 #3
0
 public static string[] CheckNone(string[] arr)
 {
     if (arr.Length == 1)
     {
         if (CaseInsensitiveStringComparer.Compare(arr[0], none))
         {
             return(Utils.EmptyStringArray);
         }
         return(arr);
     }
     return(arr);
 }
コード例 #4
0
 public static string CheckNoneNull(string str)
 {
     if (str == null)
     {
         return(null);
     }
     if (CaseInsensitiveStringComparer.Compare(str, none))
     {
         return(null);
     }
     return(str);
 }
コード例 #5
0
 public static bool IsNone(string str)
 {
     return(CaseInsensitiveStringComparer.Compare(str, none));
 }