public int CreateAsicMapFile(string srcDir, string dstDir, string typeName, string lotNo, bool[] waferList, string explorerPath, out int[] waPassList, out int[] waFailList, out int passCount, out int failCount) { int count = 0; string srcFile = ""; string dstFile = ""; string errMsg = ""; LotDatInformation lotDatInfo = null; WaferMap waferData = null; waPassList = new int[CommonConstants.WAFER_MAX]; waFailList = new int[CommonConstants.WAFER_MAX]; passCount = 0; failCount = 0; var testCount = 0; try { // LOT.DAT読込 srcFile = srcDir + "\\" + CommonConstants.LOT_DAT_STRING; var rc = fileAccessClass.LotDataReadToClass(srcFile, ref lotDatInfo, ref errMsg); if (rc != CommonConstants.ECODE_OK) { Utils.Utils.WriteLog(view, "LOT.DAT読込失敗 (" + typeName + ")"); return(rc); } // コピー先のファイルを削除 fileCopyClass.LotDatFileDelete(dstDir); foreach (var w in waferList.Select((v, j) => new { v, j })) { if (w.v) { srcFile = srcDir + "\\" + CommonConstants.WAFER_DAT_STRING + string.Format("{0:00}", (w.j + 1)) + ".dat"; rc = fileAccessClass.WaferDataReadToClass(srcFile, ref lotDatInfo, ref waferData, false, ref errMsg); if (rc != CommonConstants.ECODE_OK) { Utils.Utils.WriteLog(view, "Error : WaferDataReadToClass"); return(rc); } if (Directory.Exists(dstDir) == false) { Directory.CreateDirectory(dstDir); } dstFile = dstDir + "\\" + CommonConstants.WAFER_DAT_STRING + string.Format("{0:00}", w.j + 1) + ".dat"; File.Copy(srcFile, dstFile); // ファイルの情報を更新 fileAccessClass.WaDataUpDate(dstFile, (w.j + 1), ref errMsg); waPassList[w.j] = waferData.wafer_test_sum_info.pass_total; waFailList[w.j] = waferData.wafer_test_sum_info.fail_total; passCount += waferData.wafer_test_sum_info.pass_total; failCount += waferData.wafer_test_sum_info.fail_total; testCount += waferData.wafer_test_sum_info.test_total; } } // LOT.DATのコピー srcFile = srcDir + "\\" + CommonConstants.LOT_DAT_STRING; dstFile = dstDir + "\\" + CommonConstants.LOT_DAT_STRING; File.Copy(srcFile, dstFile); rc = fileAccessClass.LotData_UpdateSomeInfo(dstFile, typeName, lotNo, waferList, passCount, failCount, testCount, ref errMsg); if (rc != CommonConstants.ECODE_OK) { Utils.Utils.WriteLog(view, "Error : LotData_UpdateSomeInfo"); return(rc); } } catch (Exception ex) { return(CommonConstants.ECODE_ERROR); } return(CommonConstants.ECODE_OK); }
static void Main(string[] args) { var builder = new FlatBufferBuilder(1); var waferid = builder.CreateString("TestWafer"); var wnum = (short)1; var lotid = builder.CreateString("LotWafer"); var binFormat = format.Hex; var data = new short[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; var map_info = WaferMap.CreateMapVector(builder, data); var mitMap = WaferMap.CreateWaferMap(builder, waferid, wnum, lotid, binFormat, map_info); builder.Finish(mitMap.Value); /// serialize to file /// var filename = "D:\\Temp\\csharp.dat"; FileStream stream = File.Create(filename); var formatter = new BinaryFormatter(); Console.WriteLine("Serializing buffer"); byte[] savebuf = builder.SizedByteArray(); formatter.Serialize(stream, savebuf); stream.Close(); // access read buffer var buf = builder.DataBuffer; // Get access to the root: var readMap = WaferMap.GetRootAsWaferMap(buf); Console.WriteLine("LotId : " + readMap.Lotid); Console.WriteLine("BinFormat : " + readMap.BinFormat); for (int i = 0; i < readMap.MapLength; i++) { Console.WriteLine(readMap.Map(i).ToString()); } filename = "D:\\Temp\\csharp.dat"; // deserialize from file stream = File.OpenRead(filename); Console.WriteLine("Deserializing buffer"); byte[] loadbuf = (byte[])formatter.Deserialize(stream); stream.Close(); var loadBytebuf = new ByteBuffer(loadbuf); var loadMap = WaferMap.GetRootAsWaferMap(loadBytebuf); Console.WriteLine("LotId : " + loadMap.Lotid); // binary reader filename = "D:\\Temp\\output.dat"; // deserialize from file BinaryReader reader = new BinaryReader(File.Open(@"D:\\Temp\\output.dat", FileMode.Open)); int length = (int)reader.BaseStream.Length; Console.WriteLine("binary read buffer"); byte[] loadbinbuf = reader.ReadBytes(length); reader.Close(); var loadbinBytebuf = new ByteBuffer(loadbinbuf); var loadbinMap = WaferMap.GetRootAsWaferMap(loadbinBytebuf); Console.WriteLine("LotId : " + loadbinMap.Lotid); for (int i = 0; i < loadbinMap.MapLength; i++) { Console.WriteLine(loadbinMap.Map(i).ToString()); } }
public int CreateMapFile(string srcDir, string dstDir, string typeName, string lotNo, int quantity, string explorerPath, out int waPass, out int waFail) { int i; int count = 0; string srcFile = ""; string dstFile = ""; string errMsg = ""; bool[] waferList = new bool[CommonConstants.WAFER_MAX]; LotDatInformation lotDatInfo = null; WaferMap waferData = null; waPass = 0; waFail = 0; try { // LOT.DAT読込 srcFile = srcDir + "\\" + CommonConstants.LOT_DAT_STRING; var rc = fileAccessClass.LotDataReadToClass(srcFile, ref lotDatInfo, ref errMsg); if (rc != CommonConstants.ECODE_OK) { Utils.Utils.WriteLog(view, "LOT.DAT読込失敗 (" + typeName + ")"); return(rc); } // コピー先のファイルを削除 fileCopyClass.LotDatFileDelete(dstDir); // WA-**.DATの検索 for (i = 0; i < CommonConstants.WAFER_MAX; i++) { srcFile = srcDir + "\\" + CommonConstants.WAFER_DAT_STRING + string.Format("{0:00}", (i + 1)) + ".dat"; if (File.Exists(srcFile) == true) { break; } } if (i >= CommonConstants.WAFER_MAX) { Utils.Utils.WriteLog(view, "WA-xx.datが存在しません (" + typeName + ")"); return(CommonConstants.ECODE_ERROR); } // 未使用?? var versionType = fileAccessClass.GetVersionType(srcDir + "\\" + CommonConstants.LOT_DAT_STRING); rc = fileAccessClass.WaferDataReadToClass(srcFile, ref lotDatInfo, ref waferData, false, ref errMsg); if (rc != CommonConstants.ECODE_OK) { Utils.Utils.WriteLog(view, "Error : WaferDataReadToClass"); return(rc); } if (Directory.Exists(dstDir) == false) { Directory.CreateDirectory(dstDir); } for (i = 0; i < quantity; i++) { dstFile = dstDir + "\\" + CommonConstants.WAFER_DAT_STRING + string.Format("{0:00}", (i + 1)) + ".dat"; File.Copy(srcFile, dstFile); // ファイルの情報を更新 fileAccessClass.WaDataUpDate(dstFile, (i + 1), ref errMsg); count++; } var passCount = waferData.wafer_test_sum_info.pass_total * count; var failCount = waferData.wafer_test_sum_info.fail_total * count; var testCount = waferData.wafer_test_sum_info.test_total * count; waPass = waferData.wafer_test_sum_info.pass_total; waFail = waferData.wafer_test_sum_info.fail_total; // LOT.DATのコピー srcFile = srcDir + "\\" + CommonConstants.LOT_DAT_STRING; dstFile = dstDir + "\\" + CommonConstants.LOT_DAT_STRING; File.Copy(srcFile, dstFile); // LOT.DATの情報更新 for (i = 0; i < waferList.Length; i++) { if (i < quantity) { waferList[i] = true; } else { waferList[i] = false; } } rc = fileAccessClass.LotData_UpdateSomeInfo(dstFile, typeName, lotNo, waferList, passCount, failCount, testCount, ref errMsg); if (rc != CommonConstants.ECODE_OK) { Utils.Utils.WriteLog(view, "Error : LotData_UpdateSomeInfo"); return(rc); } } catch (Exception ex) { return(CommonConstants.ECODE_ERROR); } return(CommonConstants.ECODE_OK); }
static void Main(string[] args) { var byteData1 = new byte[0]; var builder = new FlatBufferBuilder(1); var waferid = builder.CreateString("TestWafer"); var wnum = (short)1; var lotid = builder.CreateString("LotWafer"); var binFormat = format.Hex; var data = new short[] { 0, 10, 2, 3, 4, 5, 6, 7, 89, 9, 0, 10, 2, 3, 4, 5, 6, 7, 89, 9, 0, 10, 2, 3, 4, 5, 6, 7, 89, 9, 0, 10, 2, 3, 4, 5, 6, 7, 89, 9 }; //// CMitFbMap fbWrite = new CMitFbMap(); var fbFilename = @"D:\Temp\csharp.fbm"; fbWrite.Write(fbFilename, data); CMitFbMap fbRead = new CMitFbMap(); fbRead.Read(fbFilename); //// var mapdata = WaferMap.CreateMapVector(builder, data); WaferMap.StartWaferMap(builder); WaferMap.AddMap(builder, mapdata); WaferMap.AddMaxCol(builder, 5); WaferMap.AddMaxRow(builder, 2); WaferMap.AddLotNum(builder, lotid); WaferMap.AddBincodeFormat(builder, binFormat); var mitMap = WaferMap.EndWaferMap(builder); builder.Finish(mitMap.Value); /// serialize to file /// var filename = @"D:\Temp\csharp.dat"; FileStream stream = File.Create(filename); var formatter = new BinaryFormatter(); Console.WriteLine("Serializing buffer"); byte[] savebuf = builder.SizedByteArray(); formatter.Serialize(stream, savebuf); stream.Close(); // access read buffer var buf = builder.DataBuffer; // Get access to the root: var readMap = WaferMap.GetRootAsWaferMap(buf); Console.WriteLine("LotId : " + readMap.LotNum); Console.WriteLine("BinFormat : " + readMap.BincodeFormat); for (int i = 0; i < readMap.MapLength; i++) { Console.WriteLine(readMap.Map(i).ToString()); } filename = @"D:\Temp\csharp.dat"; // deserialize from file stream = File.OpenRead(filename); Console.WriteLine("Deserializing buffer"); byte[] loadbuf = (byte[])formatter.Deserialize(stream); stream.Close(); var loadBytebuf = new ByteBuffer(loadbuf); var loadMap = WaferMap.GetRootAsWaferMap(loadBytebuf); Console.WriteLine("LotId : " + loadMap.LotNum); // binary reader //filename = @"D:\Temp\output.dat"; //// deserialize from file //BinaryReader reader = new BinaryReader(File.Open(@"D:\Temp\output.dat", FileMode.Open)); //int length = (int)reader.BaseStream.Length; //Console.WriteLine("binary read buffer"); //byte[] loadbinbuf = reader.ReadBytes(length); //reader.Close(); //var loadbinBytebuf = new ByteBuffer(loadbinbuf); //var loadbinMap = WaferMap.GetRootAsWaferMap(loadbinBytebuf); //Console.WriteLine("LotId : " + loadbinMap.LotNum); //for (int i = 0; i < loadbinMap.MapLength; i++) //{ // Console.WriteLine(loadbinMap.Map(i).ToString()); //} var test = new CTestIni(); test.fn(); // const int INT_SIZE = 4; const int DBL_SIZE = sizeof(double); double[] dblArray = { 1.999, 2.899, 3.933 }; int[] arr = { 2, 4, 6, 8, 10, 12, 14, 16, 18, 20 }; byte[] byteData = new byte[INT_SIZE * 10]; byte[] byteDbl = new byte[DBL_SIZE * 3]; Buffer.BlockCopy(dblArray, 0, byteDbl, 0, DBL_SIZE * 3); //Buffer.BlockCopy(arr, 0, byteData, 0, INT_SIZE * 10); foreach (byte value in byteDbl) { Console.Write("{0} ", value); } Console.Write("\n"); int[] outBuf = new int [10]; double[] dblBuf = new double[3]; //Buffer.BlockCopy(byteData, 0, outBuf, 0, INT_SIZE * 10); Buffer.BlockCopy(byteDbl, 0, dblBuf, 0, DBL_SIZE * 3); foreach (double value in dblBuf) { Console.Write("{0} ", value); } var watch = System.Diagnostics.Stopwatch.StartNew(); watch.Stop(); var elapsedMs = watch.ElapsedMilliseconds; //// //watch.Restart(); string strData = "147968949055"; int val; Int32.TryParse(strData, out val); //int nData = System.Convert.ToInt32(strData); string strName = "M2 Input X-Axis"; bool bStatus = strName.Contains("Input Y-Axis"); }