public void SetParam(String pn, String pv) { PropertyParameter par = new PropertyParameter(pn, this); par.ParameterValue = pv; SetPar(par); }
// Encoding public void SetEncoding(Encoder en) { PropertyParameter par = GetPar("ENCODING"); if (par == null) { SetPar(new EncodingParameter(this, en)); } else { ((EncodingParameter)par).SetEncoding(en); } }
// Value type public void SetValueType(String vt) { PropertyParameter pr = GetPar("VALUE"); if (pr == null) { SetPar(new ValueParameter(this, vt)); } else { ((ValueParameter)pr).SetValue(vt); } }
public override void ParseFromStream(StreamReader sr) { String tkn = Parser.GetToken(sr); while (tkn == ";") // Reading property parameters { tkn = Parser.GetToken(sr); PropertyParameter pp; switch (tkn) { case "ENCODING": pp = new EncodingParameter(this); break; case "VALUE": pp = new ValueParameter(this); break; // case "BASE64": pp=new parEncoding(this,new Base64Enc()); // break; case "QUOTED-PRINTABLE": pp = new EncodingParameter(this, new QuotedPrintableEncoder()); break; case "7-BIT": pp = new EncodingParameter(this, new _7BitEncoder()); break; default: pp = new PropertyParameter(tkn, this); break; } pp.ParseFromStream(sr); // We will apply parameters value when we'll read it SetPar(pp); tkn = Parser.GetToken(sr); } if (tkn != ":") { throw new InvalidDocumentStructureExeption(); } _val.ParseFromStream(sr, enc); }
public void SetParam(String pn,String pv) { PropertyParameter par=new PropertyParameter(pn,this); par.ParameterValue=pv; SetPar(par); }
public override void ParseFromStream(StreamReader sr) { String tkn=Parser.GetToken(sr); while(tkn==";") // Reading property parameters { tkn=Parser.GetToken(sr); PropertyParameter pp; switch(tkn) { case "ENCODING":pp=new EncodingParameter(this); break; case "VALUE":pp=new ValueParameter(this); break; // case "BASE64": pp=new parEncoding(this,new Base64Enc()); // break; case "QUOTED-PRINTABLE": pp=new EncodingParameter(this,new QuotedPrintableEncoder()); break; case "7-BIT": pp=new EncodingParameter(this,new _7BitEncoder()); break; default:pp=new PropertyParameter(tkn,this); break; } pp.ParseFromStream(sr); // We will apply parameters value when we'll read it SetPar(pp); tkn=Parser.GetToken(sr); } if(tkn!=":")throw new InvalidDocumentStructureExeption(); _val.ParseFromStream(sr,enc); }
protected void SetPar(PropertyParameter pr) { _par.Add(pr); pr.Apply(); }