Reputation: 8 Worker
- Active Members
- Active Posts:
- 435 (0.24 per day)
- 22-September 10
- Profile Views:
- Last Active:
- Sep 28 2015 12:04 AM
- OS Preference:
- Favorite Browser:
- Internet Explorer
- Favorite Processor:
- Favorite Gaming Platform:
- Your Car:
- Dream Kudos:
Posts I've Made
Posted 25 Sep 2015I am not sure about other brackets which could appear within filenames - but i assume the could appear.
jkndjkandjksadasdk-34344_dwdw-wdwid78w(1) rgrgrgjyj_dwd-2323(3).html Report34_2015-03-04(6).whatever Report-3434_34d-dwd(4)
What i am aware files could contain as above files (number) at the end. But there could be situation that e.g file would be like this:
jkndjkandjks)adasdk-34344_dwdw-wdwid78w(1) Report34_20(15-03-04(6).whatever Rep(ort-3434_34d-dwd(4)
in above cases code should only check - recognize only the bracets at the end of file and not bracets 'before'.
Posted 24 Sep 2015Basically all of our codes are not secure on situation that there would be more brackets within filename.
Maybe it's good to make additional assumptions:
1) if file contains more/less than 1 open bracket And 1 close bracket- then return original file name
I took Razor's code and made function out of it. please take a look what can be tuned up here?
Private Function DeleteBrackets(ByVal fn As String) As String Dim countOpenBracket As Integer = fn.Split("(").Length - 1 Dim countCloseBracket As Integer = fn.Split(")").Length - 1 '-- If only one occurence of ( and one occurence of ) If countOpenBracket = 1 And countCloseBracket = 1 Then Dim filextension = IO.Path.GetExtension(fn) Dim filewithoutExtension As String = IO.Path.GetFileNameWithoutExtension(fn) 'Debug.Print("Oryginal file name = " & fn) 'Debug.Print("File name without extension = " & filewithoutExtension) 'Debug.Print("Extension = " & IO.Path.GetExtension(fn)) If filewithoutExtension.EndsWith(")") Then fn = filewithoutExtension.Remove(filewithoutExtension.LastIndexOf("(")) 'Debug.Print("After removing last index of ( = " & fn) 'Debug.Print("Adding again extension = " & fn & filextension) End If 'Debug.Print(fn) End If Return fn End Function
Posted 20 Sep 2015Why i decided to do it is to learn correctly how event working therefore i decided to make event better than just select case within DoSomething.
It's fully clear for me but i am just wondering is it good use of events like we have here. From my knowledge use of events is exactly how we did so: the parser raising event then some subscriber is getting that notification by his method event handler which is called at the moement event in Parser has been executed right? What we do additionaly is sending back some value by custom event class to parser.
So my question is it all correct what i wrote or there is completly diffrent point of using events?
Posted 20 Sep 2015Thanks for youur answer. I am thinking right now what's benefit to use event in this way? It would be easier to just use select case within "DoSomething" method without creating additional event, custom event class etc. Why it is good to go this way with event i mean is much simpler and less code without. Can you explain? Maybe usage of event i am doing is not correct example of event use?
Posted 3 Jul 2015problem is i cannot find out some enough resource from where start to go. I found only inputs how to read images from photoshop or similar Staff. Hope someone from this forum can point correct place i could Begin. Anyhow i am still looking for it myself without success.
- Member Title:
- D.I.C Regular
- Age Unknown
- Birthday Unknown
- Full Name:
- Years Programming:
- Programming Languages: