Beispiel #1
0
        /*----------------------3.0------------------------------*/

        public bool RenameEmoticonShortcut(int userID, int groupID, List <int> emoticonIDs, List <string> newShortcuts)
        {
            //替换|为空
            string sortcurString = StringUtil.Join(newShortcuts);

            if (sortcurString.IndexOf('"') > -1 || sortcurString.IndexOf('<') > -1 || sortcurString.IndexOf('>') > -1)
            {
                ThrowError(new InvalidEmoticonShortcutError());
                return(false);
            }

            Dictionary <string, int> temp = new Dictionary <string, int>(new DictionaryIgnoreCase());

            for (int i = 0; i < newShortcuts.Count; i++)
            {
                newShortcuts[i] = newShortcuts[i].Replace("|", "");
                if (newShortcuts[i].Length > 15)
                {
                    newShortcuts[i] = newShortcuts[i].Substring(0, 15);
                }
                if (!temp.ContainsKey(newShortcuts[i]))
                {
                    temp.Add(newShortcuts[i], emoticonIDs[i]);
                }
                else
                {
                    if (newShortcuts[i] != string.Empty)
                    {
                        return(false);
                    }
                }
            }

            bool status = EmoticonDao.Instance.RenameEmoticonShortcut(userID, groupID, emoticonIDs, newShortcuts);

            //缓存更新
            if (status)
            {
                foreach (int i in emoticonIDs)
                {
                    CacheUtil.Remove(string.Format(cacheKey_Emoticon, i));
                }
                RemoveCacheByGroup(userID, groupID);
            }
            return(status);
        }