private void FmLoad(object sender, EventArgs e) { this.InitGrid(GridFile); var dal = new MCardDAL(); var modInfo = dal.GetMomRow(CardNo); var cardM = dal.GetCardMain(CardNo); string fldr = cardM.cInvCode.Substring(0, 4) + modInfo.cInvCode.Substring(2); basePath = Information.FileServerInfo.FtpAddress + "\\" + modInfo.cInvCode + "\\" + fldr; this.gridControl1.DataSource = this.GetFileList(basePath); this.GridFile.DoubleClick += new EventHandler(new Action <object, EventArgs>((x, y) => { var curfile = GridFile.GetFocusedRow() as FileInformaion; if (curfile.FileExt == "文件夹") { this.curPath = curfile.FileFullName; this.gridControl1.DataSource = this.GetFileList(curPath); } else { ProcessStartInfo info = new ProcessStartInfo(); info.WorkingDirectory = basePath; info.FileName = curfile.FileFullName; Process.Start(info); } })); }
public void Setup() { TransformationFactory = new CoordinateTransformationFactory(); Grid = GridFile.Open(GetType().Assembly.GetManifestResourceStream("ProjNet.NTv2.Tests.BETA2007.gsb"), true); Data = LoadData(); }
public void File_Save_Is_Not_Lossy() { using (var conn = Mongo.Create(TestHelper.ConnectionString())) { var ms = new MemoryStream(8000000);//about 8MB. for (int i = 0; i < 2000000; i++) { ms.Write(BitConverter.GetBytes(i), 0, 4); } var gridFS = conn.Database.Files(); var file = new GridFile(); file.ContentType = "application/unknown"; file.FileName = "Random_File_Test" + Guid.NewGuid().ToString(); file.Aliases = new String[] { "Alpha", "Bravo", "Delta", "Echo" }; file.Content = ms.ToArray(); gridFS.Save(file); var file2 = gridFS.FindOne(new { _id = file.Id }); Assert.Equal(file.Id, file2.Id); Assert.Equal(file.MD5Checksum, file2.MD5Checksum); Assert.Equal(file.ContentType, file2.ContentType); //Mongo stores dates as long, therefore, we have to use double->long rounding. Assert.Equal((long)((file.UploadDate - DateTime.MinValue)).TotalMilliseconds, (long)(file2.UploadDate - DateTime.MinValue).TotalMilliseconds); Assert.True(file.Aliases.SequenceEqual(file2.Aliases)); Assert.True(file.Content.SequenceEqual(file2.Content)); } }
public FileTag(Hashtable options) { StatusEvent.FireStatusError(this, statusEvent, Globalisation.GetString("")); if (options.ContainsKey("Db")) { this.Db = (MyDatabase)options["Db"]; } if (options.ContainsKey("Form")) { this.Form = (Form1)options["Form"]; } if (options.ContainsKey("listview")) { this.ListView = (ListView)options["listview"]; this.ListView.MouseDown += new MouseEventHandler(mouseDown_ListView); this.ListView.OwnerDraw = true; this.ListView.DrawItem += new DrawListViewItemEventHandler(ListView_DrawItem); } if (options.ContainsKey("infopanel")) { this.Infopanel = (RichTextBox)options["infopanel"]; } if (options.ContainsKey("GridFile")) { this.GridFile = (GridFile)options["GridFile"]; this.GridFileListView = this.GridFile.GetListView(); //this.GridFileListView.MouseDown += new MouseEventHandler(mouseDown_LoadTag); this.GridFileListView.SelectedIndexChanged += new System.EventHandler(this.center_listview_SelectedIndexChanged); } }
/// <summary> /// Reads a grid file from given stream. /// </summary> /// <param name="stream">The stream containing the binary grid data.</param> /// <returns>The grid file.</returns> public GridFile Read(Stream stream) { using (var reader = new BinaryReader(stream)) { var header = ReadHeader(reader); var g = new GridFile(header); for (int i = 0; i < header.NUM_FILE; i++) { var s = ReadGridHeader(reader); g.grids.Add(ReadGrid(reader, s)); } return(g); } }
public void TestNAD() { var NAD27 = SRIDReader.GetCSbyID(4267); var NAD83 = SRIDReader.GetCSbyID(4269); // https://github.com/OSGeo/proj-datumgrid/tree/master/north-america var grid = GridFile.Open(@"ntv2_0.gsb"); var ct = TransformationFactory.CreateFromCoordinateSystems(NAD27, NAD83, grid, false); // http://www.apsalin.com/nad-conversion.aspx // https://www.ngs.noaa.gov/NCAT/ double[] input = new[] { -79.378243, 43.664087 }; double[] expected = new[] { -79.3780316, 43.6641356 }; var actual = ct.MathTransform.Transform(input); CollectionAssert.AreEqual(expected, actual); }
private void BtnDown_Click(object sender, EventArgs e) { if (GridFile.FocusedRowHandle < 0) { return; } var curfile = GridFile.GetFocusedRow() as FileInformaion; if (curfile.FileExt == "文件夹") { return; } var sdg = new SaveFileDialog(); sdg.FileName = curfile.FileName; if (sdg.ShowDialog() == DialogResult.OK) { var sourcePath = curfile.FileFullName; File.Copy(sourcePath, sdg.FileName); } }
public void File_Delete_Works() { using (var conn = Mongo.Create(TestHelper.ConnectionString())) { var ms = new MemoryStream(50000); for (int i = 0; i < 2000; i++) { ms.Write(BitConverter.GetBytes(i), 0, 4); } var gridFS = conn.Database.Files(); var file = new GridFile(); file.ContentType = "application/unknown"; file.FileName = "Random_File_Test" + Guid.NewGuid().ToString(); file.Aliases = new String[] { "Alpha", "Bravo", "Delta", "Echo" }; file.Content = ms.ToArray(); gridFS.Save(file); var file2 = gridFS.FindOne(new { _id = file.Id }); Assert.NotNull(file2); gridFS.Delete(file2.Id); file2 = gridFS.FindOne(new { _id = file.Id }); Assert.Null(file2); } }
public GridReadStream(GridFile file, MongoCollection<GridFile> rootCollection) { this._gridFile = file; this._collection = rootCollection; }
/// <summary> /// Creates a transformation between two coordinate systems. /// </summary> /// <param name="factory">The coordinate transformation factory.</param> /// <param name="sourceCS">Source coordinate system.</param> /// <param name="targetCS">Target coordinate system.</param> /// <param name="grid">The grid file.</param> /// <param name="inverse">Indicates whether to use the inverse grid transform.</param> /// <returns></returns> public static ICoordinateTransformation CreateFromCoordinateSystems(this CoordinateTransformationFactory factory, CoordinateSystem sourceCS, CoordinateSystem targetCS, GridFile grid, bool inverse) { if (sourceCS == null) { throw new ArgumentNullException(nameof(sourceCS)); } if (targetCS == null) { throw new ArgumentNullException(nameof(targetCS)); } var ct = factory.CreateFromCoordinateSystems(sourceCS, targetCS); if (sourceCS is ProjectedCoordinateSystem && targetCS is ProjectedCoordinateSystem) { var list = GetCoordinateTransformationList(ct); if (list.Count != 3) { throw new NotSupportedException("No support for grid transformation."); } // Replace the geographic transform in the middle with our grid transformation. list[1] = CreateGridTransformation(list[1].SourceCS, list[1].TargetCS, grid, inverse); } else if (sourceCS is GeographicCoordinateSystem source && targetCS is GeographicCoordinateSystem target) { return(CreateGridTransformation(source, target, grid, inverse)); }
/// <summary> /// Creates a transformation between two coordinate systems. /// </summary> /// <param name="factory">The coordinate transformation factory.</param> /// <param name="sourceCS">Source coordinate system.</param> /// <param name="targetCS">Target coordinate system.</param> /// <param name="gridFile">The grid file path.</param> /// <param name="inverse">Indicates whether to use the inverse grid transform.</param> /// <returns></returns> public static ICoordinateTransformation CreateFromCoordinateSystems(this CoordinateTransformationFactory factory, CoordinateSystem sourceCS, CoordinateSystem targetCS, string gridFile, bool inverse) { return(CreateFromCoordinateSystems(factory, sourceCS, targetCS, GridFile.Open(gridFile), inverse)); }
public GridTransformation(GridFile grid, bool inverse) { this.inverse = inverse; this.grid = grid; }