Class MaxiCodeCodetextMode3
Namespace: Aspose.BarCode.ComplexBarcode
Assembly: Aspose.BarCode.dll (25.1.0)
คลาสสำหรับการเข้ารหัสและถอดรหัสข้อความที่ฝังอยู่ในโค้ด MaxiCode สำหรับโหมด 3
public class MaxiCodeCodetextMode3 : MaxiCodeStructuredCodetext, IComplexCodetext
การสืบทอด
object ← MaxiCodeCodetext ← MaxiCodeStructuredCodetext ← MaxiCodeCodetextMode3
การใช้งาน
สมาชิกที่สืบทอด
MaxiCodeStructuredCodetext.GetConstructedCodetext(), MaxiCodeStructuredCodetext.InitFromString(string), MaxiCodeStructuredCodetext.Equals(object), MaxiCodeStructuredCodetext.GetHashCode(), MaxiCodeStructuredCodetext.PostalCode, MaxiCodeStructuredCodetext.CountryCode, MaxiCodeStructuredCodetext.ServiceCategory, MaxiCodeStructuredCodetext.SecondMessage, MaxiCodeCodetext.GetMode(), MaxiCodeCodetext.GetConstructedCodetext(), MaxiCodeCodetext.InitFromString(string), MaxiCodeCodetext.GetBarcodeType(), MaxiCodeCodetext.MaxiCodeEncodeMode, MaxiCodeCodetext.ECIEncoding, object.GetType(), object.MemberwiseClone(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()
ตัวอย่าง
ตัวอย่างนี้แสดงวิธีการเข้ารหัสและถอดรหัสข้อความโค้ด MaxiCode สำหรับโหมด 3
//โหมด 3 พร้อมข้อความที่สองตามมาตรฐาน
MaxiCodeCodetextMode3 maxiCodeCodetext = new MaxiCodeCodetextMode3();
maxiCodeCodetext.PostalCode = "B1050";
maxiCodeCodetext.CountryCode = 056;
maxiCodeCodetext.ServiceCategory = 999;
MaxiCodeStandartSecondMessage maxiCodeStandartSecondMessage = new MaxiCodeStandartSecondMessage();
maxiCodeStandartSecondMessage.Message = "ข้อความทดสอบ";
maxiCodeCodetext.SecondMessage = maxiCodeStandartSecondMessage;
using (ComplexBarcodeGenerator complexGenerator = new ComplexBarcodeGenerator(maxiCodeCodetext))
{
complexGenerator.GenerateBarCodeImage();
}
//โหมด 3 พร้อมข้อความที่สองแบบมีโครงสร้าง
MaxiCodeCodetextMode3 maxiCodeCodetext = new MaxiCodeCodetextMode3();
maxiCodeCodetext.PostalCode = "B1050";
maxiCodeCodetext.CountryCode = 056;
maxiCodeCodetext.ServiceCategory = 999;
MaxiCodeStructuredSecondMessage maxiCodeStructuredSecondMessage = new MaxiCodeStructuredSecondMessage();
maxiCodeStructuredSecondMessage.Add("634 ALPHA DRIVE");
maxiCodeStructuredSecondMessage.Add("PITTSBURGH");
maxiCodeStructuredSecondMessage.Add("PA");
maxiCodeStructuredSecondMessage.Year = 99;
maxiCodeCodetext.SecondMessage = maxiCodeStructuredSecondMessage;
using (ComplexBarcodeGenerator complexGenerator = new ComplexBarcodeGenerator(maxiCodeCodetext))
{
complexGenerator.GenerateBarCodeImage();
}
//การถอดรหัสข้อความโค้ดดิบพร้อมข้อความที่สองตามมาตรฐาน
using (BarCodeReader reader = new BarCodeReader(@"c:\test.png", DecodeType.MaxiCode))
{
foreach (BarCodeResult result in reader.ReadBarCodes())
{
MaxiCodeCodetext resultMaxiCodeCodetext = ComplexCodetextReader.TryDecodeMaxiCode(result.Extended.MaxiCode.MaxiCodeMode, result.CodeText);
if (resultMaxiCodeCodetext is MaxiCodeCodetextMode3){
MaxiCodeCodetextMode3 maxiCodeStructuredCodetext = (MaxiCodeCodetextMode3)resultMaxiCodeCodetext;
Console.WriteLine("ประเภทบาร์โค้ด: " + maxiCodeStructuredCodetext.PostalCode);
Console.WriteLine("โหมด MaxiCode: " + maxiCodeStructuredCodetext.CountryCode);
Console.WriteLine("ข้อความบาร์โค้ด: " + maxiCodeStructuredCodetext.ServiceCategory);
if (maxiCodeStructuredCodetext.SecondMessage is MaxiCodeStandartSecondMessage){
MaxiCodeStandartSecondMessage secondMessage = (MaxiCodeStandartSecondMessage)maxiCodeStructuredCodetext.SecondMessage;
Console.WriteLine("ข้อความ: " + secondMessage.Message);
}
}
}
}
//การถอดรหัสข้อความโค้ดดิบพร้อมข้อความที่สองแบบมีโครงสร้าง
using (BarCodeReader reader = new BarCodeReader(@"c:\test.png", DecodeType.MaxiCode))
{
foreach (BarCodeResult result in reader.ReadBarCodes())
{
MaxiCodeCodetext resultMaxiCodeCodetext = ComplexCodetextReader.TryDecodeMaxiCode(result.Extended.MaxiCode.MaxiCodeMode, result.CodeText);
if (resultMaxiCodeCodetext is MaxiCodeCodetextMode3){
MaxiCodeCodetextMode3 maxiCodeStructuredCodetext = (MaxiCodeCodetextMode3)resultMaxiCodeCodetext;
Console.WriteLine("ประเภทบาร์โค้ด: " + maxiCodeStructuredCodetext.PostalCode);
Console.WriteLine("โหมด MaxiCode: " + maxiCodeStructuredCodetext.CountryCode);
Console.WriteLine("ข้อความบาร์โค้ด: " + maxiCodeStructuredCodetext.ServiceCategory);
if (maxiCodeStructuredCodetext.SecondMessage is MaxiCodeStructuredSecondMessage){
MaxiCodeStructuredSecondMessage secondMessage = (MaxiCodeStructuredSecondMessage)maxiCodeStructuredCodetext.SecondMessage;
Console.WriteLine("ข้อความ:");
foreach (var identifier in secondMessage.Identifiers){
Console.WriteLine(identifier);
}
}
}
}
}
ตัวสร้าง
MaxiCodeCodetextMode3()
public MaxiCodeCodetextMode3()
วิธีการ
GetMode()
รับโหมด MaxiCode
public override MaxiCodeMode GetMode()
คืนค่า
โหมด MaxiCode