Example #1
0
        public void DeleteGroup(int groupID, MessageDisplay msgdisplay)
        {
            DefaultEmoticonGroup group = m_groups.GetValue(groupID);// m_groups[groupName];

            if (group != null)
            {
                bool error = false;

                if (string.IsNullOrEmpty(group.DirectoryName))
                {
                    msgdisplay.AddError("groupname", "不能删除默认分组");
                }
                else
                {
                    //全部文件监控都关闭然后再删除文件夹, 否则会导致重启 ||  事实证明停止监视也会重启
                    EndWach();
                    foreach (DefaultEmoticonGroup tempgroup in m_groups)
                    {
                        tempgroup.EndWach();
                    }

                    try
                    {
                        Directory.Delete(m_groups.GetValue(groupID).FilePath, true);
                    }
                    catch (Exception ex)
                    {
                        group.BeginWach();
                        msgdisplay.AddError("删除表情出错,错误信息:" + ex.Message);
                        error = true;
                    }

                    if (error == false)
                    {
                        SettingManager.SaveSettings(this);
                        init(group.DirectoryName);
                    }
                    else
                    {
                        foreach (DefaultEmoticonGroup tempgroup in m_groups)
                        {
                            tempgroup.BeginWach();
                        }
                        BeginWach();
                    }
                }
            }
        }
Example #2
0
        public void CreateGroup(int sortorder, string GroupName, MessageDisplay msgdisplay)
        {
            if (GroupName != null && GroupName.Trim() != string.Empty)
            {
                GroupName = GroupName.Trim();
                if (GetEmoticonGroupByName(GroupName) != null)
                {
                    msgdisplay.AddError("groupname", "分组:" + GroupName + " 已经存在");
                }
                else
                {
                    if (Regex.IsMatch(GroupName, "[\\/:\\*\\?\"\\<\\>\\|]+"))
                    {
                        msgdisplay.AddError("分组是以文件夹的形式存在。因此,分组名称里不能包含下列字符:/ : * ? \" < > |");
                    }
                    else
                    {
                        bool error = false;
                        try
                        {
                            Directory.CreateDirectory(IOUtil.JoinPath(this.FaceDirectory, GroupName));
                        }
                        catch (Exception ex)
                        {
                            error = true;
                            msgdisplay.AddError("创建表情分组失败, 可能的原因是: 对 " + this.FaceDirectory + " 无写入权限! 具体错误信息: " + ex.Message);
                        }

                        if (error == false)
                        {
                            init();
                            DefaultEmoticonGroup newGroup = GetEmoticonGroupByName(GroupName);
                            if (newGroup != null)
                            {
                                newGroup.SortOrder = sortorder;
                            }
                            SettingManager.SaveSettings(this);
                        }
                    }
                }
            }
            else
            {
                msgdisplay.AddError("groupname", "分组名称不能为空。");
            }
        }
Example #3
0
 public DefaultEmoticon(DefaultEmoticonGroup group)
 {
     this.Group = group;
 }
Example #4
0
 public DefaultEmoticonCollection(DefaultEmoticonGroup ownerGroup)
 {
     this.OnwerGroup = ownerGroup;
 }