Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Imports System
- Imports System.IO
- Imports System.Net.Mime.MediaTypeNames
- Imports System.Text
- Module Program
- Sub Main(args As String())
- Dim reader As New StreamReader("Masks.txt", Encoding.Default)
- Dim dictionary As New Dictionary(Of String, Integer)
- Dim a As String
- Do
- a = reader.ReadLine
- If a Is Nothing Then
- Else
- Try
- dictionary.Add(a, AddMask(a))
- Catch ex As Exception
- End Try
- End If
- Loop Until a Is Nothing
- reader.Close()
- Dim keyList As List(Of String) = (From tPair As KeyValuePair(Of String, Integer) _
- In dictionary Order By tPair.Value Ascending
- Select tPair.Key).ToList
- Dim FileName As String = System.AppDomain.CurrentDomain.BaseDirectory & "\Masks_New.txt"
- IO.File.WriteAllLines(FileName, keyList)
- End Sub
- Private Function AddMask(ToAdd As String)
- Dim TAD As String = ToAdd
- Try
- TAD = TAD.Replace("d", "2").Replace("l", "3").Replace("u", "3").Replace("s", "4")
- Catch ex As Exception
- End Try
- Dim XX = TAD.Split("?")
- Dim intList() As Integer
- intList = (From str As String In XX
- Where Integer.TryParse(str, Nothing)
- Select (Integer.Parse(str))).ToArray
- Dim prod As Long = intList(0)
- For i As Integer = 0 To intList.Length - 1
- prod *= intList(i)
- Next
- Return Math.Round(prod / 1000, 2)
- End Function
- End Module
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement