Esempio n. 1
0
        void DoMessage(MType type, string msg, Ast.ILNode node)
        {
            string        timestamp = TimeStampString;
            StringBuilder sb        = new StringBuilder();

            sb.Append(type.ToString());
            sb.Append(' ');
            sb.Append(timestamp);
            if (code_name != null)
            {
                sb.Append('(');
                sb.Append(code_name);
                sb.Append(')');
            }
            sb.Append(": ");
            if (node != null)
            {
                string header = sb.ToString();
                sb.Append(msg);
                sb.AppendLine();
                using (PlainTextWriter ptext = new PlainTextWriter())
                {
                    ptext.LineHeader = header;
                    ptext.Indent++;
                    ptext.Write(node.ToString());
                    ptext.Indent--;
                    if (ptext.Column > 0)
                    {
                        ptext.WriteLine();
                    }
                    sb.Append(ptext.ToString());
                }
            }
            else
            {
                sb.Append(msg);
            }
            string      o  = sb.ToString();
            TaskMessage tm = new TaskMessage()
            {
                Message = o, type = type
            };

            messages.Add(tm);
            if (type >= printMoreThanThis)
            {
                ConsoleWriteLine(o);
                System.Diagnostics.Debug.WriteLine(o); // just because I don't look at console all the time
            }
        }
Esempio n. 2
0
 public ExampleMessage(MType type)
 {
     this.Types = type.ToString();
 }
Esempio n. 3
0
 public ErrorMessage(MType type, string ipPort, string msg) : base(MType.Error, ipPort)
 {
     this.FromTypes = type.ToString();
     this.Message   = msg;
 }
Esempio n. 4
0
        public ModelInfo(Type _type)
        {
            this.MType     = _type;
            this.Fillables = new List <ModelField>();
            this.Table     = _type.GetCustomAttribute <Table>();

            if (Table == null)
            {
                throw new ModelFormatException(string.Format("Missing table attribute for Model {0}", MType.ToString()));
            }

            foreach (FieldInfo field in _type.GetFields())
            {
                if (field.GetCustomAttribute(typeof(Fillable)) != null)
                {
                    ModelField modelField = new ModelField(field);
                    if (PrimaryField == null && modelField.GetPrimaryKey() != null)
                    {
                        this.PrimaryField = modelField;
                    }

                    Fillables.Add(modelField);
                }
            }
        }
Esempio n. 5
0
 public void registerUser(int playerNo, MType type)                 // consider having this method send registration messages as well
 {
     try {
         userList[playerNo].Add(type);
         revUserList[type].Add(playerNo);
     } catch (KeyNotFoundException) {
         Debug.Log("Invalid dictionary access during player registration! playerNo: " + playerNo + " type: " + type.ToString());
     }
 }