/// <summary> /// Allocates an object that represents a .NET assembly. /// </summary> /// <param name="name">The name of the unit.</param> /// <param name="location">An indication of the location where the unit is or will be stored. This need not be a file system path and may be empty. /// The interpretation depends on the IMetadataHost instance used to resolve references to this unit.</param> /// <param name="moduleName">The name of the module containing the assembly manifest. This can be different from the name of the assembly itself.</param> /// <param name="assemblyReferences">A list of the assemblies that are referenced by this module.</param> /// <param name="moduleReferences">A list of the modules that are referenced by this module.</param> /// <param name="resources">A list of named byte sequences persisted with the assembly and used during execution, typically via .NET Framework helper classes.</param> /// <param name="files"> /// A list of the files that constitute the assembly. These are not the source language files that may have been /// used to compile the assembly, but the files that contain constituent modules of a multi-module assembly as well /// as any external resources. It corresonds to the File table of the .NET assembly file format. /// </param> protected Assembly(IName name, string location, IName moduleName, IEnumerable<IAssemblyReference> assemblyReferences, IEnumerable<IModuleReference> moduleReferences, IEnumerable<IResourceReference> resources, IEnumerable<IFileReference> files) : base(name, location, Dummy.Assembly, assemblyReferences, moduleReferences) { this.moduleName = moduleName; this.resources = resources; this.files = files; }
public TypeTests(ModuleReaderTestClass mrTest) { this.ModuleReaderTest = mrTest; this.System = mrTest.NameTable.GetNameFor("System"); this.Collections = mrTest.NameTable.GetNameFor("Collections"); this.Generic = mrTest.NameTable.GetNameFor("Generic"); this.List = mrTest.NameTable.GetNameFor("List"); this.Assem = mrTest.NameTable.GetNameFor("Assem"); this.Generic1 = mrTest.NameTable.GetNameFor("Generic1"); this.Generic2 = mrTest.NameTable.GetNameFor("Generic2"); this.Generic3 = mrTest.NameTable.GetNameFor("Generic3"); this.Generic4 = mrTest.NameTable.GetNameFor("Generic4"); this.Nested = mrTest.NameTable.GetNameFor("Nested"); this.Generic1Nested = mrTest.NameTable.GetNameFor("Generic1Nested"); this.Generic2Nested = mrTest.NameTable.GetNameFor("Generic2Nested"); this.Generic3Nested = mrTest.NameTable.GetNameFor("Generic3Nested"); this.Foo = mrTest.NameTable.GetNameFor("Foo"); this.Bar = mrTest.NameTable.GetNameFor("Bar"); this.FooNested = mrTest.NameTable.GetNameFor("FooNested"); this.TypeTest = mrTest.NameTable.GetNameFor("TypeTest"); this.foo = mrTest.NameTable.GetNameFor("foo"); this.bar = mrTest.NameTable.GetNameFor("bar"); this.field1 = mrTest.NameTable.GetNameFor("field1"); this.field2 = mrTest.NameTable.GetNameFor("field2"); this.GenMethod = mrTest.NameTable.GetNameFor("GenMethod"); this.IntList = mrTest.NameTable.GetNameFor("IntList"); }
public TypeMemberTests(ModuleReaderTestClass mrTest) { this.ModuleReaderTest = mrTest; this.System = mrTest.NameTable.GetNameFor("System"); this.Collections = mrTest.NameTable.GetNameFor("Collections"); this.Generic = mrTest.NameTable.GetNameFor("Generic"); this.List = mrTest.NameTable.GetNameFor("List"); this.Add = mrTest.NameTable.GetNameFor("Add"); this._emptyArray = mrTest.NameTable.GetNameFor("_emptyArray"); this._defaultCapacity = mrTest.NameTable.GetNameFor("_defaultCapacity"); this.Item = mrTest.NameTable.GetNameFor("Item"); this.GC = mrTest.NameTable.GetNameFor("GC"); this.ClearCache = mrTest.NameTable.GetNameFor("ClearCache"); this.MarshalTest = mrTest.NameTable.GetNameFor("MarshalTest"); this.CreateFontIndirect = mrTest.NameTable.GetNameFor("CreateFontIndirect"); this.CreateFontIndirectArray = mrTest.NameTable.GetNameFor("CreateFontIndirectArray"); this.Assem = mrTest.NameTable.GetNameFor("Assem"); this.GenMethod = mrTest.NameTable.GetNameFor("GenMethod"); this.Generic1 = mrTest.NameTable.GetNameFor("Generic1"); this.fieldT = mrTest.NameTable.GetNameFor("fieldT"); this.propT = mrTest.NameTable.GetNameFor("propT"); this.get_propT = mrTest.NameTable.GetNameFor("get_propT"); this.GenericEvent = mrTest.NameTable.GetNameFor("GenericEvent"); this.free = mrTest.NameTable.GetNameFor("free"); this.PtrToStringChars = mrTest.NameTable.GetNameFor("PtrToStringChars"); this._A0x8179e609 = mrTest.NameTable.GetNameFor("?A0x8179e609"); this._InitializedPerProcess_initializer__CurrentDomain__CrtImplementationDetails_____Q2P6MXXZEA = mrTest.NameTable.GetNameFor("?InitializedPerProcess$initializer$@CurrentDomain@<CrtImplementationDetails>@@$$Q2P6MXXZEA"); }
/** * For manipulating the internals of {@link HSSFName} during Testing.<br/> * Some Tests need a {@link NameRecord} with unusual state, not normally producible by POI. * This method achieves the aims at low cost without augmenting the POI usermodel api. * @return a reference to the wrapped {@link NameRecord} */ public static NameRecord GetNameRecord(IName definedName) { FieldInfo f; f = typeof(HSSFName).GetField("_definedNameRec",BindingFlags.Instance|BindingFlags.NonPublic); //f.SetAccessible(true); return (NameRecord)f.GetValue(definedName); }
internal VccAssembly(IName name, string location, ISourceEditHost hostEnvironment, VccOptions options, IEnumerable<IAssemblyReference> assemblyReferences, IEnumerable<IModuleReference> moduleReferences, IEnumerable<CompilationPart> compilationParts) : base(name, location, name, assemblyReferences, moduleReferences, new List<IResourceReference>(0).AsReadOnly(), new List<IFileReference>(0).AsReadOnly()) { this.options = options; this.hostEnvironment = hostEnvironment; this.compilationParts = compilationParts; }
public VccAssembly(IName name, string location, ISourceEditHost hostEnvironment, VccOptions options, IEnumerable<IAssemblyReference> assemblyReferences, IEnumerable<IModuleReference> moduleReferences, IEnumerable<VccSourceDocument> programSources) : base(name, location, name, assemblyReferences, moduleReferences, new List<IResourceReference>(0).AsReadOnly(), new List<IFileReference>(0).AsReadOnly()) { this.options = options; this.hostEnvironment = hostEnvironment; this.programSources = programSources; }
// // CONSTRUCTOR // public GeometricNetworkLoader(byte[] bytes) { // Cast byte to object object obj = (object)bytes; // Unpack dropped object to Esri name enumerator INameFactory nameFactory = new NameFactoryClass(); IEnumName enumName = nameFactory.UnpackageNames(ref obj); this._name = enumName.Next(); }
/// <summary> /// Allocates a mutable object that represents a local variable or constant. /// </summary> public GeneratorLocal() { this.compileTimeValue = Dummy.Constant; this.customModifiers = new List<ICustomModifier>(); this.isModified = false; this.isPinned = false; this.isReference = false; this.locations = new List<ILocation>(); this.name = Dummy.Name; this.methodDefinition = Dummy.Method; this.type = Dummy.TypeReference; }
public void TestNamedRead() { HSSFWorkbook wb = HSSFTestDataSamples.OpenSampleWorkbook("namedinput.xls"); //Get index of the named range with the name = "NamedRangeName" , which was defined in input.xls as A1:D10 int NamedRangeIndex = wb.GetNameIndex("NamedRangeName"); //Getting NAmed Range IName namedRange1 = wb.GetNameAt(NamedRangeIndex); String sheetName = wb.GetSheetName(0); //Getting its reference String reference = namedRange1.RefersToFormula; Assert.AreEqual(sheetName + "!$A$1:$D$10", reference); IName namedRange2 = wb.GetNameAt(1); Assert.AreEqual(sheetName + "!$D$17:$G$27", namedRange2.RefersToFormula); Assert.AreEqual("SecondNamedRange", namedRange2.NameName); }
public static ESRI.ArcGIS.Geodatabase.IWorkspace GetWorkspace(string inXMLFile) { IWorkspaceFactory inMemoryWorkspaceFactory = new InMemoryWorkspaceFactoryClass(); IWorkspaceName workspaceName = inMemoryWorkspaceFactory.Create("", "InMemory", null, 0); IName name = workspaceName as IName; IWorkspace workspace = (IWorkspace)name.Open(); //Create a GDB importer IGdbXmlImport xmlImport = new GdbImporterClass(); // Read schema section from the XML file. // Note: enumNameMapping is initialized to nothing and its value is set 'by ref' with a call to the GenerateNameMapping method. IEnumNameMapping eNameMapping = null; xmlImport.GenerateNameMapping(inXMLFile, workspace, out eNameMapping); //Create the workspace schema and load the data xmlImport.ImportWorkspace(inXMLFile, eNameMapping, workspace, false); return(workspace); }
/// <summary> /// Clears everything. /// </summary> private void Init() { _transform = new ChampTransformClass(); _transform.SetMap(ArcMap.Document.FocusMap); _benchmarkName = null; _transformTableName = null; inputDatasetTextBox.Text = ""; controlPointsComboBox.DataSource = null; controlPointsComboBox.Text = ""; attributeFieldComboBox.Items.Clear(); attributeFieldComboBox.Text = ""; benchmark1ComboBox.Items.Clear(); benchmark1ComboBox.Text = ""; benchmark2ComboBox.Items.Clear(); benchmark2ComboBox.Text = ""; benchmark3ComboBox.Items.Clear(); benchmark3ComboBox.Text = ""; benchmarkTextBox.Text = ""; transformTextBox.Text = ""; outputWorkspaceTextBox.Text = ""; }
/// <summary> /// 获取重定义名称实体集合 /// </summary> /// <param name="workBook"></param> /// <returns></returns> public static IEnumerable <INameInfo> GetAllINameInfo(this IWorkbook workBook) { List <INameInfo> list = new List <INameInfo>(); for (int index = 0; index < workBook.NumberOfNames; index++) { IName iname = workBook.GetNameAt(index); if (iname.IsDeleted || iname.IsFunctionName) { continue; } INameInfo info = DealIName(iname); if (info == null) { continue; } list.Add(info); } return(list); }
private void CreateLayer(IName name) { ILayerFactoryHelper helper = new LayerFactoryHelperClass(); try { IEnumLayer layer = helper.CreateLayersFromName(name); layer.Reset(); for (ILayer layer2 = layer.Next(); layer2 != null; layer2 = layer.Next()) { int toIndex = 0; toIndex = LocalCommonHelper.GetLayerIndex(this.axMapControl1.Map, layer2); this.axMapControl1.AddLayer(layer2, toIndex); this.axMapControl1.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGeography, layer2, null); } } catch (Exception) { MessageBox.Show("无法打开指定文档!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Hand); } }
public IWorkspace CreateShapeFileWorkSpace(string filename) { IWorkspaceFactory pWorkspaceFactory = new ESRI.ArcGIS.DataSourcesFile.ShapefileWorkspaceFactory() as IWorkspaceFactory; filename = filename.Substring(0, filename.LastIndexOf(".")); if (System.IO.Directory.Exists(filename)) { if (pWorkspaceFactory.IsWorkspace(filename)) { IWorkspace pTempWks = pWorkspaceFactory.OpenFromFile(filename, 0); return(pTempWks); } } IWorkspaceName pWorkspaceName = pWorkspaceFactory.Create("" + System.IO.Path.GetDirectoryName(filename) + "", "" + System.IO.Path.GetFileName(filename) + "", null, 0); IName name = (ESRI.ArcGIS.esriSystem.IName)pWorkspaceName; IWorkspace shapefile_workspace = (IWorkspace)name.Open(); return(shapefile_workspace); }
/// <summary> /// Computes the AssemblyIdentifier of the PE File. This requires that peFile is an assembly. /// </summary> /// <param name="peFileReader"></param> /// <returns></returns> internal AssemblyIdentity GetAssemblyIdentifier(PEFileReader peFileReader) //^ requires peFileReader.ReaderState >= ReaderState.Metadata && peFileReader.IsAssembly; //^ ensures (result.Location != null && result.Location.Length != 0); { AssemblyRow assemblyRow = peFileReader.AssemblyTable[1]; IName assemblyName = this.metadataReaderHost.NameTable.GetNameFor(peFileReader.StringStream[assemblyRow.Name]); string cultureName = peFileReader.StringStream[assemblyRow.Culture]; Version version = new Version(assemblyRow.MajorVersion, assemblyRow.MinorVersion, assemblyRow.BuildNumber, assemblyRow.RevisionNumber); byte[] publicKeyArray = TypeCache.EmptyByteArray; byte[] publicKeyTokenArray = TypeCache.EmptyByteArray; if (assemblyRow.PublicKey != 0) { publicKeyArray = peFileReader.BlobStream[assemblyRow.PublicKey]; if (publicKeyArray.Length > 0) { publicKeyTokenArray = UnitHelper.ComputePublicKeyToken(publicKeyArray); } } return(new AssemblyIdentity(assemblyName, cultureName, version, publicKeyTokenArray, peFileReader.BinaryDocumentMemoryBlock.BinaryDocument.Location)); }
private void EditWorkspacelist_SelectedIndexChanged(object sender, EventArgs e) { this.CanEditDatasetList.Items.Clear(); if (this.EditWorkspacelist.SelectedItems.Count != 0) { try { CheckInOutWorkspaceInfo tag = this.EditWorkspacelist.SelectedItems[0].Tag as CheckInOutWorkspaceInfo; IEnumName enumName = tag.EnumName; enumName.Reset(); for (IName name2 = enumName.Next(); name2 != null; name2 = enumName.Next()) { this.CanEditDatasetList.Items.Add((name2 as IDatasetName).Name); } } catch (Exception exception) { MessageBox.Show(exception.ToString()); } } }
public static void SimpleCheckOut(IWorkspaceName iworkspaceName_0, IWorkspaceName iworkspaceName_1, IEnumName ienumName_0, bool bool_0, bool bool_1, string string_0) { IName name = iworkspaceName_1 as IName; IWorkspace arg_12_0 = name.Open() as IWorkspace; IWorkspace arg_23_0 = (iworkspaceName_0 as IName).Open() as IWorkspace; IReplicaDescription replicaDescription = new ReplicaDescription() as IReplicaDescription; replicaDescription.Init(ienumName_0, iworkspaceName_1, bool_0, esriDataExtractionType.esriDataCheckOut); replicaDescription.ReplicaModelType = esriReplicaModelType.esriModelTypeFullGeodatabase; ICheckOut checkOut = new CheckOut(); if (bool_1) { checkOut.CheckOutData(replicaDescription, true, string_0); } else { checkOut.CheckOutSchema(replicaDescription, string_0); } }
/// <summary> /// 创建查询表 /// </summary> /// <param name="queryDef"></param> /// <param name="str_pk"></param> /// <param name="workspaceName"></param> /// <param name="tableName"></param> /// <returns></returns> private ITable CreateQueryTable(IQueryDef queryDef, string str_pk, IWorkspaceName workspaceName, string tableName) { IQueryName2 queryName2 = (IQueryName2) new TableQueryNameClass(); queryName2.QueryDef = queryDef; //queryName2.PrimaryKey = "streets.StreetID"; queryName2.PrimaryKey = str_pk; queryName2.CopyLocally = true; // Set the workspace and name of the new QueryTable. IDatasetName datasetName = (IDatasetName)queryName2; datasetName.WorkspaceName = workspaceName; datasetName.Name = tableName; // Open the virtual table. IName name = (IName)queryName2; ITable table = (ITable)name.Open(); return(table); }
public void RenameByName_Ok() { Dictionary <string, string> env = new Dictionary <string, string>(); env.Add(Context.INITIAL_CONTEXT_FACTORY, "Java2NetPort.JNDI.ServiceProviders.InMemoryServiceProvider.InitialInMemoryContextFactory"); IContext ctx = new InitialContext(env); IName name = ctx.GetNameParser("").Parse("stringItem1"); IName name2 = ctx.GetNameParser("").Parse("stringItem2"); ctx.Bind(name, "stringItem1Value"); ctx.Rename(name, name2); object obj = ctx.Lookup(name2); Assert.IsNotNull(obj); Assert.IsTrue(obj is string); Assert.IsTrue(obj.ToString() == "stringItem1Value"); }
/** * Find the 2D base data area for the pivot table, either from its direct reference or named table/range. * @return AreaReference representing the current area defined by the pivot table * @ if the ref1 attribute is not contiguous or the name attribute is not found. */ public AreaReference GetPivotArea(IWorkbook wb) { CT_WorksheetSource wsSource = ctPivotCacheDefinition.cacheSource.worksheetSource; String ref1 = wsSource.@ref; String name = wsSource.name; if (ref1 == null && name == null) { throw new ArgumentException("Pivot cache must reference an area, named range, or table."); } // this is the XML format, so tell the reference that. if (ref1 != null) { return(new AreaReference(ref1, SpreadsheetVersion.EXCEL2007)); } if (name != null) { // named range or table? IName range = wb.GetName(name); if (range != null) { return(new AreaReference(range.RefersToFormula, SpreadsheetVersion.EXCEL2007)); } // not a named range, check for a table. // do this second, as tables are sheet-specific, but named ranges are not, and may not have a sheet name given. XSSFSheet sheet = (XSSFSheet)wb.GetSheet(wsSource.sheet); foreach (XSSFTable table in sheet.GetTables()) { if (table.Name.Equals(name)) { //case-sensitive? return(new AreaReference(table.StartCellReference, table.EndCellReference)); } } } throw new ArgumentException("Name '" + name + "' was not found."); }
private void method_7() { this.ienumNameMapping_0.Reset(); for (INameMapping mapping = this.ienumNameMapping_0.Next(); mapping != null; mapping = this.ienumNameMapping_0.Next()) { if (mapping.SourceObject is IName) { IName sourceObject = mapping.SourceObject as IName; if (sourceObject is IFeatureClassName) { this.int_0++; } else if (sourceObject is ITableName) { this.int_0++; } IEnumNameMapping children = mapping.Children; if (children != null) { children.Reset(); for (INameMapping mapping3 = children.Next(); mapping3 != null; mapping3 = children.Next()) { sourceObject = mapping3.SourceObject as IName; if (sourceObject is IFeatureClassName) { this.int_0++; } else if (sourceObject is ITableName) { this.int_0++; } } } } } this.progressBarObjectClass.Minimum = 0; this.progressBarObjectClass.Maximum = this.int_0; }
/// <summary> /// Sheet中引用校验引用区域 /// </summary> /// <param name="workbook"></param> /// <param name="sheet"></param> /// <param name="item"></param> private void SheetAddDataValidation(IWorkbook workbook, ISheet sheet, ColumnProperty item) { if (item == null || string.IsNullOrWhiteSpace(item.ConstraintReference)) //如果没有引用区域, 则退出 { return; } CellRangeAddressList regions = new CellRangeAddressList(2, 65535, item.ColumnIndex, item.ColumnIndex); IDataValidation dataValidate = null; if (excelVersion == ExcelVersion.XLSX) { XSSFSheet xssfSheet = sheet as XSSFSheet; XSSFDataValidationHelper dvHelper = new XSSFDataValidationHelper(xssfSheet); XSSFDataValidationConstraint dvConstraint = (XSSFDataValidationConstraint)dvHelper.CreateFormulaListConstraint(item.ConstraintReference); dataValidate = dvHelper.CreateValidation(dvConstraint, regions); dataValidate.EmptyCellAllowed = true; dataValidate.ShowErrorBox = true; dataValidate.CreateErrorBox("系统提示", "请选择指定的" + item.ColumnHeader + "选项"); dataValidate.ShowPromptBox = true; dataValidate.CreatePromptBox("", item.ColumnHeader); } else { IName range = workbook.CreateName(); range.RefersToFormula = item.ConstraintReference; range.NameName = item.ConstraintName; DVConstraint constraint = DVConstraint.CreateFormulaListConstraint(item.ConstraintName); dataValidate = new HSSFDataValidation(regions, constraint); dataValidate.EmptyCellAllowed = true; dataValidate.ShowErrorBox = true; dataValidate.CreateErrorBox("系统提示", "请选择指定的" + item.ColumnHeader + "选项"); dataValidate.ShowPromptBox = true; dataValidate.CreatePromptBox("", item.ColumnHeader); } sheet.AddValidationData(dataValidate); }
private void btnSetDatasources_Click(object sender, EventArgs e) { frmOpenFile file = new frmOpenFile { Text = "设置数据源", AllowMultiSelect = false }; if (this.idataLayer_0 is IFeatureLayer) { file.AddFilter(new MyGxFilterFeatureClasses(), true); } if ((file.DoModalOpen() == DialogResult.OK) && (file.Items.Count == 1)) { IGxObject obj2 = file.Items.get_Element(0) as IGxObject; IName internalObjectName = obj2.InternalObjectName; bool flag = false; if ((this.idataLayer_0.get_DataSourceSupported(internalObjectName) && (this.idataLayer_0 is IFeatureLayer)) && (obj2 is IGxDataset)) { IDataset dataset = (obj2 as IGxDataset).Dataset; if (dataset is IFeatureClass) { try { (this.idataLayer_0 as IFeatureLayer).FeatureClass = dataset as IFeatureClass; flag = true; this.method_0(); } catch { } } } if (!flag) { MessageBox.Show("无法把图层数据源设置为选择的数据!"); } } }
/// <summary> /// 叠置分析 /// </summary> /// <param name="axmapcontrol"></param> /// <param name="i">图层索引</param> /// <param name="name">输出图层名字</param> /// <returns></returns> public static FeatureLayer Stastic(AxMapControl axmapcontrol, int i, string name) { if (axmapcontrol == null || axmapcontrol.LayerCount < 2) { return(null); } // pLayer = axmapcontrol.Map.Layer(0); ILayer pLayer = axmapcontrol.ActiveView.FocusMap.get_Layer(i); IFeatureLayer pFeatureLayer = pLayer as IFeatureLayer; IFeatureClass pFeatureClass = pFeatureLayer.FeatureClass; ITable table = pFeatureClass as ITable; pLayer = axmapcontrol.ActiveView.FocusMap.get_Layer(axmapcontrol.LayerCount - 1); IFeatureLayer ppFeatureLayer = (IFeatureLayer)pLayer; IFeatureClass ppFeatureClass = ppFeatureLayer.FeatureClass; ITable ptable = (ITable)ppFeatureClass; //Intersect intersect=new Intersect() Double tol = 0.0; IWorkspaceFactory wspfctry = new ShapefileWorkspaceFactory(); IWorkspace pWorkSpace = wspfctry.OpenFromFile(SystemSet.Base_Map + "\\处理数据库\\实验数据", 0); IDataset pDataset = (IDataset)pWorkSpace; IName pName = pDataset.FullName; IDatasetName pDatasetName = new FeatureClassNameClass(); pDatasetName.Name = name; pDatasetName.WorkspaceName = (IWorkspaceName)pName; IFeatureClassName fcn = (IFeatureClassName)pDatasetName; IBasicGeoprocessor pBG = new BasicGeoprocessor(); IFeatureClass pOutFeatureClass = pBG.Intersect(table, false, ptable, false, tol, fcn); IFeatureLayer pOutFeatLayer = new FeatureLayerClass(); FeatureLayer featurelayer = (FeatureLayer)pOutFeatLayer; featurelayer.FeatureClass = pOutFeatureClass; featurelayer.Name = pOutFeatureClass.AliasName; return(featurelayer); }
private void method_11() { ICheckIn @in = new CheckInClass(); ESRI.ArcGIS.GeoDatabaseDistributed.IFeatureProgress_Event event2 = @in as ESRI.ArcGIS.GeoDatabaseDistributed.IFeatureProgress_Event; base.InitEvent(event2); if (this.bool_0) { IName name = this.iworkspaceName_0 as IName; IWorkspace workspace = name.Open() as IWorkspace; IWorkspaceReplicas replicas = workspace as IWorkspaceReplicas; IReplica replica = replicas.Replicas.Next(); try { @in.CheckInFromGDB(base.m_MasterWorkspaceName, replica.Name, this.iworkspaceName_0, this.bool_1, false); } catch { } } else { esriExportDataChangesOption esriExportToAccess = esriExportDataChangesOption.esriExportToAccess; if (Path.GetExtension(this.string_0).ToLower() == ".xml") { esriExportToAccess = esriExportDataChangesOption.esriExportToXML; } try { @in.CheckInFromDeltaFile(base.m_MasterWorkspaceName, this.string_1, this.string_0, esriExportToAccess, this.bool_1, false); } catch { } } base.ReleaseEvent(event2); }
public static void OpenMosaicDataset(AxMapControl MapControl, IMosaicDatasetName pMdName, DataTable dt = null) { MapControl.ClearLayers(); MapControl.SpatialReference = null; IDatasetName pDsName = pMdName as IDatasetName; string sName = pDsName.Name; IName pName = pMdName as IName; IMosaicDataset pMds = pName.Open() as IMosaicDataset; if (null != dt) { IFeatureClass pFc = pMds.Catalog; InitDataTable(pFc, dt); IFeatureCursor pCursor = pFc.Search(null, false); IFeature pfea = pCursor.NextFeature(); int j = 0; while (pfea != null) { DataRow dataRow = dt.NewRow(); for (int i = 0; i < pfea.Fields.FieldCount; i++) { dataRow[i] = pfea.get_Value(i).ToString(); } dt.Rows.Add(dataRow); pfea = pCursor.NextFeature(); j++; } ComReleaser.ReleaseCOMObject(pCursor); } IMosaicLayer pML = new MosaicLayerClass(); pML.CreateFromMosaicDataset(pMds); MapControl.AddLayer(pML as ILayer); MapControl.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGeography, null, null); }
private static INamespaceTypeDefinition /*?*/ GetNamespaceType(INameTable nameTable, INamespaceDefinition namespaceDefinition, string typeName, int genericParameterCount, ref int offset) { Contract.Requires(nameTable != null); Contract.Requires(namespaceDefinition != null); Contract.Requires(typeName != null); Contract.Requires(genericParameterCount >= 0); Contract.Requires(offset >= 0); Contract.Ensures(offset >= 0); int len = typeName.Length; if (offset >= len) { return(null); } int dotPos = typeName.IndexOf('.', offset); Contract.Assume(dotPos < 0 || (dotPos >= offset && dotPos < len)); if (dotPos < 0) { dotPos = len; } IName tName = nameTable.GetNameFor(typeName.Substring(offset, dotPos - offset)); foreach (var member in namespaceDefinition.GetMembersNamed(tName, false)) { var namespaceType = member as INamespaceTypeDefinition; if (namespaceType == null) { continue; } if (namespaceType.GenericParameterCount != genericParameterCount) { continue; } offset = dotPos + 1; return(namespaceType); } return(null); }
public void CalculateIdentifier_WhenCalled_ReturnsBase64StringBasedOnContact() { string displayName = _fixture.Create <string>(); IName name = _fixture.BuildNameMock(displayName).Object; string mailAddress = _fixture.Create <string>(); string primaryPhone = _fixture.Create <string>(); string secondaryPhone = _fixture.Create <string>(); IContact sut = CreateSut(name, mailAddress, primaryPhone, secondaryPhone); string result = sut.CalculateIdentifier(); using MemoryStream sourceMemoryStream = new MemoryStream(Encoding.UTF8.GetBytes($"{displayName.Trim().Replace(" ", "")}|{mailAddress.Trim().Replace(" ", "")}|{primaryPhone.Trim().Replace(" ", "")}|{secondaryPhone.Trim().Replace(" ", "")}")); using MemoryStream targetMemoryStream = new MemoryStream(); using GZipStream gZipStream = new GZipStream(targetMemoryStream, CompressionMode.Compress); gZipStream.Write(sourceMemoryStream.ToArray()); gZipStream.Flush(); targetMemoryStream.Seek(0, SeekOrigin.Begin); Assert.That(result, Is.EqualTo(Convert.ToBase64String(targetMemoryStream.ToArray()))); }
private static void RunPlugin(string fileName, StreamReader instream, VccOptions commandLineOptions) { HostEnvironment hostEnvironment = new HostEnvironment(commandLineOptions.PointerSize); hostEnvironment.Errors += new CciErrorHandler(commandLineOptions).HandleErrors; IName assemName = hostEnvironment.NameTable.GetNameFor(Path.GetFileNameWithoutExtension(fileName)); IName docName = hostEnvironment.NameTable.GetNameFor(Path.GetFileName(fileName)); List <IAssemblyReference> assemblyReferences = new List <IAssemblyReference>(); List <IModuleReference> moduleReferences = new List <IModuleReference>(); assemblyReferences.Add(hostEnvironment.LoadAssembly(hostEnvironment.CoreAssemblySymbolicIdentity)); assemblyReferences.Add(hostEnvironment.LoadAssembly(hostEnvironment.VccRuntimeAssemblyIdentity)); List <VccSourceDocument> programSources = new List <VccSourceDocument>(1); VccAssembly assem = new VccAssembly(assemName, Path.GetFullPath(fileName), hostEnvironment, commandLineOptions, assemblyReferences, moduleReferences, programSources); VccCompilationHelper helper = new VccCompilationHelper(assem.Compilation); programSources.Add(new VccSourceDocument(helper, docName, Path.GetFullPath(fileName), instream)); if (0 != Felt2Cast2Plugin(fileName, commandLineOptions, hostEnvironment, assem)) { fileErrorCount++; } }
// provide unique name (for IName) private static void ProvideUniqueName(IName name, HashSet <string> names, string dbName) { // default CLR name var name2 = ClrName.GetNodeName(name); var renameIndex = 1; while (true) { //if (!names.Add(name2.ToUpperInvariant()) || !IsValidClrObjectName(name2, dbName)) if (!names.Add(name2) || !IsValidClrObjectName(name2, dbName)) { name.RenameIndex = renameIndex; // set node's renaming index (for late renaming) name2 = Rename(name2, renameIndex++); } else { name.NodeName = name2; // set node name break; } } }
/// <summary> /// 作用:创建要素类 /// 作者:汪建龙 /// 编写时间:2016年12月27日10:50:16 /// </summary> /// <param name="saveFilePath"></param> /// <param name="spatialReference"></param> /// <param name="esriGeometryType"></param> /// <returns></returns> public static IFeatureClass CreateFeatrueClass(string saveFilePath, ISpatialReference spatialReference, esriGeometryType esriGeometryType) { IWorkspaceFactory workspaceFactory = new ShapefileWorkspaceFactoryClass(); var directory = System.IO.Path.GetDirectoryName(saveFilePath); var parent = System.IO.Path.GetDirectoryName(directory); var fileName = System.IO.Path.GetFileName(directory); IWorkspaceName workspaceName = workspaceFactory.Create(parent, fileName, null, 0); IName name = workspaceName as IName; IWorkspace workspace = name.Open() as IWorkspace; IFeatureWorkspace featureWorkspace = workspace as IFeatureWorkspace; IFields fields = new FieldsClass(); IFieldsEdit fieldsEdit = fields as IFieldsEdit; IFieldEdit fieldEdit = new FieldClass(); fieldEdit.Name_2 = "OID"; fieldEdit.AliasName_2 = "序号"; fieldEdit.Type_2 = esriFieldType.esriFieldTypeOID; fieldsEdit.AddField(fieldEdit as IField); fieldEdit = new FieldClass(); fieldEdit.Name_2 = "TCMC"; fieldEdit.AliasName_2 = "图层名称"; fieldEdit.Type_2 = esriFieldType.esriFieldTypeString; fieldsEdit.AddField(fieldEdit as IField); IGeometryDefEdit geometryDefEdit = new GeometryDefClass(); geometryDefEdit.SpatialReference_2 = spatialReference; geometryDefEdit.GeometryType_2 = esriGeometryType; fieldEdit = new FieldClass(); fieldEdit.Name_2 = "Shape"; fieldEdit.AliasName_2 = "形状"; fieldEdit.Type_2 = esriFieldType.esriFieldTypeGeometry; fieldEdit.GeometryDef_2 = geometryDefEdit; fieldsEdit.AddField(fieldEdit as IField); return(featureWorkspace.CreateFeatureClass(System.IO.Path.GetFileNameWithoutExtension(saveFilePath), fields, null, null, esriFeatureType.esriFTSimple, "shape", "")); }
public static HSSFDataValidation CreateListConstraint(this HSSFWorkbook book, int columnIndex, IEnumerable <string> values) { var sheetName = "_constraintSheet_"; ISheet sheet = book.GetSheet(sheetName) ?? book.CreateSheet(sheetName); var firstRow = sheet.GetRow(0); var conColumnIndex = firstRow == null ? 0 : firstRow.PhysicalNumberOfCells; var rowIndex = 0; var lastValue = ""; foreach (var value in values) { var row = sheet.GetRow(rowIndex) ?? sheet.CreateRow(rowIndex); row.CreateCell(conColumnIndex).SetCellValue(value); rowIndex++; lastValue = value; } //如果只有一个可选值,则增加一个相同的选项 if (values.Count() == 1) { var row = sheet.GetRow(rowIndex) ?? sheet.CreateRow(rowIndex); row.CreateCell(conColumnIndex).SetCellValue(lastValue); rowIndex++; } IName range = book.CreateName(); range.RefersToFormula = String.Format("{2}!${0}$1:${0}${1}", (Char)('A' + conColumnIndex), rowIndex.ToString(), sheetName); string rangeName = "dicRange" + columnIndex; range.NameName = rangeName; var cellRegions = new CellRangeAddressList(1, 65535, columnIndex, columnIndex); var constraint = DVConstraint.CreateFormulaListConstraint(rangeName); book.SetSheetHidden(book.GetSheetIndex(sheet), true); return(new HSSFDataValidation(cellRegions, constraint)); }
/// <summary> /// Applies the rule. /// </summary> /// <param name="node">The node instance to modify.</param> /// <param name="data">Private data from CheckConsistency().</param> public override void Apply(IOverLoopInstruction node, object data) { IExpression OverList = (IExpression)node.OverList; IList <ITypeName> IndexTypeNameList = ((Tuple <IList <ITypeName>, IList <ICompiledType> >)data).Item1; IList <ICompiledType> IndexTypeList = ((Tuple <IList <ITypeName>, IList <ICompiledType> >)data).Item2; for (int i = 0; i < node.IndexerList.Count; i++) { ITypeName ItemTypeName = IndexTypeNameList[i]; ICompiledType ItemType = IndexTypeList[i]; IName ItemName = node.IndexerList[i]; string ValidText = ItemName.ValidText.Item; IScopeAttributeFeature TypeFixedEntity = node.InnerLoopScope[ValidText]; TypeFixedEntity.FixFeatureType(ItemTypeName, ItemType); } node.ResolvedInitResult.Item = ResultType.Empty; node.AdditionalScope.Merge(node.InnerLoopScope); node.AdditionalScope.Seal(); }
public void OnKeyPress(EventArgs <ITextControl> args) { var oldLocation = _currentLocation; _navigationUtils.GetLocation( args.Value, curLocation => { var newLocation = _currentLocation = curLocation; if (!IsNewLocation(oldLocation, newLocation)) { return; } var keyboardNavigationEvent = Create <NavigationEvent>(); keyboardNavigationEvent.Location = newLocation; keyboardNavigationEvent.TypeOfNavigation = NavigationType.Keyboard; keyboardNavigationEvent.TriggeredBy = EventTrigger.Typing; Fire(keyboardNavigationEvent); }); }
private void AddColumns(IName name) { if (name != null && name is IPersonName personName) { AddColumnValue(personName.GivenName) .AddColumnValue(personName.MiddleName) .AddColumnValue(personName.Surname); return; } if (name != null && name is ICompanyName companyName) { AddEmptyColumn() .AddEmptyColumn() .AddColumnValue(companyName.FullName); return; } AddEmptyColumn() .AddEmptyColumn() .AddEmptyColumn(); }
private void button6_Click(object sender, EventArgs e) { IGxDialog dlg = new GxDialogClass(); IGxObjectFilter filter1 = new GxFilterFeatureClassesClass(); IGxObjectFilter filter2 = new GxFilterAnnotationFeatureClassesClass(); IGxObjectFilterCollection filters = dlg as IGxObjectFilterCollection; filters.AddFilter(filter1, true); filters.AddFilter(filter2, false); IEnumGxObject selection; if (dlg.DoModalOpen(this.Handle.ToInt32(), out selection)) { IGxObject gobj = selection.Next(); if (gobj != null) { this.tbxDataSource.Text = gobj.FullName; m_fcName = gobj.InternalObjectName; this.tbxCacheName.Text = gobj.BaseName; } } }
private AsmMetaRewriter( IMetadataHost host, PdbReader pdbReader, ITypeReference contractClassType, ITypeReference compilerGeneratedAttributeType, ITypeReference systemAttributeType, ITypeReference systemBooleanType, ITypeReference systemObjectType, ITypeReference systemStringType, ITypeReference systemVoidType ) : base(host) { this.pdbReader = pdbReader; this.MoveNextName = host.NameTable.GetNameFor("MoveNext"); this.contractClassType = contractClassType; this.compilerGeneratedAttributeType = compilerGeneratedAttributeType; this.systemAttributeType = systemAttributeType; this.systemBooleanType = systemBooleanType; this.systemObjectType = systemObjectType; this.systemStringType = systemStringType; this.systemVoidType = systemVoidType; }
private static void Test(IName name, string prefix) { var id = name.Identifier; var fixed1 = id.FixIdentifiers(); if (!id.Equals(fixed1)) { Console.WriteLine(@"change ({0}, without prefix):", name.GetType().Name); Console.WriteLine(@" before: " + id); Console.WriteLine(@" after: " + fixed1); } var fixed2 = id.FixIdentifiers(prefix); if (!id.Equals(fixed2)) { Console.WriteLine(@"change ({0}, with prefix {1}):", name.GetType().Name, prefix); Console.WriteLine(@" before: " + id); Console.WriteLine(@" after: " + fixed2); } }
internal static IName RicavaDatasetName(IDataset datasetInput, IWorkspaceName workspaceName) { IDatasetName datasetName = null; switch (datasetInput.Type) { case esriDatasetType.esriDTFeatureDataset: IFeatureDatasetName InFeatureDatasetName = new FeatureDatasetNameClass(); datasetName = (IDatasetName)InFeatureDatasetName; break; case esriDatasetType.esriDTFeatureClass: IFeatureClassName InFeatureClassName = new FeatureClassNameClass(); datasetName = (IDatasetName)InFeatureClassName; break; case esriDatasetType.esriDTTable: ITableName InTableName = new TableNameClass(); datasetName = (IDatasetName)InTableName; break; case esriDatasetType.esriDTGeometricNetwork: IGeometricNetworkName InGeometricNetworkName = new GeometricNetworkNameClass(); datasetName = (IDatasetName)InGeometricNetworkName; break; default: return(null); } // Set the name and workspace name of the new name object. datasetName.Name = datasetInput.Name; datasetName.WorkspaceName = workspaceName; // Cast the object to the IName interface and return it. IName name = (IName)datasetName; return(name); }
uint IInternFactory.GetNestedTypeReferenceInternedKey(ITypeReference containingTypeReference, IName typeName, uint genericParameterCount) { lock (GlobalLock.LockingObject) { return this.GetNestedTypeReferenceInternId(containingTypeReference, typeName, genericParameterCount); } }
uint GetNestedTypeReferenceInternId(ITypeReference containingTypeReference, IName typeName, uint genericParameterCount) { Contract.Requires(containingTypeReference != null); Contract.Requires(typeName != null); uint containingTypeReferenceInteredId = this.GetTypeReferenceInternId(containingTypeReference); foreach (NestedTypeStore nstTypeStore in this.NestedTypeHashtable.GetValuesFor((uint)typeName.UniqueKey)) { if ( nstTypeStore.ContainingTypeInternedId == containingTypeReferenceInteredId && nstTypeStore.GenericParameterCount == genericParameterCount ) { return nstTypeStore.InternedId; } } NestedTypeStore nstTypeStore1 = new NestedTypeStore(containingTypeReferenceInteredId, genericParameterCount, this.CurrentTypeInternValue++); this.NestedTypeHashtable.Add((uint)typeName.UniqueKey, nstTypeStore1); return nstTypeStore1.InternedId; }
/// <summary> /// Initializes a unit of metadata stored as a single artifact and potentially produced and revised independently from other units. /// Examples of units include .NET assemblies and modules, as well C++ object files and compiled headers. /// </summary> /// <param name="name">The name of the unit.</param> /// <param name="location">An indication of the location where the unit is or will be stored. This need not be a file system path and may be empty. /// The interpretation depends on the ICompilationHostEnviroment instance used to resolve references to this unit.</param> protected Unit(IName name, string location) { this.name = name; this.location = location; }
internal NamespaceTypeName(INameTable nameTable, NamespaceName/*?*/ namespaceName, IName name) { this.NamespaceName = namespaceName; this.Name = name; string nameStr = null; TypeCache.SplitMangledTypeName(name.Value, out nameStr, out this.genericParameterCount); if (this.genericParameterCount > 0) this.unmanagledTypeName = nameTable.GetNameFor(nameStr); else this.unmanagledTypeName = name; }
/// <summary> /// Allocates an object that represents a source document that is the composition of an ordered enumeration of fragments from other source document. /// The document is parsed according to the rules of a particular language, such as C#, to produce an object model that can be obtained via the CompilationPart property. /// </summary> /// <param name="name">The name of the document. Used to identify the document in user interaction.</param> protected CompositeSourceDocument(IName name) : base(name) { }
/// <summary> /// Allocates an object that represents a source document, such as file, which is parsed according to the rules of a particular langauge, /// such as C#, to produce an object model. /// </summary> /// <param name="name">The name of the document. Used to identify the document in user interaction.</param> /// <param name="location">The location where the document was found or where it will be stored.</param> /// <param name="text">The source text of the document.</param> protected PrimarySourceDocument(IName name, string location, string text) : base(name) { this.location = location; this.text = text; }
internal TypeNameParser( INameTable nameTable, string typeName ) { this.NameTable = nameTable; this.TypeName = typeName; this.Length = typeName.Length; this.Version = nameTable.GetNameFor("Version"); this.Retargetable = nameTable.GetNameFor("Retargetable"); this.PublicKeyToken = nameTable.GetNameFor("PublicKeyToken"); this.Culture = nameTable.GetNameFor("Culture"); this.neutral = nameTable.GetNameFor("neutral"); this.CurrentIdentifierInfo = nameTable.EmptyName; this.NextToken(false); }
void NextToken(bool assemblyName) { this.SkipSpaces(); if (this.CurrentIndex >= this.TypeName.Length) { this.CurrentTypeNameTokenKind = TypeNameTokenKind.EOS; return; } switch (this.TypeName[this.CurrentIndex]) { case '[': this.CurrentTypeNameTokenKind = TypeNameTokenKind.OpenBracket; this.CurrentIndex++; break; case ']': this.CurrentTypeNameTokenKind = TypeNameTokenKind.CloseBracket; this.CurrentIndex++; break; case '*': this.CurrentTypeNameTokenKind = TypeNameTokenKind.Astrix; this.CurrentIndex++; break; case '.': this.CurrentTypeNameTokenKind = TypeNameTokenKind.Dot; this.CurrentIndex++; break; case '+': this.CurrentTypeNameTokenKind = TypeNameTokenKind.Plus; this.CurrentIndex++; break; case ',': this.CurrentTypeNameTokenKind = TypeNameTokenKind.Comma; this.CurrentIndex++; break; case '&': this.CurrentTypeNameTokenKind = TypeNameTokenKind.Ampersand; this.CurrentIndex++; break; case '=': if (assemblyName) { this.CurrentTypeNameTokenKind = TypeNameTokenKind.Equals; this.CurrentIndex++; break; } goto default; default: { int currIndex = this.CurrentIndex; StringBuilder sb = new StringBuilder(); string name = this.TypeName; while (currIndex < this.Length) { char c = name[currIndex]; if (TypeNameParser.IsEndofIdentifier(c, assemblyName)) break; if (c == '\\') { currIndex++; if (currIndex < this.Length) { sb.Append(name[currIndex]); currIndex++; } else { break; } } else { sb.Append(c); currIndex++; } } this.CurrentIndex = currIndex; this.CurrentIdentifierInfo = this.NameTable.GetNameFor(sb.ToString()); this.CurrentTypeNameTokenKind = TypeNameTokenKind.Identifier; break; } } }
void RestoreScanner( ScannerState scannerState ) { this.CurrentIndex = scannerState.CurrentIndex; this.CurrentTypeNameTokenKind = scannerState.CurrentTypeNameTokenKind; this.CurrentIdentifierInfo = scannerState.CurrentIdentifierInfo; }
internal ScannerState( int currentIndex, TypeNameTokenKind currentTypeNameTokenKind, IName currentIdentifierInfo ) { this.CurrentIndex = currentIndex; this.CurrentTypeNameTokenKind = currentTypeNameTokenKind; this.CurrentIdentifierInfo = currentIdentifierInfo; }
internal NestedTypeName(INameTable nameTable, NominalTypeName containingTypeName, IName mangledName) { this.ContainingTypeName = containingTypeName; this.Name = mangledName; string nameStr = null; TypeCache.SplitMangledTypeName(mangledName.Value, out nameStr, out this.genericParameterCount); this.unmangledTypeName = nameTable.GetNameFor(nameStr); }
private NamespaceTypeName(INameTable nameTable, NamespaceName/*?*/ namespaceName, IName name, IName unmangledTypeName) { this.NamespaceName = namespaceName; this.Name = name; this.unmanagledTypeName = unmangledTypeName; }
/// <summary> /// Check if the given <see cref="IName"/> instance has the same <see cref="Name"/> as this instance. /// </summary> /// <returns> /// <c>true</c> if the given <see cref="IName"/> instance has the same <see cref="Name"/> as this instance; /// <c>false</c> otherwise. /// </returns> /// <param name='other'> /// The <see cref="IName"/> instance to compare with. /// </param> public virtual bool EqualName(IName other) { return this.Name == other.Name; }
/// <summary> /// Allocates an object that represents a source document, such as file, which is parsed according to the rules of a particular langauge, /// such as C#, to produce an object model. /// </summary> /// <param name="name">The name of the document. Used to identify the document in user interaction.</param> /// <param name="location">The location where the document was found or where it will be stored.</param> /// <param name="streamReader">A StreamReader instance whose BaseStream produces the contents of the document.</param> protected PrimarySourceDocument(IName name, string location, StreamReader streamReader) : base(name) { this.location = location; this.GetOwnStreamReaderAndReadAhead(streamReader); }
public IEnumerable<ITypeDefinitionMember> GetMatchingMembersNamed(IName name, bool ignoreCase, Function<ITypeDefinitionMember, bool> predicate) { return IteratorHelper.GetEmptyEnumerable<ITypeDefinitionMember>(); }
/// <summary> /// Allocates an object that represents a source document, such as a file, which is parsed according to the rules of a particular langauge, /// such as C#, to produce an object model. /// </summary> /// <param name="name">The name of the document. Used to identify the document in user interaction.</param> protected SourceDocument(IName name) { this.name = name; }
public IEnumerable<ITypeDefinitionMember> GetMembersNamed(IName name, bool ignoreCase) { return IteratorHelper.GetEmptyEnumerable<ITypeDefinitionMember>(); }
internal FieldOrPropertyNamedArgumentExpression( IName name, ITypeReference containingType, bool isField, ITypeReference fieldOrPropTypeReference, ExpressionBase expressionValue ) { this.Name = name; this.ContainingType = containingType; if (isField) this.Flags |= FieldOrPropertyNamedArgumentExpression.IsFieldFlag; this.fieldOrPropTypeReference = fieldOrPropTypeReference; this.ExpressionValue = expressionValue; }
/// <summary> /// Allocates an object that represents a .NET module. /// </summary> /// <param name="name">The name of the unit.</param> /// <param name="location">An indication of the location where the unit is or will be stored. This need not be a file system path and may be empty. /// The interpretation depends on the ICompilationHostEnviroment instance used to resolve references to this unit.</param> /// <param name="containingAssembly">The assembly that contains this module.</param> /// <param name="assemblyReferences">A list of the assemblies that are referenced by this module.</param> /// <param name="moduleReferences">A list of the modules that are referenced by this module.</param> protected Module(IName name, string location, IAssembly containingAssembly, IEnumerable<IAssemblyReference> assemblyReferences, IEnumerable<IModuleReference> moduleReferences) : base(name, location) { this.containingAssembly = containingAssembly; this.assemblyReferences = assemblyReferences; this.moduleReferences = moduleReferences; }
public void AddNamedObject(IName namedObject) { if (namedObject != null) { this.namedObjects.Add(namedObject.Name, namedObject); } }
internal NamespaceName(INameTable nameTable, NamespaceName/*?*/ parentNamespaceName, IName name) { this.ParentNamespaceName = parentNamespaceName; this.Name = name; if (parentNamespaceName == null) this.FullyQualifiedName = name; else this.FullyQualifiedName = nameTable.GetNameFor(parentNamespaceName.FullyQualifiedName.Value + "." + name); }