Exemplo n.º 1
0
        public static Atom CreateNew(String name)
        {
            if (String.IsNullOrWhiteSpace(name))
            {
                throw new ArgumentNullException(nameof(name));
            }

            var existingLocalAtom = LocalAtomNativeMethods.FindAtom(name);

            if (existingLocalAtom == 0)
            {
                existingLocalAtom = LocalAtomNativeMethods.AddAtom(name);
                if (existingLocalAtom == 0)
                {
                    throw new Win32Exception();
                }

                return(new LocalAtom(existingLocalAtom, name));
            }

            throw new Win32Exception();
        }