Extract Image From Pancard PDF and Print
This blog is vary help full for Print Pancard bhamasah card or adhar card or etc card from pdf
Program.cs
using System;
using System.Collections.Generic;
using System.Data;
using System.IO;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Pancard
{
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new MainForm());
}
}
}
MainForm.cs
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Drawing.Imaging;
using System.Drawing.Printing;
using System.IO;
using System.Linq;
using System.Management;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Pancard
{
public partial class MainForm : Form
{
public Image FrontImage;
public Image BackImage;
public int count = 0;
private string PrinterBrand = "";
private Image[] SelectedCollection = new Image[2];
public int PageCounter = 0;
private static string PrinterStatus;
private static bool IsWorkOffline;
private static string PrinterName;
private PrintDocument pdoc;
public MainForm()
{
InitializeComponent();
}
private void MainForm_Load(object sender, EventArgs e)
{
LoadFormDetails();
}
private void LoadFormDetails()
{
}
private void btnBrowse_Click(object sender, EventArgs e)
{
try
{
this.btnReset_Click((object)null, (EventArgs)null);
OpenFileDialog openFileDialog1 = new OpenFileDialog();
openFileDialog1.InitialDirectory = "C:\\\\";
openFileDialog1.FileName = "";
openFileDialog1.Filter = "Adobe PDF Files (*.pdf)|*.pdf;";
OpenFileDialog openFileDialog2 = openFileDialog1;
if (openFileDialog2.ShowDialog() == DialogResult.OK)
this.txtFilePath.Text = openFileDialog2.FileName;
openFileDialog2.Dispose();
}
catch (Exception ex)
{
}
}
private void btnReset_Click(object sender, EventArgs e)
{
}
private bool getPrinterStatus(string str)
{
Exception exception;
try
{
string str1 = str;
if (str == "Fargo")
str1 = "DTC1000 Card Printer%' OR Name LIKE '%DTC1250%' OR Name LIKE '%DTC400%' OR Name LIKE '%c30%' OR Name LIKE '%c50";
else if (str == "Smart")
str1 = "Smart-50 Card Printer%' OR Name LIKE '%SMART-50 Card Printer%' OR Name LIKE '%Smart%' OR Name LIKE '%SMART";
ManagementObjectCollection objectCollection = new ManagementObjectSearcher(string.Format("SELECT * from Win32_Printer WHERE Name LIKE '%{0}%'", (object)str1)).Get();
ManagementObjectCollection.ManagementObjectEnumerator enumerator = objectCollection.GetEnumerator();
int count = objectCollection.Count;
for (int index = 0; index <= count; ++index)
{
try
{
ManagementObject current = (ManagementObject)enumerator.Current;
PrinterStatus = ((ushort)current.Properties["PrinterStatus"].Value).ToString();
IsWorkOffline = (bool)current.Properties["WorkOffline"].Value;
PrinterName = (string)current.Properties["Name"].Value;
if (!IsWorkOffline)
break;
}
catch (Exception ex)
{
exception = ex;
}
enumerator.MoveNext();
}
return PrinterStatus == "3" && !IsWorkOffline;
}
catch (Exception ex)
{
exception = ex;
int num = (int)MessageBox.Show("first connect " + str + " printer than proceed.");
return false;
}
}
private void paperprint()
{
try
{
this.SelectedCollection[0] = this.picCardFront.Image;
this.SelectedCollection[1] = this.picCardBack.Image;
PrintDialog printDialog = new PrintDialog();
this.pdoc = new PrintDocument();
PrinterSettings printerSettings = new PrinterSettings();
Font font = new Font("Courier New", 15f);
PaperSize paperSize = new PaperSize("Custom", 342, 212);
printerSettings.DefaultPageSettings.PaperSize = paperSize;
printerSettings.PrinterName = PrinterName;
printerSettings.Duplex = Duplex.Horizontal;
this.pdoc.DefaultPageSettings.Landscape = true;
printDialog.Document = this.pdoc;
printDialog.Document.DefaultPageSettings.PaperSize = paperSize;
if (printerSettings.CanDuplex)
printerSettings.Duplex = Duplex.Horizontal;
printDialog.PrinterSettings = printerSettings;
PageCounter = 0;
if (this.PrinterBrand == "Paper_Printer")
{
this.picCardFront.Image.Save("\\cardFront.jpg");
this.picCardBack.Image.Save("\\cardBack.jpg");
}
else if (printerSettings.IsValid)
{
this.pdoc.PrintPage += new PrintPageEventHandler(this.pdoc_PrintPage);
this.pdoc.PrinterSettings = printerSettings;
this.pdoc.Print();
printDialog.Dispose();
}
else
{
int num = (int)MessageBox.Show("Please select installed and ready printer");
}
}
catch (Exception ex)
{
}
}
private void pdoc_PrintPage(object sender, PrintPageEventArgs e)
{
try
{
if (this.PageCounter == 0)
{
Bitmap bitmap2 = new Bitmap(Application.StartupPath + "\\Front.bmp");
e.Graphics.DrawImage((Image)bitmap2, 0, 0, 345, 212);
++this.PageCounter;
e.HasMorePages = true;
}
else
{
}
}
catch (Exception ex)
{
}
}
public Image CropImage(float X, float Y)
{
try
{
Rectangle srcRect = new Rectangle(new Point(Convert.ToInt32(Convert.ToDecimal(X) * Convert.ToDecimal(4.17) - 0), 2816 - Convert.ToInt32(Convert.ToDecimal(Y) * Convert.ToDecimal(4.19) - 0)), new Size(Convert.ToInt32(new Decimal(1091) - 0), Convert.ToInt32(new Decimal(696) - 0)));
Rectangle srcRect2 = new Rectangle(new Point(0, 0), new Size(Convert.ToInt32(new Decimal(600)), Convert.ToInt32(new Decimal(696))));
Bitmap bitmap1 = Image.FromFile("Untitled.bmp") as Bitmap;
Bitmap bitmap2 = new Bitmap(600, 400);
using (Graphics graphics = Graphics.FromImage((Image)bitmap2))
graphics.DrawImage((Image)bitmap1, srcRect2, srcRect, GraphicsUnit.Pixel);
bitmap1.Dispose();
return (Image)bitmap2;
}
catch (Exception ex)
{
return (Image)null;
}
}
public void ExtractPage(string sourcePdfPath, string outputPdfPath, int pageNumber, string password)
{
iTextSharp.text.pdf.PdfReader reader = null;
iTextSharp.text.Document document = null;
iTextSharp.text.pdf.PdfCopy copy = null;
iTextSharp.text.pdf.PdfImportedPage iPage = null;
try
{
iTextSharp.text.pdf.PdfReader.unethicalreading = true;
reader = new iTextSharp.text.pdf.PdfReader(sourcePdfPath, Encoding.ASCII.GetBytes(password));
document = new iTextSharp.text.Document(reader.GetPageSizeWithRotation(pageNumber));
copy = new iTextSharp.text.pdf.PdfCopy(document, new System.IO.FileStream(outputPdfPath, System.IO.FileMode.Create));
document.Open();
iPage = copy.GetImportedPage(reader, pageNumber);
copy.AddPage(iPage);
document.Close();
reader.Close();
}
catch (Exception exception)
{
MessageBox.Show(exception.Message);
throw exception;
}
}
public void GenerateSinglePageThumbnail()
{
try
{
int i = 300;
int y = 300;
Spire.Pdf.PdfDocument doc = new Spire.Pdf.PdfDocument();
doc.LoadFromFile(Application.StartupPath + "/Untitled.pdf");
System.Drawing.Image bmp = doc.SaveAsImage(0, i, y);
bmp.Save("Untitled.bmp", ImageFormat.Bmp);
}
catch (Exception ex) { }
}
private void btnPreview_Click(object sender, EventArgs e)
{
try
{
int i = 0;
this.ExtractPage(this.txtFilePath.Text, "Untitled.pdf", 1, txtPass.Text);
this.GenerateSinglePageThumbnail();
foreach (KeyValuePair<Image, ImageParams> image in PdfImageExtractor.ExtractImages(this.txtFilePath.Text, 1, txtPass.Text))
{
i++;
if (image.Key.Height == 338 && image.Key.Width == 1025)
{
if (this.count == 0)
{
this.FrontImage = this.CropImageNSDL(image.Value.X, image.Value.Y, "F");
++this.count;
}
if (this.count == 1)
{
this.BackImage = this.CropImageNSDL(image.Value.X, image.Value.Y, "B");
this.count = 0;
break;
}
}
}
this.picCardFront.Image = FrontImage;
this.picCardBack.Image = BackImage;
this.picCardFront.Image.Save(Application.StartupPath + "\\Front.bmp");
this.picCardBack.Image.Save(Application.StartupPath + "\\Back.bmp");
}
catch (Exception ex)
{
}
}
public System.Drawing.Image CropImageNSDL(float X, float Y, string type)
{
try
{
int x = Convert.ToInt32(Convert.ToDecimal(X) * Convert.ToDecimal(4.17)) + 20;
if (type == "B")
x = Convert.ToInt32(Convert.ToDecimal(X) * Convert.ToDecimal(4.17)) + 1030;
int y = Convert.ToInt32(Convert.ToDecimal(Y) * Convert.ToDecimal(4.19)) + 2579;
System.Drawing.Rectangle srcRect = new System.Drawing.Rectangle(new Point(x, y), new Size(Convert.ToInt32(new Decimal(990)), Convert.ToInt32(new Decimal(624))));
if (type == "B")
srcRect = new System.Drawing.Rectangle(new Point(x, y), new Size(Convert.ToInt32(new Decimal(990)), Convert.ToInt32(new Decimal(624))));
System.Drawing.Rectangle srcRect1 = new System.Drawing.Rectangle(new Point(0, 0), new Size(Convert.ToInt32(txtPrintWidth.Text), Convert.ToInt32(new Decimal(624))));
Bitmap bitmap1 = System.Drawing.Image.FromFile("Untitled.bmp") as Bitmap;
Bitmap bitmap2 = new Bitmap(srcRect.Width, srcRect.Height);
using (Graphics graphics = Graphics.FromImage((System.Drawing.Image)bitmap2))
graphics.DrawImage((System.Drawing.Image)bitmap1, srcRect1, srcRect, GraphicsUnit.Pixel);
bitmap1.Dispose();
return (System.Drawing.Image)bitmap2;
}
catch (Exception ex)
{
return (System.Drawing.Image)null;
}
}
private void cmbPrinter_SelectedIndexChanged(object sender, EventArgs e)
{
{
if (this.cmbPrinter.SelectedIndex == 8 || this.cmbPrinter.Text == "Others")
{
string[] strArray = new string[7]
{
"Magicard",
"Orphicard",
"Zebra",
"Evolis",
"DataCard",
"DTC",
"Smart"
};
cmbPaperPrinter.Items.Clear();
this.cmbPrinter.Visible = true;
foreach (string printer in System.Drawing.Printing.PrinterSettings.InstalledPrinters)
{
this.cmbPaperPrinter.Items.Add(printer);
}
this.cmbPaperPrinter.Visible = true;
this.lblOtherPrinter.Visible = true;
}
else
{
this.cmbPaperPrinter.Visible = false;
this.lblOtherPrinter.Visible = false;
}
}
}
private void btnPrint_Click(object sender, EventArgs e)
{
getPrinterStatus(cmbPaperPrinter.Text);
paperprint();
}
private void btnClose_Click(object sender, EventArgs e)
{
Application.Exit();
}
private void btnSavePrinter_Click(object sender, EventArgs e)
{
}
private void textBox1_TextChanged(object sender, EventArgs e)
{
}
private void cmbPaperPrinter_SelectedIndexChanged(object sender, EventArgs e)
{
txtPrintWidth.Text = "990";
}
private void button2_Click(object sender, EventArgs e)
{
}
}
}
ImageParams.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Pancard
{
public class ImageParams
{
public string Extension { get; private set; }
public float width { get; private set; }
public float height { get; private set; }
public float X { get; private set; }
public float Y { get; private set; }
public ImageParams(string Extension, float width, float height, float X, float Y)
{
this.Extension = Extension;
this.width = width;
this.height = height;
this.X = X;
this.Y = Y;
}
}
}
PdfImageExtractor.cs
using iTextSharp.text.pdf;
using iTextSharp.text.pdf.parser;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Pancard
{
public static class PdfImageExtractor
{
public static bool PageContainsImages(string filename, int pageNumber)
{
using (PdfReader reader = new PdfReader(filename))
{
ImageRenderListener imageRenderListener;
new PdfReaderContentParser(reader).ProcessContent<ImageRenderListener>(pageNumber, imageRenderListener = new ImageRenderListener());
return imageRenderListener.Images.Count > 0;
}
}
public static Dictionary<string, Image> ExtractImages(string filename)
{
Dictionary<string, Image> dictionary = new Dictionary<string, Image>();
using (PdfReader reader = new PdfReader(filename))
{
PdfReaderContentParser readerContentParser = new PdfReaderContentParser(reader);
for (int pageNumber = 1; pageNumber <= reader.NumberOfPages; ++pageNumber)
{
ImageRenderListener imageRenderListener;
readerContentParser.ProcessContent<ImageRenderListener>(pageNumber, imageRenderListener = new ImageRenderListener());
int num = 1;
if (imageRenderListener.Images.Count > 0)
{
Console.WriteLine("Found {0} images on page {1}.", (object)imageRenderListener.Images.Count, (object)pageNumber);
foreach (KeyValuePair<Image, ImageParams> image in imageRenderListener.Images)
{
dictionary.Add(string.Format("{0}_Page_{1}_Image_{2}{3}", (object)System.IO.Path.GetFileNameWithoutExtension(filename), (object)pageNumber.ToString("D4"), (object)num.ToString("D4"), (object)image.Value), image.Key);
++num;
}
}
}
return dictionary;
}
}
public static Dictionary<Image, ImageParams> ExtractImages(string filename, int pageNumber, string password)
{
Dictionary<Image, ImageParams> dictionary = new Dictionary<Image, ImageParams>();
ImageRenderListener imageRenderListener;
new PdfReaderContentParser(new PdfReader(filename, Encoding.ASCII.GetBytes(password))).ProcessContent<ImageRenderListener>(pageNumber, imageRenderListener = new ImageRenderListener());
int num = 1;
if (imageRenderListener.Images.Count > 0)
{
Console.WriteLine("Found {0} images on page {1}.", (object)imageRenderListener.Images.Count, (object)pageNumber);
foreach (KeyValuePair<Image, ImageParams> image in imageRenderListener.Images)
{
dictionary.Add(image.Key, image.Value);
++num;
}
}
return dictionary;
}
public static Dictionary<Image, ImageParams> ExtractImages(string filename, int pageNumber)
{
Dictionary<Image, ImageParams> dictionary = new Dictionary<Image, ImageParams>();
ImageRenderListener imageRenderListener;
new PdfReaderContentParser(new PdfReader(filename)).ProcessContent<ImageRenderListener>(pageNumber, imageRenderListener = new ImageRenderListener());
int num = 1;
if (imageRenderListener.Images.Count > 0)
{
Console.WriteLine("Found {0} images on page {1}.", (object)imageRenderListener.Images.Count, (object)pageNumber);
foreach (KeyValuePair<Image, ImageParams> image in imageRenderListener.Images)
{
dictionary.Add(image.Key, image.Value);
++num;
}
}
return dictionary;
}
}
}
Pancard.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
namespace Pancard
{
class IOFile
{
// Set fields
private string _onTopOption;
private string _WrapOption;
private string _AutoSave;
private string _XMLPath;
private string _ErrHap = null;
// Set properties
public string onTopOption
{
get { return _onTopOption; } // 'Always on top' checkbox option on the main form
set { _onTopOption = value; }
}
public string WrapOption
{
get { return _WrapOption; } // 'Word wrap' option in the file menu of the main form
set { _WrapOption = value; }
}
public string AutoSave
{
get { return _AutoSave; } // 'Word wrap' option in the file menu of the main form
set { _AutoSave = value; }
}
public string XMLPath
{
get { return _XMLPath; } // XML path
set { _XMLPath = value; }
}
public string ErrHap
{
get { return _ErrHap; } // 'Always on top' checkbox option on the main form
set { _ErrHap = value; }
}
// IOFile Constructor
public IOFile()
{
string[] SettingItem = new string[4]; // there are only 4 lines to read from the ini file
// set the array for that number
int i = 0;
// Scripting.FileSystemObject FsO = new Scripting.FileSystemObject(); // Create instance of FileSystemObject class
if (File.Exists("app.ini") == true) // Check if 'app.ini' is exist
{
try
{
using (StreamReader sr = new StreamReader("app.ini")) // Open 'app.ini' file
{
do
{
SettingItem[i] = Convert.ToString(sr.ReadLine());
if (SettingItem[i] == null) { break; } // Set the array values
i++;
}
while (i < SettingItem.Length);
if (i < (SettingItem.Length - 1)) // If 'while' loop ends early
// there could be a file error
{
_ErrHap = "1";
}
else // set property values
{
_onTopOption = SettingItem[0]; // a1
_WrapOption = SettingItem[1]; // b1
_AutoSave = SettingItem[2]; // c1
_XMLPath = SettingItem[3]; // d1
}
}
}
catch (Exception exc)
{
_ErrHap = exc.Message; // other file read error
}
}
else
{
_ErrHap = "2"; // 'app.ini' file is not exist
}
}
public void createINIFile()
{
try
{
using (StreamWriter sw = new StreamWriter("app.ini")) // Open 'app.ini' to write
{
sw.WriteLine(_onTopOption);
sw.WriteLine(_WrapOption);
sw.WriteLine(_AutoSave);
sw.WriteLine(_XMLPath);
}
}
catch (Exception exc)
{
_ErrHap = exc.Message; // error when try to write to a file
}
}
}
}
ImageRenderListener .cs
using iTextSharp.text.pdf;
using iTextSharp.text.pdf.parser;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Pancard
{
internal class ImageRenderListener : IRenderListener
{
private Dictionary<Image, ImageParams> images = new Dictionary<Image, ImageParams>();
public Dictionary<Image, ImageParams> Images
{
get
{
return this.images;
}
}
public void BeginTextBlock()
{
}
public void EndTextBlock()
{
}
public void RenderImage(ImageRenderInfo renderInfo)
{
PdfImageObject image = renderInfo.GetImage();
image.GetDictionary();
Matrix imageCtm = renderInfo.GetImageCTM();
float width = imageCtm[0];
float height = imageCtm[4];
float X = imageCtm[6];
float Y = imageCtm[7];
PdfName pdfName = (PdfName)image.Get(PdfName.FILTER);
if (pdfName == null)
return;
Image drawingImage = image.GetDrawingImage();
string Extension = ".";
if (pdfName == PdfName.DCTDECODE)
Extension += PdfImageObject.ImageBytesType.JPG.FileExtension;
else if (pdfName == PdfName.JPXDECODE)
Extension += PdfImageObject.ImageBytesType.JP2.FileExtension;
else if (pdfName == PdfName.FLATEDECODE)
Extension += PdfImageObject.ImageBytesType.PNG.FileExtension;
else if (pdfName == PdfName.LZWDECODE)
Extension += PdfImageObject.ImageBytesType.CCITT.FileExtension;
this.Images.Add(drawingImage, new ImageParams(Extension, width, height, X, Y));
}
public void RenderText(TextRenderInfo renderInfo)
{
}
}
}
FingerPrint.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Cryptography;
using System.Text;
using System.Threading.Tasks;
namespace Pancard
{
public class FingerPrint
{
private static string fingerPrint = string.Empty;
public static string Value()
{
if (string.IsNullOrEmpty(fingerPrint))
{
fingerPrint = GetHash("CPU >> " + cpuId() + "\nBIOS >> " + biosId() + "\nBASE >> " + baseId() + "\nVIDEO >> " + videoId());
}
return fingerPrint;
}
public static string Value2()
{
if (string.IsNullOrEmpty(fingerPrint))
{
fingerPrint = GetHash("CPU >> " + cpuId() + "\nBIOS >> " + biosId() + "\nBASE >> " + baseId()
+ "\nDISK >> " + diskId() + "\nVIDEO >> " + videoId());
}
return fingerPrint;
}
public static string Value1()
{
if (string.IsNullOrEmpty(fingerPrint))
{
fingerPrint = GetHash("CPU >> " + cpuId() + "\nBIOS >> " + biosId() + "\nBASE >> " + baseId()
+ "\nDISK >> " + diskId() + "\nVIDEO >> " + videoId() + "\nMAC >> " + macId()
);
}
return fingerPrint;
}
private static string GetHash(string s)
{
MD5 sec = new MD5CryptoServiceProvider();
ASCIIEncoding enc = new ASCIIEncoding();
byte[] bt = enc.GetBytes(s);
return GetHexString(sec.ComputeHash(bt));
}
private static string GetHexString(byte[] bt)
{
string s = string.Empty;
for (int i = 0; i < bt.Length; i++)
{
byte b = bt[i];
int n, n1, n2;
n = (int)b;
n1 = n & 15;
n2 = (n >> 4) & 15;
if (n2 > 9)
s += ((char)(n2 - 10 + (int)'A')).ToString();
else
s += n2.ToString();
if (n1 > 9)
s += ((char)(n1 - 10 + (int)'A')).ToString();
else
s += n1.ToString();
if ((i + 1) != bt.Length && (i + 1) % 2 == 0) s += "-";
}
return s;
}
#region Original Device ID Getting Code
//Return a hardware identifier
private static string identifier(string wmiClass, string wmiProperty, string wmiMustBeTrue)
{
string result = "";
System.Management.ManagementClass mc = new System.Management.ManagementClass(wmiClass);
System.Management.ManagementObjectCollection moc = mc.GetInstances();
foreach (System.Management.ManagementObject mo in moc)
{
if (mo[wmiMustBeTrue].ToString() == "True")
{
//Only get the first one
if (result == "")
{
try
{
result = mo[wmiProperty].ToString();
break;
}
catch
{
}
}
}
}
return result;
}
//Return a hardware identifier
private static string identifier(string wmiClass, string wmiProperty)
{
string result = "";
System.Management.ManagementClass mc = new System.Management.ManagementClass(wmiClass);
System.Management.ManagementObjectCollection moc = mc.GetInstances();
foreach (System.Management.ManagementObject mo in moc)
{
//Only get the first one
if (result == "")
{
try
{
result = mo[wmiProperty].ToString();
break;
}
catch
{
}
}
}
return result;
}
public static string cpuId()
{
//Uses first CPU identifier available in order of preference
//Don't get all identifiers, as very time consuming
string retVal = identifier("Win32_Processor", "UniqueId");
if (retVal == "") //If no UniqueID, use ProcessorID
{
retVal = identifier("Win32_Processor", "ProcessorId");
if (retVal == "") //If no ProcessorId, use Name
{
retVal = identifier("Win32_Processor", "Name");
if (retVal == "") //If no Name, use Manufacturer
{
retVal = identifier("Win32_Processor", "Manufacturer");
}
//Add clock speed for extra security
retVal += identifier("Win32_Processor", "MaxClockSpeed");
}
}
return retVal;
}
//BIOS Identifier
public static string biosId()
{
return identifier("Win32_BIOS", "Manufacturer")
+ identifier("Win32_BIOS", "SMBIOSBIOSVersion")
+ identifier("Win32_BIOS", "IdentificationCode")
+ identifier("Win32_BIOS", "SerialNumber")
+ identifier("Win32_BIOS", "ReleaseDate")
+ identifier("Win32_BIOS", "Version");
}
//Main physical hard drive ID
public static string diskId()
{
return identifier("Win32_DiskDrive", "Model")
+ identifier("Win32_DiskDrive", "Manufacturer")
+ identifier("Win32_DiskDrive", "Signature")
+ identifier("Win32_DiskDrive", "TotalHeads");
}
//Motherboard ID
public static string baseId()
{
return identifier("Win32_BaseBoard", "Model")
+ identifier("Win32_BaseBoard", "Manufacturer")
+ identifier("Win32_BaseBoard", "Name")
+ identifier("Win32_BaseBoard", "SerialNumber");
}
//Primary video controller ID
public static string videoId()
{
return identifier("Win32_VideoController", "DriverVersion")
+ identifier("Win32_VideoController", "Name");
}
//First enabled network card ID
public static string macId()
{
return identifier("Win32_NetworkAdapterConfiguration", "MACAddress", "IPEnabled");
}
#endregion
}
}