amxmodx/installer/builder/AMod.cs

124 lines
2.5 KiB
C#
Raw Normal View History

2005-08-02 06:28:41 +00:00
using System;
using System.Diagnostics;
using System.Collections;
namespace AMXXRelease
{
//Holds information about a plugin
2005-08-02 06:28:41 +00:00
public class Plugin
{
public string name; //Plugin output file name
public string source; //Source code file
public string options; //Compile-time options
public string outdir; //Output folder
2005-08-02 06:28:41 +00:00
public Plugin(string Name)
{
name = (string)Name.Clone();
source = (string)Name.Clone();
outdir = "plugins";
}
}
//Holds information necessary to compile a module/C++ program
2005-08-02 06:28:41 +00:00
public class Module
{
public string sourcedir; //Source directory
public string projname; //Output binary name (such as amxmodx_mm)
public string build; //Build configuration
public string bindir; //Binary directory
public string vcproj; //VCProj file name
public string outdir; //Output directory
2005-08-02 06:28:41 +00:00
public Module()
{
build = "Release";
outdir = "modules";
bindir = "msvc8";
2005-08-02 06:28:41 +00:00
}
public Module(string name)
{
build = "Release";
outdir = "modules";
sourcedir = "dlls\\" + name;
bindir = "msvc8";
2005-08-02 06:28:41 +00:00
projname = name + "_amxx";
vcproj = name;
}
}
//Class that represents how a mod wants to be built.
//It exports a list of functions, mods, and a few
// tidbits of information. It can also hook an extra
// step for copying miscellanious files.
2005-08-02 06:28:41 +00:00
public abstract class AMod
{
protected ArrayList m_Modules;
protected ArrayList m_Plugins;
public abstract string GetName();
public virtual string GetBaseName()
{
return GetName();
}
public AMod()
{
m_Modules = new ArrayList();
m_Plugins = new ArrayList();
}
//called when it's okay to build an extra dir structure
// and copy files to it
public virtual bool CopyExtraFiles(ABuilder ab, string basedir, string sourcedir)
2005-08-02 06:28:41 +00:00
{
return true;
}
//defines a copy prevention filter
public virtual bool ExcludeCopy(string file)
{
return false;
}
2005-08-02 06:28:41 +00:00
public virtual string GetPluginDir()
{
return GetName();
}
public virtual int GetModules()
{
return m_Modules.Count;
}
public virtual Module GetModule(int i)
{
return (Module)m_Modules[i];
}
public virtual int GetPlugins()
{
return m_Plugins.Count;
}
2005-08-03 01:14:17 +00:00
public virtual string GetModPath()
{
return GetName() + "\\addons\\amxmodx";
}
2005-08-02 06:28:41 +00:00
public virtual Plugin GetPlugin(int i)
{
return (Plugin)m_Plugins[i];
}
public virtual Plugin AddPlugin(string name)
{
Plugin pl = new Plugin(name);
m_Plugins.Add(pl);
return pl;
}
}
}