2014-12-29 23:44:39 +00:00
using System ;
using System.Collections.Generic ;
using System.ComponentModel ;
using System.Data ;
using System.Drawing ;
using System.Linq ;
using System.Text ;
using System.Threading.Tasks ;
using System.Windows.Forms ;
namespace Pithos
{
public partial class mainWindow : Form
{
private decode decoder = new decode ( ) ;
public bool adminMode = false ;
public mainWindow ( )
{
InitializeComponent ( ) ;
}
public void display ( string text , Color colour ) {
if ( output . TextLength ! = 0 ) { output . AppendText ( "\n[" + DateTime . Now . ToString ( "hh:mm:ss" ) + "] " ) ; } //so that the first line isnt a new line for no reason. (although its extra code)
else { output . AppendText ( "[" + DateTime . Now . ToString ( "hh:mm:ss" ) + "] " ) ; }
int length = output . TextLength ;
text = decoder . injectVariables ( text ) ; //injects variables into string
output . AppendText ( text ) ;
output . SelectionStart = length ;
output . SelectionLength = text . Length ;
output . SelectionColor = colour ;
output . SelectionStart = length + text . Length ;
output . SelectionColor = Color . Black ;
}
private void mainWindow_Load ( object sender , EventArgs e )
{
display ( "Currently Logged in as: " + Environment . UserDomainName + "\\" + Environment . UserName , Color . Red ) ;
}
private void executeButton_Click ( object sender , EventArgs e )
{
string input = inputBox . Text ;
if ( input = = "" ) { return ; } //if its empty, dont bother decoding
string initChar = input . Substring ( 0 , 1 ) ; //gets the first character in the input
string [ ] args = input . Substring ( 1 ) . Split ( ' ' ) ; //splits the input by spaces, and removes init character
switch ( initChar )
{
case "/" :
if ( args [ 0 ] = = "exec" ) //runs a pithos program
{
2014-12-30 22:39:01 +00:00
pithosPrograms . decodeInput ( input ) ;
return ;
2014-12-29 23:44:39 +00:00
}
else if ( args [ 0 ] = = "start" ) //runs a program (using cmd)
{
}
2014-12-30 20:56:18 +00:00
else { decoder . command ( input ) ; } //decode other commands
2014-12-29 23:44:39 +00:00
break ;
case "¦" : //admin commands
break ;
}
if ( input . Substring ( 0 , 4 ) . ToLower ( ) = = "echo" )
{
display ( input . Substring ( 5 ) , Color . Green ) ;
}
inputBox . Text = "" ; //clear the contents after execution
}
}
}