|
Hi,
I'm currently trying to localize a .Net project. that means I need to use localized resources like stringtables and Bitmaps for german and english.
Following a localization sample delivered by VS, I succeessfully localized string-resources using the resgen and afterwards the assemblylinker(al.exe) tools.
Unfortunately, using the al-tool to localize bitmaps failed.
Does anyone have ideas or examples with which parameters to call the al.exe to use localized Bitmaps and how to use the bitmap-resource via GetManifestResourceStream() or something?
Thanks,
klawipo
|
|
|
|
|
The easiest way is to persist the images in ResX files (typically encoded in base64 - just set a BackgroundImage for a control and look at the form's/user control's .resx file "under" the file is you show all files in your project for an example). This allows you to use the ResourceManager which already takes care of the satellite assemblies for you; otherwise, you can use Assembly.GetSatelliteAssembly (calling it on an Assembly reference that is the primary assembly using the same assembly name but a different culture) and then call GetManifestResourceStream from that. If your primary assembly (the one with IL modules in it - the code that is executing) contains that culture (if you use the assembly-level NeutralResourcesLanguageAttribute ) or if no satellite assembly is found, and exception will be thrown so then grab the resource out of the primary assembly.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
i have 2 modules (exe) and i'm serializing a certain object with one module and i want to deserialize it with the other one..
but the framework throws an exception coz the assembly is not the same one it was serialized from..
any clue ??
thanx
shakoosh
|
|
|
|
|
I had a similar problem in the project I'm working on now. You need to ensure that the type that is being serialized exists in both assemblies. For example, say that you have the following setup:
ASSEMBLY 1:
- Module1.cs
ASSEMBLY 2:
- Module2.cs
And assume that each of those files has the code for some class Foo in it. Even if the code for Foo is byte-for-byte the same in both files, the framework will throw an error when attempting to deserialize because it's trying to instantiate the assembly in which the object was first created. The important fact here is that it's extremely difficult to separate a class from its containing assembly.
The solution that I ended up implementing:
ASSEMBLY 1:
- Module1.cs
- References [ASSEMBLY FOO]
ASSEMBLY 2:
- Module2.cs
- References [ASSEMBLY FOO]
ASSEMBLY FOO:
- Foo.cs
Here, simply remove the code for Foo from Module1.cs and Module2.cs, putting it into Foo.cs in a different assembly instead. If you reference ASSEMBLY FOO from both modules, the framework will now correctly locate the required assembly and deserialize the class.
There may in fact be an alternative method to implementing this, but this is the most straightforward method that I know of. It's also the one that worked for my project.
|
|
|
|
|
I have two .net applications (windows and web applications)
Both these applications use class from dinamic loaded .dll
How could I obtain the name of current application configuration file inside this .dll class?
Thanks.
|
|
|
|
|
AppDomain.CurrentDomain.SetupInformation.ConfigurationFile
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
The situation is that:
I write a master application. The master application contains several dll class component. I would like to implement the master application such that if there is a new dll class component install to the master application, the master application can detect the new component automatically without changing the master application. How do I implement it?
Thanks!
p.s (I am using C#)
|
|
|
|
|
You could track the last date it updated, and any newer files in the folder would get processed.
"For all of our languages, we cannot communicate" - Christy Moore, Natives
|
|
|
|
|
Is there any possibility to save Bitmap as JPG, however
with better quality than allows the following code :
...
encoderParameters.Param[0] = new EncoderParameter(Encoder.Quality,100);
//100 => maximum possible
foreach( ImageCodecInfo encoder in encoders ) //PERF OPT
{
if( encoder.MimeType == "image/jpeg" )
{
img.Save(stream,encoder,encoderParameters);
}
}
When saving images with maximum possible quality I get files that
are about 80% of size of image produced by Adobe Phooshop,
even with 10 (scale 1-12 ) quality (!)
It was somewhat about 160 kB, versus 200 kB, and of course,
the difference had been evident. The difference was visible
due to the fact that on the original image some lines and polygons
along with text were drawn. And these require quite a good
compression quality.
Sombody might say that I should save images as GIF or PNG, however
these do not provide as good compression ratio as JPEG does, even
when saving JPEG with the best quality (size increases)
(best JPEG by PhotoShop == 320 KB, best by framework == 160 KB,
PNG = 770 KB)
When saving image as JPEG with photoshop, user is able to choose
compression level (that seems to be "wider" than what framewotk
provides) and is able to choose from "Format options" that are
following: BaseLine, Baseline-Optimized and Progressive.
Is there any way to make the same work in GDI+ ?
But the main question remains : How to save image with quality
better than that from the above code example.
Thanks
Michał Januszczyk
|
|
|
|
|
I have a .NET DLL that has the following inheritance structure (each object inherits from the object above it):
<br />
BaseObject (VB6 COM DLL)<br />
COM Interop DLL (.NET)<br />
Abstract BaseObject (.NET)<br />
Abstract BaseObject2 (.NET)<br />
Concrete Object (.NET)<br />
To complicate matters, the Concrete .NET Class needs to be accessible from COM. I have set the appropriate attributes to make this happen, and everything works fine on my machine, and some others too.
To register on another machine, I use RegAsm. However, on some XP machines, regasm is failing, with the error:
<br />
RegAsm error: Could not load type XX.XX.AppBase from assembly XX.XX.XX, Version=0.9.1616.28364, Culture=neutral, PublicKeyToken=null because the format is invalid.<br />
where XX.XX.AppBase is the first abstract base object. All machines are running .NET 1.1. I have tried to work around the problem by using .reg files to register the DLL, but that just defers the error message until the application tries to use the object.
Has anyone any ideas on how I can resolve this, or what causes it?
|
|
|
|
|
Sometimes I had similiar problems using RegAsm.
I don't know whether they help, but I have a few advices:
-Clear all Registry Entries made from previous attempts to register your Assembly (search the registry e.g. for the dll-names or UUIDs if any are given in your Code).
-If not already done, type an unique Versionnumber in 'AssemblyInfo.cs' (Important: Don't leave any '*' in the Versionnumber. The '*' shall cause the VS to generate a Versionnumber. I think it's the Buildnumber. But this simply doesn't work correctly, s.t. regasm may try to register a seemingly older version over a newer one.)
- If it still doesn't work:
Try to 'export' as few symbols as possible. That means (in C#): Use 'public' only on functions that are used by other dlls or via com (e.g. implemented Interface-functions must be public).
Use 'internal' for other functions instead.
As far as I understood, public in C# is for com like dllexport in C.
Please tell me if any of the advices helped.
|
|
|
|
|
The problem turned out to be that my DLL exposed an ADO recordset. This was not a problem on machines with Visual Studio.NET installed, because they have ADODB.DLL in the GAC. However, most user machines do not. So the solution was to copy ADODB.DLL from my local machine (C:\Program Files\Microsoft.NET\Primary Interop Assemblies\ADODB.DLL) to the target machine, and then install it to the GAC (gacutil -i ADODB.DLL).
|
|
|
|
|
Hi. I’m thinking about building a general purpose high score xml web service to use in my games. I’m currently working on the Pocket 1945 project, a classic shooter for the Pocket PC. The project can be found at http://workspaces.gotdotnet.com/pocket1945, and an article about the project can be found at http://www.codeproject.com/netcf/CfPocket1945.asp. The article was submitted for the Code Project .NET CF competition, so if you think the project sounds cool, please vote.
So, my web service problem is: how do I make the high score service “secure”? I mean, how can I be sure a method call is coming from a registered game, and not some one trying to fake the score? I was thinking along the lines of strong named assemblies that you register in a database and validate the request and see if it’s a registered assembly posting a new score. But, then again this is only SOAP calls that could be tempered with?
I’m open for any suggestion. How have other people solved this problem? Is remoting an option?
Thanks!
|
|
|
|
|
Hi, I have a major problem with the CallContext when hosting a MarshalByRef Object in the IIS. The problem occurs when the executing method in the IIS throws an exception. The effect is that the LogicalCallContext in the ResponseStream is always the same as in the RequestStream.
My use case is the following: In the CallContext I carry a Transaction Context. At server side this Transaction Context is set or removed. If no exception occurs everything works. But in case of a exception, the modified context is not returned to the client.
Furthermore I tested this scenario in a Windows Service Host (tcp channel with binary) instead of IIS (http channel with binary or soap). In the service host everything works fine, especially with the exceptions. Is this a bug in the http channel in connection with the IIS? I found nothing about it in other Message Boards or newsgroups.
I tried it with SingleCall or Singleton objects.
Thanks in advance for your help.
|
|
|
|
|
How would I register a new file type (file type name, extension, and icon) for my apps with Windows using .NET? Thanks is advance!
Happy Programming and God Bless!
Internet::WWW::CodeProject::bneacetp
|
|
|
|
|
Hi,
I guess you are asking how to register a new file type during setup of an application.
What I know is if you are making a deployment package for your project then you can do customization on registering new file types with extension and even define custom action on the same.
To do that, in your setup and deployment project use the "File Types Editor" which is the 3rd ICON on the top bar of solution Explorer window.
For more information on how to go about it in the editor please refer to the following URL :
Setup and Deployment Customization
Hope itz useful...
regards,
Aryadip.
Cheers !! and have a Funky day !!
|
|
|
|
|
Thanks for the information. Actually, I was wondering how to do it programmatically. Anyone have any ideas?
Happy Programming and God Bless!
Internet::WWW::CodeProject::bneacetp
|
|
|
|
|
You can use the Registry and RegistryKey classes in the Microsoft.Win32 namespace. Read Creating File Associations[^] under "Shell Basics" in the Platform SDK for more information.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Thanks for the help!
Happy Programming and God Bless!
Internet::WWW::CodeProject::bneacetp
|
|
|
|
|
I have a report that needs to be generated in PCL format. I set the output to be printed on the PCl print driver ported to Print To File. Whenever I print the output, I get this Windows Popup "Print to File" asking me for a file name. Been trying to find a workaround on this so filenaming is done programmatically, eg. via VB.Net. I have been told that the .Net framework does not currently support dynamic file naming. Anyone know if this is true? Is there any way to dynamically assign file when sending output to a PCL printer set to Print To File?
|
|
|
|
|
I have experience with C++/MFC/Win32 API but what da heck is that .NET Framework !? Where can i find extremely detailed information... Every tutorial i find is about damn VB and C#. Can anybody familiar with the same things with me help ??
|
|
|
|
|
.NET is a platform for developing managed applications. It is a large collection of library code for working with Windows in whatever language you see need in using, whether C++, C#, VB.NET, etc. Before working with .NET, I only worked with C++/MFC. In a lot of ways, working with .NET has improved the speed of my development. I still use "native", non-managed C++ for projects where I need more low-level control and performance since .NET can be a bit slower for more demanding projects. Native C++ doesn't use .NET while Managed C++ does take advantage of .NET. If you are planning on thinking of taking your C++ programming to .NET, I would personally wait until the next version of Visual Studio .NET (2005 or Whidbey)is released. When MSFT first released Managed Extensions for C++ (which are basically additional keywords so that C++ can more effectively be written for .NET), most people didn't care for the style of the extensions since they all started with "__" such as __gc, etc. In the next version, a more elegant syntax will be used. If you like to do Linux programming as well, you might be wondering, "If I use .NET, cross platform capability goes out the window." Actually, thanks to the MONO project (www.go-mono.org[^]), that problem will be solved since it is a Linux version of the .NET platform. Before I explored some in .NET, I wondered what all of the fuss was myself. I hope that clears up a lot of the mystery about .NET for you.
Here is some information about .NET:
http://msdn.microsoft.com/netframework/using/default.aspx[^]
http://www.go-mono.org/[^] (the Linux implementation)
Happy Programming and God Bless!
Internet::WWW::CodeProject::bneacetp
|
|
|
|
|
I have a serrious problem.I've developed an application on VC6 that used to work fine. Now I have converted it on VC.NET 7.0 and builded in RELEASE configuration. The problem is that it only works on my computer. On other computers that don't have VC installed it just doesn't start. If started with depends.exe (XP Support Tools) it gives the following error:
Second chance exception 0xC00000005 (Access violation) occured in "NTDLL.DLL" at address 0x77F8243D
Exited "program" with code 128(0x80)
They have all the necesary dlls. What should I do? I'm disperate.
If there is an error in program why does it work on my computer fine, and on other computers without VC .NET installed crashes without any errors??
Contact: nemoprod@go.ro, www.nemoprod.go.ro .
|
|
|
|
|
Just a wild guess. If you have the /clr switch turned on (that is you are using .NET in your VC++.NET project) do you have the .NET Framework installed on the other computers that you have been testing your program on?
Happy Programming and God Bless!
Internet::WWW::CodeProject::bneacetp
|
|
|
|
|
I've reinstalled Windows on my computer and then installed VS.NET 7.0 and the program isn't working on my computer either now. I have the .NET framework installed on my computer.When i try to debug it I receive this error: "Unhandled exception at 0x77f60b6f in nMonitor.exe: 0xC0000005: Access violation writing location 0x00030fdc."In the call stack it shows:" ntdll.dll!77f60b6f() "
Somebody help. This is strange.
|
|
|
|