internal IPrintManagerProvider GetPrintManager(string key, PrintMode printMode) { IPrintManagerProvider provider = null; Dictionary<PrintMode, IPrintManagerProvider> printManagerProvider; if (false == this.printManagerProviderDictionary.TryGetValue(key, out printManagerProvider)) { printManagerProvider = this.printManagerProviderDictionary["DEFAULT"]; } if (false == printManagerProvider.TryGetValue(printMode, out provider)) { throw new NotImplementedException("Print Manager provider for key= '" + key + "' and Print Mode '" + printMode + "' not implemented. Check configuration"); } return provider; }
private void TestBandwidth(Context context, Device[] devices, int start, int end, int increment, TestMode testMode, MemoryCopyKind memoryCopyKind, PrintMode printMode, AccessMode accessMode, MemoryMode memoryMode, int startDevice, int endDevice) { switch (testMode) { case TestMode.Quick: TestBandwidthQuick(context, devices, DefaultSize, memoryCopyKind, printMode, accessMode, memoryMode, startDevice, endDevice); break; case TestMode.Range: TestBandwidthRange(context, devices, start, end, increment, memoryCopyKind, printMode, accessMode, memoryMode, startDevice, endDevice); break; case TestMode.Shmoo: TestBandwidthShmoo(context, devices, memoryCopyKind, printMode, accessMode, memoryMode, startDevice, endDevice); break; default: break; } }
public IPrintManagerProvider GetPrintManager(string key, PrintMode printMode) { switch (key.ToUpperInvariant()) { case "PM": { switch (printMode) { case PrintMode.Sync: return new PrintManagerSyncProvider(this.factory, this.provider); case PrintMode.Async: return new PrintManagerAsyncProvider(this.factory, this.provider, this.provider); default: throw new NotSupportedException("printMode"); } } default: throw new NotSupportedException(string.Format("Key = {0}", key)); } }
private void TestBandwidthShmoo(Context context, Device[] devices, MemoryCopyKind memoryCopyKind, PrintMode printMode, AccessMode accessMode, MemoryMode memoryMode, int startDevice, int endDevice) { throw new NotImplementedException(); }
private void TestBandwidthRange(Context context, Device[] devices, int start, int end, int increment, MemoryCopyKind memoryCopyKind, PrintMode printMode, AccessMode accessMode, MemoryMode memoryMode, int startDevice, int endDevice) { // count the number of copies we're going to run int count = 1 + ((end - start) / increment); int[] memSizes = new int[count]; double[] bandwidths = new double[count]; // Before calculating the cumulative bandwidth, initialize bandwidths array to NULL for (int i = 0; i < count; i++) { bandwidths[i] = 0.0; } // Use the device asked by the user for (int currentDevice = startDevice; currentDevice <= endDevice; currentDevice++) { // Allocate command queue for the device (dealloc first if already allocated) using (CommandQueue queue = CreateQueue(context, devices[currentDevice])) { // run each of the copies for (int i = 0; i < count; i++) { memSizes[i] = start + (i * increment); switch (memoryCopyKind) { case MemoryCopyKind.DeviceToHost: bandwidths[i] += TestDeviceToHostTransfer(context, queue, memSizes[i], accessMode, memoryMode); break; case MemoryCopyKind.HostToDevice: bandwidths[i] += TestHostToDeviceTransfer(context, queue, memSizes[i], accessMode, memoryMode); break; case MemoryCopyKind.DeviceToDevice: bandwidths[i] += TestDeviceToDeviceTransfer(context, queue, memSizes[i]); break; } } } } // Complete the bandwidth computation on all the devices // print results if (printMode == PrintMode.Csv) { PrintResultsCsv(memSizes, bandwidths, count, memoryCopyKind, accessMode, memoryMode, 1 + endDevice - startDevice); } else { PrintResultsReadable(memSizes, bandwidths, count, memoryCopyKind, accessMode, memoryMode, 1 + endDevice - startDevice); } }
private void TestBandwidthQuick(Context context, Device[] devices, int size, MemoryCopyKind memoryCopyKind, PrintMode printMode, AccessMode accessMode, MemoryMode memoryMode, int startDevice, int endDevice) { TestBandwidthRange(context, devices, size, size, DefaultIncrement, memoryCopyKind, printMode, accessMode, memoryMode, startDevice, endDevice); }
public static void Print(this IEnumerable <IFunction> me, PrintMode mode) { switch (mode) { case PrintMode.OneLine: foreach (var fun in me) { Printer.WriteLine(fun.Id.ToString() + "-" + fun.Name); } break; case PrintMode.PropertyList: break; case PrintMode.Table: var idLength = me.Select(p => p.Id.ToString().Length).Union(new[] { "ID".Length }).Max(); var nameLength = me.Select(p => p.Name.ToString().Length).Union(new[] { "NAME".Length }).Max(); //var typeLength = new[] { "TYPE".Length }.Concat(me.SelectMany(p => p.Scopes.Select(s => s.Discriminator.TypeName.Length))).Max(); //var nameLength = new[] { "NAME".Length }.Concat(me.SelectMany(p => p.Scopes.Select(s => s.Discriminator.Name.Length))).Max(); //var propagationLength = new[] { "PROPAGATION".Length }.Concat(me.SelectMany(p => p.Scopes.Select(s => s.Propagation.ToString().Length))).Max(); Printer.WriteLine("┌" + ("".PadRight(idLength, '─')) + "┬" + ("".PadRight(nameLength, '─')) //+ "┬" + ("".PadRight(typeLength, '─')) //+ "┬" + ("".PadRight(nameLength, '─')) //+ "┬" + ("".PadRight(propagationLength, '─')) + "┐"); if (me.Any()) { Printer.WriteLine("│" + ("ID".PadRight(idLength, ' ')) + "│" + ("NAME".PadRight(nameLength, ' ')) //+ "│" + ("TYPE".PadRight(typeLength, ' ')) //+ "│" + ("NAME".PadRight(nameLength, ' ')) //+ "│" + ("PROPAGATION".PadRight(propagationLength, ' ')) + "│"); Printer.WriteLine("├" + ("".PadRight(idLength, '─')) + "┼" + ("".PadRight(nameLength, '─')) //+ "┼" + ("".PadRight(typeLength, '─')) //+ "┼" + ("".PadRight(nameLength, '─')) //+ "┼" + ("".PadRight(propagationLength, '─')) + "┤"); } foreach (var per in me) { //var list = per.Scopes.ToList(); //if (list.Count == 0) //{ Printer.WriteLine("│" + per.Id.ToString().PadRight(idLength, ' ') + "│" + per.Name.PadRight(nameLength, ' ') + "│" + //("".PadRight(typeLength, ' ')) + "│" + //("".PadRight(nameLength, ' ')) + "│" + //("".PadRight(propagationLength, ' ')) + "│" + ""); //} //else //{ // for (int i = 0; i < list.Count; i++) // { // Printer.Print("│" + // ((i == 0 ? per.Value.ToString() : "").PadRight(valueLength, ' ')) + "│" + // ((i == 0 ? per.Function.Name : "").PadRight(functionLength, ' ')) + "│" + // (list[i].Discriminator.TypeName.PadRight(typeLength, ' ')) + "│" + // (list[i].Discriminator.Name.PadRight(nameLength, ' ')) + "│" + // (list[i].Propagation.ToString().PadRight(propagationLength, ' ')) + "│"); // } //} } Printer.WriteLine("└" + ("".PadRight(idLength, '─')) + "┴" + ("".PadRight(nameLength, '─')) //+ "┴" + ("".PadRight(typeLength, '─')) //+ "┴" + ("".PadRight(nameLength, '─')) //+ "┴" + ("".PadRight(propagationLength, '─')) + "┘"); break; } }
public DynamicMethod ComposePatchedMethod() { DynamicMethod method = AllocatePatchMethod(); var generator = new LoggingIlGenerator(method.GetILGenerator(), PrintMode.HasFlag(PrintModeEnum.EmittedReflection) ? LogLevel.Info : LogLevel.Trace); List <MsilInstruction> il = EmitPatched((type, pinned) => new MsilLocal(generator.DeclareLocal(type, pinned))).ToList(); var dumpTarget = DumpTarget != null?File.CreateText(DumpTarget) : null; try { const string gap = "\n\n\n\n\n"; void LogTarget(PrintModeEnum mode, bool err, string msg) { if (DumpMode.HasFlag(mode)) { dumpTarget?.WriteLine((err ? "ERROR " : "") + msg); } if (!PrintMode.HasFlag(mode)) { return; } if (err) { _log.Error(msg); } else { _log.Info(msg); } } if (PrintMsil || DumpTarget != null) { lock (_log) { var ctx = new MethodContext(_method); ctx.Read(); LogTarget(PrintModeEnum.Original, false, "========== Original method =========="); MethodTranspiler.IntegrityAnalysis((a, b) => LogTarget(PrintModeEnum.Original, a, b), ctx.Instructions, true); LogTarget(PrintModeEnum.Original, false, gap); LogTarget(PrintModeEnum.Emitted, false, "========== Desired method =========="); MethodTranspiler.IntegrityAnalysis((a, b) => LogTarget(PrintModeEnum.Emitted, a, b), il); LogTarget(PrintModeEnum.Emitted, false, gap); } } MethodTranspiler.EmitMethod(il, generator); try { PatchUtilities.Compile(method); } catch { lock (_log) { var ctx = new MethodContext(method); ctx.Read(); MethodTranspiler.IntegrityAnalysis((err, msg) => _log.Warn(msg), ctx.Instructions); } throw; } if (PrintMsil || DumpTarget != null) { lock (_log) { var ctx = new MethodContext(method); ctx.Read(); LogTarget(PrintModeEnum.Patched, false, "========== Patched method =========="); MethodTranspiler.IntegrityAnalysis((a, b) => LogTarget(PrintModeEnum.Patched, a, b), ctx.Instructions, true); LogTarget(PrintModeEnum.Patched, false, gap); } } } finally { dumpTarget?.Close(); } return(method); }
private void TestBandwidthRange(Context context, Device[] devices, int start, int end, int increment, MemoryCopyKind memoryCopyKind, PrintMode printMode, AccessMode accessMode, MemoryMode memoryMode, int startDevice, int endDevice) { //count the number of copies we're going to run int count = 1 + ((end - start) / increment); int[] memSizes = new int[count]; double[] bandwidths = new double[count]; // Before calculating the cumulative bandwidth, initialize bandwidths array to NULL for (int i = 0; i < count; i++) bandwidths[i] = 0.0; // Use the device asked by the user for (int currentDevice = startDevice; currentDevice <= endDevice; currentDevice++) { // Allocate command queue for the device (dealloc first if already allocated) using (CommandQueue queue = CreateQueue(context, devices[currentDevice])) { //run each of the copies for (int i = 0; i < count; i++) { memSizes[i] = start + i * increment; switch (memoryCopyKind) { case MemoryCopyKind.DeviceToHost: bandwidths[i] += TestDeviceToHostTransfer(context, queue, memSizes[i], accessMode, memoryMode); break; case MemoryCopyKind.HostToDevice: bandwidths[i] += TestHostToDeviceTransfer(context, queue, memSizes[i], accessMode, memoryMode); break; case MemoryCopyKind.DeviceToDevice: bandwidths[i] += TestDeviceToDeviceTransfer(context, queue, memSizes[i]); break; } } } } // Complete the bandwidth computation on all the devices //print results if (printMode == PrintMode.Csv) { PrintResultsCsv(memSizes, bandwidths, count, memoryCopyKind, accessMode, memoryMode, (1 + endDevice - startDevice)); } else { PrintResultsReadable(memSizes, bandwidths, count, memoryCopyKind, accessMode, memoryMode, (1 + endDevice - startDevice)); } }
/// <summary> /// CAREFUL: THIS IS A __DEBUG METHOD, WORKS BEST ON __DEBUG FLAG /// Prints information message by code, if isError then as error string. /// Exits program on exit == true /// Optionally prints appended string /// </summary> /// <param name="code"></param> /// <param name="isError"></param> /// <param name="exit"></param> public static void PrintInformation(Configuration.InformationStrings code, string optstring, PrintMode mode, bool exit) { MethodBase m = new StackTrace().GetFrame(1).GetMethod(); string methodName = "N/A"; string className = "N/A"; string logMessage = ""; if (m != null) { methodName = m.Name; className = m.ReflectedType.Name; } switch (mode) { case PrintMode.ERROR: logMessage += "ERROR:"; #if __DEBUG Console.ForegroundColor = ConsoleColor.Red; Console.Write("ERROR: "); #endif break; case PrintMode.VARS: logMessage += "VARIABLES:"; #if __DEBUG Console.ForegroundColor = ConsoleColor.Green; Console.Write("VARIABLES: "); #endif break; default: break; } logMessage += ":" + className + ":" + methodName + ": " + StringEnum.GetInternalString(code) + " "; #if __DEBUG Console.ForegroundColor = ConsoleColor.Cyan; Console.Write("{0,-35}", ":" + className + ":" + methodName + ": "); // Console.ResetColor(); Console.ForegroundColor = ConsoleColor.White; Console.Write(StringEnum.GetInternalString(code)); //Console.ResetColor(); #endif if (!String.IsNullOrEmpty(optstring)) { #if __DEBUG Console.Write(optstring); #endif logMessage += optstring; } #if __DEBUG Console.Write("\n"); #endif logMessage += "\n"; Logger.Logger.Log(logMessage); if (exit) { #if __DEBUG Console.ForegroundColor = ConsoleColor.White; Console.Write("Exiting."); #endif Logger.Logger.Log("Exiting."); #if __DEBUG Console.ReadKey(); #endif Environment.Exit(0); } }
public void AlternatePrintMode() { PrintModeEnum = PrintModeEnum == Data.PrintMode.NoTax? Data.PrintMode.LegalTicket: Data.PrintMode.NoTax; }
/// <summary> /// ESC ! n /// </summary> public static byte[] SelectPrintMode(PrintMode printMode) => new byte[] { 0x1B, 0x21, (byte)printMode };
/// <summary> /// 저장버튼을 눌렀을 경우 /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param> private void btnSave_Click(object sender, EventArgs e) { try { string facilitycode = ""; string facililtyname = ""; string facilitypart = ""; string facilitypartname = ""; string rfiddest = CboBox.ComboSelectedMember(this.cboRFID, "VAL"); string rfidport = CboBox.ComboSelectedMember(this.cboRFIDPort, "VAL"); string signpadport = CboBox.ComboSelectedMember(this.cboSignPort, "VAL"); string tsp800print = CboBox.ComboSelectedMember(this.cboPrintTSP800, "VAL"); string signpad = CboBox.ComboSelectedMember(this.cboSignPad, "VAL"); bool signpaduse = chkSignPadUse.Checked; string cardtid = ""; string cashtid = ""; string depositwindowyn = ""; string roomviewyn = ""; string taskDate = ""; string machinestyle = CboBox.ComboSelectedMember(this.cboComPrintMachine, "VAL"); string printcomport = CboBox.ComboSelectedMember(this.cboComPort, "VAL"); string printstopbit = CboBox.ComboSelectedMember(this.cboComStopBit, "VAL"); string printdatabit = CboBox.ComboSelectedMember(this.cboComDataBit, "VAL"); string printbaundrate = CboBox.ComboSelectedMember(this.cboComBoundRate, "VAL"); string printparity = CboBox.ComboSelectedMember(this.cboComParity, "VAL"); string printmode = ""; if (chkRS232.Checked) { printmode = "SERIALPORT"; } else if (chkDriver.Checked) { printmode = "DRIVER"; } if (this.lupFacility.EditValue.ToString().Trim() != "" && this.lupFacility.Text.Trim() != "") { facilitycode = this.lupFacility.EditValue.ToString(); } if (this.lupFacilityPart.EditValue.ToString().Trim() != "" && this.lupFacilityPart.Text.Trim() != "") { facilitypart = this.lupFacilityPart.EditValue.ToString(); } DataTable dtParm = DataLayer.GetDataTableParameter(DataLayer.DatatableStyle.Parameter); dtParm.Rows.Add(new object[] { "V_BIZ_CODE", Parm.CurrentUserInformation.BizInfo.BizCode }); dtParm.Rows.Add(new object[] { "V_FACILITY_CODE", facilitycode }); dtParm.Rows.Add(new object[] { "V_FACI_PART", facilitypart }); dtParm.Rows.Add(new object[] { "V_POS_NO", Parm._ROOM_POS_NO }); DataSet dsTmp = DataLayer.ExecuteSpDataset("PKG_REFERENCE_TASK.PR_01", dtParm, DataLayer.MessageEncoding.Default); if (dsTmp.Tables[0].Rows.Count > 0) { facililtyname = dsTmp.Tables[0].Rows[0]["FACILITY_NAME"].ToString().Trim(); facilitypartname = dsTmp.Tables[0].Rows[0]["FACI_PART_NAME"].ToString().Trim(); cardtid = dsTmp.Tables[0].Rows[0]["CARD_TID"].ToString().Trim(); cashtid = dsTmp.Tables[0].Rows[0]["CASH_TID"].ToString().Trim(); } else { Basic.ShowMessage(2, "영업장별특성[DZA010MS] , 영업장별POS[JAA020MS] , 영업장정보[JAA010MS], 동구분[DZA021MS] 테이블에 정보가 없습니다."); return; } if (dsTmp.Tables[1].Rows.Count > 0) { taskDate = dsTmp.Tables[1].Rows[0][0].ToString().Trim(); } else { Basic.ShowMessage(1, "TaskDate가 없습니다."); } DataTable dtParm13 = DataLayer.GetDataTableParameter(DataLayer.DatatableStyle.Parameter); dtParm13.Rows.Add(new object[] { "V_BIZ_CODE", Parm.CurrentUserInformation.BizInfo.BizCode }); dtParm13.Rows.Add(new object[] { "V_FACILITY_TYPE", Parm.CurrentUserInformation.roomTask.gsDFacility }); DataSet dsTmp13 = DataLayer.ExecuteSpDataset("PKG_REFERENCE_TASK.PR_03", dtParm13, DataLayer.MessageEncoding.Default); if (dsTmp13.Tables[0].Rows.Count > 0) { Parm.CurrentUserInformation.roomTask.gsTaskDate = dsTmp13.Tables[0].Rows[0][0].ToString().Trim(); } //객실특성 if (dsTmp13.Tables[1].Rows.Count > 0) { for (int u = 0; u < dsTmp13.Tables[1].Rows.Count; u++) { switch (dsTmp13.Tables[1].Rows[u]["PART_CODE"].ToString().Trim()) { case "100": //회원제여부 Parm.CurrentUserInformation.roomTask.IsMember = dsTmp13.Tables[1].Rows[u][1].ToString().Trim() == "Y" ? true : false; break; case "200": //인테리어사용여부 / 온돌 / 침실 욥션등.. Parm.CurrentUserInformation.roomTask.IsInterior = dsTmp13.Tables[1].Rows[u][1].ToString().Trim() == "Y" ? true : false; break; } } } if (dsTmp13.Tables[2].Rows.Count > 0) { Parm.CurrentUserInformation.roomTask.IsForcasting = dsTmp13.Tables[2].Rows[0][0].ToString().Trim() == "Y" ? true : false; Parm.CurrentUserInformation.roomTask.IsDePosit = dsTmp13.Tables[2].Rows[0][1].ToString().Trim() == "Y" ? true : false; } //해당사업장 거만 삭제 DataRow[] rr = dtReference.Select("BIZ_CODE = '" + Parm.CurrentUserInformation.BizInfo.BizCode + "'"); string str = "BIZ_CODE = '" + Parm.CurrentUserInformation.BizInfo.BizCode + "'"; for (int j = 0; j < rr.Length; j++) { dtReference.Rows.Remove(rr[j]); } dtReference.Rows.Add(new object[] { Parm.CurrentUserInformation.BizInfo.BizCode, "FACILITY_CODE", facilitycode }); dtReference.Rows.Add(new object[] { Parm.CurrentUserInformation.BizInfo.BizCode, "FACILITY_PART", facilitypart }); dtReference.Rows.Add(new object[] { Parm.CurrentUserInformation.BizInfo.BizCode, "RFID_DEST", rfiddest }); dtReference.Rows.Add(new object[] { Parm.CurrentUserInformation.BizInfo.BizCode, "RFID_PORT", rfidport }); dtReference.Rows.Add(new object[] { Parm.CurrentUserInformation.BizInfo.BizCode, "SIGNPAD_PORT", signpadport }); dtReference.Rows.Add(new object[] { Parm.CurrentUserInformation.BizInfo.BizCode, "SIGNPAD", signpad }); dtReference.Rows.Add(new object[] { Parm.CurrentUserInformation.BizInfo.BizCode, "SIGNPAD_USE", signpaduse ? "Y" : "N" }); dtReference.Rows.Add(new object[] { Parm.CurrentUserInformation.BizInfo.BizCode, "PRINT_TSP800", tsp800print }); dtReference.Rows.Add(new object[] { Parm.CurrentUserInformation.BizInfo.BizCode, "PRINT_COM_PORT", printcomport }); dtReference.Rows.Add(new object[] { Parm.CurrentUserInformation.BizInfo.BizCode, "PRINT_COM_BAUND", printbaundrate }); dtReference.Rows.Add(new object[] { Parm.CurrentUserInformation.BizInfo.BizCode, "PRINT_COM_PARITY", printparity }); dtReference.Rows.Add(new object[] { Parm.CurrentUserInformation.BizInfo.BizCode, "PRINT_COM_STOPBIT", printstopbit }); dtReference.Rows.Add(new object[] { Parm.CurrentUserInformation.BizInfo.BizCode, "PRINT_COM_DATABIT", printdatabit }); dtReference.Rows.Add(new object[] { Parm.CurrentUserInformation.BizInfo.BizCode, "PRINT_COM_MACHINE", machinestyle }); dtReference.Rows.Add(new object[] { Parm.CurrentUserInformation.BizInfo.BizCode, "PRINT_MODE", printmode }); dtReference.WriteXml(System.Windows.Forms.Application.StartupPath + "\\" + Parm.mPath.PATH_ROOM_REFERENCE_FILE); Parm.CurrentUserInformation.roomTask.gsCardTerminalID = cardtid; Parm.CurrentUserInformation.roomTask.gsCashTerminalID = cashtid; Parm.CurrentUserInformation.roomTask.gsDFacility = facilitycode; Parm.CurrentUserInformation.roomTask.gsDFacilityName = facililtyname; Parm.CurrentUserInformation.roomTask.gsDFaciPart = facilitypart; Parm.CurrentUserInformation.roomTask.gsDFaciPartName = facilitypartname; Parm.CurrentUserInformation.roomTask.gsEtcSignPort = signpadport; Parm.CurrentUserInformation.roomTask.gsRFCOMPort = rfidport; Parm.CurrentUserInformation.roomTask.gsRFDest = rfiddest; Parm.CurrentUserInformation.roomTask.TSP800 = tsp800print; Parm.CurrentUserInformation.roomTask.gsTaskDate = taskDate; Parm.CurrentUserInformation.roomTask.IsUseSignpad = signpaduse; Parm.CurrentUserInformation.roomTask.SerialPrintInfo.ComPort = printcomport; Parm.CurrentUserInformation.roomTask.SerialPrintInfo.BaundRate = printbaundrate; Parm.CurrentUserInformation.roomTask.SerialPrintInfo.DataBit = printdatabit; Parm.CurrentUserInformation.roomTask.SerialPrintInfo.Parity = RS232Info.GetConvertParity(printparity); Parm.CurrentUserInformation.roomTask.SerialPrintInfo.StopBit = RS232Info.GetConvertStopBit(printstopbit); PrintMode printMode = PrintMode.NONE; switch (printmode) { case "SERIALPORT": printMode = PrintMode.SERIALPORT; break; case "DRIVER": printMode = PrintMode.DRIVER; break; } Parm.CurrentUserInformation.roomTask.gsPrintMode = printMode; SignPad stPad = SignPad.NONE; switch (signpad) { case "EP791R": stPad = SignPad.EP791R; break; case "KSP100S": stPad = SignPad.KSP100S; break; case "KISSP30": stPad = SignPad.KISSP30; break; } Parm.CurrentUserInformation.roomTask.gsEtcSignPad = stPad; ComPortPrintStyle comprintstyle = ComPortPrintStyle.NONE; switch (machinestyle) { case "LUKHAN": comprintstyle = ComPortPrintStyle.LUKHAN; break; } Parm.CurrentUserInformation.roomTask.SerialPrintStyle = comprintstyle; dr = DialogResult.OK; Basic.ShowMessage(1, "Van TID 는 서버에 셋팅된 값으로 저장됩니다. \n\r모든설정을 저장하였습니다."); } catch (Exception ex) { Basic.ShowMessage(3, ex.Message); } }
private void Print(string s, PrintMode mode = PrintMode.Normal) { Print(s, null, mode); }
public static void Print(this IEnumerable <IPermission> me, PrintMode mode) { switch (mode) { case PrintMode.OneLine: foreach (var per in me) { Printer.WriteLine(per.Function.Name.PadRight(8, ' ') + " , v:" + per.Value + "".PadRight(per.Value ? 1 : 0, ' ') + " , ss:[" + per.Scopes.Aggregate("", (str, actual) => str + actual + ",", str => str.Trim(',')) + "]"); } break; case PrintMode.PropertyList: break; case PrintMode.Table: string GetValue(IPermission permission) => permission?.Value.ToString(); string GetFunction(IPermission permission) => permission?.Function?.ToString() ?? "null"; string GetDiscriminatorTypeId(IScope scope) => scope.Discriminator?.TypeKey?.ToString() ?? "null"; string GetDiscriminatorTypeName(IScope scope) => scope.Discriminator?.TypeName?.ToString() ?? "null"; string GetDiscriminatorId(IScope scope) => scope.Discriminator?.Id?.ToString() ?? "null"; string GetDiscriminatorName(IScope scope) => scope.Discriminator?.Name?.ToString() ?? "null"; string GetScopePropagation(IScope scope) => scope?.Propagation.ToString() ?? "null"; var maxValue = me.Select(p => GetValue(p).Length).Union(new[] { "VALUE".Length }).Max(); var maxFunction = me.Select(p => GetFunction(p).Length).Union(new[] { "FUNCTION".Length }).Max(); var maxDiscriminatorTypeId = me.SelectMany(p => p.Scopes.Select(s => GetDiscriminatorTypeId(s).Length)).Union(new[] { "TYPE_ID".Length }).Max(); var maxDiscriminatorTypeName = me.SelectMany(p => p.Scopes.Select(s => GetDiscriminatorTypeName(s).Length)).Union(new[] { "TYPE_NAME".Length }).Max(); var maxDiscriminatorId = me.SelectMany(p => p.Scopes.Select(s => GetDiscriminatorId(s).Length)).Union(new[] { "ID".Length }).Max(); var maxDiscriminatorName = me.SelectMany(p => p.Scopes.Select(s => GetDiscriminatorName(s).Length)).Union(new[] { "NAME".Length }).Max(); var maxScopePropagation = me.SelectMany(p => p.Scopes.Select(s => GetScopePropagation(s).Length)).Union(new[] { "PROPAGATION".Length }).Max(); // Headers Printer.WriteLine("┌" + ("".PadRight(maxValue, '─')) + "┬" + ("".PadRight(maxFunction, '─')) + "╥" + ("".PadRight(maxDiscriminatorTypeId, '─')) + "┬" + ("".PadRight(maxDiscriminatorTypeName, '─')) + "┬" + ("".PadRight(maxDiscriminatorId, '─')) + "┬" + ("".PadRight(maxDiscriminatorName, '─')) + "┬" + ("".PadRight(maxScopePropagation, '─')) + "┐"); if (me.Any()) { Printer.WriteLine("│" + ("VALUE".PadRight(maxValue, ' ')) + "│" + ("FUNCTION".PadRight(maxFunction, ' ')) + "║" + ("TYPE_ID".PadRight(maxDiscriminatorTypeId, ' ')) + "│" + ("TYPE_NAME".PadRight(maxDiscriminatorTypeName, ' ')) + "│" + ("ID".PadRight(maxDiscriminatorId, ' ')) + "│" + ("NAME".PadRight(maxDiscriminatorName, ' ')) + "│" + ("PROPAGATION".PadRight(maxScopePropagation, ' ')) + "│"); Printer.WriteLine("├" + ("".PadRight(maxValue, '─')) + "┼" + ("".PadRight(maxFunction, '─')) + "╫" + ("".PadRight(maxDiscriminatorTypeId, '─')) + "┼" + ("".PadRight(maxDiscriminatorTypeName, '─')) + "┼" + ("".PadRight(maxDiscriminatorId, '─')) + "┼" + ("".PadRight(maxDiscriminatorName, '─')) + "┼" + ("".PadRight(maxScopePropagation, '─')) + "┤"); } // Body foreach (var per in me) { var list = per.Scopes.ToList(); if (list.Count == 0) { Printer.WriteLine("│" + GetValue(per).PadRight(maxValue, ' ') + "│" + GetFunction(per).PadRight(maxFunction, ' ') + "║" + ("".PadRight(maxDiscriminatorTypeId, ' ')) + "│" + ("".PadRight(maxDiscriminatorTypeName, ' ')) + "│" + ("".PadRight(maxDiscriminatorId, ' ')) + "│" + ("".PadRight(maxDiscriminatorName, ' ')) + "│" + ("".PadRight(maxScopePropagation, ' ')) + "│"); } else { for (var i = 0; i < list.Count; i++) { Printer.WriteLine("│" + ((i == 0 ? GetValue(per) : "").PadRight(maxValue, ' ')) + "│" + ((i == 0 ? GetFunction(per) : "").PadRight(maxFunction, ' ')) + "║" + (GetDiscriminatorTypeId(list[i]).PadRight(maxDiscriminatorTypeId, ' ')) + "│" + (GetDiscriminatorTypeName(list[i]).PadRight(maxDiscriminatorTypeName, ' ')) + "│" + (GetDiscriminatorId(list[i]).PadRight(maxDiscriminatorId, ' ')) + "│" + (GetDiscriminatorName(list[i]).PadRight(maxDiscriminatorName, ' ')) + "│" + (GetScopePropagation(list[i]).PadRight(maxScopePropagation, ' ')) + "│"); } } } // Footer Printer.WriteLine("└" + ("".PadRight(maxValue, '─')) + "┴" + ("".PadRight(maxFunction, '─')) + "╨" + ("".PadRight(maxDiscriminatorTypeId, '─')) + "┴" + ("".PadRight(maxDiscriminatorTypeName, '─')) + "┴" + ("".PadRight(maxDiscriminatorId, '─')) + "┴" + ("".PadRight(maxDiscriminatorName, '─')) + "┴" + ("".PadRight(maxScopePropagation, '─')) + "┘"); break; } }
public void TestBandwidth() { int start = DefaultSize; int end = DefaultSize; int increment = DefaultIncrement; PrintMode printMode = PrintMode.UserReadable; MemoryMode memoryMode = MemoryMode.Pageable; AccessMode accessMode = AccessMode.Direct; // Get OpenCL platform ID for NVIDIA if available, otherwise default Platform platform = OclUtils.GetPlatform(); // Find out how many devices there are Device[] devices = platform.GetDevices(DeviceType.Gpu); if (devices.Length == 0) { Console.WriteLine("No GPU devices found. Falling back to CPU for test..."); devices = platform.GetDevices(DeviceType.Cpu); Assert.AreNotEqual(0, devices.Length, "There are no devices supporting OpenCL"); } int startDevice = 0; int endDevice = 0; // Get and log the device info Console.WriteLine("Running on..."); Console.WriteLine(); for (int i = startDevice; i <= endDevice; i++) { Console.WriteLine(devices[i].Name); } Console.WriteLine(); // Mode Console.WriteLine("Quick Mode"); Console.WriteLine(); TestMode testMode = TestMode.Quick; bool hostToDevice = true; bool deviceToHost = true; bool deviceToDevice = true; if (testMode == TestMode.Range) { throw new NotImplementedException(); } using (var context = Context.Create(devices)) { if (hostToDevice) { TestBandwidth(context, devices, start, end, increment, testMode, MemoryCopyKind.HostToDevice, printMode, accessMode, memoryMode, startDevice, endDevice); } if (deviceToHost) { TestBandwidth(context, devices, start, end, increment, testMode, MemoryCopyKind.DeviceToHost, printMode, accessMode, memoryMode, startDevice, endDevice); } if (deviceToDevice) { TestBandwidth(context, devices, start, end, increment, testMode, MemoryCopyKind.DeviceToDevice, printMode, accessMode, memoryMode, startDevice, endDevice); } } }
/// <summary> /// 프린터 설정여부 /// </summary> /// <param name="type">프로젝트 타입 [업무타입]</param> /// <param name="IsSkip">다음단계 진행여부</param> /// <returns> /// <c>true</c> if [is print setting] [the specified type]; otherwise, <c>false</c>. /// </returns> /// <example> /// <code> ///private void HFHAH04_Load(object sender, EventArgs e) ///{ /// try /// { /// bool IsSkip = false; /// /// if(Parm.CurrentUserInformation.golfTask.CardTid == "") /// { /// Basic.ShowMessage(2, "신용카드승인관련 터미널아이디가 등록되지 않았습니다.\n\r영업장별 POS 등록화면에서 터미널아이디를 셋팅하세요"); /// goto _Close; /// /// } /// /// //프린텨 설정여부를 리턴받는다. 해당 변수가 false 일때는 영수출력을 하지 않는다. /// IsPrint = CheckPrint.IsPrintSetting(CheckPrint.ProjectType.GOLF , ref IsSkip); /// /// _Close: /// if(!IsSkip) //영수증프린터가 설정안되어 진행하지 않는다고 하면 화면을 종료한다. /// { /// try /// { /// //폼로드 블럭이기때문에 폼 종료시 에러가난다. /// this.Close(); /// } /// catch /// { /// /// } /// } /// } /// catch (Exception ex) /// { /// /// } ///} /// </code> /// </example> /// <remarks> /// 프린터를 체크하는 모듈을 페이지 마다 설정하지 않기위해서 체크 클레스를 만들어 사용한다. /// 만약 해당 업무의 프린터 구분이 틀려질 경우 분개하여 사용한다. /// </remarks> public static bool IsPrintSetting(ProjectType type, ref bool IsSkip) { try { //프린터 셋팅여부 bool IsSetting = false; PrintMode mode = PrintMode.NONE; string tsp800 = ""; ComPortPrintStyle comstyle = ComPortPrintStyle.NONE; string BaundRate = ""; string ComPort = ""; string DataBit = ""; switch (type) { case ProjectType.GOLF: mode = Parm.CurrentUserInformation.golfTask.PrintMode; tsp800 = Parm.CurrentUserInformation.golfTask.TSP800; comstyle = Parm.CurrentUserInformation.golfTask.SerialPrintStyle; BaundRate = Parm.CurrentUserInformation.golfTask.SerialPrintInfo.BaundRate; ComPort = Parm.CurrentUserInformation.golfTask.SerialPrintInfo.ComPort; DataBit = Parm.CurrentUserInformation.golfTask.SerialPrintInfo.DataBit; break; case ProjectType.ROOM: mode = Parm.CurrentUserInformation.roomTask.gsPrintMode; tsp800 = Parm.CurrentUserInformation.roomTask.TSP800; comstyle = Parm.CurrentUserInformation.roomTask.SerialPrintStyle; BaundRate = Parm.CurrentUserInformation.roomTask.SerialPrintInfo.BaundRate; ComPort = Parm.CurrentUserInformation.roomTask.SerialPrintInfo.ComPort; DataBit = Parm.CurrentUserInformation.roomTask.SerialPrintInfo.DataBit; break; } if (mode == PrintMode.NONE) { if (Basic.ShowMessageQuestion("영수증프린터가 설정되어 있지 않습니다.\n\r영수증 출력이 불가 합니다.\n\n계속 하시겠습니까?") == DialogResult.Yes) { IsSkip = true; } } else if (mode == PrintMode.DRIVER && tsp800 == "") { if (Basic.ShowMessageQuestion("영수증프린터는 드라이버모드로 설정되어 있지만 프린터는 선택되지 않았습니다.\n\r영수증 출력이 불가 합니다.\n\n계속 하시겠습니까?") == DialogResult.Yes) { IsSkip = true; } } else if (mode == PrintMode.SERIALPORT && comstyle == ComPortPrintStyle.NONE) { if (Basic.ShowMessageQuestion("영수증프린터는 시리얼모드로 설정되어 있지만 프린터는 타입은 설정되어 있지 않습니다.\n\r승인/취소시 영수증 출력이 불가 합니다.\n\n계속 하시겠습니까?") == DialogResult.Yes) { IsSkip = true; } } else if (mode == PrintMode.SERIALPORT && (BaundRate == "" || ComPort == "" || DataBit == "")) { if (Basic.ShowMessageQuestion("영수증프린터는 시리얼모드로 설정되어 있지만 상세 설정이 없는것이 있습니다.\n\r승인/취소시 영수증 출력이 불가 합니다.\n\n계속 하시겠습니까?") == DialogResult.Yes) { IsSkip = true; } } else { IsSetting = true; IsSkip = true; } return(IsSetting); } catch (Exception ex) { throw ex; } }
public CharSequenceEventArgs(string charData, Guid eventId, Type sequenceType, PrintMode sequencePrintMode, Guid conversationId) : base(eventId) { this.CharData = charData; this.SequenceType = sequenceType; this.SequencePrintMode = sequencePrintMode; this.ConversationId = conversationId; }
public void UpdatePrintMode() { Data.PrintMode mode = SalePaymentHeader != null && SalePaymentHeader.SalePaymentItems.Any(item => item.PaymentInstrument.PrintModeDefault == (int)Data.PrintMode.LegalTicket) ? Data.PrintMode.LegalTicket : Data.PrintMode.NoTax; if (mode != Data.PrintMode.LegalTicket && Customer!=null && Customer.TaxPosition!=null ) { mode = customer.TaxPosition.ResolvePrintMode(); } PrintModeEnum = mode; }
/// <summary> /// 저장버튼을 눌렀을 경우 /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param> private void btnSave_Click(object sender, EventArgs e) { try { string facilitycode = ""; string facilityname = ""; string signpadport = CboBox.ComboSelectedMember(this.cboSignPort, "VAL"); string tsp800print = CboBox.ComboSelectedMember(this.cboPrintTSP800, "VAL"); string signpad = CboBox.ComboSelectedMember(this.cboSignPad, "VAL"); bool signpaduse = chkSignPadUse.Checked; string machinestyle = CboBox.ComboSelectedMember(this.cboComPrintMachine, "VAL"); string printcomport = CboBox.ComboSelectedMember(this.cboComPort, "VAL"); string printstopbit = CboBox.ComboSelectedMember(this.cboComStopBit, "VAL"); string printdatabit = CboBox.ComboSelectedMember(this.cboComDataBit, "VAL"); string printbaundrate = CboBox.ComboSelectedMember(this.cboComBoundRate, "VAL"); string printparity = CboBox.ComboSelectedMember(this.cboComParity, "VAL"); string printmode = ""; if (chkRS232.Checked) { printmode = "SERIALPORT"; } else if (chkDriver.Checked) { printmode = "DRIVER"; } if (this.lupFacility.EditValue.ToString().Trim() != "" && this.lupFacility.Text.Trim() != "") { facilitycode = this.lupFacility.EditValue.ToString(); facilityname = this.lupFacility.Text.Trim(); } Parm.CurrentUserInformation.golfTask.CardTid = ""; Parm.CurrentUserInformation.golfTask.CashTid = ""; if (Parm.CurrentUserInformation.golfTask.FacilityCode != "") { DataTable dtParmGolf = DataLayer.GetDataTableParameter(DataLayer.DatatableStyle.Parameter); dtParmGolf.Rows.Add(new object[] { "V_BIZ_CODE", Parm.CurrentUserInformation.BizInfo.BizCode }); dtParmGolf.Rows.Add(new object[] { "V_FACILITY_CODE", Parm.CurrentUserInformation.golfTask.FacilityCode }); dtParmGolf.Rows.Add(new object[] { "V_POS_NO", "01" }); DataSet dsGolfTmp = DataLayer.ExecuteSpDataset("PKG_REFERENCE_TASK.PR_04", dtParmGolf, DataLayer.MessageEncoding.Default); if (dsGolfTmp.Tables[0].Rows.Count > 0) { Parm.CurrentUserInformation.golfTask.CardTid = dsGolfTmp.Tables[0].Rows[0]["CARD_TID"].ToString().Trim(); Parm.CurrentUserInformation.golfTask.CashTid = dsGolfTmp.Tables[0].Rows[0]["CASH_TID"].ToString().Trim(); } } //해당사업장 거만 삭제 DataRow[] rr = dtReference.Select("BIZ_CODE = '" + Parm.CurrentUserInformation.BizInfo.BizCode + "'"); string str = "BIZ_CODE = '" + Parm.CurrentUserInformation.BizInfo.BizCode + "'"; for (int j = 0; j < rr.Length; j++) { dtReference.Rows.Remove(rr[j]); } dtReference.Rows.Add(new object[] { Parm.CurrentUserInformation.BizInfo.BizCode, "FACILITY_CODE", facilitycode }); dtReference.Rows.Add(new object[] { Parm.CurrentUserInformation.BizInfo.BizCode, "FACILITY_NAME", facilityname }); dtReference.Rows.Add(new object[] { Parm.CurrentUserInformation.BizInfo.BizCode, "SIGNPAD_PORT", signpadport }); dtReference.Rows.Add(new object[] { Parm.CurrentUserInformation.BizInfo.BizCode, "SIGNPAD", signpad }); dtReference.Rows.Add(new object[] { Parm.CurrentUserInformation.BizInfo.BizCode, "SIGNPAD_USE", signpaduse ? "Y" : "N" }); dtReference.Rows.Add(new object[] { Parm.CurrentUserInformation.BizInfo.BizCode, "PRINT_TSP800", tsp800print }); dtReference.Rows.Add(new object[] { Parm.CurrentUserInformation.BizInfo.BizCode, "PRINT_COM_PORT", printcomport }); dtReference.Rows.Add(new object[] { Parm.CurrentUserInformation.BizInfo.BizCode, "PRINT_COM_BAUND", printbaundrate }); dtReference.Rows.Add(new object[] { Parm.CurrentUserInformation.BizInfo.BizCode, "PRINT_COM_PARITY", printparity }); dtReference.Rows.Add(new object[] { Parm.CurrentUserInformation.BizInfo.BizCode, "PRINT_COM_STOPBIT", printstopbit }); dtReference.Rows.Add(new object[] { Parm.CurrentUserInformation.BizInfo.BizCode, "PRINT_COM_DATABIT", printdatabit }); dtReference.Rows.Add(new object[] { Parm.CurrentUserInformation.BizInfo.BizCode, "PRINT_COM_MACHINE", machinestyle }); dtReference.Rows.Add(new object[] { Parm.CurrentUserInformation.BizInfo.BizCode, "PRINT_MODE", printmode }); dtReference.WriteXml(System.Windows.Forms.Application.StartupPath + "\\" + Parm.mPath.PATH_GOLF_REFERENCE_FILE); Parm.CurrentUserInformation.golfTask.FacilityCode = facilitycode; Parm.CurrentUserInformation.golfTask.FacilityName = facilityname; Parm.CurrentUserInformation.golfTask.SignPort = signpadport; Parm.CurrentUserInformation.golfTask.TSP800 = tsp800print; Parm.CurrentUserInformation.golfTask.IsUseSignpad = signpaduse; Parm.CurrentUserInformation.golfTask.SerialPrintInfo.ComPort = printcomport; Parm.CurrentUserInformation.golfTask.SerialPrintInfo.BaundRate = printbaundrate; Parm.CurrentUserInformation.golfTask.SerialPrintInfo.DataBit = printdatabit; Parm.CurrentUserInformation.golfTask.SerialPrintInfo.Parity = RS232Info.GetConvertParity(printparity); Parm.CurrentUserInformation.golfTask.SerialPrintInfo.StopBit = RS232Info.GetConvertStopBit(printstopbit); PrintMode printMode = PrintMode.NONE; switch (printmode) { case "SERIALPORT": printMode = PrintMode.SERIALPORT; break; case "DRIVER": printMode = PrintMode.DRIVER; break; } Parm.CurrentUserInformation.golfTask.PrintMode = printMode; SignPad stPad = SignPad.NONE; switch (signpad) { case "EP791R": stPad = SignPad.EP791R; break; case "KSP100S": stPad = SignPad.KSP100S; break; case "KISSP30": stPad = SignPad.KISSP30; break; } Parm.CurrentUserInformation.golfTask.SignPad = stPad; ComPortPrintStyle comprintstyle = ComPortPrintStyle.NONE; switch (machinestyle) { case "LUKHAN": comprintstyle = ComPortPrintStyle.LUKHAN; break; } Parm.CurrentUserInformation.golfTask.SerialPrintStyle = comprintstyle; dr = DialogResult.OK; Basic.ShowMessage(1, "모든설정을 저장하였습니다."); } catch (Exception ex) { Basic.ShowMessage(3, ex.Message); } }
private void WritePropName(JsonWriter writer, string name, bool isSimpleValue = true, PrintMode mode = PrintMode.ValueCell) { writer.WritePropertyName(name); }
/// <summary> /// Prints a bitmap /// </summary> /// <param name="Width">Bitmap width (should be a power of 8)</param> /// <param name="Height">Bitmap height (should be a power of 8)</param> /// <param name="Bitmap">Bitmap data</param> /// <param name="Mode">Print mode</param> public void PrintBitmap(int Width, int Height, byte[] Bitmap, PrintMode Mode = PrintMode.SingleDensity24Dots) { if ((Width / 8) * 8 != Width) { throw new ArgumentException("Width should be a power of 8"); } if ((Height / 8) * 8 != Height) { throw new ArgumentException("Height should be a power of 8"); } if ((Width * Height / 8) != Bitmap.Length) { throw new ArgumentException("Bitmap should have the same amount of bits as Width x Height"); } if (Width < 1 || Width > 384) throw new ArgumentOutOfRangeException("Width should be between 0 and 385"); if (Height < 1 || Height > 2040) throw new ArgumentOutOfRangeException("Height should be between 0 and 2041"); if ((Width * Height) > 9600) throw new ArgumentOutOfRangeException("The bitmap may only contain 9600 pixels"); // Defines the bitmap size this.Print(new byte[] { 0x1d, 0x2a, (byte)(Width / 8), (byte)(Height / 8) }); // Sends the bitmap this.Print(Bitmap); // Actually prints out this.Print(new byte[] { 0x1d, 0x2f, (byte)Mode }); }
/// <summary> /// Sets Mode of the Printer /// Tear Off /// Peel Off /// Cut /// </summary> /// <param name="mode"></param> /// <returns></returns> public ZplLabel Mode(PrintMode mode) { _mode = mode; return(this); }
public DefaultGeneratorOptions(PrintMode printMode) { this.PrintMode = printMode; this.RecursionStackLimit = 255; this.GeneratorPass = GeneratorPass.All; }