Beispiel #1
0
    // Config

    bool ConfigOperation(WrenchProject proj, BuildServices bs)
    {
        Result res = bs.GetValue().Result;

        if (res == null)
        {
            return(true);
        }

        // prompt
        Result rprompt;

        if (bs.GetTag("prompt", out rprompt))
        {
            return(true);
        }

        string prompt;

        if (rprompt == null)
        {
            log.PushLocation(bs.FullName);
            log.Warning(2017, "This configurable option does not have a \'prompt\' tag.", null);
            log.PopLocation();
            prompt = String.Format("Set value of {0}:", bs.FullName);
        }
        else
        {
            // TODO: i18n
            prompt = ((MBString)rprompt).Value;
        }

        if (res is MBBool)
        {
            DoConfigBool(prompt, (MBBool)res);
        }
        else if (res is MBString)
        {
            DoConfigString(prompt, (MBString)res);
        }
        else if (res is MBDirectory)
        {
            DoConfigDirectory(prompt, (MBDirectory)res);
        }
        else
        {
            string s = String.Format("Current value is {0}", res);
            log.PushLocation(bs.FullName);
            log.Error(2018, "Don't know how to configure this option.", s);
            log.PopLocation();
            return(true);
        }

        bs.FixValue(res);
        return(false);
    }
Beispiel #2
0
    void OnStringTimeout(Entry entry)
    {
        BuildServices services = (BuildServices)entry.Data[services_key];
        MBString      val      = (MBString)entry.Data[result_key];

        val.Value = entry.Text;
        Console.WriteLine("Fixing {0} = {1}", services.FullName, val);
        services.FixValue(val);
        timeouts.Remove(entry);
    }
Beispiel #3
0
    // Callbacks

    void OnBoolToggled(object sender, EventArgs args)
    {
        CheckButton   cb       = (CheckButton)sender;
        BuildServices services = (BuildServices)cb.Data[services_key];
        MBBool        val      = (MBBool)cb.Data[result_key];

        val.Value = cb.Active;
        Console.WriteLine("Fixing {0} = {1}", services.FullName, val);
        services.FixValue(val);
    }
Beispiel #4
0
    public int ImportXml(string here, ProjectManager pm)
    {
        int num_imported = 0;

        while (!import_reader.EOF)
        {
            if (import_reader.NodeType != XmlNodeType.Element ||
                import_reader.Name != "result")
            {
                import_reader.Read();
                continue;
            }

            string id;
            Result r = Result.ImportXml(import_reader, out id, log);

            if (r == null)
            {
                continue;
            }

            if (id == null || id.Length == 0)
            {
                log.Warning(3019, "Found a result without associated ID; don't know where to import", r.ToString());
                continue;
            }

            if (id[0] != '/')
            {
                log.Warning(3019, "This file configures a relative target name; " +
                            "behavior will vary depending on current directory", null);
                id = here + id;
            }

            BuildServices bs = pm.Project.GetTargetServices(id);
            if (bs == null)
            {
                continue;
            }

            Console.WriteLine(" + {0} = {1}", id, r);
            bs.FixValue(r);
            num_imported++;
        }

        Console.WriteLine("Imported {0} result values", num_imported);

        return(0);
    }