private async void BangumiId_OnTextChanged(object sender, TextChangedEventArgs e) { var oldVal = PublishInfo.BangumiId; await Task.Delay(1000); if (PublishInfo.BangumiId != oldVal || string.IsNullOrWhiteSpace(PublishInfo.BangumiId)) { return; } try { ProgressBar.Visibility = Visibility.Visible; await PublishInfo.InitDataFromBangumi(PublishInfo.BangumiId); } catch { PublishInfo.ChsName = null; PublishInfo.JpnName = null; PublishInfo.Cover = null; } finally { ProgressBar.Visibility = Visibility.Hidden; } }
public void Should_be_able_to_get_messages_from_a_queue() { var queue = managementClient.GetQueues().SingleOrDefault(x => x.Name == testQueue); if (queue == null) { throw new ApplicationException("Test queue has not been created"); } var defaultExchange = new Exchange { Name = "amq.default", Vhost = vhostName }; var properties = new Dictionary <string, string> { { "app_id", "management-test" } }; var publishInfo = new PublishInfo(properties, testQueue, "Hello World", "string"); managementClient.Publish(defaultExchange, publishInfo); var criteria = new GetMessagesCriteria(1, false); var messages = managementClient.GetMessagesFromQueue(queue, criteria); foreach (var message in messages) { Console.Out.WriteLine("message.Payload = {0}", message.Payload); foreach (var property in message.Properties) { Console.Out.WriteLine("key: '{0}', value: '{1}'", property.Key, property.Value); } } }
/// <summary> /// To the mail message. /// </summary> /// <param name="info">The information.</param> /// <returns>MailMessage.</returns> internal static MailMessage ToMailMessage(this PublishInfo info) { var template = Templates .Get(x => x.Id == info.TemplateId) .First() as Template; if (template == null) { return(null); } template.Content = info; var msg = new MailMessage { Subject = info.Subject, From = new MailAddress(SmtpConfig.SmtpFrom), Body = template.Body }; foreach (var target in info.Targets) { msg.To.Add(new MailAddress(target)); } return(msg); }
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2201:DoNotRaiseReservedExceptionTypes")] // TODO: fix public TValue GetOrCreateValue(TKey key, Func <TValue> create) { bool lockTaken = false; try { MonitorUtils.Enter(data, ref lockTaken); PublishInfo <TValue> pubValue; if (data.TryGetValue(key, out pubValue)) { if (pubValue.Value == null && pubValue.Exception == null) { pubValue.PrepareForWait(); MonitorUtils.Exit(data, ref lockTaken); try { pubValue.WaitForPublish(); } finally { MonitorUtils.Enter(data, ref lockTaken); pubValue.FinishWait(); } } if (pubValue.Exception != null) { throw new Exception("Error", pubValue.Exception); } return(pubValue.Value); } TValue ret; // publish the empty PublishInfo data[key] = pubValue = new PublishInfo <TValue>(); // release our lock while we create the new value // then re-acquire the lock and publish the info. MonitorUtils.Exit(data, ref lockTaken); try { try { ret = create(); Debug.Assert(ret != null, "Can't publish a null value"); } finally { MonitorUtils.Enter(data, ref lockTaken); } } catch (Exception e) { pubValue.PublishError(e); throw; } pubValue.PublishValue(ret); return(ret); } finally { if (lockTaken) { Monitor.Exit(data); } } }
public void InsertPublishInfo(PublishInfo publishInfo) { var xmlNode = _xmlHelper.SerializeXmlNode(publishInfo); _xmlHelper.AppendNode(xmlNode); _xmlHelper.Save(); }
public async Task Should_be_able_to_get_messages_from_a_queue() { var queue = await CreateTestQueue(testQueue).ConfigureAwait(false); var defaultExchange = new Exchange { Name = "amq.default", Vhost = vhostName }; var publishInfo = new PublishInfo( new Dictionary <string, object> { { "app_id", "management-test" } }, testQueue, "Hello World", "string"); await managementClient.PublishAsync(defaultExchange, publishInfo).ConfigureAwait(false); foreach (var message in await managementClient.GetMessagesFromQueueAsync(queue, new GetMessagesCriteria(1, Ackmodes.ack_requeue_false)).ConfigureAwait(false)) { Console.Out.WriteLine("message.Payload = {0}", message.Payload); foreach (var property in message.Properties) { Console.Out.WriteLine("key: '{0}', value: '{1}'", property.Key, property.Value); } } }
private void buttonSelect_Unselect_Click(object sender, EventArgs e) { bool allAreChecked = DwgNameList.CheckedItems.Count == DwgNameList.Items.Count; int count = DwgNameList.Items.Count; for (int i = 0; i < count; i++) { PublishInfo info = (PublishInfo)DwgNameList.Items[i]; _checkedChangedWithoutAuthorizationDwg = true; DwgNameList.SetItemChecked(DwgNameList.Items.IndexOf(info), !allAreChecked); _checkedChangedWithoutAuthorizationDwg = false; } if (_curPubInfo != null) { int nCount = LayoutNameList.Items.Count; for (int i = 0; i < nCount; i++) { LayoutInfo info = (LayoutInfo)LayoutNameList.Items[i]; _checkedChangedWithoutAuthorizationLayout = true; LayoutNameList.SetItemChecked(LayoutNameList.Items.IndexOf(info), !allAreChecked); _checkedChangedWithoutAuthorizationLayout = false; } } }
internal static void UpdatePublishStatus(PublishInfo info, string dateTime, string text) { try { XmlDocument xd = new XmlDocument(); xd.Load(_xmlName); string xpath = "descendant::PublishInfo[DrawingName=" + "'" + info.DwgName + "']"; XmlNodeList listNode = xd.SelectNodes(xpath); if (listNode.Count == 0) { xd.Save(_xmlName); return; } XmlNode main = listNode[0]; if (main == null) { xd.Save(_xmlName); return; } foreach (XmlNode node in main.ChildNodes) { if (Same(text, pubStatusName)) { if (Same(node.Name, pubStatusName)) { node.InnerText = trueValue; } else if (Same(node.Name, idxName)) { node.InnerText = info.Index.ToString(); } else if (Same(node.Name, dwfTimeName)) { node.InnerText = dateTime; } else if (Same(node.Name, pdfTimeName)) { node.InnerText = dateTime; } } else if (Same(text, failedStatusName)) { if (Same(node.Name, failedStatusName)) { node.InnerText = GetValue(info.Failed); } } } xd.Save(_xmlName); } catch { } }
private static FileSystemOrderItem AddFileTagItem(FileListFile originalFile, uint fileId) { //find tag item var publishInfo = PublishInfo.GetPublishInfo(originalFile.FileInfo); FileSystemTagItem tagItem; if (TagItems.ContainsKey(publishInfo)) { tagItem = TagItems[publishInfo]; } else { tagItem = new FileSystemTagItem { Tag = publishInfo.Tag }; TagItems.Add(publishInfo, tagItem); FileSystem.TagItems.Add(tagItem); } //find name item string resourceName = originalFile.ResourceName; if (tagItem != null) { var nameItems = tagItem.NameItems; var nameItem = nameItems.FirstOrDefault(resourceMapNameItem => resourceMapNameItem.Name == resourceName); if (nameItem == null) { nameItem = new FileSystemNameItem { Name = resourceName }; nameItems.Add(nameItem); } //find order item uint order = originalFile.Order; var orderItems = nameItem.OrderItems; var orderItem = orderItems.FirstOrDefault(resourceMapOrderItem => resourceMapOrderItem.Order == order); if (orderItem == null) { orderItem = new FileSystemOrderItem { Order = order, FileId = fileId }; orderItems.Add(orderItem); return(orderItem); } else { var prevItem = FileListGenerator.GetFileName(orderItem.FileId); Logger.LogAll("\tDuplicate tag item:{0} in {1} & {2}\r\n", resourceName, originalFile, prevItem); } } return(null); }
public async Task <IActionResult> PublishAsync([FromBody] PublishInfo publishInfo) { if (ZLMediaKitWebHookEvents.OnPlay_IsNull) { return(Json(new PublishResult())); } SetServerInfo(publishInfo); return(Json(ZLMediaKitWebHookEvents.OnPublish_Call(publishInfo))); }
public string Serialize(PublishInfo info, IProjectFile projFile) { FilePath destinationFilePath = (FilePath)info.DestinationFilePath; string sourceFilePath = info.SourceFilePath; string des = (string)destinationFilePath.ChangeExtension(".csb"); string itemDirectory = (string)Services.ProjectOperations.CurrentSelectedSolution.ItemDirectory; return(CSCocosHelp.ConvertToBinProto(des, sourceFilePath, itemDirectory)); }
public string Serialize(PublishInfo info, IProjectFile projFile) { FilePath filePath = info.DestinationFilePath; string sourceFilePath = info.SourceFilePath; string des = filePath.ChangeExtension(".csb"); string res = Services.ProjectOperations.CurrentSelectedSolution.ItemDirectory; return(CSCocosHelp.ConvertToBinByFlat(des, sourceFilePath, res)); }
private void CopyAudio(FileListFile audioFile) { var packageInfo = PublishInfo.GetPublishInfo(audioFile.FileInfo.FullName); if (packageInfo.IsPublish(PublishTarget.Current)) { string tempFilePath = PathManager.OutputPath + Path.AltDirectorySeparatorChar.ToString() + PathManager.AudioDirectoryName + Path.AltDirectorySeparatorChar.ToString() + audioFile.FileInfo.Name; audioFile.FileInfo.CopyTo(tempFilePath); } }
public async Task Should_be_able_to_publish_to_an_exchange() { var exchange = await CreateExchange(testExchange).ConfigureAwait(false); var publishInfo = new PublishInfo(testQueue, "Hello World"); var result = await managementClient.PublishAsync(exchange, publishInfo).ConfigureAwait(false); // the testExchange isn't bound to a queue result.Routed.ShouldBeFalse(); }
private static DateTime?GetPublishedDate(Page page, TargetType targetType) { PublishInfo publishInfo = PublishEngine.GetPublishInfo(page).FirstOrDefault(pi => pi.TargetType == targetType); if (publishInfo == null) { return(null); } return(publishInfo.PublishedAt); }
public Task <PublishResult> PublishAsync(Exchange exchange, PublishInfo publishInfo, CancellationToken cancellationToken = default(CancellationToken)) { Ensure.ArgumentNotNull(exchange, nameof(exchange)); Ensure.ArgumentNotNull(publishInfo, nameof(publishInfo)); return(PostAsync <PublishInfo, PublishResult>( $"exchanges/{SanitiseVhostName(exchange.Vhost)}/{exchange.Name}/publish", publishInfo, cancellationToken)); }
public void Publish(string topic, byte[] content) { var pInfo = new PublishInfo() { Name = _name, Topic = topic, Data = content }; SendAsyncBase(QueueSocketMsgType.Publish, pInfo.ToBytes()); }
public static void WriteDefaultInfo(PublishInfo info) { TryToExecute(() => { using (StreamWriter sw = File.CreateText(_configFilePath)) { sw.WriteLine(info.ServerAddress); sw.WriteLine(info.Categ.SchoolId); sw.WriteLine(info.Categ.ClassId); } }); }
private void GetPublishInfo(out PublishInfo[] assemblyPublishInfos, out PublishInfo[] filePublishInfos, out PublishInfo[] satellitePublishInfos, out PublishInfo[] manifestEntryPointPublishInfos) { List <PublishInfo> list = new List <PublishInfo>(); List <PublishInfo> list2 = new List <PublishInfo>(); List <PublishInfo> list3 = new List <PublishInfo>(); List <PublishInfo> list4 = new List <PublishInfo>(); if (this.PublishFiles != null) { foreach (ITaskItem item in this.PublishFiles) { PublishInfo info = new PublishInfo(item); string metadata = item.GetMetadata("FileType"); if (metadata == null) { goto Label_00BA; } if (!(metadata == "Assembly")) { if (metadata == "File") { goto Label_009C; } if (metadata == "Satellite") { goto Label_00A6; } if (metadata == "ManifestEntryPoint") { goto Label_00B0; } goto Label_00BA; } list.Add(info); continue; Label_009C: list2.Add(info); continue; Label_00A6: list3.Add(info); continue; Label_00B0: list4.Add(info); continue; Label_00BA :; base.Log.LogWarningWithCodeFromResources("GenerateManifest.InvalidItemValue", new object[] { "FileType", item.ItemSpec }); } } assemblyPublishInfos = list.ToArray(); filePublishInfos = list2.ToArray(); satellitePublishInfos = list3.ToArray(); manifestEntryPointPublishInfos = list4.ToArray(); }
public static void ReadDefaultInfo(PublishInfo info) { TryToExecute(() => { using (StreamReader sw = File.OpenText(_configFilePath)) { info.ServerAddress = sw.ReadLine(); info.Categ.SchoolId = sw.ReadLine(); info.Categ.ClassId = sw.ReadLine(); } }); }
public PublishInfo ToPublishInfo() { var info = new PublishInfo(); if (!string.IsNullOrEmpty(PublicLink)) { info.Items.Add(new PublishInfoItem { Path = FullPath, Url = ConstSettings.PublishFileLink + PublicLink }); } return(info); }
public PublishInfo ToPublishInfo() { var info = new PublishInfo(); if (PublicLinks.Any()) { info.Items.Add(new PublishInfoItem { Path = FullPath, Urls = PublicLinks.Select(pli => pli.Uri).ToList() }); } return(info); }
public static PublishInfo ToConfirmationEmailInfo(this Account account) { var res = new PublishInfo() { Subject = String.Format("Confirming Your registration"), Targets = new[] { account.Email }, TemplateId = ConfirmationEmailTemplate.ID, }; res.AddParameter("EmailFirstName", account.FirstName); res.AddParameter("ActivationLink", String.Format(AuthConfig.ActivationLinkTemplate, account.Id, account.Username)); return(res); }
public override void Publish(IProgressMonitor monitor, PublishInfo info) { string text = string.Empty; if (Services.ProjectOperations.CurrentSelectedSolution != null) { text = Services.ProjectsService.SerializeGameProject(info, base.ProjectFile); } if (!string.IsNullOrEmpty(text)) { monitor.ReportError(text, null); } }
/// <summary> /// Returns the last publish date in the given <see cref="T:Tridion.ContentManager.CommunicationManagement.Publication" /> and /// given <see cref="T:Tridion.ContentManager.CommunicationManagement.PublicationTarget" /> /// </summary> /// <param name="identifiableObject"><see cref="T:Tridion.ContentManager.ContentManagement.RepositoryLocalObject" /></param> /// <param name="publication"><see cref="T:Tridion.ContentManager.CommunicationManagement.Publication" /></param> /// <param name="publicationTarget"><see cref="T:Tridion.ContentManager.CommunicationManagement.PublicationTarget" /></param> /// <returns> /// Returns <see cref="T:System.DateTime" /> or DateTime.MinValue /// </returns> public static DateTime PublishedAt(this IdentifiableObject identifiableObject, Publication publication, PublicationTarget publicationTarget) { if (identifiableObject != null && publication != null && publicationTarget != null) { PublishInfo info = identifiableObject.PublishInfo(publication, publicationTarget).FirstOrDefault(); if (info != null) { return(info.PublishedAt); } } return(default(DateTime)); }
public override void Publish(IProgressMonitor monitor, PublishInfo info) { string message = string.Empty; if (Services.ProjectOperations.CurrentSelectedSolution != null) { message = Services.ProjectsService.SerializeGameProject(info, this.ProjectFile); } if (string.IsNullOrEmpty(message)) { return; } monitor.ReportError(message, (Exception)null); }
public PublishResult Publish(Exchange exchange, PublishInfo publishInfo) { if (exchange == null) { throw new ArgumentNullException("exchange"); } if (publishInfo == null) { throw new ArgumentNullException("publishInfo"); } return(Post <PublishInfo, PublishResult>( string.Format("exchanges/{0}/{1}/publish", SanitiseVhostName(exchange.Vhost), exchange.Name), publishInfo)); }
private void DwgNameList_ItemCheck(object sender, ItemCheckEventArgs e) { if (e.Index < 0) { return; } if (!this._checkedChangedWithoutAuthorizationDwg) { if (!this._authorizedCheckDwg) { e.NewValue = e.CurrentValue; //check state change was not through authorized actions return; } } PublishInfo info = (PublishInfo)DwgNameList.Items[e.Index]; if (e.NewValue == CheckState.Checked) { info.SkipDwg = false; if (info != null) { foreach (LayoutInfo layoutInfo in info.LayoutInfos) { if (!_layoutWasChackedManualy) { layoutInfo.Publish = true; } } } //LayoutNameList.Enabled = true; } else { info.SkipDwg = true; //update the layouts.... if (info != null) { foreach (LayoutInfo layoutInfo in info.LayoutInfos) { layoutInfo.Publish = false; } } //LayoutNameList.Enabled = false; } }
/// <summary> /// Publish a message to a given exchange. /// Please note that the publish / get paths in the HTTP API are intended for injecting /// test messages, diagnostics etc - they do not implement reliable delivery and so should /// be treated as a sysadmin's tool rather than a general API for messaging. /// </summary> /// <param name="source"></param> /// <param name="exchange">The exchange</param> /// <param name="publishInfo">The publication parameters</param> /// <param name="cancellationToken"></param> /// <returns>A PublishResult, routed == true if the message was sent to at least one queue</returns> public static PublishResult Publish( [NotNull] this IManagementClient source, [NotNull] Exchange exchange, [NotNull] PublishInfo publishInfo, CancellationToken cancellationToken = default ) { if (source == null) { throw new ArgumentNullException(nameof(source)); } return(source.PublishAsync(exchange, publishInfo, cancellationToken) .GetAwaiter() .GetResult()); }
public void Should_be_able_to_publish_to_an_exchange() { var exchange = managementClient.GetExchanges().SingleOrDefault(x => x.Name == testExchange); if (exchange == null) { throw new ApplicationException( string.Format("Test exchange '{0}' hasn't been created", testExchange)); } var publishInfo = new PublishInfo(testQueue, "Hello World"); var result = managementClient.Publish(exchange, publishInfo); // the testExchange isn't bound to a queue result.Routed.ShouldBeFalse(); }
/// <summary> /// Serialize function /// 序列化方法 /// </summary> /// <param name="info">info of Publish(Publish信息)</param> /// <param name="projFile">Project file(项目文件)</param> /// <returns>error info(错误信息)</returns> public string Serialize(PublishInfo info, GameFile projFile) { //csd fullpath //csd 路径 string src = info.SourceFilePath; //des fullpath //csd转换后的路径 FilePath desFilePath = info.DestinationFilePath; //resources fullpath //当前项目资源路径 string res = Services.ProjectOperations.CurrentSelectedSolution.ItemDirectory; //serialize code //序列化代码写在下面 return ""; }
private ITaskItem GetOutputEntryPoint(ITaskItem entryPoint, PublishInfo[] manifestEntryPointList) { if (entryPoint == null) { return null; } TaskItem destinationItem = new TaskItem(entryPoint.ItemSpec); entryPoint.CopyMetadataTo(destinationItem); string metadata = entryPoint.GetMetadata("TargetPath"); if (!string.IsNullOrEmpty(metadata)) { for (int i = 0; i < manifestEntryPointList.Length; i++) { if (string.Equals(metadata, manifestEntryPointList[i].key, StringComparison.OrdinalIgnoreCase)) { if (!string.IsNullOrEmpty(manifestEntryPointList[i].includeHash)) { if (((manifestEntryPointList[i].state != PublishState.Exclude) && string.Equals(manifestEntryPointList[i].includeHash, "false", StringComparison.OrdinalIgnoreCase)) && this.SigningManifests) { this.canPublish = false; } destinationItem.SetMetadata("IncludeHash", manifestEntryPointList[i].includeHash); } return destinationItem; } } } return destinationItem; }
private ITaskItem[] GetOutputFiles(PublishInfo[] publishInfos) { List<ITaskItem> list = new List<ITaskItem>(); FileMap map = new FileMap(); if (this.Files != null) { foreach (ITaskItem item in this.Files) { map.Add(item, true); } } if (this.ExtraFiles != null) { foreach (ITaskItem item2 in this.ExtraFiles) { map.Add(item2, false); } } foreach (PublishInfo info in publishInfos) { MapEntry entry = map[info.key]; if (entry != null) { entry.publishInfo = info; } else { base.Log.LogWarningWithCodeFromResources("ResolveManifestFiles.PublishFileNotFound", new object[] { info.key }); } } foreach (MapEntry entry2 in (IEnumerable) map) { if (entry2.publishInfo == null) { entry2.publishInfo = new PublishInfo(); } string extension = Path.GetExtension(entry2.item.ItemSpec); PublishFlags flags = PublishFlags.GetFileFlags(entry2.publishInfo.state, extension, entry2.includedByDefault); if ((flags.IsPublished && string.Equals(entry2.publishInfo.includeHash, "false", StringComparison.OrdinalIgnoreCase)) && this.SigningManifests) { this.canPublish = false; } if (flags.IsPublished) { list.Add(CreateFileItem(entry2.item, entry2.publishInfo.group, entry2.publishInfo.targetPath, entry2.publishInfo.includeHash, flags.IsDataFile)); } } return list.ToArray(); }
private void GetOutputAssemblies(PublishInfo[] publishInfos, ref List<ITaskItem> assemblyList) { AssemblyMap assemblyMap = new AssemblyMap(); // Add all managed assemblies to the AssemblyMap, except assemblies that are part of the .NET Framework... if (_managedAssemblies != null) foreach (ITaskItem item in _managedAssemblies) if (!IsFiltered(item)) { item.SetMetadata("AssemblyType", "Managed"); assemblyMap.Add(item); } if (_nativeAssemblies != null) foreach (ITaskItem item in _nativeAssemblies) if (!IsFiltered(item)) { item.SetMetadata("AssemblyType", "Native"); assemblyMap.Add(item); } // Apply PublishInfo state from PublishFile items... foreach (PublishInfo publishInfo in publishInfos) { MapEntry entry = assemblyMap[publishInfo.key]; if (entry != null) entry.publishInfo = publishInfo; else Log.LogWarningWithCodeFromResources("ResolveManifestFiles.PublishFileNotFound", publishInfo.key); } // Go through the AssemblyMap and determine which items get added to ouput AssemblyList based // on computed PublishFlags for each item... foreach (MapEntry entry in assemblyMap) { // If PublishInfo didn't come from a PublishFile item, then construct PublishInfo from the item if (entry.publishInfo == null) entry.publishInfo = new PublishInfo(); // If state is auto then also need to look on the item to see whether the dependency type // has alread been specified upstream (i.e. from ResolveNativeReference task)... if (entry.publishInfo.state == PublishState.Auto) { string dependencyType = entry.item.GetMetadata("DependencyType"); if (String.Equals(dependencyType, "Prerequisite", StringComparison.Ordinal)) entry.publishInfo.state = PublishState.Prerequisite; else if (String.Equals(dependencyType, "Install", StringComparison.Ordinal)) entry.publishInfo.state = PublishState.Include; } bool copyLocal = GetItemCopyLocal(entry.item); PublishFlags flags = PublishFlags.GetAssemblyFlags(entry.publishInfo.state, copyLocal); if (flags.IsPublished && string.Equals(entry.publishInfo.includeHash, "false", StringComparison.OrdinalIgnoreCase) && SigningManifests == true) _canPublish = false; if (flags.IsPublished) assemblyList.Add(CreateAssemblyItem(entry.item, entry.publishInfo.group, entry.publishInfo.targetPath, entry.publishInfo.includeHash)); else if (flags.IsPrerequisite) assemblyList.Add(CreatePrerequisiteItem(entry.item)); } }
private ITaskItem GetOutputEntryPoint(ITaskItem entryPoint, PublishInfo[] manifestEntryPointList) { if (entryPoint == null) { return null; } TaskItem outputEntryPoint = new TaskItem(entryPoint.ItemSpec); entryPoint.CopyMetadataTo(outputEntryPoint); string targetPath = entryPoint.GetMetadata("TargetPath"); if (!string.IsNullOrEmpty(targetPath)) { for (int i = 0; i < manifestEntryPointList.Length; i++) { if (String.Equals(targetPath, manifestEntryPointList[i].key, StringComparison.OrdinalIgnoreCase)) { if (!string.IsNullOrEmpty(manifestEntryPointList[i].includeHash)) { if (manifestEntryPointList[i].state != PublishState.Exclude && string.Equals(manifestEntryPointList[i].includeHash, "false", StringComparison.OrdinalIgnoreCase) && SigningManifests == true) _canPublish = false; outputEntryPoint.SetMetadata("IncludeHash", manifestEntryPointList[i].includeHash); } return outputEntryPoint; } } } return outputEntryPoint; }
private void GetOutputSatellites(PublishInfo[] publishInfos, ref List<ITaskItem> assemblyList) { FileMap map = new FileMap(); if (this.satelliteAssemblies != null) { foreach (ITaskItem item in this.satelliteAssemblies) { item.SetMetadata("AssemblyType", "Satellite"); map.Add(item, true); } } foreach (PublishInfo info in publishInfos) { string str = info.key + ".dll"; MapEntry entry = map[str]; if (entry != null) { entry.publishInfo = info; } else { base.Log.LogWarningWithCodeFromResources("ResolveManifestFiles.PublishFileNotFound", new object[] { info.key }); } } foreach (MapEntry entry2 in (IEnumerable) map) { if (entry2.publishInfo == null) { entry2.publishInfo = new PublishInfo(); } CultureInfo itemCulture = GetItemCulture(entry2.item); PublishFlags flags = PublishFlags.GetSatelliteFlags(entry2.publishInfo.state, itemCulture, this.targetCulture, this.includeAllSatellites); if ((flags.IsPublished && string.Equals(entry2.publishInfo.includeHash, "false", StringComparison.OrdinalIgnoreCase)) && this.SigningManifests) { this.canPublish = false; } if (flags.IsPublished) { assemblyList.Add(CreateAssemblyItem(entry2.item, entry2.publishInfo.group, entry2.publishInfo.targetPath, entry2.publishInfo.includeHash)); } else if (flags.IsPrerequisite) { assemblyList.Add(CreatePrerequisiteItem(entry2.item)); } } }
private ITaskItem[] GetOutputFiles(PublishInfo[] publishInfos) { List<ITaskItem> fileList = new List<ITaskItem>(); FileMap fileMap = new FileMap(); // Add all input Files to the FileMap, flagging them to be published by default... if (Files != null) foreach (ITaskItem item in Files) fileMap.Add(item, true); // Add all input ExtraFiles to the FileMap, flagging them to NOT be published by default... if (ExtraFiles != null) foreach (ITaskItem item in ExtraFiles) fileMap.Add(item, false); // Apply PublishInfo state from PublishFile items... foreach (PublishInfo publishInfo in publishInfos) { MapEntry entry = fileMap[publishInfo.key]; if (entry != null) entry.publishInfo = publishInfo; else Log.LogWarningWithCodeFromResources("ResolveManifestFiles.PublishFileNotFound", publishInfo.key); } // Go through the FileMap and determine which items get added to ouput FileList based // on computed PublishFlags for each item... foreach (MapEntry entry in fileMap) { // If PublishInfo didn't come from a PublishFile item, then construct PublishInfo from the item if (entry.publishInfo == null) entry.publishInfo = new PublishInfo(); string fileExtension = Path.GetExtension(entry.item.ItemSpec); PublishFlags flags = PublishFlags.GetFileFlags(entry.publishInfo.state, fileExtension, entry.includedByDefault); if (flags.IsPublished && string.Equals(entry.publishInfo.includeHash, "false", StringComparison.OrdinalIgnoreCase) && SigningManifests == true) _canPublish = false; if (flags.IsPublished) fileList.Add(CreateFileItem(entry.item, entry.publishInfo.group, entry.publishInfo.targetPath, entry.publishInfo.includeHash, flags.IsDataFile)); } return fileList.ToArray(); }
// Returns PublishFile items seperated into seperate arrays by FileType attribute. private void GetPublishInfo( out PublishInfo[] assemblyPublishInfos, out PublishInfo[] filePublishInfos, out PublishInfo[] satellitePublishInfos, out PublishInfo[] manifestEntryPointPublishInfos) { List<PublishInfo> assemblyList = new List<PublishInfo>(); List<PublishInfo> fileList = new List<PublishInfo>(); List<PublishInfo> satelliteList = new List<PublishInfo>(); List<PublishInfo> manifestEntryPointList = new List<PublishInfo>(); if (PublishFiles != null) foreach (ITaskItem item in PublishFiles) { PublishInfo publishInfo = new PublishInfo(item); string fileType = item.GetMetadata("FileType"); switch (fileType) { case "Assembly": assemblyList.Add(publishInfo); break; case "File": fileList.Add(publishInfo); break; case "Satellite": satelliteList.Add(publishInfo); break; case "ManifestEntryPoint": manifestEntryPointList.Add(publishInfo); break; default: Log.LogWarningWithCodeFromResources("GenerateManifest.InvalidItemValue", "FileType", item.ItemSpec); continue; } } assemblyPublishInfos = assemblyList.ToArray(); filePublishInfos = fileList.ToArray(); satellitePublishInfos = satelliteList.ToArray(); manifestEntryPointPublishInfos = manifestEntryPointList.ToArray(); }
private ITaskItem[] GetOutputAssembliesAndSatellites(PublishInfo[] assemblyPublishInfos, PublishInfo[] satellitePublishInfos) { List<ITaskItem> assemblyList = new List<ITaskItem>(); this.GetOutputAssemblies(assemblyPublishInfos, ref assemblyList); this.GetOutputSatellites(satellitePublishInfos, ref assemblyList); return assemblyList.ToArray(); }
private void GetOutputAssemblies(PublishInfo[] publishInfos, ref List<ITaskItem> assemblyList) { AssemblyMap map = new AssemblyMap(); if (this.managedAssemblies != null) { foreach (ITaskItem item in this.managedAssemblies) { if (!IsFiltered(item)) { item.SetMetadata("AssemblyType", "Managed"); map.Add(item); } } } if (this.nativeAssemblies != null) { foreach (ITaskItem item2 in this.nativeAssemblies) { if (!IsFiltered(item2)) { item2.SetMetadata("AssemblyType", "Native"); map.Add(item2); } } } foreach (PublishInfo info in publishInfos) { MapEntry entry = map[info.key]; if (entry != null) { entry.publishInfo = info; } else { base.Log.LogWarningWithCodeFromResources("ResolveManifestFiles.PublishFileNotFound", new object[] { info.key }); } } foreach (MapEntry entry2 in (IEnumerable) map) { if (entry2.publishInfo == null) { entry2.publishInfo = new PublishInfo(); } if (entry2.publishInfo.state == PublishState.Auto) { string metadata = entry2.item.GetMetadata("DependencyType"); if (string.Equals(metadata, "Prerequisite", StringComparison.Ordinal)) { entry2.publishInfo.state = PublishState.Prerequisite; } else if (string.Equals(metadata, "Install", StringComparison.Ordinal)) { entry2.publishInfo.state = PublishState.Include; } } bool itemCopyLocal = GetItemCopyLocal(entry2.item); PublishFlags assemblyFlags = PublishFlags.GetAssemblyFlags(entry2.publishInfo.state, itemCopyLocal); if ((assemblyFlags.IsPublished && string.Equals(entry2.publishInfo.includeHash, "false", StringComparison.OrdinalIgnoreCase)) && this.SigningManifests) { this.canPublish = false; } if (assemblyFlags.IsPublished) { assemblyList.Add(CreateAssemblyItem(entry2.item, entry2.publishInfo.group, entry2.publishInfo.targetPath, entry2.publishInfo.includeHash)); } else if (assemblyFlags.IsPrerequisite) { assemblyList.Add(CreatePrerequisiteItem(entry2.item)); } } }
/// <summary> /// ContextInitialize is called before Serialize /// 在调用Serialize方法之前调用 /// </summary> public void ContextInitialize(PublishInfo publishInfo) { }
/// <summary> /// ContextInitialize is called after Serialize /// 在最后一次调用Serialize之后调用 /// </summary> public void ContextFinalize(PublishInfo publishInfo) { }
private void GetOutputSatellites(PublishInfo[] publishInfos, ref List<ITaskItem> assemblyList) { FileMap satelliteMap = new FileMap(); if (_satelliteAssemblies != null) foreach (ITaskItem item in _satelliteAssemblies) { item.SetMetadata("AssemblyType", "Satellite"); satelliteMap.Add(item, true); } // Apply PublishInfo state from PublishFile items... foreach (PublishInfo publishInfo in publishInfos) { string key = publishInfo.key + ".dll"; MapEntry entry = satelliteMap[key]; if (entry != null) entry.publishInfo = publishInfo; else Log.LogWarningWithCodeFromResources("ResolveManifestFiles.PublishFileNotFound", publishInfo.key); } // Go through the AssemblyMap and determine which items get added to ouput SatelliteList based // on computed PublishFlags for each item... foreach (MapEntry entry in satelliteMap) { // If PublishInfo didn't come from a PublishFile item, then construct PublishInfo from the item if (entry.publishInfo == null) { entry.publishInfo = new PublishInfo(); } CultureInfo satelliteCulture = GetItemCulture(entry.item); PublishFlags flags = PublishFlags.GetSatelliteFlags(entry.publishInfo.state, satelliteCulture, _targetCulture, _includeAllSatellites); if (flags.IsPublished && string.Equals(entry.publishInfo.includeHash, "false", StringComparison.OrdinalIgnoreCase) && SigningManifests == true) _canPublish = false; if (flags.IsPublished) { assemblyList.Add(CreateAssemblyItem(entry.item, entry.publishInfo.group, entry.publishInfo.targetPath, entry.publishInfo.includeHash)); } else if (flags.IsPrerequisite) { assemblyList.Add(CreatePrerequisiteItem(entry.item)); } } }
private void GetPublishInfo(out PublishInfo[] assemblyPublishInfos, out PublishInfo[] filePublishInfos, out PublishInfo[] satellitePublishInfos, out PublishInfo[] manifestEntryPointPublishInfos) { List<PublishInfo> list = new List<PublishInfo>(); List<PublishInfo> list2 = new List<PublishInfo>(); List<PublishInfo> list3 = new List<PublishInfo>(); List<PublishInfo> list4 = new List<PublishInfo>(); if (this.PublishFiles != null) { foreach (ITaskItem item in this.PublishFiles) { PublishInfo info = new PublishInfo(item); string metadata = item.GetMetadata("FileType"); if (metadata == null) { goto Label_00BA; } if (!(metadata == "Assembly")) { if (metadata == "File") { goto Label_009C; } if (metadata == "Satellite") { goto Label_00A6; } if (metadata == "ManifestEntryPoint") { goto Label_00B0; } goto Label_00BA; } list.Add(info); continue; Label_009C: list2.Add(info); continue; Label_00A6: list3.Add(info); continue; Label_00B0: list4.Add(info); continue; Label_00BA:; base.Log.LogWarningWithCodeFromResources("GenerateManifest.InvalidItemValue", new object[] { "FileType", item.ItemSpec }); } } assemblyPublishInfos = list.ToArray(); filePublishInfos = list2.ToArray(); satellitePublishInfos = list3.ToArray(); manifestEntryPointPublishInfos = list4.ToArray(); }