|
|
By P/Invoking the functions you need. See DllImportAttribute for more information. It would also be best to encapsulate this into a nice class or classes. It will give you and your clients a better object-oriented approach to dealing with CAB files.
-----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-----
|
|
|
|
|
what is the corrsponed type in C# that means the type void* in C++
|
|
|
|
|
IntPtr . You should also read about interoperability in .NET in the .NET Framework SDK, as well as understand what the intrinsic types are. In .NET, this is pretty easy because the bit size is part of the Type name, like Int32 is 32 bits. Knowing what the types are in the Win32 APIs isn't always so easy, but looking at the data types in the Platform SDK at http://msdn.microsoft.com/library/en-us/winprog/winprog/windows_data_types.asp[^] can help, especially if you have the Platform SDK installed so that you can search the headers for the typedef (personally, I use gvim.exe (Graphical Vi IMproved) with tag files created by ctags.exe).
-----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 have a .net/C# project that prompts the user for a couple of parameters during installation. These parameters are then passed to an installer class as a custom action which validates this data before letting installation complete.
I am now trying to do a silent installation deployment of the application and want the user to type in these parameters as command line arguments. I have played around with msiexec.exe and how to install .msi files under silent mode. That being said, I cannot figure out how to pass command-line data to a custom action that is an installer class (!) Before I was just using the CustomActionData property and feeding in the parameters that way - but having trouble now trying to do this from the command line. Anyone have any advice? Thanks.
|
|
|
|
|
Add a secure public property (all capital letters and added to the semi-colon-delimited list of the SecureProperties property) to your installer project and use that public property (using the square brackets, [PROPERTY]) as the value for the param(s) of your Installer class. A user can then use msiexec.exe /i ... Package.msi /PROPERTY=Value. I use this for our installation and it works great. You should also consider giving this property a default value as well.
The only real problem is that the Windows Installer project for VS.NET is very lacking. You'll either need to use a real development environment like Wise for Windows Installer or the very expensive InstallShield DevStudio, or download the Windows Installer SDK from http://msdn.microsoft.com/platformsdk[^] and install the Orca.msi package to obtain Orca - perhaps one of the best tools for MSI developers and AD administrators! Just open your compiled MSI package in that and add the property to the Property table post-build. You can use that same property name in your Custom Action command line for your Installer class at design-time, though.
-----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 - appreciate it. I will take a look at Orca as well.
|
|
|
|
|
I cannot find the SecureProperties property?!? I searched the documentation as well and do not see anything about it... can you give me some direction?
|
|
|
|
|
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
|
|
|
|