public IFormat HandleRequest(int format) { IFormat extension = null; if(format == 0 || format == 1 || format == 2 || format == 3 || format == 4 || format == 5) { extension = new BaseFormats(); } else if (Successor != null) { Successor.HandleRequest(format); } return extension; }
public static IFormat ChooseFormat(int index) { IFormat format = null; switch (index) { case 0: case 1: case 2: case 3: case 4: case 5: format = new BaseFormats(); break; case 6: format = new XpsFormat(); break; case 7: format = new PdfFormat(); break; case 8: format = new PsdFormat(); break; default: break; } return format; }