BarcodeLib/Symbologies/Code39.cs
(开头部分) 10KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
using System;
using System.Collections.Generic;
using System.Text;
namespace BarcodeLib
{
class Code39 : BarcodeCommon, IBarcode
{
private System.Collections.Hashtable C39_Code = new System.Collections.Hashtable(); //is initialized by init_Code39()
private System.Collections.Hashtable ExtC39_Translation = new System.Collections.Hashtable();
private bool _AllowExtended = false;
/// <summary>
/// Encodes with Code39.
/// </summary>
/// <param name="input">Data to encode.</param>
public Code39(string input)
{
Raw_Data = input;
}//Code39
/// <summary>
/// Encodes with Code39.
/// </summary>
/// <param name="input">Data to encode.</param>
/// <param name="AllowExtended">Allow Extended Code 39 (Full Ascii mode).</param>
public Code39(string input, bool AllowExtended)
{
Raw_Data = input;
_AllowExtended = AllowExtended;
}
/// <summary>
/// Encode the raw data using the Code 39 algorithm.
/// </summary>
private string Encode_Code39()
{
this.init_Code39();
this.init_ExtendedCode39();
string strFormattedData = "*" + Raw_Data.Replace("*", "") + "*";
if (_AllowExtended)
InsertExtendedCharsIfNeeded(ref strFormattedData);
this.FormattedData = strFormattedData;
string result = "";
foreach (char c in this.FormattedData)
{
try
{
result += C39_Code[c].ToString();
result += "0";//whitespace
}//try
catch
{
if (_AllowExtended)
throw new Exception("EC39-1: Invalid data.");
else
后面还有 182 行代码,解锁后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。