static void RPMUpKey(RPGMenu menu) { //{Someone just pressed the UP key, and we're gonna process that input.} //{PRECONDITIONS: menu has been initialized properly, and is currently being} //{ displayed on the screen.} //{Lets set up the window.} Crt.Window(menu.x1 + 1, menu.y1 + 1, menu.x2 - 1, menu.y2 - 1); //{Calculate the width of the menu.} int width = menu.x2 - menu.x1 - 1; //{De-indicate the old selected item.} //{Change color to the regular item color...} Crt.TextColor(menu.itemColor); //{Then reprint the text of the previously selected item.} Crt.GotoXY(1, menu.selectItem - menu.topItem + 1); string msg = RPMLocateByPosition(menu, menu.selectItem).msg; Crt.Write(msg.Substring(0, Math.Min(width, msg.Length))); //{Decrement the selected item by one.} menu.selectItem--; //{If this causes it to go beneath one, wrap around to the last item.} if (menu.selectItem == 0) { menu.selectItem = menu.numItem; } //{If the movement takes the selected item off the screen, do a redisplay.} //{Otherwise, indicate the newly selected item.} if ((menu.selectItem < menu.topItem) || ((menu.selectItem - menu.topItem) > (menu.y2 - menu.y1 - 2))) { //{First, restore the normal window size, since DisplayMenu will try to resize it.} Crt.Window(1, 1, WDM.CON_WIDTH, WDM.CON_HEIGHT); //{Determine an appropriate new value for topitem.} RPMReposition(menu); //{Redisplay the menu.} DisplayMenu(menu); } else { Crt.TextColor(menu.selColor); Crt.GotoXY(1, menu.selectItem - menu.topItem + 1); msg = RPMLocateByPosition(menu, menu.selectItem).msg; Crt.Write(msg.Substring(0, Math.Min(width, msg.Length))); //{Restore the window to its regular size.} Crt.Window(1, 1, WDM.CON_WIDTH, WDM.CON_HEIGHT); //{If this menu features item descriptions, better refresh the text.} if (menu.dx1 > 0) { RPMRefreshDesc(menu); } } }
public static RPGMenuItem RPMLocateByPosition(RPGMenu menu, int i) { //{ Locate the i'th element of the item list, then return its address.} //{ Error check, first off.} if (i > menu.numItem) { Crt.Write("ERROR: RPMLocateByPosition asked to find a message that doesnt exist.\n"); do { rpgtext.RPGKey(); } while (true); } RPGMenuItem a = menu.firstItem; int t = 1; if (i > 1) { for (t = 2; t <= i; ++t) { a = a.next; } } return(a); }
public override void ExportCertificate(Crt cert, EncodingFormat fmt, Stream target) { string outform; switch (fmt) { case EncodingFormat.PEM: outform = "PEM"; break; case EncodingFormat.DER: outform = "DER"; break; default: throw new NotSupportedException("unsupported encoding format"); } var tempSource = Path.GetTempFileName(); var tempTarget = Path.GetTempFileName(); try { File.WriteAllText(tempSource, cert.Pem); RunCli($"x509 -inform PEM -in {tempSource} -outform {outform} -out {tempTarget}"); var targetBytes = File.ReadAllBytes(tempTarget); target.Write(targetBytes, 0, targetBytes.Length); } finally { File.Delete(tempSource); File.Delete(tempTarget); } }
public static void RunGame() { rpgtext.SetKeyMap(); rpgmenus.RPGMenu menu = rpgmenus.CreateRPGMenu(Crt.Color.LightBlue, Crt.Color.Green, Crt.Color.LightGreen, 20, 8, 60, 23); rpgmenus.AddRPGMenuItem(menu, "Start New Game", 1); rpgmenus.AddRPGMenuItem(menu, "Load Saved Game", 2); rpgmenus.AddRPGMenuItem(menu, "Quit DeadCold", -1); int N = 0; do { //{ Set up the screen display. } Crt.ClrScr(); Crt.CursorOff(); //{ Get a selection from the menu. } N = rpgmenus.SelectMenu(menu, rpgmenus.RPMNoCancel); switch (N) { case 1: dcplay.StartGame(); break; case 2: dcplay.RestoreGame(); break; } }while (N > 0); }
protected override void Paint(bool AForce) { // Draw the message switch (_TextAlignment) { case CrtAlignment.Center: if (Text.Length >= Width) { // Text is greater than available space so chop it off with PadRight() Crt.FastWrite(StringUtils.PadRight(Text, ' ', Width), ScreenLeft, ScreenTop, _ForeColour, _BackColour); } else { // Text needs to be centered int LeftSpaces = (Width - Text.Length) / 2; int RightSpaces = Width - Text.Length - LeftSpaces; Crt.FastWrite(new string(' ', LeftSpaces) + Text + new string(' ', RightSpaces), ScreenLeft, ScreenTop, _ForeColour, _BackColour); } break; case CrtAlignment.Left: Crt.FastWrite(StringUtils.PadRight(Text, ' ', Width), ScreenLeft, ScreenTop, _ForeColour, _BackColour); break; case CrtAlignment.Right: Crt.FastWrite(StringUtils.PadLeft(Text, ' ', Width), ScreenLeft, ScreenTop, _ForeColour, _BackColour); break; } }
static private void Write(string text, bool prefixWithTime) { if (prefixWithTime && (!string.IsNullOrEmpty(text))) { Crt.Write(DateTime.Now.ToString(_GameSrv.TimeFormatUI) + " "); } if (text.Contains("ERROR:") || text.Contains("EXCEPTION:")) { Crt.TextColor(Crt.LightRed); } else if (text.Contains("WARNING:")) { Crt.TextColor(Crt.Yellow); } else if (text.Contains("DEBUG:")) { Crt.TextColor(Crt.LightCyan); } else { Crt.TextColor(Crt.LightGray); } Crt.Write(text); }
public static void DCGameMessage(string msg, bool lf) { //{ Print a standard text message for the game GearHead.} //{ Set the background color to black.} Crt.TextBackground(Crt.Color.Black); //{ If needed, go to the next line.} if (lf) { DCNewMessage(); } //{ Set the text color.} Crt.TextColor(DCTextColor); //{ Set the window to the desired print area, and move to the right pos.} Crt.Window(WDM.RPGMsg_X, WDM.RPGMsg_Y, WDM.RPGMsg_X2, WDM.RPGMsg_Y2); Crt.GotoXY(GM_X, GM_Y); //{call the Delineate procedure to prettyprint it.} Crt.AutoScrollOn(); Delineate(msg, WDM.RPGMsg_WIDTH, GM_X); Crt.AutoScrollOff(); //{Save the current cursor position.} GM_X = Crt.WhereX(); GM_Y = Crt.WhereY(); //{restore the window to its original, full dimensions.} Crt.Window(1, 1, WDM.CON_WIDTH, WDM.CON_HEIGHT); }
public static void GameMessage(string msg, int x1, int y1, int x2, int y2, Crt.Color textColor, Crt.Color edgeColor) { //{ Take a text string, MSG, and prettyprint } //{ it within the box defined by X1,Y1 - X2,Y2. } //{ Set the background color to black.} Crt.TextBackground(Crt.Color.Black); //{ Print the border} if (edgeColor != Crt.Color.Black) { LovelyBox(edgeColor, x1, y1, x2, y2); } //{ Set the window to the desired print area, and clear everything.} Crt.Window(x1 + 1, y1 + 1, x2 - 1, y2 - 1); Crt.ClrScr(); //{ call the Delineate procedure to prettyprint it.} Crt.TextColor(textColor); Delineate(msg, x2 - x1 - 1, 1); //{ restore the window to its original, full dimensions.} Crt.Window(1, 1, WDM.CON_WIDTH, WDM.CON_HEIGHT); }
public static void DCPointMessage(string msg) { //{ Display a message without affecting GM_X,GM_Y.} //{ Set the background color to black.} Crt.TextBackground(Crt.Color.Black); Crt.TextColor(DCTextColor); //{ Set the window to the desired print area, and move to the right pos.} Crt.Window(WDM.RPGMsg_X, WDM.RPGMsg_Y, WDM.RPGMsg_X2, WDM.RPGMsg_Y2); Crt.GotoXY(GM_X, GM_Y); Crt.ClrEol(); int width = Math.Min(WDM.RPGMsg_WIDTH - GM_X + 1, msg.Length); if (width < 1) { return; } //{ Write out as much of the message as will fit on the line.} Crt.Write(msg.Substring(0, width)); //{restore the window to its original, full dimensions.} Crt.Window(1, 1, WDM.CON_WIDTH, WDM.CON_HEIGHT); }
public static void LovelyBox(Crt.Color edgeColor, int x1, int y1, int x2, int y2) { Crt.AutoScrollOff(); //{ Draw a lovely box!} Crt.TextColor(edgeColor); //{ Print the four corners.} Crt.GotoXY(x1, y1); Crt.Write((char)218); Crt.GotoXY(x2, y1); Crt.Write((char)191); Crt.GotoXY(x1, y2); Crt.Write((char)192); Crt.GotoXY(x2, y2); Crt.Write((char)217); //{ Print the two horizontal edges.} for (int x = x1 + 1; x < x2; ++x) { Crt.GotoXY(x, y1); Crt.Write((char)196); Crt.GotoXY(x, y2); Crt.Write((char)196); } //{ Print the two vertical edges.} for (int y = y1 + 1; y < y2; ++y) { Crt.GotoXY(x1, y); Crt.Write((char)179); Crt.GotoXY(x2, y); Crt.Write((char)179); } }
// Event for when the status bar needs updating } static void Door_OnStatusBar(object sender, EventArgs e) { switch (Status.Current) { case 0: Crt.FastWrite("þ þ F1=HELP þ RMASTERMIND þ Idle: þ Left: þ", 1, 25, 30); Crt.FastWrite(StringUtils.PadRight(Door.DropInfo.RealName, ' ', 21), 3, 25, 31); Crt.FastWrite("F1=HELP", 27, 25, 31); Crt.FastWrite("RMASTERMIND", 37, 25, 31); Crt.FastWrite(StringUtils.PadRight("Idle: " + StringUtils.SecToMS(Door.SecondsIdle), ' ', 11), 51, 25, 31); Crt.FastWrite("Left: " + StringUtils.SecToHMS(Door.SecondsLeft), 65, 25, 31); break; case 1: Crt.FastWrite("þ F1: Toggle StatusBar þ Alt-C: SysOp Chat þ Alt-H: Hang-Up þ Alt-K: Kick User þ", 1, 25, 30); Crt.FastWrite("F1: Toggle StatusBar", 3, 25, 31); Crt.FastWrite("Alt-C: SysOp Chat", 26, 25, 31); Crt.FastWrite("Alt-H: Hang-Up", 46, 25, 31); Crt.FastWrite("Alt-K: Kick User", 63, 25, 31); break; case 2: Crt.FastWrite(StringUtils.PadRight(" " + PROG_VER + " is an R&M Door example program - http://www.randm.ca/", ' ', 80), 1, 25, 31); break; } }
public void Uninstall(PrivateKey pk, Crt crt, IEnumerable <PKI.Crt> chain, IPkiTool cp) { AssertNotDisposed(); throw new NotImplementedException(); }
static void TheDisplay(gamebook.Scenario SC) { /*This procedure sets up the BackPack display.*/ Crt.Window(WDM.EqpWin_X, WDM.EqpWin_Y, WDM.PCSWin_X2, WDM.InvWin_Y2); Crt.ClrScr(); Crt.Window(1, 1, WDM.CON_WIDTH, WDM.CON_HEIGHT); rpgtext.LovelyBox(Crt.Color.LightGray, WDM.EqpWin_X, WDM.EqpWin_Y, WDM.InvWin_X2, WDM.InvWin_Y2); Crt.TextColor(Crt.Color.Green); Crt.GotoXY(WDM.EqpWin_X + 2, WDM.EqpWin_Y2); Crt.TextColor(Crt.Color.LightGray); for (int t = 1; t <= WDM.EqpWin_WIDTH - 3; ++t) { Crt.Write((char)205); } Crt.TextColor(Crt.Color.Green); rpgtext.LovelyBox(Crt.Color.DarkGray, WDM.PCSWin_X, WDM.PCSWin_Y, WDM.PCSWin_X2, WDM.PCSWin_Y2); DisplayPCStats(SC); Crt.TextColor(Crt.Color.DarkGray); Crt.GotoXY(WDM.PCSWin_X, WDM.PCSWin_Y2 + 1); Crt.Write("/ - Mode d - Drop"); Crt.GotoXY(WDM.PCSWin_X, WDM.PCSWin_Y2 + 2); Crt.Write("[SPACE] - Default Item Action"); Crt.GotoXY(WDM.PCSWin_X, WDM.PCSWin_Y2 + 3); Crt.Write("[ESC] - Exit"); }
public void Install(PrivateKey pk, Crt crt, IEnumerable <Crt> chain, IPkiTool cp) { var store = new X509Store(StoreName, StoreLocation); try { store.Open(OpenFlags.ReadWrite); var crtChain = new[] { crt }.Concat(chain); using (var ms = new MemoryStream()) { cp.ExportArchive(pk, crtChain, ArchiveFormat.PKCS12, ms); var flag = X509KeyStorageFlags.UserKeySet; if (StoreLocation == StoreLocation.LocalMachine) { flag = X509KeyStorageFlags.MachineKeySet; } var cert = new X509Certificate2(ms.ToArray(), string.Empty, X509KeyStorageFlags.PersistKeySet | flag | X509KeyStorageFlags.Exportable); if (!string.IsNullOrEmpty(FriendlyName)) { cert.FriendlyName = FriendlyName; } store.Add(cert); } } finally { store.Close(); } }
// default functions public void CreateName(LeaderBoardData lbd) { UpdateColor(lbd.col); data = lbd; if (A.FollowType != FollowType.None) { hwp = go.Gc <HWP>(); if (hwp) { hwp.info.arrow.size = Screen.width * 0.06f; HWPManager.instance.TextStyle.fontSize = M.RoundInt(Screen.width * 0.06f); HWPManager.instance.TextStyle.contentOffset = Vector2.up * -(Screen.width * 0.06f * 1.6f); hwp.info.text = A.GC.isNameUppercase ? data.name.ToUpper() : data.name; hwp.info.color = data.col; hwp.info.character = this; } if (A.FollowType == FollowType.Follow || A.FollowType == FollowType.FollowPointer) { Follow follow = Crt.Go <Follow>(Resources.Load <GameObject>("Main/FollowName"), new Tf(transform.position), "", A.GC.transform); follow.followTf = transform; followTmp = follow.Child <TextMeshPro>(0); if (followTmp) { followTmp.text = A.GC.isNameUppercase ? data.name.ToUpper() : data.name; followTmp.color = data.col; } } } }
private static void SaveCommandCSV(Dictionary <string, int> commandUsage, string group) { string FileName = Global.GetSafeAbsolutePath("CommandUsage" + group + ".csv"); try { // Delete old file FileUtils.FileDelete(FileName); // Save new file if (commandUsage.Count > 0) { StringBuilder SB = new StringBuilder(); SB.AppendLine("Command,Uses"); foreach (KeyValuePair <string, int> KVP in commandUsage) { SB.Append(KVP.Key); SB.Append(","); SB.AppendLine(KVP.Value.ToString()); } FileUtils.FileWriteAllText(FileName, SB.ToString()); } } catch { Crt.WriteLn("Error saving " + FileName); Crt.ReadKey(); } }
public ResultadoTributacao(ITributavelProduto produto, Crt crtEmpresa, TipoOperacao operacao, TipoPessoa tipoPessoa) { _produto = produto; CrtEmpresa = crtEmpresa; Operacao = operacao; TipoPessoa = tipoPessoa; }
public override void draw(SpriteBatch sprite_batch, Vector2 draw_offset = default(Vector2)) { if (texture != null) { if (visible) { Rectangle src_rect = this.src_rect; Vector2 offset = this.offset; if (mirrored) { offset.X = src_rect.Width - offset.X; } sprite_batch.Draw(texture, loc + draw_vector() - draw_offset, src_rect, tint, angle, offset, scale, mirrored ? SpriteEffects.FlipHorizontally : SpriteEffects.None, Z); AtkSpdLabel.draw(sprite_batch, -draw_offset - (loc + draw_vector() + new Vector2(0, 0) - offset)); Atk.draw(sprite_batch, -draw_offset - (loc + draw_vector() + TEXT_LOC + new Vector2(0, 0) - offset)); Hit.draw(sprite_batch, -draw_offset - (loc + draw_vector() + TEXT_LOC + new Vector2(0, 8) - offset)); Crt.draw(sprite_batch, -draw_offset - (loc + draw_vector() + TEXT_LOC + new Vector2(0, 16) - offset)); AtkSpd.draw(sprite_batch, -draw_offset - (loc + draw_vector() + TEXT_LOC + new Vector2(0, 24) - offset)); } } }
static void ClearUCM() { /* Cls on the UCM zone described above. */ Crt.Window(WDM.UCM_X, WDM.UCM_Y, WDM.UCM_X2, WDM.UCM_Y2); Crt.ClrScr(); Crt.Window(1, 1, WDM.CON_WIDTH, WDM.CON_HEIGHT); }
static RTGlobal() { // Load all the ref files in the current directory string[] RefFileNames = Directory.GetFiles(ProcessUtils.StartupPath, "*.ref", SearchOption.TopDirectoryOnly); foreach (string RefFileName in RefFileNames) { LoadRefFile(RefFileName); } if (Debugger.IsAttached) { SaveCommandCSV(_ImplementedCommandUsage, "Implemented"); SaveCommandCSV(_UnimplementedCommandUsage, "Unimplemented"); SaveCommandCSV(_UnknownCommandUsage, "Unknown"); SaveCommandCSV(_UnusedCommandUsage, "Unused"); if ((_UnknownCommandUsage.Count > 0) || (_UnusedCommandUsage.Count > 0)) { Crt.WriteLn("Unknown commands used: " + _UnknownCommandUsage.Count.ToString()); Crt.WriteLn("Unused commands used: " + _UnusedCommandUsage.Count.ToString()); Crt.ReadKey(); } } // Read-only variables RTVariables.Init(); }
public static void Delineate(string msg, int width, int offset) { //{ This is the breaking-into-lines section of the prettyprinter.} //{ Take a null-terminated string, MSG, and break it into} //{ sections of width characters or less.} //{ The offset parameter, if more than one, indicates the column} //{ that text display starts at.} //{ PRE-CONDITIONS: The CRT display is set up exactly as you want it with} //{ regards to window, text color, cursor placement, and so on.} if (msg == null || msg == string.Empty) { return; } int lineStart = 0; do { int lineBreak = lineStart; int wordCount = 0; int wordEnd = 0; do { wordCount += 1; wordEnd = msg.IndexOf(' ', lineBreak); if (wordEnd < 0) { wordEnd = msg.Length; } //{if there's enough room for this to fit on a} //{line, it becomes linebreak.} //{Also, if this is the first word, print it} //{anyways. This should, in theory, deal with} //{words too long to fit on a single line.} if ((wordEnd - lineStart + offset - 1 <= width) || wordCount == 1) { lineBreak = wordEnd + 1; } }while ((wordEnd - lineStart + offset <= width) && (lineBreak < msg.Length + 1)); if (Crt.WhereX() != offset) { Crt.Write("\n"); } string theLine = msg.Substring(lineStart, lineBreak - lineStart - 1); Crt.Write(theLine); lineStart = lineBreak; offset = 1; }while (lineStart < msg.Length); }
private void LogUnused(string[] tokens) { string Output = "UNUSED?!? (hit a key): " + string.Join(" ", tokens); Crt.FastWrite(StringUtils.PadRight(Output, ' ', 80), 1, 25, 31); Crt.ReadKey(); Crt.FastWrite(new string(' ', 80), 1, 25, 0); }
private void LogMissing(string[] tokens) { string Output = "MISSING!!! (hit a key): " + string.Join(" ", tokens); Crt.FastWrite(StringUtils.PadRight(Output, ' ', 80), 1, 25, 31); Crt.ReadKey(); Crt.FastWrite(new string(' ', 80), 1, 25, 0); }
public ResultadoTributacao(ITributavelProduto produto, Crt crtEmpresa, TipoOperacao operacao, TipoPessoa tipoPessoa, TipoDesconto tipoDesconto = TipoDesconto.Incondicional) { _produto = produto; CrtEmpresa = crtEmpresa; Operacao = operacao; TipoPessoa = tipoPessoa; TipoDesconto = tipoDesconto; }
protected void Page_Load(object sender, EventArgs e) { Crt cart = SessionHelper.GetCart(Session); csQuantity.InnerText = cart.Lines.Sum(x => x.Quantity).ToString(); csTotal.InnerText = cart.ComputeTotalPrice().ToString("c"); csLink.HRef = RouteTable.Routes.GetVirtualPath(null, "cart", null).VirtualPath; }
private void LogUnimplemented(string[] tokens) { string Output = "UNIMPLEMENTED (hit a key): " + string.Join(" ", tokens); Crt.FastWrite(StringUtils.PadRight(Output, ' ', 80), 1, 25, 31); Crt.ReadKey(); Crt.FastWrite(new string(' ', 80), 1, 25, 0); }
private static void StatusText(string text, bool prefixWithTime = true) { if (prefixWithTime && (!string.IsNullOrEmpty(text))) { text = $"{DateTime.Now.ToString(Config.Instance.TimeFormatUI)} {text}"; } Crt.Write($"{text}\r\n"); }
private void DownloadButton_Click(object sender, EventArgs e) { Transfer.XModem xModem = new Transfer.XModem(); string fn = Path.ChangeExtension(Path.GetTempFileName(), ".xmodem"); Crt.PrintLine("Receiving to " + fn); xModem.ReceiveFile(Session, fn); }
static void Main(string[] args) { try { Door.Startup(); Door.StripLF = false; Door.TextAttr(7); Door.ClrScr(); Door.GotoXY(1, 1); Door.KeyPressed(); // Ensures statusbar gets drawn before connecting (which blocks updates) // Default values (could be overridden when handling CLPs) _RLoginClientUserName = Door.DropInfo.Alias; _RLoginServerUserName = Door.DropInfo.Alias; // Parse CLPs HandleCLPs(args); // Check if we're being told where to connect, or should display a menu if (string.IsNullOrEmpty(_HostName)) { // No hostname, display a menu Menu(); } else { // Have a hostname, connect to it Connect(); // Pause before quitting Door.ClearBuffers(); if (_WaitOnExit > 0) { Door.WriteLn(); Door.TextAttr(15); Door.Write(new string(' ', 30) + "Hit any key to quit"); for (int i = 0; i < _WaitOnExit * 10; i++) { if (Door.KeyPressed()) { break; } Crt.Delay(100); } Door.ReadKey(); } Door.TextAttr(7); } } catch (Exception ex) { FileUtils.FileAppendAllText("ex.log", ex.ToString() + Environment.NewLine); } finally { Door.Shutdown(); } }
private static void UpdateTime() { if (_FancyOutput) { // Update time Crt.FastWrite(StringUtils.PadRight(DateTime.Now.ToString(_TimeFormatFooter).ToLower(), ' ', 7), 9, 38, Crt.LightGreen); Crt.FastWrite(StringUtils.PadRight(DateTime.Now.ToString("dddd MMMM dd, yyyy"), ' ', 28), 23, 38, Crt.LightGreen); } }