public static void GenerateBlockImages(Document doc, MSCDataset dataset)
 {
     try
     {
         ToolPalette.InitializePaletteFolders();
         Database database = doc.Database;
         using (doc.LockDocument())
         {
             using (Transaction transaction = database.TransactionManager.StartTransaction())
             {
                 foreach (MSCFeatureService current in dataset.FeatureServices.Values)
                 {
                     if (!current.QueryOnly && current.GeometryType == MSCFeatureClass.fcTypeCode.fcTypePoint)
                     {
                         ObjectId blockDefinition = DocUtil.GetBlockDefinition(doc, current.LayerName);
                         if (!(blockDefinition == ObjectId.Null))
                         {
                             ToolPalette.CreateBlockImage(transaction, doc, ToolPalette.ImageFolder, blockDefinition);
                         }
                     }
                 }
                 transaction.Commit();
             }
         }
     }
     catch
     {
     }
 }
 private static void WriteTool(MSCFeatureClass fs, string layerName, StreamWriter writer, Document doc, Transaction t)
 {
     try
     {
         Database database = doc.Database;
         if (fs.GeometryType == MSCFeatureClass.fcTypeCode.fcTypePoint)
         {
             if (DocUtil.IsNewDrawing(doc))
             {
                 doc.Editor.WriteMessage(AfaStrings.UnableToAddPointTool);
             }
             else
             {
                 ObjectId blockDefinition = DocUtil.GetBlockDefinition(doc, layerName);
                 if (blockDefinition != ObjectId.Null)
                 {
                     string value = ToolPalette.CreateBlockImage(t, doc, ToolPalette.ImageFolder, blockDefinition);
                     writer.Write(tpResources.xmlPointToolPart1);
                     writer.Write(fs.Name);
                     writer.Write(tpResources.xmlPointToolPart2);
                     writer.Write(value);
                     writer.Write(tpResources.xmlPointToolPart3);
                     writer.Write(value);
                     writer.Write(tpResources.xmlPointToolPart4a);
                     writer.Write(AfaStrings.CreatePointFeatures);
                     writer.Write(tpResources.xmlPointToolPart4b);
                     writer.Write(layerName);
                     writer.Write(tpResources.xmlPointToolPart5);
                     writer.Write(layerName);
                     writer.Write(tpResources.xmlPointToolPart6);
                     writer.Write(layerName);
                     writer.Write(tpResources.xmlPointToolPart7);
                     writer.Write(database.Filename);
                     writer.Write(tpResources.xmlPointToolPart8);
                 }
                 else
                 {
                     writer.Write(tpResources.xmlPtToolPart1);
                     writer.Write(fs.Name);
                     writer.Write(tpResources.xmlPtToolPart2);
                     writer.Write(layerName);
                     writer.Write(tpResources.xmlPtToolPart3);
                     writer.Write(layerName);
                     writer.Write(tpResources.xmlPtToolPart4);
                 }
             }
         }
         else if (fs.GeometryType == MSCFeatureClass.fcTypeCode.fcTypePolyline)
         {
             string value2 = string.Concat(new string[]
             {
                 tpResources.xmlLineToolPart1a,
                 Guid.NewGuid().ToString("B"),
                 tpResources.xmlLineToolPart1b,
                 fs.Name,
                 tpResources.xmlLineToolPart2,
                 AfaStrings.CreateLineFeatures,
                 tpResources.xmlLineToolPart3,
                 layerName,
                 tpResources.xmlLineToolPart4,
                 layerName,
                 tpResources.xmlLineToolPart5
             });
             writer.Write(value2);
         }
         else if (fs.GeometryType == MSCFeatureClass.fcTypeCode.fcTypePolygon)
         {
             string value3 = string.Concat(new string[]
             {
                 tpResources.xmlAreaToolPart1a,
                 Guid.NewGuid().ToString("B"),
                 tpResources.xmlAreaToolPart1b,
                 fs.Name,
                 tpResources.xmlAreaToolPart2,
                 AfaStrings.CreateAreaFeatures,
                 tpResources.xmlAreaToolPart3,
                 layerName,
                 tpResources.xmlAreaToolPart3b,
                 layerName,
                 tpResources.xmlAreaToolPart4
             });
             writer.Write(value3);
         }
     }
     catch
     {
     }
 }