SoftWarly Engine 1 V1.1.0.3 First Class |
Imports System.IO
Imports System.Net.Mail
Imports System.Threading
Public Class SoftEngine
'If you have any questions please email [email protected]
'SoftEngine Version 1.1.0.3
'Getting AppName and Compony name
Public Shared ComponyName As String = My.Application.Info.CompanyName
Public Shared AppName As String = My.Application.Info.AssemblyName
'AppStartUpPath was added by Markus Ritter
Public Shared AppStartUpPath As String = Application.StartupPath
'Settings was added by Markus Ritter
Public Shared Sub EditSetting(ByVal FileDir As String, ByVal value As String)
Dim objwriter As New System.IO.StreamWriter(FileDir)
objwriter.WriteLine(value)
objwriter.Close()
End Sub
'Settings was added by Markus Ritter
Public Shared Function ReadToEnd(ByVal FileDir As String) As String
Dim objreader As New System.IO.StreamReader(FileDir)
Dim Result As String = ""
Result = objreader.ReadToEnd
Console.WriteLine("This is the string :" + Result)
objreader.Close()
Return Result
End Function
'Settings was added by Markus Ritter
Public Shared Function ReadLine(ByVal FileDir As String) As String
Dim objreader As New System.IO.StreamReader(FileDir)
Dim Result As String = ""
Result = objreader.ReadLine
Console.WriteLine("This is the string :" + Result)
objreader.Close()
Return Result
End Function
'Settings was added by Alex Ritter
Public Shared Function TestSetting(ByVal FileDir As String)
Dim Result As Boolean
If My.Computer.FileSystem.FileExists(FileDir) Then
Result = True
Else
Result = False
End If
Return Result
End Function
'Settings was added by Alex Ritter
Public Shared Sub CreateSettingFile(ByVal FileDir As String, ByVal Value As String)
My.Computer.FileSystem.CreateDirectory(GetDirectory)
Dim objmaker1 As FileStream = File.Create(GetDirectory() + FileDir)
objmaker1.Close()
Dim objwriter1 As New System.IO.StreamWriter(GetDirectory() + FileDir)
objwriter1.WriteLine(Value)
objwriter1.Close()
End Sub
'Update was added by Alex Ritter
Public Shared Sub StartUpUpdate()
Dim request As System.Net.HttpWebRequest = System.Net.HttpWebRequest.Create("Verson File Link")
Dim response As System.Net.HttpWebResponse = request.GetResponse()
Dim sr As System.IO.StreamReader = New System.IO.StreamReader(response.GetResponseStream())
Dim newestversion As String = sr.ReadToEnd()
Dim currentversion As String = Application.ProductVersion
If newestversion.Contains(currentversion) Then
Else
Dim ask As MsgBoxResult
ask = MsgBox("There Is A New Update, Would You Like To Download It?", MsgBoxStyle.YesNoCancel, "New Update")
If ask = MsgBoxResult.Yes Then
MsgBox("Downloading, Click Ok To Continue.", , "New Update")
System.Diagnostics.Process.Start("Download for the file")
Else
If ask = MsgBoxResult.No Then
End If
End If
End If
End Sub
'Update was added by Alex Ritter
Public Shared Sub Update()
Dim request As System.Net.HttpWebRequest = System.Net.HttpWebRequest.Create("Verson File Link")
Dim response As System.Net.HttpWebResponse = request.GetResponse()
Dim sr As System.IO.StreamReader = New System.IO.StreamReader(response.GetResponseStream())
Dim newestversion As String = sr.ReadToEnd()
Dim currentversion As String = Application.ProductVersion
If newestversion.Contains(currentversion) Then
MsgBox("You Have the Current Version", , "No New Update")
Else
Dim ask As MsgBoxResult
ask = MsgBox("There Is A New Update, Would You Like To Download It?", MsgBoxStyle.YesNoCancel, "New Update")
If ask = MsgBoxResult.Yes Then
System.Diagnostics.Process.Start("Download for the file")
Else
If ask = MsgBoxResult.No Then
End If
End If
End If
End Sub
'Convert was added by Alex Ritter
Public Shared Sub Convert(ByVal MySetting As String, ByVal SoftSetting As String)
MySetting = SoftSetting
End Sub
'Mail was added by Alex Ritter
Public Shared Sub SendMail(ByVal too As String, ByVal Subject As String, ByVal Body As String)
If SoftSettings.EmailPassword = "nul" And SoftSettings.EmailUsername = "nul" Then
MsgBox("Email have been disabled!")
Else
If My.Computer.Network.IsAvailable = True Then
Dim SmtpServer As New SmtpClient()
Dim mail As New MailMessage()
SmtpServer.Credentials = New Net.NetworkCredential(SoftSettings.EmailUsername, SoftSettings.EmailPassword)
SmtpServer.Port = 587
SmtpServer.Host = "smtp.gmail.com"
SmtpServer.EnableSsl = True
mail = New MailMessage()
mail.From = New MailAddress(SoftSettings.EmailUsername)
mail.To.Add(too)
mail.Subject = Subject
mail.Body = Body
SmtpServer.Send(mail)
Else
If SoftSettings.EmailErrorWarn = True Then
MsgBox("Error : You are not conencted to the Internet")
Else
'Nothing
End If
End If
End If
End Sub
'GetDirectory was added by Alex Ritter
Public Shared Function GetDirectory() As String
Dim SD As String
If SoftSettings.SettingSaveLocation = False Then
SD = "C:\SoftEngine\Software\" + ComponyName + AppName + "\bin\Resources\Settings\"
Return SD
Else
SD = SoftEngine.AppStartUpPath + "\SoftEngine\Software\" + ComponyName + AppName + "\bin\Resources\Settings\"
Return SD
End If
End Function
'SendKey was added by Alex Ritter
Public Shared Sub SendKey(ByVal Value As String)
My.Computer.Keyboard.SendKeys(Value)
End Sub
End Class
Imports System.Net.Mail
Imports System.Threading
Public Class SoftEngine
'If you have any questions please email [email protected]
'SoftEngine Version 1.1.0.3
'Getting AppName and Compony name
Public Shared ComponyName As String = My.Application.Info.CompanyName
Public Shared AppName As String = My.Application.Info.AssemblyName
'AppStartUpPath was added by Markus Ritter
Public Shared AppStartUpPath As String = Application.StartupPath
'Settings was added by Markus Ritter
Public Shared Sub EditSetting(ByVal FileDir As String, ByVal value As String)
Dim objwriter As New System.IO.StreamWriter(FileDir)
objwriter.WriteLine(value)
objwriter.Close()
End Sub
'Settings was added by Markus Ritter
Public Shared Function ReadToEnd(ByVal FileDir As String) As String
Dim objreader As New System.IO.StreamReader(FileDir)
Dim Result As String = ""
Result = objreader.ReadToEnd
Console.WriteLine("This is the string :" + Result)
objreader.Close()
Return Result
End Function
'Settings was added by Markus Ritter
Public Shared Function ReadLine(ByVal FileDir As String) As String
Dim objreader As New System.IO.StreamReader(FileDir)
Dim Result As String = ""
Result = objreader.ReadLine
Console.WriteLine("This is the string :" + Result)
objreader.Close()
Return Result
End Function
'Settings was added by Alex Ritter
Public Shared Function TestSetting(ByVal FileDir As String)
Dim Result As Boolean
If My.Computer.FileSystem.FileExists(FileDir) Then
Result = True
Else
Result = False
End If
Return Result
End Function
'Settings was added by Alex Ritter
Public Shared Sub CreateSettingFile(ByVal FileDir As String, ByVal Value As String)
My.Computer.FileSystem.CreateDirectory(GetDirectory)
Dim objmaker1 As FileStream = File.Create(GetDirectory() + FileDir)
objmaker1.Close()
Dim objwriter1 As New System.IO.StreamWriter(GetDirectory() + FileDir)
objwriter1.WriteLine(Value)
objwriter1.Close()
End Sub
'Update was added by Alex Ritter
Public Shared Sub StartUpUpdate()
Dim request As System.Net.HttpWebRequest = System.Net.HttpWebRequest.Create("Verson File Link")
Dim response As System.Net.HttpWebResponse = request.GetResponse()
Dim sr As System.IO.StreamReader = New System.IO.StreamReader(response.GetResponseStream())
Dim newestversion As String = sr.ReadToEnd()
Dim currentversion As String = Application.ProductVersion
If newestversion.Contains(currentversion) Then
Else
Dim ask As MsgBoxResult
ask = MsgBox("There Is A New Update, Would You Like To Download It?", MsgBoxStyle.YesNoCancel, "New Update")
If ask = MsgBoxResult.Yes Then
MsgBox("Downloading, Click Ok To Continue.", , "New Update")
System.Diagnostics.Process.Start("Download for the file")
Else
If ask = MsgBoxResult.No Then
End If
End If
End If
End Sub
'Update was added by Alex Ritter
Public Shared Sub Update()
Dim request As System.Net.HttpWebRequest = System.Net.HttpWebRequest.Create("Verson File Link")
Dim response As System.Net.HttpWebResponse = request.GetResponse()
Dim sr As System.IO.StreamReader = New System.IO.StreamReader(response.GetResponseStream())
Dim newestversion As String = sr.ReadToEnd()
Dim currentversion As String = Application.ProductVersion
If newestversion.Contains(currentversion) Then
MsgBox("You Have the Current Version", , "No New Update")
Else
Dim ask As MsgBoxResult
ask = MsgBox("There Is A New Update, Would You Like To Download It?", MsgBoxStyle.YesNoCancel, "New Update")
If ask = MsgBoxResult.Yes Then
System.Diagnostics.Process.Start("Download for the file")
Else
If ask = MsgBoxResult.No Then
End If
End If
End If
End Sub
'Convert was added by Alex Ritter
Public Shared Sub Convert(ByVal MySetting As String, ByVal SoftSetting As String)
MySetting = SoftSetting
End Sub
'Mail was added by Alex Ritter
Public Shared Sub SendMail(ByVal too As String, ByVal Subject As String, ByVal Body As String)
If SoftSettings.EmailPassword = "nul" And SoftSettings.EmailUsername = "nul" Then
MsgBox("Email have been disabled!")
Else
If My.Computer.Network.IsAvailable = True Then
Dim SmtpServer As New SmtpClient()
Dim mail As New MailMessage()
SmtpServer.Credentials = New Net.NetworkCredential(SoftSettings.EmailUsername, SoftSettings.EmailPassword)
SmtpServer.Port = 587
SmtpServer.Host = "smtp.gmail.com"
SmtpServer.EnableSsl = True
mail = New MailMessage()
mail.From = New MailAddress(SoftSettings.EmailUsername)
mail.To.Add(too)
mail.Subject = Subject
mail.Body = Body
SmtpServer.Send(mail)
Else
If SoftSettings.EmailErrorWarn = True Then
MsgBox("Error : You are not conencted to the Internet")
Else
'Nothing
End If
End If
End If
End Sub
'GetDirectory was added by Alex Ritter
Public Shared Function GetDirectory() As String
Dim SD As String
If SoftSettings.SettingSaveLocation = False Then
SD = "C:\SoftEngine\Software\" + ComponyName + AppName + "\bin\Resources\Settings\"
Return SD
Else
SD = SoftEngine.AppStartUpPath + "\SoftEngine\Software\" + ComponyName + AppName + "\bin\Resources\Settings\"
Return SD
End If
End Function
'SendKey was added by Alex Ritter
Public Shared Sub SendKey(ByVal Value As String)
My.Computer.Keyboard.SendKeys(Value)
End Sub
End Class
SECOND Class
Public Class SoftSettings
''Default Settings
'Stuff that you need to set
Public Shared EmailUsername As String = "nul" 'Type in your email username here
Public Shared EmailPassword As String = "nul" 'Type in your email password here
Public Shared SettingSaveLocation As Boolean = True 'True, Will set it so it will save to C:\SoftEngine\Software\(CompanyName)\(AppName)\bin\Resources\Settings\. False will set it to the program location\CompanyName\AppName\bin\Resources\Settings
'Default settings that require a file
Public Shared EmailErrorWarn As String = True 'If set to true then it will warn the user when there was an error with the email system, if set to false it will not warn the user if there is n error with theemail system
Public Shared Dir_TestSetting As String = SoftEngine.GetDirectory() + "TestSetting.txt"
'Settings for the program
Public Shared TestSeting As String = Nothing
'Log File
Public Shared Log As String = SoftEngine.GetDirectory() + "Log.txt"
Public Shared Sub StartUp()
If SoftEngine.TestSetting(Dir_TestSetting) = True Then
TestSeting = SoftEngine.ReadLine(Dir_TestSetting)
Else
SoftEngine.CreateSettingFile("TestSetting.txt", "Test lol")
End If
End Sub
Public Shared Sub OnClose()
SoftEngine.EditSetting(Dir_TestSetting, TestSeting)
End Sub
End Class
''Default Settings
'Stuff that you need to set
Public Shared EmailUsername As String = "nul" 'Type in your email username here
Public Shared EmailPassword As String = "nul" 'Type in your email password here
Public Shared SettingSaveLocation As Boolean = True 'True, Will set it so it will save to C:\SoftEngine\Software\(CompanyName)\(AppName)\bin\Resources\Settings\. False will set it to the program location\CompanyName\AppName\bin\Resources\Settings
'Default settings that require a file
Public Shared EmailErrorWarn As String = True 'If set to true then it will warn the user when there was an error with the email system, if set to false it will not warn the user if there is n error with theemail system
Public Shared Dir_TestSetting As String = SoftEngine.GetDirectory() + "TestSetting.txt"
'Settings for the program
Public Shared TestSeting As String = Nothing
'Log File
Public Shared Log As String = SoftEngine.GetDirectory() + "Log.txt"
Public Shared Sub StartUp()
If SoftEngine.TestSetting(Dir_TestSetting) = True Then
TestSeting = SoftEngine.ReadLine(Dir_TestSetting)
Else
SoftEngine.CreateSettingFile("TestSetting.txt", "Test lol")
End If
End Sub
Public Shared Sub OnClose()
SoftEngine.EditSetting(Dir_TestSetting, TestSeting)
End Sub
End Class