Exemplo n.º 1
0
        public PermissionEnum Permissions = PermissionEnum.None; // set of assigned permissions

/// <summary>
/// Get the external group or user name corresponding to an internal name
/// </summary>
/// <returns></returns>

        public string GetExternalName()
        {
            string name = AssignedTo;

            if (IsGroup)
            {
                UserGroup g = UserGroups.LookupInternalName(name);
                if (g != null)
                {
                    name = g.ExternalName;
                }
            }

            else             // user name
            {
                DictionaryMx userDict = DictionaryMx.Get("UserName");
                if (userDict != null && userDict.LookupDefinition(name) != null)
                {
                    string   userInfoString = userDict.LookupDefinition(name);
                    UserInfo ui             = UserInfo.Deserialize(userInfoString);
                    name = ui.FullNameReversed;
                }
            }

            return(name);
        }
Exemplo n.º 2
0
/// <summary>
/// Get a list of all of the words in a dictionary
/// </summary>
/// <param name="dictName"></param>
/// <returns></returns>

        public static List <string> GetWords(
            string dictName,
            bool removeDuplicates)
        {
            DictionaryMx dict = DictionaryMx.Get(dictName);

            if (dict == null)
            {
                return(null);
            }
            if (!removeDuplicates)
            {
                return(dict.Words);
            }

            List <string>    words = new List <string>();
            HashSet <string> set   = new HashSet <string>();

            foreach (string word in dict.Words)
            {
                if (set.Contains(word.ToLower()))
                {
                    continue;
                }

                words.Add(word);
                set.Add(word.ToLower());
            }

            return(words);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Lookup the definition for a word
        /// </summary>
        /// <param name="dictName"></param>
        /// <param name="word"></param>
        /// <returns></returns>

        public static string LookupDefinition(
            string dictName,
            string word)
        {
            DictionaryMx d = DictionaryMx.Get(dictName);

            if (d == null)
            {
                return(null);
            }
            return(d.LookupDefinition(word));
        }