public static Atom FromExisting([NotNull] String name) { if (String.IsNullOrWhiteSpace(name)) { throw new ArgumentNullException(nameof(name)); } var atomId = LocalAtomNativeMethods.FindAtom(name); if (atomId == 0) { throw new Win32Exception(); } return(new LocalAtom(atomId, name)); }
public static String GetAtomName(UInt16 atomId) { if (atomId == 0) { throw new ArgumentOutOfRangeException(nameof(atomId)); } var buffer = new StringBuilder(1024); var result = LocalAtomNativeMethods.GetAtomName(atomId, buffer, buffer.Capacity); if (result == 0) { throw new Win32Exception(); } return(buffer.ToString()); }
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(); }
protected override void DeleteAtom(UInt16 atomid) { LocalAtomNativeMethods.DeleteAtom(atomid); }