public static string Compile(string strText, bool bIsAutoTypeSequence, PwEntry pwEntry, PwDatabase pwDatabase, bool bEscapeForAutoType, bool bEscapeQuotesForCommandLine) { if (strText == null) { Debug.Assert(false); return(string.Empty); } if (strText.Length == 0) { return(string.Empty); } SprEngine.InitializeStatic(); SprContentFlags cf = new SprContentFlags(bEscapeForAutoType && bIsAutoTypeSequence, bEscapeQuotesForCommandLine); SprRefsCache vRefsCache = new SprRefsCache(); string str = SprEngine.CompileInternal(strText, pwEntry, pwDatabase, cf, 0, vRefsCache); if (bEscapeForAutoType && !bIsAutoTypeSequence) { str = SprEncoding.MakeAutoTypeSequence(str); } return(str); }
internal static string MakeAutoTypeSequence(string str) { if (str == null) { Debug.Assert(false); return(string.Empty); } str = SprEncoding.EscapeAutoTypeBrackets(str); str = str.Replace(@"[", @"{[}"); str = str.Replace(@"]", @"{]}"); str = str.Replace(@"+", @"{+}"); str = str.Replace(@"^", @"{^}"); str = str.Replace(@"%", @"{%}"); str = str.Replace(@"~", @"{~}"); str = str.Replace(@"(", @"{(}"); str = str.Replace(@")", @"{)}"); return(str); }
private static string UntransformContent(string strContent, SprContext ctx) { if (strContent == null) { Debug.Assert(false); return(string.Empty); } string str = strContent; if (ctx != null) { if (ctx.EncodeAsAutoTypeSequence) { Debug.Assert(false); } if (ctx.EncodeForCommandLine) { str = SprEncoding.DecodeCommandLine(str); } } return(str); }
public static string TransformContent(string strContent, SprContext ctx) { if (strContent == null) { Debug.Assert(false); return(string.Empty); } string str = strContent; if (ctx != null) { if (ctx.EncodeQuotesForCommandLine) { str = SprEncoding.MakeCommandQuotes(str); } if (ctx.EncodeAsAutoTypeSequence) { str = SprEncoding.MakeAutoTypeSequence(str); } } return(str); }