|
Yes, I see how I could use that to select a certain day, but how from there can I tell if that day has been selected/highlighted by the user? I've gone through documentation and this is my primary problem.
Thanks though.
There are only 10 types of people in this world....those that understand binary, and those that do not.
|
|
|
|
|
As I keep saying, you must iterate through the dates between the MonthCalendar.SelectionStart and MonthCalendar.SelectionEnd dates. That snippet of code I posted the first time does this. The TimeSpan merely adds i days to the SelectionState DateTime and adds that to the array. The SelectionRange is contiquous to simply iterating inclusively between the SelectionStart and SelectionEnd dates is how you get an array of the selected dates.
-----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-----
|
|
|
|
|
How exactly, then, is it determining if the date was selected/highlighted? That snipped just appears to go through all the dates. Does the SelectionRange only give dates that were selected?
BTW....I'm at work now and unable to play with the code in question ("my own" code at home)....so I'm going by memory (e.g. code is not in front of me). That's why I'm unable to put this in and test and see what you mean.
There are only 10 types of people in this world....those that understand binary, and those that do not.
|
|
|
|
|
As I've mentioned a couple times now, the SelectionRange is inclusive, meaning that every date between MonthCalendar.SelectionStart and MonthCalendar.SelectionEnd is selected. Unless there's some undocumented feature of the MonthCalendar or you've extended and overridden its behavior, this is how the MonthCalendar works - a single date range can be selected.
Now, if you want to track every selection the user makes, handle the MonthCalendar.DateSelected event and add the range from DateRangeEventArgs.Start and DateRangeEventArgs.End to an ArrayList or something, which you can later use ArrayList.CopyTo to create an array from the 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've got it now and am only posting it here now for posterity. I must have been pretty tired when I worked on it last because it was right there as obvious as could be. I swear I went through the docs on the MonthCalendar class about 5 times and didn't see what I wanted, but NOW I see there is a property BoldedDates which returns to me an array of DateTime[] of all the dates that are bolded. Which is EXACTLY what I was trying to get.
Why it was so hard, I don't know. Like I said...I must have been tired...it was late last Saturday or Sunday night when I played with it last.
There are only 10 types of people in this world....those that understand binary, and those that do not.
|
|
|
|
|
You never said bolded dates - those are different from selected dates, hence even the different property names. If you had specified that before, I could've told you immediately; of course, if you had looked at the class members like I mentioned you should do before - i.e., read the documentation - it should'be been obvious.
There is a big difference between bolded and selected dates, 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-----
|
|
|
|
|
Hi all,
I would like to be able to determine at the start of my app if the user has enough permissions for many different files/folders.
I have read articles that discuss calling Win32 API NTFS calls, and Active Directory calls to get ACLs, but this seems like something that I would think would be inside dot net some how. No?
Like something like:
if( File.GetPermissions( "C:\\my cars" ) == FileAccess.Read | FileAccess.Write )
{
// good
}
else
{
MessageBox.Show( "Not enough permissions. );
}
Anyone got any ideas?
Thanks alot for any help you can lend,
Kris.
|
|
|
|
|
Krisp,
I do not know if this going to help you or not. But System.IO.File.GetAttributes(FileName)returns a file's attributes. Typical Attributes are Archive, ReadOnly and hidden, I am sure there is more.
Hope this helps!
|
|
|
|
|
No, that doesn't get any file permissions such as: can the user read/write.
I had looked at that myself as well.
But thanks anyways.
|
|
|
|
|
Thats ok, I was reading this on an other site. It deals with permissions.
http://www.codeguru.com/cs_misc/Security.html
|
|
|
|
|
No, there is currently nothing in the .NET base class library that deals with NTFS permissions. There may be some third-party libraries out there and I'm sure "Longhorn" will introduce such encapsulation, but you either have to use the NTFS APIs or try to write a zero-byte file to the directory and catch any exceptions that are thrown.
For more discussion about alternatives, please click the "Search Comments" link above. We have covered this in the past. There are also a few articles here on the CP web site. Use the search text box toward the top of the page (below the logo).
-----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-----
|
|
|
|
|
|
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.
|
|
|
|