Skip to main content

A Technical Talk on Microservices and Cloud Deployment

This is a full-length session of microservices development using Microsoft .Net Core WebAPI(C#.Net) and Mongo DB as backend. The session presentation available below   The source code of session available in GitHub , feel free to share your feedback and contribute to this project Full session video Prerequisites for development MongoDB (you can download from here ) Visual Studio 2019 DotNet Core 3.1.x SDK Postman (for API Testing)

Resource Explorer (DLL/Exe) using C#

After long time we are with the Resource Explorer.
This is verymuch usefull for the resource management in the Application/DLL.

Purspose

    You are having the images/icon in other dll then you can load and use that particular image/icon using the below concept

Source Code:

public partial class frmAssemblyHandling : Form

{

public frmAssemblyHandling()

{

InitializeComponent();

}

private void btnSelectDLL_Click(object sender, EventArgs e)

{

//the required resources to filter from the available

ArrayList arImageFilter = new ArrayList();

arImageFilter.AddRange(new string[] { ".png", ".ico", ".bmp", ".png" });



OpenFileDialog fd = new OpenFileDialog();

fd.Filter = "DLL Files (*.Dll)|*.dll|Application Files (*.exe)|*.exe";

if (fd.ShowDialog() == System.Windows.Forms.DialogResult.OK)

{

try

{

lblAssemblyPath.Text = fd.FileName.ToString().Trim();

//load the selected assembly

var asm = Assembly.LoadFile(lblAssemblyPath.Text.Trim());

string resName = asm.GetName().Name + ".g.resources"; //open the resources

using (var stream = asm.GetManifestResourceStream(resName))

using (var reader = new System.Resources.ResourceReader(stream))

{

//filtering the resource and add the path to listbox

lstResources.DataSource = reader.Cast<DictionaryEntry>().Where(x =>

arImageFilter.Contains(System.IO.Path.GetExtension(x.Key.ToString()))).Select(entry =>

(string)entry.Key).ToArray();

}

}

catch (Exception ex)

{

lblAssemblyPath.Text =
string.Empty;

MessageBox.Show(string.Format("Unable to load the resource(s) from {0}",

fd.FileName.ToString().Trim()), "Resource Explorer",

MessageBoxButtons.OK, MessageBoxIcon.Exclamation);

}

}

}

private void listBox1_SelectedIndexChanged(object sender, EventArgs e)

{

if (!lblAssemblyPath.Text.Trim().Equals(string.Empty))

{

string sAssemblyPath = lblAssemblyPath.Text.Trim();

if (System.IO.File.Exists(sAssemblyPath))

{

var asm = Assembly.LoadFile(sAssemblyPath);

                    string resName = asm.GetName().Name + ".g.resources";
using (var stream = asm.GetManifestResourceStream(resName))

using (var reader = new System.Resources.ResourceReader(stream))

{

//select the specific resource

//and convert it to stream->image and display in the picture box

pictureBox1.Image = Image.FromStream((reader.Cast<DictionaryEntry>().Where(x =>

x.Key.Equals(lstResources.SelectedItem.ToString())).Select(entry =>

(System.IO.
Stream)entry.Value).FirstOrDefault()));

}

}

}

}

}


Screen Shots

1. Application Interface


2. Sample Resource (DLL)






 

Comments

pavloyahr said…
The polygamous Casino - OKlahomacasinoguru
The polygamous Casino offers you 양방배팅 everything 블랙 잭 전략 you 예스 벳 88 need to know about the 브라 벗기 world's most 월드 벳 famous slots and table games.

Popular posts from this blog

Know more about Azure Website KUDU?

KUDU  is the web tool for analyzing and troubleshooting azure websites. Benefits of Kudu Know about operating system Environment variables Processors & cores Applications settings Connection strings Process explorer (running instances) Debugging console (Command prompt & PowerShell) Diagnostics Log (view & download) Site extensions management and more Environment details Command prompt Are your wondering to use KUDU?, its very simple open browser and type https://{ your azure website name }.scm.azurewebsites.net . To access KUDU you need to have your azure deployment credentials! Example Your azure website : https://textingwebsite.azurewebsites.net/ Kudu URL : https://textingwebsite.scm.azurewebsites.net/ for more information about Kudu click here

A Technical Talk on Microservices and Cloud Deployment

This is a full-length session of microservices development using Microsoft .Net Core WebAPI(C#.Net) and Mongo DB as backend. The session presentation available below   The source code of session available in GitHub , feel free to share your feedback and contribute to this project Full session video Prerequisites for development MongoDB (you can download from here ) Visual Studio 2019 DotNet Core 3.1.x SDK Postman (for API Testing)