Simple Textformatter {[Name]:ALIGNMENT:WIDTH:FILLCHAR} or {index:ALIGNMENT:WIDTH:FILLCHAR} or {"text":...} [Name] is the name of a defined text macro index is the index in the passed parameter list "text" is a freestyle text to be formatted ALIGNMENT =LN ... left-aligned and do not fill =LF ... left aligned and fill up = M ... centered = R ... right-aligned WIDTH Tells the formatter to which width the text should be aligned FILLCHAR For LF and R. Char used to fill
Esempio n. 1
0
        /// <summary>
        /// Looks for {[..]} constructions in the specified expression,
        /// and calls the callback for each of them replacing its occurance with the
        /// return value of the callback
        /// </summary>
        /// <param name="expression"></param>
        /// <param name="cb"></param>
        /// <returns></returns>
        public static string ReplaceVariables(string expression, VariableDetectedCB cb)
        {
            SimpleFormatter f = new SimpleFormatter ();
            f.OnGetParameter += delegate(string parameterName) {
                return cb (parameterName);
            };

            return f.Format (expression);
        }
        public void SendCommand(RemoteControlProtocol r)
        {
            RemoteProcessInfo[] processes = null;
            ManualResetEvent evt = new ManualResetEvent (false);

            r.RemoteProcessInfo += delegate(RemoteProcessInfo[] lProcesses) {
                processes = lProcesses;
                evt.Set ();
            };

            SimpleFormatter f = new SimpleFormatter ();
            f.OnGetParameter += delegate(string parameterName) {
                KeyValuePair<string, string>? keyP = StringHelper.SplitToKeyValue (parameterName, "|");
                if (keyP == null)
                    throw new ArgumentException ("Invalid variable speciication");

                switch (keyP.Value.Key)
                {
                case "remote-pid":
                    if (processes == null)
                    {
                        r.RemoteProcesses ();
                        evt.WaitOne ();
                    }
                    RemoteProcessInfo procInfo = FindProcess (processes, keyP.Value.Value);
                    if (procInfo == null)
                        throw new ArgumentException (string.Format ("Could not find process '{0}'", keyP.Value.Value));
                    return procInfo.Pid.ToString ();

                default:
                    throw new NotSupportedException ("The specified variable is not supported");
                }
            };

            string newCmd = f.Format (_cmd.Path);
            List<string> newArgs = new List<string> ();
            foreach (string arg in _cmd.Args)
                newArgs.Add (f.Format (arg));

            List<string> newEnv = new List<string> ();
            foreach (String env in _cmd.EnvP)
                newEnv.Add (f.Format (env));

            r.SendCommand (new RemoteExecCommand (_cmd.Name, newCmd, newArgs, newEnv));
        }
Esempio n. 3
0
        public static string StaticFormat(string format, params object[] args)
        {
            SimpleFormatter formatter = new SimpleFormatter ();

            return formatter.Format (format, args);
        }
Esempio n. 4
0
 /// <summary>
 /// Initializes the fuzzing environment
 /// </summary>
 public void Init()
 {
     _formatter = new SimpleFormatter ();
     _formatter.IgnoreUnknownMacros = true;
     XmlFactoryHelpers.ParseValueIncludes (_doc.DocumentElement, _configDir, _formatter, _values);
     InitRemote ();
     InitTargetConnection ();
     InitPreDefinedFuzzers ();
     InitPreCondition ();
     InitFuzzDescription ();
     InitLoggers ();
 }
        /// <summary>
        /// Initializes the analyzation environment
        /// </summary>
        public void Init()
        {
            _formatter = new SimpleFormatter();
            XmlFactoryHelpers.ParseValueIncludes(_doc.DocumentElement,
                _configDir, _formatter, _values);

            InitRegisters();
            InitRegisterTypeResolver();
            InitFuzzLogPath();
            InitErrorLog();
            InitAnalyzers();
        }