//this function will be on a UI button
    public void logInAccount()
    {
        //Get username from Input field
        GameObject inputFieldObject = GameObject.Find("InputFieldUsernameLogin");
        InputField inputField = inputFieldObject.GetComponent<InputField>();
        string username = inputField.text;

        //Get Password
        inputFieldObject = GameObject.Find("InputFieldPasswordLogin");
        inputField = inputFieldObject.GetComponent<InputField>();
        string password = inputField.text;

        if (checkLoginInputFields(username,password))
        {
            scObject data = new scObject("loginInfo");
            data.addString("username", username);
            string nPass = calculateMD5Hash(password);
            data.addString("password", nPass);
            message mes = new message("login");
            mes.addSCObject(data);
            SendServerMessage(mes);
        }
        else
        {
            //Error message
            GameObject errorTextOb = GameObject.Find("TextLoginError");
            Text errorText = errorTextOb.GetComponent<Text>();
            errorText.text = "*Please type your username and password.";
        }
    }
Esempio n. 2
0
        public override bool chatEvent(message m, chat c = null)
        {
            bool processed = false;

            if (m.text_msg.StartsWith("/craft_add"))
            {
                TelegramAPI.GetReply(m.chatID, "Enter the word to add", m.message_id, true);
                processed = true;
            }
            else if (m.text_msg.StartsWith("/craft_remove"))
            {
                TelegramAPI.GetReply(m.chatID, "Enter the word to remove", m.message_id, true);
                processed = true;
            }
            else if (m.text_msg.StartsWith("/craft"))
            {
                TelegramAPI.SendMessage(m.chatID, craftWord());
                processed = true;
            }
            else if (m.isReply && m.replyOrigMessage == "Enter the word to add" && m.replyOrigUser == Roboto.Settings.botUserName)
            {
                //reply to add word
                addCraftWord(m.text_msg);
                TelegramAPI.SendMessage(m.chatID, "Added " + m.text_msg + " for " + m.userFirstName);
                processed = true;
            }
            else if (m.isReply && m.replyOrigMessage == "Enter the word to remove" && m.replyOrigUser == Roboto.Settings.botUserName)
            {
                bool success = removeCraftWord(m.text_msg);
                TelegramAPI.SendMessage(m.chatID, "Removed " + m.text_msg + " for " + m.userFirstName + " " + (success ? "successfully" : "but fell on my ass"));
                processed = true;
            }

            return processed;
        }
Esempio n. 3
0
        public override bool chatEvent(message m, chat c = null)
        {
            bool processed = false;
            if (c != null) //Needs to be done in a chat!
            {
                mod_birthday_data chatData = c.getPluginData< mod_birthday_data>();

                if (m.text_msg.StartsWith("/birthday_add"))
                {
                    TelegramAPI.GetExpectedReply(m.chatID, m.userID,  "Whose birthday do you want to add?", true, this.GetType(), "ADD");
                    processed = true;
                }
                else if (m.text_msg.StartsWith("/birthday_remove"))
                {
                    TelegramAPI.GetExpectedReply(m.chatID, m.userID, "Whose birthday do you want to remove?", true, this.GetType(), "REMOVE");
                    processed = true;
                }

                else if (m.text_msg.StartsWith("/birthday_list"))
                {
                    chatData.listBirthdays();
                    processed = true;
                }

            }
            return processed;
        }
Esempio n. 4
0
        public static void SaveMessage(string subject, string bodyxml, string filters, string senderTeacherID, List<string> staffRecipientIDs, List<string> studentRecipientIDs)
        {
            var db = ContextFactory.New();
            message m = new message();
            m.Body = bodyxml;
            m.Subject = subject;
            m.Filters = filters;

            foreach (var staff in staffRecipientIDs)
            {
                m.messagerecipients.Add(
                    new messagerecipient()
                    {
                        Recipient = staff,
                        RecipientType = (int)MessageRecipientType.Staff,
                        Sender = senderTeacherID
                    });
            };

            foreach (var student in studentRecipientIDs)
            {
                m.messagerecipients.Add(
                    new messagerecipient()
                    {
                        Recipient = student,
                        RecipientType = (int)MessageRecipientType.Student,
                        Sender = senderTeacherID
                    });
            };

            db.messages.AddObject(m);
            db.SaveChanges();
        }
Esempio n. 5
0
        public override bool chatEvent(message m, chat c = null)
        {
            bool processed = false;
            if (c != null)
            {
                mod_steam_chat_data chatData = (mod_steam_chat_data)c.getPluginData(typeof(mod_steam_chat_data));

                if (m.text_msg.StartsWith("/steam_addplayer"))
                {
                    TelegramAPI.GetExpectedReply(c.chatID, m.userID
                        , "Enter the steamID of the player you want to add. /steam_help to find out how to get this."
                        , false
                        , typeof(mod_steam)
                        , "ADDPLAYER", m.message_id, true);
                    processed = true;
                }
                else if (m.text_msg.StartsWith("/steam_help"))
                {
                    TelegramAPI.SendMessage(m.chatID, "You are looking for an ID from the Steam Community site, try http://steamcommunity.com/ and find your profile. You should have something like http://steamcommunity.com/profiles/01234567890132456 . Take this number on the end of the URL."
                        ,false, m.message_id);
                    processed = true;
                }
                else if (m.text_msg.StartsWith("/steam_check"))
                {
                    checkChat(c);

                    processed = true;
                }
                else if (m.text_msg.StartsWith ("/steam_stats"))
                {
                    string announce = "Currently watching achievements from the following players: " + "\n\r";
                    foreach (mod_steam_player p in chatData.players)
                    {
                        announce += "*" + p.playerName + "* - " + p.chievs.Count().ToString() + " known achievements" + "\n\r";
                    }
                    int achievements = 0;
                    foreach (mod_steam_game g in localData.games)
                    {
                        achievements += g.chievs.Count();
                    }
                    announce += "Tracking " + achievements.ToString() + " achievements across " + localData.games.Count().ToString() + " games";

                    TelegramAPI.SendMessage(m.chatID, announce , true, m.message_id);
                }

                else if (m.text_msg.StartsWith("/steam_remove"))
                {
                    List<string> playerKeyboard = new List<string>();
                    foreach (mod_steam_player p in chatData.players)
                    {
                        playerKeyboard.Add(p.playerName);
                    }
                    playerKeyboard.Add("Cancel");
                    string playerKeyboardText = TelegramAPI.createKeyboard(playerKeyboard, 2);
                    TelegramAPI.GetExpectedReply(c.chatID, m.userID, "Which player do you want to stop tracking?", false, typeof(mod_steam), "REMOVEPLAYER", m.message_id, true, playerKeyboardText);

                }
            }
            return processed;
        }
    //Listener for button Show me Data
    public void buttonListenerShowMeData()
    {
        string userPrefs = textCounty.text + "," + textMonth.text + "," + textYear.text + "," + textAccidentType.text;

        Debug.Log(userPrefs);

        scObject data = new scObject("userprefs");
        data.addString("county", textCounty.text);
        data.addString("month", textMonth.text);
        data.addString("year", textYear.text);
        data.addString("accidentType", textAccidentType.text);

        message openDatamsg = new message("opendata");
        openDatamsg.addSCObject(data);
        //TODO check dates if correct
        //object for construct correct message
        HandlePlayerQuery pq = new HandlePlayerQuery();
        //Send the correct message

        message svrMessage = new message("ServerOpenDataRequest");

        svrMessage = pq.messageOpenDataReady(openDatamsg);

        if (svrMessage != null)
        {
            UpdateInfoPanel(textCounty.text,svrMessage.getSCObject(0).getString("dateMY"), textAccidentType.text);
            SendServerMessage(svrMessage);
        }
        else
        {
            Debug.Log("THERE ARE EMPTY FIELDS...");
        }
    }
Esempio n. 7
0
    protected void Button3_Click(object sender, EventArgs e)
    {
        for (int i = 0; i < GridView1.Rows.Count; i++)
        {
            CheckBox cb = (CheckBox)GridView1.Rows[i].FindControl("CheckBox1");
            if (cb.Checked)
            {
                int id = Convert.ToInt32(GridView1.DataKeys[i].Value);

                message mes = new message();
                mes.id = id;
                mes.state = 1;

                BLLmessage bllmessage = new BLLmessage();
                int result = bllmessage.p_update(mes);
                if (result > 0)
                {
                    Response.Write("<script>alert('批量审核成功');location.href='../message.aspx'</script>");
                }
                else
                {
                    Common.MessageAlert.Alert(Page, "alert('批量审核失败');");
                }
            }
        }
    }
Esempio n. 8
0
 public void askKickMessage(message m)
 {
     List<string> playernames = new List<string>();
     foreach (mod_xyzzy_player p in players ) { playernames.Add(p.name); }
     playernames.Add("Cancel");
     string keyboard = TelegramAPI.createKeyboard(playernames, 2);
     TelegramAPI.GetExpectedReply(chatID, m.userID, "Which player do you want to kick", true, typeof(mod_xyzzy), "kick", -1, true, keyboard);
 }
Esempio n. 9
0
 public static void AbortTranslation(ErrorCode err, message.MessageProducer mp)
 {
     string fatal = "FATAL ERROR: " + err.Message;
        var args = Tuple.Create(0, 0, "", fatal);
        Message msg = new Message(MessageType.SyntaxError, args);
        mp.Send(msg);
        Environment.Exit(-1);
 }
 public DateEvent(string q, bool d)
 {
     question = q;
     answer = "";
     image = new TendresseData();
     mediaIsDrawing = d;
     sound = new message("sendSound");
 }
Esempio n. 11
0
 public void SetMapData(message.CrashMapData temp)
 {
     if(_map_data == null)
     {
         _map_data = new MapData();
     }
     _map_data.set_info(temp);
 }
Esempio n. 12
0
        public static void Flag(Token token, ErrorCode err, message.MessageProducer mp)
        {
            var args = Tuple.Create(token.LineNumber, token.Position, token.Lexeme, err.Message);
               Message msg = new Message(MessageType.SyntaxError, args);
               mp.Send(msg);

               if (++errors > MAX_ERRORS)
               {
               AbortTranslation(ErrorCode.TOO_MANY_ERRORS, mp);
               }
        }
Esempio n. 13
0
	public void parseOfficeChaper(message.MsgS2COfficeMapACK msg)
	{
		int chapter_id = msg.chapter_id;
		int session_id = 0;
		if (_officilMap.ContainsKey (chapter_id) == true) 
		{
			foreach (message.CrashMapData entry in msg.maps) 
			{
				_officilMap[chapter_id][entry.Section] = entry;	
				session_id = entry.Section;
			}
		}
		int req_chapter_id = -1;
		int req_section_id = -1;
		if (msg.section_count == _officilMap [chapter_id].Count) 
		{
			bool next_chapter_id = false;
			foreach (int chapter_id_entry in _chapter_ids) 
			{
				if (next_chapter_id == false) 
				{
					if (chapter_id == chapter_id_entry) 
					{
						next_chapter_id = true;
					}
				} 
				else 
				{
					req_chapter_id = chapter_id_entry;
					break;
				}
			}
		} 
		else 
		{
			req_chapter_id = chapter_id;
			req_section_id = session_id;
		}

		if (req_chapter_id == -1 && req_section_id == -1) 
		{
			endOfficilMapLoad ();
		}
		else 
		{
			if (chapter_id != -1) 
			{
				message.MsgC2SOfficeMapReq MsgReq = new message.MsgC2SOfficeMapReq ();
				MsgReq.chapter_id = req_chapter_id;
				MsgReq.section_id = req_section_id;
				global_instance.Instance._net_client.send (msg);
			}
		}
	}
Esempio n. 14
0
        public int delete(message mes)
        {
            StringBuilder sql = new StringBuilder();
            sql.Append("delete from message where _id=@id");

            SqlParameter[] pra = {
                               new SqlParameter("@id",SqlDbType.Int,4)
                               };
            pra[0].Value = mes.id;

            return Common.DbHelperSQL.ExecuteSql(sql.ToString(), pra);
        }
Esempio n. 15
0
        public override bool chatEvent(message m, chat c = null)
        {
            bool processed = false;
            if (c != null) //Needs to be done in a chat!
            {
                if (m.text_msg.StartsWith("/birthday_add"))
                {
                    TelegramAPI.GetReply(m.chatID, "Whose birthday do you want to add?", m.message_id, true);
                    processed = true;
                }
                else if (m.text_msg.StartsWith("/birthday_remove"))
                {
                    TelegramAPI.GetReply(m.chatID, "Whose birthday do you want to remove?", m.message_id, true);
                    processed = true;
                }
                else if (m.isReply && m.replyOrigMessage == "Whose birthday do you want to add?" && m.replyOrigUser == Roboto.Settings.botUserName)
                {
                    //reply to add word
                    TelegramAPI.GetReply(m.chatID, "What birthday does " + m.text_msg + " have? (DD-MON-YYYY format, e.g. 01-JAN-1900)", m.message_id, true);
                    processed = true;
                }

                else if (m.isReply && m.replyOrigMessage.StartsWith("What birthday does ") && m.replyOrigUser == Roboto.Settings.botUserName)
                {
                    string uname = m.replyOrigMessage.Substring(19);
                    uname = uname.Substring(0, uname.IndexOf(" have?"));
                    DateTime birthday;
                    bool success = DateTime.TryParse(m.text_msg, out birthday);
                    if (success)
                    {
                        mod_birthday_birthday data = new mod_birthday_birthday(uname, birthday);
                        addBirthday(data, c);
                    }
                    else
                    {
                        Console.WriteLine("Failed to add birthday");
                        TelegramAPI.SendMessage(m.chatID, "Failed to add birthday");
                    }
                    processed = true;
                }

                else if (m.isReply && m.replyOrigMessage == "Whose birthday do you want to remove?" && m.replyOrigUser == Roboto.Settings.botUserName)
                {

                    bool success = removeBirthday(m.text_msg, c);
                    TelegramAPI.SendMessage(m.chatID, "Removed birthday for " + m.text_msg + " " + (success ? "successfully" : "but fell on my ass"));
                    processed = true;
                }
            }
            return processed;
        }
        //this method gets a raw message with the prefs of user
        //and returns a message ready to send to server or null
        public message messageOpenDataReady(message m)
        {
            //Initialize
            emptyDropdown = false;
            //INPUT
            string county, month, year, accidentType;
            //OUTPUT
            string elCounty,dateMY,table;

            //GET INPUT
            county = m.getSCObject(0).getString("county");
            month = m.getSCObject(0).getString("month");
            year = m.getSCObject(0).getString("year");
            accidentType = m.getSCObject(0).getString("accidentType");

            //PREPARE OUTPUT
            elCounty = getCountyInGreek(county);
            dateMY = getMonth(month) + "-" + year;
            table = getAccidentType(accidentType);

            //Build a ReadyTOSend message
            message newMes = new message("opendata");
            scObject obj = new scObject("OpenDataObject");
            obj.addString("county", elCounty);
            obj.addString("dateMY", dateMY);
            obj.addString("table", table);

            newMes.addSCObject(obj);

            //return it
            if (!emptyDropdown)
            {
                if(!accidentType.Equals("Lethals"))
                {
                    int num;
                    if(month.Equals("Select month") || year.Equals("Select year") || !(int.TryParse(year, out num)))
                    {
                        return null;
                    }
                    else
                    {
                        return newMes;
                    }
                }
                return newMes;
            }
            else
                return null;
        }
Esempio n. 17
0
        public void PublishToAltSubscribedTest()
        {
            //arrange
            MessageCenter target = new MessageCenter();
            string res = null;
            target.Subscribe<string>(a => { res = a; });

            var msg = new message() { txt = "hi" };

            //act
            target.Publish(msg);

            //assert
            Assert.AreNotEqual(res, "hi");
        }
 public TendresseData MakeImageFromMessage(message image)
 {
     List<List<Vector3>> points = new List<List<Vector3>>();
     for (int i = 0; i < image.getNetObjectCount(); i++)
     {
         NetObject lineObj = image.getNetObject(i);
         List<Vector3> line = new List<Vector3>();
         for (int j = 0; j < lineObj.getFloatCount(); j+=2)
         {
             line.Add(new Vector3(lineObj.getFloat(j), lineObj.getFloat(j+1), 0));
         }
         points.Add(line);
     }
     return new TendresseData(points);;
 }
Esempio n. 19
0
    protected void Page_Load(object sender, EventArgs e)
    {
        int id = Convert.ToInt32(Request.QueryString["_id"]);
        message mes = new message();
        mes.id = id;

        BLLmessage bllmessage = new BLLmessage();
        MySqlDataReader sdr = bllmessage.readmessage(mes);
        if (sdr.Read())
        {
            Label1.Text = sdr["_title"].ToString();
            TextBox1.Text = sdr["_content"].ToString();
            Label3.Text = sdr["_posttime"].ToString();
        }
        sdr.Close();
    }
Esempio n. 20
0
 protected void Button1_Click(object sender, EventArgs e)
 {
     message mes = new message();
     mes.id = Convert.ToInt32(Request.QueryString["_id"]);
     mes.reply = TextBox2.Text;
     mes.state = 1;
     BLLmessage bllmessage = new BLLmessage();
     int result = bllmessage.reply(mes);
     if (result > 0)
     {
         Response.Write("<script>alert('回复留言成功');location.href='../message.aspx'</script>");
     }
     else
     {
         Response.Write("<script>alert('回复留言失败');</script>");
     }
 }
    public void HandleMessage(message mes)
    {
        //Debug.Log(mes.messageText);
        switch (mes.messageText)
        {
            /*--------------------------------------  Movement Update   -----------------------------------------*/
            case "startEvent":
                DateManager.instance.OnStartNewEvent(mes.getNetObject(0).getString(0), mes.getNetObject(0).getInt(0) == 0);
                break;
            case "receiveImage":
                GameManager.instance.Event_OnReceiveImage(MakeImageFromMessage(mes));
                break;
            case "receiveText":
                DateManager.instance.ExecuteDateEvent_OnReceiveText(mes.getNetObject(0).getString(0));
                break;

            case "receiveSound":
                Debug.Log(conversionTools.convertMessageToString(mes));
                GameManager.instance.Event_OnReveiceSound(mes);

                break;

            case "startMatch":
                GameManager.instance.Event_OnFindPartner(mes.getNetObject(0).getBool(0));
                break;

            case "startDate":
                DateManager.instance.OnStartNewDate(mes.getNetObject(0).getString(0),mes.getNetObject(0).getString(1),mes.getNetObject(0).getInt(0), mes.getNetObject(0).getInt(2));
                break;

            case "oponenName":
                DateManager.instance.OnGetOwnName(mes.getNetObject(0).getString(0));
                break;

            case "endDate":
                DateManager.instance.ExecuteDateEvent_EndPhase();
                break;

            /*----------------------------------------------------------------------------------------------------*/
            default:
                Debug.Log("The server has sent the message: " + mes.messageText);
                Debug.Log(conversionTools.convertMessageToString(mes));
                break;
        }
    }
Esempio n. 22
0
        public override bool chatEvent(message m, chat c = null)
        {
            bool processed = false;

            if (m.text_msg.StartsWith("/help"))
            {
                TelegramAPI.SendMessage(m.chatID, getAllMethodDescriptions());
                processed = true;
            }
            else if (m.text_msg.StartsWith("/save"))
            {
                Roboto.Settings.save();
                TelegramAPI.SendMessage(m.chatID, "Saved settings");
            }
            //TODO - start, stop listening to chat.

            return processed;
        }
Esempio n. 23
0
	public void parseOfficeStatus(message.MsgS2COfficeStatusACK msg)
	{
		_chapter_ids.Clear ();
		_officilMap.Clear ();
		foreach (int secion_id in msg.chapter_id) 
		{
			_chapter_ids.Add (secion_id);
		}

		if (_chapter_ids.Count != 0) 
		{
			message.MsgC2SOfficeMapReq MsgReq = new message.MsgC2SOfficeMapReq ();
			MsgReq.chapter_id = _chapter_ids [0];
			MsgReq.section_id = -1;
			global_instance.Instance._net_client.send (msg);
		}
		else
		{
			endOfficilMapLoad ();
		}
	}
Esempio n. 24
0
        public override bool chatEvent(message m, chat c = null)
        {
            bool processed = false;
            if (c != null)
            {
                mod_quote_data chatData = (mod_quote_data)c.getPluginData(typeof(mod_quote_data));

                if (m.text_msg.StartsWith("/quote_add"))
                {
                    TelegramAPI.GetExpectedReply(c.chatID, m.userID, "Who is the quote by? Or enter 'cancel'", true, typeof(mod_quote), "WHO", -1, true);
                    processed = true;
                }
                else if (m.text_msg.StartsWith("/quote_conv"))
                {
                    TelegramAPI.GetExpectedReply(c.chatID, m.userID, "Enter the first speaker's name, a \\, then the text (e.g. Bob\\I like Bees).\n\rOr enter 'cancel' to cancel", true, typeof(mod_quote), "WHO_M", -1, true);
                    processed = true;
                }

                else if (m.text_msg.StartsWith("/quote_config"))
                {
                    List<string> options = new List<string>();
                    options.Add("Set Duration");
                    options.Add("Toggle automatic quotes");
                    string keyboard = TelegramAPI.createKeyboard(options, 1);
                    TelegramAPI.GetExpectedReply(c.chatID, m.userID,
                        "Quotes are currently " + (chatData.autoQuoteEnabled == true? "enabled" : "disabled")
                        + " and set to announce every " + chatData.autoQuoteHours.ToString() + " hours"
                        , false, typeof(mod_quote), "CONFIG", m.message_id, true, keyboard);
                }
                else if (m.text_msg.StartsWith("/quote"))
                {
                    TelegramAPI.SendMessage(m.chatID, getQuote(c), true, m.message_id);
                    processed = true;
                }
            }

            //also accept forwarded messages

            return processed;
        }
    public message MakeMessageFromClip()
    {
        message sound = new message("sendSound");

        audioSource.clip = aud;
        float[] samples = new float[audioSource.clip.samples * audioSource.clip.channels];
        audioSource.clip.GetData(samples, 0);
        int cpt = 0;
        NetObject subSound = new NetObject("subSound");
        subSound.addInt("", samples.Length);

        for (int i = 0; i < samples.Length; i++) {
            if (cpt == 250) {
                sound.addNetObject(subSound);
                subSound = new NetObject("subSound");
                cpt = 0;
            }
            subSound.addFloat("", (Mathf.Floor(samples[i] * 1000) / 1000));
            cpt++;
        }
        return sound;
    }
Esempio n. 26
0
        public override bool chatEvent(message m, chat c = null)
        {
            bool processed = false;

            if (m.text_msg.StartsWith("/craft_add"))
            {
                TelegramAPI.GetExpectedReply(m.chatID, m.userID, "Enter the word to add", true, GetType(), "AddWord");
                processed = true;
            }
            else if (m.text_msg.StartsWith("/craft_remove"))
            {
                TelegramAPI.GetExpectedReply(m.chatID, m.userID, "Enter the word to remove", true, GetType(), "RemWord");
                processed = true;
            }
            else if (m.text_msg.StartsWith("/craft"))
            {
                TelegramAPI.SendMessage(m.chatID, craftWord());
                processed = true;
            }

            return processed;
        }
Esempio n. 27
0
        private testLog GetTestLogWithSoap()
        {
            var t = new testLog();
            var msgList = new List<message>();

            foreach (var file in this.Files.Where(IsSoap))
            {
                message m = new message();
                m.httpHeaders = new object[]
                                    {
                                        "POST /dummyUrl HTTP/1.1",
                                        new contentTypeHeader
                                            {
                                                parameter = new parameter[]
                                                                {
                                                                  new parameter()
                                                                      {
                                                                           key="charset",
                                                                           value="utf-8"
                                                                      }
                                                                }
                                            }
                                    };

                var x = new XmlDocument();
                x.LoadXml(File.ReadAllText(file));

                m.messageContents = new messageContents()
                                        {
                                            Any = x.DocumentElement,
                                        };
                msgList.Add(m);
            }

            t.messageLog = msgList.ToArray();

            return t;
        }
Esempio n. 28
0
        public override bool chatEvent(message m, chat c = null)
        {
            bool processed = false;

            if (c != null)
            {
                mod_steam_chat_data chatData = (mod_steam_chat_data)c.getPluginData(typeof(mod_steam_chat_data));


                if (m.text_msg.StartsWith("/steam_addplayer"))
                {
                    TelegramAPI.GetExpectedReply(c.chatID, m.userID
                                                 , "Enter the steamID of the player you want to add. /steam_help to find out how to get this."
                                                 , false
                                                 , typeof(mod_steam)
                                                 , "ADDPLAYER", m.userFullName, m.message_id, true);
                    processed = true;
                }
                else if (m.text_msg.StartsWith("/steam_help"))
                {
                    TelegramAPI.SendMessage(m.chatID, "You are looking for an ID from the Steam Community site, try http://steamcommunity.com/ and find your profile. You should have something like http://steamcommunity.com/profiles/01234567890132456 . Take this number on the end of the URL."
                                            , m.userFullName, false, m.message_id);
                    processed = true;
                }
                else if (m.text_msg.StartsWith("/steam_check"))
                {
                    checkChat(c);

                    processed = true;
                }
                else if (m.text_msg.StartsWith("/steam_stats"))
                {
                    string announce = "Currently watching achievements from the following players: " + "\n\r";
                    foreach (mod_steam_player p in chatData.players)
                    {
                        announce += "*" + p.playerName + "* - " + p.chievs.Count().ToString() + " known achievements" + "\n\r";
                    }
                    int achievements = 0;
                    foreach (mod_steam_game g in localData.games)
                    {
                        achievements += g.chievs.Count();
                    }
                    announce += "Tracking " + achievements.ToString() + " achievements across " + localData.games.Count().ToString() + " games";

                    TelegramAPI.SendMessage(m.chatID, announce, m.userFullName, true, m.message_id);
                }


                else if (m.text_msg.StartsWith("/steam_remove"))
                {
                    List <string> playerKeyboard = new List <string>();
                    foreach (mod_steam_player p in chatData.players)
                    {
                        playerKeyboard.Add(p.playerName);
                    }
                    playerKeyboard.Add("Cancel");
                    string playerKeyboardText = TelegramAPI.createKeyboard(playerKeyboard, 2);
                    TelegramAPI.GetExpectedReply(c.chatID, m.userID, "Which player do you want to stop tracking?", false, typeof(mod_steam), "REMOVEPLAYER", m.userFullName, m.message_id, true, playerKeyboardText);
                }
            }
            return(processed);
        }
        new TaskCanceledException(message ?? s_cancellationMessage, innerException, cancellationToken); // TCE for compatibility with other handlers that use TaskCompletionSource.TrySetCanceled()
#else
        new TaskCanceledException(message ?? s_cancellationMessage, innerException);
Esempio n. 30
0
 new DotvvmCompilationException(message, resolvedBinding.DothtmlNode.Tokens) :
Esempio n. 31
0
 SetResult(message, keysResult);
 // POST api/<controller>
 public void Post([FromBody] message message)
 {
     db.messages.Add(message);
     db.SaveChanges();
 }
Esempio n. 33
0
 public int reply(message mes)
 {
     DALmessageDAL DALmessageDAL = new DALmessageDAL();
     return DALmessageDAL.reply(mes);
 }
Esempio n. 34
0
        public override bool chatEvent(message m, chat c = null)
        {
            bool processed = false;

            if (m.text_msg.StartsWith("/help") && c != null && c.muted == false)
            {
                mod_standard_chatdata chatData = c.getPluginData <mod_standard_chatdata>();
                string openingMessage          = "This is chat " + (c.chatTitle == null ? "" : c.chatTitle) + " (" + c.chatID + "). " + "\n\r";
                if (chatData.quietHoursStartTime != TimeSpan.MinValue && chatData.quietHoursEndTime != TimeSpan.MinValue)
                {
                    openingMessage += "Quiet time set between " + chatData.quietHoursStartTime.ToString("c") + " and " + chatData.quietHoursEndTime.ToString("c") + ". \n\r";
                }

                TelegramAPI.SendMessage(m.chatID, openingMessage + getAllMethodDescriptions());
                processed = true;
            }
            else if (m.text_msg.StartsWith("/save"))
            {
                Roboto.Settings.save();
                TelegramAPI.SendMessage(m.chatID, "Saved settings");
                processed = true;
            }
            else if (m.text_msg.StartsWith("/stop") && c != null)
            {
                c.muted = true;
                TelegramAPI.SendMessage(m.chatID, "I am now ignoring all messages in this chat until I get a /start command. ");
                //TODO - make sure we abandon any games

                processed = true;
            }
            else if (m.text_msg.StartsWith("/start") && c != null && c.muted == true)
            {
                c.muted = false;
                TelegramAPI.SendMessage(m.chatID, "I am listening for messages again. Type /help for a list of commands." + "\n\r" + getAllWelcomeDescriptions());
                processed = true;
            }
            else if (m.text_msg.StartsWith("/start"))
            {
                //a default /start message where we arent on pause. Might be in group or private chat.
                TelegramAPI.SendMessage(m.chatID, getAllWelcomeDescriptions());
            }


            else if (m.text_msg.StartsWith("/background"))
            {
                //kick off the background loop.
                Roboto.Settings.backgroundProcessing(true);
            }

            else if (m.text_msg.StartsWith("/setquiethours") && c != null)
            {
                TelegramAPI.GetExpectedReply(m.chatID, m.userID, "Enter the start time for the quiet hours, cancel, or disable. This should be in the format hh:mm:ss (e.g. 23:00:00)", true, this.GetType(), "setQuietHours");
                processed = true;
            }

            else if (m.text_msg.StartsWith("/stats"))
            {
                TimeSpan uptime = DateTime.Now.Subtract(Roboto.startTime);

                String statstxt = "I is *@" + Roboto.Settings.botUserName + "*" + "\n\r" +
                                  "Uptime: " + uptime.Days.ToString() + " days, " + uptime.Hours.ToString() + " hours and " + uptime.Minutes.ToString() + " minutes." + "\n\r" +
                                  "I currently know about " + Roboto.Settings.chatData.Count().ToString() + " chats." + "\n\r" +
                                  "The following plugins are currently loaded:" + "\n\r";

                foreach (RobotoModuleTemplate plugin in settings.plugins)
                {
                    statstxt += "*" + plugin.GetType().ToString() + "*" + "\n\r";
                    statstxt += plugin.getStats() + "\n\r";
                }

                TelegramAPI.SendMessage(m.chatID, statstxt, m.userFullName, true);
                processed = true;
            }
            else if (m.text_msg.StartsWith("/addadmin") && c != null)
            {
                //check if we have privs. This will send a fail if not.
                if (c.checkAdminPrivs(m.userID, c.chatID))
                {
                    //if there is no admin, add player
                    if (!c.chatHasAdmins())
                    {
                        bool added = c.addAdmin(m.userID, m.userID);
                        if (added)
                        {
                            TelegramAPI.SendMessage(m.chatID, "Added " + m.userFullName + " as admin.");
                        }
                        else
                        {
                            TelegramAPI.SendMessage(m.chatID, "Something went wrong! ");
                            log("Error adding user as an admin", logging.loglevel.high);
                        }
                    }
                    else
                    {
                        //create a keyboard with the recent chat members
                        List <string> members = new List <string>();
                        foreach (chatPresence p in c.getRecentChatUsers())
                        {
                            members.Add(p.ToString());
                        }
                        //send keyboard to player requesting admin.
                        TelegramAPI.GetExpectedReply(m.chatID, m.userID, "Who do you want to add as admin?", true, typeof(mod_standard), "ADDADMIN", m.userFullName, -1, false, TelegramAPI.createKeyboard(members, 2));
                    }
                }
                else
                {
                    log("User tried to add admin, but insufficient privs", logging.loglevel.high);
                }
                processed = true;
            }
            else if (m.text_msg.StartsWith("/removeadmin") && c != null)
            {
                //check if we have privs. This will send a fail if not.
                if (c.checkAdminPrivs(m.userID, c.chatID))
                {
                    //if there is no admin, add player
                    if (!c.chatHasAdmins())
                    {
                        TelegramAPI.SendMessage(m.chatID, "Group currently doesnt have any admins!");
                    }
                    else
                    {
                        //create a keyboard with the recent chat members
                        List <string> members = new List <string>();
                        foreach (long userID in c.chatAdmins)
                        {
                            members.Add(userID.ToString());
                        }
                        //send keyboard to player requesting admin.
                        TelegramAPI.GetExpectedReply(m.chatID, m.userID, "Who do you want to remove as admin?", true, typeof(mod_standard), "REMOVEADMIN", m.userFullName, -1, false, TelegramAPI.createKeyboard(members, 2));
                    }
                }
                else
                {
                    log("User tried to remove admin, but insufficient privs", logging.loglevel.high);
                }
                processed = true;
            }



            else if (m.text_msg.StartsWith("/statgraph"))
            {
                string[] argsList = m.text_msg.Split(" ".ToCharArray(), 2);
                Stream   image;
                //Work out args and get our image
                if (argsList.Length > 1)
                {
                    string args = argsList[1];
                    image = Roboto.Settings.stats.generateImage(argsList[1].Split("|"[0]).ToList());
                }
                else
                {
                    image = Roboto.Settings.stats.generateImage(new List <string>());
                }

                //Sending image...
                if (image != null)
                {
                    TelegramAPI.SendPhoto(m.chatID, "Stats", image, "StatsGraph.jpg", "application/octet-stream", m.message_id, false);
                }
                else
                {
                    TelegramAPI.SendMessage(m.chatID, "No statistics were found that matched your input, sorry!");
                }
                processed = true;

                //TODO - keyboard for stats?
            }

            return(processed);
        }
Esempio n. 35
0
        public static List <latestUpdates> ObtainLatestMessages()
        {
            //Instantiate variables
            var umbracoHelper = new UmbracoHelper(UmbracoContext.Current);
            List <latestUpdates> lstLatestUpdates = new List <latestUpdates>();


            try
            {
                //Get all messages
                BaseSearchProvider mySearcher = ExamineManager.Instance.SearchProviderCollection[Common.searchProviders.MessagesSearcher];
                ISearchCriteria    criteria   = mySearcher.CreateSearchCriteria(IndexTypes.Content);
                IBooleanOperation  query      = criteria.Field(Common.NodeProperties.indexType, Common.NodeProperties.content); //gets all items
                query.And().OrderByDescending(Common.NodeProperties.publishDate);
                query.And().OrderBy(Common.NodeProperties.nodeName);
                query.And().OrderBy(Common.miscellaneous.Path);
                ISearchResults isResults = mySearcher.Search(query.Compile());


                if (isResults.Any())
                {
                    //Instantiate variables
                    DateTime msgDate = new DateTime(1900, 1, 1);
                    //DateTime prevDate = new DateTime(1900, 1, 1);
                    latestUpdates     latestUpdate = new latestUpdates();
                    visionary         visionary    = new visionary();
                    message           message;
                    IPublishedContent ipMsg;
                    IPublishedContent ipVisionary;
                    Boolean           isFirst = true;


                    //Get top 'n' results and determine link structure
                    foreach (SearchResult srResult in isResults)
                    {
                        //Obtain message's node
                        ipMsg = umbracoHelper.TypedContent(Convert.ToInt32(srResult.Id));
                        if (ipMsg != null)
                        {
                            if (isFirst)
                            {
                                //Obtain date of latest message
                                msgDate = ipMsg.GetPropertyValue <DateTime>(Common.NodeProperties.publishDate);
                                isFirst = false;
                            }
                            else
                            {
                                //Exit loop if a different publish date exists
                                if (msgDate != ipMsg.GetPropertyValue <DateTime>(Common.NodeProperties.publishDate))
                                {
                                    break;
                                }
                            }


                            //Create a new date for messages
                            //if (msgDate != prevDate)
                            //{
                            //    //Update current date
                            //    prevDate = msgDate;

                            //Create new instances for updates and add to list of all updates.
                            latestUpdate = new latestUpdates();
                            latestUpdate.datePublished = msgDate;
                            lstLatestUpdates.Add(latestUpdate);

                            //Reset the visionary class on every new date change.
                            visionary = new visionary();
                            //}

                            //Obtain current visionary or webmaster
                            if (ipMsg.AncestorsOrSelf().FirstOrDefault(x => x.DocumentTypeAlias == Common.docType.Visionary) != null)
                            {
                                if (visionary.id != ipMsg.AncestorsOrSelf().FirstOrDefault(x => x.DocumentTypeAlias == Common.docType.Visionary).Id)
                                {
                                    //Obtain visionary node
                                    ipVisionary = ipMsg.AncestorsOrSelf().FirstOrDefault(x => x.DocumentTypeAlias == Common.docType.Visionary);

                                    //Create new visionary class and add to latest update class
                                    visionary      = new visionary();
                                    visionary.id   = ipVisionary.Id;
                                    visionary.name = ipVisionary.Name;
                                    visionary.url  = ipVisionary.UrlAbsolute();
                                    latestUpdate.lstVisionaries.Add(visionary);
                                }
                            }
                            else if (ipMsg.AncestorsOrSelf().FirstOrDefault(x => x.DocumentTypeAlias == Common.docType.WebmasterMessageList) != null)
                            {
                                if (visionary.id != ipMsg.AncestorsOrSelf().FirstOrDefault(x => x.DocumentTypeAlias == Common.docType.WebmasterMessageList).Id)
                                {
                                    //Obtain visionary node
                                    ipVisionary = ipMsg.AncestorsOrSelf().FirstOrDefault(x => x.DocumentTypeAlias == Common.docType.WebmasterMessageList);

                                    //Create new visionary class and add to latest update class
                                    visionary      = new visionary();
                                    visionary.id   = ipVisionary.Id;
                                    visionary.name = ipVisionary.Name;
                                    visionary.url  = ipVisionary.UrlAbsolute();
                                    latestUpdate.lstVisionaries.Add(visionary);
                                }
                            }

                            //Create new message and add to existing visionary class.
                            message       = new message();
                            message.id    = ipMsg.Id;
                            message.title = ipMsg.Name;
                            message.url   = ipMsg.UrlAbsolute();
                            visionary.lstMessages.Add(message);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                //StringBuilder sb = new StringBuilder();
                //sb.AppendLine(@"MessageController.cs : RenderLatestMessages()");
                //sb.AppendLine("model:" + Newtonsoft.Json.JsonConvert.SerializeObject(lstLatestUpdates));
                //Common.saveErrorMessage(ex.ToString(), sb.ToString());


                //ModelState.AddModelError("", "*An error occured while creating the latest message list.");
                //return CurrentUmbracoPage();
            }


            //
            return(lstLatestUpdates);
        }
     : super(message, innerException)
 {
 }
Esempio n. 37
0
 { Timestamp.Descriptor.FullName, (parser, message, tokenizer) => MergeTimestamp(message, tokenizer.Next()) },
Esempio n. 38
0
        public ActionResult AdminPage()
        {
            using (DisDBContext db = new DisDBContext())
            {
                BaseModel model = new BaseModel();

                #region Current User
                var newUser = User as CustomPrincipal;

                if (newUser != null)
                {
                    user _userAdmin = db.Users.FirstOrDefault(m => m.id == newUser.UserId && m.email == newUser.UserEmail);
                    if (_userAdmin.position == 0)
                    {
                        #endregion
                        #region User Layout
                        ViewBag.Email = _userAdmin.email;
                        #endregion

                        #region Chat

                        #region Chat models
                        List <user>      user_list     = new List <user>();
                        List <ChatModel> conversations = new List <ChatModel>();
                        ChatModel        cm            = new ChatModel();
                        #endregion

                        user_list = db.Users.Where(p => p.email != _userAdmin.email).ToList();
                        List <conversation> conver = db.Conversations.Where(p => p.user1 == newUser.UserEmail || p.user2 == newUser.UserEmail).ToList();
                        foreach (var c in conver)
                        {
                            string other = (c.user1 == newUser.UserEmail) ? c.user2 : c.user1;
                            var    user  = db.Users.First(p => p.email == other);
                            user_list.Remove(user);

                            DateTime lastConver = db.Messages.Where(p => p.conversation_id == c.id).Max(p => p.date);
                            message  msg        = db.Messages.FirstOrDefault(p => p.conversation_id == c.id && p.date == lastConver);
                            cm.fname     = user.first_name;
                            cm.lname     = user.last_name;
                            cm.date      = msg.date.ToShortDateString();
                            cm.msg       = msg.msg;
                            cm.otherUser = other;
                            conversations.Add(cm);
                        }
                        ViewBag.UserList     = user_list;
                        ViewBag.Conversation = conversations;
                        #endregion

                        #region Company
                        foreach (company Companies in db.Companies.OrderByDescending(o => o.id))
                        {
                            if (Companies == null)
                            {
                                break;
                            }
                            model.Companies.Add(Companies);
                        }
                        #endregion

                        #region User Profile
                        model.User = db.Users.FirstOrDefault(m => m.id == _userAdmin.id);
                        #endregion

                        #region Documents flow

                        string userAdminId           = _userAdmin.id.ToString();
                        string userAdminCompanyID    = _userAdmin.company_id.ToString();
                        string userAdminDepartmentID = _userAdmin.department_id.ToString();


                        #region _userAdmin sent documents
                        foreach (document DocumentsHistory in db.Documents.Where(p => p.owner_id == userAdminId).OrderByDescending(o => o.id))
                        {
                            if (DocumentsHistory == null)
                            {
                                break;
                            }
                            model.DocumentsHistory.Add(DocumentsHistory);
                        }
                        #endregion

                        #region _userAdmin inbox documents
                        foreach (document DocumentsInbox in db.Documents.Where(p => ((p.send_id == "user_" + userAdminId || p.send_id == "company_" + userAdminCompanyID || p.send_id == "department_" + userAdminDepartmentID) && p.owner_id != userAdminId)).OrderByDescending(o => o.id))
                        {
                            if (DocumentsInbox == null)
                            {
                                break;
                            }
                            model.DocumentsInbox.Add(DocumentsInbox);
                        }
                        #endregion


                        #endregion

                        return(View(model));
                    }
                }
            }

            return(RedirectToAction("AccessDenied", "Home"));
        }
 public Package(MessageTypeRequest req)
 {
     Message = new message();
     Message.requestMessage = req;
 }
 public Package(MessageTypeResponse resp)
 {
     Message = new message();
     Message.responseMessage = resp;
 }
Esempio n. 41
0
 public void Post([FromBody] message msg)
 {
     ms.Add(msg);
     Console.WriteLine($"{msg.username}:  {msg.text} ({ms.messages.Count})");
 }
Esempio n. 42
0
 public void Post([FromBody] message msg)
 {
     ms.Add(msg.username, msg.text);
 }
Esempio n. 43
0
        public override bool replyReceived(ExpectedReply e, message m, bool messageFailed = false)
        {
            chat c = Roboto.Settings.getChat(e.chatID);
            mod_standard_chatdata chatData = c.getPluginData <mod_standard_chatdata>();

            if (e.messageData == "setQuietHours")
            {
                if (m.text_msg.ToLower() == "cancel")
                {
                    //dont need to do anything else
                }
                else if (m.text_msg.ToLower() == "disable")
                {
                    chatData.quietHoursEndTime   = TimeSpan.MinValue;
                    chatData.quietHoursStartTime = TimeSpan.MinValue;
                    TelegramAPI.SendMessage(e.chatID, "Quiet hours have been disabled");
                }
                else
                {
                    //try parse it
                    TimeSpan s;
                    bool     success = TimeSpan.TryParse(m.text_msg, out s);
                    if (success && s > TimeSpan.Zero && s.TotalDays < 1)
                    {
                        chatData.quietHoursStartTime = s;
                        TelegramAPI.GetExpectedReply(e.chatID, m.userID, "Enter the wake time for the quiet hours, cancel, or disable. This should be in the format hh:mm:ss (e.g. 23:00:00)", true, this.GetType(), "setWakeHours", m.userFullName, -1, false, "", false, false, true);
                    }
                    else
                    {
                        TelegramAPI.GetExpectedReply(e.chatID, m.userID, "Invalid value. Enter the start time for the quiet hours, cancel, or disable. This should be in the format hh:mm:ss (e.g. 23:00:00)", true, this.GetType(), "setQuietHours", m.userFullName, -1, false, "", false, false, true);
                    }
                }
                return(true);
            }
            else if (e.messageData == "setWakeHours")
            {
                if (m.text_msg.ToLower() == "cancel")
                {
                    //dont need to do anything else
                }
                else if (m.text_msg.ToLower() == "disable")
                {
                    chatData.quietHoursEndTime   = TimeSpan.MinValue;
                    chatData.quietHoursStartTime = TimeSpan.MinValue;
                    TelegramAPI.SendMessage(e.chatID, "Quiet hours have been disabled");
                }
                else
                {
                    //try parse it
                    TimeSpan s;
                    bool     success = TimeSpan.TryParse(m.text_msg, out s);
                    if (success && s > TimeSpan.Zero && s.TotalDays < 1)
                    {
                        chatData.quietHoursEndTime = s;
                        TelegramAPI.SendMessage(e.chatID, "Quiet time set from " + chatData.quietHoursStartTime.ToString("c") + " to " + chatData.quietHoursEndTime.ToString("c"));
                    }
                    else
                    {
                        TelegramAPI.GetExpectedReply(e.chatID, m.userID, "Invalid value. Enter the start time for the quiet hours, cancel, or disable. This should be in the format hh:mm:ss (e.g. 23:00:00)", true, this.GetType(), "setQuietHours", m.userFullName, -1, false, "", false, false, true);
                    }
                }
                return(true);
            }
            else if (e.messageData == "ADDADMIN")
            {
                //try match against out presence list to get the userID
                List <chatPresence> members = c.getRecentChatUsers().Where(x => x.ToString() == m.text_msg).ToList();
                if (members.Count > 0)
                {
                    bool success = c.addAdmin(members[0].userID, m.userID);
                    TelegramAPI.SendMessage(m.chatID, success ? "Successfully added admin" : "Failed to add admin");
                }
                else
                {
                    TelegramAPI.SendMessage(m.chatID, "Failed to add admin");
                }
                return(true);
            }
            else if (e.messageData == "REMOVEADMIN")
            {
                //try match against out presence list to get the userID
                long playerID = -1;
                bool success  = long.TryParse(m.text_msg, out playerID);
                if (success)
                {
                    success = c.removeAdmin(playerID, m.userID);
                }

                TelegramAPI.SendMessage(m.chatID, success ? "Successfully removed admin" : "Failed to remove admin");
                return(true);
            }

            return(false);
        }
Esempio n. 44
0
 private void Awake()
 {
     instance = this;
 }
Esempio n. 45
0
        public static LatestUpdateList ObtainAllMessages(int pageNo = 1)
        {
            //Instantiate variables
            var umbracoHelper = new UmbracoHelper(UmbracoContext.Current);
            LatestUpdateList lstLatestUpdates = new LatestUpdateList();


            //try
            //{
            //Get all ...
            BaseSearchProvider mySearcher = ExamineManager.Instance.SearchProviderCollection[Common.searchProviders.MessagesSearcher];
            ISearchCriteria    criteria   = mySearcher.CreateSearchCriteria(IndexTypes.Content);
            IBooleanOperation  query      = criteria.Field(Common.NodeProperties.indexType, Common.NodeProperties.content); //gets all items

            query.And().OrderByDescending(Common.NodeProperties.publishDate);
            query.And().OrderBy(Common.NodeProperties.nodeName);
            query.And().OrderBy(Common.miscellaneous.Path);
            ISearchResults isResults = mySearcher.Search(query.Compile());

            if (isResults.Any())
            {
                //Instantiate variables
                DateTime          msgDate      = new DateTime(1900, 1, 1);
                DateTime          prevDate     = new DateTime(1900, 1, 1);
                latestUpdates     latestUpdate = new latestUpdates();
                visionary         visionary    = new visionary();
                message           message;
                IPublishedContent ipMsg;
                IPublishedContent ipVisionary;



                //Get item counts and total experiences.
                lstLatestUpdates.Pagination.itemsPerPage = 20;
                lstLatestUpdates.Pagination.totalItems   = isResults.Count();


                //Determine how many pages/items to skip and take, as well as the total page count for the search result.
                if (lstLatestUpdates.Pagination.totalItems > lstLatestUpdates.Pagination.itemsPerPage)
                {
                    lstLatestUpdates.Pagination.totalPages = (int)Math.Ceiling((double)lstLatestUpdates.Pagination.totalItems / (double)lstLatestUpdates.Pagination.itemsPerPage);
                }
                else
                {
                    lstLatestUpdates.Pagination.itemsPerPage = lstLatestUpdates.Pagination.totalItems;
                    lstLatestUpdates.Pagination.totalPages   = 1;
                }


                //Determine current page number
                if (pageNo <= 0 || pageNo > lstLatestUpdates.Pagination.totalPages)
                {
                    pageNo = 1;
                }
                lstLatestUpdates.Pagination.pageNo = pageNo;


                //Determine how many pages/items to skip
                if (lstLatestUpdates.Pagination.totalItems > lstLatestUpdates.Pagination.itemsPerPage)
                {
                    lstLatestUpdates.Pagination.itemsToSkip = lstLatestUpdates.Pagination.itemsPerPage * (pageNo - 1);
                }



                //Get top 'n' results and determine link structure
                //foreach (SearchResult srResult in isResults.Take(30))
                foreach (SearchResult srResult in isResults.Skip(lstLatestUpdates.Pagination.itemsToSkip).Take(lstLatestUpdates.Pagination.itemsPerPage))
                {
                    //Obtain message's node
                    ipMsg = umbracoHelper.TypedContent(Convert.ToInt32(srResult.Id));
                    if (ipMsg != null)
                    {
                        //Obtain date of message
                        msgDate = ipMsg.GetPropertyValue <DateTime>(Common.NodeProperties.publishDate);

                        //Create a new date for messages
                        if (msgDate != prevDate)
                        {
                            //Update current date
                            prevDate = msgDate;

                            //Create new instances for updates and add to list of all updates.
                            latestUpdate = new latestUpdates();
                            latestUpdate.datePublished = msgDate;
                            lstLatestUpdates.LstLatestUpdates.Add(latestUpdate);

                            //Reset the visionary class on every new date change.
                            visionary = new visionary();
                        }

                        //Obtain current visionary or webmaster
                        if (ipMsg.AncestorsOrSelf().FirstOrDefault(x => x.DocumentTypeAlias == Common.docType.Visionary) != null)
                        {
                            if (visionary.id != ipMsg.AncestorsOrSelf().FirstOrDefault(x => x.DocumentTypeAlias == Common.docType.Visionary).Id)
                            {
                                //Obtain visionary node
                                ipVisionary = ipMsg.AncestorsOrSelf().FirstOrDefault(x => x.DocumentTypeAlias == Common.docType.Visionary);

                                //Create new visionary class and add to latest update class
                                visionary      = new visionary();
                                visionary.id   = ipVisionary.Id;
                                visionary.name = ipVisionary.Name;
                                visionary.url  = ipVisionary.Url;
                                latestUpdate.lstVisionaries.Add(visionary);
                            }
                        }
                        else if (ipMsg.AncestorsOrSelf().FirstOrDefault(x => x.DocumentTypeAlias == Common.docType.WebmasterMessageList) != null)
                        {
                            if (visionary.id != ipMsg.AncestorsOrSelf().FirstOrDefault(x => x.DocumentTypeAlias == Common.docType.WebmasterMessageList).Id)
                            {
                                //Obtain visionary node
                                ipVisionary = ipMsg.AncestorsOrSelf().FirstOrDefault(x => x.DocumentTypeAlias == Common.docType.WebmasterMessageList);

                                //Create new visionary class and add to latest update class
                                visionary      = new visionary();
                                visionary.id   = ipVisionary.Id;
                                visionary.name = ipVisionary.Name;
                                visionary.url  = ipVisionary.Url;
                                latestUpdate.lstVisionaries.Add(visionary);
                            }
                        }

                        //Create new message and add to existing visionary class.
                        message       = new message();
                        message.id    = ipMsg.Id;
                        message.title = ipMsg.Name;
                        message.url   = ipMsg.Url;
                        visionary.lstMessages.Add(message);
                    }
                }
            }


            //}
            //catch (Exception ex)
            //{
            //    //StringBuilder sb = new StringBuilder();
            //    //sb.AppendLine(@"MessageController.cs : RenderLatestMessages()");
            //    //sb.AppendLine("model:" + Newtonsoft.Json.JsonConvert.SerializeObject(lstLatestUpdates));
            //    //Common.SaveErrorMessage(ex, sb, typeof(MessageController));


            //    //ModelState.AddModelError("", "*An error occured while creating the latest message list.");
            //    //return CurrentUmbracoPage();
            //}


            //Return data to partialview
            return(lstLatestUpdates);
        }
 => Encode(message as PortInputFormatSetupSingleMessage ?? throw new ArgumentException("message is null or not PortInputFormatSetupSingleMessage", nameof(message)), data);
Esempio n. 47
0
 return(HasMatchingCommand(message, _settings.Aliases));
 _ => EnsureSuccessStatusCode(message, empty)
Esempio n. 49
0
 => await ReplyAsync(message, allowedMentions : ping?null : AllowedMentions.None, messageReference : new(Context.Message.Id));
Esempio n. 50
0
 _ => base.ResolveId(message, context)
Esempio n. 51
0
        public string sendEmail([FromBody] message message)
        {
            Guide checkGuide = new Guide();

            return(checkGuide.SendEmail(message));
        }
Esempio n. 52
0
 SetResult(message, clients);
 => Encode(message as PortModeInformationRequestMessage ?? throw new ArgumentException("No message provided", nameof(message)), data);
        public PartialViewResult AddedMessages()
        {
            user user = (user)Session[ECGlobalConstants.CurrentUserMarcker];
            //      if (user == null || user.id == 0 || user.role_id == 4 || user.role_id == 5 || user.role_id == 6 || user.role_id == 7)
            //           return RedirectToAction("Index", "Account");
            int sender_id = Convert.ToInt16(Request["sender_id"]);

            if (user.id != sender_id)
            {
                // security issue
                sender_id = user.id;
            }

            int report_id = Convert.ToInt16(Request["report_id"]);
            // check if sender has access to report
            int    reporter_access = Convert.ToInt16(Request["reporter_access"]);
            string body_tx         = (string)(Request["body_tx"]);

            message _message = new message();

            _message.created_dt = DateTime.Now;
            _message.ip_ds      = "";
            _message.subject_ds = "";

            _message.body_tx         = body_tx;
            _message.report_id       = report_id;
            _message.reporter_access = reporter_access;
            _message.sender_id       = sender_id;


            db.message.Add(_message);
            try
            {
                db.SaveChanges();
                glb.UpdateReportLog(_message.sender_id, 7, _message.report_id, "", null, "");

                // send emails to Case Admin

                #region Email to Case Admin
                ReportModel rm = new ReportModel(_message.report_id);

                foreach (user _user in rm.MediatorsWhoHasAccessToReport())
                {
                    if ((_user.email.Trim().Length > 0) && m_EmailHelper.IsValidEmail(_user.email.Trim()))
                    {
                        List <string> to  = new List <string>();
                        List <string> cc  = new List <string>();
                        List <string> bcc = new List <string>();

                        to.Add(_user.email.Trim());
                        ///     bcc.Add("*****@*****.**");

                        EC.Business.Actions.Email.EmailManagement em = new EC.Business.Actions.Email.EmailManagement();
                        EC.Business.Actions.Email.EmailBody       eb = new EC.Business.Actions.Email.EmailBody(1, 1, Request.Url.AbsoluteUri.ToLower());
                        eb.NewMessage(_user.first_nm, _user.last_nm, rm._report.display_name);
                        string body = eb.Body;
                        ///////         em.Send(to, cc, App_LocalResources.GlobalRes.Email_Title_NewMessage, body, true);
                    }
                }


                #endregion
            }
            catch (Exception ex)
            {
                logger.Error(ex.ToString());
                ///// return or log error??
            }

            CaseMessagesViewModel cmvm = new CaseMessagesViewModel().BindMessageToViewMessage(_message, sender_id);
            PartialViewResult     pvr  = PartialView("~/Views/Shared/Helpers/_SingleMessage.cshtml", cmvm);
            return(pvr);
        }
Esempio n. 55
0
 public MySqlDataReader readmessage(message mes)
 {
     DALmessageDAL DALmessageDAL = new DALmessageDAL();
     return DALmessageDAL.readmessage(mes);
 }
Esempio n. 56
0
 var response = await SendAsyncInternal(method, uri, message, token);
Esempio n. 57
0
 public int update(message mes)
 {
     DALmessageDAL DALmessageDAL = new DALmessageDAL();
     return DALmessageDAL.update(mes);
 }
Esempio n. 58
0
 => Encode(message as PortInputFormatSingleMessage, data);
Esempio n. 59
0
        public ActionResult ChatIn(string chatMessage, string chatId)
        {
            using (DisDBContext db = new DisDBContext())
            {
                int chatid  = Convert.ToInt32(chatId);
                var newUser = User as CustomPrincipal;
                if (!string.IsNullOrEmpty(chatMessage))
                {
                    message m = new message
                    {
                        conversation_id = chatid,
                        msg             = chatMessage,
                        date            = DateTime.Now,
                        sender          = newUser.UserEmail,
                        msg_type        = "msg"
                    };

                    db.Messages.Add(m);
                    db.SaveChanges();
                }



                if (Request.Files.Count > 0)
                {
                    //  Get all files from Request object
                    HttpFileCollectionBase files = Request.Files;
                    for (int i = 0; i < files.Count; i++)
                    {
                        //string path = AppDomain.CurrentDomain.BaseDirectory + "Uploads/";
                        //string filename = Path.GetFileName(Request.Files[i].FileName);

                        HttpPostedFileBase file = files[i];
                        string             fname;

                        // Checking for Internet Explorer
                        if (Request.Browser.Browser.ToUpper() == "IE" || Request.Browser.Browser.ToUpper() == "INTERNETEXPLORER")
                        {
                            string[] testfiles = file.FileName.Split(new char[] { '\\' });
                            fname = testfiles[testfiles.Length - 1];
                        }
                        else
                        {
                            fname = file.FileName;
                        }


                        var path = Server.MapPath("~/Files/Message/" + chatId + "/");
                        Directory.CreateDirectory(path);
                        //Сохраняем файл на сервере
                        string filePath = "/Files/Message/" + chatId + "/" + fname;
                        file.SaveAs(Server.MapPath("~/Files/Message/" + chatId + "/" + fname));

                        //Сохраняем данные о рисунках в базе данных
                        db.Messages.Add(new message
                        {
                            conversation_id = chatid,
                            msg             = chatMessage,
                            date            = DateTime.Now,
                            sender          = newUser.UserEmail,
                            msg_type        = "pic"
                        });
                        db.SaveChanges();
                    }

                    // Returns message that successfully uploaded
                }
                var msg = db.Messages.Where(m => m.conversation_id == chatid).ToList().OrderBy(m => m.date);

                return(View());
            }
        }
Esempio n. 60
0
        public void handleClientData(Socket cSock, message incObject)
        {
            Stopwatch Sw = new Stopwatch();

            switch (incObject.messageText)
            {
            case "home":
                message home = new message("homeResponse");
                cSock.Shutdown(SocketShutdown.Receive);
                if (true)
                {
                    scObject data = new scObject("data");
                    data.addBool("response", true);
                    home.addSCObject(data);
                    sendClientMessage(cSock, home);
                }
                break;

            case "close":
                message close = new message("closeResponse");
                cSock.Shutdown(SocketShutdown.Receive);
                if (true)
                {
                    scObject data = new scObject("data");
                    data.addBool("response", true);
                    close.addSCObject(data);
                    sendClientMessage(cSock, close);
                }
                break;

            case "login":
                //output.outToScreen("serverTCP - login 정상 실행.");
                message login = new message("loginResponse");
                if (playerTools.checkLogin(incObject.getSCObject(0).getString("account"), incObject.getSCObject(0).getString("password")))
                {
                    scObject data = new scObject("data");
                    data.addBool("response", true);
                    login.addSCObject(data);
                    output.outToScreen("loginScript - loginResponse에 True 값 전달.");
                }

                else
                {
                    scObject data = new scObject("data");
                    data.addBool("response", false);
                    login.addSCObject(data);
                    output.outToScreen("loginScript - loginResponse에 False 값 전달.");
                }
                sendClientMessage(cSock, login);
                break;

            case "register":
                //output.outToScreen("serverTCP - register 정상 실행.");
                message register = new message("registerResponse");
                if (playerTools.createregister(incObject.getSCObject(0).getString("account"), incObject.getSCObject(0).getString("password")))
                {
                    scObject data = new scObject("data");
                    data.addBool("response", true);
                    register.addSCObject(data);
                    output.outToScreen("loginScript - registerResponse에 True 값 전달.");
                }
                else
                {
                    scObject data = new scObject("data");
                    data.addBool("response", false);
                    register.addSCObject(data);
                    output.outToScreen("loginScript - registerResponse에 False 값 전달.");
                }
                sendClientMessage(cSock, register);
                break;

            case "url":
                //output.outToScreen("serverTCP - url 정상 실행.");
                message url = new message("urlResponse");
                if (playerTools.createurl(incObject.getSCObject(0).getString("url"), incObject.getSCObject(0).getString("account")))
                {
                    scObject data = new scObject("data");
                    data.addBool("response", true);
                    url.addSCObject(data);
                    output.outToScreen("loginScript - urlResponse에 True 값 전달.");
                }
                else
                {
                    scObject data = new scObject("data");
                    data.addBool("response", false);
                    url.addSCObject(data);
                    output.outToScreen("loginScript - urlResponse에 False 값 전달.");
                }
                sendClientMessage(cSock, url);
                break;

            case "getItem":
                //output.outToScreen("serverTCP - getItem 정상 실행.");
                message getitem = new message("getItemResponse");
                if (playerTools.getItem(incObject.getSCObject(0).getString("account"), incObject.getSCObject(0).getString("itemName")))
                {
                    scObject data = new scObject("data");
                    data.addBool("response", true);
                    getitem.addSCObject(data);
                    output.outToScreen("loginScript - getItemResponse에 True 값 전달.");
                }
                else
                {
                    scObject data = new scObject("data");
                    data.addBool("response", false);
                    getitem.addSCObject(data);
                    output.outToScreen("loginScript - getItemResponse에 False 값 전달.");
                }
                sendClientMessage(cSock, getitem);
                break;

            case "UpdatePlantListTable":
                //output.outToScreen("serverTCP - UpdatePlantListTable 정상 실행.");
                message updatePlantListTableMes = new message("UpdatePlantListTableResponse");
                if (playerTools.UpdatePlantListTable(incObject.getSCObject(0).getString("account"),
                                                     incObject.getSCObject(0).getString("plantName"),
                                                     incObject.getSCObject(0).getInt("plantID"),
                                                     incObject.getSCObject(0).getString("itemName"), incObject.getSCObject(0).getInt("posNumber"),
                                                     incObject.getSCObject(0).getInt("level"), incObject.getSCObject(0).getFloat("expAmount"),
                                                     incObject.getSCObject(0).getBool("isSeedItem")))
                {
                    scObject data = new scObject("data");
                    data.addBool("response", true);
                    updatePlantListTableMes.addSCObject(data);
                    output.outToScreen("loginScript - UpdatePlantListTable에 True 값 전달.");
                }
                else
                {
                    scObject data = new scObject("data");
                    data.addBool("response", false);
                    updatePlantListTableMes.addSCObject(data);
                    output.outToScreen("loginScript - UpdatePlantListTable에 False 값 전달.");
                }
                sendClientMessage(cSock, updatePlantListTableMes);
                break;

            case "SelectQuery":
                //output.outToScreen("serverTCP - SelectQuery 정상 실행.");
                message selectQueryMes = new message("SelectQueryResponse");
                if (playerTools.SelectQuery(incObject.getSCObject(0).getString("account"), incObject.getSCObject(0).getString("columnName"),
                                            incObject.getSCObject(0).getString("tableName")))
                {
                    scObject data = new scObject("data");
                    data.addBool("response", true);
                    data.addInt("plantListTableCount", playerTools.plantPos.Count);
                    for (int i = 0; i <= playerTools.plantPos.Count - 1; i++)
                    {
                        data.addInt("plantPos[" + i + "]", playerTools.plantPos[i]);
                        data.addString("plantName[" + i + "]", playerTools.plantName[i]);
                        data.addInt("plantID[" + i + "]", playerTools.plantID[i]);
                        data.addInt("Lv[" + i + "]", playerTools.Lv[i]);
                        data.addFloat("waterEXP[" + i + "]", playerTools.waterEXP[i]);
                        data.addFloat("sunEXP[" + i + "]", playerTools.sunEXP[i]);
                        data.addFloat("fertilizerEXP[" + i + "]", playerTools.fertilizerEXP[i]);
                    }
                    ////고민중, 걍 노가다임시방편으로 할지 여러 곳에 사용될수잇게 만들지.. 테이블마다 컬럼 개수가 다를 텐데 어떻게 다 가져오지?
                    //위에 써놓음, 다시말하면 2차원배열 만들면됨, 배열 크기는 loginScript에서 넘겨받으면됨,
                    //근데 보통 테이블마다 따로 짠다고하니 별 상관 없을듯함
                    selectQueryMes.addSCObject(data);
                    output.outToScreen("loginScript - SelectQueryResponse에 True 값 전달.");
                }
                else
                {
                    scObject data = new scObject("data");
                    data.addBool("response", false);
                    selectQueryMes.addSCObject(data);
                    output.outToScreen("loginScript - SelectQueryResponse에 False 값 전달.");
                }
                playerTools.plantPos.Clear();
                playerTools.plantName.Clear();
                playerTools.plantID.Clear();
                playerTools.Lv.Clear();
                playerTools.waterEXP.Clear();
                playerTools.sunEXP.Clear();
                playerTools.fertilizerEXP.Clear();
                sendClientMessage(cSock, selectQueryMes);
                break;

            case "UpdatePlantExp":
                //output.outToScreen("serverTCP - SelectQuery 정상 실행.");
                message UpdatePlantExpMes = new message("UpdatePlantExpResponse");
                if (playerTools.UpdatePlantExp(incObject.getSCObject(0).getString("account"), incObject.getSCObject(0).getInt("plantPos"),
                                               incObject.getSCObject(0).getInt("level"), incObject.getSCObject(0).getInt("expName"), incObject.getSCObject(0).getFloat("expAmount")))
                {
                    output.outToScreen("SeverTCP - UpdatePlantExp is complete");
                    scObject data = new scObject("data");
                    data.addBool("response", true);
                    UpdatePlantExpMes.addSCObject(data);
                }
                else
                {
                    scObject data = new scObject("data");
                    data.addBool("response", false);
                    UpdatePlantExpMes.addSCObject(data);
                }
                //sendClientMessage(cSock, UpdatePlantExpMes);
                break;

            case "UpdatePlantID":
                message UpdatePlantIDMes = new message("UpdatePlantIDResponse");
                if (playerTools.UpdatePlantID(incObject.getSCObject(0).getString("account"), incObject.getSCObject(0).getInt("plantPos"),
                                              incObject.getSCObject(0).getInt("plantID")))
                {
                    output.outToScreen("SeverTCP - UpdatePlantID is complete");
                    scObject data = new scObject("data");
                    data.addBool("response", true);
                    UpdatePlantIDMes.addSCObject(data);
                }
                else
                {
                    scObject data = new scObject("data");
                    data.addBool("response", false);
                    UpdatePlantIDMes.addSCObject(data);
                }
                //sendClientMessage(cSock, UpdatePlantExpMes);
                break;

            case "ItemCountCheck":
                //output.outToScreen("serverTCP - ItemCountCheck 정상 실행.");
                message itemcountcheck = new message("ItemCountCheckResponse");
                if (playerTools.ItemCountCheck(incObject.getSCObject(0).getString("account"), incObject.getSCObject(0).getString("itemName")))
                {
                    scObject data = new scObject("data");
                    data.addBool("response", true);

                    if (playerTools.number == playerTools.wItemNum)
                    {
                        data.addInt("wItemNum", playerTools.wItemNum);
                        itemcountcheck.addSCObject(data);
                        //output.outToScreen("loginScript - ItemCountCheckResponse에 True 값과 wItemNum 값 전달.");
                    }
                    if (playerTools.number2 == playerTools.fItemNum)
                    {
                        data.addInt("fItemNum", playerTools.fItemNum);
                        itemcountcheck.addSCObject(data);
                        //output.outToScreen("loginScript - ItemCountCheckResponse에 True 값과 fItemNum 값 전달.");
                    }
                    if (playerTools.number3 == playerTools.sItemNum)
                    {
                        data.addInt("sItemNum", playerTools.sItemNum);
                        itemcountcheck.addSCObject(data);
                        //output.outToScreen("loginScript - ItemCountCheckResponse에 True 값과 sItemNum 값 전달.");
                    }
                    if (playerTools.number4 == playerTools.nItemNum)
                    {
                        data.addInt("nItemNum", playerTools.nItemNum);
                        itemcountcheck.addSCObject(data);
                        //output.outToScreen("loginScript - ItemCountCheckResponse에 True 값과 nItemNum 값 전달.");
                    }
                    if (playerTools.number5 == playerTools.sfsItemNum)
                    {
                        data.addInt("sfsItemNum", playerTools.sfsItemNum);
                        itemcountcheck.addSCObject(data);
                        //output.outToScreen("loginScript - ItemCountCheckResponse에 True 값과 sfsItemNum 값 전달.");
                    }
                    if (playerTools.number6 == playerTools.csItemNum)
                    {
                        data.addInt("csItemNum", playerTools.csItemNum);
                        itemcountcheck.addSCObject(data);
                        //output.outToScreen("loginScript - ItemCountCheckResponse에 True 값과 csItemNum 값 전달.");
                    }
                    if (playerTools.number7 == playerTools.tsItemNum)
                    {
                        data.addInt("tsItemNum", playerTools.tsItemNum);
                        itemcountcheck.addSCObject(data);
                        //output.outToScreen("loginScript - ItemCountCheckResponse에 True 값과 tsItemNum 값 전달.");
                    }
                    output.outToScreen("loginScript - ItemCountCheckResponse에 True 값 전달");
                }
                else
                {
                    scObject data = new scObject("data");
                    data.addBool("response", false);
                    itemcountcheck.addSCObject(data);
                    output.outToScreen("loginScript - ItemCountCheckResponse에 False 값 전달.");
                }

                sendClientMessage(cSock, itemcountcheck);
                break;

            case "urlcheck":
                //output.outToScreen("serverTCP - urlcheck 정상 실행.");
                message urlcheck = new message("urlcheckResponse");
                if (playerTools.urlcheck(incObject.getSCObject(0).getString("account"), incObject.getSCObject(0).getString("password")))
                {
                    scObject data = new scObject("data");
                    data.addBool("response", true);
                    urlcheck.addSCObject(data);
                    output.outToScreen("loginScript - urlcheckResponse에 True 값 전달.");
                }
                else
                {
                    scObject data = new scObject("data");
                    data.addBool("response", false);
                    urlcheck.addSCObject(data);
                    output.outToScreen("loginScript - urlcheckResponse에 False 값 전달.");
                }
                sendClientMessage(cSock, urlcheck);
                break;

            case "UseItem":
                //output.outToScreen("serverTCP - UseItem 정상 실행.");
                message useitem = new message("UseItemResponse");
                if (playerTools.UseItem(incObject.getSCObject(0).getString("account"), incObject.getSCObject(0).getString("itemName"), incObject.getSCObject(0).getInt("itemNum")))
                {
                    scObject data = new scObject("data");
                    data.addBool("response", true);
                    data.addInt("wItemNum", playerTools.number);
                    data.addInt("fItemNum", playerTools.number2);
                    data.addInt("sItemNum", playerTools.number3);
                    data.addInt("nItemNum", playerTools.number4);
                    data.addInt("sfsItemNum", playerTools.number5);
                    data.addInt("csItemNum", playerTools.number6);
                    data.addInt("tsItemNum", playerTools.number7);
                    useitem.addSCObject(data);
                    output.outToScreen("loginScript - UseItemResponse에 True 값 전달.");
                }
                else
                {
                    scObject data = new scObject("data");
                    data.addBool("response", false);
                    useitem.addSCObject(data);
                    output.outToScreen("loginScript - UseItemResponse에 False 값 전달.");
                }
                sendClientMessage(cSock, useitem);
                break;

            case "sendtime":
                message sendtime = new message("sendtimeresponse");
                if (playerTools.sendtime(incObject.getSCObject(0).getString("account"), incObject.getSCObject(0).getFloat("time"), incObject.getSCObject(0).getString("scenename")))
                {
                    output.outToScreen("");
                }
                break;

            case "plusExp":
                //output.outToScreen("serverTCP - plusExp 정상 실행.");
                message plusExp = new message("plusExpResponse");
                if (playerTools.plusExp(incObject.getSCObject(0).getString("account"), incObject.getSCObject(0).getString("password")))
                {
                    scObject data = new scObject("data");
                    data.addBool("response", true);
                    plusExp.addSCObject(data);
                    output.outToScreen("loginScript - plusExpResponse에 True 값 전달.");
                }
                else
                {
                    scObject data = new scObject("data");
                    data.addBool("response", false);
                    plusExp.addSCObject(data);
                    output.outToScreen("loginScript - plusExpResponse에 False 값 전달.");
                }
                sendClientMessage(cSock, plusExp);
                break;

            case "CheckExp":
                //output.outToScreen("serverTCP - CheckExp 정상 실행.");
                message CheckExp = new message("CheckExpResponse");
                if (playerTools.CheckExp(incObject.getSCObject(0).getString("account"), incObject.getSCObject(0).getString("password")))
                {
                    scObject data = new scObject("data");
                    data.addBool("response", true);
                    data.addInt("Exp", playerTools.Exp);
                    CheckExp.addSCObject(data);
                    output.outToScreen("loginScript - CheckExpResponse에 True 값 전달.");
                }
                else
                {
                    scObject data = new scObject("data");
                    data.addBool("response", false);
                    CheckExp.addSCObject(data);
                    output.outToScreen("loginScript - CheckExpResponse에 False 값 전달.");
                }
                sendClientMessage(cSock, CheckExp);
                break;

            case "getplantname":     //이부분도 수정이 필요하다. 첨에 대전 버튼 누르면 되는데 아니면 안된다.
                message GetPlantNameMessage = new message("GetPlantNameResponse");
                if (true)
                {
                    string name = "";
                    char   sp   = ',';
                    name = playerTools.GetPlantName(incObject.getSCObject(0).getString("account"));
                    string[] spstring = name.Split(sp);
                    scObject data     = new scObject("data");
                    data.addBool("response", true);
                    data.addString("name1", spstring[0]);
                    data.addString("name2", spstring[1]);
                    data.addString("name3", spstring[2]);
                    data.addString("name4", spstring[3]);
                    GetPlantNameMessage.addSCObject(data);
                    sendClientMessage(cSock, GetPlantNameMessage);
                }

                /*else
                 * {
                 *  output.outToScreen("식물 이름 받아오기 실패");
                 *  scObject data = new scObject("data");
                 *  data.addBool("response", false);
                 *  GetPlantNameMessage.addSCObject(data);
                 *  sendClientMessage(cSock, GetPlantNameMessage);
                 * }*/
                break;

            case "transferip":
                message newMessage10 = new message("TransferIPResponse");
                if (clientSockets.Contains(cSock))
                {
                    output.outToScreen("중복 아이피 또는 Socket 입니다. " + incObject.getSCObject(0).getString("battleip") + cSock);
                }
                else
                {
                    clientSockets.Add(cSock);
                }

                if (clientSockets.Count == 2)
                {
                    clientinfos.Add(clientSockets[0], clientSockets[1]);     //KEY VALUE
                    scObject data = new scObject("data");
                    data.addBool("response", true);
                    newMessage10.addSCObject(data);
                    sendClientMessage(clientSockets[0], newMessage10);
                    sendClientMessage(clientSockets[1], newMessage10);
                    clientSockets.Clear();
                }
                else
                {
                    scObject data = new scObject("data");
                    output.outToScreen("매칭 인원이 부족합니다.");
                    data.addBool("response", false);
                    sendClientMessage(clientSockets[0], newMessage10);
                }
                break;

            case "addrank":
                message addRank = new message("addRankResponse");
                if (true)
                {
                    scObject data = new scObject("data");
                    data.addBool("response", true);
                    data.addInt("rankpoint", playerTools.addrank(incObject.getSCObject(0).getString("account")));
                    addRank.addSCObject(data);
                }
                else
                {
                }
                sendClientMessage(cSock, addRank);
                break;

            case "subtractionrank":
                message subtractionrank = new message("subtractionRankResponse");
                if (true)
                {
                    scObject data = new scObject("data");
                    data.addBool("response", true);
                    data.addInt("rankpoint", playerTools.subtractionrank(incObject.getSCObject(0).getString("account")));
                    subtractionrank.addSCObject(data);
                }
                else
                {
                }
                sendClientMessage(cSock, subtractionrank);
                break;

            case "sendplantname":
                if (playerTools.sendplantname(incObject.getSCObject(0).getString("account"), incObject.getSCObject(0).getString("plantname")))
                {
                    output.outToScreen("sendplantName");    //이제 로그인 스크립트에 저장된 이름 다시 쏴줘야해
                }
                break;

            case "alldeleteplantname":
                if (playerTools.AllDeletePlantName(incObject.getSCObject(0).getString("account")))
                {
                    output.outToScreen("이름 전부 초기화");
                }
                break;

            case "deleteplantname":
                if (playerTools.DeletePlantName(incObject.getSCObject(0).getString("account"), incObject.getSCObject(0).getString("plantname")))
                {
                    output.outToScreen("이름 1개 완료");
                }
                break;

            case "sendcardmessage":     //왜 안되는지 모르겠음
                message SendCreateMyCard = new message("MyCardResponse");
                message SendCreateAICard = new message("SendCreateAICardResponse");
                if (clientinfos.ContainsKey(cSock) || clientinfos.ContainsValue(cSock))
                {
                    plantname = incObject.getSCObject(0).getString("plantname");
                    scObject data = new scObject("data");
                    data.addBool("response", true);
                    data.addString("plantname", plantname);
                    SendCreateMyCard.addSCObject(data);
                    SendCreateAICard.addSCObject(data);

                    if (clientinfos.ContainsKey(cSock))
                    {
                        clientinfos.TryGetValue(cSock, out value_Value);
                        sendClientMessage(value_Value, SendCreateAICard);
                        sendClientMessage(cSock, SendCreateMyCard);
                    }
                    else if (clientinfos.ContainsValue(cSock))
                    {
                        value_Key = clientinfos.FirstOrDefault(x => x.Value == cSock).Key;
                        sendClientMessage(value_Key, SendCreateAICard);
                        sendClientMessage(cSock, SendCreateMyCard);
                    }
                }
                else
                {
                }
                break;

            case "senddestroyotherobject":     //내 오브젝트 파괴 했다는 메세지 받았을때;
            {
                output.outToScreen("??");
                message  newMessage13 = new message("SendDestroyMyObjectResponse");
                scObject data         = new scObject("data");
                data.addBool("response", true);
                newMessage13.addSCObject(data);

                message  newMessage14 = new message("SendDestroyAiObjectResponse");
                scObject data1        = new scObject("data1");
                data1.addBool("response", true);
                newMessage14.addSCObject(data1);

                if (clientinfos.ContainsKey(cSock))
                {
                    clientinfos.TryGetValue(cSock, out value_Value);
                    sendClientMessage(cSock, newMessage14);
                    sendClientMessage(value_Value, newMessage13);
                }

                else if (clientinfos.ContainsValue(cSock))
                {
                    value_Key = clientinfos.FirstOrDefault(x => x.Value == cSock).Key;
                    sendClientMessage(cSock, newMessage14);
                    sendClientMessage(value_Key, newMessage13);
                }
                output.outToScreen("" + newMessage14);
            }
            break;

            case "senddestroycastle":
            {
                output.outToScreen("???");
                message  newMessage15 = new message("SendDestroyMyCastleResponse");
                scObject data         = new scObject("data");
                data.addBool("response", true);
                newMessage15.addSCObject(data);

                message  newMessage16 = new message("SendDestroyAiCastleResponse");
                scObject data1        = new scObject("data1");
                data1.addBool("response", true);
                newMessage16.addSCObject(data1);

                message  newMessage17 = new message("SendVictoryResponse");
                scObject data2        = new scObject("data2");
                data2.addBool("response", true);
                newMessage17.addSCObject(data2);

                message  newMessage18 = new message("SendLoseResponse");
                scObject data3        = new scObject("data3");
                data3.addBool("response", true);
                newMessage18.addSCObject(data3);

                if (clientinfos.ContainsKey(cSock))
                {
                    clientinfos.TryGetValue(cSock, out value_Value);
                    sendClientMessage(cSock, newMessage16);
                    sendClientMessage(value_Value, newMessage15);
                    sendClientMessage(cSock, newMessage17);
                    sendClientMessage(value_Value, newMessage18);
                }

                else if (clientinfos.ContainsValue(cSock))
                {
                    value_Key = clientinfos.FirstOrDefault(x => x.Value == cSock).Key;
                    sendClientMessage(cSock, newMessage16);
                    sendClientMessage(value_Key, newMessage15);
                    sendClientMessage(cSock, newMessage17);
                    sendClientMessage(value_Key, newMessage18);
                }
                clientinfos.Remove(cSock);
                output.outToScreen("" + newMessage15);
            }
            break;


            default:
                output.outToScreen("The client sent a message: " + incObject.messageText);
                break;
            }
        }