tools/builder/Main.cs
author Matt Woodrow <pred@alliedmods.net>
Tue Apr 01 00:51:21 2008 +0000 (2008-04-01)
changeset 1956 8ae29b9df92c
parent 1952 b7aa2b626807
child 2256 de422b59bdfc
permissions -rw-r--r--
Added EquipPlayerWeapon to SDKTools. Offsets for CS:S and TF2 added.
ds@1952
     1
using System;
ds@1952
     2
using System.IO;
ds@1952
     3
using System.Diagnostics;
ds@1952
     4
ds@1952
     5
namespace builder
ds@1952
     6
{
ds@1952
     7
	class Program
ds@1952
     8
	{
ds@1952
     9
		static void Main(string[] args)
ds@1952
    10
		{
ds@1952
    11
			if (args.GetLength(0) < 1)
ds@1952
    12
			{
ds@1952
    13
				System.Console.WriteLine("Usage: <config file>");
ds@1952
    14
				return;
ds@1952
    15
			}
ds@1952
    16
ds@1952
    17
			Config cfg = new Config();
ds@1952
    18
			if (!cfg.ReadFromFile(args[0]))
ds@1952
    19
			{
ds@1952
    20
				return;
ds@1952
    21
			}
ds@1952
    22
ds@1952
    23
			/* :TODO: Add path validation */
ds@1952
    24
ds@1952
    25
			ABuilder bld = null;
ds@1952
    26
			
ds@1952
    27
			if (cfg.Platform == BasePlatform.Platform_Linux)
ds@1952
    28
			{
ds@1952
    29
				bld = new LinuxBuilder(cfg);
ds@1952
    30
			} 
ds@1952
    31
			else if (cfg.Platform == BasePlatform.Platform_Windows)
ds@1952
    32
			{
ds@1952
    33
				bld = new Win32Builder(cfg);
ds@1952
    34
				if (cfg.pdb_log_file != null && File.Exists(cfg.pdb_log_file))
ds@1952
    35
				{
ds@1952
    36
					File.Delete(cfg.pdb_log_file);
ds@1952
    37
				}
ds@1952
    38
			}
ds@1952
    39
ds@1952
    40
			try
ds@1952
    41
			{
ds@1952
    42
				bld.BuildPackage(new PkgCore());
ds@1952
    43
			} 
ds@1952
    44
			catch (System.Exception e) 
ds@1952
    45
			{
ds@1952
    46
				Console.WriteLine("Build failed: " + e.Message);
ds@1952
    47
			}
ds@1952
    48
		}
ds@1952
    49
	}
ds@1952
    50
}