I can't create a list of string based on search criteria. If a search for "user= test" form textbox I want all the paragraph which belongs to this user to be included in list of string not just one row and then delete all rows which belongs to this user including [account], user,pwd,description,email,address,zip.
I think I don't need to split but join this in a string based in search criteria. (user= test)
Please help me with real code based on the list below
user = test
pwd = test
description = test
email = "firstname.lastname@example.org"
address = "balalala"
zip = 235555</b>
Shared Iterator Function GroupAccounts(ByVal lines As IEnumerable(OfString)) As IEnumerable(Of IList(OfString))
Dim currentAccount As List(OfString) = NothingForEach line AsStringIn lines
IfString.IsNullOrWhiteSpace(line) ThenContinueForIfString.Equals(line, "[account]", StringComparison.OrdinalIgnoreCase) ThenIf currentAccount IsNotNothingThen Yield currentAccount
currentAccount = New List(OfString)()
EndIfIf currentAccount IsNotNothingThen
EndIfNextIf currentAccount IsNotNothingThen
EndIfEndFunctionShared Iterator Function UngroupAccounts(ByVal groupedAccounts As IEnumerable(Of IEnumerable(OfString))) As IEnumerable(OfString)
Dim started AsBoolean = FalseForEach account As IEnumerable(OfString) In groupedAccounts
If started Then
EndIfForEach line AsStringIn account
started = TrueNextEndFunctionSharedFunction RemoveUser(ByVal groupedAccounts As IList(Of IList(OfString)), ByVal userToRemove AsString) AsBooleanDim found AsBoolean = FalseFor index AsInteger = groupedAccounts.Count - 1To0Step -1
If groupedAccounts(index).Any(Function (line) String.Equals(line, "user = " & userToRemove, StringComparison.OrdinalIgnoreCase)) Then
Found = trueEndIfNextReturn found
Dim sourceLines As IEnumerable(OfString) = IO.File.ReadLines(textpath)
Dim groupedAccounts As IList(Of IList(OfString)) = GroupAccounts(sourceLines).ToList()
If RemoveUser(groupedAccounts, txtuser.Text.Trim()) ThenDim resultLines As IEnumerable(OfString) = UngroupAccounts(groupedAccounts)
NB: This will remove any lines from the file which come before the first [account] header, remove any blank lines within an account, and ensure that all accounts are separated by two blank lines.
'Dim countMatchingLines As Integer = 0
'Dim lines() As String
'Dim outputlines As New List(Of String)
'Dim searchstring1 As String = txtuser.Text.Trim()
'lines = IO.File.ReadAllLines(textpath)
'For Each line As String In lines
' If line.Contains(searchstring1) Then
' countMatchingLines = 7
' End If
' If countMatchingLines = 0 Then
System.InvalidCastException: 'Unable to cast object of type 'System.Collections.Generic.List`1[System.Collections.Generic.IList`1[System.String]]' to type 'System.Collections.Generic.IEnumerable`1[System.Collections.Generic.IEnumerable`1[System.String]]'.'
I have problem with Bytes Written randomly in textfile
Text replace correctly but when i open file with hex editor (HxD) and compare files some bytes replace with 81 45
Dim binaryfile As String = "E:\1.txt"
Dim txt As String
Dim encoding As System.Text.Encoding = System.Text.Encoding.GetEncoding(932)
Using fr As StreamReader = New StreamReader(binaryfile, System.Text.Encoding.GetEncoding(932), False)
txt = fr.ReadToEnd
txt = txt.Replace("111", "2222")
My.Computer.FileSystem.WriteAllText(binaryfile, txt, False, System.Text.Encoding.GetEncoding(932))
Could you imagine an artist painting without brushes or Michelangelo sculpturing without chisels? Obviously, no. The fact is similar to web developers who can’t build web apps of enterprise level without the hold of some right tools.
So lets discuss the top 5 list of helpful .Net tools which is used by application development experts.
I want to implement a chatbot using ASP.Net. I want to merge chatbot in my existing project. But, I don't know how to do it. Even, I am not familiar with the functionality of chatbot. Is there anyone who can help me?
Hopefully this forum is appropriate for this question. No one seems to visit the graphics forum very often.
I need to be able to both import and export a 16 bit grayscale png file. I have found some help with importing but exporting is a big problem. I have found stack overflow references to Magick.NET but I cannot get this source to compile in VS 2012 as it requires build tools 141 and setting it to 110 results in errors, one of which is a missing dll that I cannot find using internet resources. I have already tried installing runtimes for later versions and for some reason they cannot be used. Probably because I use Windows 7.
Are there any other alternatives? Or advice on how to get a runtime of Magick.NET? I need to be able to read, manipulate (on an individual basis), and save 16 bit grayscale pixel values to a heightmap for importing into various terrain editors.
In terms of manipulating, I can probably use the native 48 bit rgb pixel format (please correct me if I am wrong) for display, convert, and then just read/write to the image directly but I still need to find a runtime that supports reading and writing to the 16 bit format. It would be nice however, if there was a library that did this automatically.
Thanks for your quick reply. That looks like a native library. Not necessarily a problem but I am curious if there is a .NET wrapper. Also, is that a dll separate from the software or will I need to run GIMP? Is there any documentation on the class formats and uses? I am noticing things like "image_id" and other proprietary data types. One problem I may run into is that I currently need a 64 bit library as my project requires enough memory to produce extremely large bitmaps for illustrating data (I need around 2,061,341,604 bytes available for a 22701 x 22701 image in addition to the regular memory used by the application which is not small by itself).
Last Visit: 14-Dec-18 14:01 Last Update: 14-Dec-18 14:01