Warning() public method

public Warning ( int line, int col, string s ) : void
line int
col int
s string
return void
Esempio n. 1
0
    /// <summary>
    /// Constructor.
    /// </summary>
    /// <param name="src">Source description</param>
    /// <param name="post">Postfix (used in errors)</param>
    public Server(string src, string post)
    {
        string[] a = src.Split(delims);

        if (a.Length > 5)
        {
            Errors.Warning("Ignored server: " + src + " " + post);
            return;
        }

        if (a.Length == 0)
        {
            Errors.Warning("Ignored garbage " + post);
            return;
        }

        string s = a[0].Trim();

        if (s.Length == 0)
        {
            return;
        }

        name    = s.ToLower();
        isValid = true;

        cpu = PickUp(a, 1);
        mem = PickUp(a, 2);
        net = PickUp(a, 3);
        dsk = PickUp(a, 4);
    }
Esempio n. 2
0
    /// <summary>
    /// Handle the Map command.
    /// </summary>
    /// <param name="l">Map</param>
    private void CmdMap(string l)
    {
        if (calculate)
        {
            Verbose.Out("Calculation mode - skipping Map");
            return;
        }

        int i;

        if ((i = l.IndexOf(']')) == -1)
        {
            Errors.Error("Usage: " + UsMap + " (" + lineNo + ")");
        }
        else
        {
            string p = l.Substring(0, i);

            if (phantoms.ContainsKey(p))
            {
                char[]   delim = new char[] { ' ' };
                Phantom  ph    = (Phantom)phantoms[p];
                string[] a;

                l = l.Substring(i + 1);
                a = l.Split(delim, StringSplitOptions.RemoveEmptyEntries);
                for (i = 0; i < a.Length; i++)
                {
                    if (iServers.ContainsKey(a[i]))
                    {
                        if (ph.srvs.ContainsKey(a[i]) == true)
                        {
                            Errors.Warning("Server '" + a[i] + "' is already bound to this phantom - skipping (" + lineNo + ")");
                        }
                        else
                        {
                            Verbose.Out("Binding '" + a[i] + "' to phantom '" + ph.name + "' (" + lineNo + ")");
                            ph.Stack((Server)iServers[a[i]]);
                        }

                        iServers.Remove(a[i]);
                    }
                    else
                    {
                        Errors.Error("No such server: '" + a[i] + "' (" + lineNo + ")");
                    }
                }
            }
            else
            {
                Errors.Error("No such phantom server: '" + p + "' (" + lineNo + ")");
            }
        }
    }
Esempio n. 3
0
 /// <summary>
 /// Add the phantom to the Phantoms list.
 /// </summary>
 /// <param name="p">Phantom</param>
 public void AddToPhantomList(Phantom p)
 {
     if (phantoms.ContainsKey(p.name))
     {
         Errors.Warning("Phantom " + p.name + " already exists on phantoms list - overwriting");
         phantoms[p.name] = p;
     }
     else
     {
         phantoms.Add(p.name, p);
     }
 }
Esempio n. 4
0
 /// <summary>
 /// Add the server to the server list.
 /// </summary>
 /// <param name="s">Server</param>
 private void AddToServerList(Server s)
 {
     if (iServers.ContainsKey(s.name))
     {
         Errors.Warning("Server " + s.name + " already exists on server list - overwriting");
         iServers[s.name] = s;
     }
     else
     {
         iServers.Add(s.name, s);
     }
 }
Esempio n. 5
0
        public void CompDeletableSymbols()
        {
            bool changed;

            do
            {
                changed = false;
                foreach (Symbol sym in nonterminals)
                {
                    if (!sym.deletable && sym.graph != null && DelGraph(sym.graph))
                    {
                        sym.deletable = true; changed = true;
                    }
                }
            } while (changed);
            foreach (Symbol sym in nonterminals)
            {
                if (sym.deletable)
                {
                    errors.Warning("  " + sym.name + " deletable");
                }
            }
        }
Esempio n. 6
0
 /// <summary>
 /// Handle the Server command.
 /// </summary>
 /// <param name="line">Server descriptor</param>
 private void CmdServer(string line)
 {
     if (line.Length == 0)
     {
         Errors.Error("Usage: " + UsServer + " (" + lineNo + ")");
     }
     else
     {
         Server srv = new Server(line, "(" + lineNo + ")");
         if (srv.isValid)
         {
             Verbose.Out("Adding server to serverlist: " + srv.name + " (" + lineNo + ")");
             AddToServerList(srv);
         }
         else
         {
             Errors.Warning("Blank server - ignored (" + lineNo + ")");
         }
     }
 }
Esempio n. 7
0
    /// <summary>
    /// Load servers into scenario.
    /// </summary>
    /// <param name="src">Serverlist</param>
    /// <returns>true if successful, false otherwise</returns>
    private bool LoadServers(string src)
    {
        int srvs = 0;

        src = src.Trim();

        if (!File.Exists(src))
        {
            Errors.Error("No such serverlist: " + src + " (" + lineNo + ")");
            return(false);
        }

        using (StreamReader r = new StreamReader(src)) {
            int    sLno   = 0;
            char[] delims = new char[] { ',' };
            string s;
            Server srv;

            while ((s = r.ReadLine()) != null)
            {
                sLno++;

                srv = new Server(s, "(" + src + ":" + sLno + ")");
                if (srv.isValid)
                {
                    Verbose.Out("Adding server to serverlist: " + srv.name + " (" + src + ":" + sLno + ")");
                    AddToServerList(srv);
                    srvs++;
                }
                else
                {
                    Errors.Warning("Blank server - ignored (" + src + ":" + sLno + ")");
                    srv = null;
                }
            }
        }

        Verbose.Out(srvs + " server" + ((srvs == 1) ? " " : "s ") + "loaded from " + src);
        return(true);
    }
Esempio n. 8
0
    public override void Run()
    {
        Server srv;

        SortServersDescending();

        for (int sIdx = 0; sIdx < sc.servers.Count; sIdx++)
        {
            srv = (Server)sc.servers[sIdx];
            if (TryPlace(srv) == false)
            {
                if (sc.calculate)
                {
                    AllocNewPhantom(srv);
                }
                else
                {
                    Errors.Warning("Cannot stack server '" + srv.name + "'");
                    sc.unstackable.Add(srv.name, srv);
                }
            }
        }
    }