Exemplo n.º 1
0
        private void method_1(string string_1)
        {
            IGxObject      obj2  = new GxCadDataset();
            IGxObject      obj3  = new GxCadDrawing();
            IDatasetName   name2 = new CadDrawingNameClass();
            IWorkspaceName name  = new WorkspaceNameClass
            {
                WorkspaceFactoryProgID = "esriDataSourcesFile.CadWorkspaceFactory",
                PathName = System.IO.Path.GetDirectoryName(string_1)
            };

            name2.Name          = System.IO.Path.GetFileName(string_1);
            name2.WorkspaceName = name;
            (obj2 as IGxDataset).DatasetName = name2;
            name2 = new CadDrawingNameClass();
            name  = new WorkspaceNameClass
            {
                WorkspaceFactoryProgID = "esriDataSourcesFile.CadWorkspaceFactory",
                PathName = System.IO.Path.GetDirectoryName(string_1)
            };
            name2.Name          = System.IO.Path.GetFileName(string_1);
            name2.WorkspaceName = name;
            (obj3 as IGxDataset).DatasetName = name2;
            obj2.Attach(this, this.igxCatalog_0);
            obj3.Attach(this, this.igxCatalog_0);
        }
Exemplo n.º 2
0
 private void method_0(string string_1)
 {
     try
     {
         IGxObject      obj2  = new GxCadDataset();
         IDatasetName   name  = new FeatureClassNameClass();
         IWorkspaceName name2 = new WorkspaceNameClass
         {
             WorkspaceFactoryProgID = "esriDataSourcesFile.CadWorkspaceFactory",
             PathName = this.idatasetName_0.WorkspaceName.PathName
         };
         name.Name          = this.idatasetName_0.Name + ":" + string_1;
         name.WorkspaceName = name2;
         (obj2 as IGxDataset).DatasetName = name;
         obj2.Attach(this, this.igxCatalog_0);
     }
     catch (Exception exception)
     {
         Logger.Current.Error("", exception, "");
     }
 }
Exemplo n.º 3
0
        private bool method_0(string string_1, string string_2, bool bool_0)
        {
            IGxObject      obj2 = null;
            IDatasetName   name;
            IWorkspaceName name2;

            switch (string_2.ToLower())
            {
            case ".bmp":
            case ".png":
            case ".jpg":
            case ".tif":
            case ".img":
            case ".sid":
                obj2  = new GxRasterDataset();
                name  = new RasterDatasetNameClass();
                name2 = new WorkspaceNameClass
                {
                    WorkspaceFactoryProgID = "esriDataSourcesFile.RasterWorkspaceFactory",
                    PathName = Path.GetDirectoryName(string_1)
                };
                name.Name          = Path.GetFileName(string_1);
                name.WorkspaceName = name2;
                (obj2 as IGxDataset).DatasetName = name;
                obj2.Attach(this.igxObject_0, this.igxCatalog_0);
                if (bool_0)
                {
                    this.igxCatalog_0.ObjectAdded(obj2);
                }
                return(true);

            case ".mdb":
                obj2  = new GxDatabase();
                name2 = new WorkspaceNameClass
                {
                    WorkspaceFactoryProgID = "esriDataSourcesGDB.AccessWorkspaceFactory",
                    PathName = string_1
                };
                (obj2 as IGxDatabase).WorkspaceName = name2;
                obj2.Attach(this.igxObject_0, this.igxCatalog_0);
                if (bool_0)
                {
                    this.igxCatalog_0.ObjectAdded(obj2);
                }
                return(true);

            case ".shp":
                obj2  = new GxShapefileDataset();
                name  = new FeatureClassNameClass();
                name2 = new WorkspaceNameClass
                {
                    WorkspaceFactoryProgID = "esriDataSourcesFile.ShapefileWorkspaceFactory",
                    PathName = Path.GetDirectoryName(string_1)
                };
                name.Name          = Path.GetFileName(string_1);
                name.WorkspaceName = name2;
                (obj2 as IGxDataset).DatasetName = name;
                obj2.Attach(this.igxObject_0, this.igxCatalog_0);
                if (bool_0)
                {
                    this.igxCatalog_0.ObjectAdded(obj2);
                }
                return(true);

            case ".dbf":
                if (
                    !File.Exists(Path.Combine(Path.GetDirectoryName(string_1),
                                              Path.GetFileNameWithoutExtension(string_1) + ".shp")))
                {
                    obj2  = new GxDataset();
                    name  = new TableNameClass();
                    name2 = new WorkspaceNameClass
                    {
                        WorkspaceFactoryProgID = "esriDataSourcesFile.ShapefileWorkspaceFactory",
                        PathName = Path.GetDirectoryName(string_1)
                    };
                    name.Name          = Path.GetFileName(string_1);
                    name.WorkspaceName = name2;
                    (obj2 as IGxDataset).DatasetName = name;
                    obj2.Attach(this.igxObject_0, this.igxCatalog_0);
                    if (bool_0)
                    {
                        this.igxCatalog_0.ObjectAdded(obj2);
                    }
                    return(true);
                }
                return(false);

            case ".sde":
                obj2  = new GxDatabase();
                name2 = new WorkspaceNameClass
                {
                    WorkspaceFactoryProgID = "esriDataSourcesGDB.SdeWorkspaceFactory",
                    PathName = string_1
                };
                (obj2 as IGxDatabase).WorkspaceName = name2;
                obj2.Attach(this.igxObject_0, this.igxCatalog_0);
                if (bool_0)
                {
                    this.igxCatalog_0.ObjectAdded(obj2);
                }
                return(true);

            case ".lyr":
                obj2 = new GxLayer();
                (obj2 as IGxFile).Path = string_1;
                obj2.Attach(this.igxObject_0, this.igxCatalog_0);
                if (bool_0)
                {
                    this.igxCatalog_0.ObjectAdded(obj2);
                }
                return(true);

            case ".dwg":
            case ".dxf":
                obj2  = new GxCadDataset();
                name  = new CadDrawingNameClass();
                name2 = new WorkspaceNameClass
                {
                    WorkspaceFactoryProgID = "esriDataSourcesFile.CadWorkspaceFactory",
                    PathName = Path.GetDirectoryName(string_1)
                };
                name.Name          = Path.GetFileName(string_1);
                name.WorkspaceName = name2;
                (obj2 as IGxDataset).DatasetName = name;
                obj2.Attach(this.igxObject_0, this.igxCatalog_0);
                if (bool_0)
                {
                    this.igxCatalog_0.ObjectAdded(obj2);
                }
                return(true);

            case ".doc":
            case ".xls":
                obj2 = new GxOfficeFile();
                (obj2 as IGxFile).Path = string_1;
                obj2.Attach(this.igxObject_0, this.igxCatalog_0);
                if (bool_0)
                {
                    this.igxCatalog_0.ObjectAdded(obj2);
                }
                return(true);
            }
            return(false);
        }