Hello There, Guest!
View New Posts  |  View Today's Posts
[Release] TLF PostPad - Developed by AceInfinity

  • 0 Vote(s) - 0 Average


03-15-2012, 06:13 PM #1
AceInfinity
Developer
*******
Administrators
Posts: 9,733 Threads:1,026 Joined: Jun 2011 Reputation: 76

TLF PostPad - Developed by AceInfinity
Preview:


It should be pretty self explanatory for what it's used for, but in this application you can assign your own personalized BBcodes to each of the 7 available custom button slots by a configuration file :)

Virus Scan: https://www.virustotal.com/file/473109a6...331853068/

Source:
Code:
Imports System.IO
Imports System.Text
Imports System.Threading

Public Class Form1

    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        Me.Text = "TLF PostPad v" & Application.ProductVersion.Remove(5)
        LoadCustomButtonIcons()
    End Sub

    Private Structure CustomButton
        Dim Icon As String
        Dim StartTag As String
        Dim EndTag As String
        Dim MiddleValue As String
    End Structure

    Private Sub CheckICONSFolder()
        If Not Directory.Exists(Application.StartupPath & "\ICONS") Then Directory.CreateDirectory(Application.StartupPath & "\ICONS")
    End Sub

    Private Sub LoadCustomButtonIcons()
        CheckICONSFolder()
        Dim CBtns As String(,) = ReloadConfigVals()
        For i As Integer = 0 To 7
            Dim CButton As New CustomButton
            Dim InValidCBtn As Boolean

            If CBtns(i, 0) = String.Empty Then
                InValidCBtn = True
                Exit For
            End If


            If Not InValidCBtn Then
                With CButton
                    .Icon = CBtns(i, 0)

                    If File.Exists(Application.StartupPath & "\ICONS\" & .Icon) Then
                        Select Case (i + 1)
                            Case 1
                                Btn_C1.Image = Image.FromFile(Application.StartupPath & "\ICONS\" & .Icon)
                            Case 2
                                Btn_C2.Image = Image.FromFile(Application.StartupPath & "\ICONS\" & .Icon)
                            Case 3
                                Btn_C3.Image = Image.FromFile(Application.StartupPath & "\ICONS\" & .Icon)
                            Case 4
                                Btn_C4.Image = Image.FromFile(Application.StartupPath & "\ICONS\" & .Icon)
                            Case 5
                                Btn_C5.Image = Image.FromFile(Application.StartupPath & "\ICONS\" & .Icon)
                            Case 6
                                Btn_C6.Image = Image.FromFile(Application.StartupPath & "\ICONS\" & .Icon)
                            Case 7
                                Btn_C7.Image = Image.FromFile(Application.StartupPath & "\ICONS\" & .Icon)
                        End Select
                    End If
                End With
            End If
        Next
    End Sub

    Private Function LoadCButton(Button_Index As Integer) As CustomButton
        Dim CBtns As String(,) = ReloadConfigVals()
        Dim CButton As New CustomButton
        Dim InValidCBtn As Boolean
        For i As Integer = 0 To 2 'Leave out (MiddleValue) Setting: Index[3]
            If CBtns(Button_Index, i) = String.Empty Then
                InValidCBtn = True
                Exit For
            End If
        Next

        If Not InValidCBtn Then
            With CButton
                .Icon = CBtns(Button_Index, 0)
                .StartTag = CBtns(Button_Index, 1)
                .EndTag = CBtns(Button_Index, 2)
                .MiddleValue = CBtns(Button_Index, 3)
            End With
            Return CButton
        End If

        Return Nothing
    End Function

    Private Sub CheckForConfigFile()
        If Not File.Exists(Application.StartupPath & "\config_postpad.tlf") Then CreateConfigFile()
    End Sub

    Private Sub CreateConfigFile()
        Dim resName As Byte() = My.Resources.config_postpad
        Using fstream As New FileStream(Application.StartupPath & "\config_postpad.tlf", FileMode.Append)
            fstream.Write(resName, 0, resName.Length)
        End Using
    End Sub

    '// Return Values From Config File (2 Dimensional String Array)
    Private Function ReloadConfigVals() As String(,)
        Try
            CheckForConfigFile()
            Dim SettingsHolder(,) As String
            ReDim SettingsHolder(6, 3)

            Using sr As New StreamReader(Application.StartupPath & "\config_postpad.tlf")
                Dim Cval As Integer = -1
                Dim i As Integer = 0

                While sr.Peek > -1
                    Dim ln As String = sr.ReadLine.Trim
                    If Not String.IsNullOrEmpty(ln) AndAlso Not ln.StartsWith(";") Then
                        If ln.StartsWith("[") Then
                            Cval += 1
                            i = 0
                        Else
                            SettingsHolder(Cval, i) = Convert.ToString(ln.Substring(ln.IndexOf("'"c) + 1).Replace("'"c, String.Empty))
                            i += 1
                        End If
                    End If
                End While

            End Using

            Return SettingsHolder
        Catch ex As Exception
            MessageBox.Show(ex.Message, "Error", _
                            MessageBoxButtons.OK, MessageBoxIcon.Error)
            Return Nothing
        End Try
    End Function

    Private Sub AddBBCode(StartTag As String, EndTag As String, Optional MiddleString As String = Nothing)
        Dim L_ST As Integer = StartTag.Length
        If Not MiddleString = Nothing Then
            TextBox1.SelectedText = TextBox1.SelectedText.Replace(TextBox1.SelectedText, StartTag & MiddleString & EndTag)
        Else
            TextBox1.SelectedText = TextBox1.SelectedText.Insert(0, StartTag).Insert(TextBox1.SelectedText.Length + L_ST, EndTag)
        End If
    End Sub

#Region "Various Buttons"
    Private Sub Btn_ColorChange_Click(sender As Object, e As EventArgs) Handles Btn_ColorChange.Click
        Dim PlaceHolder As Integer = TextBox1.SelectionStart
        Dim ColDlg As New ColorDialog
        With ColDlg
            .FullOpen = True
            .ShowDialog()
        End With

        Dim HexColorVal As String = String.Format("{0:X2}{1:X2}{2:X2}", ColDlg.Color.R, ColDlg.Color.G, ColDlg.Color.B)
        AddBBCode("[color=#" & HexColorVal & "]", "[/color]")
        TextBox1.Focus()
        TextBox1.SelectionStart = PlaceHolder + 15
    End Sub

    Private Sub Btn_Bold_Click(sender As Object, e As EventArgs) Handles Btn_Bold.Click
        Dim PlaceHolder As Integer = TextBox1.SelectionStart
        AddBBCode("[b]", "[/b]")
        TextBox1.Focus()
        TextBox1.SelectionStart = PlaceHolder + 3
    End Sub

    Private Sub Btn_Italic_Click(sender As Object, e As EventArgs) Handles Btn_Italic.Click
        Dim PlaceHolder As Integer = TextBox1.SelectionStart
        AddBBCode("[i]", "[/i]")
        TextBox1.Focus()
        TextBox1.SelectionStart = PlaceHolder + 3
    End Sub

    Private Sub Btn_Underline_Click(sender As Object, e As EventArgs) Handles Btn_Underline.Click
        Dim PlaceHolder As Integer = TextBox1.SelectionStart
        AddBBCode("[u]", "[/u]")
        TextBox1.Focus()
        TextBox1.SelectionStart = PlaceHolder + 3
    End Sub

    Private Sub Btn_Strikeout_Click(sender As Object, e As EventArgs) Handles Btn_Strikeout.Click
        Dim PlaceHolder As Integer = TextBox1.SelectionStart
        AddBBCode("[s]", "[/s]")
        TextBox1.Focus()
        TextBox1.SelectionStart = PlaceHolder + 3
    End Sub

    Private Sub Btn_LeftAlign_Click(sender As Object, e As EventArgs) Handles Btn_LeftAlign.Click
        Dim PlaceHolder As Integer = TextBox1.SelectionStart
        AddBBCode("[align=left]", "[/align]")
    End Sub

    Private Sub Btn_CenterAlign_Click(sender As Object, e As EventArgs) Handles Btn_CenterAlign.Click
        Dim PlaceHolder As Integer = TextBox1.SelectionStart
        AddBBCode("[align=center]", "[/align]")
        TextBox1.Focus()
        TextBox1.SelectionStart = PlaceHolder + 14
    End Sub

    Private Sub Btn_RightAlign_Click(sender As Object, e As EventArgs) Handles Btn_RightAlign.Click
        Dim PlaceHolder As Integer = TextBox1.SelectionStart
        AddBBCode("[align=right]", "[/align]")
        TextBox1.Focus()
        TextBox1.SelectionStart = PlaceHolder + 13
    End Sub

    Private Sub Btn_Justified_Click(sender As Object, e As EventArgs) Handles Btn_Justified.Click
        Dim PlaceHolder As Integer = TextBox1.SelectionStart
        AddBBCode("[align=justify]", "[/align]")
        TextBox1.Focus()
        TextBox1.SelectionStart = PlaceHolder + 15
    End Sub

    Private Sub Btn_Undo_Click(sender As Object, e As EventArgs) Handles Btn_Undo.Click
        TextBox1.Undo()
    End Sub

    Private StepBackOnce As New List(Of String)(2)
    Private Sub Btn_Redo_Click(sender As Object, e As EventArgs) Handles Btn_Redo.Click
        TextBox1.Text = StepBackOnce.Item(0)
    End Sub

    Private Sub Btn_AddLink_Click(sender As Object, e As EventArgs) Handles Btn_AddLink.Click
        Dim URL_Input As String = InputBox("Enter a URL below:", "URL Input", "http://")
        If Not String.IsNullOrEmpty(URL_Input) Then
            AddBBCode("[url=" & URL_Input & "]", "[/url]")
        Else
            Dim PlaceHolder As Integer = TextBox1.SelectionStart
            AddBBCode("[url]", "[/url]")
            TextBox1.Focus()
            TextBox1.SelectionStart = PlaceHolder + 5
        End If
    End Sub

    Private Sub Btn_AddImage_Click(sender As Object, e As EventArgs) Handles Btn_AddImage.Click
        Dim PlaceHolder As Integer = TextBox1.SelectionStart
        AddBBCode("[img]", "[/img]")
        TextBox1.Focus()
        TextBox1.SelectionStart = PlaceHolder + 5
    End Sub

    Private Sub Btn_PointBullets_Click(sender As Object, e As EventArgs) Handles Btn_PointBullets.Click
        Dim sb As New StringBuilder
        Dim Bullet_Input As String = InputBox("Enter a list item below or don't enter a value and press OK to quit adding new list items:", "Bullet List Input")
        While Not String.IsNullOrEmpty(Bullet_Input)
            sb.AppendLine("[*]" & Bullet_Input)
            Bullet_Input = InputBox("Enter a list item below or don't enter a value and press OK to quit adding new list items:", "Bullet List Input")
        End While
        Dim PlaceHolder As Integer = TextBox1.SelectionStart
        AddBBCode("[list]", "[/list]", sb.ToString)
        TextBox1.Focus()
        TextBox1.SelectionStart = PlaceHolder + 6
    End Sub

    Private Sub Btn_NumBullets_Click(sender As Object, e As EventArgs) Handles Btn_NumBullets.Click
        Dim sb As New StringBuilder
        Dim Bullet_Input As String = InputBox("Enter a numbered list item below or don't enter a value and press OK to quit adding new list items:", "Numbered List Input")
        While Not String.IsNullOrEmpty(Bullet_Input)
            sb.AppendLine("[*]" & Bullet_Input)
            Bullet_Input = InputBox("Enter a numbered list item below or don't enter a value and press OK to quit adding new list items:", "Numbered List Input")
        End While
        Dim PlaceHolder As Integer = TextBox1.SelectionStart
        AddBBCode("[list=1]", "[/list]", sb.ToString)
        TextBox1.Focus()
        TextBox1.SelectionStart = PlaceHolder + 8
    End Sub

    Private Sub Btn_Quote_Click(sender As Object, e As EventArgs) Handles Btn_Quote.Click
        Dim PlaceHolder As Integer = TextBox1.SelectionStart
        AddBBCode("[quote]", "[/quote]")
        TextBox1.Focus()
        TextBox1.SelectionStart = PlaceHolder + 7
    End Sub

    Private Sub Btn_Code_Click(sender As Object, e As EventArgs) Handles Btn_Code.Click
        Dim PlaceHolder As Integer = TextBox1.SelectionStart
        AddBBCode("[ code]", "[/ code]")
        TextBox1.Focus()
        TextBox1.SelectionStart = PlaceHolder + 6
    End Sub

    Private Sub Btn_PHP_Click(sender As Object, e As EventArgs) Handles Btn_PHP.Click
        Dim PlaceHolder As Integer = TextBox1.SelectionStart
        AddBBCode("[php]", "[/php]")
        TextBox1.Focus()
        TextBox1.SelectionStart = PlaceHolder + 5
    End Sub
#End Region

    Private Sub TextBox1_TextChanged(sender As Object, e As EventArgs) Handles TextBox1.TextChanged
        If StepBackOnce.Count = 2 Then
            StepBackOnce.RemoveAt(0)
        End If
        StepBackOnce.Add(TextBox1.Text)
    End Sub

    Private Sub Btn_ReloadConfig_Click(sender As Object, e As EventArgs) Handles Btn_ReloadConfig.Click
        LoadCustomButtonIcons()
    End Sub

    Private Sub Btn_C1_Click(sender As Object, e As EventArgs) Handles Btn_C1.Click
        CB_Button_Clicked(Nothing, Nothing, 0)
    End Sub

    Private Sub Btn_C2_Click(sender As Object, e As EventArgs) Handles Btn_C2.Click
        CB_Button_Clicked(Nothing, Nothing, 1)
    End Sub

    Private Sub Btn_C3_Click(sender As Object, e As EventArgs) Handles Btn_C3.Click
        CB_Button_Clicked(Nothing, Nothing, 2)
    End Sub

    Private Sub Btn_C4_Click(sender As Object, e As EventArgs) Handles Btn_C4.Click
        CB_Button_Clicked(Nothing, Nothing, 3)
    End Sub

    Private Sub Btn_C5_Click(sender As Object, e As EventArgs) Handles Btn_C5.Click
        CB_Button_Clicked(Nothing, Nothing, 4)
    End Sub

    Private Sub Btn_C6_Click(sender As Object, e As EventArgs) Handles Btn_C6.Click
        CB_Button_Clicked(Nothing, Nothing, 5)
    End Sub

    Private Sub Btn_C7_Click(sender As Object, e As EventArgs) Handles Btn_C7.Click
        CB_Button_Clicked(Nothing, Nothing, 6)
    End Sub

    Private Sub CB_Button_Clicked(sender As Object, e As EventArgs, Btn As Integer)
        Dim PlaceHolder As Integer = TextBox1.SelectionStart

        Dim CButton As CustomButton = LoadCButton(Btn)
        If CButton.StartTag = Nothing OrElse CButton.EndTag = Nothing Then Exit Sub

        If CButton.MiddleValue <> String.Empty Then
            Select Case CButton.MiddleValue
                Case "InputBox"
                    Dim sb As New StringBuilder
                    Dim CB_Input As String = InputBox("Enter an input:", "Custom Button 6 Input")
                    While Not String.IsNullOrEmpty(CB_Input)
                        sb.AppendLine("[*]" & CB_Input)
                        CB_Input = InputBox("Enter an input:", "Custom Button 6 Input")
                    End While
                    AddBBCode(Convert.ToString(CButton.StartTag), Convert.ToString(CButton.EndTag), sb.ToString)
                Case Else
                    AddBBCode(Convert.ToString(CButton.StartTag), Convert.ToString(CButton.EndTag), Convert.ToString(CButton.MiddleValue))
            End Select
        Else
            AddBBCode(Convert.ToString(CButton.StartTag), Convert.ToString(CButton.EndTag))
            TextBox1.Focus()
            TextBox1.SelectionStart = PlaceHolder + CButton.StartTag.Length
        End If
    End Sub

    Private Sub ComboBox1_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ComboBox1.SelectedIndexChanged
        If ComboBox1.SelectedIndex <> -1 Then
            Dim PlaceHolder As Integer = TextBox1.SelectionStart
            AddBBCode("[font=" & ComboBox1.SelectedItem.Text & "]", "[/font]")
            TextBox1.Focus()
            TextBox1.SelectionStart = PlaceHolder + 7 + ComboBox1.SelectedItem.Text.Length
            ComboBox1.SelectedIndex = -1
        End If
    End Sub

    Private Sub ComboBox2_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ComboBox2.SelectedIndexChanged
        If ComboBox2.SelectedIndex <> -1 Then
            Dim PlaceHolder As Integer = TextBox1.SelectionStart
            AddBBCode("[size=" & ComboBox2.SelectedItem.Text & "]", "[/size]")
            TextBox1.Focus()
            TextBox1.SelectionStart = PlaceHolder + 7 + ComboBox2.SelectedItem.Text.Length
            ComboBox1.SelectedIndex = -1
        End If
    End Sub

    Private Sub ComboBox1_MouseUp(sender As Object, e As MouseEventArgs) Handles ComboBox1.MouseUp, ComboBox2.MouseUp
        TextBox1.Focus()
    End Sub

End Class

Download: In Attachment


Attached Files
.zip   TLF PostPad v1.0.0.zip (Size: 167.35 KB / Downloads: 43)
This post was last modified: 03-15-2012, 07:11 PM by AceInfinity.


Microsoft MVP .NET Programming - (2012 - Present)
®Crestron DMC-T Certified Automation Programmer

Development Site: aceinfinity.net

 ▲
 ▲ ▲

03-15-2012, 06:14 PM #2
BreShiE
Knowledge Is Power
*****
Posts: 1,130 Threads:158 Joined: Sep 2011 Reputation: 12

RE: TLF PostPad - Developed by AceInfinity
That's quite a nifty little program you've made there Ace! Once again you've brought out something awesome! :D

Come in the IRC?


"It was pretty impressive to watch a missile fly down an air vent, but couldn't we feasibly use that same technology to shoot food at hungry people?"

03-15-2012, 06:22 PM #3
1912Dummy
Unregistered
 

RE: TLF PostPad - Developed by AceInfinity
nice job ace :)
looks awesome

03-15-2012, 06:30 PM #4
AceInfinity
Developer
*******
Administrators
Posts: 9,733 Threads:1,026 Joined: Jun 2011 Reputation: 76

RE: TLF PostPad - Developed by AceInfinity
I just added the attachment, I was waiting for my Virus scan to finish.

You can assign your own BBcode to each of the 7 custom buttons, and give them your own icons as well.
This post was last modified: 03-15-2012, 06:31 PM by AceInfinity.


Microsoft MVP .NET Programming - (2012 - Present)
®Crestron DMC-T Certified Automation Programmer

Development Site: aceinfinity.net

 ▲
 ▲ ▲

03-15-2012, 06:35 PM #5
BreShiE
Knowledge Is Power
*****
Posts: 1,130 Threads:158 Joined: Sep 2011 Reputation: 12

RE: TLF PostPad - Developed by AceInfinity
Ace come to the IRC mate...


"It was pretty impressive to watch a missile fly down an air vent, but couldn't we feasibly use that same technology to shoot food at hungry people?"

03-15-2012, 07:12 PM #6
AceInfinity
Developer
*******
Administrators
Posts: 9,733 Threads:1,026 Joined: Jun 2011 Reputation: 76

RE: TLF PostPad - Developed by AceInfinity
Added Source code to first post as well... I had to change this line:
Code:
AddBBCode("[ code]", "[/ code]")

As it was messing up my code tags for the post itself, so I added those spaces on purpose.

I got bored of this project quick though so i'll leave it as is. It works, and I don't really have a purpose for working on it much more than that lol. I was going to try to boost performance a bit, but I don't think it matters.


Microsoft MVP .NET Programming - (2012 - Present)
®Crestron DMC-T Certified Automation Programmer

Development Site: aceinfinity.net

 ▲
 ▲ ▲

06-28-2012, 09:35 AM #7
Null
Moderator
*****
Moderators
Posts: 130 Threads:23 Joined: Feb 2012 Reputation: 4

RE: TLF PostPad - Developed by AceInfinity
Looks really cool pal. You recall IDB's colour picker control? Would deffinetely look great here if anybody can get their hands on it that is, pretty sure the link's dead on his website and other forums.

06-28-2012, 07:08 PM #8
AceInfinity
Developer
*******
Administrators
Posts: 9,733 Threads:1,026 Joined: Jun 2011 Reputation: 76

RE: TLF PostPad - Developed by AceInfinity
(06-28-2012, 09:35 AM)ByteBlast Wrote:  Looks really cool pal. You recall IDB's colour picker control? Would deffinetely look great here if anybody can get their hands on it that is, pretty sure the link's dead on his website and other forums.

Nope, not too sure on what you mean, I haven't really seen a lot of his stuff, I look at other people's projects and see what kind of stuff they are working on and all that, but for the most part I just make my own stuff, and use other's to instigate ideas to new projects of my own that I think up.

This was more of a "Oh, I seen someone else make a tool like this for another forum, lets create my own version and see what kind of features I can come up with". Doesn't matter if it's useful or not, it's still good for the practice, and when you release it to others they get an idea of your coding style, and can learn, or make feedback for you.


Microsoft MVP .NET Programming - (2012 - Present)
®Crestron DMC-T Certified Automation Programmer

Development Site: aceinfinity.net

 ▲
 ▲ ▲

07-03-2012, 02:43 AM #9
FizzyPenthos
Member
**
Posts: 137 Threads:16 Joined: Nov 2011 Reputation: 8

RE: TLF PostPad - Developed by AceInfinity
Well been away for a while again :/ Sorry guys, and i can see i have missed so much!

Nice work as always on this one Ace, I do love your clean coding style :P
My house

07-03-2012, 04:06 AM #10
Kewlz
Junior Member
**
Posts: 9 Threads:1 Joined: Mar 2012 Reputation: 0

RE: TLF PostPad - Developed by AceInfinity
Wow Ace, this is a really great project, I was thinking of making something similar earlier but never had time to make it.

Great stuff! Hats off.




Forum Jump:


Possibly Related Threads...
Thread Author Replies Views Last Post
   FolderDrive Mapper - Developed by AceInfinity AceInfinity 11 9,018 04-09-2012, 05:19 PM
Last Post: AceInfinity
  W7 Diag Tool v2.01 - New Version - Developed by AceInfinity AceInfinity 6 6,033 01-30-2012, 06:50 PM
Last Post: AceInfinity
  Snippet Safe v0.7 - Coded by AceInfinity AceInfinity 17 8,382 12-27-2011, 07:44 AM
Last Post: AceInfinity


Users browsing this thread: 1 Guest(s)