internal static DxfObject FromBuffer(DxfCodePairBufferReader buffer) { var first = buffer.Peek(); buffer.Advance(); DxfObject obj; switch (first.StringValue) { case "ACAD_PROXY_OBJECT": obj = new DxfAcadProxyObject(); break; case "ACDBDICTIONARYWDFLT": obj = new DxfDictionaryWithDefault(); break; case "ACDBPLACEHOLDER": obj = new DxfPlaceHolder(); break; case "DATATABLE": obj = new DxfDataTable(); break; case "DICTIONARY": obj = new DxfDictionary(); break; case "DICTIONARYVAR": obj = new DxfDictionaryVariable(); break; case "DIMASSOC": obj = new DxfDimensionAssociativity(); break; case "FIELD": obj = new DxfField(); break; case "GEODATA": obj = new DxfGeoData(); break; case "GROUP": obj = new DxfGroup(); break; case "IDBUFFER": obj = new DxfIdBuffer(); break; case "IMAGEDEF": obj = new DxfImageDefinition(); break; case "IMAGEDEF_REACTOR": obj = new DxfImageDefinitionReactor(); break; case "LAYER_FILTER": obj = new DxfLayerFilter(); break; case "LAYER_INDEX": obj = new DxfLayerIndex(); break; case "LAYOUT": obj = new DxfLayout(); break; case "LIGHTLIST": obj = new DxfLightList(); break; case "MATERIAL": obj = new DxfMaterial(); break; case "MLEADERSTYLE": obj = new DxfMLeaderStyle(); break; case "MLINESTYLE": obj = new DxfMLineStyle(); break; case "OBJECT_PTR": obj = new DxfObjectPointer(); break; case "PLOTSETTINGS": obj = new DxfPlotSettings(); break; case "RASTERVARIABLES": obj = new DxfRasterVariables(); break; case "MENTALRAYRENDERSETTINGS": obj = new DxfMentalRayRenderSettings(); break; case "RENDERENVIRONMENT": obj = new DxfRenderEnvironment(); break; case "RENDERGLOBAL": obj = new DxfRenderGlobal(); break; case "SECTIONMANAGER": obj = new DxfSectionManager(); break; case "SECTIONSETTINGS": obj = new DxfSectionSettings(); break; case "SORTENTSTABLE": obj = new DxfSortentsTable(); break; case "SPATIAL_FILTER": obj = new DxfSpatialFilter(); break; case "SPATIAL_INDEX": obj = new DxfSpatialIndex(); break; case "SUNSTUDY": obj = new DxfSunStudy(); break; case "TABLESTYLE": obj = new DxfTableStyle(); break; case "UNDERLAYDEFINITION": obj = new DxfUnderlayDefinition(); break; case "VBA_PROJECT": obj = new DxfVbaProject(); break; case "VISUALSTYLE": obj = new DxfVisualStyle(); break; case "WIPEOUTVARIABLES": obj = new DxfWipeoutVariables(); break; case "XRECORD": obj = new DxfXRecordObject(); break; default: SwallowObject(buffer); obj = null; break; } if (obj != null) { obj = obj.PopulateFromBuffer(buffer); } return(obj); }
public void WriteSunStudyTest() { var sun = new DxfSunStudy(); sun.Hours.Add(42); sun.Hours.Add(43); sun.Hours.Add(44); var file = new DxfFile(); file.Objects.Add(sun); VerifyFileContains(file, @" 0 SUNSTUDY 5 A 100 AcDbSunStudy 90 0 1 2 70 0 3 290 0 4 291 0 91 0 292 0 73 3 290 42 290 43 290 44 340 0 341 0 342 0 74 0 75 0 76 0 77 0 40 0.0 293 0 294 0 343 0 "); // verify writing as binary doesn't crash using (var ms = new MemoryStream()) { file.Save(ms, asText: false); } }