|
Hi,
I'm trying to build a kind of a plugin-factory and I'd like to load these 'plug-ins' at run-time all using the same interface ect..
What I'm missing is a way to load the Class from a dll file into my program at run-time.
Using .NET 2.0 would be preffered but I'm kinda easy as long as I get a viable solution
thanks,
HHG
|
|
|
|
|
Looking for something like this:
string[] filePaths = Directory.GetFiles(FormMain.PluginsDirectoryPath, "*.dll");
for (int i = 0; i < filePaths.Length; i++)
{
try
{
Assembly assembly = Assembly.LoadFrom(filePaths[i]);
Type[] types = assembly.GetTypes();
IPlugin plugin;
for (int j = 0; j < types.Length; j++)
{
if (types[j].GetInterface(typeof(IPlugin).FullName) != null)
{
plugin = (IPlugin) Activator.CreateInstance(types[j]);
this.plugins.Add(plugin);
}
}
}
}
www.troschuetz.de
|
|
|
|
|
Thanks alot, this seems promising
|
|
|
|
|
Hello!
I'm documenting my C# project using XML comments (and building a CHM later using NDoc). Now I got a problem: I have an enum that contains many values and these values do not need to be documented, they are self-explanatory.
public enum Icons
{
None = 0,
Directory,
Apple,
Banana,
Computer,
...
}
Hundreds of icons. Now I want to document the enum itself, but not any of the possible values. Unfortunately, when compiling with level 4 compiler warnings, each value gives me a warning about a missing XML comment.
Is there any way to suppress such XML comment warnings?
Thanks in advance and best regards
Dominik
_outp(0x64, 0xAD);
and
__asm mov al, 0xAD __asm out 0x64, al
do the same... but what do they do??
(doesn't work on NT)
|
|
|
|
|
You can just disable the specific warnings in the compiler options.
|
|
|
|
|
But I don't want to disable all enum XML comment warnings... I only want to suppress the warnings for this specific enumeration.
Thanks for your reply and best regards
Dominik
_outp(0x64, 0xAD);
and
__asm mov al, 0xAD __asm out 0x64, al
do the same... but what do they do??
(doesn't work on NT)
|
|
|
|
|
Hi
There's no way to do what you want in .Net 1.1.
In .Net 2.0 you can use #pragma warning .
----------------------------
Be excellent to each other
EasiReports[^] My free reporting component for WinForms.
|
|
|
|
|
I'm using .NET 2.0.
Thanks for the tip! Works perfectly
Best regards
Dominik
_outp(0x64, 0xAD);
and
__asm mov al, 0xAD __asm out 0x64, al
do the same... but what do they do??
(doesn't work on NT)
|
|
|
|
|
hello all and thank you for your efforts
i am having a problem with declaring and using delegates. and what is the relation bet delegates and events in general.
what is a delegate?
what is an event in relation to delegates?
thank you very much
abdelhameed81@yahoo.com
abdelhameed81
|
|
|
|
|
|
hi
how to create and extract ISO file using c# technology
thanks
Raj
Project Leader
india
small
|
|
|
|
|
hi guys
if any one knows how to create virtual dirve using c# e.g. mount and unmount etc..
Rah
Project Leader
India
small
|
|
|
|
|
I'm testing this code and all I get is a freaking unhandled FormatException, I don't know why but it tries to parse an int from the string I send as parameter. Why is this happening?
<br />
PerformanceCounter pc = new PerformanceCounter( "Memory", "Available MBytes" );<br />
try<br />
{<br />
Console.WriteLine( "Available RAM: " + pc.NextValue().ToString() + "MB" );<br />
}<br />
catch (Exception e)<br />
{<br />
Console.WriteLine(e.ToString());<br />
finally<br />
{<br />
pc.Close();<br />
}<br />
The exception: System.FormatException was unhandled.
Message="Input string was not in a correct format."
at System.Int32.Parse(String s, IFormatProvider provider)
at System.Diagnostics.PerformanceCounterLib.GetStringTable(Boolean isHelp)
at System.Diagnostics.PerformanceCounterLib.get_NameTable()
at System.Diagnostics.PerformanceCounterLib.get_CategoryTable()
at System.Diagnostics.PerformanceCounterLib.CounterExists(String category, String counter, Boolean& categoryExists)
Thankful for any help. Is this class supposed to be used in another fashion since 2.0?
|
|
|
|
|
hi
i tried to insert to listview for each row a new image when i try to do it i see always the same image
what do i need to do?
thanks
have a nice day
|
|
|
|
|
How do I do voice chat.
How to convert voice into bytes.
Any Idea abt this .Please send me.
|
|
|
|
|
If you have got some solution for Voice Chat. Please also let me know how to do that. How are you capturing sound from Mic? if you are ready to convert it to byts? Please also help me if you get some clue. Thanks in advance.
Best Regards,
Rizwan Ahmed
|
|
|
|
|
Do one thing. Download VaxVoIP SDK from net. I think google search will help you to do that. VoIP is the better way of communication through Voic and text
.
Cheers
|
|
|
|
|
I have to view all drives,directories,files of a remote machine in to my
local machine.How can I do that in use of Tcp socket.
Deepthi
|
|
|
|
|
In my point of view, Remoting will be the simplest way to do that.
You can find a lot of articles on coderproject on remoting.
The idea is:
1) you'll write a remotable object (dll) with some function who gets this information from the local computer and returns this information to its caller. This information must be in serailizable form. you can use XML or even a string as a return type. All you need is to re calculalte you information from that returned value back.
2) A Server will expose this object to be called by the clients on a specific URI.
3) Client will use a proxy of that remotable object and connect to the server by registering a channel and Call that method remotely just like its a local function of it, get the required information.
I have tried to give you some idea. Please read some article about remoting. You'll achieve your goal within 30 minutes for sure after understanding remoting.
Best Regards,
Rizwan
|
|
|
|
|
Hi ...
I'm having trouble setting the values of the array in my class.
I tried this ... and i can set/get "x.name" but pgm crashes with an error message that says i do not have an instance of the array item when i try to set "x.number[1]".
namespace WindowsApplication1
{
public partial class Form1 : Form
{
class myClass
{
// fields
private string _name;
private double[] _number;
// properties
public string name
{
get { return _name; }
set { _name = value; }
}
public double[] number;
public double this[int index]
{
get { return _number[index]; }
set { _number[index] = value; }
}
// Default constructor:
public myClass()
{
name = "";
double[] number = new double[5];
number[0] = 0;
number[1] = 0;
number[2] = 0;
number[3] = 0;
number[4] = 0;
}
// Clear Numbers
public void ClearNumbers()
{
double[] number = new double[5];
number[0] = 0;
number[1] = 0;
number[2] = 0;
number[3] = 0;
number[4] = 0;
}
}
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
}
private void button1_Click(object sender, EventArgs e)
{
myClass x = new myClass();
x.name = "Charlie";
x.number[1] = 123.45;
}
}
}
My program works on x.name = "Charlie";
My program fails on x.number[1] = 123.45;
Please advise on how to fix my class definition to accomodate arrays.
Thank you.
-- modified at 10:17 Saturday 25th March, 2006
|
|
|
|
|
The code in the constructor is not even possible to compile. Why don't you show the code that you really are using?
I assume that the code in the constructor looks like the code in the ClearNumbers method, as that at least compiles...
You have two array references in the class, _number and number. You never assign anything to any of them, so of course you get an error message when you try to use any of them. If you look at the task list after compiling, you will see that the compiler has given you very informative warnings about this.
---
b { font-weight: normal; }
|
|
|
|
|
Sorry ... i have corrected the original post.
i should have just copy/pasted the whole original .. i did not actually save that much space when i copied just part of the problem ... and i introduced an error.
Thank you for pointing that out.
As you can tell ... i am a newbie at class definitions. I have no idea why the underscore character precedes the field names and then (if needed at all) why it is not used in EVERY reference to the field.
But not having a knowledgeable mentor ... i am subject to the problems associated with "mimicking" what i have seen in other class definitions.
I think u get the idea of what i am trying to accomplsh. Please suggest code change to the class so the button code works.
Thanks.
|
|
|
|
|
You have two arrays, like Guffa said, number and _number and you dont assign anything to either of them. The fact that they have the same name, give or take an underscore, means nothing, they are completely different variables that are in no way related to each other.
Your code crashes on x.number[1] because you havent initialised number to anything, and so it is currently null . So trying to access the second value of it will crash because there is no second element. Try the following code, is should work...
class myClass
{
private string _name;
private double[] _number = new double[5];
public string name
{
get { return _name; }
set { _name = value; }
}
public double[] number
{
get { return _number; }
set { _number = value; }
}
public double this[int index]
{
get { return _number[index]; }
set { _number[index] = value; }
}
public myClass()
{
name = "";
_number[0] = 0;
_number[1] = 0;
_number[2] = 0;
_number[3] = 0;
_number[4] = 0;
}
public void ClearNumbers()
{
_number[0] = 0;
_number[1] = 0;
_number[2] = 0;
_number[3] = 0;
_number[4] = 0;
}
} Hope that helps
Cheers,
Will H
|
|
|
|
|
Thank you so VERY much, Will ! Your suggestions work great!
I still do not understand the use of "this" in the code block ...
public double this[int index]
{
get { return _number[index]; }
set { _number[index] = value; }
}
... but for the time being, until i get that understanding, i can mimic what u showed me for future class definitions.
Your help is much appreciated!
|
|
|
|
|
That code block is there so that you can access myClass as though it was an array itself. It means that if you create an instance of myClass like so
myClass foo = new myClass(); then you can access your _number array in two ways. Like this...
double firstElement = foo.number[0]; and also like this...
double firstElement = foo[0]; The last way is only allowed because of the 'public double this[int index] ' accessor.
Glad I could help
Cheers,
Will H
|
|
|
|