public static void MailArrived(ModelMail mail) { try { if (mail.To == null || mail.To.Login != SessionClientController.My.Login) { return; } Action <ModelMail> action; if (TypeMailProcessing.TryGetValue(mail.GetType(), out action)) { Loger.Log($"Mail {mail.GetType().Name} " + (mail.From == null ? "-" : mail.From.Login) + "->" + (mail.To == null ? "-" : mail.To.Login) + ":" + " hash=" + mail.GetHash()); action(mail); } else { Loger.Log("Mail fail: error type " + mail.GetType().Name); } } catch (Exception e) { Loger.Log("Mail Exception: " + e.ToString()); } }
public void Register() { gameModel = new ModelGame(); alertModel = new ModelAlert(); userModel = new ModelUser(); roleModel = new ModelRole(); guildModel = new ModelGuild(); chatModel = new ModelChat(); cardModel = new ModelCard(); mailModel = new ModelMail(); fightModel = new ModelFight(); rankModel = new ModelRank(); guideModel = new ModelGuide(); shareModel = new ModelShare(); }
public static void MailProcessAttackTechnicalVictory(ModelMail incoming) { var mail = (ModelMailAttackTechnicalVictory)incoming; Loger.Log("Client MailProcessAttackTechnicalVictory"); if (SessionClientController.Data.AttackModule != null) { SessionClientController.Data.AttackModule.Finish(true); } if (SessionClientController.Data.AttackUsModule != null) { SessionClientController.Data.AttackUsModule.Finish(false); } }
public ActionResult Send(MailModel model) { User user = (User)Session["users"]; if (user == null) { return(RedirectToAction("Index", "Login")); } ModelMail mail = new ModelMail(); NH.NHibernateOperation operation = new NH.NHibernateOperation(); User u = operation.GetUserById(model.Id_user); mail.from = user.Email; mail.to = u.Email; return(View(mail)); }
public static void MailProcessAttackCancel(ModelMail incoming) { var mail = (ModelMailAttackCancel)incoming; Loger.Log("Client MailProcessAttackCancel"); GameAttackTrigger_Patch.ForceSpeed = -1f; //на всякий случай if (SessionClientController.Data.AttackModule != null) { SessionClientController.Data.AttackModule.Clear(); } if (SessionClientController.Data.AttackUsModule != null) { SessionClientController.Data.AttackUsModule.Clear(); } SessionClientController.Disconnected("OCity_GameAttacker_Dialog_ErrorMessage".Translate()); }
public static void MailProcessMessadge(ModelMail incoming) { var msg = (ModelMailMessadge)incoming; LetterDef def; switch (msg.type) { case ModelMailMessadge.MessadgeTypes.ThreatBig: def = LetterDefOf.ThreatBig; break; case ModelMailMessadge.MessadgeTypes.ThreatSmall: def = LetterDefOf.ThreatSmall; break; case ModelMailMessadge.MessadgeTypes.Death: def = LetterDefOf.Death; break; case ModelMailMessadge.MessadgeTypes.Negative: def = LetterDefOf.NegativeEvent; break; case ModelMailMessadge.MessadgeTypes.Neutral: def = LetterDefOf.NeutralEvent; break; case ModelMailMessadge.MessadgeTypes.Positive: def = LetterDefOf.PositiveEvent; break; case ModelMailMessadge.MessadgeTypes.Visitor: def = LetterDefOf.AcceptVisitors; break; default: def = LetterDefOf.NeutralEvent; break; } Find.LetterStack.ReceiveLetter(ChatController.ServerCharTranslate(msg.label) , ChatController.ServerCharTranslate(msg.text) , def); }
public void sendMail(ModelMail model) { SmtpClient client = new SmtpClient(); client.Port = 587; client.Host = "smtp.gmail.com"; client.EnableSsl = true; client.Timeout = 10000; client.DeliveryMethod = SmtpDeliveryMethod.Network; client.UseDefaultCredentials = false; client.Credentials = new System.Net.NetworkCredential("*****@*****.**", "$Opteam$"); MailMessage mm = new MailMessage(model.from, model.to, model.subject, model.value); mm.BodyEncoding = UTF8Encoding.UTF8; mm.DeliveryNotificationOptions = DeliveryNotificationOptions.OnFailure; client.Send(mm); }
public static void MailProcessCreateThings(ModelMail incoming) { ModelMailTrade mail = (ModelMailTrade)incoming; if (mail.Things == null || mail.Things.Count == 0 || mail.PlaceServerId <= 0) { Loger.Log("Mail fail: no data"); return; } var place = GetPlace(mail); if (place != null) { DropToWorldObject(place, mail.Things, (mail.From == null ? "-" : mail.From.Login)); } }
public static void MailProcessDeleteByServerId(ModelMail incoming) { var mail = (ModelMailDeleteWO)incoming; Loger.Log("Client MailProcessDeleteByServerId " + mail.PlaceServerId); if (mail.PlaceServerId <= 0) { Loger.Log("Mail fail: no data"); return; } var place = GetPlace(mail, false, true); if (place != null) { Find.WorldObjects.Remove(place); //автосейв с единым сохранением SessionClientController.SaveGameNow(true); } }
public static void MailProcessStartIncident(ModelMail incoming) { Loger.Log("IncidentLod MailController.MailProcessStartIncident 1"); var mail = (ModelMailStartIncident)incoming; Find.TickManager.Pause(); var incident = new Incidents().GetIncident(mail.IncidentType); incident.mult = mail.IncidentMult; incident.arrivalMode = mail.IncidentArrivalMode; incident.strategy = mail.IncidentStrategy; incident.faction = mail.IncidentFaction; incident.attacker = mail.From.Login; incident.place = GetPlace(mail); incident.TryExecuteEvent(); if (!SessionClientController.Data.BackgroundSaveGameOff) { SessionClientController.SaveGameNow(true); } Loger.Log("IncidentLod MailController.MailProcessStartIncident 2"); }
public AdmMailController() { _modelMail = new ModelMail(); }
public ActionResult Sending(ModelMail model) { sendMail(model); return(View()); }
public ActionResult Change(FullFlowModel model) { User user = (User)Session["users"]; if (user == null) { return(RedirectToAction("Index", "Login")); } NH.NHibernateOperation operation = new NH.NHibernateOperation(); string id = (string)RouteData.Values["id"]; int f = Int32.Parse(id); Flow flow = operation.FindFlowById(f); Position p = operation.FindPositionById(flow.id_position.Id_position); ViewBag.Pos = p.Id_position; Step step = operation.FindStep(p); ViewBag.Model = model; if (step != null) { flow.id_position = step.End_position_id; String cond = step.Condition; if (cond != null) { Parser parser = new Parser(); string[] list = parser.Parse(cond); Dictionary <string, string> dict = new Dictionary <string, string>(); foreach (FlowModel <string> mdl in model.list) { dict.Add(mdl.name, mdl.value); } foreach (FlowModel <int> mdl in model.list_int) { dict.Add(mdl.name, mdl.value.ToString()); } List <bool> bool_list = new List <bool>(); List <string> sign = new List <string>(); foreach (string s in list) { string temp = s; char start = s[0]; char end = s[s.Length - 1]; string str = ""; string en = ""; if (start.Equals("|") || start.Equals("&")) { temp = s.Substring(2, s.Length - 2); str = "" + start + start; sign.Add(str); } if (end.Equals("|") || end.Equals("&")) { temp = temp.Substring(0, temp.Length - 2); en = "" + end + end; sign.Add(en); } bool result = parser.checkBracket(temp, dict); bool_list.Add(result); } bool wynik = bool_list[0]; for (int i = 0; i < sign.Count; i++) { if (sign.Equals("||")) { wynik = wynik || bool_list[i + 1]; } else { wynik = wynik && bool_list[i + 1]; } } if (wynik == true) { MailController mm = new MailController(); IList <Task> tasks = operation.GetTasksByPositionId(step.End_position_id); foreach (Task t in tasks) { ModelMail mdl = new ModelMail(); mdl.from = "*****@*****.**"; User us = operation.GetUserById(t.Id_user.Id_user); mdl.to = us.Email; mdl.subject = "Nowe zadanie"; mdl.value = " Masz nowe zadanie wejdz na konto i sprawdz"; mm.sendMail(mdl); } //AddElements(flow, model); //operation.Update<Flow>(flow); } // JESLI NIE SPELNI WARUNKOW TO ROB CO INNEGO } else { MailController mm = new MailController(); IList <Task> tasks = operation.GetTasksByPositionId(step.End_position_id); foreach (Task t in tasks) { ModelMail mdl = new ModelMail(); mdl.from = "*****@*****.**"; User us = operation.GetUserById(t.Id_user.Id_user); mdl.to = us.Email; mdl.subject = "Nowe zadanie"; mdl.value = " Masz nowe zadanie wejdz na konto i sprawdz"; mm.sendMail(mdl); } //AddElements(flow, model); //operation.Update<Flow>(flow); } } else { flow.id_position = null; //AddElements(flow, model); //operation.Update<Flow>(flow); } return(View()); }