IPAddress[] addresses = Dns.GetHostEntry(Dns.GetHostName()).AddressList;
The code above retrieves the IP addresses for each connected network adapter of the device. The Dns and IPAddress classes belong to the System.Net namespace.
This blog is moved to a new home - https://christianhelle.com
IPAddress[] addresses = Dns.GetHostEntry(Dns.GetHostName()).AddressList;
public class Vibrate
{[DllImport("aygshell.dll")]
static extern int Vibrate(int cvn, IntPtr rgvn, bool fRepeat, uint dwTimeout);
[DllImport("aygshell.dll")]
static extern int VibrateStop();
const uint INFINITE = 0xffffffff;
public static bool Play()
{VibratePlay(0, IntPtr.Zero, true, INFINITE);
}
public static void Stop()
{VibrateStop();
}
}
[DllImport("ossvcs.dll", EntryPoint = "#218")]
static extern int SetSpeakerMode(uint mode);
void EnableSpeakerPhone(){SetSpeakerMode(1);
}
void DisableSpeakerPhone(){SetSpeakerMode(0);
}
public static List<string> GetStorageCards()
{var list = new List<string>();
var root = new DirectoryInfo("\\");
foreach (DirectoryInfo directory in root.GetDirectories())
{if (FileAttributes.Temporary == (directory.Attributes & FileAttributes.Temporary))
list.Add(directory.Name);
}
return list;}
const int KEYEVENTF_KEYPRESS = 0x0000;
const int KEYEVENTF_KEYUP = 0x0002;
[DllImport("coredll.dll")]
static extern void keybd_event(byte bVk, byte bScan, int dwFlags, int dwExtraInfo);
void SendKey(Keys key){ keybd_event((byte) key, 0, KEYEVENTF_KEYPRESS, 0); keybd_event((byte) key, 0, KEYEVENTF_KEYUP, 0);}