public static int Add(EnumSaveType SaveT, string AppID, string Name) { lock (objLock) { int nSave = (int)SaveT; return(AddCore(nSave, AppID, Name)); } }
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()); } }
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; } }
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); } }
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); } }
/// <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; }
public override bool Save(Stream stream, EnumSaveType save_type) { throw new NotImplementedException(); }
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; } }
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);