This checks the availability of a server by sending a ping to the given IP address and waiting a certain amount of time for a…
Not all possible characters are suitable for file names. For example path separators cannot be used for file names. This changes any string into a…
The following functions can be used to convert an image object to a byte array (and vise versa). This is often used to store images…
The following code snippet checks if the current user as administrator rights: /// <summary> /// Checks if user has administrator rights /// </summary> public static bool UserIsAdmin() { WindowsIdentity identity = WindowsIdentity.GetCurrent(); WindowsPrincipal principal = new WindowsPrincipal(identity); return principal.IsInRole(WindowsBuiltInRole.Administrator); } If the application requires…
The following C# code changes an image object into an icon. public static Icon ConvertImageToIcon(Image img) { if (img == null) return null; Bitmap square…
The following function changes the size of an image object and optionally changes the ratio of the image or crops the image. Perfectly for creating…