 |
|
|
 |
|
|
 |
|
 |
Hi All,
Can anybody tell how can we remove a resource from ResX file on the fly i.e through programmatically.
Best Regards
|
|
|
|
 |
|
 |
My task is quite simple:
I need to add some icons to an assembly and then link them to file types in the registry.
The DefaultIcon resgistry key gets the path to the assembly (exe, dll) and then the index to the icon.
However, I haven't succeed to cause the icons to be a part of the assembly so a link by an icon index is possible.
Any ideas?
|
|
|
|
 |
|
 |
Mr. Sayles,
I downloaded and tested your tool to find out if I experienced the same problem with your resource editor as I do with Mr. Roeder's. It seems that I do.
My issue is this: make a copy of a resource file with a bitmap image in it. open the copy with your (or Mr. Roeder's) editor. Do nothing but click "save". Exit out and do a file compare.
It appears that every third or fourth line has a modified character (or two) in it. Makes for messy diff. The resulting image does not appear altered.
Have you seen anything like this? What could the source of this issue be? Does base64 encoding (my assumption of what type of encoding is used in the resx file) have insignificant bits that are encoded inconsistently?
I've been puzzling over this for some time now.
Thanks for any insight,
Troy Hildebrand
|
|
|
|
 |
|
|
 |
|
 |
Greetings!
I used your code and it works great. Easy, clean.
A little bit buggy, but hey! It was a tool made in a hurry as I gather, right? So it's still 5 stars for me.
But... there's always a but...
I'm using it to add icons in a VB.NET application and when I create the setup application I'm not able to find the icons I've added in the resource. Any idea?
Regards,
Paulo
|
|
|
|
 |
|
 |
Paulo,
I just had the same problem. The reason you're not finding the icons it that they are serialized as bitmaps. The editor loads all images as bitmaps regardless of extension. To get icons to work you'll have to modify the code slightly, and rebuild the editor.
Replace lines 37-49 in the file PickImageEditor.cs with the following:
openFileDialog1.DefaultExt = "ico";
openFileDialog1.Filter = "Icons (*.ico)|*.ico|Bitmaps (*.bmp)|*.bmp|JPEG Files (*.jpg)|*.jpg|All Files (*.*)|*.*";
openFileDialog1.RestoreDirectory = true;
openFileDialog1.Title = "Open an image file";
if (openFileDialog1.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
item.FileName = openFileDialog1.FileName;
data = item.FileName.EndsWith(".ico") ? (object)new Icon(item.FileName) : (object)new Bitmap( item.FileName );
}
Good Luck,
Drew
|
|
|
|
 |
|
 |
Hi
When i run your program and open the Demo.resourcesConfig
i receive the message "invalid file name for image".
What am i doing wrong ?
Thank you in advance
A.BArros
|
|
|
|
 |
|
 |
You'll need to find/replace the folder within the .resourcesConfig file. It has absolute paths in it, and so your path (where you extracted the zip file) will be different to the authors.
Change these over and it will work.
|
|
|
|
 |
|
|
 |
|
 |
Thanks for putting your work out there- it's going to come in pretty handy.
Now all that's left to do is figure out why this wasn't included in .NET Studio to start with.
Olivier
|
|
|
|
 |
|
 |
I developed another editor for editing resources, it has similar features:
- Edit individual items
- Add icons and bitmaps
- Source Code available
Additionally:
- Integrated on Visual Studio 2003
- ImageList editing
- Config file is not needed
http://weblogs.asp.net/gmilano/archive/2004/03/03/83155.aspx
GMilano
|
|
|
|
 |
|
 |
http://aisto.com/roeder/dotnet
|
|
|
|
 |
|
 |
IMO Resourcer is muuuuch better than this.
krass
|
|
|
|
 |
|
 |
Good for them. I threw this one together because at the time I found nothing and my graphics department was changing the "look and feel" daily. I appreciate the feedback, but it probably would be some time until I could correct the problems with icons or make any other improvements due to my current workload. This little tool will probably be "unsupported" for now. If another tool supercedes it, I am all for it.
|
|
|
|
 |
|
 |
Give me one reason (or more, if you can) why Resourcer is better. I just looked at both (haven't used either one yet) and my first impression is that Resource Editor .NET looks better.
I especially like two things about Resource Editor .NET:
1. the config file and the functionality that comes with it
2. source code is available
So far, the score is
Resource Editor .NET: 2
Resourcer: 0
Now it's your turn to put some points on the board krass.
Regards,
Mountain
|
|
|
|
 |
|
 |
first thanks a lot - this will save me a tremendous bit of time.
as far as i can see now icons are somehow converted and stored as bitmaps within the tool? ahead the icon related informations seems to be lost on reopening (due to that conversion?)
nice feature would be the ability to retrieve a exactly specified icon (size and resolution) from one icon-file/ or perhaps the ability to store complete multi-file icons within the resource-file
stefan rieger
|
|
|
|
 |
|
 |
It contained just what I was looking for. It's weird that there's no similar official tool for doing this from Microsoft. Who cares as long as this one exists. I'm looking forward to seeing the app develop further.
Mattias
|
|
|
|
 |
|
 |
Is there a way to get all the objects of the .resource file and save them, each as an iindividual bitmap. Supose we know the names of each bitmap (thanks to using your app) and we want to save to my disk whatever.bmp and whoknows.bmp.
Is that possible?
|
|
|
|
 |
|
 |
Yes, there is. The file selected in the editor is first manifested as a bitmap object, hence the thumbnail view in the editor. This bitmap can be saved as a physical file of some supported type by the Bitmap.Save() method. I might add that functionality when I get a chance, I just had no need for it.
|
|
|
|
 |
|
 |
I added the following to export images:
private System.Drawing.Imaging.ImageFormat GetImageFormatFromExtension(string imgPath)
{
string ext = Path.GetExtension(imgPath);
ext = ext.ToLower();
if (ext == ".bmp")
return System.Drawing.Imaging.ImageFormat.Bmp;
if (ext == ".emf")
return System.Drawing.Imaging.ImageFormat.Emf;
if (ext == ".gif")
return System.Drawing.Imaging.ImageFormat.Gif;
if (ext == ".ico")
return System.Drawing.Imaging.ImageFormat.Icon;
if (ext == ".jpg" || ext == ".jpeg")
return System.Drawing.Imaging.ImageFormat.Jpeg;
if (ext == ".png")
return System.Drawing.Imaging.ImageFormat.Png;
if (ext == ".tif" || ext == ".tiff")
return System.Drawing.Imaging.ImageFormat.Tiff;
if (ext == ".wmf")
return System.Drawing.Imaging.ImageFormat.Wmf;
return System.Drawing.Imaging.ImageFormat.Bmp;
}
private void buttonExport_Click(object sender, System.EventArgs e)
{
if (propertyGridResources.SelectedGridItem != null)
{
try
{
string ext = ".bmp";
if (propertyGridResources.SelectedGridItem.Value is Icon)
{
ext = ".ico";
}
System.Windows.Forms.SaveFileDialog saveFileDlg = new System.Windows.Forms.SaveFileDialog();
saveFileDlg.FileName = textBoxRename.Text + ext;
saveFileDlg.DefaultExt = ext;
saveFileDlg.Filter="Image Files(*.BMP;*.JPG;*.GIF;*.ICO)|*.BMP;*.JPG;*.GIF;*.ICO|All files (*.*)|*.*" ;
if (saveFileDlg.ShowDialog() == DialogResult.OK)
{
Bitmap bitmap = null;
Icon icon = null;
if (propertyGridResources.SelectedGridItem.Value is Bitmap)
{
bitmap = (Bitmap)propertyGridResources.SelectedGridItem.Value;
}
else if (propertyGridResources.SelectedGridItem.Value is Icon)
{
icon = (Icon)propertyGridResources.SelectedGridItem.Value;
bitmap = icon.ToBitmap();
}
else
{
MessageBox.Show(this,
"Can only export Bitmap or Icon Resource",
"Resource Editor",
MessageBoxButtons.OK,
MessageBoxIcon.Exclamation);
return;
}
if (File.Exists(saveFileDlg.FileName))
{
File.Delete(saveFileDlg.FileName);
}
System.Drawing.Imaging.ImageFormat imgFmt = GetImageFormatFromExtension(saveFileDlg.FileName);
if (imgFmt == System.Drawing.Imaging.ImageFormat.Icon)
{
if (icon == null)
{
icon = Icon.FromHandle(bitmap.GetHicon());
}
System.IO.FileStream fileStream = new FileStream(saveFileDlg.FileName, FileMode.CreateNew);
icon.Save(fileStream);
}
else
{
bitmap.Save(saveFileDlg.FileName, imgFmt);
}
}
}
catch( Exception ex )
{
MessageBox.Show(this,
ex.Message,
"Resource Editor",
MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
}
}
}
|
|
|
|
 |
|
 |
Hello,
It seems that you have not implemented this "last" change on downloadable code or demo, isn't it ?
Thanks !
|
|
|
|
 |
|
 |
I would agree ... this feature is too valuable to not have as part of your application.
In fact, I am completely surprised that other resource editors out there (e.g. Resourcer by Lutz Roeder) don't allow you to save an image from a .resx.
It seems as if every Tom, Dick, and Henry would want to do this!
|
|
|
|
 |
|
 |
Just wanted to say thanks. I was looking for a tool that did this, you saved the day.
|
|
|
|
 |