private void LoadChars() { int maxCharacters = 16; float initX = -9; float initY = 15; float deltaX = 7; float deltaY = -7; Vector2 pos = new Vector2(initX, initY); var sortedFileInfos = new System.IO.DirectoryInfo(Path.Save).GetFiles().OrderBy(file => file.CreationTime).ToArray(); string[] sortedFiles = sortedFileInfos.Select(file => file.FullName).ToArray(); for (int i = 0; i < sortedFiles.Length && i < maxCharacters; i++) { zChars.Add(new MenuCharacter(sortedFiles[i])); zChars.Last().Position = pos; //get next pos pos.X += deltaX; if ((i + 1) % 4 == 0) { pos.X = initX; pos.Y += deltaY; } } }
public ActionResult ErrorLog(string log) { var logs = new System.IO.DirectoryInfo(Server.MapPath("~/App_Data")).GetFiles("*.log") .OrderByDescending(o => o.LastWriteTime) .Take(10) .ToDictionary(f => f.Name, f => f.FullName); string[] selected = { "Select a log file to view..." }; if (!string.IsNullOrWhiteSpace(log)) { var file = logs.Where(l => l.Key == log).FirstOrDefault(); selected = System.IO.File.ReadAllLines(file.Value); } ErrorLogModel model = new ErrorLogModel() { LogFiles = logs.Select(l => l.Key).ToArray(), SelectedLog = selected }; return(View("ErrorLog", model)); }
public ActionResult ErrorLog(string log) { var logs = new System.IO.DirectoryInfo(Server.MapPath("~/App_Data")).GetFiles("*.log") .OrderByDescending(o => o.LastWriteTime) .Take(10) .ToDictionary(f => f.Name, f => f.FullName); string[] selected = { "Select a log file to view..." }; if (!string.IsNullOrWhiteSpace(log)) { var file = logs.Where(l => l.Key == log).FirstOrDefault(); selected = System.IO.File.ReadAllLines(file.Value); } ErrorLogModel model = new ErrorLogModel() { LogFiles = logs.Select(l => l.Key).ToArray(), SelectedLog = selected }; return View("ErrorLog", model); }
private void LoadChars() { int maxCharacters = 16; float initX = -9; float initY = 15; float deltaX = 7; float deltaY = -7; Vector2 pos = new Vector2(initX, initY); var sortedFileInfos = new System.IO.DirectoryInfo(Path.Save).GetFiles().OrderBy(file => file.CreationTime).ToArray(); string[] sortedFiles = sortedFileInfos.Select(file => file.FullName).ToArray(); for (int i = 0; i < sortedFiles.Length && i < maxCharacters; i++) { zChars.Add(new MenuCharacter(sortedFiles[i])); zChars.Last().Position = pos; //get next pos pos.X += deltaX; if ((i+1) % 4 == 0) { pos.X = initX; pos.Y += deltaY; } } }