我是 C# 新手,所以感谢您的帮助。我有以下调用 API 的代码。我需要对 URL 值进行编码。现在我不知道该怎么做。我将不胜感激您的帮助。
谢谢你。
private void DeviceDetect_Load(object sender, EventArgs e)
{
var printerQuery = new ManagementObjectSearcher("Select * from Win32_Printer");
foreach (var printer in printerQuery.Get())
{
var name = printer.GetPropertyValue("Name");
var status = printer.GetPropertyValue("Status");
var isDefault = printer.GetPropertyValue("Default");
var isNetworkPrinter = printer.GetPropertyValue("Network");
var description = printer.GetPropertyValue("Description");
var PortName = printer.GetPropertyValue("PortName");
var Location = printer.GetPropertyValue("Location");
var Comment = printer.GetPropertyValue("Comment");
string macAddress = string.Empty;
System.Diagnostics.Process pProcess = new System.Diagnostics.Process();
pProcess.StartInfo.FileName = "arp";
pProcess.StartInfo.Arguments = "-a " + PortName;
pProcess.StartInfo.UseShellExecute …
Run Code Online (Sandbox Code Playgroud)