|
I'm sorry, it is SecureCustomProperties. It probably won't exist in the MSI created from the Windows Installer proejct in VS.NET, so just add it and remember that it is a semi-colon-delimited list.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
I do an encryption with hashing and now try to check itfor myself so I show output of encyption in my console application ,then I replcae one of characters with another one to check changing the string and my hashing mechanism get it,for example replace 2 with 1.But in this situation I get run time error at the line which I use FlushFinalBlock() for my decryptor stream. Any suggestion?
Mazy
No sig. available now.
|
|
|
|
|
Could you please post the exception text? This would be far more helpful than "run time error".
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
Oh,Sorry,thats the things that I always say to others,now I gorget it myself.
This is an error message: Bad Data
This is an ecryption between web service and a client so I convert bytes to string,and it look like this:
232 121 32 45 23.....
For doing some test I replcae all 2 with 1 programically, but changing cause to this eeror at line I told, I write my IV at the begining of string maybe changing in that cause this,any idea?
Mazy
No sig. available now.
|
|
|
|
|
You should be transfering this data as base64. See the FromBase64Transform and ToBase64Transform . There should also be some sample code in there, too. Basically, the plain text and cipher text is run through these transforms which encodes and decodes the data using base64 transforms. This is what most cryptographic providers use as an encoding when transferring cipher text. Converting bytes to strings like you are is not a standard encoding so the cryptographic transforms won't understand it.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
Thhanks Heath...Ok,I'll do it. But that error does not happend at regular time,it only happend if I change the some charachters inside my application.
Mazy
No sig. available now.
|
|
|
|
|
If you're changing the cipher text it shouldn't decrypt. What's the point of encryption, then? Throwing an exception is what should be happening in some cases, and "Bad data" sounds about right. I got that once or twice when testing my XML Digital Signatures sample code to make sure that changing the signature digest invalidated the signature.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
Fair enough.
Mazy
No sig. available now.
|
|
|
|
|
I am looking for a way to enter and edit text on an image displayed on a form. Any suggestions
|
|
|
|
|
|
I have a control 'MyControl' with a property of type 'MyObject'. MyObject has a property 'MyField' that is a enum type. I want the type of enum to vary depending on a another property of MyObject called 'MyFieldType'. E.g. if MyFieldType = TypeA, MyField returns EnumA. See code below:
public enum FieldTypes
{
TypeA,
TypeB
}
public enum EnumA
{
Big,
Medium,
Small
}
public enum EnumB
{
Short,
Tall,
Squat,
Huge
}
[DefaultProperty("MyFieldType")]
public class MyObject
{
private FieldTypes m_MyFieldType;
private object m_MyField = 0;
public FieldTypes MyFieldType
{
get {return m_MyFieldType;}
set {m_MyFieldType = value;}
}
public object MyField
{
get
{
if (MyFieldType == FieldTypes.TypeA)
{
return (EnumA)m_MyField;
}
else
{
return (EnumB)m_MyField;
}
}
set
{
m_MyField = value;
}
}
}
My problem is that the MyField property is not editable via a dropdown list in the designer. It appears as a greyed-out (read only) string representation of the respective enum (EnumA or EnumB). I've tried writing a TypeConverter (inheriting from EnumConverter) but just ended up going round in circles.
Does anyone have an example of what I'm trying to do or point me in the right direction?
Thanks
|
|
|
|
|
It is because you are returning object. That said, if you return an object from an encapsulting class, and apply the ExpandableObjectConverter, you should be able to access the "real" properties.
leppie::AllocCPArticle("Zee blog"); Seen on my Campus BBS: Linux is free...coz no-one wants to pay for it.
|
|
|
|
|
MyObject is already using the ExpandableObjectConverter that's not the problem. It's the MyField property. If I use an ExpandableObjectConverter for this property, the property becomes editable, but as a string not an enum. I think I need to use some kind of EnumConverter and dynamically specify the enum type, but I don't know how.
|
|
|
|
|
You wanna make a typeconvertor for the type and apply that. The key methods to override (implement) is SupportValues() and GetSupportedValuesCollection() (the method names are most likely wrong too lazy to look them up). This will automaticaly create an "enum" like convertor, do not implemeted any other methods.
leppie::AllocCPArticle("Zee blog"); Seen on my Campus BBS: Linux is free...coz no-one wants to pay for it.
|
|
|
|
|
What is the best way to update a treeview node in place?
I have a tree view that exposes the nodes to an XML editor. When the value of this node changes [in the XML editor], I' like to update the tree to show the new value.
Coding in the heartland
|
|
|
|
|
There is no direct binding support such as this (though you could add support). Instead, watch the XML fragment/file for changes and update the node text. There are so many ways of doing this, however, that it'd be difficult to list them all here.
You could, for example, watch for any changes in your editor (like for a multi-line TextBox handle the TextChanged event). When it changes, rebuild your tree from the XML information in the TextBox . To update just the node who's representation has changed in the XML fragment/file, it would be much more difficult. You could construct a path by recursing up the parent elements and pre-pending the text each time, using the TreeView.PathSeparator to separate each node. Then use that to find the node in the tree and update only that TreeNode . This would get increasingly difficult for added and removed nodes because you would also have to take state into account. Most implementations I've seen simply refresh the tree, which is apparent for larger XML hierarchies.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
Thanks Heath.
Fortunately, for this application I won't have to worry about too many added or removed nodes.
I continued to play around with the functionality I was looking for. The combination of events that gives me the functionality I'm looking for is both KeyUp and Leave. But, I see that TextChanged would work just as well. Thanks.
I set a flag to manage the dirty state of my text box and this seems to work well even when I have a 6mb XML file loaded in the tree.
I was looking for the method that I use to update just a single node in place. As you said, "simply... refresh the tree". Thanks. That works fine.
Coding in the Heartland
|
|
|
|
|
Hopefully one of you guys could help me with this query about enumerations.
Heres a simple enumeration :
public enum e {Val1=1, Val2=2 }
This allocates Val1 as int 1, Val2 as int 2 and so on, so if i do :
int x = (int) e.Val2;
x is given the value of 2
Now heres the thing, I want to allocate four int values, now I know this code isnt right but it gives an idea of the effect I am after :
public enum e {Val1="1,2,3,4", Val2="5,6,7,8"};
So if I use the following code :
int[] x = (int[])e.Val2
Which would populate the int array X with the values 5,6,7,8
|
|
|
|
|
Anonymous wrote:
public enum e {Val1="1,2,3,4", Val2="5,6,7,8"};
The reason this does not work is because enum is intrinsically an int .
Anonymous wrote:
int[] x = (int[])e.Val2
Even if e.Val2 returned a string this code would not work because it is not possible to directly convert a string to an array of int s.
An idea might be to set up an array of arrays that map to the enum:
public enum e{Val1 = 0, Val2=1}
int[] x = (int[])myArray[(int)e];
--Colin Mackay--
EuroCPian Spring 2004 Get Together[^]
|
|
|
|
|
That is absolutely not supported! No arrays, no strings, ... you'd get the following error:
Type byte, sbyte, short, ushort, int, uint, long, or ulong expected
Hmm however you can combine 2 int16s into an int32 and find the values by doing some bit manipulation (in a function you call to calculate the values based on the int32 of the enum) I think, but that is way too complicated...
Why would you want to do such thing anyway?
greetz
*Niels Penneman*
Software/Dev Site Personal Site
|
|
|
|
|
As the two previous posts said, this isn't possible for the reasons they gave. You can, however, use read-only members in a class like so:
public sealed class Values
{
private Values() {}
static Values()
{
Val1 = new int[] {1, 2, 3, 4};
Val2 = new int[] {5, 6, 7, 8};
}
public static int[] Val1;
public static int[] Val2;
}
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
I use remoting in my application, which proofed to be very useful but now i have a small problem.
In the server application the remote object is register as an available service in singleton mode.
RemotingConfiguration.RegisterWellKnownServiceType(
typeof(RemoteObject),
"Server",
WellKnownObjectMode.Singleton );
Now I'm searching a way to unregister it in the server application, so no remote calls from clients are processed?
|
|
|
|
|
If you use a configuration file to publish the types you want remoted, you can use the RemotingServices.Disconnect to stop the object from receiving further messages. See the documentation for that method for more information.
The only other way is to stop the AppDomain in which the WKO is registered. If you're using a Windows Service, you can stop the service both manually using the Services snap-in or the ServiceController class. If you're hosting this in another process, you could create a separate AppDomain and launch an executable that registers the WKO, then when you want to stop it unload the AppDomain using AppDomain.Unload .
One more way that wouldn't unregister the WKO but would keep it from processing requests (which I wouldn't recommend because clients will still see the published WKO) would be to put the interface in a shared library and the implementation of that on the server. Have an internal method that you can call that could do something like set a flag. In each of your interface implementation methods / properties, check that flag and either don't return anything or throw some sort of exception, like NotSupportedException or something. The first two methods are more complete, IMO.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
Thanks for info!
I'm now using this code in my server application and it functions very well.
this.remoteObject = new RemoteObject();
System.Runtime.Remoting.RemotingServices.Marshal(this.remoteObject, "Server");
System.Runtime.Remoting.RemotingServices.Disconnect(this.remoteObject);
|
|
|
|
|
I have just finished creating a C# class library that has public classes available in it, when i include this lib in my test applications it works fine, but when i passed it to the division i wrote it for they complained it will not work. The error they get is as follows:
"An unhandled exception of type 'System.TypeLoadException" occurred in unknown module. Additional information: could not load type"
It then lists the class they are trying to access from my component.
They are adding a reference to an existing C# app, when they create a test app and add it the component works fine.
My question is what does this unhelpful error message mean and how can i fix it?
Any help would be great
Simon Wren
simon.wren@nesltd.co.uk
Senior Software Architect
National Energy Services Ltd
Visit Us: www.nesltd.co.uk Or: www.nher.co.uk
|
|
|
|