|
I am developing appliation with ACR 38 and SLE 4428 card. I dont find API to be programmed in my .Net application on ACS website. Can you help so that i can directly use those API in my application.
my mail id : pratik81in@gmail.com
I know the ApI:
AC_Open
AC_StartSession
AC_ExchangeApdu
|
|
|
|
|
I use this
For i = 0 To CheckedListBox1.CheckedItems.Count - 1
DataGridView1.Rows.Add(1)
DataGridView1.Rows(i).Cells(0).Value = CheckedListBox1.CheckedItems.Item(i)
Next
But this add this "System.Data.DataRowView"
|
|
|
|
|
You have to convert the CheckedItems.Item(i) to a String or retrieve whatever text you used to label that item.
|
|
|
|
|
Hi,
I am reading all the directories but the loop gets broken when the directory doesn't have permission to read. Therefore I decided write the following function get the permit before I read a directory via code. However the function doesn't produce any result. Neither demand nor assert functions are wotking with or without "try" blocks.
How I can get at least a read permission to iterate trough the directories without having any security problem. I have incuded the following statement in assembly also.
Regards,
<Assembly: PermissionSetAttribute(SecurityAction.RequestMinimum, unrestricted:=True)>
'Here how I check the permission
If AskPermission(GetDir.FullName, FileIOPermissionAccess.Read) = False Then 'for testing
MsgBox("No permit")
End
End If
'This is the function called and if directory doesn't permit to read teh message supposedly should pop up but it doesn't
Public Function AskPermission(ByVal GetFile As String, ByVal GetPermissionType As FileIOPermissionAccess) As Boolean
Dim ps As New Security.PermissionSet(PermissionState.Unrestricted)
Dim fs As FileIOPermission
Dim ep As EnvironmentPermission
Dim Permitted As Boolean = True
fs = New FileIOPermission(GetPermissionType, Path.GetFullPath(GetFile))
ep = New EnvironmentPermission(EnvironmentPermissionAccess.Read, GetFile)
Try
ps.AddPermission(ep)
ps.AddPermission(fs)
fs.Demand()
Catch ex As Exception
MsgBox("no permit")
Permitted = False
Try
fs.Assert()
Catch dx As Exception
MsgBox("asseret failed")
Permitted = False
Finally
Permitted = True
End Try
End Try
Return Permitted
End Function
What a curious mind needs to discover knowledge is noting else than a pin-hole.
|
|
|
|
|
Hi,
This problem is almost identical to the previous situation you had encountered and the answer is the same as well. You have to differentiate between what the CLR will allow your code to do and what the operating system will allow the current user to do.
If you cannot navigate into the directory using Windows Explorer then the account does not have that permission and an attempt to get it through code will fail.
Usually, for example, a directory iterator will have to skip over the recycle bin. The problem is that without trying you will not know which directories are inaccessible. All you can do is catch the System.UnauthorizedAccessException and carry on.
http://www.codeproject.com/script/Forums/View.aspx?fid=1646&select=2926191&fr=292#xx2926191xx[^]
Alan.
|
|
|
|
|
Here is a very quick and dirty recursive loop that doesn't break when it finds a folder it can't access;
The form has a textbox for the startpath
a listbox box for all the found items
a listbox for the problem paths
a go button;
Imports System.IO
Public Class Form1
Private Sub getDir(ByVal path As String)
Try
'Get List Of Directories in current directory
For Each dirname As String In Directory.GetDirectories(path)
listFound.Items.Add(dirname)
getDir(dirname)
Application.DoEvents() 'Quick dirty solution
Next
'Get list of files in current directory
For Each filename As String In Directory.GetFiles(path)
listFound.Items.Add(filename)
Application.DoEvents() 'quick dirty solution
Next
Catch ex As Exception
listErrors.Items.Add("ERROR: " & ex.Message & " : " & path)
End Try
End Sub
Private Sub buttonGo_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles buttonGo.Click
listErrors.Items.Clear()
listFound.Items.Clear()
Try
If Directory.Exists(textStartPath.Text) Then
getDir(textStartPath.Text)
End If
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub
End Class
I don't know if that's what your trying to do, but this works with both mapped drives and unc paths, i have tested against a machine with known folders with no access and it simply adds them to the errors list and continues.
cheers,
|
|
|
|
|
Dave, Thanks for responding. My solution is the same actually but guess what happens during iteration. There is directory called "SYSTEM VOLUME INFORMATION" under C:\. The OS can't allow you to read this directory even you try to give the permission. Therefore code is skeeping it while recursively looping.
After "System Volume Information", there is temp and then Users directory. I placed a file under temp directory to check if the procedure could read it. It didn't read the temp but the one "Users" after the temp. Now I am trying to figure out this problem how it is skeeping the temp and directly jumping into Users. If you can figure it, let me know please. Thanks again.
Private Function CheckDirectories(ByVal GetDir As DirectoryInfo, ByVal worker As BackgroundWorker, ByVal e As DoWorkEventArgs) As Boolean
Static Barmax As Int32 = 0
Try
If GetDir.GetFiles.Count > 0 Then Call ReadFiles(GetDir)
'__________________________________________________________________
'
'
For Each SubDir As DirectoryInfo In GetDir.GetDirectories
Application.DoEvents()
'
'______________________________________________________________
'
If SubDir.GetDirectories.Count > 0 Then
Barmax += SubDir.GetDirectories.Count
Me._ProgressBarDir.Maximum = Barmax
Me._ProgressBarDir.Value += 1
Me._LabelDirMes.Text = GetDir.Name
End If
'We set backgroundworker controlling right here
If worker.CancellationPending Then
e.Cancel = True
Return False
End If
Me._LabelDirMes.Text = SubDir.Name
CheckDirectories(SubDir, worker, e)
Next
Catch ex As System.UnauthorizedAccessException
DirError = True
Note += GetDir.Name & vbCrLf
'Note is displayed with a message box out of this procedure to tell users about the directories with no
'permit
End Try
End Function
What a curious mind needs to discover knowledge is noting else than a pin-hole.
|
|
|
|
|
Once again, you cannot grant yourself permissions you do not already have. This code does NOT give you permission to read from that folder. No code you write will ever do this.
|
|
|
|
|
Your right Dave. I decided to go with try-catch blocks but a strange thing is happening now if you want to look at in my posted message may be you can figure it out. Thanks.
What a curious mind needs to discover knowledge is noting else than a pin-hole.
|
|
|
|
|
Hi CP Members,
I am trying to create an application which looks like Visual basic Editor Designer .
I am using pickbox from code project
http://www.codeproject.com/KB/miscctrl/CSPickBoxSample1.aspx for my controls.
It worked with single control now i tried to create a selections for multiple controls when ctrl +click . i am creating instances for the pickbox and i am changing the color of label controls to identify the multiple controls.
But how can i delete the instance again after ctrl +click once again on the selected control .I am not able to identify the instance of the pickbox for new multiple controls . so i am not able to unwire it as possible . Those instances are appearing on the screen which is not exaclty like in Visual Studio 2005 .
I am not able identify the instance of pickbox and not able to dispose the instance causing the selection to stay on top when i click the control.
for the control which is clicked with ctrl key + click
Private Sub ShowNewSelection(ByVal sender As Object)
Try
Dim pickselect As New pickbox()
pickselect .SelectControl(sender, New EventArgs)
Catch ex As Exception
End Try
End Sub
on ctrl+ click on the control/s.
or else just tell me how can i create the selections for mulitple controls if i press the control with CTRL + Click and to remove the created selection if i clcik the selected control again usign this Pickbox or any new way to achieve this . or link .
Its urgent and important.
I am trying to create exactly like in Visual Basic Designer 2005.
I struck here .
Any help ??
|
|
|
|
|
You best source of information is going to be the forum under that article.
I haven't used his article at all and haven't looked at the code, but I would imagine that you would have to have some kind of container control that hosts the selectable controls and manages which are selected and which are not.
|
|
|
|
|
How Can I Encrypt and Decrypt a String
remember its encrypt and Decrypt a null string also
Please,Help me
Arindam Banerjee
Sr. Software Developer
Rance Computer Pvt Ltd.
Kolkata (India)
|
|
|
|
|
Please check the following sample, I think you can also include null strings checking. I hope it works out for you.
Imports System.Text
Imports System.Security.Cryptography
Public Class Encryption
#Region "Public Routines"
const ENCRYPT_KEY AS STRING = "TEST"
const ENCRYPT_VECTOR AS STRING = "CODEPRJT"
Public Shared Function ToBase64(ByVal sDataToEncrypt As String) As String
Dim stream As System.IO.MemoryStream = New System.IO.MemoryStream
Dim key As Byte() = Encoding.Default.GetBytes(ENCRYPT_KEY.PadRight(24, Chr(0)))
Dim Vector As Byte() = Encoding.Default.GetBytes(ENCRYPT_VECTOR.PadRight(8, Chr(0)))
Dim des As TripleDESCryptoServiceProvider = New TripleDESCryptoServiceProvider
Dim cryptoStream As CryptoStream = New CryptoStream(stream, des.CreateEncryptor(key, Vector), CryptoStreamMode.Write)
Dim Input() As Byte = Encoding.Default.GetBytes(sDataToEncrypt)
cryptoStream.Write(Input, 0, Input.Length)
cryptoStream.FlushFinalBlock()
Return Convert.ToBase64String(stream.ToArray())
End Function
Public Shared Function ToBase32(ByVal sDataToDecrypt As String) As String
Dim stream As System.IO.MemoryStream = New System.IO.MemoryStream
Dim key As Byte() = Encoding.Default.GetBytes(ENCRYPT_KEY.PadRight(24, Chr(0)))
Dim Vector As Byte() = Encoding.Default.GetBytes(ENCRYPT_VECTOR.PadRight(8, Chr(0)))
Dim des As TripleDESCryptoServiceProvider = New TripleDESCryptoServiceProvider
Dim cryptoStream As CryptoStream = New CryptoStream(stream, des.CreateDecryptor(key, Vector), CryptoStreamMode.Write)
Dim Input() As Byte = Convert.FromBase64String(sDataToDecrypt)
cryptoStream.Write(Input, 0, Input.Length)
cryptoStream.FlushFinalBlock()
Return Encoding.Default.GetString(stream.ToArray())
End Function
#End Region
End Class
What a curious mind needs to discover knowledge is noting else than a pin-hole.
|
|
|
|
|
its throws an error message :
Specified key is a known weak key for 'TripleDES' and cannot be used
Arindam Banerjee
Sr. Software Developer
Rance Computer Pvt Ltd.
Kolkata (India)
|
|
|
|
|
I had the same problem but when I change the keys it worked out. Actually teh code doesn't belong to me. Try to use different string keys.
What a curious mind needs to discover knowledge is noting else than a pin-hole.
|
|
|
|
|
I need the code for accessing the IMEI number of PDA using windows mobile application..
Regards
Varun Prakash
|
|
|
|
|
Denied. This site does not exist to just hand over code. We'll help you write your own, but noone is going to write it for you. If you want prewritten code, you'll have to visit RentACoder.com and take your chances.
|
|
|
|
|
Hi all...
Suggest me how can I delete 2 or 3 lines from the mid or any location of file without changing other lines of file.
Thanks.
Gagan
|
|
|
|
|
A brute-force way could be that you use File.ReadAllLines[^] which gives you an array of string, then remove the unwanted elements and then use WriteAllLines[^] to write the contents.
Another way would be to use TextReader.ReadLine[^], loop through the rows and if you want to save the row, use StreamWriter class to write the data. For an example, have a look at the example in TextWriter[^].
|
|
|
|
|
Thanks for your suggestion.
Gagan
|
|
|
|
|
--> i want to send form-events from the form to a class library... which i want to handle them in the class library... but i cannot find any way to do this...
e.g: keypress event of a textbox.....
--> How can i handle events in a class library..?
J A Nasir K
modified on Saturday, February 21, 2009 8:38 AM
|
|
|
|
|
You should have event handlers defined in your class library. You register those event handlers with the Form events. When the event is fired(from the Form), all event handlers registered will be invoked. Since your class library had registered, its event handler will also be invoked.
|
|
|
|
|
Hi i have a problem that is making me scratch my head until it hurts.
Hopefully someone can help. Well in my project I have a graph were I plot information from a database. Anyways, when I draw my data to the screen I add each point to an arraylist. I use an arraylist since the number of points can vary. So I have my points drawn on screen so next is were my problem comes in. What I want to happen is when the mouse pointer goes over any of my points on my graph, then a small box pops up with more information. So in my mousemove event I have code as follows
For Each p As Point In myCoordinatesArrayL
gPath.AddEllipse(p.X, p.Y, 30, 30)
If gPath.IsVisible(mouse.X, mouse.Y) Then
'Then make my small window pop up
Else
'Do nothing or close small window if its up
End If
Next
So im taking the points from my arraylist and adding an ellipse to a graphics path. Then I check
the graphics path 'IsVisible' function if the mouse's x and y are over it.
I have mixed results with this so far. Some strange and unexpected things have happened. I can get the window to pop up but sometimes it doesn't. I have done a bit of error checking were I have placed two labels on my form and I increment a number when ever the mouse is not over the points and then increments the other number when the mouse pointer is over the point. This has unexpected results such as when I have only one point on the screen and i move the mouse over the point then both label increment and when i have more than one point on the screen, its works as expected except for the first point on my graph where is produces the same problem.
Hope you can make sense of this. Is there a better way to do what im trying to do. Any suggestions.
Thanks for your help
|
|
|
|
|
You creating an ellipse for every point in the graph every time the mouse moves?? Wouldn't it be easier to just track the mouse movement, mapping it to the closest point in the X axis, then just create the one ellipse to see if the mouse is in it?
Also, the code looks incomplete. Are you Disposing the GraphicsPath you created when you're done with it?? Are you creating a new one every time you iterate through this loop?? You don't need to.
|
|
|
|
|
Hi,
Not sure I know what you mean. So i think that for every point in my arraylist that I should
check its x coordinate against the mouse x coordinate and then if it does , then i should add the ellipse to my graphics path. This is what I've tried but its not really working for me
For Each p As Point In myCoordinatesArrayL
If p.X = mouse.X Then
gPath.AddEllipse(p.X, p.Y, 30, 30)
If gPath.IsVisible(mouse.X, mouse.Y) Then
'code for displaying my window
End If
Else
'do nothing or close my window
End If
Next
I dont have code to dispose the graphicsPath here but in my forms closing method. Is this right
Thanks for your time
|
|
|
|