Censure worm 1.0 C# source code 04-30-2013, 08:57 PM
#1
I gotta release some useful stuff for community since i feel like a bad leecher v.v + something which some of you already know . :x
This was my first project in C#, so it could be a little messy. This program is useful for Counter Strike 1.6 players.
Purpose: It blocks the malicious files that are automatically downloaded in your setting files of CS 1.6, and it pretty much ruins your game with those setting. Some people know how to fix the settings back manually but, only few. And thats why i wanted to create this, to help newbies so they can play safely.
Why should it be useful, i don't even play counter strike!? Well if you are C# newbie you can see clear example of how to use Timer, file management, sounds, getting a process and killing it & basic usage of buttons and labels and class variables as global variables..
![[Image: RAIV0pu.png]](http://i.imgur.com/RAIV0pu.png)
CODE
If you wish to download it or read more about the program click here!
This was my first project in C#, so it could be a little messy. This program is useful for Counter Strike 1.6 players.
Purpose: It blocks the malicious files that are automatically downloaded in your setting files of CS 1.6, and it pretty much ruins your game with those setting. Some people know how to fix the settings back manually but, only few. And thats why i wanted to create this, to help newbies so they can play safely.
Why should it be useful, i don't even play counter strike!? Well if you are C# newbie you can see clear example of how to use Timer, file management, sounds, getting a process and killing it & basic usage of buttons and labels and class variables as global variables..
![[Image: RAIV0pu.png]](http://i.imgur.com/RAIV0pu.png)
CODE
Code:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;
using System.Threading;
using System.Diagnostics; // for killing process
using System.Media; // For sounds
namespace Cworm
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void toolTip1_Popup(object sender, PopupEventArgs e)
{
}
class data
{
public static string cstrike = "none";
public static string config = "none";
public static string slot1 = "none declared";
public static string slot2 = "none declared";
public static string shadowcfg = "none declared";
public static string csexe = "none declared";
}
private void activate_b_Click(object sender, EventArgs e)
{
string cstrike = pathbox.Text;
string backup_folder = pathbox.Text + @"\backup";
bool CstrikeIsExists = Directory.Exists(pathbox.Text); // i love HC!
bool ConfigIsExists = File.Exists(cstrike + @"\config.cfg");
if (CstrikeIsExists == true && ConfigIsExists == true)
string cfg = cstrike + @"\config.cfg";
data.config = cstrike + @"\config.cfg"; // config <global>
data.cstrike = cstrike; // cstrike <global>
data.csexe = cstrike.Replace("cstrike", "Counter-Strike");
// Pokrece backup funkciju
var t4 = new System.Windows.Forms.Timer { Enabled = true, Interval = 4000 };
t4.Tick += (o, a) => { t4.Stop(); status.ForeColor = System.Drawing.Color.GreenYellow; status.Text = "Please wait..."; backup(cfg, cstrike); t4.Enabled = false; };
}
else
{
status.Text = "Invalid path";
}
}
private void backup(string config,string cstrike)
{
bool backupIsExists = File.Exists(cstrike + @"\backup");
string backup_folder = cstrike + @"\backup";
status.Text = " If block following";
if (backupIsExists == true)
{
File.Copy(config, backup_folder + @"\config.cfg", true);
status.Text = "Cfg backuped"+ config +" to "+ backup_folder;
data.shadowcfg = backup_folder + @"\config.cfg";
}
else
{
try
{
Directory.CreateDirectory(backup_folder);
}
catch(System.IO.IOException)
{
status.Text = "Run the program as administrator";
}
File.Copy(config, backup_folder + @"\config.cfg", true);
status.Text = "Cfg backuped";
status.ForeColor = System.Drawing.Color.GreenYellow;
data.shadowcfg = backup_folder + @"\config.cfg";
}
activate_b.Enabled = false;
stop_b.Enabled = true;
pathbox.Enabled = false;
button1.Enabled = false;
shield(config,cstrike,backup_folder);
}
private void shield(string config,string cstrike,string backup_folder)
{
string censure = cstrike + @"\censuree.cfg";
string shadowcfg = backup_folder + @"\config.cfg";
status.Text = "Activated";
status.ForeColor = System.Drawing.Color.GreenYellow;
fileSystemWatcher1.Path = cstrike;
fileSystemWatcher1.EnableRaisingEvents = true;
Resource1.ResourceManager.GetStream("nudgeSound", Resource1.Culture);
System.IO.Stream s = Resource1.ResourceManager.GetStream("activated", Resource1.Culture);
SoundPlayer player = new SoundPlayer(s);
player.Play();
}
private void stop_b_Click(object sender, EventArgs e)
{
stop_b.Enabled = false;
activate_b.Enabled = true;
fileSystemWatcher1.EnableRaisingEvents = false;
status.Text = "Off";
status.ForeColor = System.Drawing.Color.Red;
Resource1.ResourceManager.GetStream("disabled", Resource1.Culture);
System.IO.Stream s = Resource1.ResourceManager.GetStream("disabled", Resource1.Culture);
SoundPlayer player = new SoundPlayer(s);
player.Play();
}
private void pathbox_TextChanged(object sender, EventArgs e)
{
}
private void button1_Click(object sender, EventArgs e)
{
try
{
if (folderBrowserDialog1.ShowDialog() == DialogResult.OK)
{
pathbox.Text = folderBrowserDialog1.SelectedPath;
}
}
catch (Exception ex)
{
MessageBox.Show("Exception occured. Make sure you run program as administrator or cstrike folder isn't valid");
}
}
private void fcreated(object sender, FileSystemEventArgs e)
{
if (e.Name == "censuree.cfg" || e.Name == "censure.cfg" || e.Name == data.slot1 || e.Name == data.slot2)
{
File.Delete(data.cstrike + @"\" + e.Name);
File.Copy(data.shadowcfg, data.config, true);
if (notify.Checked == true)
{
Resource1.ResourceManager.GetStream("alarm", Resource1.Culture);
System.IO.Stream s = Resource1.ResourceManager.GetStream("alarm", Resource1.Culture);
SoundPlayer player = new SoundPlayer(s);
player.Play(); ;
}
if (restart.Checked == true)
try
{
foreach (Process proc in Process.GetProcessesByName("hl"))
{
proc.Kill();
var tstart = new System.Windows.Forms.Timer { Enabled = true, Interval = 4000 };
tstart.Tick += (o, a) => { tstart.Stop();
var msg = MessageBox.Show("Censure is removed, you can continue playing now.");
; };
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message +": "+data.csexe);
}
}
else
{
status.Text = "Activated";
}
}
private void Form1_Load(object sender, EventArgs e)
{
if (Properties.Settings.Default.lastpath != "none")
pathbox.Text = Properties.Settings.Default.lastpath;
}
private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{
MessageBox.Show("Coded by Ante Gulin (Guxi). Contact me on facebook: facebook.com/theguxi. Contact me via emails: theguxi@hotmail.com & theguxi@gmail.com. Skype: ante_gulin.");
}
}
}If you wish to download it or read more about the program click here!




![[+]](https://sinister.li/images/modern/collapse_collapsed.png)


![[Image: deco_nightstalker_cross.jpg]](http://www.vampyres.ca/uploads/deco_nightstalker_cross.jpg)

miling: +