public async Task <IActionResult> DeleteContest(Guid id) { var contest = await _context.Contests.FindAsync(id); Images oldImage = await _context.Images.Where(i => i.ImageId.Equals(contest.ContestImageId)).FirstOrDefaultAsync(); Archives archive = new Archives() { PostId = contest.ContestId, PostTitle = contest.ContestTitle, PostText = contest.ContestText + " " + contest.Email, PostCategory = $"{contest.ContestStartDate} - {contest.ContestEndDate}", PostUploadDate = contest.ContestUploadDate, PostLastEditedDate = contest.ContestEditDate, PostArchivedDate = DateTime.Now }; _context.Archives.Add(archive); _context.Contests.Remove(contest); if (oldImage != null) { TTLRemoveUnusedImage(null, oldImage); } await _context.SaveChangesAsync(); return(RedirectToAction(nameof(AllContests))); }
private void saveBtn_Click(object sender, EventArgs e) { if (this.license.Text.Length != 5) { MessageUtil.ShowError("号牌号码输入不正确!"); return; } Archives archive = new Archives(); archive.License = this.license.Text; archive.Process = this.process.Text; archive.Reason = this.reason.Text; archive.Saver = LoginForm.user.UsersId; archive.SaveDate = DateTime.ParseExact(VehicleDao.GetCurrentTimestamp(), "yyyy-MM-dd HH:mm:ss", System.Globalization.CultureInfo.CurrentCulture); try { ArchivesDao.AddArchives(archive); } catch (Exception ex) { MessageUtil.ShowError("保存档案时出错,错误信息为:" + ex.Message); } this.dataGridView.DataSource = ArchivesDao.Load(); this.clear(); }
public void AddArchive(string archive) { lock (Archives) { Archives = Archives.Concat(new[] { FileSystem.GetArchive(archive) }).ToArray(); } }
public SocialImages() { Dependencies.AddRange(nameof(Inputs)); ProcessModules = new ModuleList { new GetPipelineDocuments(ContentType.Content), // Filter to non-archive content new FilterDocuments(Config.FromDocument(doc => !Archives.IsArchive(doc))), // Process the content new CacheDocuments { new AddTitle(), new SetDestination(true), new ExecuteIf(Config.FromSetting(WebKeys.OptimizeContentFileNames, true)) { new OptimizeFileName() }, new GenerateSocialImage(), } }; OutputModules = new ModuleList { new WriteFiles() }; }
private static ArchiveDirectoryEntry FindLocationDirectory(string name) { string directoryName = name.Substring(0, 2); string sourcePath = Path.Combine(SourcePath, directoryName, name); return(Archives.FindEntry <ArchiveDirectoryEntry>(sourcePath)); }
/// <summary> /// Gets the RiotArhiveFile associated with the specified path. /// </summary> /// <param name="path">The path of the RiotArchiveFile to get.</param> /// <returns></returns> public RiotArchiveFile this[string path] { get { return(Archives.First(a => a.Exists(path))[path]); } }
/// <summary> /// Gets the hash code /// </summary> /// <returns>Hash code</returns> public override int GetHashCode() { unchecked // Overflow is fine, just wrap { var hashCode = 41; // Suitable nullity checks etc, of course :) if (Datasources != null) { hashCode = hashCode * 59 + Datasources.GetHashCode(); } if (Step != null) { hashCode = hashCode * 59 + Step.GetHashCode(); } if (Archives != null) { hashCode = hashCode * 59 + Archives.GetHashCode(); } if (Path != null) { hashCode = hashCode * 59 + Path.GetHashCode(); } return(hashCode); } }
/// <summary> /// Checks whether any conditions exists that should prevent the user from being able to run AddArchiveAsync (no folder chosen, name has already been used etc) /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void OnInputValuesChanged(object sender, System.EventArgs e) { Archive archiveWithMatchingName = new Archive(); if (CatalogName != null) { archiveWithMatchingName = Archives.FirstOrDefault(archiveToCheck => archiveToCheck.Name.Equals(CatalogName)); } bool match = false; if (archiveWithMatchingName != null) { match = true; } if (addFolderPathText?.Length > 0 && CatalogName?.Length > 0 && !(match) && PercentDone == 0) { GoEnabled = true; } else { GoEnabled = false; } }
private void PathEnter(object sender, KeyEventArgs e) { if (e.Key == Key.Enter) { Archives.Focus(); } }
public async Task <IActionResult> DeleteBlog(Guid id) { var blogs = await _context.Blogs.Include(b => b.BlogCategoryNavigation).Where(b => b.BlogId.Equals(id)).FirstOrDefaultAsync(); Images oldImage = await _context.Images.Where(i => i.ImageId.Equals(blogs.BlogImageId)).FirstOrDefaultAsync(); Archives archive = new Archives() { PostId = blogs.BlogId, PostTitle = blogs.BlogTitle, PostText = blogs.BlogText, PostCategory = blogs.BlogCategoryNavigation.CategoryName, PostUploadDate = blogs.BlogUploadDate, PostLastEditedDate = blogs.BlogEditDate, PostArchivedDate = DateTime.Now }; _context.Archives.Add(archive); _context.Blogs.Remove(blogs); if (oldImage != null) { TTLRemoveUnusedImage(null, oldImage); } await _context.SaveChangesAsync(); return(RedirectToAction(nameof(AllBlogs))); }
private void OnOkButtonClick(object sender, RoutedEventArgs e) { try { IEnumerable <LocationView> items = ((IEnumerable <LocationView>)LocationsListBox.ItemsSource).Where(i => i.IsSelected); foreach (LocationView view in items) { switch (_mode) { case Mode.Save: view.Location.SaveRequestedData(); break; case Mode.Import: view.Location.ImportRequestedData(); break; } } Archives.GetInfo(ArchiveName.Field).Update(); DialogResult = true; } catch (Exception ex) { UIHelper.ShowError(ex); } }
/// <summary> /// Will convert ArchiveCountCollection method from Archives.GetPostsByCategoryArchive() /// into a <see cref="LinkCategory"/>. LinkCategory is a common item to databind to a web control. /// </summary> public static LinkCategory BuildCategoriesArchiveLinks(string title, UrlHelper urlHelper) { ICollection <ArchiveCount> acc = Archives.GetPostCountByCategory(); var category = new LinkCategory { Title = title }; foreach (ArchiveCount ac in acc) { var link = new Link { IsActive = true, NewWindow = false, Title = string.Format("{0} ({1})", ac.Title, ac.Count.ToString(CultureInfo.InvariantCulture)), Url = urlHelper.CategoryUrl(new Category { Id = ac.Id, Title = ac.Title }) }; //Ugh, I hate how categories work in Subtext. So intertwined with links. category.Links.Add(link); } return(category); }
public async Task <IActionResult> DeleteFact(Guid id) { var fact = await _context.Facts.Include(f => f.DykcategoryNavigation).Where(f => f.Dykid.Equals(id)).FirstOrDefaultAsync(); Images oldImage = await _context.Images.Where(i => i.ImageId.Equals(fact.DykimageId)).FirstOrDefaultAsync(); Archives archive = new Archives() { PostId = fact.Dykid, PostTitle = fact.Dyktitle, PostText = fact.Dyktext, PostCategory = fact.DykcategoryNavigation.CategoryName, PostUploadDate = fact.DykuploadDate, PostLastEditedDate = fact.DykeditDate, PostArchivedDate = DateTime.Now }; _context.Archives.Add(archive); _context.Facts.Remove(fact); if (oldImage != null) { TTLRemoveUnusedImage(null, oldImage); } await _context.SaveChangesAsync(); return(RedirectToAction(nameof(AllFacts))); }
public void CanGetPostsByCategoryArchive() { UnitTestHelper.SetupBlog(); ICollection <ArchiveCount> counts = Archives.GetPostCountByCategory(); Assert.AreEqual(0, counts.Count); Entry entry = UnitTestHelper.CreateEntryInstanceForSyndication("me", "title", "body"); int categoryId = UnitTestHelper.CreateCategory(Config.CurrentBlog.Id, "Test"); int entryId = UnitTestHelper.Create(entry); ObjectProvider.Instance().SetEntryCategoryList(entryId, new[] { categoryId }); counts = Archives.GetPostCountByCategory(); Assert.AreEqual(1, counts.Count); foreach (ArchiveCount archiveCount in counts) { Assert.AreEqual(1, archiveCount.Count, "Expected one post in the archive."); archiveCount.Title = "Test"; Assert.AreEqual("Test", archiveCount.Title); archiveCount.Id = 10; Assert.AreEqual(10, archiveCount.Id); return; } }
public async Task <IActionResult> DeleteActivity(Guid id) { var activity = await _context.Activities.Include(a => a.ActivityCategoryNavigation).Where(a => a.ActivityId.Equals(id)).FirstOrDefaultAsync(); Images oldImage = await _context.Images.Where(i => i.ImageId.Equals(activity.ActivityImageId)).FirstOrDefaultAsync(); Archives archive = new Archives() { PostId = activity.ActivityId, PostTitle = activity.ActivityTitle, PostText = activity.ActivityText, PostCategory = activity.ActivityCategoryNavigation.CategoryName, PostUploadDate = activity.ActivityUploadDate, PostLastEditedDate = activity.ActivityEditDate, PostArchivedDate = DateTime.Now }; _context.Archives.Add(archive); _context.Activities.Remove(activity); if (oldImage != null) { TTLRemoveUnusedImage(null, oldImage); } await _context.SaveChangesAsync(); return(RedirectToAction(nameof(AllActivities))); }
public void CopyFrom(object original) { if (original is null) { throw new ArgumentNullException(nameof(original)); } var src = (Template)original; Name = src.Name; Description = src.Description; foreach (var t in src.Tags) { Tags.Add(t); } foreach (var a in src.Alarms) { Alarms.Add(a); } foreach (var z in src.Archives) { Archives.Add(z); } foreach (var d in src.DeviceToTemplates) { DeviceToTemplates.Add(d); } }
/// <summary> /// Returns true if OrgApacheSlingCommonsMetricsRrd4jImplCodahaleMetricsReporterProperties instances are equal /// </summary> /// <param name="other">Instance of OrgApacheSlingCommonsMetricsRrd4jImplCodahaleMetricsReporterProperties to be compared</param> /// <returns>Boolean</returns> public bool Equals(OrgApacheSlingCommonsMetricsRrd4jImplCodahaleMetricsReporterProperties other) { if (other is null) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return (( Datasources == other.Datasources || Datasources != null && Datasources.Equals(other.Datasources) ) && ( Step == other.Step || Step != null && Step.Equals(other.Step) ) && ( Archives == other.Archives || Archives != null && Archives.Equals(other.Archives) ) && ( Path == other.Path || Path != null && Path.Equals(other.Path) )); }
public static GameFont HiResFromGameData() { using (DisposableStack disposables = new DisposableStack(2)) { GameImage firstImage, secondImage; ArchiveDirectoryEntry mainDirectory = Archives.GetEntry <ArchiveDirectoryEntry>(MainPath); ArchiveDirectoryEntry menuDirectory = Archives.GetEntry <ArchiveDirectoryEntry>(MenuPath); ArchiveDirectoryEntry hiresDirectory = menuDirectory.GetChildEntry <ArchiveDirectoryEntry>(HiResDirectoryName); ArchiveFileEntry tdwEntry = mainDirectory.GetChildEntry <ArchiveFileEntry>(HiResCharactersWidthsFileName); ArchiveFileEntry image01 = hiresDirectory.GetChildEntry <ArchiveFileEntry>(HiResFontImage1FileName); ArchiveFileEntry image02 = hiresDirectory.GetChildEntry <ArchiveFileEntry>(HiResFontImage2FileName); byte[] widths; using (TdwFileReader tdwReader = new TdwFileReader(tdwEntry.OpenReadableContentStream())) widths = tdwReader.Table; using (TexFileReader texReader = new TexFileReader(image01.OpenReadableContentStream())) { firstImage = GameImageReader.FromTex(texReader); disposables.Add(firstImage.Layer); } using (TexFileReader texReader = new TexFileReader(image02.OpenReadableContentStream())) secondImage = disposables.Add(GameImageReader.FromTex(texReader)); int x = firstImage.X; int y = firstImage.Y; GLTexture palettes = firstImage.Palettes; GLTexture layer = GLTextureFactory.HorizontalJoin(firstImage.Layer, secondImage.Layer); GameImage image = new GameImage(x, y, layer, palettes); return(new GameFont(image, widths)); } }
public static bool TryGetArchivePath(string path, out string archive, out string file) { if (path is null) { throw new ArgumentNullException(nameof(path)); } foreach (var extension in SupportedExtensions) { var split = path.Split(new[] { extension }, 2, StringSplitOptions.None); if (split.Length == 2) { archive = split[0] + extension; file = split[1]; while (Path.IsPathRooted(file)) { file = file.Substring(1); } lock (Lock) { return(Archives.ContainsKey(archive) || System.IO.File.Exists(archive)); } } } archive = string.Empty; file = string.Empty; return(false); }
public void LoadBookmarks() { SortBy.Clear(); foreach (var n in Archives.Namespaces) { SortBy.Add(n); } SortByIndex = SortBy.IndexOf(Settings.SortByDefault); OrderBy = Settings.OrderByDefault; if (Settings.OpenBookmarksStart && Archives.Archives.Count > 0) { foreach (var b in Settings.Profile.Bookmarks) { var archive = Archives.GetArchive(b.archiveID); if (archive != null) { Archives.OpenTab(archive, false); } else { WeakReferenceMessenger.Default.Send(new ShowNotification("Bookmarked Archive with ID[" + b.archiveID + "] not found.", "")); } } } Settings.Profile.MarkedAsNonDuplicated.RemoveAll(hit => !(Archives.HasArchive(hit.Left) && Archives.HasArchive(hit.Right))); }
public async Task Refresh() { if (_internalLoadingArchives) { return; } _internalLoadingArchives = true; RefreshOnErrorButton = false; ArchiveList.Clear(); LoadingArchives = true; foreach (var b in Settings.Profile.Bookmarks) { var archive = Archives.GetArchive(b.archiveID); if (archive != null) { Tabs.CloseTabWithId(archive.title); } } await Archives.ReloadArchives(); LoadBookmarks(); Page = 0; LoadingArchives = false; _internalLoadingArchives = false; }
#pragma warning restore 0169 public ConfirmRestoreWindow(Archives a, int book_Num, string archiveDrive) { arc = a; arcDrivePath = archiveDrive; bookNum = book_Num; pmsutil = new PMSUtil(); InitializeComponent(); }
public void detectGames() { Games.detectGames(); Archives.DetectBackups(); Monitor.Monitor.flushQueue(); updater = new Updater.Updater(Games.xml, Games.GameDataFolder); Core.monitor.start(); }
public ActionResult DeleteConfirmed(int id) { Archives archives = db.Archives.Find(id); db.Archives.Remove(archives); db.SaveChanges(); return(RedirectToAction("Index")); }
private void InitWorkspace() { _archives = new Archives(Database.ARCHIVES); _envStorage = new EnvironmentStorage(Database.ENVIRONMENTS); _logs = new Logs(Database.ENVIRONMENTS); _archives.Initialize(archivesListBox); _logs.Initialize(logsListBox); }
public static void UpdateArchives(Archives entity) { ISession session = SessionFactory.OpenSession(); { session.Update(entity); session.Flush(); } }
internal static void Create(string filePath) { var zipFilePath = ZipFilePath(); var sourceFilePath = SourceFilePath(filePath); var sourceFileName = SourceFileName(sourceFilePath); Archives.Zip(filePath, zipFilePath, sourceFileName, Directories.Temp()); }
/// <summary> /// Gets the RiotArhiveFile associated with the specified path. /// </summary> /// <param name="path">The path of the RiotArchiveFile to get.</param> /// <param name="file">When this method returns, if the key is found, contains the RiotArchiveFile associated with the specified key; otherwise, null.</param> /// <returns><c>true</c> if this RiotArchive contains an element with the specified key; otherwise, <c>false</c>.</returns> public bool TryGetValue(string path, out RiotArchiveFile file) { RiotArchiveFile outFile = null; var result = Archives.Any(a => a.TryGetValue(path, out outFile)); file = outFile; return(result); }
/// <summary> /// 格式化输出 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void dataGridView_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e) { Archives vehicle = dataGridView.Rows[e.RowIndex].DataBoundItem as Archives; if (dataGridView.Columns[e.ColumnIndex].Name == "DateColumn") { e.Value = vehicle.SaveDate.ToString("yyyy年MM月dd日"); } }
/// <summary> /// Adds the provided Archive to the collection.</summary> /// <param name="writeToDb">If true, the object will be written to the Database.</param> private async Task AddArchiveAsync(Archive archive, bool writeToDb) { Archives.Add(archive); if (writeToDb) { await Database.InsertArchiveAsync(archive); } }
//结课资料 protected void btnUpload_Click(object sender, EventArgs e) { List<int> listArchiveItemIds = new List<int>(); List<string> listArchivesAttachmentIds = new List<string>(); DalOperationAboutArchives doaa = new DalOperationAboutArchives(); foreach (Control ctlTable in phUpload.Controls) { foreach (Control ctlTableRow in ctlTable.Controls) { foreach (Control ctlTableCell in ctlTableRow.Controls) { foreach (Control ctl in ctlTableCell.Controls) { string _type = ctl.GetType().ToString(); if (_type == "System.Web.UI.WebControls.HiddenField") { if (ctl.ID.StartsWith("hid_")) { listArchiveItemIds.Add(int.Parse(ctl.ID.Split("_".ToCharArray())[1])); } else if (ctl.ID.StartsWith("hidAttachmentId")) { listArchivesAttachmentIds.Add(((HiddenField)ctl).Value); } } } } } } Archives archives = new Archives { courseNo = Request["courseNo"], classID = Server.UrlDecode(Request["classID"]), termTag = Request["termTag"].Trim(), teacherType = Master.teacherType }; for (int i = 0; i < listArchiveItemIds.Count; i++) { archives.archiveItemId = listArchiveItemIds[i]; archives.attachmentIds = listArchivesAttachmentIds[i]; //判断是否存在课程结课资料记录,并返回archiveId int archiveId = doaa.IsExistArchivesBycourseNo(Master.courseNo, Master.classID, Master.termtag, Master.teacherType, archives.archiveItemId); if (archiveId != 0) { archives.archiveId = archiveId; doaa.UpdateArchives(archives); Javascript.ExcuteJavascriptCode("delBeforeUnloadEvent();", Page); Javascript.AlertAndRedirect("上传成功!", "CInfoAttachment.aspx?courseNo=" + archives.courseNo + "&classID=" + Master.classID + "&termtag=" + Master.termtag + "&teacherType=" + Master.teacherType, Page); } else { doaa.AddArchives(archives); Javascript.ExcuteJavascriptCode("delBeforeUnloadEvent();", Page); Javascript.AlertAndRedirect("上传成功!", "CInfoAttachment.aspx?courseNo=" + archives.courseNo + "&classID=" + Master.classID + "&termtag=" + Master.termtag + "&teacherType=" + Master.teacherType, Page); } } }