public ActionResult DeleteConfirmed(int id) { Chronicle chronicle = db.Chronicles.Find(id); DeleteModels.Delete(chronicle); return(RedirectToAction("Index", new { id = chronicle.Story_id })); }
public string Encrypt(Chronicle chron) { if (string.IsNullOrEmpty(AttachedFilePath) || !File.Exists(AttachedFilePath)) { throw new FileNotFoundException("No File Attached"); } //Copy File for Temporary Usage String fileName = Path.GetFileName(AttachedFilePath); File.Copy(AttachedFilePath, BinariesPath + "temp/" + fileName, true); //Grab DDF file String DDFFileName = Path.GetFileNameWithoutExtension(AttachedFilePath.Replace("dec-", "").Replace("enc-", "")) + ".ddf"; String DDFFilePath = String.Format("{0}DAT_defs/{1}/{2}", BinariesPath, Chronicles.GetCode(chron), DDFFileName); String EncryptionFileName = Path.GetFileNameWithoutExtension(AttachedFilePath) + ".dat"; File.Copy(DDFFilePath, BinariesPath + "temp/" + DDFFileName, true); String Command = String.Format("l2asm.exe -d temp/{0} temp/{1} temp/{2}", DDFFileName, fileName, EncryptionFileName); CommandLine cmd = new CommandLine(BinariesPath); String Output = cmd.Execute(Command); if (File.Exists(BinariesPath + "temp/" + EncryptionFileName)) { return(BinariesPath + "temp/" + EncryptionFileName); } return(null); }
public ActionResult Edit(int id) { Chronicle chronicle = _chronicleService.GetById(id); if (chronicle == null) { AR.Setfailure(Messages.HttpNotFound); return(Json(AR, JsonRequestBehavior.AllowGet)); } var vm = _mapper.Map <ChronicleIM>(chronicle); var pageMeta = _pageMetaServices.GetPageMeta(ModelType.CHRONICLE, vm.Id.ToString()); if (pageMeta != null) { vm.SEOTitle = pageMeta.Title; vm.Keywords = pageMeta.Keyword; vm.SEODescription = pageMeta.Description; } ViewBag.Years = new SelectList(DateTimeHelper.GetYearList(2010)); ViewBag.Months = new SelectList(DateTimeHelper.GetMonthList()); ViewBag.Days = new SelectList(DateTimeHelper.GetDayList()); return(PartialView("_Edit", vm)); }
private void ApplyStatusChangesFor <T, TKey>( Chronicle <T, TKey> chronicle, T legacyEvent) where T : ICrabEvent, IHasCrabAddressStatus, IHasCrabKey <TKey> { var crabStatusEvent = chronicle.MostCurrent(legacyEvent); var newStatus = crabStatusEvent == null ? null : Map(crabStatusEvent.AddressStatus, crabStatusEvent.Modification); if (_status != newStatus) { if (crabStatusEvent != null && crabStatusEvent.Modification == CrabModification.Correction) { if (!IsRetired) { ApplyStatusCorrection(newStatus); } } else { if (!IsRetired) { ApplyStatusChange(newStatus); } } } if (crabStatusEvent?.Modification == CrabModification.Correction) { ApplyOfficallyAssignedCorrection(crabStatusEvent.AddressStatus); } else { ApplyOfficallyAssignedChange(crabStatusEvent?.AddressStatus, crabStatusEvent?.Modification); } }
private static void Main(string[] args) { NChronicle.Core.NChronicle.Configure (c => { c.WithConsoleLibrary(); //c.WithFileLibrary(); //c.WithSmtpLibrary().Configure //(s => //{ // s.WithRecipients("*****@*****.**"); // s.WithSender("*****@*****.**"); // s.UsingNetworkMethod("mailtrap.io", 465, "7934d276be13a5", "d75867f8f5c994"); // s.ListeningTo(ChronicleLevel.Success); // s.AllowingRecurrences(); // s.SendingSynchronously(); //}); }); var chronicle = new Chronicle(); while (true) { PrintFrontierResponse(chronicle); Thread.Sleep(2500); } }
public JsonResult Delete(int id) { Chronicle vCategory = _chronicleService.GetById(id); _chronicleService.Delete(vCategory); AR.SetSuccess(String.Format(Messages.AlertDeleteSuccess, EntityNames.Chronicle)); return(Json(AR, JsonRequestBehavior.DenyGet)); }
public Task <bool> CreateChronicleAsync(Chronicle chronicle) { chronicle.Created = DateTime.Now; if (_dbContext.Chronicles.Count(c => c.Slug == chronicle.Slug) > 0) { chronicle.Slug = $"{chronicle.Slug}-{Guid.NewGuid().ToString().Substring(0, 8)}"; } _dbContext.Chronicles.Add(chronicle); return(CommitedResultIsSuccessfulAsync()); }
public async Task <bool> SetHeaderFileNameOnChronicleAsync(Chronicle chronicle) { _dbContext.Chronicles.Update(chronicle); _dbContext.Entry(chronicle).State = EntityState.Modified; _dbContext.Entry(chronicle).Property(x => x.Created).IsModified = false; var result = await CommitedResultIsSuccessfulAsync(); _dbContext.Entry(chronicle).State = EntityState.Detached; return(result); }
public static String GetCode(Chronicle chronicle) { string code = ""; switch (chronicle) { case Chronicle.RiseOfDarkness: code = "C3"; break; case Chronicle.ScionsOfDestiny: code = "C4"; break; case Chronicle.OathOfBlood: code = "C5"; break; case Chronicle.Interlude: code = "Interlude"; break; case Chronicle.Kamael: code = "CT1_0"; break; case Chronicle.Hellbound: code = "CT1_5"; break; case Chronicle.GraciaPT1: code = "CT2_1en"; break; case Chronicle.GraciaPT2: code = "CT2_2en"; break; case Chronicle.GraciaFinal: code = "CT2_3en"; break; case Chronicle.GraciaEpilogue: code = "CT2_4en"; break; case Chronicle.Freya: code = "CT2_5en"; break; case Chronicle.HighFive: code = "CT2_6"; break; case Chronicle.Awakening: code = "GODtw580"; break; case Chronicle.Harmony: code = "GODhar"; break; case Chronicle.Tauti: code = "GODtau"; break; case Chronicle.GloryDays: code = "GODglo"; break; case Chronicle.Lindvior: code = "GODlind"; break; case Chronicle.Valiance: code = "GODepei"; break; case Chronicle.Ertheia: code = "GODerthkr"; break; case Chronicle.InfinityOdyssey: code = "GODep2.0"; break; case Chronicle.Helios: code = "GOD_Helios_64"; break; case Chronicle.GrandCrusade: code = "GOD_GrandCrusade_109"; break; default: break; } return(code); }
public ActionResult Edit([Bind(Include = "System_id,Story_id,Name,Description,Status")] Chronicle chronicle) { if (ModelState.IsValid) { db.Entry(chronicle).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index", new { id = chronicle.Story_id })); } ViewBag.Story_id = new SelectList(db.Stories, "System_id", "Narrator_id", chronicle.Story_id); return(View(chronicle)); }
// GET: Sessions/Create public ActionResult Create(int?id) { Chronicle chronicle = db.Chronicles.SingleOrDefault(c => c.System_id == id); ViewBag.Chronicle_id = chronicle.System_id; Session model = new Session(chronicle.Story_id); model.Date = DateTime.Today; ViewBag.Players = new SelectList(chronicle.Story.Players.Where(p => p.Type == "Player"), "System_id", "UserName"); return(View(model)); }
private void saveToolStripMenuItem_Click(object sender, EventArgs e) { Task task = Task.Factory.StartNew(() => { String dump = CreateDumpFile(); if (dump != null && File.Exists(Application.StartupPath + "/Temp/" + dump)) { String CopyFile = Application.StartupPath + "/Temp/" + Path.GetFileNameWithoutExtension(CurrentFile) + ".dump"; File.Copy(Application.StartupPath + "/Temp/" + dump, CopyFile, true); SetState("Assembling Dat File"); Chronicle chronicle = (Chronicle)Convert.ToInt32(Properties.Settings.Default.DefaultChronicle); L2ASM asm = new L2ASM(); asm.AttachFile(CopyFile); string assembledFile = asm.Encrypt(chronicle); if (assembledFile != null && File.Exists(assembledFile)) { SetState("Encoding Assembeled File.."); L2Encdec encdec = new L2Encdec(); encdec.AttachFile(assembledFile); string EncryptedFile = encdec.EncryptDat(); if (EncryptedFile != null && File.Exists(EncryptedFile)) { String FinalFilePath = Application.StartupPath + "/Temp/" + CurrentFile; File.Copy(EncryptedFile, FinalFilePath, true); SetState("Asking for Overwrite Permission..."); DialogResult result = MessageBox.Show("Would you Like to Overwrite the Original File ?", "Success", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (result == DialogResult.Yes) { File.Copy(FinalFilePath, CurrentFilePath, true); SetState("File has been overwritten for you."); MessageBox.Show("File Successfully Updated"); } else if (result == DialogResult.No) { SetState("Asking for Saving Location ..."); SaveFileDialog Save = new SaveFileDialog(); Save.FileName = Path.GetFileNameWithoutExtension(CurrentFile); Save.Title = "Save to ..."; Save.Filter = "Data Files (*.dat)|*.dat"; Save.DefaultExt = "dat"; DialogResult res = Save.ShowDialog(); if (res == DialogResult.OK) { File.Copy(FinalFilePath, Save.FileName, true); SetState("File Saved Successfully"); } } } } } }); }
// GET: Chronicles/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Chronicle chronicle = db.Chronicles.Find(id); if (chronicle == null) { return(HttpNotFound()); } return(View(chronicle)); }
// GET: Chronicles/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Chronicle chronicle = db.Chronicles.Find(id); if (chronicle == null) { return(HttpNotFound()); } ViewBag.Story_id = new SelectList(db.Stories, "System_id", "Narrator_id", chronicle.Story_id); return(View(chronicle)); }
// GET: Chronicles/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Chronicle chronicle = db.Chronicles.Find(id); if (chronicle == null) { return(HttpNotFound()); } ViewBag.Story_id = chronicle.Story_id; return(View(chronicle)); }
// GET: Sessions public ActionResult Index(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Chronicle chronicle = db.Chronicles.SingleOrDefault(c => c.System_id == id); Story story = db.Stories.SingleOrDefault(s => s.System_id == chronicle.Story_id); ViewBag.Chronicle = chronicle.Name; ViewBag.Chronicle_id = chronicle.System_id; ViewBag.Story = story.Name; ViewBag.Story_id = story.System_id; var sessions = db.Sessions.Include(s => s.Chronicle).Where(c => c.Chronicle_id == chronicle.System_id).OrderByDescending(c => c.Date); return(View(sessions.ToList())); }
// GET: Sessions/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Session session = db.Sessions.Find(id); if (session == null) { return(HttpNotFound()); } Chronicle chronicle = db.Chronicles.SingleOrDefault(c => c.System_id == session.Chronicle_id); ViewBag.Players = new SelectList(chronicle.Story.Players, "System_id", "UserName"); return(View(session)); }
private static void PrintFrontierResponse(Chronicle chronicle) { Dictionary <string, int> statuses = GetFrontierResponse(); if (statuses != null) { var onlineCount = statuses.Count(s => s.Value == 1); var count = statuses.Count; var message = $"{statuses.Count(s => s.Value == 1)} out of {statuses.Count} servers are online."; if (onlineCount == count) { chronicle.Success(message); } else { chronicle.Critical(message); } } }
public FiveStepEmittingStatefulProcess() : base("12345") { _state = new StepCountState(); _chronicle = new Chronicle <StepCountState>(_state); }
// PUT: api/Chronicle/5 public void Put(long id, [FromBody] Chronicle value) { value.Id = id; repository.Update(value); }
public FiveStepEmittingObjectProcess(long id) : base(id.ToString()) { _state = new StepCountObjectState(id); _chronicle = new Chronicle <StepCountObjectState>(_state); }
public bool Update(Chronicle page) { return(_unitOfWork.ChronicleRepository.Update(page)); }
public Chronicle Create(Chronicle page) { return(_unitOfWork.ChronicleRepository.Insert(page)); }
public bool Delete(Chronicle page) { return(_unitOfWork.ChronicleRepository.Delete(page)); }
protected void Terminate(Chronicle <TFolklore> chronicle, TFolklore folklore) { chronicle.Terminate(folklore); }
// POST: api/Chronicle public void Post([FromBody] Chronicle value) { value.Id = 0; repository.Save(value); }