public static void BeginCount(int count, ContorlMinAndMaxValue contorlMinAndMaxValue, RefreshValue refreshValue) { contorlMinAndMaxValue(1, count); for (int i = 1; i <= count; i++) { Thread.Sleep(25); refreshValue(i); } }
public static void BeginCount(ContorlMinAndMaxValue contorlMinAndMaxValue, RefreshValue refreshValue) { contorlMinAndMaxValue(1, 68); for (int i = 1; i <= 68; i++) { Thread.Sleep(100); refreshValue(i); } }
public static void MergeManyShpFile(object args) { Collection <object> argCollection = (Collection <object>)args; string[] files = (string[])argCollection[0]; string targetFile = (string)argCollection[1]; ContorlMinAndMaxValue contorlMinAndMaxValue = (ContorlMinAndMaxValue)argCollection[2]; RefreshValue refreshValue = (RefreshValue)argCollection[3]; MergeManyShpFile(files, targetFile, contorlMinAndMaxValue, refreshValue); }
public static void MergeManyShpFile(string[] sourceFiles, String saveFileName, ContorlMinAndMaxValue contorlMinAndMaxValue, RefreshValue refreshValue) { BinaryReader binaryReader1 = null; FileStream fileStreamRead = null; FileStream fileStreamWrite = null; fileStreamWrite = new FileStream(saveFileName, FileMode.Create, FileAccess.Write); BinaryWriter binaryWriter = new BinaryWriter(fileStreamWrite); Record record = new Record(); int recordLastNum = 0; ShpFileHeader shpFileHeaderTatal = new ShpFileHeader(); ShpFileHeader shpFileHeaderRead = new ShpFileHeader(); contorlMinAndMaxValue(0, sourceFiles.Length - 1); for (int i = 0; i < sourceFiles.Length; i++) { fileStreamRead = new FileStream(sourceFiles[i], FileMode.Open, FileAccess.Read, FileShare.None); binaryReader1 = new BinaryReader(fileStreamRead); shpFileHeaderRead = ShapeFileFunction.ReadShpFileHeader(binaryReader1); if (i == 0) { ShapeFileFunction.WriteShpFileHeader(shpFileHeaderRead, binaryWriter); shpFileHeaderTatal = shpFileHeaderRead; } else { shpFileHeaderTatal = ShapeFileFunction.MergeShpHeader(shpFileHeaderTatal, shpFileHeaderRead); } while (binaryReader1.BaseStream.Position < binaryReader1.BaseStream.Length) { record = ShapeFileFunction.ReadRecord(binaryReader1); record.recordNum = recordLastNum++; ShapeFileFunction.WriteRecord(record, binaryWriter); } binaryReader1.Close(); fileStreamRead.Close(); Thread.Sleep(500); refreshValue(i); } fileStreamWrite.Seek(0, SeekOrigin.Begin); WriteShpFileHeader(shpFileHeaderTatal, binaryWriter); binaryWriter.Close(); fileStreamWrite.Close(); }