public void Parse(byte[] packagebodybyte, IPackage package) { try { byte[] header = packagebodybyte.Take(min_body_header_length).ToArray(); byte[] body = packagebodybyte.Skip(min_body_header_length).Take(packagebodybyte.Length - min_body_header_length).ToArray(); ipp_Header ippheader = new ipp_Header(header); ipp_Body ippbody = new ipp_Body(body, _defEncoding); Indexes indexes = new Indexes(0, 6); package.PCC = ippbody.GetString(indexes); package.UID = ippbody.GetUid(indexes.Next(24));//ci + ippheader.PT + ippheader.PCT, ippheader.PCT); package.PD = ippbody.GetDatetime(indexes.Next(14));//ci + ippheader.PT + ippheader.PCT, ippheader.PCT); package.IPPV = ippbody.GetString(indexes.Next(ippheader.IPPV));//ci, ippheader.PT); package.PT = ippbody.GetInt(indexes.Next(ippheader.PT));//ci, ippheader.PT); package.PCT = ippbody.GetInt(indexes.Next(ippheader.PCT));//ci + ippheader.PT, ippheader.PCT); package.PCL = ippbody.GetInt(indexes.Next(ippheader.PCL));//ci + ippheader.PT + ippheader.PCT, ippheader.PCT); package.PS = ippbody.GetString(indexes.Next(ippheader.PS));//ci + ippheader.PT + ippheader.PCT + ippheader.PCL, ippheader.PS); package.PR = ippbody.GetString(indexes.Next(ippheader.PR));//ci + ippheader.PT + ippheader.PCT + ippheader.PCL + ippheader.PS, ippheader.PR); package.PCN = ippbody.GetString(indexes.Next(ippheader.PCN));//ci + ippheader.PT + ippheader.PCT + ippheader.PCL + ippheader.PS + ippheader.PR, ippheader.PS); package.PC = body.Skip(indexes.Index + indexes.Count).Take(body.Length - indexes.Index + indexes.Count).ToArray();//ci + ippheader.PT + ippheader.PCT + ippheader.PCL, ippheader.PCT); } catch (Exception e) { } }
public void Parse(byte[] packagebodybyte, IPackage package) { try { byte[] header = packagebodybyte.Take(min_body_header_length).ToArray(); byte[] body = packagebodybyte.Skip(min_body_header_length).Take(packagebodybyte.Length - min_body_header_length).ToArray(); ipp_Header ippheader = new ipp_Header(header); ipp_Body ippbody = new ipp_Body(body, _defEncoding); Indexes indexes = new Indexes(0, 6); package.PCC = ippbody.GetString(indexes); package.UID = ippbody.GetUid(indexes.Next(24)); //ci + ippheader.PT + ippheader.PCT, ippheader.PCT); package.PD = ippbody.GetDatetime(indexes.Next(14)); //ci + ippheader.PT + ippheader.PCT, ippheader.PCT); package.IPPV = ippbody.GetString(indexes.Next(ippheader.IPPV)); //ci, ippheader.PT); package.PT = ippbody.GetInt(indexes.Next(ippheader.PT)); //ci, ippheader.PT); package.PCT = ippbody.GetInt(indexes.Next(ippheader.PCT)); //ci + ippheader.PT, ippheader.PCT); package.PCL = ippbody.GetInt(indexes.Next(ippheader.PCL)); //ci + ippheader.PT + ippheader.PCT, ippheader.PCT); package.PS = ippbody.GetString(indexes.Next(ippheader.PS)); //ci + ippheader.PT + ippheader.PCT + ippheader.PCL, ippheader.PS); package.PR = ippbody.GetString(indexes.Next(ippheader.PR)); //ci + ippheader.PT + ippheader.PCT + ippheader.PCL + ippheader.PS, ippheader.PR); package.PCN = ippbody.GetString(indexes.Next(ippheader.PCN)); //ci + ippheader.PT + ippheader.PCT + ippheader.PCL + ippheader.PS + ippheader.PR, ippheader.PS); package.PC = body.Skip(indexes.Index + indexes.Count).Take(body.Length - indexes.Index + indexes.Count).ToArray(); //ci + ippheader.PT + ippheader.PCT + ippheader.PCL, ippheader.PCT); } catch (Exception e) { } }