public static NodeUIPolicy CreateUIPolicy(Attachments.Attach attach) { if (attach != null) { Type type = Type.GetType("Behaviac.Design.NodeUI." + attach.ExportClass + "UIPolicy"); if (type != null) return (NodeUIPolicy)Activator.CreateInstance(type); } return new NodeUIPolicy(); }
private void AddFile(FileModel file) { if (file.Downloaded != true) { FilesAwaiting.Add(file); _parent.DownloadClient.DownloadQueue.Add(file); return; } Attachments.Add(file); this.Dispatcher.Invoke(() => { FileListItem listItem = new FileListItem(file); listItem.AllowDownload = false; listItem.AllowRename = false; listItem.RemoveFile += ListItem_RemoveFile; FileList.Children.Add(listItem); }); }
private void InitializeComponent() { this.TabControl1.InitTabPage(); this.UpdateUserGroupInf.Click += new EventHandler(this.UpdateUserGroupInf_Click); this.radminid.Items.Add(new ListItem("请选择 ", "0")); foreach (var current in UserGroup.GetAdminUserGroup()) { this.radminid.Items.Add(new ListItem(current.GroupTitle, current.ID.ToString())); } DataTable attachmentType = Attachments.GetAttachmentType(); this.attachextensions.AddTableData(attachmentType); string @string = Request["groupid"]; if (@string != "") { this.LoadUserGroupInf(DNTRequest.GetInt("groupid", -1)); return; } base.Response.Redirect("sysglobal_sysadminusergroupgrid.aspx"); }
public ComponentObject(Component component) { this.Id = component.Id; this.IsActive = component.IsActive; this.Certificate = component.Certificate; this.Type = component.Type; this.Number = component.Number; this.Length = component.Length; this.IsAvailableToJoint = component.IsAvailableToJoint; this.ConstructionStatus = component.ConstructionStatus; this.InspectionStatus = component.InspectionStatus; if (component.Attachments != null) { this.Attachments = new List <FileObject>(); foreach (var file in component.Attachments) { Attachments.Add(new FileObject(file)); } } }
private void DeleteAll_Click(object sender, EventArgs e) { #region 直接全部删除 if (this.CheckCookie()) { DataTable dt = Attachments.GetAttachList(ViewState["condition"].ToString(), Posts.GetPostTableName()); string aid = "0"; foreach (DataRow dr in dt.Rows) { DeleteFile(dr["filename"].ToString()); aid += "," + dr["aid"].ToString(); } Attachments.DeleteAttachment(aid); AdminVistLogs.InsertLog(this.userid, this.username, this.usergroupid, this.grouptitle, this.ip, "删除附件", "ID:" + aid); base.RegisterStartupScript("PAGE", "window.location.href='forum_searchattchment.aspx';"); } #endregion }
protected void SyncChangedAttachmentFolders() { string sel, hostpath, remotepath; //SFTPInterface sftpi = new SFTPInterface(); //sel = @"select LogX, ERefNo = null from _Attachments where changed = 1 union select LogX = null, ERefNo from _Attachments where changed = 1"; sel = @"select LogX, ERefNo from _Attachments where changed = 1"; AttachmentCollection changed = Attachments.GetCollection(sel); foreach (Attachment a in changed) { hostpath = GetHostPathToThisAttachment(a.Logx, a.ERefNo); remotepath = GetRemotePathToThisAttachment(a.Logx, a.ERefNo); int xxx = 0; xxx = SFTPInterface.SynchronizeAttachmentFolder(remotepath, hostpath); if (xxx == 0) { Attachment.ClearAttachmentChangedFlag(a); } } }
public static int CountNonEmbeddedAttachments(this Attachments attachments) { int cnt = 0; if (attachments != null) { // any attachments? if (attachments.Count > 0) { // iterate attachments foreach (Attachment attachment in attachments) { if (!attachment.IsEmbedded()) { cnt++; } } } } return(cnt); }
public bool IsValid() { return(!string.IsNullOrEmpty(Name) && !string.IsNullOrEmpty(Title) && !string.IsNullOrEmpty(Description) && Uri.IsWellFormedUriString(Url.ToString(), UriKind.RelativeOrAbsolute) && Uri.IsWellFormedUriString(ParentStoryUrl.ToString(), UriKind.RelativeOrAbsolute) && KeyIdentifiers != null && KeyIdentifiers.Any() ? KeyIdentifiers.All(s => s.IsValid()) : true && TestCases != null && TestCases.Any() ? TestCases.All(s => s.IsValid()) : true && Checkups != null && Checkups.Any() ? Checkups.All(s => s.IsValid()) : true && Attachments != null && Attachments.Any() ? Attachments.All(s => Uri.IsWellFormedUriString(s.Value, UriKind.RelativeOrAbsolute)) : true && Queries != null && Queries.Any() ? Queries.All(s => Uri.IsWellFormedUriString(s.Value, UriKind.RelativeOrAbsolute)) : true && Scripts != null && Scripts.Any() ? Scripts.All(s => Uri.IsWellFormedUriString(s.Value, UriKind.RelativeOrAbsolute)) : true && SubTasks.Any() ? SubTasks.All(s => s.IsValid()) : true); }
private void DelRec_Click(object sender, EventArgs e) { #region 除相关的附件类型 if (this.CheckCookie()) { if (DNTRequest.GetString("id") != "") { Attachments.DeleteAttchType(DNTRequest.GetString("id")); AdminVistLogs.InsertLog(this.userid, this.username, this.usergroupid, this.grouptitle, this.ip, "删除附件类型", "删除附件类型,ID为:" + DNTRequest.GetString("id").Replace("0 ", "")); Response.Redirect("forum_attachtypesgrid.aspx"); } else { base.RegisterStartupScript("", "<script>alert('您未选中任何选项');window.location.href='forum_attachtypesgrid.aspx';</script>"); } } #endregion }
//function used whenever equipment gets changed public void ChangeEquipment(Attachments newEquip) { Attachments.Slot slot = newEquip.GetSlot(); //checks the slot of the new attachment and equips the new equipment to the corresponding slot switch (slot) { default: case Attachments.Slot.Weapon: currentlyEquipped[0] = newEquip; break; case Attachments.Slot.Armour: currentlyEquipped[1] = newEquip; break; case Attachments.Slot.Wheels: currentlyEquipped[2] = newEquip; break; } }
public static string OrignalFileName(int organizationID, int userID) { string originalFileName; { Attachments attachments = new Attachments(LoginUser.Anonymous); attachments.LoadByReference(ReferenceType.UserPhoto, userID); StringBuilder path = new StringBuilder(); if (attachments.Count > 0) { path.Append(AttachmentPath.GetPath(LoginUser.Anonymous, organizationID, AttachmentPath.Folder.ProfileImages, (int)attachments[0].FilePathID)); } else { path.Append(AttachmentPath.GetPath(LoginUser.Anonymous, organizationID, AttachmentPath.Folder.ProfileImages)); } originalFileName = AttachmentPath.GetImageFileName(path.ToString(), userID.ToString() + "avatar"); } return(originalFileName); }
/// <summary> /// Gets the related information for the post. /// </summary> private void GetRelated() { PostTemplate pt = PostTemplate.GetSingle(((Post)Post).TemplateId); // Get categories Categories = Category.GetByPostId(Post.Id); // Properties if (pt.Properties.Count > 0) { foreach (string str in pt.Properties) { ((IDictionary <string, object>)Properties).Add(str, ""); } Property.GetContentByParentId(Post.Id, ((Post)Post).IsDraft).ForEach(pr => { if (((IDictionary <string, object>)Properties).ContainsKey(pr.Name)) { ((IDictionary <string, object>)Properties)[pr.Name] = pr.Value; } }); } // Attachments ((Models.Post)Post).Attachments.ForEach(a => Attachments.Add(Models.Content.GetSingle(a, ((Post)Post).IsDraft))); // Extensions foreach (var ext in ((Post)Post).GetExtensions()) { object body = ext.Body; if (body != null) { var getContent = body.GetType().GetMethod("GetContent"); if (getContent != null) { body = getContent.Invoke(body, new object[] { this }); } } ((IDictionary <string, object>)Extensions)[ExtensionManager.Current.GetInternalIdByType(ext.Type)] = body; } }
public AttachmentData download(int attachmentId) { AttachmentData jd = new AttachmentData(); Attachments attachment = null; using (ISession session = NHibernateHelper.OpenSession()) { try { attachment = session.Get <Attachments>(attachmentId); } catch (Exception e) { } } string filePath = ""; if (attachment.RelateType == "K") { filePath = Path.Combine(ConfigurationManager.AppSettings["IMIND_UPLOADPATH"] + "knowledges/", attachment.FileName); } else if (attachment.FolderName == "../uploads/requests/aero/") { filePath = Path.Combine(ConfigurationManager.AppSettings["IMIND_UPLOADPATH"] + "requests/aero/", attachment.FileName); } else { filePath = Path.Combine(ConfigurationManager.AppSettings["IMIND_UPLOADPATH"] + "requests/", attachment.FileName); } if (!File.Exists(filePath)) { filePath = Server.MapPath("no_pictures.jpg"); } jd.bytes = File.ReadAllBytes(filePath); // jd.bytes = new byte[fs.Length]; // fs.Read(jd.bytes, 0, (int)fs.Length); jd.fileName = attachment.OriginalFilename; jd.fileType = attachment.FileType; return(jd); }
internal QueryParameters ToApiParameters(bool toCreate) { var parameters = new QueryParameters(); parameters.Add("summary", Summary, toCreate); parameters.Add("issueTypeId", Type.Id, toCreate); parameters.Add("priorityId", Priority.Id, toCreate); parameters.Add("description", Description ?? ""); parameters.Add("dueDate", DueDate?.ToString("yyyy-MM-dd") ?? ""); parameters.Add("startDate", StartDate?.ToString("yyyy-MM-dd") ?? ""); parameters.AddRange("categoryId[]", Categories.Select(x => x.Id)); parameters.AddRange("versionId[]", Versions.Select(x => x.Id)); parameters.AddRange("milestoneId[]", Milestones.Select(x => x.Id)); parameters.AddRange("attachmentId[]", Attachments.Select(x => x.Id)); parameters.Add("parentIssueId", ParentTicketId?.ToString() ?? ""); parameters.Add("estimatedHours", EstimatedHours?.ToString() ?? ""); parameters.Add("actualHours", ActualHours?.ToString() ?? ""); parameters.Add("assigneeId", Assignee?.Id.ToString() ?? ""); if (!toCreate) { parameters.Add("statusId", Status?.Id.ToString() ?? ""); parameters.Add("resolutionId", Resolution?.Id.ToString() ?? ""); } if (CustomFields != null) { foreach (var field in CustomFields) { parameters.Add($"customField_{field.Id}", field.ToJsonValue()); if (field.OtherValue != null) { parameters.Add($"customField_{field.Id}_otherValue", field.OtherValue); } } } return(parameters); }
private void Btn_View_Click(object sender, RoutedEventArgs e) { attach = Registration.unit.Attachments.Get(a => a.FilmsId == id && a.UsersID == userId).FirstOrDefault(); var converter = new System.Windows.Media.BrushConverter(); var brush = (Brush)converter.ConvertFromString("#c3dbce"); if (attach != null) { if (item.Background == Brushes.White) { item.Background = brush; attach.CheckView = true; Registration.unit.Attachments.Update(attach); Registration.unit.Save(); checkViews = false; } else { item.Background = Brushes.White; attach.CheckView = false; Registration.unit.Attachments.Update(attach); Registration.unit.Save(); checkViews = true; } } else { if (item.Background == Brushes.White) { Attachments attach = new Attachments(); item.Background = brush; attach.UsersID = userId; attach.FilmsId = id; attach.CheckView = true; Registration.unit.Attachments.Create(attach); Registration.unit.Save(); checkViews = false; } } }
private void radminid_SelectedIndexChanged(object sender, EventArgs e) { #region 绑定关联用户组信息 UserGroupInfo radminUserGroupInfo = UserGroups.GetUserGroupInfo(int.Parse(radminid.SelectedValue)); if (radminUserGroupInfo != null) { //设置管理组初始化信息 //DataRow usergrouprights = usergrouprightstable.Rows[0]; creditshigher.Text = radminUserGroupInfo.Creditslower.ToString(); creditslower.Text = radminUserGroupInfo.Creditslower.ToString(); stars.Text = radminUserGroupInfo.Stars.ToString(); color.Text = radminUserGroupInfo.Color; groupavatar.Text = radminUserGroupInfo.Groupavatar; readaccess.Text = radminUserGroupInfo.Readaccess.ToString(); maxprice.Text = radminUserGroupInfo.Maxprice.ToString(); maxpmnum.Text = radminUserGroupInfo.Maxpmnum.ToString(); maxsigsize.Text = radminUserGroupInfo.Maxsigsize.ToString(); maxattachsize.Text = radminUserGroupInfo.Maxattachsize.ToString(); maxsizeperday.Text = radminUserGroupInfo.Maxsizeperday.ToString(); DataTable dt = Attachments.GetAttachmentType(); attachextensions.AddTableData(dt, radminUserGroupInfo.Attachextensions); } AdminGroupInfo radminUserGroup = AdminGroups.GetAdminGroupInfo(int.Parse(radminid.SelectedValue)); if (radminUserGroup != null) { //设置管理权限组初始化信息 //DataRow dr = admingrouprights.Rows[0]; admingroupright.SelectedIndex = -1; admingroupright.Items[0].Selected = radminUserGroup.Alloweditpost == 1; admingroupright.Items[1].Selected = radminUserGroup.Alloweditpoll == 1; admingroupright.Items[2].Selected = radminUserGroup.Allowdelpost == 1; admingroupright.Items[3].Selected = radminUserGroup.Allowmassprune == 1; admingroupright.Items[4].Selected = radminUserGroup.Allowviewip == 1; admingroupright.Items[5].Selected = radminUserGroup.Allowedituser == 1; admingroupright.Items[6].Selected = radminUserGroup.Allowviewlog == 1; admingroupright.Items[7].Selected = radminUserGroup.Disablepostctrl == 1; } #endregion }
/// <summary> /// Adds the specified entity. /// </summary> /// <param name="entity">The entity.</param> /// <returns></returns> public AttachmentModel Add(AttachmentModel Model, string userEmail, string SentBy) { try { //var result = AttachmentMapper<AttachmentsModel, Attachments>.Map(entity); var user = LoggedInUser(userEmail); Attachments attachments = new Attachments() { AccountId = Model.AccountId, AttachmentId = Model.AttachmentId, CreationDate = DateTime.Now, DeletedOn = Model.DeletionDate, DownloadUrl = Model.DownloadUrl, ExpiriedOn = Model.ExpiryDate, PurgedOn = Model.ExpiryDate.AddDays(3), Name = Model.Name, TotalSize = Model.TotalSize, Status = Model.Status, UserId = user.Id, SentBy = SentBy == "Guest" ? (int)AttachmentSentByEnum.GuestSent : (int)AttachmentSentByEnum.WebSent, GuestLinkId = Model.GuestLinkID == 0 ? 0 : Model.GuestLinkID }; m_AttachmentRepository.Add(attachments); Model.AttachmentId = attachments.AttachmentId; Model.DownloadUrl = attachments.DownloadUrl + "/" + attachments.AttachmentId; Model.SentBy = attachments.SentBy == (int)AttachmentSentByEnum.GuestSent ? AttachmentSentByEnum.GuestSent.ToString() : AttachmentSentByEnum.WebSent.ToString(); this.m_LogService.LogActivity((int)LogsActivityType.FileUpload, "File Uploaded by Guest User", (int)attachments.AttachmentId, "Attachment", user.Id); return(Model); } catch (Exception ex) { var message = string.Format("{0} {1} {2}", ex.InnerException == null ? ex.Message : ex.InnerException.Message, Environment.NewLine, ex.StackTrace); throw new Exception(message); } }
protected override void OnClosed(EventArgs e) { base.OnClosed(e); if (this.session != null) { this.session.Dispose(); this.session = null; } if (Attachments?.Any() ?? false) { Attachments.ForEach(x => { if (x.ContentStream != null) { x.ContentStream.Dispose(); } }); Attachments.Clear(); } }
public ActionResult Edit([Bind(Include = "Id,TicketsId,SubmitterId,Body,MediaUrl,OwnerId,Created,Updated")] Attachments attachment, HttpPostedFileBase image) { if (ModelState.IsValid) { attachment = db.Attachments.Find(image); var fileName = Path.GetFileName(image.FileName); var uniqueId = DateTime.Now.Ticks; fileName = Regex.Replace(fileName, @"[!@#$%_\s]", ""); image.SaveAs(Path.Combine(Server.MapPath("~/fileUpload/"), uniqueId + fileName)); attachment.MediaUrl = "/fileUpload/" + uniqueId + fileName; var ticket = db.Tickets.Find(attachment.Tickets); attachment.UserId = User.Identity.GetUserId(); ticket = db.Tickets.Find(attachment.Tickets); var assignedUserId = ticket.AssignedUserId; db.Entry(attachment).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.OwnerId = new SelectList(db.Users, "Id", "FirstName", attachment.SubmitterId); ViewBag.TicketsId = new SelectList(db.Tickets, "Id", "OwnerId", attachment.Tickets); return(View(attachment)); }
public override int GetHashCode() { unchecked { var hashCode = base.GetHashCode(); hashCode = (hashCode * 397) ^ (_emailSender != null ? _emailSender.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (_dataObject != null ? _dataObject.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (_password != null ? _password.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (_selectedEmailSource != null ? _selectedEmailSource.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (FromAccount != null ? FromAccount.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (To != null ? To.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (Cc != null ? Cc.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (Bcc != null ? Bcc.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (int)Priority; hashCode = (hashCode * 397) ^ (Subject != null ? Subject.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (Attachments != null ? Attachments.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (Body != null ? Body.GetHashCode() : 0); hashCode = (hashCode * 397) ^ IsHtml.GetHashCode(); hashCode = (hashCode * 397) ^ (Result != null ? Result.GetHashCode() : 0); return(hashCode); } }
public static string DeleteAttachment(RestCommand command, int assetID, int attachmentID) { Asset asset = Assets.GetAsset(command.LoginUser, assetID); if (asset.OrganizationID != command.Organization.OrganizationID) { throw new RestException(HttpStatusCode.Unauthorized); } Attachment attachment = Attachments.GetAttachment(command.LoginUser, attachmentID); if (attachment.OrganizationID != command.Organization.OrganizationID) { throw new RestException(HttpStatusCode.Unauthorized); } if (attachment.RefID != asset.AssetID) { throw new RestException(HttpStatusCode.Unauthorized); } Attachments.DeleteAttachmentAndFile(command.LoginUser, attachmentID); return(attachment.Collection.GetXml("Attachments", "Attachment", true, command.Filters)); }
private void InnerAddAttachment(string fieldPath, string fileName, bool isInline, string cidName) { // 因为Attachment中存储的时FilePath对应文件的Stream,所以这边在获取FileInfo信息的时候,同时转化为Stream传递给Attachment实例, // 避免再次根据FilePath获取文件内容 FileInfo file = new FileInfo(fieldPath); Stream stream = file.Open(FileMode.Open, FileAccess.Read, FileShare.Read); Attachment data = new Attachment(stream, String.Empty); data.NameEncoding = Encoding.UTF8; //实例邮件内容 ContentDisposition disposition = data.ContentDisposition; if (isInline) { disposition.Inline = true; // 设置此附件的 MIME 内容 ID。 data.ContentId = cidName; } // 设置文件附件的创建日期。 disposition.CreationDate = file.CreationTime; // 设置文件附件的修改日期。 disposition.ModificationDate = file.LastWriteTime; // 设置文件附件的读取日期。 disposition.ReadDate = file.LastAccessTime; // 设定文件名称 (内嵌资源设置文件名后下载下来才有默认后缀) if (String.IsNullOrEmpty(fileName)) { disposition.FileName = file.Name.ToString(); } else { disposition.FileName = fileName + Path.GetExtension(fieldPath); } Attachments.Add(data); }
public void UpdateInventoryCategories() { Injectors.Clear(); Attachments.Clear(); Relic.Clear(); foreach (var gameItem in _inventory) { if (gameItem is Injector) { Injectors.Add(gameItem); } if (gameItem is Attachment) { Attachments.Add(gameItem); } if (gameItem is Relic) { Relic.Add(gameItem); } } }
void IWorkItemManager.AttachAndInlineFiles(int workItemId, IEnumerable <Tuple <string, IIncomingEmailAttachment> > fileList) { foreach (var filename in fileList.Where(filename => !File.Exists(filename.Item1))) { Logger.ErrorFormat("Couldn't find attachment file {0}", filename.Item1); } if (ThrowOnAttachFiles != null) { throw ThrowOnAttachFiles; } if (!Attachments.ContainsKey(workItemId)) { Attachments[workItemId] = new List <string>(); } foreach (var filename in fileList.Where(filename => File.Exists(filename.Item1))) { Attachments[workItemId].Add(filename.Item1); } }
private List <IEmail> FindAndReplaceVariablesInEmails(List <IEmail> emailTemplates, Variables _variables) { var generatedEmails = emailTemplates; foreach (var email in generatedEmails) { email.Subject = FindAndReplaceVariablesInString(email.Subject, Variables); email.Body = FindAndReplaceVariablesInString(email.Body, Variables); var newRecipients = new Recipients(); foreach (var recipient in email.Recipients) { newRecipients.Add(FindAndReplaceVariablesInString(recipient, Variables)); } email.Recipients.Clear(); foreach (var newR in newRecipients) { email.Recipients.Add(newR); } var newAttachments = new Attachments(); foreach (var attachment in email.Attachments) { newAttachments.Add(FindAndReplaceVariablesInString(attachment, Variables)); } email.Attachments.Clear(); foreach (var newA in newAttachments) { email.Attachments.Add(newA); } } return(generatedEmails); }
protected bool Equals(CalendarEvent other) { var resourcesSet = new HashSet <string>(StringComparer.OrdinalIgnoreCase); resourcesSet.UnionWith(Resources); var result = Equals(DtStart, other.DtStart) && Equals(DtEnd, other.DtEnd) && string.Equals(Location, other.Location, StringComparison.OrdinalIgnoreCase) && resourcesSet.SetEquals(other.Resources) && Status.Equals(other.Status) && IsActive() == other.IsActive() && Transparency.Equals(other.Transparency) && EvaluationIncludesReferenceDate == other.EvaluationIncludesReferenceDate && Attachments.SequenceEqual(other.Attachments) && CollectionHelpers.Equals(ExceptionDates, other.ExceptionDates) && CollectionHelpers.Equals(ExceptionRules, other.ExceptionRules) && CollectionHelpers.Equals(RecurrenceRules, other.RecurrenceRules, true) && CollectionHelpers.Equals(RecurrenceDates, other.RecurrenceDates, true); return(result); }
/// <inheritdoc/> public override async Task <DialogTurnResult> BeginDialogAsync(DialogContext dc, object options = null, CancellationToken cancellationToken = default(CancellationToken)) { if (options is CancellationToken) { throw new ArgumentException($"{nameof(options)} cannot be a cancellation token"); } if (Disabled != null && Disabled.GetValue(dc.State)) { return(await dc.EndDialogAsync(cancellationToken : cancellationToken).ConfigureAwait(false)); } Activity activity = null; if (Attachments != null) { activity = await Attachments.BindAsync(dc, dc.State).ConfigureAwait(false); } if (activity?.Attachments?.Any() != true) { throw new InvalidOperationException($"Missing attachments in {Kind}."); } var layout = AttachmentLayout.GetValue(dc.State); var attachments = activity.Attachments.Select(a => new MessagingExtensionAttachment(a.ContentType, null, a.Content)); var result = new MessagingExtensionResult { Type = MEResultResponseType.result.ToString(), AttachmentLayout = layout.ToString(), Attachments = attachments.ToList(), }; var invokeResponse = CreateMessagingExtensionInvokeResponseActivity(dc, result); ResourceResponse resourceResponse = await dc.Context.SendActivityAsync(invokeResponse, cancellationToken : cancellationToken).ConfigureAwait(false); return(await dc.EndDialogAsync(resourceResponse, cancellationToken : cancellationToken).ConfigureAwait(false)); }
public override int GetHashCode() { unchecked { var hashCode = (Project != null ? Project.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (Tracker != null ? Tracker.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (Status != null ? Status.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (Priority != null ? Priority.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (Author != null ? Author.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (Category != null ? Category.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (Subject != null ? Subject.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (Description != null ? Description.GetHashCode() : 0); hashCode = (hashCode * 397) ^ StartDate.GetHashCode(); hashCode = (hashCode * 397) ^ DueDate.GetHashCode(); hashCode = (hashCode * 397) ^ DoneRatio.GetHashCode(); hashCode = (hashCode * 397) ^ PrivateNotes.GetHashCode(); hashCode = (hashCode * 397) ^ EstimatedHours.GetHashCode(); hashCode = (hashCode * 397) ^ SpentHours.GetHashCode(); hashCode = (hashCode * 397) ^ (CustomFields != null ? CustomFields.GetHashCode() : 0); hashCode = (hashCode * 397) ^ CreatedOn.GetHashCode(); hashCode = (hashCode * 397) ^ UpdatedOn.GetHashCode(); hashCode = (hashCode * 397) ^ ClosedOn.GetHashCode(); hashCode = (hashCode * 397) ^ (Notes != null ? Notes.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (AssignedTo != null ? AssignedTo.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (ParentIssue != null ? ParentIssue.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (FixedVersion != null ? FixedVersion.GetHashCode() : 0); hashCode = (hashCode * 397) ^ IsPrivate.GetHashCode(); hashCode = (hashCode * 397) ^ TotalSpentHours.GetHashCode(); hashCode = (hashCode * 397) ^ TotalEstimatedHours.GetHashCode(); hashCode = (hashCode * 397) ^ (Journals != null ? Journals.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (Changesets != null ? Changesets.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (Attachments != null ? Attachments.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (Relations != null ? Relations.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (Children != null ? Children.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (Uploads != null ? Uploads.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (Watchers != null ? Watchers.GetHashCode() : 0); return(hashCode); } }
/// <summary> /// Format slack response /// </summary> /// <param name="responseMessage">Response received from Septa API</param> /// <param name="sourceStation">string</param> /// <param name="destStation">string</param> /// <returns>Slack formatted response for propoer slack rendering of response by slack channel</returns> private static SlackResponse FormatSlackResponse(string responseMessage, string sourceStation, string destStation) { var slackResponse = new SlackResponse(); slackResponse.text = "Next available trains"; var attachmentResponse = JsonConvert.DeserializeObject <List <ApiResponse> >(responseMessage); //create attachment object var attachmentList = new List <Attachments>(); var attachment = new Attachments(); attachment.color = "#1E98D1"; attachment.footer = "Seprr © 2020"; attachment.ts = (DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1))).TotalSeconds.ToString(); var fieldList = new List <Fields>(); foreach (var item in attachmentResponse) { attachment.text = $"*On* {item.orig_line} Line *From* {sourceStation} *To* {destStation}"; var filed = new Fields(); if (item.orig_delay.ToLower() == "on time") { filed.value = $"*Departure time : {item.orig_departure_time}* | `{item.orig_delay}`"; } else { filed.value = $"*Departure time : {item.orig_departure_time}* | `delayed by {item.orig_delay}`"; } filed.title = $"Train # {item.orig_train}"; fieldList.Add(filed); } attachment.fields = fieldList; attachmentList.Add(attachment); slackResponse.attachments = attachmentList; return(slackResponse); }
public override string ToString() { StringBuilder __sb = new StringBuilder("AFContent("); bool __first = true; if (Text != null && __isset.text) { if (!__first) { __sb.Append(", "); } __first = false; __sb.Append("Text: "); __sb.Append(Text); } if (Attachments != null && __isset.attachments) { if (!__first) { __sb.Append(", "); } __first = false; __sb.Append("Attachments: "); __sb.Append(Attachments.ToDebugString()); } if (Button != null && __isset.button) { if (!__first) { __sb.Append(", "); } __first = false; __sb.Append("Button: "); __sb.Append(Button == null ? "<null>" : Button.ToString()); } __sb.Append(")"); return(__sb.ToString()); }
public void ReplaceEmbeddedImages(ILogger log = null) { log = log ?? new NullLogger(); try { var attchments = Attachments.Where(a => a.isEmbedded && !string.IsNullOrEmpty(a.storedFileUrl)).ToList(); if (!attchments.Any()) { return; } foreach (var attach in attchments) { if (!string.IsNullOrEmpty(attach.contentId)) { HtmlBody = HtmlBody.Replace(string.Format("cid:{0}", attach.contentId.Trim('<').Trim('>')), attach.storedFileUrl); } else if (!string.IsNullOrEmpty(attach.contentLocation)) { HtmlBody = HtmlBody.Replace(string.Format("{0}", attach.contentLocation), attach.storedFileUrl); } else { //This attachment is not embedded; attach.contentId = null; attach.contentLocation = null; } } } catch (Exception ex) { log.Error("ReplaceEmbeddedImages() \r\n Exception: \r\n{0}\r\n", ex.ToString()); } }
public void AddAttachment(Attachments.Attachment attach) { _attachments.Add(attach); }
private void ZipAttachments(Attachments attachments, IEnumerable<Attachment> processedAttachments, ZipAllOptions zipAll, OlBodyFormat bodyFormat) { IFile zipfile; const string groupName = "attachments.zip"; string filename = string.Empty; string attachName = string.Empty; string tempDir = string.Empty; try { RemoveAllAttachmentsFromMsg(attachments, bodyFormat); const int iRenderingPosition = 1; zipfile = FileFactory.Create(groupName, FileType.ZIP); foreach (Attachment attachment in processedAttachments) { if (!attachment.IsSignature) { IFile attachmentFile = FileFactory.Create(attachment.FileName, attachment.Name); zipfile.Add(attachmentFile); } } SetEncryption(zipfile, zipAll); zipfile.PackContainer(zipAll.PassWord); tempDir = FileToDisk(zipfile.FileName, zipfile); attachName = Path.Combine(tempDir, zipfile.FileName); Microsoft.Office.Interop.Outlook.Attachment newAttachment = attachments.Add(attachName, OlAttachmentType.olByValue, iRenderingPosition, zipfile.DisplayName); Encoding ansiEncoding = Encoding.GetEncoding(Encoding.Default.CodePage, new EncoderExceptionFallback(), new DecoderExceptionFallback()); try { byte[] ansiBytes = ansiEncoding.GetBytes(zipfile.FileName); } catch (EncoderFallbackException /*ex*/) { newAttachment.PropertyAccessor.SetProperty(MAPIStringDefines.PR_ATTACH_LONG_FILENAME_W, zipfile.FileName); newAttachment.PropertyAccessor.SetProperty(MAPIStringDefines.PR_ATTACH_FILENAME_W, zipfile.FileName); newAttachment.PropertyAccessor.SetProperty(MAPIStringDefines.PR_DISPLAY_NAME_W, zipfile.DisplayName); } } catch (Exception ex) { Interop.Logging.Logger.LogError(ex); throw; } finally { if (!string.IsNullOrEmpty(filename) && File.Exists(filename)) { File.Delete(filename); } if (!string.IsNullOrEmpty(attachName) && File.Exists(attachName)) { File.Delete(attachName); } if (!string.IsNullOrEmpty(tempDir) && Directory.Exists(tempDir)) { Directory.Delete(tempDir); } } }
/// <summary> /// Initialises a property on a given attachment. /// </summary> /// <param name="xml">The XML element containing the attribute we want to get.</param> /// <param name="node">The attachment whose property we want to set.</param> /// <param name="property">The property on the attachment we want to set.</param> protected void InitProperty(List<Nodes.Node.ErrorCheck> result, XmlNode xml, Attachments.Attachment attach, DesignerPropertyInfo property) { string value; if (GetAttribute(xml, property.Property.Name, out value)) { property.SetValueFromString(result, attach, value); } }
private void AddRemoveConnection(AttachmentKind kind, AttachedGrid attached, bool add) { using (lock_Connections.AcquireExclusiveUsing()) { Attachments attach; if (!Connections.TryGetValue(attached, out attach)) { attach = new Attachments(myGrid, attached.myGrid); Connections.Add(attached, attach); } if (add) attach.Add(kind); else attach.Remove(kind); } }
private void ExportProperties(BsonSerializer file, Attachments.Attachment a) { file.WriteStartElement("properties"); IList<DesignerPropertyInfo> properties = a.GetDesignerProperties(); foreach (DesignerPropertyInfo p in properties) { // we skip properties which are not marked to be exported if (p.Attribute.HasFlags(DesignerProperty.DesignerFlags.NoExport)) continue; WriteProperty(file, p, a); } file.WriteEndElement(); }
private void AddAttachmentToMsg(Attachment attachment, Attachments attachments, int index, bool isAnEmbeddedEmail) { string fileName = attachment.FileName; if (isAnEmbeddedEmail) { // A subject line like // "test messed up subject line, invalid characters: /\/\ 29/04/2004\" // in an email is why LocalCopyOfFileManager.GetValidFileName() cant be used // // Change to replace invalid characters by underscore to avoid potential empty file name. e.g. ' .msg' // we need .msg extension to use Namespace.OpenSharedItem() if (!File.Exists(Path.ChangeExtension(fileName, MsgExtension))) { fileName = Path.ChangeExtension(fileName, MsgExtension); File.Copy(attachment.FileName, fileName); } _msgFileBackingCopies.Add(fileName); dynamic nameSpace = OutlookApp.GetNamespace("MAPI"); var mitem = nameSpace.OpenSharedItem(fileName); using (new ComRelease(mitem)) { var mailItem = attachments.Parent; using (new ComRelease(mailItem)) { if (mailItem != null && (Microsoft.Office.Interop.Outlook.OlBodyFormat)mailItem.BodyFormat != OlBodyFormat.olFormatRichText) { index = 1; } var newAttach = attachments.Add(mitem, OlAttachmentType.olEmbeddeditem, index, attachment.Name); using (new ComRelease(newAttach)) { var propertyAccessor = newAttach.PropertyAccessor; using (new ComRelease(propertyAccessor)) { string displayname = mitem.Subject; if (string.IsNullOrEmpty(displayname) || string.IsNullOrEmpty(displayname.Trim())) { propertyAccessor.SetProperty(MAPIStringDefines.PR_DISPLAY_NAME_W, UntitledAttachmentTitle); } else { propertyAccessor.SetProperty(MAPIStringDefines.PR_DISPLAY_NAME_W, mitem.Subject); } } } } } // need to do this to ensure mitem does not hold onto file used to create it GC.Collect(); GC.WaitForPendingFinalizers(); /////////////////////////////////////////////////////////////////////////////// } else { if (!attachment.IsSignature) { var mailItem = attachments.Parent; if (mailItem != null && (Microsoft.Office.Interop.Outlook.OlBodyFormat)mailItem.BodyFormat != OlBodyFormat.olFormatRichText) { index = 1; } attachments.Add(fileName, OlAttachmentType.olByValue, index, attachment.Name); } } }
public void LoadMsg(MessageItem item, string parentKey, string index, string parentId, Account account, string parentSender) { string source = _className + "LoadMsg"; _parentKey = parentKey; Key = index; _sender = item.Sender.SMTPAddress; _account = account; if (ThisAddIn.AppVersion < 15) { msgHdr14.LoadMessage(item.Subject, item.SenderName, string.Format("{0} {1}", item.SentOn.ToString("ddd"), item.SentOn.ToString("g")), item.To, item.CC); } else { msgHdr15.LoadMessage(item.Subject, item.SenderName, string.Format("{0} {1}", item.SentOn.ToString("ddd"), item.SentOn.ToString("g")), item.To, item.CC, false); } wb1.DocumentText = item.HTMLBody; if (Utils.HasChiaraHeader(item)) { string pointers; Utils.GetChiaraHeaders(item, out pointers, out _serverName, out _serverPort, out _encryptKey2, out _userAgent); _configuration = _account.Configurations.Values.First(config => config.Server == _serverName); if (!string.IsNullOrEmpty(pointers)) { _pointers = pointers.Split(new[] {" "}, StringSplitOptions.None); string content; string error; ContentHandler.FetchContent(account.SMTPAddress, _configuration, _sender, _pointers[0], _serverName, _serverPort, false, out content, out error); if (string.IsNullOrEmpty(error) || error == "success") { if (!string.IsNullOrEmpty(_encryptKey2)) { byte[] encrypted = Convert.FromBase64String(content); content = Encoding.UTF8.GetString( AES_JS.Decrypt(encrypted, _encryptKey2)); } wb1.DocumentText = content; } else { Logger.Warning(source,string.Format( "failed to retrieve content for {0} using pointer {1}, supplying sender {2}: {3}", item.Subject, _pointers[0], _sender, error)); } } } _attachments = item.Attachments; if (_attachments.Count.Equals(0)) { lblAttach.Visible = false; panelAttach.Visible = false; } else { //load them into the panel LoadAttachments(); } }
public void AddAttachment(Attachments.Attachment attach, int index) { Debug.Check(attach != null); _attachments.Insert(index, attach); sortAttachments(); attach.ResetId(); }
private bool RemoveAttachment(Attachments attachments, Attachment attachment) { for (int index = attachments.Count; index > 0; --index) { dynamic safeAttachment = attachments[index]; var wsAttachments = attachments as WsAttachments; foreach (CustomProperty cp in attachment.Properties) { if (cp.Name == "RecordKey") { if (wsAttachments != null) { wsAttachments.Remove(cp.Value); return true; } else { if (cp.Value == safeAttachment.RecordKey) { attachments.Remove(index); return true; } } } } } return false; }
// Use this for initialization public void start(WeaponDrop drop) { m_WeaponDrop = drop; m_Attachment = drop.GamePrefab.GetComponentInChildren<Attachments>(); m_BaseWeapon = drop.GamePrefab.GetComponentInChildren<BaseBaseWeapon>(); MiscEffects[] effects = drop.GamePrefab.GetComponentsInChildren<MiscEffects>(); if(effects.Length > 0) { m_MiscEffects = ""; for(int i = 0; i < effects.Length; i++) { m_MiscEffects += effects[i].EffectType; if(i + 1 < effects.Length) { m_MiscEffects += ", "; } } } }
/// <summary> /// Initialises a property on a given attachment. /// </summary> /// <param name="xml">The XML element containing the attribute we want to get.</param> /// <param name="node">The attachment whose property we want to set.</param> /// <param name="property">The property on the attachment we want to set.</param> protected void InitProperty(XmlNode xml, Attachments.Attachment attach, DesignerPropertyInfo property) { string value; if (GetAttribute(xml, property.Property.Name, out value)) property.SetValueFromString(attach, value); }
private void ExportProperties(XmlWriter file, Attachments.Attachment a) { DesignerPropertyInfo propertyEffector = new DesignerPropertyInfo(); IList<DesignerPropertyInfo> properties = a.GetDesignerProperties(true); foreach(DesignerPropertyInfo p in properties) { // we skip properties which are not marked to be exported if (p.Attribute.HasFlags(DesignerProperty.DesignerFlags.NoExport)) { continue; } object v = p.Property.GetValue(a, null); bool bExport = !Plugin.IsExportArray(v); if (bExport) { if (p.Property.Name == "Effectors") { propertyEffector = p; } else { // create the code which assigns the value to the node's property //file.Write(string.Format("{0}\t{1}.{2} = {3};\r\n", indent, nodeName, properties[p].Property.Name, properties[p].GetExportValue(node))); string propValue = p.GetExportValue(a); if (propValue != string.Empty && propValue != "\"\"") { file.WriteStartElement("property"); file.WriteAttributeString(p.Property.Name, propValue); file.WriteEndElement(); } } } } if (propertyEffector.Property != null) { List<TransitionEffector> listV = (List<TransitionEffector>)propertyEffector.Property.GetValue(a, null); if (listV != null) { foreach(TransitionEffector te in listV) { IList<DesignerPropertyInfo> effectorProperties = te.GetDesignerProperties(); file.WriteStartElement("attachment"); foreach(DesignerPropertyInfo p in effectorProperties) { // we skip properties which are not marked to be exported if (p.Attribute.HasFlags(DesignerProperty.DesignerFlags.NoExport)) { continue; } string propValue = p.GetExportValue(te); if (propValue != string.Empty && propValue != "\"\"") { file.WriteStartElement("property"); file.WriteAttributeString(p.Property.Name, propValue); file.WriteEndElement(); } } file.WriteEndElement(); } } } }
public SubItem GetSubItem(Attachments.Attachment attach) { if (attach != null) { for (int i = 0; i < _subItems.Count; ++i) { if (_subItems[i].SelectableObject == attach) { return _subItems[i]; } } } return null; }
public void AddAttachment(Attachments.Attachment attach, int index) { _attachments.Insert(index, attach); }
/// <summary> /// Sets the value of the property for the given event from a string. /// </summary> /// <param name="evnt">The event we want to set the value on.</param> /// <param name="valueString">The string holding the value.</param> public void SetValueFromString(List<Nodes.Node.ErrorCheck> result, Attachments.Attachment attach, string valueString) { _property.SetValue(attach, FromStringValue(result, attach, null, _property.PropertyType, valueString), null); }
/// <summary> /// Creates a new subitm which can render an attachment on the node. /// </summary> /// <param name="backgroundNormal">The background brush used when the subitem is not selected.</param> /// <param name="backgroundSelected">The background brush used when the subitem is selected. If it cannot be selected, use null.</param> /// <param name="labelFont">The font used to draw the label.</param> /// <param name="labelBrush">The brush used to draw the label.</param> protected SubItemAttachment(Attachments.Attachment attach, Brush backgroundNormal, Brush backgroundSelected, Font labelFont, Brush labelBrush) : base(backgroundNormal, backgroundSelected, labelFont, labelBrush, Alignment.Center, false) { _attachment = attach; }
private void ExportParameters(BsonSerializer file, Attachments.Attachment attachment) { Attachments.Event evt = attachment as Attachments.Event; if (evt == null || evt.Pars.Count == 0) return; file.WriteStartElement("pars"); for (int i = 0; i < evt.Pars.Count; ++i) { file.WriteStartElement("par"); file.WriteString(evt.Pars[i].Name); file.WriteString(Plugin.GetNativeTypeName(evt.Pars[i].Type)); file.WriteString(evt.Pars[i].DefaultValue); if (!string.IsNullOrEmpty(evt.Pars[i].EventParam)) { file.WriteString(evt.Pars[i].EventParam); } file.WriteEndElement(); } file.WriteEndElement(); }
private void GetAttachmentProperties(Attachments attachments, Dictionary<string, AttachmentProperties> dictAttachmentProps) { foreach (Microsoft.Office.Interop.Outlook.Attachment att in attachments) { if (att.Type == OlAttachmentType.olOLE) { // OLE attachments are currently not processed like the rest // (removed, processed, then added back to the mail item) continue; } string[] properties = { MAPIStringDefines.PR_RECORD_KEY, MAPIStringDefines.PR_ATTACH_CONTENT_ID, MAPIStringDefines.PR_ATTACHMENT_HIDDEN, MAPIStringDefines.PR_ATTACHMENT_FLAGS, MAPIStringDefines.PR_RENDERING_POSITION, MAPIStringDefines.PR_ATTACHMENT_CONTACTPHOTO, MAPIStringDefines.PR_CREATION_TIME, MAPIStringDefines.PR_LAST_MODIFICATION_TIME }; object[] propertyValues = att.PropertyAccessor.GetProperties(properties); string recordkey = GetStringFromBytes(propertyValues[0] as byte[]); if (dictAttachmentProps.ContainsKey(recordkey)) { // If the same doc is attached more than once use the same props. // TODO: this doesn't cover the case where different files are attached // but they have the same name and one is embedded while the other is attached. continue; } AttachmentProperties attProps = new AttachmentProperties(); attProps.OContentId = propertyValues[1]; attProps.OHidden = propertyValues[2]; attProps.OFlags = propertyValues[3]; attProps.OPosition = propertyValues[4]; attProps.OContactPhoto = propertyValues[5]; if (propertyValues[6] is DateTime) { attProps.CreationTime = (DateTime) propertyValues[6]; } else { attProps.CreationTime = DateTime.Now; } if (propertyValues[7] is DateTime) { attProps.LastModifiedtime = (DateTime) propertyValues[7]; } else { attProps.LastModifiedtime = DateTime.Now; } dictAttachmentProps.Add(recordkey, attProps); } }
private static void RemoveAllAttachmentsFromMsg(Attachments attachments, OlBodyFormat bodyFormat) { for (int i = attachments.Count; i > 0; i--) { Microsoft.Office.Interop.Outlook.Attachment attachment = attachments[i]; if (bodyFormat != OlBodyFormat.olFormatUnspecified) { if (OomSignatureInspector.IsSignature(attachment, bodyFormat)) continue; } attachment.Delete(); } }
private static void RemoveAllAttachment(Attachments attachments) { while (attachments.Count > 0) { attachments.Remove(1); } }
private void ExportProperties(BsonSerializer file, Attachments.Attachment a) { DesignerPropertyInfo propertyEffector = new DesignerPropertyInfo(); file.WriteStartElement("properties"); IList<DesignerPropertyInfo> properties = a.GetDesignerProperties(true); foreach(DesignerPropertyInfo p in properties) { // we skip properties which are not marked to be exported if (p.Attribute.HasFlags(DesignerProperty.DesignerFlags.NoExport)) { continue; } object v = p.Property.GetValue(a, null); bool bExport = !Plugin.IsExportArray(v); if (bExport) { if (p.Property.Name == "Effectors") { propertyEffector = p; } else { WriteProperty(file, p, a); } } } file.WriteEndElement(); if (propertyEffector.Property != null) { List<TransitionEffector> listV = (List<TransitionEffector>)propertyEffector.Property.GetValue(a, null); if (listV != null) { file.WriteStartElement("attachments"); foreach(TransitionEffector te in listV) { file.WriteStartElement("attachment"); file.WriteStartElement("properties"); IList<DesignerPropertyInfo> effectorProperties = te.GetDesignerProperties(); foreach(DesignerPropertyInfo p in effectorProperties) { // we skip properties which are not marked to be exported if (p.Attribute.HasFlags(DesignerProperty.DesignerFlags.NoExport)) { continue; } WriteProperty(file, p, te); } file.WriteEndElement(); file.WriteEndElement(); } file.WriteEndElement(); } } }
public void AddAttachment(Attachments.Attachment attach) { Debug.Check(attach != null); _attachments.Add(attach); sortAttachments(); attach.ResetId(); }
public static Attachments.Attachment GetPrefabAttachment(Attachments.Attachment instanceAttachment) { if (instanceAttachment != null && instanceAttachment.Node != null && !string.IsNullOrEmpty(instanceAttachment.Node.PrefabName)) { string fullpath = Behaviac.Design.FileManagers.FileManager.GetFullPath(instanceAttachment.Node.PrefabName); BehaviorNode behavior = Behaviac.Design.BehaviorManager.Instance.LoadBehavior(fullpath); if (behavior != null) { DefaultObject obj = Plugin.GetObjectById((Node)behavior, instanceAttachment.PrefabAttachmentId); if (obj != null && obj.GetType() == instanceAttachment.GetType()) { return (Attachments.Attachment)obj; } } } return null; }
public void RemoveAttachment(Attachments.Attachment attach) { _attachments.Remove(attach); }
private void ExportProperties(XmlWriter file, Attachments.Attachment a) { IList<DesignerPropertyInfo> properties = a.GetDesignerProperties(); foreach (DesignerPropertyInfo p in properties) { // we skip properties which are not marked to be exported if (p.Attribute.HasFlags(DesignerProperty.DesignerFlags.NoExport)) continue; // create the code which assigns the value to the node's property //file.Write(string.Format("{0}\t{1}.{2} = {3};\r\n", indent, nodeName, properties[p].Property.Name, properties[p].GetExportValue(node))); file.WriteStartElement("property"); file.WriteAttributeString(p.Property.Name, p.GetExportValue(a)); file.WriteEndElement(); } }
private void AddAttachments(StringBuilder header, Attachments attachments) { if (attachments != null && attachments.Count > 0) { header.AppendFormat("<br/><span><a onclick=\"{0}\">Attachments ({1})</a>", GetTogglingJS(), attachments.Count); header.AppendFormat("<ul class='{0}' id=\"atchContainer\" style=\"display:none;list-style:none;\" itemId='{1}'>", TOGGLING_ELEMENT_CLASS, attachments.Parent.EntryID); foreach (Attachment ATCH in attachments) { header.AppendFormat("<li><a tabindex=-1 onclick='' id='atch{0}'>{1}</a></li>", ATCH.Index, ATCH.DisplayName); } header.Append("</ul></span>"); } }
private void AddRemoveConnection(AttachmentKind kind, AttachedGrid attached, bool add) { using (lock_Connections.AcquireExclusiveUsing()) { Attachments attach; if (!Connections.TryGetValue(attached, out attach)) { if (add) { attach = new Attachments(myGrid, attached.myGrid); Connections.Add(attached, attach); } else { myLogger.alwaysLog("cannot remove, no attachments of kind " + kind, Logger.severity.ERROR); return; } } if (add) attach.Add(kind); else attach.Remove(kind); } }
public static UniversalRequestObject GetUro(Attachments attachments) { return GetUro(attachments == Attachments.AddSomeAttachments ? true : false); }
/// <summary> /// Sets the value of the property for the given event from a string. /// </summary> /// <param name="evnt">The event we want to set the value on.</param> /// <param name="valueString">The string holding the value.</param> public void SetValueFromString(Attachments.Attachment attach, string valueString) { _property.SetValue(attach, FromStringValue(attach, null, _property.PropertyType, valueString), null); }