2005-08-02 06:28:41 +00:00
|
|
|
using System;
|
2005-08-24 02:53:38 +00:00
|
|
|
using System.IO;
|
2005-08-02 06:28:41 +00:00
|
|
|
|
|
|
|
namespace AMXXRelease
|
|
|
|
{
|
2005-08-24 02:53:38 +00:00
|
|
|
//Reads in config file info
|
2005-08-02 06:28:41 +00:00
|
|
|
public class Config
|
|
|
|
{
|
2005-08-24 02:53:38 +00:00
|
|
|
private string m_SourceTree;
|
|
|
|
private string m_OutputPath;
|
|
|
|
private string m_DevenvPath;
|
|
|
|
private string m_PathToCompress;
|
|
|
|
private string m_ReleaseName;
|
|
|
|
private string m_MakeOpts;
|
|
|
|
|
2005-08-02 06:28:41 +00:00
|
|
|
public Config()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
public string GetSourceTree()
|
|
|
|
{
|
2005-08-24 02:53:38 +00:00
|
|
|
return m_SourceTree;
|
2005-08-02 06:28:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public string OutputPath()
|
|
|
|
{
|
2005-08-24 02:53:38 +00:00
|
|
|
return m_OutputPath;
|
2005-08-02 06:28:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public string DevenvPath()
|
|
|
|
{
|
2005-08-24 02:53:38 +00:00
|
|
|
return m_DevenvPath;
|
|
|
|
}
|
|
|
|
|
|
|
|
public string CompressPath()
|
|
|
|
{
|
|
|
|
return m_PathToCompress;
|
|
|
|
}
|
|
|
|
|
|
|
|
public string GetReleaseName()
|
|
|
|
{
|
|
|
|
return m_ReleaseName;
|
2005-08-02 06:28:41 +00:00
|
|
|
}
|
|
|
|
|
2005-08-24 02:53:38 +00:00
|
|
|
public string MakeOpts()
|
2005-08-02 06:28:41 +00:00
|
|
|
{
|
2005-08-24 02:53:38 +00:00
|
|
|
return m_MakeOpts;
|
|
|
|
}
|
|
|
|
|
|
|
|
public bool ReadFromFile(string file)
|
|
|
|
{
|
|
|
|
try
|
|
|
|
{
|
|
|
|
StreamReader sr = new StreamReader(file);
|
|
|
|
|
|
|
|
string line;
|
|
|
|
string delim = "\t \n\r\v";
|
|
|
|
string splt = "=";
|
|
|
|
while ( (line = sr.ReadLine()) != null )
|
|
|
|
{
|
|
|
|
line = line.Trim(delim.ToCharArray());
|
|
|
|
if (line.Length < 1 || line[0] == ';')
|
|
|
|
continue;
|
|
|
|
string [] s = line.Split(splt.ToCharArray());
|
|
|
|
string key, val="";
|
|
|
|
if (s.GetLength(0) >= 1)
|
|
|
|
{
|
|
|
|
key = s[0];
|
|
|
|
if (s.GetLength(0) >= 2)
|
|
|
|
{
|
|
|
|
for(int i=1; i<s.GetLength(0); i++)
|
|
|
|
val += s[i];
|
|
|
|
}
|
|
|
|
key = key.Trim(delim.ToCharArray());
|
|
|
|
val = val.Trim(delim.ToCharArray());
|
|
|
|
if (key.CompareTo("compress")==0)
|
|
|
|
m_PathToCompress = val;
|
|
|
|
if (key.CompareTo("devenv")==0)
|
|
|
|
m_DevenvPath = val;
|
|
|
|
if (key.CompareTo("output")==0)
|
|
|
|
m_OutputPath = val;
|
|
|
|
if (key.CompareTo("source")==0)
|
|
|
|
m_SourceTree = val;
|
|
|
|
if (key.CompareTo("release")==0)
|
|
|
|
m_ReleaseName = val;
|
|
|
|
if (key.CompareTo("makeopts")==0)
|
|
|
|
m_MakeOpts = val;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
} catch {
|
|
|
|
Console.WriteLine("Unable to read file: " + file);
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
2005-08-02 06:28:41 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2005-08-24 02:53:38 +00:00
|
|
|
|