/**<summary>Processes the Script mode option.</summary>*/ private static void ProcessScript() { if (passedArgs.HasFlag(ArgTypes.Script)) { LogOptionAlreadySpecified(ArgTypes.Script); } if (argMode != ArgTypes.None && argMode != ArgTypes.Script) { LogModeAlreadySpecified(ArgTypes.Script); } processMode = ProcessModes.Script; }
/**<summary>Processes the Restore mode option.</summary>*/ private static void ProcessRestore() { if (passedArgs.HasFlag(ArgTypes.Restore)) { LogOptionAlreadySpecified(ArgTypes.Restore); } if (argMode != ArgTypes.None && argMode != ArgTypes.Restore) { LogModeAlreadySpecified(ArgTypes.Restore); } processMode = ProcessModes.Restore; }
/**<summary>Processes the Backup mode option.</summary>*/ private static void ProcessBackup() { if (passedArgs.HasFlag(ArgTypes.Backup)) { LogOptionAlreadySpecified(ArgTypes.Backup); } if (argMode != ArgTypes.None && argMode != ArgTypes.Backup) { LogModeAlreadySpecified(ArgTypes.Backup); } processMode = ProcessModes.Convert; }
public virtual ProcessEngine <UserType> SelectEngine(ProcessModes gm) { switch (gm) { case (ProcessModes.Queue): gameengine = new QueueEngine(); return(gameengine); case (ProcessModes.OneTurn): gameengine = new QueueEngine(); return(gameengine); case (ProcessModes.RealTime): gameengine = new QueueEngine(); return(gameengine); } return(null); }
private static void PrintProcessMode() { ProcessModes processMode = ProcessMode.Current.Mode; ConsoleColor color = ConsoleColor.Red; switch (processMode) { case ProcessModes.Dev: color = ConsoleColor.Green; break; case ProcessModes.Test: color = ConsoleColor.Yellow; break; case ProcessModes.Prod: color = ConsoleColor.Red; break; } OutLineFormat("Current ProcessMode is {0}", color, processMode.ToString()); Thread.Sleep(30); }
private static void ProcessNode(StringBuilder output, HtmlNode node, ProcessModes mode, bool returnHtml) { var lineBreak = returnHtml ? "<br />" : "\r\n"; // (mode == ProcessModes.Quote) ? "\n" : "<br /> "; if (node == null || output == null || (mode == ProcessModes.TextOnly && node.Name != "#text")) return; switch (node.Name) { // No action needed for these node types case "#text": var text = HttpUtility.HtmlDecode(node.InnerHtml); //if (mode != ProcessModes.Quote) // text = HttpContext.Current.Server.HtmlEncode(text); text = text.Replace("&", "&").Replace("<", "<").Replace(">", ">"); output.Append(text); return; case "tr": ProcessNodes(output, node.ChildNodes, mode, returnHtml); output.Append(lineBreak); return; case "script": return; case "ol": case "ul": if (mode != ProcessModes.Normal) return; output.Append(lineBreak); var listItemNodes = node.SelectNodes("//li"); for (var i = 0; i < listItemNodes.Count; i++) { var listItemNode = listItemNodes[i]; output.AppendFormat("{0} ", node.Name == "ol" ? (i + 1).ToString() : "*"); ProcessNodes(output, listItemNode.ChildNodes, mode, returnHtml); output.Append(lineBreak); } return; case "li": if (mode == ProcessModes.Quote) return; output.Append("* "); ProcessNodes(output, node.ChildNodes, mode, returnHtml); output.Append(lineBreak); return; case "p": ProcessNodes(output, node.ChildNodes, mode, returnHtml); output.Append(lineBreak); return; case "b": case "strong": if (mode != ProcessModes.Quote) { output.Append("<b>"); ProcessNodes(output, node.ChildNodes, mode, returnHtml); output.Append("</b>"); } else { output.Append("[b]"); ProcessNodes(output, node.ChildNodes, mode, returnHtml); output.Append("[/b]"); } return; case "i": if (mode != ProcessModes.Quote) { output.Append("<i>"); ProcessNodes(output, node.ChildNodes, mode, returnHtml); output.Append("</i>"); } else { output.Append("[i]"); ProcessNodes(output, node.ChildNodes, mode, returnHtml); output.Append("[/i]"); } return; case "blockquote": if (mode != ProcessModes.Normal) return; output.Append("[quote]"); ProcessNodes(output, node.ChildNodes, mode, returnHtml); output.Append("[/quote]" + lineBreak); return; case "br": output.Append(lineBreak); return; case "img": var src = node.Attributes["src"]; if (src == null || string.IsNullOrWhiteSpace(src.Value)) return; var isEmoticon = src.Value.IndexOf("emoticon", 0, StringComparison.InvariantCultureIgnoreCase) >= 0; var url = src.Value.Trim(); var request = HttpContext.Current.Request; // Make a fully qualifed URL if (!url.ToLower().StartsWith("http")) { var rootDirectory = url.StartsWith("/") ? string.Empty : "/"; url = string.Format("{0}://{1}{2}{3}", request.Url.Scheme, request.Url.Host, rootDirectory, url); } if (mode == ProcessModes.Quote && isEmoticon) return; output.AppendFormat(isEmoticon ? "<img src='{0}' />" : "[img]{0}[/img]", url); return; case "a": var href = node.Attributes["href"]; if (href == null || string.IsNullOrWhiteSpace(href.Value)) return; output.AppendFormat("[url={0}]", href.Value); ProcessNodes(output, node.ChildNodes, ProcessModes.TextOnly, returnHtml); output.Append("[/url]"); return; } ProcessNodes(output, node.ChildNodes, mode, returnHtml); }
private static void ProcessNodes(StringBuilder output, IEnumerable<HtmlNode> nodes, ProcessModes mode, bool returnHtml) { foreach (var node in nodes) ProcessNode(output, node, mode, returnHtml); }
static void Main(string[] args) { if (args.Length < 4) { Console.WriteLine( "Unreal Config Tool (C) Mojobojo 2011\n" + "Usage:\n\n" + "Unpack /u\n" + "Pack /p\n" + "Unicode /n\n" + "Ascii /a\n\n" + "UnrealConfigTool <options> <in/out file> <in/out dir>\n" ); return; } ProcessModes ProcessMode = ProcessModes.Null; DataModes DataMode = DataModes.Null; string InOutFileName; string InOutDir; int i = 0; for ( ; i < args.Length; i++) { if (args[i][0] == '/') { switch (args[i][1]) { case 'u': case 'U': ProcessMode = ProcessModes.Unpack; break; case 'p': case 'P': ProcessMode = ProcessModes.Pack; break; case 'n': case 'N': DataMode = DataModes.Unicode; break; case 'a': case 'A': DataMode = DataModes.Ascii; break; default: Console.WriteLine("Unknown command"); break; } } else { break; } } InOutFileName = args[i++]; InOutDir = args[i++]; if (ProcessMode == ProcessModes.Unpack) { if (DataMode == DataModes.Unicode) { UnpackUnicode(InOutFileName, InOutDir); } else if (DataMode == DataModes.Ascii) { UnpackAscii(InOutFileName, InOutDir); } } else if (ProcessMode == ProcessModes.Pack) { if (DataMode == DataModes.Unicode) { PackUnicdoe(InOutFileName, InOutDir); } else if (DataMode == DataModes.Ascii) { PackAscii(InOutFileName, InOutDir); } } }
public static ProcessMode FromEnum(ProcessModes enumVal) { return(new ProcessMode { Mode = enumVal }); }