示例#1
0
 public static int Add(EnumSaveType SaveT, string AppID, string Name)
 {
     lock (objLock) {
         int nSave = (int)SaveT;
         return(AddCore(nSave, AppID, Name));
     }
 }
示例#2
0
        public static int Find(EnumSaveType SaveT, string AppID, string Name)
        {
            int nT = (int)SaveT;

            using (DBIDBuilderContext db = new DBIDBuilderContext()) {
                return(db.IDSeedName.Where(T => T.AppID == AppID).Where(T => T.Name == Name).Where(T => T.DurableTye == nT)
                       .Select(T => T.ID).FirstOrDefault());
            }
        }
示例#3
0
        private void btnOpen_Click(object sender, EventArgs e)
        {
            switch (ExportType)
            {
            case EnumExportType.FeatureClass:
            {
                frmOpenFile frm = new frmOpenFile();
                frm.AllowMultiSelect = false;
                frm.AddFilter(new MyGxFilterWorkspaces(), false);
                frm.AddFilter(new MyGxFilterDatasets(), true);
                frm.Text = @"选择输出位置";
                if (frm.DoModalOpen() == DialogResult.OK)
                {
                    IGxObject gxObject = frm.Items.get_Element(0) as IGxObject;
                    if (gxObject is IGxDatabase)
                    {
                        IGxDatabase gxDatabase = gxObject as IGxDatabase;
                        _dataset   = null;
                        _workspace = gxDatabase.Workspace;
                        _saveType  = EnumSaveType.Workspace;
                    }
                    else if (gxObject is IGxDataset)
                    {
                        IGxDataset gxDataset = gxObject as IGxDataset;
                        _dataset   = gxDataset.Dataset;
                        _workspace = _dataset.Workspace;
                        _saveType  = EnumSaveType.Dataset;
                    }
                }
            }
            break;

            case EnumExportType.Shapefile:
            {
                FolderBrowserDialog dialog = new FolderBrowserDialog();
                dialog.ShowNewFolderButton = true;
                if (dialog.ShowDialog() == DialogResult.OK)
                {
                    this.txtPath.Text = dialog.SelectedPath;

                    Type factoryType = Type.GetTypeFromProgID("esriDataSourcesFile.ShapefileWorkspaceFactory");
                    IWorkspaceFactory shapefileWorkspaceFactory = Activator.CreateInstance(factoryType) as IWorkspaceFactory;
                    if (shapefileWorkspaceFactory == null)
                    {
                        return;
                    }
                    _dataset   = null;
                    _workspace = shapefileWorkspaceFactory.OpenFromFile(dialog.SelectedPath, 0);
                    _saveType  = EnumSaveType.Workspace;
                }
            }
            break;
            }
        }
示例#4
0
 public override bool Save(Stream stream, EnumSaveType save_type)
 {
     try
     {
         if (save_type == EnumSaveType.BINARY)
         {
             new BinaryFormatter().Serialize(stream, (object)this);
         }
         return(true);
     }
     catch (VirtualDeviceLibException ex)
     {
         return(false);
     }
 }
 public static object FromFile(Stream stream, EnumSaveType save_type)
 {
     try
     {
         if (save_type == EnumSaveType.BINARY)
         {
             return(new BinaryFormatter().Deserialize(stream));
         }
         return((object)null);
     }
     catch (VirtualDeviceLibException ex)
     {
         return((object)null);
     }
 }
示例#6
0
 public override bool Save(string fileName, EnumSaveType save_type)
 {
     try
     {
         if (save_type == EnumSaveType.BINARY)
         {
             if (!fileName.ToLower().EndsWith(".vdaction"))
             {
                 fileName += ".vdaction";
             }
             using (FileStream fileStream = new FileStream(fileName, FileMode.Create))
                 new BinaryFormatter().Serialize((Stream)fileStream, (object)this);
         }
         return(true);
     }
     catch (VirtualDeviceLibException ex)
     {
         return(false);
     }
 }
 public static object FromFile(string fileName, EnumSaveType save_type)
 {
     try
     {
         object obj = (object)null;
         if ((uint)save_type > 0U)
         {
             return((object)null);
         }
         if (!fileName.ToLower().EndsWith(".vdaction"))
         {
             fileName += ".vdaction";
         }
         using (FileStream fileStream = new FileStream(fileName, FileMode.Open))
             obj = new BinaryFormatter().Deserialize((Stream)fileStream);
         return(obj);
     }
     catch (VirtualDeviceLibException ex)
     {
         return((object)null);
     }
 }
示例#8
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DbEnumAttribute" /> class.
 /// </summary>
 /// <param name="saveType">Type of the save.</param>
 public DbEnumAttribute(EnumSaveType saveType)
 {
     this.SaveType = saveType;
 }
示例#9
0
 public override bool Save(Stream stream, EnumSaveType save_type)
 {
     throw new NotImplementedException();
 }
示例#10
0
        private void btnOpen_Click(object sender, EventArgs e)
        {
            switch (ExportType)
            {
            case EnumExportType.FeatureClass:
            {
                IGxDialog dialog = new GxDialogClass();
                IGxObjectFilterCollection filterCollection = dialog as IGxObjectFilterCollection;
                filterCollection.AddFilter(new GxFilterWorkspacesClass(), true);
                filterCollection.AddFilter(new GxFilterDatasetsClass(), false);
                dialog.AllowMultiSelect = false;
                dialog.ButtonCaption    = "选择";
                dialog.RememberLocation = true;
                dialog.Title            = "选择输出位置";
                IEnumGxObject selection = null;
                if (dialog.DoModalOpen(0, out selection))
                {
                    if (selection == null)
                    {
                        return;
                    }
                    IGxObject gxObject = selection.Next();
                    if (gxObject is IGxDatabase)
                    {
                        IGxDatabase gxDatabase = gxObject as IGxDatabase;
                        _dataset   = null;
                        _workspace = gxDatabase.Workspace;
                        _saveType  = EnumSaveType.Workspace;
                    }
                    else if (gxObject is IGxDataset)
                    {
                        IGxDataset gxDataset = gxObject as IGxDataset;
                        _dataset   = gxDataset.Dataset;
                        _workspace = _dataset.Workspace;
                        _saveType  = EnumSaveType.Dataset;
                    }
                    txtPath.Text = gxObject.FullName;
                }
            }
            break;

            case EnumExportType.Shapefile:
            {
                FolderBrowserDialog dialog = new FolderBrowserDialog();
                dialog.ShowNewFolderButton = true;
                if (dialog.ShowDialog() == DialogResult.OK)
                {
                    this.txtPath.Text = dialog.SelectedPath;

                    Type factoryType = Type.GetTypeFromProgID("esriDataSourcesFile.ShapefileWorkspaceFactory");
                    IWorkspaceFactory shapefileWorkspaceFactory = Activator.CreateInstance(factoryType) as IWorkspaceFactory;
                    if (shapefileWorkspaceFactory == null)
                    {
                        return;
                    }
                    _dataset   = null;
                    _workspace = shapefileWorkspaceFactory.OpenFromFile(dialog.SelectedPath, 0);
                    _saveType  = EnumSaveType.Workspace;
                }
            }
            break;
            }
        }
示例#11
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DbEnumAttribute" /> class.
 /// </summary>
 /// <param name="saveType">Type of the save.</param>
 public DbEnumAttribute(EnumSaveType saveType)
 {
     this.SaveType = saveType;
 }
示例#12
0
 public AppBuilderContainer(string AppID, EnumSaveType st)
 {
     ST         = st;
     this.AppID = AppID;
     DicCreater = new Dictionary <string, Impl.BaseCreater>();
 }
 public abstract bool Save(Stream stream, EnumSaveType save_type);
 public abstract bool Save(string fileName, EnumSaveType save_type);