Post: BBCode Formatter (Adding colour to the forum)
10-31-2015, 06:56 PM #1
Default Avatar
Bch
Guest
(adsbygoogle = window.adsbygoogle || []).push({}); Source Download Link - You must login or register to view this content.
Quite a messy and poorly done program, but it was just a simple quick fast program i made to add some colour to the forums.
If you don't care about the source you can run the exe in BBC_CodeFormat/bin/Debug/BBC_CodeFormat.exe
If you want to add more to the "word list" for the colour blue, add the words to the following array (in the source).
string[] Blues = new string[]
{

"using",
"namespace",
"public",
"private",
"partial",
"class",
"this",
"new",
"string",
"uint",
"int",
"float",
"decimal",
"byte",
"object",
"for",
"void",
"enum",
"null"
};

You must login or register to view this content.

Example Output;
//********************* Client Code ***********************
//Here I am giving the Sample client code.
//Which I feel doesn't need any explanation.
class TCPClient
{

/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main(string[] args)
{

TCPClient client = null;
client = new TCPClient("SatyaTest.txt
"
);
client = new TCPClient("SatyaTest1.txt
"
);
client = new TCPClient("SatyaTest2.txt
"
);
client = new TCPClient("SatyaTest3.txt
"
);
client = new TCPClient("SatyaTest4.txt
"
);
client = new TCPClient("SatyaTest5.txt
"
);
}
private String m_fileName=null;
public TCPClient(String fileName)
{

m_fileName=fileName;
Thread t = new Thread(new ThreadStart(ClientThreadStart));
t.Start();
}
private void ClientThreadStart()
{

Socket clientSocket = new Socket(AddressFamily.InterNetwork,
SocketType.Stream, ProtocolType.Tcp );
clientSocket.Connect(new IPEndPoint(IPAddress.Parse("127.0.0.1"),31001));
// Send the file name.
clientSocket.Send(Encoding.ASCII.GetBytes(m_fileName));

// Receive the length of the filename.
byte [] data = new byte[128];
clientSocket.Receive(data);
int length=BitConverter.ToInt32(data,0);
clientSocket.Send(Encoding.ASCII.GetBytes(m_fileName+":"+
"this is a test
"
));
clientSocket.Send(Encoding.ASCII.GetBytes(m_fileName+":"+
"THIS IS "));
clientSocket.Send(Encoding.ASCII.GetBytes("ANOTHRER "));
clientSocket.Send(Encoding.ASCII.GetBytes("TEST."));
clientSocket.Send(Encoding.ASCII.GetBytes("
"
));
clientSocket.Send(Encoding.ASCII.GetBytes(m_fileName+":"+
"TEST.
"
+m_fileName+":"+"TEST AGAIN.
"
));
clientSocket.Send(Encoding.ASCII.GetBytes("[EOF]
"
));
// Get the total length
clientSocket.Receive(data);
length=BitConverter.ToInt32(data,0);
clientSocket.Close();
}
}
Last edited by Bch ; 10-31-2015 at 07:01 PM.

The following 2 users say thank you to Bch for this useful post:

John
10-31-2015, 08:08 PM #2
Default Avatar
Kas
Guest
Originally posted by Beach View Post
Source Download Link - You must login or register to view this content.
Quite a messy and poorly done program, but it was just a simple quick fast program i made to add some colour to the forums.
If you don't care about the source you can run the exe in BBC_CodeFormat/bin/Debug/BBC_CodeFormat.exe
If you want to add more to the "word list" for the colour blue, add the words to the following array (in the source).
string[] Blues = new string[]
{

"using",
"namespace",
"public",
"private",
"partial",
"class",
"this",
"new",
"string",
"uint",
"int",
"float",
"decimal",
"byte",
"object",
"for",
"void",
"enum",
"null"
};

You must login or register to view this content.

Example Output;
//********************* Client Code ***********************
//Here I am giving the Sample client code.
//Which I feel doesn't need any explanation.
class TCPClient
{

/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main(string[] args)
{

TCPClient client = null;
client = new TCPClient("SatyaTest.txt
"
);
client = new TCPClient("SatyaTest1.txt
"
);
client = new TCPClient("SatyaTest2.txt
"
);
client = new TCPClient("SatyaTest3.txt
"
);
client = new TCPClient("SatyaTest4.txt
"
);
client = new TCPClient("SatyaTest5.txt
"
);
}
private String m_fileName=null;
public TCPClient(String fileName)
{

m_fileName=fileName;
Thread t = new Thread(new ThreadStart(ClientThreadStart));
t.Start();
}
private void ClientThreadStart()
{

Socket clientSocket = new Socket(AddressFamily.InterNetwork,
SocketType.Stream, ProtocolType.Tcp );
clientSocket.Connect(new IPEndPoint(IPAddress.Parse("127.0.0.1"),31001));
// Send the file name.
clientSocket.Send(Encoding.ASCII.GetBytes(m_fileName));

// Receive the length of the filename.
byte [] data = new byte[128];
clientSocket.Receive(data);
int length=BitConverter.ToInt32(data,0);
clientSocket.Send(Encoding.ASCII.GetBytes(m_fileName+":"+
"this is a test
"
));
clientSocket.Send(Encoding.ASCII.GetBytes(m_fileName+":"+
"THIS IS "));
clientSocket.Send(Encoding.ASCII.GetBytes("ANOTHRER "));
clientSocket.Send(Encoding.ASCII.GetBytes("TEST."));
clientSocket.Send(Encoding.ASCII.GetBytes("
"
));
clientSocket.Send(Encoding.ASCII.GetBytes(m_fileName+":"+
"TEST.
"
+m_fileName+":"+"TEST AGAIN.
"
));
clientSocket.Send(Encoding.ASCII.GetBytes("[EOF]
"
));
// Get the total length
clientSocket.Receive(data);
length=BitConverter.ToInt32(data,0);
clientSocket.Close();
}
}


Going to move this thread to Computer programming. Not many people in general discussion will have a clue what this does.
11-01-2015, 12:15 AM #3
Winter
Purple God
Originally posted by Beach View Post
Source Download Link - You must login or register to view this content.
Quite a messy and poorly done program, but it was just a simple quick fast program i made to add some colour to the forums.
If you don't care about the source you can run the exe in BBC_CodeFormat/bin/Debug/BBC_CodeFormat.exe
If you want to add more to the "word list" for the colour blue, add the words to the following array (in the source).
string[] Blues = new string[]
{

"using",
"namespace",
"public",
"private",
"partial",
"class",
"this",
"new",
"string",
"uint",
"int",
"float",
"decimal",
"byte",
"object",
"for",
"void",
"enum",
"null"
};

You must login or register to view this content.

Example Output;
//********************* Client Code ***********************
//Here I am giving the Sample client code.
//Which I feel doesn't need any explanation.
class TCPClient
{

/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main(string[] args)
{

TCPClient client = null;
client = new TCPClient("SatyaTest.txt
"
);
client = new TCPClient("SatyaTest1.txt
"
);
client = new TCPClient("SatyaTest2.txt
"
);
client = new TCPClient("SatyaTest3.txt
"
);
client = new TCPClient("SatyaTest4.txt
"
);
client = new TCPClient("SatyaTest5.txt
"
);
}
private String m_fileName=null;
public TCPClient(String fileName)
{

m_fileName=fileName;
Thread t = new Thread(new ThreadStart(ClientThreadStart));
t.Start();
}
private void ClientThreadStart()
{

Socket clientSocket = new Socket(AddressFamily.InterNetwork,
SocketType.Stream, ProtocolType.Tcp );
clientSocket.Connect(new IPEndPoint(IPAddress.Parse("127.0.0.1"),31001));
// Send the file name.
clientSocket.Send(Encoding.ASCII.GetBytes(m_fileName));

// Receive the length of the filename.
byte [] data = new byte[128];
clientSocket.Receive(data);
int length=BitConverter.ToInt32(data,0);
clientSocket.Send(Encoding.ASCII.GetBytes(m_fileName+":"+
"this is a test
"
));
clientSocket.Send(Encoding.ASCII.GetBytes(m_fileName+":"+
"THIS IS "));
clientSocket.Send(Encoding.ASCII.GetBytes("ANOTHRER "));
clientSocket.Send(Encoding.ASCII.GetBytes("TEST."));
clientSocket.Send(Encoding.ASCII.GetBytes("
"
));
clientSocket.Send(Encoding.ASCII.GetBytes(m_fileName+":"+
"TEST.
"
+m_fileName+":"+"TEST AGAIN.
"
));
clientSocket.Send(Encoding.ASCII.GetBytes("[EOF]
"
));
// Get the total length
clientSocket.Receive(data);
length=BitConverter.ToInt32(data,0);
clientSocket.Close();
}
}

Not that bad of an idea.. but I remember there was a tag like {xml} or {php} which highlights things.. but not all and it's all like pink lmao
11-01-2015, 08:10 AM #4
Default Avatar
Bch
Guest
Originally posted by Winter View Post
Not that bad of an idea.. but I remember there was a tag like {xml} or {php} which highlights things.. but not all and it's all like pink lmao


yeah the PHP tag for me makes text screwed up and overlapping, html and code tags don't add any colour or anything :fa:
12-02-2015, 07:30 AM #5
Toxic
former staff
Originally posted by Beach View Post
Source Download Link - You must login or register to view this content.
Quite a messy and poorly done program, but it was just a simple quick fast program i made to add some colour to the forums.
If you don't care about the source you can run the exe in BBC_CodeFormat/bin/Debug/BBC_CodeFormat.exe
If you want to add more to the "word list" for the colour blue, add the words to the following array (in the source).
string[] Blues = new string[]
{

"using",
"namespace",
"public",
"private",
"partial",
"class",
"this",
"new",
"string",
"uint",
"int",
"float",
"decimal",
"byte",
"object",
"for",
"void",
"enum",
"null"
};

You must login or register to view this content.

Example Output;
//********************* Client Code ***********************
//Here I am giving the Sample client code.
//Which I feel doesn't need any explanation.
class TCPClient
{

/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main(string[] args)
{

TCPClient client = null;
client = new TCPClient("SatyaTest.txt
"
);
client = new TCPClient("SatyaTest1.txt
"
);
client = new TCPClient("SatyaTest2.txt
"
);
client = new TCPClient("SatyaTest3.txt
"
);
client = new TCPClient("SatyaTest4.txt
"
);
client = new TCPClient("SatyaTest5.txt
"
);
}
private String m_fileName=null;
public TCPClient(String fileName)
{

m_fileName=fileName;
Thread t = new Thread(new ThreadStart(ClientThreadStart));
t.Start();
}
private void ClientThreadStart()
{

Socket clientSocket = new Socket(AddressFamily.InterNetwork,
SocketType.Stream, ProtocolType.Tcp );
clientSocket.Connect(new IPEndPoint(IPAddress.Parse("127.0.0.1"),31001));
// Send the file name.
clientSocket.Send(Encoding.ASCII.GetBytes(m_fileName));

// Receive the length of the filename.
byte [] data = new byte[128];
clientSocket.Receive(data);
int length=BitConverter.ToInt32(data,0);
clientSocket.Send(Encoding.ASCII.GetBytes(m_fileName+":"+
"this is a test
"
));
clientSocket.Send(Encoding.ASCII.GetBytes(m_fileName+":"+
"THIS IS "));
clientSocket.Send(Encoding.ASCII.GetBytes("ANOTHRER "));
clientSocket.Send(Encoding.ASCII.GetBytes("TEST."));
clientSocket.Send(Encoding.ASCII.GetBytes("
"
));
clientSocket.Send(Encoding.ASCII.GetBytes(m_fileName+":"+
"TEST.
"
+m_fileName+":"+"TEST AGAIN.
"
));
clientSocket.Send(Encoding.ASCII.GetBytes("[EOF]
"
));
// Get the total length
clientSocket.Receive(data);
length=BitConverter.ToInt32(data,0);
clientSocket.Close();
}
}


small,but really handy tool :p
also, it is better to do spaces before and after a string in blues and other
eg.
lets say that i declared a string that its value "class123" it'll highlight the class even tho it is a string
ur tool:string = "class123";
so it is better to do:
string[] Blues = new string[]
{
" class ";
};
instead of
string[] Blues = new string[]
{
"class";
};
and same goes to the others :p

Copyright © 2024, NextGenUpdate.
All Rights Reserved.

Gray NextGenUpdate Logo