Ejemplo n.º 1
0
		public static byte[] GetFileBinContent(EmbeddedResourceName ern)
		{
			var retVal = string.Empty;
			var asm = Assembly.GetExecutingAssembly();
			var manifestStream = asm.GetManifestResourceStream(ern.FullName);
			try
			{
				var memoryStream = new MemoryStream();
				manifestStream.CopyTo(memoryStream);
				return memoryStream.ToArray();
			}
			catch { }
			finally
			{
				manifestStream.Close();
			}
			return null;
		}
Ejemplo n.º 2
0
		public static string GetFileContent(EmbeddedResourceName ern)
		{
			var retVal = string.Empty;
			var asm = Assembly.GetExecutingAssembly();
			var manifestStream = asm.GetManifestResourceStream(ern.FullName);
			try
			{
				using (var sr = new System.IO.StreamReader(manifestStream))
				{
					retVal = sr.ReadToEnd();
				}
			}
			catch { }
			finally
			{
				manifestStream.Close();
			}
			return retVal;
		}
		private string GetFileContent(EmbeddedResourceName ern)
		{
			try
			{
				string retVal = GetResource(ern);
				retVal = ReplaceNHydrateSpecifics(retVal);
				return retVal;
			}
			catch (Exception ex)
			{
				throw;
			}
		}
		private void GenerateDatabaseInstallerDesignerCs()
		{
			var fullParentName = "DatabaseInstaller.cs";
			var fileName = "DatabaseInstaller.Designer.cs";
			var ern = new EmbeddedResourceName();
			ern.AsmLocation = this.GetEmbeddedPath();
			ern.FileName = "DatabaseInstaller.Designer.embed";
			ern.FullName = this.GetEmbeddedPath() + "." + ern.FileName;
			var fileContent = GetFileContent(ern);
			var eventArgs = new ProjectItemGeneratedEventArgs(fileName, fileContent, ProjectName, fullParentName, this, true);
			OnProjectItemGenerated(this, eventArgs);
		}
		private void GenerateHistoryFormResx()
		{
			var fullParentName = "HistoryForm.cs";
			var fileName = "HistoryForm.resx";
			var ern = new EmbeddedResourceName();
			ern.AsmLocation = this.GetEmbeddedPath();
			ern.FileName = fileName + ".embed";
			ern.FullName = this.GetEmbeddedPath() + "." + ern.FileName;
			var fileContent = GetFileContent(ern);
			var eventArgs = new ProjectItemGeneratedEventArgs(fileName, fileContent, ProjectName, fullParentName, this, true);
			eventArgs.Properties.Add("BuildAction", 3);
			OnProjectItemGenerated(this, eventArgs);
		}