- if (disposition == null)
- throw new ArgumentNullException ();
- if (disposition.Length < 1)
- throw new FormatException ();
- Size = -1;
-
- try {
- int index = disposition.IndexOf (';');
- if (index < 0) {
- dispositionType = disposition.Trim ();
- }
- else {
- string[] split = disposition.Split (';');
- dispositionType = split[0].Trim ();
- for (int i = 1; i < split.Length; i++)
- Parse (split[i]);
- }
- } catch {
- throw new FormatException ();
- }
- }
-
- // the individual pieces
- void Parse (string pair)
- {
- if (pair == null || pair.Length < 0)
- return;
-
- string[] split = pair.Split ('=');
- if (split.Length == 2)
- parameters.Add (split[0].Trim (), split[1].Trim ());
- else
- throw new FormatException ();