/// <summary> /// Creates new course and opens it. /// </summary> public static void CreateNew() { FFDebug.EnterMethod(Cattegory.Course, State.ToString()); if ((State & CourseStates.Opened) > 0 && !Close()) { return; } __FullPath = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString()); Directory.CreateDirectory(__FullPath); __Manifest = new ManifestType("New Course") { version = CourseUpgradeManager.LastVersion }; __Manifest.ResolveTree(__Manifest); __Organization = __Manifest.organizations.Organizations[0]; __Manifest.organizations.@default = __Organization.identifier; Answers = new Answers(); Save(); if (Open(__FullPath)) { State = CourseStates.Opened; } FFDebug.LeaveMethod(Cattegory.Course, MethodBase.GetCurrentMethod()); }
/// <summary> /// Signs the CDA Package and creates the signature document. /// </summary> /// <param name="package">A CDAPackageBase instance containing the root document to sign.</param> /// <param name="signingCert">The certificate used to sign the root document.</param> /// <returns>Signature of the root document.</returns> private static byte[] CreateSignature(CDAPackage package, X509Certificate2 signingCert) { package.SigningTime = DateTime.Now.ToUniversalTime(); byte[] rootDocumentContent = package.CDADocumentRoot.FileContent; byte[] hash = CalculateSHA1(rootDocumentContent); var manifest = new ManifestType(); manifest.Reference = new ReferenceType[] { new ReferenceType() { URI = package.CDADocumentRoot.FileName, DigestMethod = new DigestMethodType() { Algorithm = SignedXml.XmlDsigSHA1Url }, DigestValue = hash } }; var approver = new ApproverType(); approver.personId = package.Approver.PersonId.ToString(); approver.personName = new PersonNameType(); approver.personName.familyName = package.Approver.PersonFamilyName; if (package.Approver.PersonTitles != null) { approver.personName.nameTitle = package.Approver.PersonTitles.ToArray(); } if (package.Approver.PersonGivenNames != null) { approver.personName.givenName = package.Approver.PersonGivenNames.ToArray(); } if (package.Approver.PersonNameSuffixes != null) { approver.personName.nameSuffix = package.Approver.PersonNameSuffixes.ToArray(); } var eSignature = new eSignatureType(); eSignature.Manifest = manifest; eSignature.approver = approver; eSignature.signingTime = package.SigningTime.Value; XmlDocument eSignatureXml = eSignature.SerializeToXml(); ISignedContainerProfileService signedContainerService = XspFactory.Instance.GetSignedContainerProfileService(XspVersion.V_2010); XmlDocument signedDoc = signedContainerService.Create(eSignatureXml, signingCert); var ms = new MemoryStream(); signedDoc.Save(ms); return(ms.ToArray()); }
/// <summary> /// A new executable manifest. /// </summary> /// <param name="manifestType">Manifest type.</param> public ManifestResource(ManifestType manifestType) : base(IntPtr.Zero, IntPtr.Zero, new ResourceId(ResourceTypes.RT_MANIFEST), new ResourceId((uint)manifestType), Kernel32Contants.LANG_NEUTRAL, 0 ) { _manifest = new XmlDocument(); _manifest.LoadXml("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>" + "<assembly xmlns=\"urn:schemas-microsoft-com:asm.v1\" manifestVersion=\"1.0\" />"); _size = Encoding.UTF8.GetBytes(_manifest.OuterXml).Length; }
/// <summary> /// A new executable manifest. /// </summary> /// <param name="manifestType">Manifest type.</param> public ManifestResource(ManifestType manifestType) : base(IntPtr.Zero, IntPtr.Zero, new ResourceId(ResourceTypes.RT_MANIFEST), new ResourceId((uint)manifestType), Kernel32Contants.LANG_NEUTRAL, 0 ) { _manifest = new XmlDocument(); _manifest.LoadXml("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>" + "<assembly xmlns=\"urn:schemas-microsoft-com:asm.v1\" manifestVersion=\"1.0\" />"); _size = Encoding.UTF8.GetBytes(_manifest.OuterXml).Length; }
// 加载资源清单 void LoadManifest(ManifestType mType) { if (m_manifests.ContainsKey(mType) && m_manifests[mType] != null) { DestroyImmediate(m_manifests[mType], true); m_manifests.Remove(mType); } string manifestName = mType.ToString(); Util.Log("LoadManifest manifestName " + manifestName); m_manifestNames.Add(manifestName); string strFullPath = FileHelper.SearchFilePath(GetManifestType(manifestName).ToString(), manifestName); Util.Log("strFullPath: " + strFullPath); BundleLoader bLoader = LoaderPool.Instance.GetLoader <BundleLoader>(); bLoader.Init(strFullPath, manifestName, delegate(object data) { LoadedBundle ab = data as LoadedBundle; if (ab != null) { m_manifests[mType] = ab.LoadAsset <AssetBundleManifest>("AssetBundleManifest"); m_bundleHeads[mType] = mType.ToString().ToLower().Split('_')[0]; Util.Log("manifest ab in not null over----"); } else { Util.LogError("manifest ab is null---------"); } LoadedBundleCtrl.Instance.UnReferenceLoadedBundle(manifestName); // 不走统一接口是因为manifest文件没有后缀 LoadedBundleCtrl.Instance.HandRemoveBundle(manifestName); if (m_manifests[mType] != null) { string[] bundles = m_manifests[mType].GetAllAssetBundles(); for (int i = 0; i < bundles.Length; ++i) { if (m_bundleNames.Contains(bundles[i])) { Util.LogError(string.Format("别的清单已同名的包名,{0} {1}", manifestName, bundles[i])); } m_bundleNames.Add(bundles[i]); } } }, false, null, true); }
public string[] GetDependencies(string abName) { ManifestType type = GetManifestType(abName); AssetBundleManifest manifest; m_manifests.TryGetValue(type, out manifest); if (null == manifest) { Util.LogError("获取依赖包名失败,清单为空 : " + abName); } return(manifest.GetDirectDependencies(abName)); }
private void miAddManifest_Click(object sender, EventArgs e) { ManifestType c = (ManifestType)tvManifest.SelectedNode.Tag; ManifestType m = new ManifestType(c.Identifier + "_submanifest"); if (c.manifest.Count == 0) { c.manifest = new ManifestNodeList <ManifestType>(c.manifest); } c.manifest.Add(m); Forms.PropertyEditor.Show(m); tvManifest.SelectedNode.Expand(); }
/// <summary> /// Load a manifest resource from an executable file. /// </summary> /// <param name="filename">Name of an executable file (.exe or .dll).</param> /// <param name="manifestType">Manifest resource type.</param> public void LoadFrom(string filename, ManifestType manifestType) { base.LoadFrom(filename, new ResourceId(ResourceTypes.RT_MANIFEST), new ResourceId((uint)manifestType), Kernel32Contants.LANG_NEUTRAL); }
public LayerDescriptionManifest(ManifestType type) { this.Nlt = type; }
/// <summary> /// Load a manifest resource from an executable file. /// </summary> /// <param name="filename">Name of an executable file (.exe or .dll).</param> /// <param name="manifestType">Manifest resource type.</param> public void LoadFrom(string filename, ManifestType manifestType) { base.LoadFrom(filename, new ResourceId(ResourceTypes.RT_MANIFEST), new ResourceId((uint)manifestType), Kernel32Contants.LANG_NEUTRAL); }
private void miAddManifest_Click(object sender, EventArgs e) { ManifestType c = (ManifestType) tvManifest.SelectedNode.Tag; ManifestType m = new ManifestType(c.Identifier + "_submanifest"); if (c.manifest.Count == 0) { c.manifest = new ManifestNodeList<ManifestType>(c.manifest); } c.manifest.Add(m); Forms.PropertyEditor.Show(m); tvManifest.SelectedNode.Expand(); }
public void ValidateSemantics(ManifestType manifestType) { switch (manifestType) { case ManifestType.Application: this.ValidateSemanticsForApplicationRole(); return; case ManifestType.Deployment: this.ValidateSemanticsForDeploymentRole(); return; } }