/// <summary> /// Determine if a character can be represented in a given codeset /// </summary> /// <param name="CharAscii">character to check for</param> /// <param name="currcs">codeset context to test</param> /// <returns>true if the codeset contains a representation for the ASCII character</returns> public static bool CharCompatibleWithCodeset(int CharAscii, CodeSet currcs) { CodeSetAllowed csa = CodesetAllowedForChar(CharAscii); return csa==CodeSetAllowed.CodeAorB || (csa==CodeSetAllowed.CodeA && currcs==CodeSet.CodeA) || (csa==CodeSetAllowed.CodeB && currcs==CodeSet.CodeB); }
public static bool CharCompatibleWithCodeset(int CharAscii, CodeSet currcs) { Code128Code.CodeSetAllowed codeSetAllowed = Code128Code.CodesetAllowedForChar(CharAscii); int arg_23_0; if (codeSetAllowed != Code128Code.CodeSetAllowed.CodeAorB && (codeSetAllowed != Code128Code.CodeSetAllowed.CodeA || currcs != CodeSet.CodeA)) { if (codeSetAllowed != Code128Code.CodeSetAllowed.CodeB || currcs != CodeSet.CodeB) { arg_23_0 = 0; return arg_23_0 != 0; } } arg_23_0 = 1; return arg_23_0 != 0; }
public static int[] CodesForChar(int CharAscii, int LookAheadAscii, ref CodeSet CurrCodeSet) { int num = -1; bool flag = !Code128Code.CharCompatibleWithCodeset(CharAscii, CurrCodeSet); bool flag2; if (flag) { flag2 = (LookAheadAscii != -1 && !Code128Code.CharCompatibleWithCodeset(LookAheadAscii, CurrCodeSet)); if (flag2) { switch ((int )CurrCodeSet) { case 0: num = 100; CurrCodeSet = CodeSet.CodeB; break; case 1: num = 101; CurrCodeSet = CodeSet.CodeA; break; } } else { num = 98; } } flag2 = (num != -1); int[] result; if (flag2) { result = new int[] { num, Code128Code.CodeValueForChar(CharAscii) }; } else { result = new int[] { Code128Code.CodeValueForChar(CharAscii) }; } return result; }
/// <summary> /// Get the Code128 code value(s) to represent an ASCII character, with /// optional look-ahead for length optimization /// </summary> /// <param name="charAscii">The ASCII value of the character to translate</param> /// <param name="lookAheadAscii">The next character in sequence (or -1 if none)</param> /// <param name="currentCodeSet">The current codeset, that the returned codes need to follow; /// if the returned codes change that, then this value will be changed to reflect it</param> /// <returns>An array of integers representing the codes that need to be output to produce the /// given character</returns> public static int[] CodesForChar(int charAscii, int lookAheadAscii, ref CodeSet currentCodeSet) { int[] result; var shifter = -1; if (!CharCompatibleWithCodeset(charAscii, currentCodeSet)) { // if we have a lookahead character AND if the next character is ALSO not compatible if ((lookAheadAscii != -1) && !CharCompatibleWithCodeset(lookAheadAscii, currentCodeSet)) { // we need to switch code sets switch (currentCodeSet) { case CodeSet.CodeA: shifter = CCodeB; currentCodeSet = CodeSet.CodeB; break; case CodeSet.CodeB: shifter = CCodeA; currentCodeSet = CodeSet.CodeA; break; } } else { // no need to switch code sets, a temporary SHIFT will suffice shifter = CShift; } } if (shifter != -1) { result = new int[2]; result[0] = shifter; result[1] = CodeValueForChar(charAscii); } else { result = new int[1]; result[0] = CodeValueForChar(charAscii); } return result; }
/// <summary> /// Transform the string into integers representing the Code128 codes /// necessary to represent it /// </summary> /// <param name="AsciiData">String to be encoded</param> /// <returns>Code128 representation</returns> private int[] StringToCode128(string AsciiData) { // turn the string into ascii byte data byte[] asciiBytes = Encoding.ASCII.GetBytes(AsciiData); // decide which codeset to start with Code128Code.CodeSetAllowed csa1 = asciiBytes.Length > 0 ? Code128Code.CodesetAllowedForChar(asciiBytes[0]) : Code128Code.CodeSetAllowed.CodeAorB; Code128Code.CodeSetAllowed csa2 = asciiBytes.Length > 0 ? Code128Code.CodesetAllowedForChar(asciiBytes[1]) : Code128Code.CodeSetAllowed.CodeAorB; CodeSet currcs = GetBestStartSet(csa1, csa2); // set up the beginning of the barcode System.Collections.ArrayList codes = new System.Collections.ArrayList(asciiBytes.Length + 3); // assume no codeset changes, account for start, checksum, and stop codes.Add(Code128Code.StartCodeForCodeSet(currcs)); // add the codes for each character in the string for (int i = 0; i < asciiBytes.Length; i++) { int thischar = asciiBytes[i]; int nextchar = asciiBytes.Length > (i + 1) ? asciiBytes[i + 1] : -1; codes.AddRange(Code128Code.CodesForChar(thischar, nextchar, ref currcs)); } // calculate the check digit int checksum = (int)(codes[0]); for (int i = 1; i < codes.Count; i++) { checksum += i * (int)(codes[i]); } codes.Add(checksum % 103); codes.Add(Code128Code.StopCode()); int[] result = codes.ToArray(typeof(int)) as int[]; return(result); }
public static int StartCodeForCodeSet(CodeSet cs) { return (cs == CodeSet.CodeA) ? 103 : 104; }
public static bool CharCompatibleWithCodeset(int CharAscii, CodeSet currcs) { CodeSetAllowed allowed = CodesetAllowedForChar(CharAscii); return(((allowed == CodeSetAllowed.CodeAorB) || ((allowed == CodeSetAllowed.CodeA) && (currcs == CodeSet.CodeA))) || ((allowed == CodeSetAllowed.CodeB) && (currcs == CodeSet.CodeB))); }
void AddFunction(int start1, int start2) { byte namelen = CodeTable[start1 + 4]; string name = ""; if (namelen > 0) { for (int i = 0; i < namelen; i++) { name += (char)CodeTable[start1 + 5 + i]; } } else if (start1 == 0) { name = ScriptFile.EntryName; } else { name = Function.FunctionName + Functions.Count.ToString(); } int pcount = CodeTable[offset + 1]; int tmp1 = CodeTable[offset + 2], tmp2 = CodeTable[offset + 3]; int vcount = ((Program.SwapEndian) ? (tmp1 << 0x8) | tmp2 : (tmp2 << 0x8) | tmp1); if (vcount < 0) { throw new Exception("Well this shouldnt have happened"); } int temp = start1 + 5 + namelen; while (CodeSet.Map(CodeTable[temp]) != Instruction.LEAVE) { switch (CodeSet.Map(CodeTable[temp])) { case Instruction.PUSH_CONST_U8: temp += 1; break; case Instruction.PUSH_CONST_U8_U8: temp += 2; break; case Instruction.PUSH_CONST_U8_U8_U8: temp += 3; break; case Instruction.PUSH_CONST_U32: case Instruction.PUSH_CONST_F: temp += 4; break; case Instruction.NATIVE: temp += 3; break; case Instruction.ENTER: throw new Exception("Return Expected"); case Instruction.LEAVE: throw new Exception("Return Expected"); case Instruction.ARRAY_U8: case Instruction.ARRAY_U8_LOAD: case Instruction.ARRAY_U8_STORE: case Instruction.LOCAL_U8: case Instruction.LOCAL_U8_LOAD: case Instruction.LOCAL_U8_STORE: case Instruction.STATIC_U8: case Instruction.STATIC_U8_LOAD: case Instruction.STATIC_U8_STORE: case Instruction.IADD_U8: case Instruction.IMUL_U8: case Instruction.IOFFSET_U8: case Instruction.IOFFSET_U8_LOAD: case Instruction.IOFFSET_U8_STORE: temp += 1; break; case Instruction.PUSH_CONST_S16: case Instruction.IADD_S16: case Instruction.IMUL_S16: case Instruction.IOFFSET_S16: case Instruction.IOFFSET_S16_LOAD: case Instruction.IOFFSET_S16_STORE: case Instruction.ARRAY_U16: case Instruction.ARRAY_U16_LOAD: case Instruction.ARRAY_U16_STORE: case Instruction.LOCAL_U16: case Instruction.LOCAL_U16_LOAD: case Instruction.LOCAL_U16_STORE: case Instruction.STATIC_U16: case Instruction.STATIC_U16_LOAD: case Instruction.STATIC_U16_STORE: case Instruction.GLOBAL_U16: case Instruction.GLOBAL_U16_LOAD: case Instruction.GLOBAL_U16_STORE: case Instruction.J: case Instruction.JZ: case Instruction.IEQ_JZ: case Instruction.INE_JZ: case Instruction.IGT_JZ: case Instruction.IGE_JZ: case Instruction.ILT_JZ: case Instruction.ILE_JZ: temp += 2; break; case Instruction.CALL: case Instruction.STATIC_U24: case Instruction.STATIC_U24_LOAD: case Instruction.STATIC_U24_STORE: case Instruction.GLOBAL_U24: case Instruction.GLOBAL_U24_LOAD: case Instruction.GLOBAL_U24_STORE: case Instruction.PUSH_CONST_U24: temp += 3; break; case Instruction.SWITCH: { if (Program.RDROpcodes) { int length = (CodeTable[temp + 2] << 8) | CodeTable[temp + 1]; temp += 2 + 6 * (Program.SwapEndian ? Utils.SwapEndian(length) : length); } else { temp += 1 + 6 * CodeTable[temp + 1]; } break; } case Instruction.TEXT_LABEL_ASSIGN_STRING: case Instruction.TEXT_LABEL_ASSIGN_INT: case Instruction.TEXT_LABEL_APPEND_STRING: case Instruction.TEXT_LABEL_APPEND_INT: temp += 1; break; } temp += 1; } int rcount = CodeTable[temp + 2]; int Location = start2; if (start1 == start2) { Functions.Add(new Function(this, name, pcount, vcount, rcount, Location, -1)); } else { Functions.Add(new Function(this, name, pcount, vcount, rcount, Location, start1)); } }
void GetFunctions() { int returnpos = -3; while (offset < CodeTable.Count) { switch (CodeSet.Map(CodeTable[offset])) { case Instruction.PUSH_CONST_U8: advpos(1); break; case Instruction.PUSH_CONST_U8_U8: advpos(2); break; case Instruction.PUSH_CONST_U8_U8_U8: advpos(3); break; case Instruction.PUSH_CONST_U32: case Instruction.PUSH_CONST_F: advpos(4); break; case Instruction.NATIVE: advpos(3); break; case Instruction.ENTER: AddFunction(offset, returnpos + 3);; advpos(CodeTable[offset + 4] + 4); break; case Instruction.LEAVE: returnpos = offset; advpos(2); break; case Instruction.ARRAY_U8: case Instruction.ARRAY_U8_LOAD: case Instruction.ARRAY_U8_STORE: case Instruction.LOCAL_U8: case Instruction.LOCAL_U8_LOAD: case Instruction.LOCAL_U8_STORE: case Instruction.STATIC_U8: case Instruction.STATIC_U8_LOAD: case Instruction.STATIC_U8_STORE: case Instruction.IADD_U8: case Instruction.IMUL_U8: case Instruction.IOFFSET_U8: case Instruction.IOFFSET_U8_LOAD: case Instruction.IOFFSET_U8_STORE: advpos(1); break; case Instruction.PUSH_CONST_S16: case Instruction.IADD_S16: case Instruction.IMUL_S16: case Instruction.IOFFSET_S16: case Instruction.IOFFSET_S16_LOAD: case Instruction.IOFFSET_S16_STORE: case Instruction.ARRAY_U16: case Instruction.ARRAY_U16_LOAD: case Instruction.ARRAY_U16_STORE: case Instruction.LOCAL_U16: case Instruction.LOCAL_U16_LOAD: case Instruction.LOCAL_U16_STORE: case Instruction.STATIC_U16: case Instruction.STATIC_U16_LOAD: case Instruction.STATIC_U16_STORE: case Instruction.GLOBAL_U16: case Instruction.GLOBAL_U16_LOAD: case Instruction.GLOBAL_U16_STORE: case Instruction.J: case Instruction.JZ: case Instruction.IEQ_JZ: case Instruction.INE_JZ: case Instruction.IGT_JZ: case Instruction.IGE_JZ: case Instruction.ILT_JZ: case Instruction.ILE_JZ: advpos(2); break; case Instruction.CALL: case Instruction.STATIC_U24: case Instruction.STATIC_U24_LOAD: case Instruction.STATIC_U24_STORE: case Instruction.GLOBAL_U24: case Instruction.GLOBAL_U24_LOAD: case Instruction.GLOBAL_U24_STORE: case Instruction.PUSH_CONST_U24: advpos(3); break; case Instruction.SWITCH: { if (Program.RDROpcodes) { int length = (CodeTable[offset + 2] << 8) | CodeTable[offset + 1]; advpos(2 + 6 * (Program.SwapEndian ? Utils.SwapEndian(length) : length)); } else { advpos(1 + 6 * CodeTable[offset + 1]); } break; } case Instruction.TEXT_LABEL_ASSIGN_STRING: case Instruction.TEXT_LABEL_ASSIGN_INT: case Instruction.TEXT_LABEL_APPEND_STRING: case Instruction.TEXT_LABEL_APPEND_INT: advpos(1); break; } advpos(1); } offset = 0; GetFunctionCode(); }
public void Save(CodeSet codeset) { IDal myDal = new DataAccessLayer(EyediaCoreConfigurationSection.CurrentConfig.Database.DatabaseType).Instance; IDbConnection conn = myDal.CreateConnection(_ConnectionString); conn.Open(); IDbTransaction transaction = myDal.CreateTransaction(conn); IDbCommand command = myDal.CreateCommand(); command.Connection = conn; command.Transaction = transaction; try { int CodeSetId = GetCodeSetId(myDal, conn, codeset.Code, codeset.EnumCode, transaction); if (CodeSetId == 0) { command.CommandText = "INSERT INTO CodeSet(Code, EnumCode, Value, ReferenceKey, Description, Position) "; command.CommandText += " VALUES (@Code, @EnumCode, @Value, @ReferenceKey, @Description, @Position)"; command.AddParameterWithValue("Code", codeset.Code); command.AddParameterWithValue("EnumCode", codeset.EnumCode); command.AddParameterWithValue("Value", codeset.Value); command.AddParameterWithValue("ReferenceKey", codeset.ReferenceKey); command.AddParameterWithValue("Description", codeset.Description); command.AddParameterWithValue("Position", codeset.Position); command.ExecuteNonQuery(); //Deb: I know dirty coding, need to be changed. OUTPUT INSERTED.Id not working @SQL CE command.Parameters.Clear(); command.CommandText = "SELECT max(CodeSetId) from CodeSet"; int newCodeSetId = (Int32)command.ExecuteScalar(); } else { command.CommandText = "UPDATE [CodeSet] SET [EnumCode] = @EnumCode,[Value] = @Value,[ReferenceKey] = @ReferenceKey, [Description] = @Description,[Position] = @Position "; command.CommandText += "WHERE [CodeSetId] = @CodeSetId"; command.AddParameterWithValue("EnumCode", codeset.EnumCode); command.AddParameterWithValue("Value", codeset.Value); command.AddParameterWithValue("ReferenceKey", codeset.ReferenceKey); command.AddParameterWithValue("Description", codeset.Description); command.AddParameterWithValue("Position", codeset.Position); command.AddParameterWithValue("CodeSetId", CodeSetId); command.ExecuteNonQuery(); } transaction.Commit(); Refresh(); } catch (Exception ex) { transaction.Rollback(); throw new Exception(ex.Message, ex); } finally { if (conn.State == ConnectionState.Open) { conn.Close(); } conn.Dispose(); transaction.Dispose(); } }
/// <summary> /// Return the appropriate START code depending on the codeset we want to be in /// </summary> /// <param name="cs">The codeset you want to start in</param> /// <returns>The code128 code to start a barcode in that codeset</returns> public static int StartCodeForCodeSet(CodeSet cs) { return(cs == CodeSet.CodeA ? CStartA : CStartB); }
public CodeSetEntry(CodeSet codeSet, bool setFNC1) { this.codeSet = codeSet; this.setFNC1 = setFNC1; }
public override IdpeMessage Parse(bool onlyConstraints) { try { string code = ParseFormulaGetCode(Formula); _ReferenceKey = string.Empty; string sqlErrorMessage = string.Empty; if (Registry.Instance.CodeSets != null) { CodeSet thisCodeSet = (from cs in Registry.Instance.CodeSets where ((cs.Code.Equals(code, StringComparison.OrdinalIgnoreCase)) && (cs.Value.Equals(Value, StringComparison.OrdinalIgnoreCase))) select cs).SingleOrDefault(); if (thisCodeSet != null) { _Value = thisCodeSet.Value; _ValueEnumCode = thisCodeSet.EnumCode; _ReferenceKey = thisCodeSet.ReferenceKey; } else { //check one more time with EnumCode, as IDPE supports Value OR EnumCode int enumCode = 0; if (int.TryParse(Value, out enumCode)) { thisCodeSet = (from cs in Registry.Instance.CodeSets where ((cs.Code.Equals(code, StringComparison.OrdinalIgnoreCase)) && (cs.EnumCode == enumCode)) select cs).SingleOrDefault(); if (thisCodeSet != null) { _Value = thisCodeSet.Value; _ValueEnumCode = thisCodeSet.EnumCode; _ReferenceKey = thisCodeSet.ReferenceKey; } else { _ValueEnumCode = -1; } } else { _ValueEnumCode = -1; } } } if ((_ValueEnumCode == -1) || (sqlErrorMessage != string.Empty)) { this._ParseResult = new IdpeMessage(IdpeMessageCodes.IDPE_CODESET_TYPE_DATA_VALIDATION_FAILED); this._ParseResult.Message = string.Format(_ParseResult.Message, PrintRowColPosition(), Value); } else { _ValueEnumValue = _Value; return(new IdpeMessage(IdpeMessageCodes.IDPE_SUCCESS)); //when got value, return success } } catch (Exception ex) { this._ParseResult = new IdpeMessage(IdpeMessageCodes.IDPE_CODESET_TYPE_DATA_VALIDATION_FAILED); this._ParseResult.Message = string.Format(_ParseResult.Message, PrintRowColPosition(), Value); ExtensionMethods.TraceError(ex.ToString()); } _IsParsed = true; return(this._ParseResult); }
private void SaveChanges_Click(object sender, EventArgs e) { List <Control> controlsList = new List <Control>(); controlsList.Add(new Control()); controlsList.Add(new Control()); foreach (Control ctrl in VisibleTheory.Controls) { if (ctrl is Scintilla) { controlsList[0] = ctrl; } else if (ctrl is TextBox) { controlsList[1] = ctrl; } else { continue; } } if (UpdateState) { using (ForumContainer container = new ForumContainer()) { foreach (var control in controlsList) { if (control is Scintilla) { Scintilla sc = (Scintilla)control; if (sc.Text.Length == 0) { MessageBox.Show("Вы добавили элемент \"Код\", но не ввели никаких данных."); return; } byte[] result = Encoding.UTF8.GetBytes(sc.Text); var code = container.CodeSet.First(x => x.CodeId == updateCodeId); code.CodeFileName = sc.Name + getIdObject(); code.BinaryFileData = result; container.SaveChanges(); CodeId = code.CodeId; } else if (control is TextBox) { TextBox tb = (TextBox)control; TheoryLessonSet lessonSet = new TheoryLessonSet() { CodeId = CodeId == -1 ? 1011 : CodeId, TheoryText = tb.Text }; TheoryControl.TheoryLessonSet = lessonSet; Close(); } else { continue; } } } } else { using (ForumContainer container = new ForumContainer()) { foreach (var control in controlsList) { if (control is Scintilla) { Scintilla sc = (Scintilla)control; if (sc.Text.Length == 0) { MessageBox.Show("Вы добавили элемент \"Код\", но не ввели никаких данных."); return; } byte[] result = Encoding.UTF8.GetBytes(sc.Text); CodeSet code = new CodeSet() { CodeFileName = sc.Name + getIdObject(), BinaryFileData = result }; container.CodeSet.Add(code); container.SaveChanges(); CodeId = code.CodeId; } else if (control is TextBox) { TextBox tb = (TextBox)control; TheoryLessonSet lessonSet = new TheoryLessonSet() { CodeId = CodeId == -1 ? 1011 : CodeId, TheoryText = tb.Text }; TheoryControl.TheoryLessonSet = lessonSet; Close(); } else { continue; } } } } }
public static int[] CodesForChar(int CharAscii, int LookAheadAscii, ref CodeSet CurrCodeSet) { int[] result; int shifter = -1; if (!CharCompatibleWithCodeset(CharAscii, CurrCodeSet)) { if ((LookAheadAscii != -1) && !CharCompatibleWithCodeset(LookAheadAscii, CurrCodeSet)) { switch (CurrCodeSet) { case CodeSet.CodeA: shifter = cCODEB; CurrCodeSet = CodeSet.CodeB; break; case CodeSet.CodeB: shifter = cCODEA; CurrCodeSet = CodeSet.CodeA; break; } } else { shifter = cSHIFT; } } if (shifter != -1) { result = new int[2]; result[0] = shifter; result[1] = CodeValueForChar(CharAscii); } else { result = new int[1]; result[0] = CodeValueForChar(CharAscii); } return result; }
/// <summary> /// Return the appropriate START code depending on the codeset we want to be in /// </summary> /// <param name="cs">The codeset you want to start in</param> /// <returns>The code128 code to start a barcode in that codeset</returns> public static int StartCodeForCodeSet(CodeSet cs) { return cs == CodeSet.CodeA ? CStartA : CStartB; }
/// <summary> /// Determine if a character can be represented in a given codeset /// </summary> /// <param name="charAscii">character to check for</param> /// <param name="currentCodeSet">codeset context to test</param> /// <returns>true if the codeset contains a representation for the ASCII character</returns> public static bool CharCompatibleWithCodeset(int charAscii, CodeSet currentCodeSet) { var csa = CodesetAllowedForChar(charAscii); return csa == CodeSetAllowed.CodeAorB || (csa == CodeSetAllowed.CodeA && currentCodeSet == CodeSet.CodeA) || (csa == CodeSetAllowed.CodeB && currentCodeSet == CodeSet.CodeB); }
/// <summary> /// Return the appropriate START code depending on the codeset we want to be in /// </summary> /// <param name="cs">The codeset you want to start in</param> /// <returns>The code128 code to start a barcode in that codeset</returns> public static int StartCodeForCodeSet(CodeSet cs) { return cs==CodeSet.CodeA ? cSTARTA : cSTARTB; }
public static int StartCodeForCodeSet(CodeSet cs) { return((cs == CodeSet.CodeA) ? 0x67 : 0x68); }
private List <CodeSetEntry> AnalyzeInputString(byte[] asciiBytes) { List <CodeSetEntry> codeSetEntries = new List <CodeSetEntry>(); int index = 0; CodeSet currentCodeSet = CodeSet.None; CodeSetEntry entry = null; bool setFNC1 = false; do { char currentChar = Convert.ToChar(asciiBytes[index]); if (currentChar == '(') { index++; setFNC1 = true; continue; } char nextChar = index + 1 < asciiBytes.Length ? Convert.ToChar(asciiBytes[index + 1]) : '^'; if (CODE_C_VALID_CHARS.Contains(currentChar) && CODE_C_VALID_CHARS.Contains(nextChar)) { if (currentCodeSet == CodeSet.CodeC && !setFNC1) { entry = codeSetEntries[codeSetEntries.Count - 1]; } else { entry = new CodeSetEntry(CodeSet.CodeC, setFNC1); codeSetEntries.Add(entry); currentCodeSet = CodeSet.CodeC; } entry.Values.Add(asciiBytes[index++]); entry.Values.Add(asciiBytes[index++]); } else if (CODE_A_VALID_CHARS.Contains(currentChar)) { if (currentCodeSet == CodeSet.CodeA && !setFNC1) { entry = codeSetEntries[codeSetEntries.Count - 1]; } else { entry = new CodeSetEntry(CodeSet.CodeA, setFNC1); codeSetEntries.Add(entry); currentCodeSet = CodeSet.CodeA; } entry.Values.Add(asciiBytes[index++]); } else if (CODE_A_VALID_CHARS.Contains(currentChar)) { if (currentCodeSet == CodeSet.CodeB && !setFNC1) { entry = codeSetEntries[codeSetEntries.Count - 1]; } else { entry = new CodeSetEntry(CodeSet.CodeB, setFNC1); codeSetEntries.Add(entry); currentCodeSet = CodeSet.CodeB; } entry.Values.Add(asciiBytes[index++]); } else { // TODO: Implement exception handling! } setFNC1 = false; } while (index < asciiBytes.Length); return(codeSetEntries); }
// $START_JOURNAL_SET; Set1; CTV3; CURRENT; DIAGNOSES public bool ProcessJournalSetDefinition(string sBlockText) { bool bResult = true; string sLine; string[] sFields; StringReader strReader = new StringReader(sBlockText); // Read Descriptor Line sLine = strReader.ReadLine(); sFields = sLine.Split(GlobalDefs.cDelimiter); if (sFields.Length != 5) { FatalError = true; ErrorMessage = "Malformed Journal Set Instruction " + sLine; bResult = false; } else { Name = sFields[1].Trim(); CodeType = sFields[2].Trim(); Period = sFields[3].Trim(); SetType = sFields[4].Trim(); sLine = strReader.ReadLine(); while (sLine != null && !FatalError) { if (sLine.StartsWith("$CODES")) { CodeSet cCodeSet = new CodeSet(); if (cCodeSet.Create(sLine)) { if (iIndex < Max) { CodeSetList[iIndex++] = cCodeSet; CodeSetCount = iIndex; } else { FatalError = true; ErrorMessage = "Maximum codes in a code set reached " + Name; bResult = false; } } else { FatalError = true; ErrorMessage = "Malformed CODES Instruction " + sLine; bResult = false; } } sLine = strReader.ReadLine(); } } return bResult; }
/// <summary> /// Return the appropriate START code depending on the codeset we want to be in /// </summary> /// <param name="cs">The codeset you want to start in</param> /// <returns>The code128 code to start a barcode in that codeset</returns> public static int StartCodeForCodeSet(CodeSet cs) { return(cs == CodeSet.CodeA ? cSTARTA : cSTARTB); }
public CodeSetCaller() : base(BLLFactory <CodeSet> .Instance) { bll = baseBLL as CodeSet; }