Initial Commit
This commit is contained in:
1 parent
c1d2346ea6
commit
6b04597a37
183 files changed
+4009
No files matched your search
Binary file not shown.
@@ -0,0 +1,33 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.IO;
|
||||
|
||||
namespace ConsoleApplication2
|
||||
{
|
||||
class Config
|
||||
{
|
||||
public static string[] config = new string[10];
|
||||
|
||||
public static void ReadConfig(string path)
|
||||
{
|
||||
int index = 0;
|
||||
|
||||
if (!File.Exists(path))
|
||||
{
|
||||
Console.WriteLine("oops");
|
||||
}
|
||||
string text = File.ReadAllText(path);
|
||||
//Console.Write(text);
|
||||
config = text.Split('\n');
|
||||
foreach (string a in config)
|
||||
{
|
||||
config[index] = config[index].Replace('\r', ' ');
|
||||
config[index] = config[index].Replace(" ", String.Empty);
|
||||
Console.WriteLine(a);
|
||||
index++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.IO;
|
||||
|
||||
namespace ConsoleApplication2
|
||||
{
|
||||
class Drives
|
||||
{
|
||||
public static string DisplayDriveInfo()
|
||||
{
|
||||
DriveInfo[] allDrives = DriveInfo.GetDrives();
|
||||
|
||||
foreach (DriveInfo d in allDrives)
|
||||
{
|
||||
if (d.Name == Config.config[2])
|
||||
{
|
||||
Console.WriteLine("Drive {0}", d.Name);
|
||||
|
||||
if (d.IsReady == true)
|
||||
{
|
||||
string Return = "Space Available " + (d.AvailableFreeSpace / 1024f) / 1024f + " MB";
|
||||
Console.WriteLine("Space Available: {0} MB", (d.AvailableFreeSpace / 1024f) / 1024f);
|
||||
Math.spaceAvailable = (d.AvailableFreeSpace / 1024f) / 1024f;
|
||||
return Return;
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
public static void ShowMediaDrives()
|
||||
{
|
||||
Console.WriteLine("The " + Config.config[0] + " Directory is: " + Files.GetDirectorySize(Config.config[0]) + " MB");
|
||||
Console.WriteLine("The " + Config.config[1] + " Directory is: " + Files.GetDirectorySize(Config.config[1]) + " MB");
|
||||
//The Will it fit on the drive maths...
|
||||
//TODO WRITE MATHS
|
||||
Console.ReadKey();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,155 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.IO;
|
||||
using System.Threading;
|
||||
|
||||
namespace ConsoleApplication2
|
||||
{
|
||||
class Files
|
||||
{
|
||||
|
||||
public static string copyStat = "Not Copied";
|
||||
public static int totalFiles = 0;
|
||||
public static int copiedFiles = 1;
|
||||
public static string False { get; set; }
|
||||
public static long GetDirectorySize(string path)
|
||||
{
|
||||
if (path == null)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
string[] a = Directory.GetFiles(path, ".", SearchOption.AllDirectories);
|
||||
|
||||
long b = 0;
|
||||
foreach (string name in a)
|
||||
{
|
||||
FileInfo info = new FileInfo(name);
|
||||
b += info.Length;
|
||||
}
|
||||
return (b / 1024) / 1024;
|
||||
}
|
||||
|
||||
public static void CopyData(string srcDir, string destDir, bool subDirs)
|
||||
{
|
||||
//TODO figure out how system.io.file.copy works AKA File.copy()
|
||||
DirectoryInfo dir = new DirectoryInfo(srcDir);
|
||||
DirectoryInfo[] dirs = dir.GetDirectories();
|
||||
copyStat = "Not Copied";
|
||||
if (!dir.Exists)
|
||||
{
|
||||
throw new DirectoryNotFoundException(
|
||||
"Source directory not found: " + srcDir);
|
||||
}
|
||||
|
||||
if (!Directory.Exists(destDir))
|
||||
{
|
||||
Directory.CreateDirectory(destDir);
|
||||
}
|
||||
|
||||
FileInfo[] files = dir.GetFiles();
|
||||
totalFiles = files.Length;
|
||||
foreach (FileInfo file in files)
|
||||
{
|
||||
string tempPath = Path.Combine(destDir, file.Name);
|
||||
|
||||
if (!File.Exists(tempPath))
|
||||
{
|
||||
try
|
||||
{
|
||||
file.CopyTo(tempPath, false);
|
||||
Console.WriteLine("Copying file : " + file.Name);
|
||||
copiedFiles++;
|
||||
LogHandler.WriteToLog(file.FullName, Config.config[3]);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Reporter.report(e);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (subDirs)
|
||||
{
|
||||
foreach (DirectoryInfo subdir in dirs)
|
||||
{
|
||||
string tempPath = Path.Combine(destDir, subdir.Name);
|
||||
|
||||
CopyData(subdir.FullName, tempPath, subDirs);
|
||||
if (!Directory.Exists(tempPath))
|
||||
{
|
||||
LogHandler.WriteToLog(subdir.FullName, Config.config[3]);
|
||||
}
|
||||
}
|
||||
}
|
||||
copyStat = "Files Copied";
|
||||
}
|
||||
|
||||
public static void DeleteData(string srcDir, bool subDirs)
|
||||
{
|
||||
DirectoryInfo dir = new DirectoryInfo(srcDir);
|
||||
DirectoryInfo[] dirs = dir.GetDirectories();
|
||||
if (!dir.Exists)
|
||||
{
|
||||
throw new DirectoryNotFoundException(
|
||||
"Source directory not found: " + srcDir);
|
||||
}
|
||||
|
||||
FileInfo[] files = dir.GetFiles();
|
||||
foreach (FileInfo file in files)
|
||||
{
|
||||
|
||||
if (File.Exists(file.FullName))
|
||||
{
|
||||
try
|
||||
{
|
||||
File.Delete(file.FullName);
|
||||
Console.WriteLine("Deleting file : " + file.Name);
|
||||
LogHandler.WriteToLog(file.FullName, Config.config[3]);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Reporter.report(e);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (subDirs)
|
||||
{
|
||||
foreach (DirectoryInfo subdir in dirs)
|
||||
{
|
||||
|
||||
|
||||
DeleteData(subdir.FullName, subDirs);
|
||||
Console.WriteLine(subdir.FullName);
|
||||
if (subdir.FullName != Config.config[1] + "\\Anime" && subdir.FullName != Config.config[1] + "\\T.V" && subdir.FullName != Config.config[1] + "\\TBS" && subdir.FullName != Config.config[1] + "\\Movies" && subdir.FullName != Config.config[1] + "\\Podcasts")
|
||||
{
|
||||
Directory.Delete(subdir.FullName);
|
||||
}
|
||||
|
||||
/* if (!Directory.Exists(tempPath))
|
||||
{
|
||||
LogHandler.WriteToLog(subdir.FullName, Config.config[3]);
|
||||
}*/
|
||||
}
|
||||
}
|
||||
}
|
||||
public static string copyStatus() {
|
||||
string response = "stat" + "*" + totalFiles + "*" + copiedFiles + "*" + copyStat;
|
||||
return response;
|
||||
}
|
||||
|
||||
public static int testData()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
public static void CopyTest()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace ConsoleApplication2
|
||||
{
|
||||
class Help
|
||||
{
|
||||
public static void showHelp()
|
||||
{
|
||||
Console.WriteLine("================================================================");
|
||||
Console.WriteLine(" This is the 'Lovely Manager' help screen");
|
||||
Console.WriteLine(" Use /CLI to enable automation");
|
||||
Console.WriteLine();
|
||||
Console.WriteLine();
|
||||
Console.WriteLine();
|
||||
Console.WriteLine();
|
||||
Console.WriteLine("================================================================");
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.IO;
|
||||
|
||||
namespace ConsoleApplication2
|
||||
{
|
||||
class LogHandler
|
||||
{
|
||||
public static void WriteToLog(string entry, string pathToLog)
|
||||
{
|
||||
if (!File.Exists(pathToLog))
|
||||
{
|
||||
File.Create(pathToLog).Close();
|
||||
|
||||
}
|
||||
|
||||
File.AppendAllText(pathToLog, entry + Environment.NewLine);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace ConsoleApplication2
|
||||
{
|
||||
class Math
|
||||
{
|
||||
public static float spaceAvailable;
|
||||
|
||||
public static string calcSpace()
|
||||
{
|
||||
string answer;
|
||||
|
||||
if (Files.GetDirectorySize(Config.config[1]) < spaceAvailable)
|
||||
{
|
||||
answer = "Yes";
|
||||
}
|
||||
else
|
||||
{
|
||||
answer = "No";
|
||||
}
|
||||
|
||||
return answer;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace ConsoleApplication2
|
||||
{
|
||||
class Menu
|
||||
{
|
||||
public static void DisplayMenu()
|
||||
{
|
||||
Console.Clear();
|
||||
Console.WriteLine("Lovely manager(WARNING VERY VERY ALPHA)");
|
||||
Console.WriteLine("==================================================");
|
||||
Console.WriteLine("= 1. Show Media Drives =");
|
||||
Console.WriteLine("= 2. Show Logs =");
|
||||
Console.WriteLine("= 3. Copy data =");
|
||||
Console.WriteLine("= 4. Test Network crap =");
|
||||
Console.WriteLine("= =");
|
||||
Console.WriteLine("= =");
|
||||
Console.WriteLine("= =");
|
||||
Console.WriteLine("= =");
|
||||
Console.WriteLine("= =");
|
||||
Console.WriteLine("= d. Display config params (testing) =");
|
||||
Console.WriteLine("= q. Quit =");
|
||||
Console.WriteLine("==================================================");
|
||||
Drives.DisplayDriveInfo();
|
||||
Console.Write("Enter option here: ");
|
||||
ParseMenu(Console.Read());
|
||||
}
|
||||
|
||||
public static void ParseMenu(int x)
|
||||
{
|
||||
char ch;
|
||||
ch = Convert.ToChar(x);
|
||||
|
||||
switch (ch)
|
||||
{
|
||||
case '1':
|
||||
Drives.ShowMediaDrives();
|
||||
break;
|
||||
case '2':
|
||||
//TODO ADD BETTER LOGGING FUNCTION
|
||||
break;
|
||||
case '3':
|
||||
Files.CopyData(Config.config[1], Config.config[0], true);
|
||||
break;
|
||||
case '4':
|
||||
TCPServer.Listen();
|
||||
break;
|
||||
case 'q':
|
||||
Program.networking.Abort();
|
||||
Program.running = !Program.running;
|
||||
break;
|
||||
case 'd':
|
||||
Console.WriteLine();
|
||||
foreach (string a in Config.config)
|
||||
{
|
||||
Console.WriteLine(a);
|
||||
}
|
||||
Console.WriteLine("Press any key to continue");
|
||||
Console.ReadKey();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace ConsoleApplication2
|
||||
{
|
||||
class NetParse
|
||||
{
|
||||
public static string parse(string data)
|
||||
{
|
||||
switch (data.ToLower())
|
||||
{
|
||||
case "diskinfo":
|
||||
return Config.config[2] + " " + Drives.DisplayDriveInfo() + " Left";
|
||||
case "copydata":
|
||||
Files.CopyData(Config.config[1], Config.config[0], true);
|
||||
return "Data copied";
|
||||
case "folderinfo":
|
||||
return Config.config[0] + " " + Files.GetDirectorySize(Config.config[0]) + " MB" + Environment.NewLine + Config.config[1] + " " + Files.GetDirectorySize(Config.config[1]) + " MB";
|
||||
case "spacerequired":
|
||||
return Math.calcSpace();
|
||||
case "awake?":
|
||||
return "yep";
|
||||
case "copystatus":
|
||||
return Files.copyStatus();
|
||||
case "deletedata":
|
||||
Files.DeleteData(Config.config[1], true);
|
||||
return "Files Deleted";
|
||||
case "update":
|
||||
string result;
|
||||
result = "yep" + "*" + Config.config[2] + " " + Drives.DisplayDriveInfo() + " Left" + "*" +
|
||||
Config.config[0] + " " + Files.GetDirectorySize(Config.config[0]) + " MB" + Environment.NewLine + Config.config[1] + " " + Files.GetDirectorySize(Config.config[1]) + " MB"
|
||||
+ "*" + Math.calcSpace();
|
||||
return result;
|
||||
case "testcopy":
|
||||
Files.CopyTest();
|
||||
return "Done!";
|
||||
default:
|
||||
return "Not a valid option";
|
||||
}
|
||||
//return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.IO;
|
||||
using System.Threading;
|
||||
|
||||
namespace ConsoleApplication2
|
||||
{
|
||||
class Program
|
||||
{
|
||||
public static bool running = true;
|
||||
public static Thread networking = new Thread(TCPServer.Listen);
|
||||
static void Main(string[] args)
|
||||
{
|
||||
|
||||
networking.Start();
|
||||
Test.TestThread();
|
||||
init();
|
||||
if (args.Length == 0)
|
||||
{
|
||||
while (running)
|
||||
{
|
||||
Menu.DisplayMenu();
|
||||
}
|
||||
}
|
||||
if (args.Length != 0 && args[0] == "/?")
|
||||
{
|
||||
Help.showHelp();
|
||||
}
|
||||
if (args.Length != 0 && args[0] == "/server")
|
||||
{
|
||||
Console.WriteLine("Running in server mode :3");
|
||||
TCPServer.Listen();
|
||||
}
|
||||
}
|
||||
|
||||
static void init()
|
||||
{
|
||||
Config.ReadConfig("config.txt");
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("ConsoleApplication2")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("ConsoleApplication2")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2015")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("9921ec54-a8f1-4e3a-af8b-682b86deeb59")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
@@ -0,0 +1,16 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace ConsoleApplication2
|
||||
{
|
||||
class Reporter
|
||||
{
|
||||
public static Exception report(Exception e)
|
||||
{
|
||||
Console.Write(e);
|
||||
return e;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
|
||||
<ProductVersion>8.0.30703</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{17DA3EA9-F8CA-4BB0-9E73-42DBC1EF689A}</ProjectGuid>
|
||||
<OutputType>Exe</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>ConsoleApplication2</RootNamespace>
|
||||
<AssemblyName>ConsoleApplication2</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
||||
<TargetFrameworkProfile>Client</TargetFrameworkProfile>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Config.cs" />
|
||||
<Compile Include="Drives.cs" />
|
||||
<Compile Include="Files.cs" />
|
||||
<Compile Include="Help.cs" />
|
||||
<Compile Include="Logger.cs" />
|
||||
<Compile Include="Math.cs" />
|
||||
<Compile Include="Menu.cs" />
|
||||
<Compile Include="NetParse.cs" />
|
||||
<Compile Include="Program.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Reporter.cs" />
|
||||
<Compile Include="TCPServer.cs" />
|
||||
<Compile Include="Test.cs" />
|
||||
<Compile Include="Threader.cs" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
||||
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
|
||||
<StartArguments>/server</StartArguments>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
@@ -0,0 +1,71 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Net;
|
||||
using System.Net.Sockets;
|
||||
using System.Text;
|
||||
|
||||
namespace ConsoleApplication2
|
||||
{
|
||||
class TCPServer
|
||||
{
|
||||
public static void Listen()
|
||||
{
|
||||
while (Program.running) {
|
||||
TcpListener server = null;
|
||||
try
|
||||
{
|
||||
Int32 port = 13754;
|
||||
IPAddress localAddr = IPAddress.Parse("127.0.0.1");
|
||||
server = new TcpListener(localAddr, port);
|
||||
server.Start();
|
||||
Byte[] bytes = new Byte[256];
|
||||
String data = null;
|
||||
|
||||
//Listening Loop
|
||||
while (true)
|
||||
{
|
||||
Console.Write("Waiting on a connection...");
|
||||
TcpClient client = server.AcceptTcpClient();
|
||||
Console.WriteLine("Connected");
|
||||
data = null;
|
||||
|
||||
NetworkStream stream = client.GetStream();
|
||||
|
||||
int i;
|
||||
|
||||
//Loop to receive all the data sent by the client
|
||||
while ((i = stream.Read(bytes, 0, bytes.Length)) != 0)
|
||||
{
|
||||
data = System.Text.Encoding.ASCII.GetString(bytes, 0, i);
|
||||
Console.WriteLine("Recieved: {0}", data);
|
||||
|
||||
data = data.ToLower();
|
||||
|
||||
data = NetParse.parse(data);
|
||||
|
||||
//Proccess the data
|
||||
//data = Drives.DisplayDriveInfo();
|
||||
byte[] msg = System.Text.Encoding.ASCII.GetBytes(data);
|
||||
|
||||
//Send back a response
|
||||
stream.Write(msg, 0, msg.Length);
|
||||
Console.WriteLine("Sent: {0}", data);
|
||||
}
|
||||
client.Close();
|
||||
}
|
||||
}
|
||||
catch (SocketException e)
|
||||
{
|
||||
Console.WriteLine("SocketException: {0}", e);
|
||||
}
|
||||
finally
|
||||
{
|
||||
server.Stop();
|
||||
}
|
||||
Console.WriteLine("\nHit enter to continue");
|
||||
Console.Read();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.IO;
|
||||
|
||||
namespace ConsoleApplication2
|
||||
{
|
||||
class Test
|
||||
{
|
||||
public static void TestThread()
|
||||
{
|
||||
Program.networking.Join();
|
||||
for (int i = 0; i <= 10; i++)
|
||||
{
|
||||
System.Console.WriteLine(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
|
||||
namespace ConsoleApplication2
|
||||
{
|
||||
class Threader
|
||||
{
|
||||
public static void addThread(string func, string option)
|
||||
{
|
||||
Thread thread = new Thread(TCPServer.Listen);
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
+11
@@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
|
||||
<assemblyIdentity version="1.0.0.0" name="MyApplication.app"/>
|
||||
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
|
||||
<security>
|
||||
<requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
|
||||
<requestedExecutionLevel level="asInvoker" uiAccess="false"/>
|
||||
</requestedPrivileges>
|
||||
</security>
|
||||
</trustInfo>
|
||||
</assembly>
|
||||
@@ -0,0 +1,2 @@
|
||||
D:\Mediabuffer\Music\New folder\e.rar
|
||||
D:\Mediabuffer\Music\New folder\New Text Document.txt
|
||||
@@ -0,0 +1,4 @@
|
||||
D:\Media2
|
||||
D:\Mediabuffer
|
||||
D:\
|
||||
Log.txt
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
+11
@@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
|
||||
<assemblyIdentity version="1.0.0.0" name="MyApplication.app"/>
|
||||
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
|
||||
<security>
|
||||
<requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
|
||||
<requestedExecutionLevel level="asInvoker" uiAccess="false"/>
|
||||
</requestedPrivileges>
|
||||
</security>
|
||||
</trustInfo>
|
||||
</assembly>
|
||||
@@ -0,0 +1,2 @@
|
||||
D:\Mediabuffer\Music\New folder\e.rar
|
||||
D:\Mediabuffer\Music\New folder\New Text Document.txt
|
||||
@@ -0,0 +1,4 @@
|
||||
D:\Media2
|
||||
D:\Mediabuffer
|
||||
D:\
|
||||
Log.txt
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
c:\users\benjamyn\documents\visual studio 2010\Projects\ConsoleApplication2\ConsoleApplication2\bin\Debug\ConsoleApplication2.exe
|
||||
c:\users\benjamyn\documents\visual studio 2010\Projects\ConsoleApplication2\ConsoleApplication2\bin\Debug\ConsoleApplication2.pdb
|
||||
c:\users\benjamyn\documents\visual studio 2010\Projects\ConsoleApplication2\ConsoleApplication2\obj\x86\Debug\ConsoleApplication2.exe
|
||||
c:\users\benjamyn\documents\visual studio 2010\Projects\ConsoleApplication2\ConsoleApplication2\obj\x86\Debug\ConsoleApplication2.pdb
|
||||
Binary file not shown.
Binary file not shown.
BIN
Binary file not shown.
+10
@@ -0,0 +1,10 @@
|
||||
c:\users\benjamyn\documents\visual studio 2010\Projects\ConsoleApplication2\ConsoleApplication2\bin\Debug\ConsoleApplication2.exe
|
||||
c:\users\benjamyn\documents\visual studio 2010\Projects\ConsoleApplication2\ConsoleApplication2\bin\Debug\ConsoleApplication2.pdb
|
||||
c:\users\benjamyn\documents\visual studio 2010\Projects\ConsoleApplication2\ConsoleApplication2\obj\x86\Debug\ConsoleApplication2.exe
|
||||
c:\users\benjamyn\documents\visual studio 2010\Projects\ConsoleApplication2\ConsoleApplication2\obj\x86\Debug\ConsoleApplication2.pdb
|
||||
C:\Users\Benjamyn\Documents\Visual Studio 2010\Projects\ConsoleApplication2\ConsoleApplication2\obj\x86\Debug\Server Manager.csprojResolveAssemblyReference.cache
|
||||
D:\Documents\Visual Studio 2010\Projects\ConsoleApplication2\ConsoleApplication2\bin\Debug\ConsoleApplication2.exe
|
||||
D:\Documents\Visual Studio 2010\Projects\ConsoleApplication2\ConsoleApplication2\bin\Debug\ConsoleApplication2.pdb
|
||||
D:\Documents\Visual Studio 2010\Projects\ConsoleApplication2\ConsoleApplication2\obj\x86\Debug\Server Manager.csprojResolveAssemblyReference.cache
|
||||
D:\Documents\Visual Studio 2010\Projects\ConsoleApplication2\ConsoleApplication2\obj\x86\Debug\ConsoleApplication2.exe
|
||||
D:\Documents\Visual Studio 2010\Projects\ConsoleApplication2\ConsoleApplication2\obj\x86\Debug\ConsoleApplication2.pdb
|
||||
BIN
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
Binary file not shown.
+10
@@ -0,0 +1,10 @@
|
||||
C:\Users\Benjamyn\Documents\Visual Studio 2010\Projects\ConsoleApplication2\ConsoleApplication2\bin\Release\ConsoleApplication2.exe
|
||||
C:\Users\Benjamyn\Documents\Visual Studio 2010\Projects\ConsoleApplication2\ConsoleApplication2\bin\Release\ConsoleApplication2.pdb
|
||||
C:\Users\Benjamyn\Documents\Visual Studio 2010\Projects\ConsoleApplication2\ConsoleApplication2\obj\x86\Release\ConsoleApplication2.exe
|
||||
C:\Users\Benjamyn\Documents\Visual Studio 2010\Projects\ConsoleApplication2\ConsoleApplication2\obj\x86\Release\ConsoleApplication2.pdb
|
||||
C:\Users\Benjamyn\Documents\Visual Studio 2010\Projects\ConsoleApplication2\ConsoleApplication2\obj\x86\Release\Server Manager.csprojResolveAssemblyReference.cache
|
||||
D:\Documents\Visual Studio 2010\Projects\ConsoleApplication2\ConsoleApplication2\bin\Release\ConsoleApplication2.exe
|
||||
D:\Documents\Visual Studio 2010\Projects\ConsoleApplication2\ConsoleApplication2\bin\Release\ConsoleApplication2.pdb
|
||||
D:\Documents\Visual Studio 2010\Projects\ConsoleApplication2\ConsoleApplication2\obj\x86\Release\Server Manager.csprojResolveAssemblyReference.cache
|
||||
D:\Documents\Visual Studio 2010\Projects\ConsoleApplication2\ConsoleApplication2\obj\x86\Release\ConsoleApplication2.exe
|
||||
D:\Documents\Visual Studio 2010\Projects\ConsoleApplication2\ConsoleApplication2\obj\x86\Release\ConsoleApplication2.pdb
|
||||
BIN
Binary file not shown.
@@ -0,0 +1,26 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 11.00
|
||||
# Visual Studio 2010
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Server Manager", "ConsoleApplication2\Server Manager.csproj", "{17DA3EA9-F8CA-4BB0-9E73-42DBC1EF689A}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Manager Client", "..\Manager Client\Manager Client\Manager Client.csproj", "{34FC8DF0-8747-4A1A-B616-37E131E5B3E8}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|x86 = Debug|x86
|
||||
Release|x86 = Release|x86
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{17DA3EA9-F8CA-4BB0-9E73-42DBC1EF689A}.Debug|x86.ActiveCfg = Debug|x86
|
||||
{17DA3EA9-F8CA-4BB0-9E73-42DBC1EF689A}.Debug|x86.Build.0 = Debug|x86
|
||||
{17DA3EA9-F8CA-4BB0-9E73-42DBC1EF689A}.Release|x86.ActiveCfg = Release|x86
|
||||
{17DA3EA9-F8CA-4BB0-9E73-42DBC1EF689A}.Release|x86.Build.0 = Release|x86
|
||||
{34FC8DF0-8747-4A1A-B616-37E131E5B3E8}.Debug|x86.ActiveCfg = Debug|x86
|
||||
{34FC8DF0-8747-4A1A-B616-37E131E5B3E8}.Debug|x86.Build.0 = Debug|x86
|
||||
{34FC8DF0-8747-4A1A-B616-37E131E5B3E8}.Release|x86.ActiveCfg = Release|x86
|
||||
{34FC8DF0-8747-4A1A-B616-37E131E5B3E8}.Release|x86.Build.0 = Release|x86
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
Binary file not shown.
Binary file not shown.
Reference in new issue
Block a user