Massive tab and trailing space cleanup
parent
e88e2945e9
commit
b16abc8166
|
@ -523,7 +523,7 @@ namespace OpenSim.Groups
|
||||||
|
|
||||||
UUID ejecteeID = new UUID(im.toAgentID);
|
UUID ejecteeID = new UUID(im.toAgentID);
|
||||||
|
|
||||||
im.imSessionID = UUID.Zero.Guid;
|
im.imSessionID = UUID.Zero.Guid;
|
||||||
im.dialog = (byte)InstantMessageDialog.MessageFromAgent;
|
im.dialog = (byte)InstantMessageDialog.MessageFromAgent;
|
||||||
OutgoingInstantMessage(im, ejecteeID);
|
OutgoingInstantMessage(im, ejecteeID);
|
||||||
|
|
||||||
|
|
|
@ -307,20 +307,20 @@ namespace OpenSim.Groups
|
||||||
m.Contribution = Int32.Parse(d.Data["Contribution"]);
|
m.Contribution = Int32.Parse(d.Data["Contribution"]);
|
||||||
m.ListInProfile = d.Data["ListInProfile"] == "1" ? true : false;
|
m.ListInProfile = d.Data["ListInProfile"] == "1" ? true : false;
|
||||||
|
|
||||||
GridUserData gud = m_GridUserService.Get(d.PrincipalID);
|
GridUserData gud = m_GridUserService.Get(d.PrincipalID);
|
||||||
if (gud != null)
|
if (gud != null)
|
||||||
{
|
{
|
||||||
if (bool.Parse(gud.Data["Online"]))
|
if (bool.Parse(gud.Data["Online"]))
|
||||||
{
|
{
|
||||||
m.OnlineStatus = @"Online";
|
m.OnlineStatus = @"Online";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
int unixtime = int.Parse(gud.Data["Login"]);
|
int unixtime = int.Parse(gud.Data["Login"]);
|
||||||
// The viewer is very picky about how these strings are formed. Eg. it will crash on malformed dates!
|
// The viewer is very picky about how these strings are formed. Eg. it will crash on malformed dates!
|
||||||
m.OnlineStatus = (unixtime == 0) ? @"unknown" : Util.ToDateTime(unixtime).ToString("MM/dd/yyyy");
|
m.OnlineStatus = (unixtime == 0) ? @"unknown" : Util.ToDateTime(unixtime).ToString("MM/dd/yyyy");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Is this person an owner of the group?
|
// Is this person an owner of the group?
|
||||||
m.IsOwner = (rolemembershipsList.Find(r => r.RoleID == ownerRoleID) != null) ? true : false;
|
m.IsOwner = (rolemembershipsList.Find(r => r.RoleID == ownerRoleID) != null) ? true : false;
|
||||||
|
|
|
@ -35,67 +35,67 @@ using OpenSim.Services.Base;
|
||||||
|
|
||||||
namespace OpenSim.Groups
|
namespace OpenSim.Groups
|
||||||
{
|
{
|
||||||
public class GroupsServiceBase : ServiceBase
|
public class GroupsServiceBase : ServiceBase
|
||||||
{
|
{
|
||||||
protected IGroupsData m_Database = null;
|
protected IGroupsData m_Database = null;
|
||||||
protected IGridUserData m_GridUserService = null;
|
protected IGridUserData m_GridUserService = null;
|
||||||
|
|
||||||
public GroupsServiceBase(IConfigSource config, string cName)
|
public GroupsServiceBase(IConfigSource config, string cName)
|
||||||
: base(config)
|
: base(config)
|
||||||
{
|
{
|
||||||
string dllName = String.Empty;
|
string dllName = String.Empty;
|
||||||
string connString = String.Empty;
|
string connString = String.Empty;
|
||||||
string realm = "os_groups";
|
string realm = "os_groups";
|
||||||
string usersRealm = "GridUser";
|
string usersRealm = "GridUser";
|
||||||
string configName = (cName == string.Empty) ? "Groups" : cName;
|
string configName = (cName == string.Empty) ? "Groups" : cName;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Try reading the [DatabaseService] section, if it exists
|
// Try reading the [DatabaseService] section, if it exists
|
||||||
//
|
//
|
||||||
IConfig dbConfig = config.Configs["DatabaseService"];
|
IConfig dbConfig = config.Configs["DatabaseService"];
|
||||||
if (dbConfig != null)
|
if (dbConfig != null)
|
||||||
{
|
{
|
||||||
if (dllName == String.Empty)
|
if (dllName == String.Empty)
|
||||||
dllName = dbConfig.GetString("StorageProvider", String.Empty);
|
dllName = dbConfig.GetString("StorageProvider", String.Empty);
|
||||||
if (connString == String.Empty)
|
if (connString == String.Empty)
|
||||||
connString = dbConfig.GetString("ConnectionString", String.Empty);
|
connString = dbConfig.GetString("ConnectionString", String.Empty);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// [Groups] section overrides [DatabaseService], if it exists
|
// [Groups] section overrides [DatabaseService], if it exists
|
||||||
//
|
//
|
||||||
IConfig groupsConfig = config.Configs[configName];
|
IConfig groupsConfig = config.Configs[configName];
|
||||||
if (groupsConfig != null)
|
if (groupsConfig != null)
|
||||||
{
|
{
|
||||||
dllName = groupsConfig.GetString("StorageProvider", dllName);
|
dllName = groupsConfig.GetString("StorageProvider", dllName);
|
||||||
connString = groupsConfig.GetString("ConnectionString", connString);
|
connString = groupsConfig.GetString("ConnectionString", connString);
|
||||||
realm = groupsConfig.GetString("Realm", realm);
|
realm = groupsConfig.GetString("Realm", realm);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// We tried, but this doesn't exist. We can't proceed.
|
// We tried, but this doesn't exist. We can't proceed.
|
||||||
//
|
//
|
||||||
if (dllName.Equals(String.Empty))
|
if (dllName.Equals(String.Empty))
|
||||||
throw new Exception("No StorageProvider configured");
|
throw new Exception("No StorageProvider configured");
|
||||||
|
|
||||||
m_Database = LoadPlugin<IGroupsData>(dllName, new Object[] { connString, realm });
|
m_Database = LoadPlugin<IGroupsData>(dllName, new Object[] { connString, realm });
|
||||||
if (m_Database == null)
|
if (m_Database == null)
|
||||||
throw new Exception("Could not find a storage interface in the given module " + dllName);
|
throw new Exception("Could not find a storage interface in the given module " + dllName);
|
||||||
|
|
||||||
//
|
//
|
||||||
// [GridUserService] section overrides [DatabaseService], if it exists
|
// [GridUserService] section overrides [DatabaseService], if it exists
|
||||||
//
|
//
|
||||||
IConfig usersConfig = config.Configs["GridUserService"];
|
IConfig usersConfig = config.Configs["GridUserService"];
|
||||||
if (usersConfig != null)
|
if (usersConfig != null)
|
||||||
{
|
{
|
||||||
dllName = usersConfig.GetString("StorageProvider", dllName);
|
dllName = usersConfig.GetString("StorageProvider", dllName);
|
||||||
connString = usersConfig.GetString("ConnectionString", connString);
|
connString = usersConfig.GetString("ConnectionString", connString);
|
||||||
usersRealm = usersConfig.GetString("Realm", usersRealm);
|
usersRealm = usersConfig.GetString("Realm", usersRealm);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_GridUserService = LoadPlugin<IGridUserData>(dllName, new Object[] { connString, usersRealm });
|
m_GridUserService = LoadPlugin<IGridUserData>(dllName, new Object[] { connString, usersRealm });
|
||||||
if (m_GridUserService == null)
|
if (m_GridUserService == null)
|
||||||
throw new Exception("Could not find a storage inferface for the given users module " + dllName);
|
throw new Exception("Could not find a storage inferface for the given users module " + dllName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -531,14 +531,14 @@ namespace OpenSim.Framework
|
||||||
{
|
{
|
||||||
lock (m_attachments)
|
lock (m_attachments)
|
||||||
{
|
{
|
||||||
List<AvatarAttachment> alist = new List<AvatarAttachment>();
|
List<AvatarAttachment> alist = new List<AvatarAttachment>();
|
||||||
foreach (KeyValuePair<int, List<AvatarAttachment>> kvp in m_attachments)
|
foreach (KeyValuePair<int, List<AvatarAttachment>> kvp in m_attachments)
|
||||||
{
|
{
|
||||||
foreach (AvatarAttachment attach in kvp.Value)
|
foreach (AvatarAttachment attach in kvp.Value)
|
||||||
alist.Add(new AvatarAttachment(attach));
|
alist.Add(new AvatarAttachment(attach));
|
||||||
}
|
}
|
||||||
return alist;
|
return alist;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal void AppendAttachment(AvatarAttachment attach)
|
internal void AppendAttachment(AvatarAttachment attach)
|
||||||
|
|
|
@ -46,93 +46,93 @@ namespace OpenSim.Framework.Console
|
||||||
//
|
//
|
||||||
public class RemoteConsole : CommandConsole
|
public class RemoteConsole : CommandConsole
|
||||||
{
|
{
|
||||||
// Connection specific data, indexed by a session ID
|
// Connection specific data, indexed by a session ID
|
||||||
// we create when a client connects.
|
// we create when a client connects.
|
||||||
protected class ConsoleConnection
|
protected class ConsoleConnection
|
||||||
{
|
{
|
||||||
// Last activity from the client
|
// Last activity from the client
|
||||||
public int last;
|
public int last;
|
||||||
|
|
||||||
// Last line of scrollback posted to this client
|
// Last line of scrollback posted to this client
|
||||||
public long lastLineSeen;
|
public long lastLineSeen;
|
||||||
|
|
||||||
// True if this is a new connection, e.g. has never
|
// True if this is a new connection, e.g. has never
|
||||||
// displayed a prompt to the user.
|
// displayed a prompt to the user.
|
||||||
public bool newConnection = true;
|
public bool newConnection = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// A line in the scrollback buffer.
|
// A line in the scrollback buffer.
|
||||||
protected class ScrollbackEntry
|
protected class ScrollbackEntry
|
||||||
{
|
{
|
||||||
// The line number of this entry
|
// The line number of this entry
|
||||||
public long lineNumber;
|
public long lineNumber;
|
||||||
|
|
||||||
// The text to send to the client
|
// The text to send to the client
|
||||||
public string text;
|
public string text;
|
||||||
|
|
||||||
// The level this should be logged as. Omitted for
|
// The level this should be logged as. Omitted for
|
||||||
// prompts and input echo.
|
// prompts and input echo.
|
||||||
public string level;
|
public string level;
|
||||||
|
|
||||||
// True if the text above is a prompt, e.g. the
|
// True if the text above is a prompt, e.g. the
|
||||||
// client should turn on the cursor / accept input
|
// client should turn on the cursor / accept input
|
||||||
public bool isPrompt;
|
public bool isPrompt;
|
||||||
|
|
||||||
// True if the requested input is a command. A
|
// True if the requested input is a command. A
|
||||||
// client may offer help or validate input if
|
// client may offer help or validate input if
|
||||||
// this is set. If false, input should be sent
|
// this is set. If false, input should be sent
|
||||||
// as typed.
|
// as typed.
|
||||||
public bool isCommand;
|
public bool isCommand;
|
||||||
|
|
||||||
// True if this text represents a line of text that
|
// True if this text represents a line of text that
|
||||||
// was input in response to a prompt. A client should
|
// was input in response to a prompt. A client should
|
||||||
// turn off the cursor and refrain from sending commands
|
// turn off the cursor and refrain from sending commands
|
||||||
// until a new prompt is received.
|
// until a new prompt is received.
|
||||||
public bool isInput;
|
public bool isInput;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Data that is relevant to all connections
|
// Data that is relevant to all connections
|
||||||
|
|
||||||
// The scrollback buffer
|
// The scrollback buffer
|
||||||
protected List<ScrollbackEntry> m_Scrollback = new List<ScrollbackEntry>();
|
protected List<ScrollbackEntry> m_Scrollback = new List<ScrollbackEntry>();
|
||||||
|
|
||||||
// Monotonously incrementing line number. This may eventually
|
// Monotonously incrementing line number. This may eventually
|
||||||
// wrap. No provision is made for that case because 64 bits
|
// wrap. No provision is made for that case because 64 bits
|
||||||
// is a long, long time.
|
// is a long, long time.
|
||||||
protected long m_lineNumber = 0;
|
protected long m_lineNumber = 0;
|
||||||
|
|
||||||
// These two variables allow us to send the correct
|
// These two variables allow us to send the correct
|
||||||
// information about the prompt status to the client,
|
// information about the prompt status to the client,
|
||||||
// irrespective of what may have run off the top of the
|
// irrespective of what may have run off the top of the
|
||||||
// scrollback buffer;
|
// scrollback buffer;
|
||||||
protected bool m_expectingInput = false;
|
protected bool m_expectingInput = false;
|
||||||
protected bool m_expectingCommand = true;
|
protected bool m_expectingCommand = true;
|
||||||
protected string m_lastPromptUsed;
|
protected string m_lastPromptUsed;
|
||||||
|
|
||||||
// This is the list of things received from clients.
|
// This is the list of things received from clients.
|
||||||
// Note: Race conditions can happen. If a client sends
|
// Note: Race conditions can happen. If a client sends
|
||||||
// something while nothing is expected, it will be
|
// something while nothing is expected, it will be
|
||||||
// intepreted as input to the next prompt. For
|
// intepreted as input to the next prompt. For
|
||||||
// commands this is largely correct. For other prompts,
|
// commands this is largely correct. For other prompts,
|
||||||
// YMMV.
|
// YMMV.
|
||||||
// TODO: Find a better way to fix this
|
// TODO: Find a better way to fix this
|
||||||
protected List<string> m_InputData = new List<string>();
|
protected List<string> m_InputData = new List<string>();
|
||||||
|
|
||||||
// Event to allow ReadLine to wait synchronously even though
|
// Event to allow ReadLine to wait synchronously even though
|
||||||
// everthing else is asynchronous here.
|
// everthing else is asynchronous here.
|
||||||
protected ManualResetEvent m_DataEvent = new ManualResetEvent(false);
|
protected ManualResetEvent m_DataEvent = new ManualResetEvent(false);
|
||||||
|
|
||||||
// The list of sessions we maintain. Unlike other console types,
|
// The list of sessions we maintain. Unlike other console types,
|
||||||
// multiple users on the same console are explicitly allowed.
|
// multiple users on the same console are explicitly allowed.
|
||||||
protected Dictionary<UUID, ConsoleConnection> m_Connections =
|
protected Dictionary<UUID, ConsoleConnection> m_Connections =
|
||||||
new Dictionary<UUID, ConsoleConnection>();
|
new Dictionary<UUID, ConsoleConnection>();
|
||||||
|
|
||||||
// Timer to control expiration of sessions that have been
|
// Timer to control expiration of sessions that have been
|
||||||
// disconnected.
|
// disconnected.
|
||||||
protected System.Timers.Timer m_expireTimer = new System.Timers.Timer(5000);
|
protected System.Timers.Timer m_expireTimer = new System.Timers.Timer(5000);
|
||||||
|
|
||||||
// The less interesting stuff that makes the actual server
|
// The less interesting stuff that makes the actual server
|
||||||
// work.
|
// work.
|
||||||
protected IHttpServer m_Server = null;
|
protected IHttpServer m_Server = null;
|
||||||
protected IConfigSource m_Config = null;
|
protected IConfigSource m_Config = null;
|
||||||
|
|
||||||
|
@ -143,130 +143,130 @@ namespace OpenSim.Framework.Console
|
||||||
|
|
||||||
public RemoteConsole(string defaultPrompt) : base(defaultPrompt)
|
public RemoteConsole(string defaultPrompt) : base(defaultPrompt)
|
||||||
{
|
{
|
||||||
// There is something wrong with this architecture.
|
// There is something wrong with this architecture.
|
||||||
// A prompt is sent on every single input, so why have this?
|
// A prompt is sent on every single input, so why have this?
|
||||||
// TODO: Investigate and fix.
|
// TODO: Investigate and fix.
|
||||||
m_lastPromptUsed = defaultPrompt;
|
m_lastPromptUsed = defaultPrompt;
|
||||||
|
|
||||||
// Start expiration of sesssions.
|
// Start expiration of sesssions.
|
||||||
m_expireTimer.Elapsed += DoExpire;
|
m_expireTimer.Elapsed += DoExpire;
|
||||||
m_expireTimer.Start();
|
m_expireTimer.Start();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ReadConfig(IConfigSource config)
|
public void ReadConfig(IConfigSource config)
|
||||||
{
|
{
|
||||||
m_Config = config;
|
m_Config = config;
|
||||||
|
|
||||||
// We're pulling this from the 'Network' section for legacy
|
// We're pulling this from the 'Network' section for legacy
|
||||||
// compatibility. However, this is so essentially insecure
|
// compatibility. However, this is so essentially insecure
|
||||||
// that TLS and client certs should be used instead of
|
// that TLS and client certs should be used instead of
|
||||||
// a username / password.
|
// a username / password.
|
||||||
IConfig netConfig = m_Config.Configs["Network"];
|
IConfig netConfig = m_Config.Configs["Network"];
|
||||||
|
|
||||||
if (netConfig == null)
|
if (netConfig == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Get the username and password.
|
// Get the username and password.
|
||||||
m_UserName = netConfig.GetString("ConsoleUser", String.Empty);
|
m_UserName = netConfig.GetString("ConsoleUser", String.Empty);
|
||||||
m_Password = netConfig.GetString("ConsolePass", String.Empty);
|
m_Password = netConfig.GetString("ConsolePass", String.Empty);
|
||||||
|
|
||||||
// Woefully underdocumented, this is what makes javascript
|
// Woefully underdocumented, this is what makes javascript
|
||||||
// console clients work. Set to "*" for anywhere or (better)
|
// console clients work. Set to "*" for anywhere or (better)
|
||||||
// to specific addresses.
|
// to specific addresses.
|
||||||
m_AllowedOrigin = netConfig.GetString("ConsoleAllowedOrigin", String.Empty);
|
m_AllowedOrigin = netConfig.GetString("ConsoleAllowedOrigin", String.Empty);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetServer(IHttpServer server)
|
public void SetServer(IHttpServer server)
|
||||||
{
|
{
|
||||||
// This is called by the framework to give us the server
|
// This is called by the framework to give us the server
|
||||||
// instance (means: port) to work with.
|
// instance (means: port) to work with.
|
||||||
m_Server = server;
|
m_Server = server;
|
||||||
|
|
||||||
// Add our handlers
|
// Add our handlers
|
||||||
m_Server.AddHTTPHandler("/StartSession/", HandleHttpStartSession);
|
m_Server.AddHTTPHandler("/StartSession/", HandleHttpStartSession);
|
||||||
m_Server.AddHTTPHandler("/CloseSession/", HandleHttpCloseSession);
|
m_Server.AddHTTPHandler("/CloseSession/", HandleHttpCloseSession);
|
||||||
m_Server.AddHTTPHandler("/SessionCommand/", HandleHttpSessionCommand);
|
m_Server.AddHTTPHandler("/SessionCommand/", HandleHttpSessionCommand);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Output(string text, string level)
|
public override void Output(string text, string level)
|
||||||
{
|
{
|
||||||
Output(text, level, false, false, false);
|
Output(text, level, false, false, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void Output(string text, string level, bool isPrompt, bool isCommand, bool isInput)
|
protected void Output(string text, string level, bool isPrompt, bool isCommand, bool isInput)
|
||||||
{
|
{
|
||||||
// Increment the line number. It was 0 and they start at 1
|
// Increment the line number. It was 0 and they start at 1
|
||||||
// so we need to pre-increment.
|
// so we need to pre-increment.
|
||||||
m_lineNumber++;
|
m_lineNumber++;
|
||||||
|
|
||||||
// Create and populate the new entry.
|
// Create and populate the new entry.
|
||||||
ScrollbackEntry newEntry = new ScrollbackEntry();
|
ScrollbackEntry newEntry = new ScrollbackEntry();
|
||||||
|
|
||||||
newEntry.lineNumber = m_lineNumber;
|
newEntry.lineNumber = m_lineNumber;
|
||||||
newEntry.text = text;
|
newEntry.text = text;
|
||||||
newEntry.level = level;
|
newEntry.level = level;
|
||||||
newEntry.isPrompt = isPrompt;
|
newEntry.isPrompt = isPrompt;
|
||||||
newEntry.isCommand = isCommand;
|
newEntry.isCommand = isCommand;
|
||||||
newEntry.isInput = isInput;
|
newEntry.isInput = isInput;
|
||||||
|
|
||||||
// Add a line to the scrollback. In some cases, that may not
|
// Add a line to the scrollback. In some cases, that may not
|
||||||
// actually be a line of text.
|
// actually be a line of text.
|
||||||
lock (m_Scrollback)
|
lock (m_Scrollback)
|
||||||
{
|
{
|
||||||
// Prune the scrollback to the length se send as connect
|
// Prune the scrollback to the length se send as connect
|
||||||
// burst to give the user some context.
|
// burst to give the user some context.
|
||||||
while (m_Scrollback.Count >= 1000)
|
while (m_Scrollback.Count >= 1000)
|
||||||
m_Scrollback.RemoveAt(0);
|
m_Scrollback.RemoveAt(0);
|
||||||
|
|
||||||
m_Scrollback.Add(newEntry);
|
m_Scrollback.Add(newEntry);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Let the rest of the system know we have output something.
|
// Let the rest of the system know we have output something.
|
||||||
FireOnOutput(text.Trim());
|
FireOnOutput(text.Trim());
|
||||||
|
|
||||||
// Also display it for debugging.
|
// Also display it for debugging.
|
||||||
System.Console.WriteLine(text.Trim());
|
System.Console.WriteLine(text.Trim());
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Output(string text)
|
public override void Output(string text)
|
||||||
{
|
{
|
||||||
// Output plain (non-logging style) text.
|
// Output plain (non-logging style) text.
|
||||||
Output(text, String.Empty, false, false, false);
|
Output(text, String.Empty, false, false, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override string ReadLine(string p, bool isCommand, bool e)
|
public override string ReadLine(string p, bool isCommand, bool e)
|
||||||
{
|
{
|
||||||
// Output the prompt an prepare to wait. This
|
// Output the prompt an prepare to wait. This
|
||||||
// is called on a dedicated console thread and
|
// is called on a dedicated console thread and
|
||||||
// needs to be synchronous. Old architecture but
|
// needs to be synchronous. Old architecture but
|
||||||
// not worth upgrading.
|
// not worth upgrading.
|
||||||
if (isCommand)
|
if (isCommand)
|
||||||
{
|
{
|
||||||
m_expectingInput = true;
|
m_expectingInput = true;
|
||||||
m_expectingCommand = true;
|
m_expectingCommand = true;
|
||||||
Output(p, String.Empty, true, true, false);
|
Output(p, String.Empty, true, true, false);
|
||||||
m_lastPromptUsed = p;
|
m_lastPromptUsed = p;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_expectingInput = true;
|
m_expectingInput = true;
|
||||||
Output(p, String.Empty, true, false, false);
|
Output(p, String.Empty, true, false, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Here is where we wait for the user to input something.
|
// Here is where we wait for the user to input something.
|
||||||
m_DataEvent.WaitOne();
|
m_DataEvent.WaitOne();
|
||||||
|
|
||||||
string cmdinput;
|
string cmdinput;
|
||||||
|
|
||||||
// Check for empty input. Read input if not empty.
|
// Check for empty input. Read input if not empty.
|
||||||
lock (m_InputData)
|
lock (m_InputData)
|
||||||
{
|
{
|
||||||
if (m_InputData.Count == 0)
|
if (m_InputData.Count == 0)
|
||||||
{
|
{
|
||||||
m_DataEvent.Reset();
|
m_DataEvent.Reset();
|
||||||
m_expectingInput = false;
|
m_expectingInput = false;
|
||||||
m_expectingCommand = false;
|
m_expectingCommand = false;
|
||||||
|
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
@ -278,19 +278,19 @@ namespace OpenSim.Framework.Console
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
m_expectingInput = false;
|
m_expectingInput = false;
|
||||||
m_expectingCommand = false;
|
m_expectingCommand = false;
|
||||||
|
|
||||||
// Echo to all the other users what we have done. This
|
// Echo to all the other users what we have done. This
|
||||||
// will also go to ourselves.
|
// will also go to ourselves.
|
||||||
Output (cmdinput, String.Empty, false, false, true);
|
Output (cmdinput, String.Empty, false, false, true);
|
||||||
|
|
||||||
// If this is a command, we need to resolve and execute it.
|
// If this is a command, we need to resolve and execute it.
|
||||||
if (isCommand)
|
if (isCommand)
|
||||||
{
|
{
|
||||||
// This call will actually execute the command and create
|
// This call will actually execute the command and create
|
||||||
// any output associated with it. The core just gets an
|
// any output associated with it. The core just gets an
|
||||||
// empty string so it will call again immediately.
|
// empty string so it will call again immediately.
|
||||||
string[] cmd = Commands.Resolve(Parser.Parse(cmdinput));
|
string[] cmd = Commands.Resolve(Parser.Parse(cmdinput));
|
||||||
|
|
||||||
if (cmd.Length != 0)
|
if (cmd.Length != 0)
|
||||||
|
@ -306,11 +306,11 @@ namespace OpenSim.Framework.Console
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Return the raw input string if not a command.
|
// Return the raw input string if not a command.
|
||||||
return cmdinput;
|
return cmdinput;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Very simplistic static access control header.
|
// Very simplistic static access control header.
|
||||||
protected Hashtable CheckOrigin(Hashtable result)
|
protected Hashtable CheckOrigin(Hashtable result)
|
||||||
{
|
{
|
||||||
if (!string.IsNullOrEmpty(m_AllowedOrigin))
|
if (!string.IsNullOrEmpty(m_AllowedOrigin))
|
||||||
|
@ -338,21 +338,21 @@ namespace OpenSim.Framework.Console
|
||||||
|
|
||||||
protected void DoExpire(Object sender, ElapsedEventArgs e)
|
protected void DoExpire(Object sender, ElapsedEventArgs e)
|
||||||
{
|
{
|
||||||
// Iterate the list of console connections and find those we
|
// Iterate the list of console connections and find those we
|
||||||
// haven't heard from for longer then the longpoll interval.
|
// haven't heard from for longer then the longpoll interval.
|
||||||
// Remove them.
|
// Remove them.
|
||||||
List<UUID> expired = new List<UUID>();
|
List<UUID> expired = new List<UUID>();
|
||||||
|
|
||||||
lock (m_Connections)
|
lock (m_Connections)
|
||||||
{
|
{
|
||||||
// Mark the expired ones
|
// Mark the expired ones
|
||||||
foreach (KeyValuePair<UUID, ConsoleConnection> kvp in m_Connections)
|
foreach (KeyValuePair<UUID, ConsoleConnection> kvp in m_Connections)
|
||||||
{
|
{
|
||||||
if (System.Environment.TickCount - kvp.Value.last > 500000)
|
if (System.Environment.TickCount - kvp.Value.last > 500000)
|
||||||
expired.Add(kvp.Key);
|
expired.Add(kvp.Key);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Delete them
|
// Delete them
|
||||||
foreach (UUID id in expired)
|
foreach (UUID id in expired)
|
||||||
{
|
{
|
||||||
m_Connections.Remove(id);
|
m_Connections.Remove(id);
|
||||||
|
@ -361,10 +361,10 @@ namespace OpenSim.Framework.Console
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Start a new session.
|
// Start a new session.
|
||||||
protected Hashtable HandleHttpStartSession(Hashtable request)
|
protected Hashtable HandleHttpStartSession(Hashtable request)
|
||||||
{
|
{
|
||||||
// The login is in the form of a http form post
|
// The login is in the form of a http form post
|
||||||
Hashtable post = DecodePostString(request["body"].ToString());
|
Hashtable post = DecodePostString(request["body"].ToString());
|
||||||
Hashtable reply = new Hashtable();
|
Hashtable reply = new Hashtable();
|
||||||
|
|
||||||
|
@ -372,7 +372,7 @@ namespace OpenSim.Framework.Console
|
||||||
reply["int_response_code"] = 401;
|
reply["int_response_code"] = 401;
|
||||||
reply["content_type"] = "text/plain";
|
reply["content_type"] = "text/plain";
|
||||||
|
|
||||||
// Check user name and password
|
// Check user name and password
|
||||||
if (m_UserName == String.Empty)
|
if (m_UserName == String.Empty)
|
||||||
return reply;
|
return reply;
|
||||||
|
|
||||||
|
@ -385,28 +385,28 @@ namespace OpenSim.Framework.Console
|
||||||
return reply;
|
return reply;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set up the new console connection record
|
// Set up the new console connection record
|
||||||
ConsoleConnection c = new ConsoleConnection();
|
ConsoleConnection c = new ConsoleConnection();
|
||||||
c.last = System.Environment.TickCount;
|
c.last = System.Environment.TickCount;
|
||||||
c.lastLineSeen = 0;
|
c.lastLineSeen = 0;
|
||||||
|
|
||||||
// Assign session ID
|
// Assign session ID
|
||||||
UUID sessionID = UUID.Random();
|
UUID sessionID = UUID.Random();
|
||||||
|
|
||||||
// Add connection to list.
|
// Add connection to list.
|
||||||
lock (m_Connections)
|
lock (m_Connections)
|
||||||
{
|
{
|
||||||
m_Connections[sessionID] = c;
|
m_Connections[sessionID] = c;
|
||||||
}
|
}
|
||||||
|
|
||||||
// This call is a CAP. The URL is the authentication.
|
// This call is a CAP. The URL is the authentication.
|
||||||
string uri = "/ReadResponses/" + sessionID.ToString() + "/";
|
string uri = "/ReadResponses/" + sessionID.ToString() + "/";
|
||||||
|
|
||||||
m_Server.AddPollServiceHTTPHandler(
|
m_Server.AddPollServiceHTTPHandler(
|
||||||
uri, new PollServiceEventArgs(null, uri, HasEvents, GetEvents, NoEvents, sessionID,25000)); // 25 secs timeout
|
uri, new PollServiceEventArgs(null, uri, HasEvents, GetEvents, NoEvents, sessionID,25000)); // 25 secs timeout
|
||||||
|
|
||||||
// Our reply is an XML document.
|
// Our reply is an XML document.
|
||||||
// TODO: Change this to Linq.Xml
|
// TODO: Change this to Linq.Xml
|
||||||
XmlDocument xmldoc = new XmlDocument();
|
XmlDocument xmldoc = new XmlDocument();
|
||||||
XmlNode xmlnode = xmldoc.CreateNode(XmlNodeType.XmlDeclaration,
|
XmlNode xmlnode = xmldoc.CreateNode(XmlNodeType.XmlDeclaration,
|
||||||
"", "");
|
"", "");
|
||||||
|
@ -429,7 +429,7 @@ namespace OpenSim.Framework.Console
|
||||||
|
|
||||||
rootElement.AppendChild(MainConsole.Instance.Commands.GetXml(xmldoc));
|
rootElement.AppendChild(MainConsole.Instance.Commands.GetXml(xmldoc));
|
||||||
|
|
||||||
// Set up the response and check origin
|
// Set up the response and check origin
|
||||||
reply["str_response_string"] = xmldoc.InnerXml;
|
reply["str_response_string"] = xmldoc.InnerXml;
|
||||||
reply["int_response_code"] = 200;
|
reply["int_response_code"] = 200;
|
||||||
reply["content_type"] = "text/xml";
|
reply["content_type"] = "text/xml";
|
||||||
|
@ -438,7 +438,7 @@ namespace OpenSim.Framework.Console
|
||||||
return reply;
|
return reply;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Client closes session. Clean up.
|
// Client closes session. Clean up.
|
||||||
protected Hashtable HandleHttpCloseSession(Hashtable request)
|
protected Hashtable HandleHttpCloseSession(Hashtable request)
|
||||||
{
|
{
|
||||||
Hashtable post = DecodePostString(request["body"].ToString());
|
Hashtable post = DecodePostString(request["body"].ToString());
|
||||||
|
@ -487,7 +487,7 @@ namespace OpenSim.Framework.Console
|
||||||
return reply;
|
return reply;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Command received from the client.
|
// Command received from the client.
|
||||||
protected Hashtable HandleHttpSessionCommand(Hashtable request)
|
protected Hashtable HandleHttpSessionCommand(Hashtable request)
|
||||||
{
|
{
|
||||||
Hashtable post = DecodePostString(request["body"].ToString());
|
Hashtable post = DecodePostString(request["body"].ToString());
|
||||||
|
@ -497,7 +497,7 @@ namespace OpenSim.Framework.Console
|
||||||
reply["int_response_code"] = 404;
|
reply["int_response_code"] = 404;
|
||||||
reply["content_type"] = "text/plain";
|
reply["content_type"] = "text/plain";
|
||||||
|
|
||||||
// Check the ID
|
// Check the ID
|
||||||
if (post["ID"] == null)
|
if (post["ID"] == null)
|
||||||
return reply;
|
return reply;
|
||||||
|
|
||||||
|
@ -505,25 +505,25 @@ namespace OpenSim.Framework.Console
|
||||||
if (!UUID.TryParse(post["ID"].ToString(), out id))
|
if (!UUID.TryParse(post["ID"].ToString(), out id))
|
||||||
return reply;
|
return reply;
|
||||||
|
|
||||||
// Find the connection for that ID.
|
// Find the connection for that ID.
|
||||||
lock (m_Connections)
|
lock (m_Connections)
|
||||||
{
|
{
|
||||||
if (!m_Connections.ContainsKey(id))
|
if (!m_Connections.ContainsKey(id))
|
||||||
return reply;
|
return reply;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Empty post. Just error out.
|
// Empty post. Just error out.
|
||||||
if (post["COMMAND"] == null)
|
if (post["COMMAND"] == null)
|
||||||
return reply;
|
return reply;
|
||||||
|
|
||||||
// Place the input data in the buffer.
|
// Place the input data in the buffer.
|
||||||
lock (m_InputData)
|
lock (m_InputData)
|
||||||
{
|
{
|
||||||
m_DataEvent.Set();
|
m_DataEvent.Set();
|
||||||
m_InputData.Add(post["COMMAND"].ToString());
|
m_InputData.Add(post["COMMAND"].ToString());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create the XML reply document.
|
// Create the XML reply document.
|
||||||
XmlDocument xmldoc = new XmlDocument();
|
XmlDocument xmldoc = new XmlDocument();
|
||||||
XmlNode xmlnode = xmldoc.CreateNode(XmlNodeType.XmlDeclaration,
|
XmlNode xmlnode = xmldoc.CreateNode(XmlNodeType.XmlDeclaration,
|
||||||
"", "");
|
"", "");
|
||||||
|
@ -547,7 +547,7 @@ namespace OpenSim.Framework.Console
|
||||||
return reply;
|
return reply;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Decode a HTTP form post to a Hashtable
|
// Decode a HTTP form post to a Hashtable
|
||||||
protected Hashtable DecodePostString(string data)
|
protected Hashtable DecodePostString(string data)
|
||||||
{
|
{
|
||||||
Hashtable result = new Hashtable();
|
Hashtable result = new Hashtable();
|
||||||
|
@ -572,7 +572,7 @@ namespace OpenSim.Framework.Console
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Close the CAP receiver for the responses for a given client.
|
// Close the CAP receiver for the responses for a given client.
|
||||||
public void CloseConnection(UUID id)
|
public void CloseConnection(UUID id)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
@ -586,8 +586,8 @@ namespace OpenSim.Framework.Console
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if there is anything to send. Return true if this client has
|
// Check if there is anything to send. Return true if this client has
|
||||||
// lines pending.
|
// lines pending.
|
||||||
protected bool HasEvents(UUID RequestID, UUID sessionID)
|
protected bool HasEvents(UUID RequestID, UUID sessionID)
|
||||||
{
|
{
|
||||||
ConsoleConnection c = null;
|
ConsoleConnection c = null;
|
||||||
|
@ -604,10 +604,10 @@ namespace OpenSim.Framework.Console
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Send all pending output to the client.
|
// Send all pending output to the client.
|
||||||
protected Hashtable GetEvents(UUID RequestID, UUID sessionID)
|
protected Hashtable GetEvents(UUID RequestID, UUID sessionID)
|
||||||
{
|
{
|
||||||
// Find the connection that goes with this client.
|
// Find the connection that goes with this client.
|
||||||
ConsoleConnection c = null;
|
ConsoleConnection c = null;
|
||||||
|
|
||||||
lock (m_Connections)
|
lock (m_Connections)
|
||||||
|
@ -617,14 +617,14 @@ namespace OpenSim.Framework.Console
|
||||||
c = m_Connections[sessionID];
|
c = m_Connections[sessionID];
|
||||||
}
|
}
|
||||||
|
|
||||||
// If we have nothing to send, send the no events response.
|
// If we have nothing to send, send the no events response.
|
||||||
c.last = System.Environment.TickCount;
|
c.last = System.Environment.TickCount;
|
||||||
if (c.lastLineSeen >= m_lineNumber)
|
if (c.lastLineSeen >= m_lineNumber)
|
||||||
return NoEvents(RequestID, UUID.Zero);
|
return NoEvents(RequestID, UUID.Zero);
|
||||||
|
|
||||||
Hashtable result = new Hashtable();
|
Hashtable result = new Hashtable();
|
||||||
|
|
||||||
// Create the response document.
|
// Create the response document.
|
||||||
XmlDocument xmldoc = new XmlDocument();
|
XmlDocument xmldoc = new XmlDocument();
|
||||||
XmlNode xmlnode = xmldoc.CreateNode(XmlNodeType.XmlDeclaration,
|
XmlNode xmlnode = xmldoc.CreateNode(XmlNodeType.XmlDeclaration,
|
||||||
"", "");
|
"", "");
|
||||||
|
@ -648,29 +648,29 @@ namespace OpenSim.Framework.Console
|
||||||
|
|
||||||
for (long i = sendStart ; i < m_lineNumber ; i++)
|
for (long i = sendStart ; i < m_lineNumber ; i++)
|
||||||
{
|
{
|
||||||
ScrollbackEntry e = m_Scrollback[(int)(i - startLine)];
|
ScrollbackEntry e = m_Scrollback[(int)(i - startLine)];
|
||||||
|
|
||||||
XmlElement res = xmldoc.CreateElement("", "Line", "");
|
XmlElement res = xmldoc.CreateElement("", "Line", "");
|
||||||
res.SetAttribute("Number", e.lineNumber.ToString());
|
res.SetAttribute("Number", e.lineNumber.ToString());
|
||||||
res.SetAttribute("Level", e.level);
|
res.SetAttribute("Level", e.level);
|
||||||
// Don't include these for the scrollback, we'll send the
|
// Don't include these for the scrollback, we'll send the
|
||||||
// real state later.
|
// real state later.
|
||||||
if (!c.newConnection)
|
if (!c.newConnection)
|
||||||
{
|
{
|
||||||
res.SetAttribute("Prompt", e.isPrompt ? "true" : "false");
|
res.SetAttribute("Prompt", e.isPrompt ? "true" : "false");
|
||||||
res.SetAttribute("Command", e.isCommand ? "true" : "false");
|
res.SetAttribute("Command", e.isCommand ? "true" : "false");
|
||||||
res.SetAttribute("Input", e.isInput ? "true" : "false");
|
res.SetAttribute("Input", e.isInput ? "true" : "false");
|
||||||
}
|
}
|
||||||
else if (i == m_lineNumber - 1) // Last line for a new connection
|
else if (i == m_lineNumber - 1) // Last line for a new connection
|
||||||
{
|
{
|
||||||
res.SetAttribute("Prompt", m_expectingInput ? "true" : "false");
|
res.SetAttribute("Prompt", m_expectingInput ? "true" : "false");
|
||||||
res.SetAttribute("Command", m_expectingCommand ? "true" : "false");
|
res.SetAttribute("Command", m_expectingCommand ? "true" : "false");
|
||||||
res.SetAttribute("Input", (!m_expectingInput) ? "true" : "false");
|
res.SetAttribute("Input", (!m_expectingInput) ? "true" : "false");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
res.SetAttribute("Input", e.isInput ? "true" : "false");
|
res.SetAttribute("Input", e.isInput ? "true" : "false");
|
||||||
}
|
}
|
||||||
|
|
||||||
res.AppendChild(xmldoc.CreateTextNode(e.text));
|
res.AppendChild(xmldoc.CreateTextNode(e.text));
|
||||||
|
|
||||||
|
@ -679,7 +679,7 @@ namespace OpenSim.Framework.Console
|
||||||
}
|
}
|
||||||
|
|
||||||
c.lastLineSeen = m_lineNumber;
|
c.lastLineSeen = m_lineNumber;
|
||||||
c.newConnection = false;
|
c.newConnection = false;
|
||||||
|
|
||||||
xmldoc.AppendChild(rootElement);
|
xmldoc.AppendChild(rootElement);
|
||||||
|
|
||||||
|
@ -693,8 +693,8 @@ namespace OpenSim.Framework.Console
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
// This is really just a no-op. It generates what is sent
|
// This is really just a no-op. It generates what is sent
|
||||||
// to the client if the poll times out without any events.
|
// to the client if the poll times out without any events.
|
||||||
protected Hashtable NoEvents(UUID RequestID, UUID id)
|
protected Hashtable NoEvents(UUID RequestID, UUID id)
|
||||||
{
|
{
|
||||||
Hashtable result = new Hashtable();
|
Hashtable result = new Hashtable();
|
||||||
|
|
|
@ -44,17 +44,17 @@ namespace OpenSim.Framework
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Manager for registries and plugins
|
/// Manager for registries and plugins
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class PluginManager : SetupService
|
public class PluginManager : SetupService
|
||||||
{
|
{
|
||||||
public AddinRegistry PluginRegistry;
|
public AddinRegistry PluginRegistry;
|
||||||
|
|
||||||
public PluginManager(AddinRegistry registry): base (registry)
|
public PluginManager(AddinRegistry registry): base (registry)
|
||||||
{
|
{
|
||||||
PluginRegistry = registry;
|
PluginRegistry = registry;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Installs the plugin.
|
/// Installs the plugin.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns>
|
/// <returns>
|
||||||
|
@ -159,11 +159,11 @@ namespace OpenSim.Framework
|
||||||
{
|
{
|
||||||
Dictionary<string, object> res = new Dictionary<string, object>();
|
Dictionary<string, object> res = new Dictionary<string, object>();
|
||||||
|
|
||||||
Addin[] addins = GetSortedAddinList("RobustPlugin");
|
Addin[] addins = GetSortedAddinList("RobustPlugin");
|
||||||
if(addins.Count() < 1)
|
if(addins.Count() < 1)
|
||||||
{
|
{
|
||||||
MainConsole.Instance.Output("Error!");
|
MainConsole.Instance.Output("Error!");
|
||||||
}
|
}
|
||||||
int count = 0;
|
int count = 0;
|
||||||
foreach (Addin addin in addins)
|
foreach (Addin addin in addins)
|
||||||
{
|
{
|
||||||
|
@ -537,15 +537,15 @@ namespace OpenSim.Framework
|
||||||
|
|
||||||
ArrayList xlist = new ArrayList();
|
ArrayList xlist = new ArrayList();
|
||||||
ArrayList list = new ArrayList();
|
ArrayList list = new ArrayList();
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
list.AddRange(PluginRegistry.GetAddins());
|
list.AddRange(PluginRegistry.GetAddins());
|
||||||
}
|
}
|
||||||
catch (Exception)
|
catch (Exception)
|
||||||
{
|
{
|
||||||
Addin[] x = xlist.ToArray(typeof(Addin)) as Addin[];
|
Addin[] x = xlist.ToArray(typeof(Addin)) as Addin[];
|
||||||
return x;
|
return x;
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (Addin addin in list)
|
foreach (Addin addin in list)
|
||||||
{
|
{
|
||||||
|
@ -559,5 +559,5 @@ namespace OpenSim.Framework
|
||||||
return addins;
|
return addins;
|
||||||
}
|
}
|
||||||
#endregion Util
|
#endregion Util
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1307,8 +1307,8 @@ namespace OpenSim.Framework
|
||||||
kvp["http_port"] = HttpPort.ToString();
|
kvp["http_port"] = HttpPort.ToString();
|
||||||
kvp["internal_ip_address"] = InternalEndPoint.Address.ToString();
|
kvp["internal_ip_address"] = InternalEndPoint.Address.ToString();
|
||||||
kvp["internal_port"] = InternalEndPoint.Port.ToString();
|
kvp["internal_port"] = InternalEndPoint.Port.ToString();
|
||||||
// TODO: Remove in next major version
|
// TODO: Remove in next major version
|
||||||
kvp["alternate_ports"] = "False";
|
kvp["alternate_ports"] = "False";
|
||||||
kvp["server_uri"] = ServerURI;
|
kvp["server_uri"] = ServerURI;
|
||||||
|
|
||||||
return kvp;
|
return kvp;
|
||||||
|
|
|
@ -104,16 +104,16 @@ namespace OpenSim
|
||||||
"[OPENSIM MAIN]: Environment variable MONO_THREADS_PER_CPU is {0}", monoThreadsPerCpu ?? "unset");
|
"[OPENSIM MAIN]: Environment variable MONO_THREADS_PER_CPU is {0}", monoThreadsPerCpu ?? "unset");
|
||||||
|
|
||||||
// Verify the Threadpool allocates or uses enough worker and IO completion threads
|
// Verify the Threadpool allocates or uses enough worker and IO completion threads
|
||||||
// .NET 2.0, workerthreads default to 50 * numcores
|
// .NET 2.0, workerthreads default to 50 * numcores
|
||||||
// .NET 3.0, workerthreads defaults to 250 * numcores
|
// .NET 3.0, workerthreads defaults to 250 * numcores
|
||||||
// .NET 4.0, workerthreads are dynamic based on bitness and OS resources
|
// .NET 4.0, workerthreads are dynamic based on bitness and OS resources
|
||||||
// Max IO Completion threads are 1000 on all 3 CLRs
|
// Max IO Completion threads are 1000 on all 3 CLRs
|
||||||
//
|
//
|
||||||
// Mono 2.10.9 to at least Mono 3.1, workerthreads default to 100 * numcores, iocp threads to 4 * numcores
|
// Mono 2.10.9 to at least Mono 3.1, workerthreads default to 100 * numcores, iocp threads to 4 * numcores
|
||||||
int workerThreadsMin = 500;
|
int workerThreadsMin = 500;
|
||||||
int workerThreadsMax = 1000; // may need further adjustment to match other CLR
|
int workerThreadsMax = 1000; // may need further adjustment to match other CLR
|
||||||
int iocpThreadsMin = 1000;
|
int iocpThreadsMin = 1000;
|
||||||
int iocpThreadsMax = 2000; // may need further adjustment to match other CLR
|
int iocpThreadsMax = 2000; // may need further adjustment to match other CLR
|
||||||
|
|
||||||
{
|
{
|
||||||
int currentMinWorkerThreads, currentMinIocpThreads;
|
int currentMinWorkerThreads, currentMinIocpThreads;
|
||||||
|
@ -138,30 +138,30 @@ namespace OpenSim
|
||||||
m_log.InfoFormat("[OPENSIM MAIN]: Limiting max worker threads to {0}",workerThreads);
|
m_log.InfoFormat("[OPENSIM MAIN]: Limiting max worker threads to {0}",workerThreads);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Increase the number of IOCP threads available.
|
// Increase the number of IOCP threads available.
|
||||||
// Mono defaults to a tragically low number (24 on 6-core / 8GB Fedora 17)
|
// Mono defaults to a tragically low number (24 on 6-core / 8GB Fedora 17)
|
||||||
if (iocpThreads < iocpThreadsMin)
|
if (iocpThreads < iocpThreadsMin)
|
||||||
{
|
{
|
||||||
iocpThreads = iocpThreadsMin;
|
iocpThreads = iocpThreadsMin;
|
||||||
m_log.InfoFormat("[OPENSIM MAIN]: Bumping up max IOCP threads to {0}",iocpThreads);
|
m_log.InfoFormat("[OPENSIM MAIN]: Bumping up max IOCP threads to {0}",iocpThreads);
|
||||||
}
|
}
|
||||||
// Make sure we don't overallocate IOCP threads and thrash system resources
|
// Make sure we don't overallocate IOCP threads and thrash system resources
|
||||||
if ( iocpThreads > iocpThreadsMax )
|
if ( iocpThreads > iocpThreadsMax )
|
||||||
{
|
{
|
||||||
iocpThreads = iocpThreadsMax;
|
iocpThreads = iocpThreadsMax;
|
||||||
m_log.InfoFormat("[OPENSIM MAIN]: Limiting max IOCP completion threads to {0}",iocpThreads);
|
m_log.InfoFormat("[OPENSIM MAIN]: Limiting max IOCP completion threads to {0}",iocpThreads);
|
||||||
}
|
}
|
||||||
// set the resulting worker and IO completion thread counts back to ThreadPool
|
// set the resulting worker and IO completion thread counts back to ThreadPool
|
||||||
if ( System.Threading.ThreadPool.SetMaxThreads(workerThreads, iocpThreads) )
|
if ( System.Threading.ThreadPool.SetMaxThreads(workerThreads, iocpThreads) )
|
||||||
{
|
{
|
||||||
m_log.InfoFormat(
|
m_log.InfoFormat(
|
||||||
"[OPENSIM MAIN]: Threadpool set to {0} max worker threads and {1} max IOCP threads",
|
"[OPENSIM MAIN]: Threadpool set to {0} max worker threads and {1} max IOCP threads",
|
||||||
workerThreads, iocpThreads);
|
workerThreads, iocpThreads);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_log.Warn("[OPENSIM MAIN]: Threadpool reconfiguration failed, runtime defaults still in effect.");
|
m_log.Warn("[OPENSIM MAIN]: Threadpool reconfiguration failed, runtime defaults still in effect.");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if the system is compatible with OpenSimulator.
|
// Check if the system is compatible with OpenSimulator.
|
||||||
// Ensures that the minimum system requirements are met
|
// Ensures that the minimum system requirements are met
|
||||||
|
|
|
@ -776,7 +776,7 @@ namespace OpenSim
|
||||||
CreateRegion(regInfo, true, out scene);
|
CreateRegion(regInfo, true, out scene);
|
||||||
|
|
||||||
if (changed)
|
if (changed)
|
||||||
m_estateDataService.StoreEstateSettings(regInfo.EstateSettings);
|
m_estateDataService.StoreEstateSettings(regInfo.EstateSettings);
|
||||||
|
|
||||||
scene.Start();
|
scene.Start();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1103,10 +1103,10 @@ namespace OpenSim
|
||||||
MainConsole.Instance.Output("Joining the estate failed. Please try again.");
|
MainConsole.Instance.Output("Joining the estate failed. Please try again.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true; // need to update the database
|
return true; // need to update the database
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class OpenSimConfigSource
|
public class OpenSimConfigSource
|
||||||
|
|
|
@ -133,7 +133,7 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||||
// data["username"] = sp.Firstname + "." + sp.Lastname;
|
// data["username"] = sp.Firstname + "." + sp.Lastname;
|
||||||
// data["display_name_next_update"] = new OSDDate(DateTime.Now);
|
// data["display_name_next_update"] = new OSDDate(DateTime.Now);
|
||||||
// data["legacy_first_name"] = sp.Firstname;
|
// data["legacy_first_name"] = sp.Firstname;
|
||||||
data["mesh_upload_status"] = "valid";
|
data["mesh_upload_status"] = "valid";
|
||||||
// data["display_name"] = sp.Firstname + " " + sp.Lastname;
|
// data["display_name"] = sp.Firstname + " " + sp.Lastname;
|
||||||
// data["legacy_last_name"] = sp.Lastname;
|
// data["legacy_last_name"] = sp.Lastname;
|
||||||
// data["id"] = m_agentID;
|
// data["id"] = m_agentID;
|
||||||
|
|
|
@ -436,8 +436,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
{
|
{
|
||||||
#region Environment.TickCount Measurement
|
#region Environment.TickCount Measurement
|
||||||
|
|
||||||
// Update the port with the one we actually got
|
// Update the port with the one we actually got
|
||||||
port = (uint)Port;
|
port = (uint)Port;
|
||||||
|
|
||||||
// Measure the resolution of Environment.TickCount
|
// Measure the resolution of Environment.TickCount
|
||||||
TickCountResolution = 0f;
|
TickCountResolution = 0f;
|
||||||
|
|
|
@ -107,10 +107,10 @@ namespace OpenMetaverse
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public float AverageReceiveTicksForLastSamplePeriod { get; private set; }
|
public float AverageReceiveTicksForLastSamplePeriod { get; private set; }
|
||||||
|
|
||||||
public int Port
|
public int Port
|
||||||
{
|
{
|
||||||
get { return m_udpPort; }
|
get { return m_udpPort; }
|
||||||
}
|
}
|
||||||
|
|
||||||
#region PacketDropDebugging
|
#region PacketDropDebugging
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -249,12 +249,12 @@ namespace OpenMetaverse
|
||||||
// we never want two regions to listen on the same port as they cannot demultiplex each other's messages,
|
// we never want two regions to listen on the same port as they cannot demultiplex each other's messages,
|
||||||
// leading to a confusing bug.
|
// leading to a confusing bug.
|
||||||
// By default, Windows does not allow two sockets to bind to the same port.
|
// By default, Windows does not allow two sockets to bind to the same port.
|
||||||
//
|
//
|
||||||
// Unfortunately, this also causes a crashed sim to leave the socket in a state
|
// Unfortunately, this also causes a crashed sim to leave the socket in a state
|
||||||
// where it appears to be in use but is really just hung from the old process
|
// where it appears to be in use but is really just hung from the old process
|
||||||
// crashing rather than closing it. While this protects agains misconfiguration,
|
// crashing rather than closing it. While this protects agains misconfiguration,
|
||||||
// allowing crashed sims to be started up again right away, rather than having to
|
// allowing crashed sims to be started up again right away, rather than having to
|
||||||
// wait 2 minutes for the socket to clear is more valuable. Commented 12/13/2016
|
// wait 2 minutes for the socket to clear is more valuable. Commented 12/13/2016
|
||||||
// m_udpSocket.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReuseAddress, false);
|
// m_udpSocket.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReuseAddress, false);
|
||||||
|
|
||||||
if (recvBufferSize != 0)
|
if (recvBufferSize != 0)
|
||||||
|
@ -262,8 +262,8 @@ namespace OpenMetaverse
|
||||||
|
|
||||||
m_udpSocket.Bind(ipep);
|
m_udpSocket.Bind(ipep);
|
||||||
|
|
||||||
if (m_udpPort == 0)
|
if (m_udpPort == 0)
|
||||||
m_udpPort = ((IPEndPoint)m_udpSocket.LocalEndPoint).Port;
|
m_udpPort = ((IPEndPoint)m_udpSocket.LocalEndPoint).Port;
|
||||||
|
|
||||||
IsRunningInbound = true;
|
IsRunningInbound = true;
|
||||||
|
|
||||||
|
|
|
@ -616,11 +616,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
|
||||||
}
|
}
|
||||||
|
|
||||||
public ISceneEntity RezSingleAttachmentFromInventory(IScenePresence sp, UUID itemID, uint AttachmentPt)
|
public ISceneEntity RezSingleAttachmentFromInventory(IScenePresence sp, UUID itemID, uint AttachmentPt)
|
||||||
{
|
{
|
||||||
return RezSingleAttachmentFromInventory(sp, itemID, AttachmentPt, null);
|
return RezSingleAttachmentFromInventory(sp, itemID, AttachmentPt, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ISceneEntity RezSingleAttachmentFromInventory(IScenePresence sp, UUID itemID, uint AttachmentPt, XmlDocument doc)
|
public ISceneEntity RezSingleAttachmentFromInventory(IScenePresence sp, UUID itemID, uint AttachmentPt, XmlDocument doc)
|
||||||
{
|
{
|
||||||
if (!Enabled)
|
if (!Enabled)
|
||||||
return null;
|
return null;
|
||||||
|
|
|
@ -53,7 +53,7 @@ namespace OpenSim.Region.CoreModules.Avatar.BakedTextures
|
||||||
private UTF8Encoding enc = new UTF8Encoding();
|
private UTF8Encoding enc = new UTF8Encoding();
|
||||||
private string m_URL = String.Empty;
|
private string m_URL = String.Empty;
|
||||||
private static XmlSerializer m_serializer = new XmlSerializer(typeof(AssetBase));
|
private static XmlSerializer m_serializer = new XmlSerializer(typeof(AssetBase));
|
||||||
private static bool m_enabled = false;
|
private static bool m_enabled = false;
|
||||||
|
|
||||||
private static IServiceAuth m_Auth;
|
private static IServiceAuth m_Auth;
|
||||||
|
|
||||||
|
@ -64,18 +64,18 @@ namespace OpenSim.Region.CoreModules.Avatar.BakedTextures
|
||||||
return;
|
return;
|
||||||
|
|
||||||
m_URL = config.GetString("URL", String.Empty);
|
m_URL = config.GetString("URL", String.Empty);
|
||||||
if (m_URL == String.Empty)
|
if (m_URL == String.Empty)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
m_enabled = true;
|
m_enabled = true;
|
||||||
|
|
||||||
m_Auth = ServiceAuth.Create(configSource, "XBakes");
|
m_Auth = ServiceAuth.Create(configSource, "XBakes");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AddRegion(Scene scene)
|
public void AddRegion(Scene scene)
|
||||||
{
|
{
|
||||||
if (!m_enabled)
|
if (!m_enabled)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// m_log.InfoFormat("[XBakes]: Enabled for region {0}", scene.RegionInfo.RegionName);
|
// m_log.InfoFormat("[XBakes]: Enabled for region {0}", scene.RegionInfo.RegionName);
|
||||||
m_Scene = scene;
|
m_Scene = scene;
|
||||||
|
|
|
@ -486,7 +486,7 @@ namespace OpenSim.Region.CoreModules.World.Estate
|
||||||
|
|
||||||
if((byte)maxAgents <= Scene.RegionInfo.AgentCapacity)
|
if((byte)maxAgents <= Scene.RegionInfo.AgentCapacity)
|
||||||
Scene.RegionInfo.RegionSettings.AgentLimit = (byte) maxAgents;
|
Scene.RegionInfo.RegionSettings.AgentLimit = (byte) maxAgents;
|
||||||
else
|
else
|
||||||
Scene.RegionInfo.RegionSettings.AgentLimit = Scene.RegionInfo.AgentCapacity;
|
Scene.RegionInfo.RegionSettings.AgentLimit = Scene.RegionInfo.AgentCapacity;
|
||||||
|
|
||||||
Scene.RegionInfo.RegionSettings.ObjectBonus = objectBonusFactor;
|
Scene.RegionInfo.RegionSettings.ObjectBonus = objectBonusFactor;
|
||||||
|
|
|
@ -52,7 +52,7 @@ namespace OpenSim.Region.CoreModules.World.Estate
|
||||||
protected List<Scene> m_Scenes = new List<Scene>();
|
protected List<Scene> m_Scenes = new List<Scene>();
|
||||||
protected bool m_InInfoUpdate = false;
|
protected bool m_InInfoUpdate = false;
|
||||||
private string token = "7db8eh2gvgg45jj";
|
private string token = "7db8eh2gvgg45jj";
|
||||||
protected bool m_enabled = false;
|
protected bool m_enabled = false;
|
||||||
|
|
||||||
public bool InInfoUpdate
|
public bool InInfoUpdate
|
||||||
{
|
{
|
||||||
|
@ -74,19 +74,19 @@ namespace OpenSim.Region.CoreModules.World.Estate
|
||||||
IConfig estateConfig = config.Configs["Estates"];
|
IConfig estateConfig = config.Configs["Estates"];
|
||||||
if (estateConfig != null)
|
if (estateConfig != null)
|
||||||
{
|
{
|
||||||
if (estateConfig.GetString("EstateCommunicationsHandler", Name) == Name)
|
if (estateConfig.GetString("EstateCommunicationsHandler", Name) == Name)
|
||||||
m_enabled = true;
|
m_enabled = true;
|
||||||
else
|
else
|
||||||
return;
|
return;
|
||||||
|
|
||||||
port = (uint)estateConfig.GetInt("Port", 0);
|
port = (uint)estateConfig.GetInt("Port", 0);
|
||||||
// this will need to came from somewhere else
|
// this will need to came from somewhere else
|
||||||
token = estateConfig.GetString("Token", token);
|
token = estateConfig.GetString("Token", token);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_enabled = true;
|
m_enabled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_EstateConnector = new EstateConnector(this, token, port);
|
m_EstateConnector = new EstateConnector(this, token, port);
|
||||||
|
|
||||||
|
@ -108,8 +108,8 @@ namespace OpenSim.Region.CoreModules.World.Estate
|
||||||
|
|
||||||
public void AddRegion(Scene scene)
|
public void AddRegion(Scene scene)
|
||||||
{
|
{
|
||||||
if (!m_enabled)
|
if (!m_enabled)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
lock (m_Scenes)
|
lock (m_Scenes)
|
||||||
m_Scenes.Add(scene);
|
m_Scenes.Add(scene);
|
||||||
|
@ -117,8 +117,8 @@ namespace OpenSim.Region.CoreModules.World.Estate
|
||||||
|
|
||||||
public void RegionLoaded(Scene scene)
|
public void RegionLoaded(Scene scene)
|
||||||
{
|
{
|
||||||
if (!m_enabled)
|
if (!m_enabled)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
IEstateModule em = scene.RequestModuleInterface<IEstateModule>();
|
IEstateModule em = scene.RequestModuleInterface<IEstateModule>();
|
||||||
|
|
||||||
|
@ -131,8 +131,8 @@ namespace OpenSim.Region.CoreModules.World.Estate
|
||||||
|
|
||||||
public void RemoveRegion(Scene scene)
|
public void RemoveRegion(Scene scene)
|
||||||
{
|
{
|
||||||
if (!m_enabled)
|
if (!m_enabled)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
lock (m_Scenes)
|
lock (m_Scenes)
|
||||||
m_Scenes.Remove(scene);
|
m_Scenes.Remove(scene);
|
||||||
|
|
|
@ -277,7 +277,7 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap
|
||||||
m_scene.RegionInfo.RegionSizeY * 0.5f - 0.5f);
|
m_scene.RegionInfo.RegionSizeY * 0.5f - 0.5f);
|
||||||
|
|
||||||
warp_Material waterColorMaterial = new warp_Material(ConvertColor(WATER_COLOR));
|
warp_Material waterColorMaterial = new warp_Material(ConvertColor(WATER_COLOR));
|
||||||
waterColorMaterial.setReflectivity(0); // match water color with standard map module thanks lkalif
|
waterColorMaterial.setReflectivity(0); // match water color with standard map module thanks lkalif
|
||||||
waterColorMaterial.setTransparency((byte)((1f - WATER_COLOR.A) * 255f));
|
waterColorMaterial.setTransparency((byte)((1f - WATER_COLOR.A) * 255f));
|
||||||
renderer.Scene.addMaterial("WaterColor", waterColorMaterial);
|
renderer.Scene.addMaterial("WaterColor", waterColorMaterial);
|
||||||
renderer.SetObjectMaterial("Water", "WaterColor");
|
renderer.SetObjectMaterial("Water", "WaterColor");
|
||||||
|
@ -377,7 +377,7 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap
|
||||||
warp_Material material = new warp_Material(texture);
|
warp_Material material = new warp_Material(texture);
|
||||||
material.setReflectivity(50);
|
material.setReflectivity(50);
|
||||||
renderer.Scene.addMaterial("TerrainColor", material);
|
renderer.Scene.addMaterial("TerrainColor", material);
|
||||||
renderer.Scene.material("TerrainColor").setReflectivity(0); // reduces tile seams a bit thanks lkalif
|
renderer.Scene.material("TerrainColor").setReflectivity(0); // reduces tile seams a bit thanks lkalif
|
||||||
renderer.SetObjectMaterial("Terrain", "TerrainColor");
|
renderer.SetObjectMaterial("Terrain", "TerrainColor");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -95,7 +95,7 @@ namespace OpenSim.Region.Framework.Interfaces
|
||||||
|
|
||||||
GridRegion GetDestination(Scene scene, UUID agentID, Vector3 pos, EntityTransferContext ctx,
|
GridRegion GetDestination(Scene scene, UUID agentID, Vector3 pos, EntityTransferContext ctx,
|
||||||
out Vector3 newpos, out string reason);
|
out Vector3 newpos, out string reason);
|
||||||
GridRegion GetObjectDestination(SceneObjectGroup grp, Vector3 targetPosition, out Vector3 newpos);
|
GridRegion GetObjectDestination(SceneObjectGroup grp, Vector3 targetPosition, out Vector3 newpos);
|
||||||
bool checkAgentAccessToRegion(ScenePresence agent, GridRegion destiny, Vector3 position, EntityTransferContext ctx, out string reason);
|
bool checkAgentAccessToRegion(ScenePresence agent, GridRegion destiny, Vector3 position, EntityTransferContext ctx, out string reason);
|
||||||
|
|
||||||
bool CrossPrimGroupIntoNewRegion(GridRegion destination, Vector3 newPosition, SceneObjectGroup grp, bool silent, bool removeScripts);
|
bool CrossPrimGroupIntoNewRegion(GridRegion destination, Vector3 newPosition, SceneObjectGroup grp, bool silent, bool removeScripts);
|
||||||
|
|
|
@ -35,9 +35,9 @@ public interface ISnmpModule
|
||||||
void Major(string Message, Scene scene);
|
void Major(string Message, Scene scene);
|
||||||
void ColdStart(int step , Scene scene);
|
void ColdStart(int step , Scene scene);
|
||||||
void Shutdown(int step , Scene scene);
|
void Shutdown(int step , Scene scene);
|
||||||
//
|
//
|
||||||
// Node Start/stop events
|
// Node Start/stop events
|
||||||
//
|
//
|
||||||
void LinkUp(Scene scene);
|
void LinkUp(Scene scene);
|
||||||
void LinkDown(Scene scene);
|
void LinkDown(Scene scene);
|
||||||
void BootInfo(string data, Scene scene);
|
void BootInfo(string data, Scene scene);
|
||||||
|
|
|
@ -2701,8 +2701,8 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
foreach (uint localID in localIDs)
|
foreach (uint localID in localIDs)
|
||||||
{
|
{
|
||||||
SceneObjectPart part = GetSceneObjectPart(localID);
|
SceneObjectPart part = GetSceneObjectPart(localID);
|
||||||
if (part == null)
|
if (part == null)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (!groups.Contains(part.ParentGroup))
|
if (!groups.Contains(part.ParentGroup))
|
||||||
groups.Add(part.ParentGroup);
|
groups.Add(part.ParentGroup);
|
||||||
|
@ -2756,8 +2756,8 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
foreach (uint localID in localIDs)
|
foreach (uint localID in localIDs)
|
||||||
{
|
{
|
||||||
SceneObjectPart part = GetSceneObjectPart(localID);
|
SceneObjectPart part = GetSceneObjectPart(localID);
|
||||||
if (part == null)
|
if (part == null)
|
||||||
continue;
|
continue;
|
||||||
part.SendPropertiesToClient(remoteClient);
|
part.SendPropertiesToClient(remoteClient);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -383,9 +383,9 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Frame time
|
/// Frame time
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
public float FrameTime { get; private set; }
|
public float FrameTime { get; private set; }
|
||||||
public int FrameTimeWarnPercent { get; private set; }
|
public int FrameTimeWarnPercent { get; private set; }
|
||||||
public int FrameTimeCritPercent { get; private set; }
|
public int FrameTimeCritPercent { get; private set; }
|
||||||
|
|
||||||
// Normalize the frame related stats to nominal 55fps for viewer and scripts option
|
// Normalize the frame related stats to nominal 55fps for viewer and scripts option
|
||||||
// see SimStatsReporter.cs
|
// see SimStatsReporter.cs
|
||||||
|
@ -397,7 +397,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
/// <remarks>
|
/// <remarks>
|
||||||
/// Always derived from MinFrameTicks.
|
/// Always derived from MinFrameTicks.
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
public float MinMaintenanceTime { get; private set; }
|
public float MinMaintenanceTime { get; private set; }
|
||||||
|
|
||||||
private int m_update_physics = 1;
|
private int m_update_physics = 1;
|
||||||
private int m_update_entitymovement = 1;
|
private int m_update_entitymovement = 1;
|
||||||
|
@ -1637,7 +1637,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
Update(-1);
|
Update(-1);
|
||||||
|
|
||||||
Watchdog.RemoveThread();
|
Watchdog.RemoveThread();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Maintenance()
|
private void Maintenance()
|
||||||
{
|
{
|
||||||
|
@ -1706,7 +1706,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
previousMaintenanceTick = m_lastMaintenanceTick;
|
previousMaintenanceTick = m_lastMaintenanceTick;
|
||||||
m_lastMaintenanceTick = Util.EnvironmentTickCount();
|
m_lastMaintenanceTick = Util.EnvironmentTickCount();
|
||||||
runtc = Util.EnvironmentTickCountSubtract(m_lastMaintenanceTick, runtc);
|
runtc = Util.EnvironmentTickCountSubtract(m_lastMaintenanceTick, runtc);
|
||||||
runtc = (int)(MinMaintenanceTime * 1000) - runtc;
|
runtc = (int)(MinMaintenanceTime * 1000) - runtc;
|
||||||
|
|
||||||
if (runtc > 0)
|
if (runtc > 0)
|
||||||
m_maintenanceWaitEvent.WaitOne(runtc);
|
m_maintenanceWaitEvent.WaitOne(runtc);
|
||||||
|
@ -3177,7 +3177,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
reallyNew = false;
|
reallyNew = false;
|
||||||
}
|
}
|
||||||
client.SceneAgent = sp;
|
client.SceneAgent = sp;
|
||||||
|
|
||||||
// This is currently also being done earlier in NewUserConnection for real users to see if this
|
// This is currently also being done earlier in NewUserConnection for real users to see if this
|
||||||
// resolves problems where HG agents are occasionally seen by others as "Unknown user" in chat and other
|
// resolves problems where HG agents are occasionally seen by others as "Unknown user" in chat and other
|
||||||
|
@ -6293,7 +6293,7 @@ Environment.Exit(1);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void StartTimerWatchdog()
|
public void StartTimerWatchdog()
|
||||||
{
|
{
|
||||||
m_timerWatchdog.Interval = 1000;
|
m_timerWatchdog.Interval = 1000;
|
||||||
m_timerWatchdog.Elapsed += TimerWatchdog;
|
m_timerWatchdog.Elapsed += TimerWatchdog;
|
||||||
|
@ -6304,7 +6304,7 @@ Environment.Exit(1);
|
||||||
public void TimerWatchdog(object sender, ElapsedEventArgs e)
|
public void TimerWatchdog(object sender, ElapsedEventArgs e)
|
||||||
{
|
{
|
||||||
CheckHeartbeat();
|
CheckHeartbeat();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// This method deals with movement when an avatar is automatically moving (but this is distinct from the
|
/// This method deals with movement when an avatar is automatically moving (but this is distinct from the
|
||||||
/// autopilot that moves an avatar to a sit target!.
|
/// autopilot that moves an avatar to a sit target!.
|
||||||
|
|
|
@ -1730,8 +1730,8 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
SceneObjectPart part = m_parentScene.GetSceneObjectPart(primLocalID);
|
SceneObjectPart part = m_parentScene.GetSceneObjectPart(primLocalID);
|
||||||
if (part != null)
|
if (part != null)
|
||||||
{
|
{
|
||||||
part.ClickAction = Convert.ToByte(clickAction);
|
part.ClickAction = Convert.ToByte(clickAction);
|
||||||
group.HasGroupChanged = true;
|
group.HasGroupChanged = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2219,9 +2219,9 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
if (m_rootPart.PhysActor != null)
|
if (m_rootPart.PhysActor != null)
|
||||||
m_rootPart.PhysActor.Building = false;
|
m_rootPart.PhysActor.Building = false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Apply physics to the root prim
|
// Apply physics to the root prim
|
||||||
m_rootPart.ApplyPhysics(m_rootPart.GetEffectiveObjectFlags(), m_rootPart.VolumeDetectActive, false);
|
m_rootPart.ApplyPhysics(m_rootPart.GetEffectiveObjectFlags(), m_rootPart.VolumeDetectActive, false);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1073,15 +1073,15 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
/// <summary></summary>
|
/// <summary></summary>
|
||||||
public Vector3 Acceleration
|
public Vector3 Acceleration
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
PhysicsActor actor = PhysActor;
|
PhysicsActor actor = PhysActor;
|
||||||
if (actor != null)
|
if (actor != null)
|
||||||
{
|
{
|
||||||
m_acceleration = actor.Acceleration;
|
m_acceleration = actor.Acceleration;
|
||||||
}
|
}
|
||||||
return m_acceleration;
|
return m_acceleration;
|
||||||
}
|
}
|
||||||
|
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
|
@ -1441,8 +1441,8 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
[XmlIgnore]
|
[XmlIgnore]
|
||||||
public bool IsOccupied // KF If an av is sittingon this prim
|
public bool IsOccupied // KF If an av is sittingon this prim
|
||||||
{
|
{
|
||||||
get { return m_occupied; }
|
get { return m_occupied; }
|
||||||
set { m_occupied = value; }
|
set { m_occupied = value; }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -2116,7 +2116,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
/// <param name="VolumeDetectActive"></param>
|
/// <param name="VolumeDetectActive"></param>
|
||||||
/// <param name="building"></param>
|
/// <param name="building"></param>
|
||||||
|
|
||||||
public void ApplyPhysics(uint _ObjectFlags, bool _VolumeDetectActive, bool building)
|
public void ApplyPhysics(uint _ObjectFlags, bool _VolumeDetectActive, bool building)
|
||||||
{
|
{
|
||||||
VolumeDetectActive = _VolumeDetectActive;
|
VolumeDetectActive = _VolumeDetectActive;
|
||||||
|
|
||||||
|
|
|
@ -1947,7 +1947,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
// m_originRegionID is UUID.Zero; after, it's non-Zero. The CompleteMovement sequence initiated from the
|
// m_originRegionID is UUID.Zero; after, it's non-Zero. The CompleteMovement sequence initiated from the
|
||||||
// viewer (in turn triggered by the source region sending it a TeleportFinish event) waits until it's non-zero
|
// viewer (in turn triggered by the source region sending it a TeleportFinish event) waits until it's non-zero
|
||||||
// m_updateAgentReceivedAfterTransferEvent.WaitOne(10000);
|
// m_updateAgentReceivedAfterTransferEvent.WaitOne(10000);
|
||||||
int count = 50;
|
int count = 50;
|
||||||
UUID originID = UUID.Zero;
|
UUID originID = UUID.Zero;
|
||||||
|
|
||||||
lock (m_originRegionIDAccessLock)
|
lock (m_originRegionIDAccessLock)
|
||||||
|
|
|
@ -113,12 +113,12 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
SimSpareMs = 32,
|
SimSpareMs = 32,
|
||||||
SimSleepMs = 33,
|
SimSleepMs = 33,
|
||||||
SimIoPumpTime = 34,
|
SimIoPumpTime = 34,
|
||||||
SimPCTSscriptsRun = 35,
|
SimPCTSscriptsRun = 35,
|
||||||
SimRegionIdle = 36, // dataserver only
|
SimRegionIdle = 36, // dataserver only
|
||||||
SimRegionIdlePossible = 37, // dataserver only
|
SimRegionIdlePossible = 37, // dataserver only
|
||||||
SimAIStepTimeMS = 38,
|
SimAIStepTimeMS = 38,
|
||||||
SimSkippedSillouet_PS = 39,
|
SimSkippedSillouet_PS = 39,
|
||||||
SimSkippedCharsPerC = 40,
|
SimSkippedCharsPerC = 40,
|
||||||
|
|
||||||
// extra stats IDs irrelevant, just far from viewer defined ones
|
// extra stats IDs irrelevant, just far from viewer defined ones
|
||||||
SimExtraCountStart = 1000,
|
SimExtraCountStart = 1000,
|
||||||
|
|
|
@ -155,8 +155,8 @@ public BSAPIUnman(string paramName, BSScene physScene)
|
||||||
|
|
||||||
// Initialization and simulation
|
// Initialization and simulation
|
||||||
public override BulletWorld Initialize(Vector3 maxPosition, ConfigurationParameters parms,
|
public override BulletWorld Initialize(Vector3 maxPosition, ConfigurationParameters parms,
|
||||||
int maxCollisions, ref CollisionDesc[] collisionArray,
|
int maxCollisions, ref CollisionDesc[] collisionArray,
|
||||||
int maxUpdates, ref EntityProperties[] updateArray
|
int maxUpdates, ref EntityProperties[] updateArray
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
// Pin down the memory that will be used to pass object collisions and updates back from unmanaged code
|
// Pin down the memory that will be used to pass object collisions and updates back from unmanaged code
|
||||||
|
@ -1472,8 +1472,8 @@ public delegate void DebugLogCallback([MarshalAs(UnmanagedType.LPStr)]string msg
|
||||||
// Initialization and simulation
|
// Initialization and simulation
|
||||||
[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
|
[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
|
||||||
public static extern IntPtr Initialize2(Vector3 maxPosition, IntPtr parms,
|
public static extern IntPtr Initialize2(Vector3 maxPosition, IntPtr parms,
|
||||||
int maxCollisions, IntPtr collisionArray,
|
int maxCollisions, IntPtr collisionArray,
|
||||||
int maxUpdates, IntPtr updateArray,
|
int maxUpdates, IntPtr updateArray,
|
||||||
DebugLogCallback logRoutine);
|
DebugLogCallback logRoutine);
|
||||||
|
|
||||||
[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
|
[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
|
||||||
|
|
|
@ -815,161 +815,161 @@ private sealed class BulletConstraintXNA : BulletConstraint
|
||||||
public override bool SliderSetLimits(BulletConstraint pConstraint, int lowerUpper, int linAng, float val)
|
public override bool SliderSetLimits(BulletConstraint pConstraint, int lowerUpper, int linAng, float val)
|
||||||
{
|
{
|
||||||
SliderConstraint constraint = (pConstraint as BulletConstraintXNA).constrain as SliderConstraint;
|
SliderConstraint constraint = (pConstraint as BulletConstraintXNA).constrain as SliderConstraint;
|
||||||
switch (lowerUpper)
|
switch (lowerUpper)
|
||||||
{
|
{
|
||||||
case SLIDER_LOWER_LIMIT:
|
case SLIDER_LOWER_LIMIT:
|
||||||
switch (linAng)
|
switch (linAng)
|
||||||
{
|
{
|
||||||
case SLIDER_LINEAR:
|
case SLIDER_LINEAR:
|
||||||
constraint.SetLowerLinLimit(val);
|
constraint.SetLowerLinLimit(val);
|
||||||
break;
|
break;
|
||||||
case SLIDER_ANGULAR:
|
case SLIDER_ANGULAR:
|
||||||
constraint.SetLowerAngLimit(val);
|
constraint.SetLowerAngLimit(val);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case SLIDER_UPPER_LIMIT:
|
case SLIDER_UPPER_LIMIT:
|
||||||
switch (linAng)
|
switch (linAng)
|
||||||
{
|
{
|
||||||
case SLIDER_LINEAR:
|
case SLIDER_LINEAR:
|
||||||
constraint.SetUpperLinLimit(val);
|
constraint.SetUpperLinLimit(val);
|
||||||
break;
|
break;
|
||||||
case SLIDER_ANGULAR:
|
case SLIDER_ANGULAR:
|
||||||
constraint.SetUpperAngLimit(val);
|
constraint.SetUpperAngLimit(val);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
public override bool SliderSet(BulletConstraint pConstraint, int softRestDamp, int dirLimOrtho, int linAng, float val)
|
public override bool SliderSet(BulletConstraint pConstraint, int softRestDamp, int dirLimOrtho, int linAng, float val)
|
||||||
{
|
{
|
||||||
SliderConstraint constraint = (pConstraint as BulletConstraintXNA).constrain as SliderConstraint;
|
SliderConstraint constraint = (pConstraint as BulletConstraintXNA).constrain as SliderConstraint;
|
||||||
switch (softRestDamp)
|
switch (softRestDamp)
|
||||||
{
|
{
|
||||||
case SLIDER_SET_SOFTNESS:
|
case SLIDER_SET_SOFTNESS:
|
||||||
switch (dirLimOrtho)
|
switch (dirLimOrtho)
|
||||||
{
|
{
|
||||||
case SLIDER_SET_DIRECTION:
|
case SLIDER_SET_DIRECTION:
|
||||||
switch (linAng)
|
switch (linAng)
|
||||||
{
|
{
|
||||||
case SLIDER_LINEAR: constraint.SetSoftnessDirLin(val); break;
|
case SLIDER_LINEAR: constraint.SetSoftnessDirLin(val); break;
|
||||||
case SLIDER_ANGULAR: constraint.SetSoftnessDirAng(val); break;
|
case SLIDER_ANGULAR: constraint.SetSoftnessDirAng(val); break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case SLIDER_SET_LIMIT:
|
case SLIDER_SET_LIMIT:
|
||||||
switch (linAng)
|
switch (linAng)
|
||||||
{
|
{
|
||||||
case SLIDER_LINEAR: constraint.SetSoftnessLimLin(val); break;
|
case SLIDER_LINEAR: constraint.SetSoftnessLimLin(val); break;
|
||||||
case SLIDER_ANGULAR: constraint.SetSoftnessLimAng(val); break;
|
case SLIDER_ANGULAR: constraint.SetSoftnessLimAng(val); break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case SLIDER_SET_ORTHO:
|
case SLIDER_SET_ORTHO:
|
||||||
switch (linAng)
|
switch (linAng)
|
||||||
{
|
{
|
||||||
case SLIDER_LINEAR: constraint.SetSoftnessOrthoLin(val); break;
|
case SLIDER_LINEAR: constraint.SetSoftnessOrthoLin(val); break;
|
||||||
case SLIDER_ANGULAR: constraint.SetSoftnessOrthoAng(val); break;
|
case SLIDER_ANGULAR: constraint.SetSoftnessOrthoAng(val); break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case SLIDER_SET_RESTITUTION:
|
case SLIDER_SET_RESTITUTION:
|
||||||
switch (dirLimOrtho)
|
switch (dirLimOrtho)
|
||||||
{
|
{
|
||||||
case SLIDER_SET_DIRECTION:
|
case SLIDER_SET_DIRECTION:
|
||||||
switch (linAng)
|
switch (linAng)
|
||||||
{
|
{
|
||||||
case SLIDER_LINEAR: constraint.SetRestitutionDirLin(val); break;
|
case SLIDER_LINEAR: constraint.SetRestitutionDirLin(val); break;
|
||||||
case SLIDER_ANGULAR: constraint.SetRestitutionDirAng(val); break;
|
case SLIDER_ANGULAR: constraint.SetRestitutionDirAng(val); break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case SLIDER_SET_LIMIT:
|
case SLIDER_SET_LIMIT:
|
||||||
switch (linAng)
|
switch (linAng)
|
||||||
{
|
{
|
||||||
case SLIDER_LINEAR: constraint.SetRestitutionLimLin(val); break;
|
case SLIDER_LINEAR: constraint.SetRestitutionLimLin(val); break;
|
||||||
case SLIDER_ANGULAR: constraint.SetRestitutionLimAng(val); break;
|
case SLIDER_ANGULAR: constraint.SetRestitutionLimAng(val); break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case SLIDER_SET_ORTHO:
|
case SLIDER_SET_ORTHO:
|
||||||
switch (linAng)
|
switch (linAng)
|
||||||
{
|
{
|
||||||
case SLIDER_LINEAR: constraint.SetRestitutionOrthoLin(val); break;
|
case SLIDER_LINEAR: constraint.SetRestitutionOrthoLin(val); break;
|
||||||
case SLIDER_ANGULAR: constraint.SetRestitutionOrthoAng(val); break;
|
case SLIDER_ANGULAR: constraint.SetRestitutionOrthoAng(val); break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case SLIDER_SET_DAMPING:
|
case SLIDER_SET_DAMPING:
|
||||||
switch (dirLimOrtho)
|
switch (dirLimOrtho)
|
||||||
{
|
{
|
||||||
case SLIDER_SET_DIRECTION:
|
case SLIDER_SET_DIRECTION:
|
||||||
switch (linAng)
|
switch (linAng)
|
||||||
{
|
{
|
||||||
case SLIDER_LINEAR: constraint.SetDampingDirLin(val); break;
|
case SLIDER_LINEAR: constraint.SetDampingDirLin(val); break;
|
||||||
case SLIDER_ANGULAR: constraint.SetDampingDirAng(val); break;
|
case SLIDER_ANGULAR: constraint.SetDampingDirAng(val); break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case SLIDER_SET_LIMIT:
|
case SLIDER_SET_LIMIT:
|
||||||
switch (linAng)
|
switch (linAng)
|
||||||
{
|
{
|
||||||
case SLIDER_LINEAR: constraint.SetDampingLimLin(val); break;
|
case SLIDER_LINEAR: constraint.SetDampingLimLin(val); break;
|
||||||
case SLIDER_ANGULAR: constraint.SetDampingLimAng(val); break;
|
case SLIDER_ANGULAR: constraint.SetDampingLimAng(val); break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case SLIDER_SET_ORTHO:
|
case SLIDER_SET_ORTHO:
|
||||||
switch (linAng)
|
switch (linAng)
|
||||||
{
|
{
|
||||||
case SLIDER_LINEAR: constraint.SetDampingOrthoLin(val); break;
|
case SLIDER_LINEAR: constraint.SetDampingOrthoLin(val); break;
|
||||||
case SLIDER_ANGULAR: constraint.SetDampingOrthoAng(val); break;
|
case SLIDER_ANGULAR: constraint.SetDampingOrthoAng(val); break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
public override bool SliderMotorEnable(BulletConstraint pConstraint, int linAng, float numericTrueFalse)
|
public override bool SliderMotorEnable(BulletConstraint pConstraint, int linAng, float numericTrueFalse)
|
||||||
{
|
{
|
||||||
SliderConstraint constraint = (pConstraint as BulletConstraintXNA).constrain as SliderConstraint;
|
SliderConstraint constraint = (pConstraint as BulletConstraintXNA).constrain as SliderConstraint;
|
||||||
switch (linAng)
|
switch (linAng)
|
||||||
{
|
{
|
||||||
case SLIDER_LINEAR:
|
case SLIDER_LINEAR:
|
||||||
constraint.SetPoweredLinMotor(numericTrueFalse == 0.0 ? false : true);
|
constraint.SetPoweredLinMotor(numericTrueFalse == 0.0 ? false : true);
|
||||||
break;
|
break;
|
||||||
case SLIDER_ANGULAR:
|
case SLIDER_ANGULAR:
|
||||||
constraint.SetPoweredAngMotor(numericTrueFalse == 0.0 ? false : true);
|
constraint.SetPoweredAngMotor(numericTrueFalse == 0.0 ? false : true);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
public override bool SliderMotor(BulletConstraint pConstraint, int forceVel, int linAng, float val)
|
public override bool SliderMotor(BulletConstraint pConstraint, int forceVel, int linAng, float val)
|
||||||
{
|
{
|
||||||
SliderConstraint constraint = (pConstraint as BulletConstraintXNA).constrain as SliderConstraint;
|
SliderConstraint constraint = (pConstraint as BulletConstraintXNA).constrain as SliderConstraint;
|
||||||
switch (forceVel)
|
switch (forceVel)
|
||||||
{
|
{
|
||||||
case SLIDER_MOTOR_VELOCITY:
|
case SLIDER_MOTOR_VELOCITY:
|
||||||
switch (linAng)
|
switch (linAng)
|
||||||
{
|
{
|
||||||
case SLIDER_LINEAR:
|
case SLIDER_LINEAR:
|
||||||
constraint.SetTargetLinMotorVelocity(val);
|
constraint.SetTargetLinMotorVelocity(val);
|
||||||
break;
|
break;
|
||||||
case SLIDER_ANGULAR:
|
case SLIDER_ANGULAR:
|
||||||
constraint.SetTargetAngMotorVelocity(val);
|
constraint.SetTargetAngMotorVelocity(val);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case SLIDER_MAX_MOTOR_FORCE:
|
case SLIDER_MAX_MOTOR_FORCE:
|
||||||
switch (linAng)
|
switch (linAng)
|
||||||
{
|
{
|
||||||
case SLIDER_LINEAR:
|
case SLIDER_LINEAR:
|
||||||
constraint.SetMaxLinMotorForce(val);
|
constraint.SetMaxLinMotorForce(val);
|
||||||
break;
|
break;
|
||||||
case SLIDER_ANGULAR:
|
case SLIDER_ANGULAR:
|
||||||
constraint.SetMaxAngMotorForce(val);
|
constraint.SetMaxAngMotorForce(val);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1197,20 +1197,20 @@ private sealed class BulletConstraintXNA : BulletConstraint
|
||||||
};
|
};
|
||||||
/*
|
/*
|
||||||
m_mass = mass;
|
m_mass = mass;
|
||||||
m_motionState =motionState;
|
m_motionState =motionState;
|
||||||
m_collisionShape = collisionShape;
|
m_collisionShape = collisionShape;
|
||||||
m_localInertia = localInertia;
|
m_localInertia = localInertia;
|
||||||
m_linearDamping = 0f;
|
m_linearDamping = 0f;
|
||||||
m_angularDamping = 0f;
|
m_angularDamping = 0f;
|
||||||
m_friction = 0.5f;
|
m_friction = 0.5f;
|
||||||
m_restitution = 0f;
|
m_restitution = 0f;
|
||||||
m_linearSleepingThreshold = 0.8f;
|
m_linearSleepingThreshold = 0.8f;
|
||||||
m_angularSleepingThreshold = 1f;
|
m_angularSleepingThreshold = 1f;
|
||||||
m_additionalDamping = false;
|
m_additionalDamping = false;
|
||||||
m_additionalDampingFactor = 0.005f;
|
m_additionalDampingFactor = 0.005f;
|
||||||
m_additionalLinearDampingThresholdSqr = 0.01f;
|
m_additionalLinearDampingThresholdSqr = 0.01f;
|
||||||
m_additionalAngularDampingThresholdSqr = 0.01f;
|
m_additionalAngularDampingThresholdSqr = 0.01f;
|
||||||
m_additionalAngularDampingFactor = 0.01f;
|
m_additionalAngularDampingFactor = 0.01f;
|
||||||
m_startWorldTransform = IndexedMatrix.Identity;
|
m_startWorldTransform = IndexedMatrix.Identity;
|
||||||
*/
|
*/
|
||||||
body.SetUserPointer(pLocalID);
|
body.SetUserPointer(pLocalID);
|
||||||
|
@ -2172,7 +2172,7 @@ private sealed class BulletConstraintXNA : BulletConstraint
|
||||||
}
|
}
|
||||||
|
|
||||||
public override BulletShape CreateTerrainShape(uint id, Vector3 size, float minHeight, float maxHeight, float[] heightMap,
|
public override BulletShape CreateTerrainShape(uint id, Vector3 size, float minHeight, float maxHeight, float[] heightMap,
|
||||||
float scaleFactor, float collisionMargin)
|
float scaleFactor, float collisionMargin)
|
||||||
{
|
{
|
||||||
const int upAxis = 2;
|
const int upAxis = 2;
|
||||||
HeightfieldTerrainShape terrainShape = new HeightfieldTerrainShape((int)size.X, (int)size.Y,
|
HeightfieldTerrainShape terrainShape = new HeightfieldTerrainShape((int)size.X, (int)size.Y,
|
||||||
|
|
|
@ -36,16 +36,16 @@ namespace OpenSim.Region.PhysicsModule.BulletS {
|
||||||
// Constraint type values as defined by Bullet
|
// Constraint type values as defined by Bullet
|
||||||
public enum ConstraintType : int
|
public enum ConstraintType : int
|
||||||
{
|
{
|
||||||
POINT2POINT_CONSTRAINT_TYPE = 3,
|
POINT2POINT_CONSTRAINT_TYPE = 3,
|
||||||
HINGE_CONSTRAINT_TYPE,
|
HINGE_CONSTRAINT_TYPE,
|
||||||
CONETWIST_CONSTRAINT_TYPE,
|
CONETWIST_CONSTRAINT_TYPE,
|
||||||
D6_CONSTRAINT_TYPE,
|
D6_CONSTRAINT_TYPE,
|
||||||
SLIDER_CONSTRAINT_TYPE,
|
SLIDER_CONSTRAINT_TYPE,
|
||||||
CONTACT_CONSTRAINT_TYPE,
|
CONTACT_CONSTRAINT_TYPE,
|
||||||
D6_SPRING_CONSTRAINT_TYPE,
|
D6_SPRING_CONSTRAINT_TYPE,
|
||||||
GEAR_CONSTRAINT_TYPE, // added in Bullet 2.82
|
GEAR_CONSTRAINT_TYPE, // added in Bullet 2.82
|
||||||
FIXED_CONSTRAINT_TYPE, // added in Bullet 2.82
|
FIXED_CONSTRAINT_TYPE, // added in Bullet 2.82
|
||||||
MAX_CONSTRAINT_TYPE, // last type defined by Bullet
|
MAX_CONSTRAINT_TYPE, // last type defined by Bullet
|
||||||
//
|
//
|
||||||
BS_FIXED_CONSTRAINT_TYPE = 1234 // BulletSim constraint that is fixed and unmoving
|
BS_FIXED_CONSTRAINT_TYPE = 1234 // BulletSim constraint that is fixed and unmoving
|
||||||
}
|
}
|
||||||
|
@ -54,25 +54,25 @@ public enum ConstraintType : int
|
||||||
[StructLayout(LayoutKind.Sequential)]
|
[StructLayout(LayoutKind.Sequential)]
|
||||||
public struct ConvexHull
|
public struct ConvexHull
|
||||||
{
|
{
|
||||||
Vector3 Offset;
|
Vector3 Offset;
|
||||||
int VertexCount;
|
int VertexCount;
|
||||||
Vector3[] Vertices;
|
Vector3[] Vertices;
|
||||||
}
|
}
|
||||||
public enum BSPhysicsShapeType
|
public enum BSPhysicsShapeType
|
||||||
{
|
{
|
||||||
SHAPE_UNKNOWN = 0,
|
SHAPE_UNKNOWN = 0,
|
||||||
SHAPE_CAPSULE = 1,
|
SHAPE_CAPSULE = 1,
|
||||||
SHAPE_BOX = 2,
|
SHAPE_BOX = 2,
|
||||||
SHAPE_CONE = 3,
|
SHAPE_CONE = 3,
|
||||||
SHAPE_CYLINDER = 4,
|
SHAPE_CYLINDER = 4,
|
||||||
SHAPE_SPHERE = 5,
|
SHAPE_SPHERE = 5,
|
||||||
SHAPE_MESH = 6,
|
SHAPE_MESH = 6,
|
||||||
SHAPE_HULL = 7,
|
SHAPE_HULL = 7,
|
||||||
// following defined by BulletSim
|
// following defined by BulletSim
|
||||||
SHAPE_GROUNDPLANE = 20,
|
SHAPE_GROUNDPLANE = 20,
|
||||||
SHAPE_TERRAIN = 21,
|
SHAPE_TERRAIN = 21,
|
||||||
SHAPE_COMPOUND = 22,
|
SHAPE_COMPOUND = 22,
|
||||||
SHAPE_HEIGHTMAP = 23,
|
SHAPE_HEIGHTMAP = 23,
|
||||||
SHAPE_AVATAR = 24,
|
SHAPE_AVATAR = 24,
|
||||||
SHAPE_CONVEXHULL= 25,
|
SHAPE_CONVEXHULL= 25,
|
||||||
SHAPE_GIMPACT = 26,
|
SHAPE_GIMPACT = 26,
|
||||||
|
@ -180,16 +180,16 @@ public struct ConfigurationParameters
|
||||||
public float collisionMargin;
|
public float collisionMargin;
|
||||||
public float gravity;
|
public float gravity;
|
||||||
|
|
||||||
public float maxPersistantManifoldPoolSize;
|
public float maxPersistantManifoldPoolSize;
|
||||||
public float maxCollisionAlgorithmPoolSize;
|
public float maxCollisionAlgorithmPoolSize;
|
||||||
public float shouldDisableContactPoolDynamicAllocation;
|
public float shouldDisableContactPoolDynamicAllocation;
|
||||||
public float shouldForceUpdateAllAabbs;
|
public float shouldForceUpdateAllAabbs;
|
||||||
public float shouldRandomizeSolverOrder;
|
public float shouldRandomizeSolverOrder;
|
||||||
public float shouldSplitSimulationIslands;
|
public float shouldSplitSimulationIslands;
|
||||||
public float shouldEnableFrictionCaching;
|
public float shouldEnableFrictionCaching;
|
||||||
public float numberOfSolverIterations;
|
public float numberOfSolverIterations;
|
||||||
public float useSingleSidedMeshes;
|
public float useSingleSidedMeshes;
|
||||||
public float globalContactBreakingThreshold;
|
public float globalContactBreakingThreshold;
|
||||||
|
|
||||||
public float physicsLoggingFrames;
|
public float physicsLoggingFrames;
|
||||||
|
|
||||||
|
@ -202,30 +202,30 @@ public struct ConfigurationParameters
|
||||||
public struct HACDParams
|
public struct HACDParams
|
||||||
{
|
{
|
||||||
// usual default values
|
// usual default values
|
||||||
public float maxVerticesPerHull; // 100
|
public float maxVerticesPerHull; // 100
|
||||||
public float minClusters; // 2
|
public float minClusters; // 2
|
||||||
public float compacityWeight; // 0.1
|
public float compacityWeight; // 0.1
|
||||||
public float volumeWeight; // 0.0
|
public float volumeWeight; // 0.0
|
||||||
public float concavity; // 100
|
public float concavity; // 100
|
||||||
public float addExtraDistPoints; // false
|
public float addExtraDistPoints; // false
|
||||||
public float addNeighboursDistPoints; // false
|
public float addNeighboursDistPoints; // false
|
||||||
public float addFacesPoints; // false
|
public float addFacesPoints; // false
|
||||||
public float shouldAdjustCollisionMargin; // false
|
public float shouldAdjustCollisionMargin; // false
|
||||||
// VHACD
|
// VHACD
|
||||||
public float whichHACD; // zero if Bullet HACD, non-zero says VHACD
|
public float whichHACD; // zero if Bullet HACD, non-zero says VHACD
|
||||||
// http://kmamou.blogspot.ca/2014/12/v-hacd-20-parameters-description.html
|
// http://kmamou.blogspot.ca/2014/12/v-hacd-20-parameters-description.html
|
||||||
public float vHACDresolution; // 100,000 max number of voxels generated during voxelization stage
|
public float vHACDresolution; // 100,000 max number of voxels generated during voxelization stage
|
||||||
public float vHACDdepth; // 20 max number of clipping stages
|
public float vHACDdepth; // 20 max number of clipping stages
|
||||||
public float vHACDconcavity; // 0.0025 maximum concavity
|
public float vHACDconcavity; // 0.0025 maximum concavity
|
||||||
public float vHACDplaneDownsampling; // 4 granularity of search for best clipping plane
|
public float vHACDplaneDownsampling; // 4 granularity of search for best clipping plane
|
||||||
public float vHACDconvexHullDownsampling; // 4 precision of hull gen process
|
public float vHACDconvexHullDownsampling; // 4 precision of hull gen process
|
||||||
public float vHACDalpha; // 0.05 bias toward clipping along symmetry planes
|
public float vHACDalpha; // 0.05 bias toward clipping along symmetry planes
|
||||||
public float vHACDbeta; // 0.05 bias toward clipping along revolution axis
|
public float vHACDbeta; // 0.05 bias toward clipping along revolution axis
|
||||||
public float vHACDgamma; // 0.00125 max concavity when merging
|
public float vHACDgamma; // 0.00125 max concavity when merging
|
||||||
public float vHACDpca; // 0 on/off normalizing mesh before decomp
|
public float vHACDpca; // 0 on/off normalizing mesh before decomp
|
||||||
public float vHACDmode; // 0 0:voxel based, 1: tetrahedron based
|
public float vHACDmode; // 0 0:voxel based, 1: tetrahedron based
|
||||||
public float vHACDmaxNumVerticesPerCH; // 64 max triangles per convex hull
|
public float vHACDmaxNumVerticesPerCH; // 64 max triangles per convex hull
|
||||||
public float vHACDminVolumePerCH; // 0.0001 sampling of generated convex hulls
|
public float vHACDminVolumePerCH; // 0.0001 sampling of generated convex hulls
|
||||||
}
|
}
|
||||||
|
|
||||||
// The states a bullet collision object can have
|
// The states a bullet collision object can have
|
||||||
|
@ -322,8 +322,8 @@ public abstract string BulletEngineVersion { get; protected set;}
|
||||||
|
|
||||||
// Initialization and simulation
|
// Initialization and simulation
|
||||||
public abstract BulletWorld Initialize(Vector3 maxPosition, ConfigurationParameters parms,
|
public abstract BulletWorld Initialize(Vector3 maxPosition, ConfigurationParameters parms,
|
||||||
int maxCollisions, ref CollisionDesc[] collisionArray,
|
int maxCollisions, ref CollisionDesc[] collisionArray,
|
||||||
int maxUpdates, ref EntityProperties[] updateArray
|
int maxUpdates, ref EntityProperties[] updateArray
|
||||||
);
|
);
|
||||||
|
|
||||||
public abstract int PhysicsStep(BulletWorld world, float timeStep, int maxSubSteps, float fixedTimeStep,
|
public abstract int PhysicsStep(BulletWorld world, float timeStep, int maxSubSteps, float fixedTimeStep,
|
||||||
|
@ -398,7 +398,7 @@ public abstract void DestroyObject(BulletWorld sim, BulletBody obj);
|
||||||
public abstract BulletShape CreateGroundPlaneShape(UInt32 id, float height, float collisionMargin);
|
public abstract BulletShape CreateGroundPlaneShape(UInt32 id, float height, float collisionMargin);
|
||||||
|
|
||||||
public abstract BulletShape CreateTerrainShape(UInt32 id, Vector3 size, float minHeight, float maxHeight, float[] heightMap,
|
public abstract BulletShape CreateTerrainShape(UInt32 id, Vector3 size, float minHeight, float maxHeight, float[] heightMap,
|
||||||
float scaleFactor, float collisionMargin);
|
float scaleFactor, float collisionMargin);
|
||||||
|
|
||||||
// =====================================================================================
|
// =====================================================================================
|
||||||
// Constraint creation and helper routines
|
// Constraint creation and helper routines
|
||||||
|
|
|
@ -90,8 +90,8 @@ public static class BSParam
|
||||||
public static float DeactivationTime { get; private set; }
|
public static float DeactivationTime { get; private set; }
|
||||||
public static float LinearSleepingThreshold { get; private set; }
|
public static float LinearSleepingThreshold { get; private set; }
|
||||||
public static float AngularSleepingThreshold { get; private set; }
|
public static float AngularSleepingThreshold { get; private set; }
|
||||||
public static float CcdMotionThreshold { get; private set; }
|
public static float CcdMotionThreshold { get; private set; }
|
||||||
public static float CcdSweptSphereRadius { get; private set; }
|
public static float CcdSweptSphereRadius { get; private set; }
|
||||||
public static float ContactProcessingThreshold { get; private set; }
|
public static float ContactProcessingThreshold { get; private set; }
|
||||||
|
|
||||||
public static bool ShouldMeshSculptedPrim { get; private set; } // cause scuplted prims to get meshed
|
public static bool ShouldMeshSculptedPrim { get; private set; } // cause scuplted prims to get meshed
|
||||||
|
@ -119,14 +119,14 @@ public static class BSParam
|
||||||
public static float Gravity { get; private set; }
|
public static float Gravity { get; private set; }
|
||||||
|
|
||||||
// Physics Engine operation
|
// Physics Engine operation
|
||||||
public static float MaxPersistantManifoldPoolSize { get; private set; }
|
public static float MaxPersistantManifoldPoolSize { get; private set; }
|
||||||
public static float MaxCollisionAlgorithmPoolSize { get; private set; }
|
public static float MaxCollisionAlgorithmPoolSize { get; private set; }
|
||||||
public static bool ShouldDisableContactPoolDynamicAllocation { get; private set; }
|
public static bool ShouldDisableContactPoolDynamicAllocation { get; private set; }
|
||||||
public static bool ShouldForceUpdateAllAabbs { get; private set; }
|
public static bool ShouldForceUpdateAllAabbs { get; private set; }
|
||||||
public static bool ShouldRandomizeSolverOrder { get; private set; }
|
public static bool ShouldRandomizeSolverOrder { get; private set; }
|
||||||
public static bool ShouldSplitSimulationIslands { get; private set; }
|
public static bool ShouldSplitSimulationIslands { get; private set; }
|
||||||
public static bool ShouldEnableFrictionCaching { get; private set; }
|
public static bool ShouldEnableFrictionCaching { get; private set; }
|
||||||
public static float NumberOfSolverIterations { get; private set; }
|
public static float NumberOfSolverIterations { get; private set; }
|
||||||
public static bool UseSingleSidedMeshes { get; private set; }
|
public static bool UseSingleSidedMeshes { get; private set; }
|
||||||
public static float GlobalContactBreakingThreshold { get; private set; }
|
public static float GlobalContactBreakingThreshold { get; private set; }
|
||||||
public static float PhysicsUnmanLoggingFrames { get; private set; }
|
public static float PhysicsUnmanLoggingFrames { get; private set; }
|
||||||
|
@ -149,19 +149,19 @@ public static class BSParam
|
||||||
public static float AvatarFlyingGroundMargin { get; private set; }
|
public static float AvatarFlyingGroundMargin { get; private set; }
|
||||||
public static float AvatarFlyingGroundUpForce { get; private set; }
|
public static float AvatarFlyingGroundUpForce { get; private set; }
|
||||||
public static float AvatarTerminalVelocity { get; private set; }
|
public static float AvatarTerminalVelocity { get; private set; }
|
||||||
public static float AvatarContactProcessingThreshold { get; private set; }
|
public static float AvatarContactProcessingThreshold { get; private set; }
|
||||||
public static float AvatarAddForcePushFactor { get; private set; }
|
public static float AvatarAddForcePushFactor { get; private set; }
|
||||||
public static float AvatarStopZeroThreshold { get; private set; }
|
public static float AvatarStopZeroThreshold { get; private set; }
|
||||||
public static float AvatarStopZeroThresholdSquared { get; private set; }
|
public static float AvatarStopZeroThresholdSquared { get; private set; }
|
||||||
public static int AvatarJumpFrames { get; private set; }
|
public static int AvatarJumpFrames { get; private set; }
|
||||||
public static float AvatarBelowGroundUpCorrectionMeters { get; private set; }
|
public static float AvatarBelowGroundUpCorrectionMeters { get; private set; }
|
||||||
public static float AvatarStepHeight { get; private set; }
|
public static float AvatarStepHeight { get; private set; }
|
||||||
public static float AvatarStepAngle { get; private set; }
|
public static float AvatarStepAngle { get; private set; }
|
||||||
public static float AvatarStepGroundFudge { get; private set; }
|
public static float AvatarStepGroundFudge { get; private set; }
|
||||||
public static float AvatarStepApproachFactor { get; private set; }
|
public static float AvatarStepApproachFactor { get; private set; }
|
||||||
public static float AvatarStepForceFactor { get; private set; }
|
public static float AvatarStepForceFactor { get; private set; }
|
||||||
public static float AvatarStepUpCorrectionFactor { get; private set; }
|
public static float AvatarStepUpCorrectionFactor { get; private set; }
|
||||||
public static int AvatarStepSmoothingSteps { get; private set; }
|
public static int AvatarStepSmoothingSteps { get; private set; }
|
||||||
|
|
||||||
// Vehicle parameters
|
// Vehicle parameters
|
||||||
public static float VehicleMaxLinearVelocity { get; private set; }
|
public static float VehicleMaxLinearVelocity { get; private set; }
|
||||||
|
@ -193,31 +193,31 @@ public static class BSParam
|
||||||
public static float CSHullVolumeConservationThresholdPercent { get; private set; }
|
public static float CSHullVolumeConservationThresholdPercent { get; private set; }
|
||||||
public static int CSHullMaxVertices { get; private set; }
|
public static int CSHullMaxVertices { get; private set; }
|
||||||
public static float CSHullMaxSkinWidth { get; private set; }
|
public static float CSHullMaxSkinWidth { get; private set; }
|
||||||
public static float BHullMaxVerticesPerHull { get; private set; } // 100
|
public static float BHullMaxVerticesPerHull { get; private set; } // 100
|
||||||
public static float BHullMinClusters { get; private set; } // 2
|
public static float BHullMinClusters { get; private set; } // 2
|
||||||
public static float BHullCompacityWeight { get; private set; } // 0.1
|
public static float BHullCompacityWeight { get; private set; } // 0.1
|
||||||
public static float BHullVolumeWeight { get; private set; } // 0.0
|
public static float BHullVolumeWeight { get; private set; } // 0.0
|
||||||
public static float BHullConcavity { get; private set; } // 100
|
public static float BHullConcavity { get; private set; } // 100
|
||||||
public static bool BHullAddExtraDistPoints { get; private set; } // false
|
public static bool BHullAddExtraDistPoints { get; private set; } // false
|
||||||
public static bool BHullAddNeighboursDistPoints { get; private set; } // false
|
public static bool BHullAddNeighboursDistPoints { get; private set; } // false
|
||||||
public static bool BHullAddFacesPoints { get; private set; } // false
|
public static bool BHullAddFacesPoints { get; private set; } // false
|
||||||
public static bool BHullShouldAdjustCollisionMargin { get; private set; } // false
|
public static bool BHullShouldAdjustCollisionMargin { get; private set; } // false
|
||||||
public static float WhichHACD { get; private set; } // zero if Bullet HACD, non-zero says VHACD
|
public static float WhichHACD { get; private set; } // zero if Bullet HACD, non-zero says VHACD
|
||||||
// Parameters for VHACD 2.0: http://code.google.com/p/v-hacd
|
// Parameters for VHACD 2.0: http://code.google.com/p/v-hacd
|
||||||
// To enable, set both ShouldUseBulletHACD=true and WhichHACD=1
|
// To enable, set both ShouldUseBulletHACD=true and WhichHACD=1
|
||||||
// http://kmamou.blogspot.ca/2014/12/v-hacd-20-parameters-description.html
|
// http://kmamou.blogspot.ca/2014/12/v-hacd-20-parameters-description.html
|
||||||
public static float VHACDresolution { get; private set; } // 100,000 max number of voxels generated during voxelization stage
|
public static float VHACDresolution { get; private set; } // 100,000 max number of voxels generated during voxelization stage
|
||||||
public static float VHACDdepth { get; private set; } // 20 max number of clipping stages
|
public static float VHACDdepth { get; private set; } // 20 max number of clipping stages
|
||||||
public static float VHACDconcavity { get; private set; } // 0.0025 maximum concavity
|
public static float VHACDconcavity { get; private set; } // 0.0025 maximum concavity
|
||||||
public static float VHACDplaneDownsampling { get; private set; } // 4 granularity of search for best clipping plane
|
public static float VHACDplaneDownsampling { get; private set; } // 4 granularity of search for best clipping plane
|
||||||
public static float VHACDconvexHullDownsampling { get; private set; } // 4 precision of hull gen process
|
public static float VHACDconvexHullDownsampling { get; private set; } // 4 precision of hull gen process
|
||||||
public static float VHACDalpha { get; private set; } // 0.05 bias toward clipping along symmetry planes
|
public static float VHACDalpha { get; private set; } // 0.05 bias toward clipping along symmetry planes
|
||||||
public static float VHACDbeta { get; private set; } // 0.05 bias toward clipping along revolution axis
|
public static float VHACDbeta { get; private set; } // 0.05 bias toward clipping along revolution axis
|
||||||
public static float VHACDgamma { get; private set; } // 0.00125 max concavity when merging
|
public static float VHACDgamma { get; private set; } // 0.00125 max concavity when merging
|
||||||
public static float VHACDpca { get; private set; } // 0 on/off normalizing mesh before decomp
|
public static float VHACDpca { get; private set; } // 0 on/off normalizing mesh before decomp
|
||||||
public static float VHACDmode { get; private set; } // 0 0:voxel based, 1: tetrahedron based
|
public static float VHACDmode { get; private set; } // 0 0:voxel based, 1: tetrahedron based
|
||||||
public static float VHACDmaxNumVerticesPerCH { get; private set; } // 64 max triangles per convex hull
|
public static float VHACDmaxNumVerticesPerCH { get; private set; } // 64 max triangles per convex hull
|
||||||
public static float VHACDminVolumePerCH { get; private set; } // 0.0001 sampling of generated convex hulls
|
public static float VHACDminVolumePerCH { get; private set; } // 0.0001 sampling of generated convex hulls
|
||||||
|
|
||||||
// Linkset implementation parameters
|
// Linkset implementation parameters
|
||||||
public static float LinksetImplementation { get; private set; }
|
public static float LinksetImplementation { get; private set; }
|
||||||
|
@ -579,7 +579,7 @@ public static class BSParam
|
||||||
(s,v) => { ContactProcessingThreshold = v;},
|
(s,v) => { ContactProcessingThreshold = v;},
|
||||||
(s,o) => { s.PE.SetContactProcessingThreshold(o.PhysBody, ContactProcessingThreshold); } ),
|
(s,o) => { s.PE.SetContactProcessingThreshold(o.PhysBody, ContactProcessingThreshold); } ),
|
||||||
|
|
||||||
new ParameterDefn<float>("TerrainImplementation", "Type of shape to use for terrain (0=heightmap, 1=mesh)",
|
new ParameterDefn<float>("TerrainImplementation", "Type of shape to use for terrain (0=heightmap, 1=mesh)",
|
||||||
(float)BSTerrainPhys.TerrainImplementation.Heightmap ),
|
(float)BSTerrainPhys.TerrainImplementation.Heightmap ),
|
||||||
new ParameterDefn<int>("TerrainMeshMagnification", "Number of times the 256x256 heightmap is multiplied to create the terrain mesh" ,
|
new ParameterDefn<int>("TerrainMeshMagnification", "Number of times the 256x256 heightmap is multiplied to create the terrain mesh" ,
|
||||||
2 ),
|
2 ),
|
||||||
|
@ -631,31 +631,31 @@ public static class BSParam
|
||||||
2.0f ),
|
2.0f ),
|
||||||
new ParameterDefn<float>("AvatarTerminalVelocity", "Terminal Velocity of falling avatar",
|
new ParameterDefn<float>("AvatarTerminalVelocity", "Terminal Velocity of falling avatar",
|
||||||
-54.0f ),
|
-54.0f ),
|
||||||
new ParameterDefn<float>("AvatarContactProcessingThreshold", "Distance from capsule to check for collisions",
|
new ParameterDefn<float>("AvatarContactProcessingThreshold", "Distance from capsule to check for collisions",
|
||||||
0.1f ),
|
0.1f ),
|
||||||
new ParameterDefn<float>("AvatarAddForcePushFactor", "BSCharacter.AddForce is multiplied by this and mass to be like other physics engines",
|
new ParameterDefn<float>("AvatarAddForcePushFactor", "BSCharacter.AddForce is multiplied by this and mass to be like other physics engines",
|
||||||
0.315f ),
|
0.315f ),
|
||||||
new ParameterDefn<float>("AvatarStopZeroThreshold", "Movement velocity below which avatar is assumed to be stopped",
|
new ParameterDefn<float>("AvatarStopZeroThreshold", "Movement velocity below which avatar is assumed to be stopped",
|
||||||
0.45f,
|
0.45f,
|
||||||
(s) => { return (float)AvatarStopZeroThreshold; },
|
(s) => { return (float)AvatarStopZeroThreshold; },
|
||||||
(s,v) => { AvatarStopZeroThreshold = v; AvatarStopZeroThresholdSquared = v * v; } ),
|
(s,v) => { AvatarStopZeroThreshold = v; AvatarStopZeroThresholdSquared = v * v; } ),
|
||||||
new ParameterDefn<float>("AvatarBelowGroundUpCorrectionMeters", "Meters to move avatar up if it seems to be below ground",
|
new ParameterDefn<float>("AvatarBelowGroundUpCorrectionMeters", "Meters to move avatar up if it seems to be below ground",
|
||||||
1.0f ),
|
1.0f ),
|
||||||
new ParameterDefn<int>("AvatarJumpFrames", "Number of frames to allow jump forces. Changes jump height.",
|
new ParameterDefn<int>("AvatarJumpFrames", "Number of frames to allow jump forces. Changes jump height.",
|
||||||
4 ),
|
4 ),
|
||||||
new ParameterDefn<float>("AvatarStepHeight", "Height of a step obstacle to consider step correction",
|
new ParameterDefn<float>("AvatarStepHeight", "Height of a step obstacle to consider step correction",
|
||||||
0.999f ) ,
|
0.999f ) ,
|
||||||
new ParameterDefn<float>("AvatarStepAngle", "The angle (in radians) for a vertical surface to be considered a step",
|
new ParameterDefn<float>("AvatarStepAngle", "The angle (in radians) for a vertical surface to be considered a step",
|
||||||
0.3f ) ,
|
0.3f ) ,
|
||||||
new ParameterDefn<float>("AvatarStepGroundFudge", "Fudge factor subtracted from avatar base when comparing collision height",
|
new ParameterDefn<float>("AvatarStepGroundFudge", "Fudge factor subtracted from avatar base when comparing collision height",
|
||||||
0.1f ) ,
|
0.1f ) ,
|
||||||
new ParameterDefn<float>("AvatarStepApproachFactor", "Factor to control angle of approach to step (0=straight on)",
|
new ParameterDefn<float>("AvatarStepApproachFactor", "Factor to control angle of approach to step (0=straight on)",
|
||||||
2f ),
|
2f ),
|
||||||
new ParameterDefn<float>("AvatarStepForceFactor", "Controls the amount of force up applied to step up onto a step",
|
new ParameterDefn<float>("AvatarStepForceFactor", "Controls the amount of force up applied to step up onto a step",
|
||||||
0f ),
|
0f ),
|
||||||
new ParameterDefn<float>("AvatarStepUpCorrectionFactor", "Multiplied by height of step collision to create up movement at step",
|
new ParameterDefn<float>("AvatarStepUpCorrectionFactor", "Multiplied by height of step collision to create up movement at step",
|
||||||
0.8f ),
|
0.8f ),
|
||||||
new ParameterDefn<int>("AvatarStepSmoothingSteps", "Number of frames after a step collision that we continue walking up stairs",
|
new ParameterDefn<int>("AvatarStepSmoothingSteps", "Number of frames after a step collision that we continue walking up stairs",
|
||||||
1 ),
|
1 ),
|
||||||
|
|
||||||
new ParameterDefn<float>("VehicleMaxLinearVelocity", "Maximum velocity magnitude that can be assigned to a vehicle",
|
new ParameterDefn<float>("VehicleMaxLinearVelocity", "Maximum velocity magnitude that can be assigned to a vehicle",
|
||||||
|
@ -699,131 +699,131 @@ public static class BSParam
|
||||||
new ParameterDefn<bool>("VehicleEnableAngularBanking", "Turn on/off vehicle angular banking effect",
|
new ParameterDefn<bool>("VehicleEnableAngularBanking", "Turn on/off vehicle angular banking effect",
|
||||||
true ),
|
true ),
|
||||||
|
|
||||||
new ParameterDefn<float>("MaxPersistantManifoldPoolSize", "Number of manifolds pooled (0 means default of 4096)",
|
new ParameterDefn<float>("MaxPersistantManifoldPoolSize", "Number of manifolds pooled (0 means default of 4096)",
|
||||||
0f,
|
0f,
|
||||||
(s) => { return MaxPersistantManifoldPoolSize; },
|
(s) => { return MaxPersistantManifoldPoolSize; },
|
||||||
(s,v) => { MaxPersistantManifoldPoolSize = v; s.UnmanagedParams[0].maxPersistantManifoldPoolSize = v; } ),
|
(s,v) => { MaxPersistantManifoldPoolSize = v; s.UnmanagedParams[0].maxPersistantManifoldPoolSize = v; } ),
|
||||||
new ParameterDefn<float>("MaxCollisionAlgorithmPoolSize", "Number of collisions pooled (0 means default of 4096)",
|
new ParameterDefn<float>("MaxCollisionAlgorithmPoolSize", "Number of collisions pooled (0 means default of 4096)",
|
||||||
0f,
|
0f,
|
||||||
(s) => { return MaxCollisionAlgorithmPoolSize; },
|
(s) => { return MaxCollisionAlgorithmPoolSize; },
|
||||||
(s,v) => { MaxCollisionAlgorithmPoolSize = v; s.UnmanagedParams[0].maxCollisionAlgorithmPoolSize = v; } ),
|
(s,v) => { MaxCollisionAlgorithmPoolSize = v; s.UnmanagedParams[0].maxCollisionAlgorithmPoolSize = v; } ),
|
||||||
new ParameterDefn<bool>("ShouldDisableContactPoolDynamicAllocation", "Enable to allow large changes in object count",
|
new ParameterDefn<bool>("ShouldDisableContactPoolDynamicAllocation", "Enable to allow large changes in object count",
|
||||||
false,
|
false,
|
||||||
(s) => { return ShouldDisableContactPoolDynamicAllocation; },
|
(s) => { return ShouldDisableContactPoolDynamicAllocation; },
|
||||||
(s,v) => { ShouldDisableContactPoolDynamicAllocation = v;
|
(s,v) => { ShouldDisableContactPoolDynamicAllocation = v;
|
||||||
s.UnmanagedParams[0].shouldDisableContactPoolDynamicAllocation = NumericBool(v); } ),
|
s.UnmanagedParams[0].shouldDisableContactPoolDynamicAllocation = NumericBool(v); } ),
|
||||||
new ParameterDefn<bool>("ShouldForceUpdateAllAabbs", "Enable to recomputer AABBs every simulator step",
|
new ParameterDefn<bool>("ShouldForceUpdateAllAabbs", "Enable to recomputer AABBs every simulator step",
|
||||||
false,
|
false,
|
||||||
(s) => { return ShouldForceUpdateAllAabbs; },
|
(s) => { return ShouldForceUpdateAllAabbs; },
|
||||||
(s,v) => { ShouldForceUpdateAllAabbs = v; s.UnmanagedParams[0].shouldForceUpdateAllAabbs = NumericBool(v); } ),
|
(s,v) => { ShouldForceUpdateAllAabbs = v; s.UnmanagedParams[0].shouldForceUpdateAllAabbs = NumericBool(v); } ),
|
||||||
new ParameterDefn<bool>("ShouldRandomizeSolverOrder", "Enable for slightly better stacking interaction",
|
new ParameterDefn<bool>("ShouldRandomizeSolverOrder", "Enable for slightly better stacking interaction",
|
||||||
true,
|
true,
|
||||||
(s) => { return ShouldRandomizeSolverOrder; },
|
(s) => { return ShouldRandomizeSolverOrder; },
|
||||||
(s,v) => { ShouldRandomizeSolverOrder = v; s.UnmanagedParams[0].shouldRandomizeSolverOrder = NumericBool(v); } ),
|
(s,v) => { ShouldRandomizeSolverOrder = v; s.UnmanagedParams[0].shouldRandomizeSolverOrder = NumericBool(v); } ),
|
||||||
new ParameterDefn<bool>("ShouldSplitSimulationIslands", "Enable splitting active object scanning islands",
|
new ParameterDefn<bool>("ShouldSplitSimulationIslands", "Enable splitting active object scanning islands",
|
||||||
true,
|
true,
|
||||||
(s) => { return ShouldSplitSimulationIslands; },
|
(s) => { return ShouldSplitSimulationIslands; },
|
||||||
(s,v) => { ShouldSplitSimulationIslands = v; s.UnmanagedParams[0].shouldSplitSimulationIslands = NumericBool(v); } ),
|
(s,v) => { ShouldSplitSimulationIslands = v; s.UnmanagedParams[0].shouldSplitSimulationIslands = NumericBool(v); } ),
|
||||||
new ParameterDefn<bool>("ShouldEnableFrictionCaching", "Enable friction computation caching",
|
new ParameterDefn<bool>("ShouldEnableFrictionCaching", "Enable friction computation caching",
|
||||||
true,
|
true,
|
||||||
(s) => { return ShouldEnableFrictionCaching; },
|
(s) => { return ShouldEnableFrictionCaching; },
|
||||||
(s,v) => { ShouldEnableFrictionCaching = v; s.UnmanagedParams[0].shouldEnableFrictionCaching = NumericBool(v); } ),
|
(s,v) => { ShouldEnableFrictionCaching = v; s.UnmanagedParams[0].shouldEnableFrictionCaching = NumericBool(v); } ),
|
||||||
new ParameterDefn<float>("NumberOfSolverIterations", "Number of internal iterations (0 means default)",
|
new ParameterDefn<float>("NumberOfSolverIterations", "Number of internal iterations (0 means default)",
|
||||||
0f, // zero says use Bullet default
|
0f, // zero says use Bullet default
|
||||||
(s) => { return NumberOfSolverIterations; },
|
(s) => { return NumberOfSolverIterations; },
|
||||||
(s,v) => { NumberOfSolverIterations = v; s.UnmanagedParams[0].numberOfSolverIterations = v; } ),
|
(s,v) => { NumberOfSolverIterations = v; s.UnmanagedParams[0].numberOfSolverIterations = v; } ),
|
||||||
new ParameterDefn<bool>("UseSingleSidedMeshes", "Whether to compute collisions based on single sided meshes.",
|
new ParameterDefn<bool>("UseSingleSidedMeshes", "Whether to compute collisions based on single sided meshes.",
|
||||||
true,
|
true,
|
||||||
(s) => { return UseSingleSidedMeshes; },
|
(s) => { return UseSingleSidedMeshes; },
|
||||||
(s,v) => { UseSingleSidedMeshes = v; s.UnmanagedParams[0].useSingleSidedMeshes = NumericBool(v); } ),
|
(s,v) => { UseSingleSidedMeshes = v; s.UnmanagedParams[0].useSingleSidedMeshes = NumericBool(v); } ),
|
||||||
new ParameterDefn<float>("GlobalContactBreakingThreshold", "Amount of shape radius before breaking a collision contact (0 says Bullet default (0.2))",
|
new ParameterDefn<float>("GlobalContactBreakingThreshold", "Amount of shape radius before breaking a collision contact (0 says Bullet default (0.2))",
|
||||||
0f,
|
0f,
|
||||||
(s) => { return GlobalContactBreakingThreshold; },
|
(s) => { return GlobalContactBreakingThreshold; },
|
||||||
(s,v) => { GlobalContactBreakingThreshold = v; s.UnmanagedParams[0].globalContactBreakingThreshold = v; } ),
|
(s,v) => { GlobalContactBreakingThreshold = v; s.UnmanagedParams[0].globalContactBreakingThreshold = v; } ),
|
||||||
new ParameterDefn<float>("PhysicsUnmanLoggingFrames", "If non-zero, frames between output of detailed unmanaged physics statistics",
|
new ParameterDefn<float>("PhysicsUnmanLoggingFrames", "If non-zero, frames between output of detailed unmanaged physics statistics",
|
||||||
0f,
|
0f,
|
||||||
(s) => { return PhysicsUnmanLoggingFrames; },
|
(s) => { return PhysicsUnmanLoggingFrames; },
|
||||||
(s,v) => { PhysicsUnmanLoggingFrames = v; s.UnmanagedParams[0].physicsLoggingFrames = v; } ),
|
(s,v) => { PhysicsUnmanLoggingFrames = v; s.UnmanagedParams[0].physicsLoggingFrames = v; } ),
|
||||||
|
|
||||||
new ParameterDefn<int>("CSHullMaxDepthSplit", "CS impl: max depth to split for hull. 1-10 but > 7 is iffy",
|
new ParameterDefn<int>("CSHullMaxDepthSplit", "CS impl: max depth to split for hull. 1-10 but > 7 is iffy",
|
||||||
7 ),
|
7 ),
|
||||||
new ParameterDefn<int>("CSHullMaxDepthSplitForSimpleShapes", "CS impl: max depth setting for simple prim shapes",
|
new ParameterDefn<int>("CSHullMaxDepthSplitForSimpleShapes", "CS impl: max depth setting for simple prim shapes",
|
||||||
2 ),
|
2 ),
|
||||||
new ParameterDefn<float>("CSHullConcavityThresholdPercent", "CS impl: concavity threshold percent (0-20)",
|
new ParameterDefn<float>("CSHullConcavityThresholdPercent", "CS impl: concavity threshold percent (0-20)",
|
||||||
5f ),
|
5f ),
|
||||||
new ParameterDefn<float>("CSHullVolumeConservationThresholdPercent", "percent volume conservation to collapse hulls (0-30)",
|
new ParameterDefn<float>("CSHullVolumeConservationThresholdPercent", "percent volume conservation to collapse hulls (0-30)",
|
||||||
5f ),
|
5f ),
|
||||||
new ParameterDefn<int>("CSHullMaxVertices", "CS impl: maximum number of vertices in output hulls. Keep < 50.",
|
new ParameterDefn<int>("CSHullMaxVertices", "CS impl: maximum number of vertices in output hulls. Keep < 50.",
|
||||||
32 ),
|
32 ),
|
||||||
new ParameterDefn<float>("CSHullMaxSkinWidth", "CS impl: skin width to apply to output hulls.",
|
new ParameterDefn<float>("CSHullMaxSkinWidth", "CS impl: skin width to apply to output hulls.",
|
||||||
0f ),
|
0f ),
|
||||||
|
|
||||||
new ParameterDefn<float>("BHullMaxVerticesPerHull", "Bullet impl: max number of vertices per created hull",
|
new ParameterDefn<float>("BHullMaxVerticesPerHull", "Bullet impl: max number of vertices per created hull",
|
||||||
200f ),
|
200f ),
|
||||||
new ParameterDefn<float>("BHullMinClusters", "Bullet impl: minimum number of hulls to create per mesh",
|
new ParameterDefn<float>("BHullMinClusters", "Bullet impl: minimum number of hulls to create per mesh",
|
||||||
10f ),
|
10f ),
|
||||||
new ParameterDefn<float>("BHullCompacityWeight", "Bullet impl: weight factor for how compact to make hulls",
|
new ParameterDefn<float>("BHullCompacityWeight", "Bullet impl: weight factor for how compact to make hulls",
|
||||||
20f ),
|
20f ),
|
||||||
new ParameterDefn<float>("BHullVolumeWeight", "Bullet impl: weight factor for volume in created hull",
|
new ParameterDefn<float>("BHullVolumeWeight", "Bullet impl: weight factor for volume in created hull",
|
||||||
0.1f ),
|
0.1f ),
|
||||||
new ParameterDefn<float>("BHullConcavity", "Bullet impl: weight factor for how convex a created hull can be",
|
new ParameterDefn<float>("BHullConcavity", "Bullet impl: weight factor for how convex a created hull can be",
|
||||||
10f ),
|
10f ),
|
||||||
new ParameterDefn<bool>("BHullAddExtraDistPoints", "Bullet impl: whether to add extra vertices for long distance vectors",
|
new ParameterDefn<bool>("BHullAddExtraDistPoints", "Bullet impl: whether to add extra vertices for long distance vectors",
|
||||||
true ),
|
true ),
|
||||||
new ParameterDefn<bool>("BHullAddNeighboursDistPoints", "Bullet impl: whether to add extra vertices between neighbor hulls",
|
new ParameterDefn<bool>("BHullAddNeighboursDistPoints", "Bullet impl: whether to add extra vertices between neighbor hulls",
|
||||||
true ),
|
true ),
|
||||||
new ParameterDefn<bool>("BHullAddFacesPoints", "Bullet impl: whether to add extra vertices to break up hull faces",
|
new ParameterDefn<bool>("BHullAddFacesPoints", "Bullet impl: whether to add extra vertices to break up hull faces",
|
||||||
true ),
|
true ),
|
||||||
new ParameterDefn<bool>("BHullShouldAdjustCollisionMargin", "Bullet impl: whether to shrink resulting hulls to account for collision margin",
|
new ParameterDefn<bool>("BHullShouldAdjustCollisionMargin", "Bullet impl: whether to shrink resulting hulls to account for collision margin",
|
||||||
false ),
|
false ),
|
||||||
|
|
||||||
new ParameterDefn<float>("WhichHACD", "zero if Bullet HACD, non-zero says VHACD",
|
new ParameterDefn<float>("WhichHACD", "zero if Bullet HACD, non-zero says VHACD",
|
||||||
0f ),
|
0f ),
|
||||||
new ParameterDefn<float>("VHACDresolution", "max number of voxels generated during voxelization stage",
|
new ParameterDefn<float>("VHACDresolution", "max number of voxels generated during voxelization stage",
|
||||||
100000f ),
|
100000f ),
|
||||||
new ParameterDefn<float>("VHACDdepth", "max number of clipping stages",
|
new ParameterDefn<float>("VHACDdepth", "max number of clipping stages",
|
||||||
20f ),
|
20f ),
|
||||||
new ParameterDefn<float>("VHACDconcavity", "maximum concavity",
|
new ParameterDefn<float>("VHACDconcavity", "maximum concavity",
|
||||||
0.0025f ),
|
0.0025f ),
|
||||||
new ParameterDefn<float>("VHACDplaneDownsampling", "granularity of search for best clipping plane",
|
new ParameterDefn<float>("VHACDplaneDownsampling", "granularity of search for best clipping plane",
|
||||||
4f ),
|
4f ),
|
||||||
new ParameterDefn<float>("VHACDconvexHullDownsampling", "precision of hull gen process",
|
new ParameterDefn<float>("VHACDconvexHullDownsampling", "precision of hull gen process",
|
||||||
4f ),
|
4f ),
|
||||||
new ParameterDefn<float>("VHACDalpha", "bias toward clipping along symmetry planes",
|
new ParameterDefn<float>("VHACDalpha", "bias toward clipping along symmetry planes",
|
||||||
0.05f ),
|
0.05f ),
|
||||||
new ParameterDefn<float>("VHACDbeta", "bias toward clipping along revolution axis",
|
new ParameterDefn<float>("VHACDbeta", "bias toward clipping along revolution axis",
|
||||||
0.05f ),
|
0.05f ),
|
||||||
new ParameterDefn<float>("VHACDgamma", "max concavity when merging",
|
new ParameterDefn<float>("VHACDgamma", "max concavity when merging",
|
||||||
0.00125f ),
|
0.00125f ),
|
||||||
new ParameterDefn<float>("VHACDpca", "on/off normalizing mesh before decomp",
|
new ParameterDefn<float>("VHACDpca", "on/off normalizing mesh before decomp",
|
||||||
0f ),
|
0f ),
|
||||||
new ParameterDefn<float>("VHACDmode", "0:voxel based, 1: tetrahedron based",
|
new ParameterDefn<float>("VHACDmode", "0:voxel based, 1: tetrahedron based",
|
||||||
0f ),
|
0f ),
|
||||||
new ParameterDefn<float>("VHACDmaxNumVerticesPerCH", "max triangles per convex hull",
|
new ParameterDefn<float>("VHACDmaxNumVerticesPerCH", "max triangles per convex hull",
|
||||||
64f ),
|
64f ),
|
||||||
new ParameterDefn<float>("VHACDminVolumePerCH", "sampling of generated convex hulls",
|
new ParameterDefn<float>("VHACDminVolumePerCH", "sampling of generated convex hulls",
|
||||||
0.0001f ),
|
0.0001f ),
|
||||||
|
|
||||||
new ParameterDefn<float>("LinksetImplementation", "Type of linkset implementation (0=Constraint, 1=Compound, 2=Manual)",
|
new ParameterDefn<float>("LinksetImplementation", "Type of linkset implementation (0=Constraint, 1=Compound, 2=Manual)",
|
||||||
(float)BSLinkset.LinksetImplementation.Compound ),
|
(float)BSLinkset.LinksetImplementation.Compound ),
|
||||||
new ParameterDefn<bool>("LinksetOffsetCenterOfMass", "If 'true', compute linkset center-of-mass and offset linkset position to account for same",
|
new ParameterDefn<bool>("LinksetOffsetCenterOfMass", "If 'true', compute linkset center-of-mass and offset linkset position to account for same",
|
||||||
true ),
|
true ),
|
||||||
new ParameterDefn<bool>("LinkConstraintUseFrameOffset", "For linksets built with constraints, enable frame offsetFor linksets built with constraints, enable frame offset.",
|
new ParameterDefn<bool>("LinkConstraintUseFrameOffset", "For linksets built with constraints, enable frame offsetFor linksets built with constraints, enable frame offset.",
|
||||||
false ),
|
false ),
|
||||||
new ParameterDefn<bool>("LinkConstraintEnableTransMotor", "Whether to enable translational motor on linkset constraints",
|
new ParameterDefn<bool>("LinkConstraintEnableTransMotor", "Whether to enable translational motor on linkset constraints",
|
||||||
true ),
|
true ),
|
||||||
new ParameterDefn<float>("LinkConstraintTransMotorMaxVel", "Maximum velocity to be applied by translational motor in linkset constraints",
|
new ParameterDefn<float>("LinkConstraintTransMotorMaxVel", "Maximum velocity to be applied by translational motor in linkset constraints",
|
||||||
5.0f ),
|
5.0f ),
|
||||||
new ParameterDefn<float>("LinkConstraintTransMotorMaxForce", "Maximum force to be applied by translational motor in linkset constraints",
|
new ParameterDefn<float>("LinkConstraintTransMotorMaxForce", "Maximum force to be applied by translational motor in linkset constraints",
|
||||||
0.1f ),
|
0.1f ),
|
||||||
new ParameterDefn<float>("LinkConstraintCFM", "Amount constraint can be violated. 0=no violation, 1=infinite. Default=0.1",
|
new ParameterDefn<float>("LinkConstraintCFM", "Amount constraint can be violated. 0=no violation, 1=infinite. Default=0.1",
|
||||||
0.1f ),
|
0.1f ),
|
||||||
new ParameterDefn<float>("LinkConstraintERP", "Amount constraint is corrected each tick. 0=none, 1=all. Default = 0.2",
|
new ParameterDefn<float>("LinkConstraintERP", "Amount constraint is corrected each tick. 0=none, 1=all. Default = 0.2",
|
||||||
0.1f ),
|
0.1f ),
|
||||||
new ParameterDefn<float>("LinkConstraintSolverIterations", "Number of solver iterations when computing constraint. (0 = Bullet default)",
|
new ParameterDefn<float>("LinkConstraintSolverIterations", "Number of solver iterations when computing constraint. (0 = Bullet default)",
|
||||||
40 ),
|
40 ),
|
||||||
|
|
||||||
new ParameterDefn<float>("DebugNumber", "A console setable number sometimes used for debugging",
|
new ParameterDefn<float>("DebugNumber", "A console setable number sometimes used for debugging",
|
||||||
1.0f ),
|
1.0f ),
|
||||||
|
|
||||||
new ParameterDefn<int>("PhysicsMetricFrames", "Frames between outputting detailed phys metrics. (0 is off)",
|
new ParameterDefn<int>("PhysicsMetricFrames", "Frames between outputting detailed phys metrics. (0 is off)",
|
||||||
|
|
|
@ -246,13 +246,13 @@ namespace OpenSim.Region.PhysicsModules.ConvexDecompositionDotNet
|
||||||
}
|
}
|
||||||
|
|
||||||
private static float DistToPt(float3 p, float4 plane)
|
private static float DistToPt(float3 p, float4 plane)
|
||||||
{
|
{
|
||||||
float x = p.x;
|
float x = p.x;
|
||||||
float y = p.y;
|
float y = p.y;
|
||||||
float z = p.z;
|
float z = p.z;
|
||||||
float d = x*plane.x + y*plane.y + z*plane.z + plane.w;
|
float d = x*plane.x + y*plane.y + z*plane.z + plane.w;
|
||||||
return d;
|
return d;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void intersect(float3 p1, float3 p2, ref float3 split, float4 plane)
|
private static void intersect(float3 p1, float3 p2, ref float3 split, float4 plane)
|
||||||
{
|
{
|
||||||
|
|
|
@ -126,9 +126,9 @@ namespace OpenSim.Region.PhysicsModules.ConvexDecompositionDotNet
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Quaternion operator *(Quaternion a, float b)
|
public static Quaternion operator *(Quaternion a, float b)
|
||||||
{
|
{
|
||||||
return new Quaternion(a.x *b, a.y *b, a.z *b, a.w *b);
|
return new Quaternion(a.x *b, a.y *b, a.z *b, a.w *b);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Quaternion normalize(Quaternion a)
|
public static Quaternion normalize(Quaternion a)
|
||||||
{
|
{
|
||||||
|
|
|
@ -127,88 +127,88 @@ namespace OpenSim.Region.PhysicsModules.ConvexDecompositionDotNet
|
||||||
}
|
}
|
||||||
|
|
||||||
public static float4x4 Inverse(float4x4 m)
|
public static float4x4 Inverse(float4x4 m)
|
||||||
{
|
{
|
||||||
float4x4 d = new float4x4();
|
float4x4 d = new float4x4();
|
||||||
//float dst = d.x.x;
|
//float dst = d.x.x;
|
||||||
float[] tmp = new float[12]; // temp array for pairs
|
float[] tmp = new float[12]; // temp array for pairs
|
||||||
float[] src = new float[16]; // array of transpose source matrix
|
float[] src = new float[16]; // array of transpose source matrix
|
||||||
float det; // determinant
|
float det; // determinant
|
||||||
// transpose matrix
|
// transpose matrix
|
||||||
for (int i = 0; i < 4; i++)
|
for (int i = 0; i < 4; i++)
|
||||||
{
|
{
|
||||||
src[i] = m[i].x;
|
src[i] = m[i].x;
|
||||||
src[i + 4] = m[i].y;
|
src[i + 4] = m[i].y;
|
||||||
src[i + 8] = m[i].z;
|
src[i + 8] = m[i].z;
|
||||||
src[i + 12] = m[i].w;
|
src[i + 12] = m[i].w;
|
||||||
}
|
}
|
||||||
// calculate pairs for first 8 elements (cofactors)
|
// calculate pairs for first 8 elements (cofactors)
|
||||||
tmp[0] = src[10] * src[15];
|
tmp[0] = src[10] * src[15];
|
||||||
tmp[1] = src[11] * src[14];
|
tmp[1] = src[11] * src[14];
|
||||||
tmp[2] = src[9] * src[15];
|
tmp[2] = src[9] * src[15];
|
||||||
tmp[3] = src[11] * src[13];
|
tmp[3] = src[11] * src[13];
|
||||||
tmp[4] = src[9] * src[14];
|
tmp[4] = src[9] * src[14];
|
||||||
tmp[5] = src[10] * src[13];
|
tmp[5] = src[10] * src[13];
|
||||||
tmp[6] = src[8] * src[15];
|
tmp[6] = src[8] * src[15];
|
||||||
tmp[7] = src[11] * src[12];
|
tmp[7] = src[11] * src[12];
|
||||||
tmp[8] = src[8] * src[14];
|
tmp[8] = src[8] * src[14];
|
||||||
tmp[9] = src[10] * src[12];
|
tmp[9] = src[10] * src[12];
|
||||||
tmp[10] = src[8] * src[13];
|
tmp[10] = src[8] * src[13];
|
||||||
tmp[11] = src[9] * src[12];
|
tmp[11] = src[9] * src[12];
|
||||||
// calculate first 8 elements (cofactors)
|
// calculate first 8 elements (cofactors)
|
||||||
d.x.x = tmp[0]*src[5] + tmp[3]*src[6] + tmp[4]*src[7];
|
d.x.x = tmp[0]*src[5] + tmp[3]*src[6] + tmp[4]*src[7];
|
||||||
d.x.x -= tmp[1]*src[5] + tmp[2]*src[6] + tmp[5]*src[7];
|
d.x.x -= tmp[1]*src[5] + tmp[2]*src[6] + tmp[5]*src[7];
|
||||||
d.x.y = tmp[1]*src[4] + tmp[6]*src[6] + tmp[9]*src[7];
|
d.x.y = tmp[1]*src[4] + tmp[6]*src[6] + tmp[9]*src[7];
|
||||||
d.x.y -= tmp[0]*src[4] + tmp[7]*src[6] + tmp[8]*src[7];
|
d.x.y -= tmp[0]*src[4] + tmp[7]*src[6] + tmp[8]*src[7];
|
||||||
d.x.z = tmp[2]*src[4] + tmp[7]*src[5] + tmp[10]*src[7];
|
d.x.z = tmp[2]*src[4] + tmp[7]*src[5] + tmp[10]*src[7];
|
||||||
d.x.z -= tmp[3]*src[4] + tmp[6]*src[5] + tmp[11]*src[7];
|
d.x.z -= tmp[3]*src[4] + tmp[6]*src[5] + tmp[11]*src[7];
|
||||||
d.x.w = tmp[5]*src[4] + tmp[8]*src[5] + tmp[11]*src[6];
|
d.x.w = tmp[5]*src[4] + tmp[8]*src[5] + tmp[11]*src[6];
|
||||||
d.x.w -= tmp[4]*src[4] + tmp[9]*src[5] + tmp[10]*src[6];
|
d.x.w -= tmp[4]*src[4] + tmp[9]*src[5] + tmp[10]*src[6];
|
||||||
d.y.x = tmp[1]*src[1] + tmp[2]*src[2] + tmp[5]*src[3];
|
d.y.x = tmp[1]*src[1] + tmp[2]*src[2] + tmp[5]*src[3];
|
||||||
d.y.x -= tmp[0]*src[1] + tmp[3]*src[2] + tmp[4]*src[3];
|
d.y.x -= tmp[0]*src[1] + tmp[3]*src[2] + tmp[4]*src[3];
|
||||||
d.y.y = tmp[0]*src[0] + tmp[7]*src[2] + tmp[8]*src[3];
|
d.y.y = tmp[0]*src[0] + tmp[7]*src[2] + tmp[8]*src[3];
|
||||||
d.y.y -= tmp[1]*src[0] + tmp[6]*src[2] + tmp[9]*src[3];
|
d.y.y -= tmp[1]*src[0] + tmp[6]*src[2] + tmp[9]*src[3];
|
||||||
d.y.z = tmp[3]*src[0] + tmp[6]*src[1] + tmp[11]*src[3];
|
d.y.z = tmp[3]*src[0] + tmp[6]*src[1] + tmp[11]*src[3];
|
||||||
d.y.z -= tmp[2]*src[0] + tmp[7]*src[1] + tmp[10]*src[3];
|
d.y.z -= tmp[2]*src[0] + tmp[7]*src[1] + tmp[10]*src[3];
|
||||||
d.y.w = tmp[4]*src[0] + tmp[9]*src[1] + tmp[10]*src[2];
|
d.y.w = tmp[4]*src[0] + tmp[9]*src[1] + tmp[10]*src[2];
|
||||||
d.y.w -= tmp[5]*src[0] + tmp[8]*src[1] + tmp[11]*src[2];
|
d.y.w -= tmp[5]*src[0] + tmp[8]*src[1] + tmp[11]*src[2];
|
||||||
// calculate pairs for second 8 elements (cofactors)
|
// calculate pairs for second 8 elements (cofactors)
|
||||||
tmp[0] = src[2]*src[7];
|
tmp[0] = src[2]*src[7];
|
||||||
tmp[1] = src[3]*src[6];
|
tmp[1] = src[3]*src[6];
|
||||||
tmp[2] = src[1]*src[7];
|
tmp[2] = src[1]*src[7];
|
||||||
tmp[3] = src[3]*src[5];
|
tmp[3] = src[3]*src[5];
|
||||||
tmp[4] = src[1]*src[6];
|
tmp[4] = src[1]*src[6];
|
||||||
tmp[5] = src[2]*src[5];
|
tmp[5] = src[2]*src[5];
|
||||||
tmp[6] = src[0]*src[7];
|
tmp[6] = src[0]*src[7];
|
||||||
tmp[7] = src[3]*src[4];
|
tmp[7] = src[3]*src[4];
|
||||||
tmp[8] = src[0]*src[6];
|
tmp[8] = src[0]*src[6];
|
||||||
tmp[9] = src[2]*src[4];
|
tmp[9] = src[2]*src[4];
|
||||||
tmp[10] = src[0]*src[5];
|
tmp[10] = src[0]*src[5];
|
||||||
tmp[11] = src[1]*src[4];
|
tmp[11] = src[1]*src[4];
|
||||||
// calculate second 8 elements (cofactors)
|
// calculate second 8 elements (cofactors)
|
||||||
d.z.x = tmp[0]*src[13] + tmp[3]*src[14] + tmp[4]*src[15];
|
d.z.x = tmp[0]*src[13] + tmp[3]*src[14] + tmp[4]*src[15];
|
||||||
d.z.x -= tmp[1]*src[13] + tmp[2]*src[14] + tmp[5]*src[15];
|
d.z.x -= tmp[1]*src[13] + tmp[2]*src[14] + tmp[5]*src[15];
|
||||||
d.z.y = tmp[1]*src[12] + tmp[6]*src[14] + tmp[9]*src[15];
|
d.z.y = tmp[1]*src[12] + tmp[6]*src[14] + tmp[9]*src[15];
|
||||||
d.z.y -= tmp[0]*src[12] + tmp[7]*src[14] + tmp[8]*src[15];
|
d.z.y -= tmp[0]*src[12] + tmp[7]*src[14] + tmp[8]*src[15];
|
||||||
d.z.z = tmp[2]*src[12] + tmp[7]*src[13] + tmp[10]*src[15];
|
d.z.z = tmp[2]*src[12] + tmp[7]*src[13] + tmp[10]*src[15];
|
||||||
d.z.z -= tmp[3]*src[12] + tmp[6]*src[13] + tmp[11]*src[15];
|
d.z.z -= tmp[3]*src[12] + tmp[6]*src[13] + tmp[11]*src[15];
|
||||||
d.z.w = tmp[5]*src[12] + tmp[8]*src[13] + tmp[11]*src[14];
|
d.z.w = tmp[5]*src[12] + tmp[8]*src[13] + tmp[11]*src[14];
|
||||||
d.z.w-= tmp[4]*src[12] + tmp[9]*src[13] + tmp[10]*src[14];
|
d.z.w-= tmp[4]*src[12] + tmp[9]*src[13] + tmp[10]*src[14];
|
||||||
d.w.x = tmp[2]*src[10] + tmp[5]*src[11] + tmp[1]*src[9];
|
d.w.x = tmp[2]*src[10] + tmp[5]*src[11] + tmp[1]*src[9];
|
||||||
d.w.x-= tmp[4]*src[11] + tmp[0]*src[9] + tmp[3]*src[10];
|
d.w.x-= tmp[4]*src[11] + tmp[0]*src[9] + tmp[3]*src[10];
|
||||||
d.w.y = tmp[8]*src[11] + tmp[0]*src[8] + tmp[7]*src[10];
|
d.w.y = tmp[8]*src[11] + tmp[0]*src[8] + tmp[7]*src[10];
|
||||||
d.w.y-= tmp[6]*src[10] + tmp[9]*src[11] + tmp[1]*src[8];
|
d.w.y-= tmp[6]*src[10] + tmp[9]*src[11] + tmp[1]*src[8];
|
||||||
d.w.z = tmp[6]*src[9] + tmp[11]*src[11] + tmp[3]*src[8];
|
d.w.z = tmp[6]*src[9] + tmp[11]*src[11] + tmp[3]*src[8];
|
||||||
d.w.z-= tmp[10]*src[11] + tmp[2]*src[8] + tmp[7]*src[9];
|
d.w.z-= tmp[10]*src[11] + tmp[2]*src[8] + tmp[7]*src[9];
|
||||||
d.w.w = tmp[10]*src[10] + tmp[4]*src[8] + tmp[9]*src[9];
|
d.w.w = tmp[10]*src[10] + tmp[4]*src[8] + tmp[9]*src[9];
|
||||||
d.w.w-= tmp[8]*src[9] + tmp[11]*src[10] + tmp[5]*src[8];
|
d.w.w-= tmp[8]*src[9] + tmp[11]*src[10] + tmp[5]*src[8];
|
||||||
// calculate determinant
|
// calculate determinant
|
||||||
det = src[0] * d.x.x + src[1] * d.x.y + src[2] * d.x.z + src[3] * d.x.w;
|
det = src[0] * d.x.x + src[1] * d.x.y + src[2] * d.x.z + src[3] * d.x.w;
|
||||||
// calculate matrix inverse
|
// calculate matrix inverse
|
||||||
det = 1/det;
|
det = 1/det;
|
||||||
for (int j = 0; j < 4; j++)
|
for (int j = 0; j < 4; j++)
|
||||||
d[j] *= det;
|
d[j] *= det;
|
||||||
return d;
|
return d;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static float4x4 MatrixRigidInverse(float4x4 m)
|
public static float4x4 MatrixRigidInverse(float4x4 m)
|
||||||
{
|
{
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -9,14 +9,14 @@ using OpenSim.Region.Framework.Interfaces;
|
||||||
|
|
||||||
namespace OpenSim.Region.PhysicsModule.ODE
|
namespace OpenSim.Region.PhysicsModule.ODE
|
||||||
{
|
{
|
||||||
[Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "ODEPhysicsScene")]
|
[Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "ODEPhysicsScene")]
|
||||||
public class OdeModule : INonSharedRegionModule
|
public class OdeModule : INonSharedRegionModule
|
||||||
{
|
{
|
||||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
private bool m_Enabled = false;
|
private bool m_Enabled = false;
|
||||||
private IConfigSource m_config;
|
private IConfigSource m_config;
|
||||||
private OdeScene m_scene;
|
private OdeScene m_scene;
|
||||||
|
|
||||||
#region INonSharedRegionModule
|
#region INonSharedRegionModule
|
||||||
|
|
||||||
|
|
|
@ -496,12 +496,12 @@ namespace OpenSim.Region.PhysicsModule.ODE
|
||||||
|
|
||||||
private ODERayCastRequestManager m_rayCastManager;
|
private ODERayCastRequestManager m_rayCastManager;
|
||||||
|
|
||||||
public Scene m_frameWorkScene = null;
|
public Scene m_frameWorkScene = null;
|
||||||
|
|
||||||
public OdeScene(Scene pscene, IConfigSource psourceconfig, string pname, string pversion)
|
public OdeScene(Scene pscene, IConfigSource psourceconfig, string pname, string pversion)
|
||||||
{
|
{
|
||||||
m_config = psourceconfig;
|
m_config = psourceconfig;
|
||||||
m_frameWorkScene = pscene;
|
m_frameWorkScene = pscene;
|
||||||
|
|
||||||
EngineType = pname;
|
EngineType = pname;
|
||||||
PhysicsSceneName = EngineType + "/" + pscene.RegionInfo.RegionName;
|
PhysicsSceneName = EngineType + "/" + pscene.RegionInfo.RegionName;
|
||||||
|
@ -525,7 +525,7 @@ namespace OpenSim.Region.PhysicsModule.ODE
|
||||||
if (mesher == null)
|
if (mesher == null)
|
||||||
m_log.WarnFormat("[ODE SCENE]: No mesher in {0}. Things will not work well.", PhysicsSceneName);
|
m_log.WarnFormat("[ODE SCENE]: No mesher in {0}. Things will not work well.", PhysicsSceneName);
|
||||||
|
|
||||||
m_frameWorkScene.PhysicsEnabled = true;
|
m_frameWorkScene.PhysicsEnabled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -535,7 +535,7 @@ namespace OpenSim.Region.PhysicsModule.ODE
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private void Initialise(Vector3 regionExtent)
|
private void Initialise(Vector3 regionExtent)
|
||||||
{
|
{
|
||||||
WorldExtents.X = regionExtent.X;
|
WorldExtents.X = regionExtent.X;
|
||||||
m_regionWidth = (uint)regionExtent.X;
|
m_regionWidth = (uint)regionExtent.X;
|
||||||
WorldExtents.Y = regionExtent.Y;
|
WorldExtents.Y = regionExtent.Y;
|
||||||
m_regionHeight = (uint)regionExtent.Y;
|
m_regionHeight = (uint)regionExtent.Y;
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -11,14 +11,14 @@ using OpenSim.Region.Framework.Interfaces;
|
||||||
|
|
||||||
namespace OpenSim.Region.PhysicsModule.ubOde
|
namespace OpenSim.Region.PhysicsModule.ubOde
|
||||||
{
|
{
|
||||||
[Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "ubODEPhysicsScene")]
|
[Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "ubODEPhysicsScene")]
|
||||||
class ubOdeModule : INonSharedRegionModule
|
class ubOdeModule : INonSharedRegionModule
|
||||||
{
|
{
|
||||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
private static Dictionary<Scene, ODEScene> m_scenes = new Dictionary<Scene, ODEScene>();
|
private static Dictionary<Scene, ODEScene> m_scenes = new Dictionary<Scene, ODEScene>();
|
||||||
private bool m_Enabled = false;
|
private bool m_Enabled = false;
|
||||||
private IConfigSource m_config;
|
private IConfigSource m_config;
|
||||||
private bool OSOdeLib;
|
private bool OSOdeLib;
|
||||||
|
|
||||||
|
|
||||||
|
@ -80,7 +80,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
||||||
|
|
||||||
if(m_scenes.ContainsKey(scene)) // ???
|
if(m_scenes.ContainsKey(scene)) // ???
|
||||||
return;
|
return;
|
||||||
ODEScene newodescene = new ODEScene(scene, m_config, Name, Version, OSOdeLib);
|
ODEScene newodescene = new ODEScene(scene, m_config, Name, Version, OSOdeLib);
|
||||||
m_scenes[scene] = newodescene;
|
m_scenes[scene] = newodescene;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -330,7 +330,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
||||||
EngineType = pname;
|
EngineType = pname;
|
||||||
PhysicsSceneName = EngineType + "/" + pscene.RegionInfo.RegionName;
|
PhysicsSceneName = EngineType + "/" + pscene.RegionInfo.RegionName;
|
||||||
EngineName = pname + " " + pversion;
|
EngineName = pname + " " + pversion;
|
||||||
m_config = psourceconfig;
|
m_config = psourceconfig;
|
||||||
m_OSOdeLib = pOSOdeLib;
|
m_OSOdeLib = pOSOdeLib;
|
||||||
|
|
||||||
// m_OSOdeLib = false; //debug
|
// m_OSOdeLib = false; //debug
|
||||||
|
|
|
@ -58,7 +58,7 @@ namespace OpenSim.Region.PhysicsModule.ubODEMeshing
|
||||||
// Setting baseDir to a path will enable the dumping of raw files
|
// Setting baseDir to a path will enable the dumping of raw files
|
||||||
// raw files can be imported by blender so a visual inspection of the results can be done
|
// raw files can be imported by blender so a visual inspection of the results can be done
|
||||||
|
|
||||||
private bool m_Enabled = false;
|
private bool m_Enabled = false;
|
||||||
|
|
||||||
public static object diskLock = new object();
|
public static object diskLock = new object();
|
||||||
|
|
||||||
|
|
|
@ -807,8 +807,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
m_host.AddScriptLPS(1);
|
m_host.AddScriptLPS(1);
|
||||||
lock (Util.RandomClass)
|
lock (Util.RandomClass)
|
||||||
{
|
{
|
||||||
return Util.RandomClass.NextDouble() * mag;
|
return Util.RandomClass.NextDouble() * mag;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public LSL_Integer llFloor(double f)
|
public LSL_Integer llFloor(double f)
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -45,103 +45,103 @@ namespace OpenSim.Server.Base
|
||||||
/// us to add commands to the console to perform operations
|
/// us to add commands to the console to perform operations
|
||||||
/// on our repos and plugins
|
/// on our repos and plugins
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class CommandManager
|
public class CommandManager
|
||||||
{
|
{
|
||||||
public AddinRegistry PluginRegistry;
|
public AddinRegistry PluginRegistry;
|
||||||
protected PluginManager PluginManager;
|
protected PluginManager PluginManager;
|
||||||
|
|
||||||
public CommandManager(AddinRegistry registry)
|
public CommandManager(AddinRegistry registry)
|
||||||
{
|
{
|
||||||
PluginRegistry = registry;
|
PluginRegistry = registry;
|
||||||
PluginManager = new PluginManager(PluginRegistry);
|
PluginManager = new PluginManager(PluginRegistry);
|
||||||
AddManagementCommands();
|
AddManagementCommands();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void AddManagementCommands()
|
private void AddManagementCommands()
|
||||||
{
|
{
|
||||||
// add plugin
|
// add plugin
|
||||||
MainConsole.Instance.Commands.AddCommand("Plugin", true,
|
MainConsole.Instance.Commands.AddCommand("Plugin", true,
|
||||||
"plugin add", "plugin add \"plugin index\"",
|
"plugin add", "plugin add \"plugin index\"",
|
||||||
"Install plugin from repository.",
|
"Install plugin from repository.",
|
||||||
HandleConsoleInstallPlugin);
|
HandleConsoleInstallPlugin);
|
||||||
|
|
||||||
// remove plugin
|
// remove plugin
|
||||||
MainConsole.Instance.Commands.AddCommand("Plugin", true,
|
MainConsole.Instance.Commands.AddCommand("Plugin", true,
|
||||||
"plugin remove", "plugin remove \"plugin index\"",
|
"plugin remove", "plugin remove \"plugin index\"",
|
||||||
"Remove plugin from repository",
|
"Remove plugin from repository",
|
||||||
HandleConsoleUnInstallPlugin);
|
HandleConsoleUnInstallPlugin);
|
||||||
|
|
||||||
// list installed plugins
|
// list installed plugins
|
||||||
MainConsole.Instance.Commands.AddCommand("Plugin", true,
|
MainConsole.Instance.Commands.AddCommand("Plugin", true,
|
||||||
"plugin list installed",
|
"plugin list installed",
|
||||||
"plugin list installed","List install plugins",
|
"plugin list installed","List install plugins",
|
||||||
HandleConsoleListInstalledPlugin);
|
HandleConsoleListInstalledPlugin);
|
||||||
|
|
||||||
// list plugins available from registered repositories
|
// list plugins available from registered repositories
|
||||||
MainConsole.Instance.Commands.AddCommand("Plugin", true,
|
MainConsole.Instance.Commands.AddCommand("Plugin", true,
|
||||||
"plugin list available",
|
"plugin list available",
|
||||||
"plugin list available","List available plugins",
|
"plugin list available","List available plugins",
|
||||||
HandleConsoleListAvailablePlugin);
|
HandleConsoleListAvailablePlugin);
|
||||||
// List available updates
|
// List available updates
|
||||||
MainConsole.Instance.Commands.AddCommand("Plugin", true,
|
MainConsole.Instance.Commands.AddCommand("Plugin", true,
|
||||||
"plugin updates", "plugin updates","List availble updates",
|
"plugin updates", "plugin updates","List availble updates",
|
||||||
HandleConsoleListUpdates);
|
HandleConsoleListUpdates);
|
||||||
|
|
||||||
// Update plugin
|
// Update plugin
|
||||||
MainConsole.Instance.Commands.AddCommand("Plugin", true,
|
MainConsole.Instance.Commands.AddCommand("Plugin", true,
|
||||||
"plugin update", "plugin update \"plugin index\"","Update the plugin",
|
"plugin update", "plugin update \"plugin index\"","Update the plugin",
|
||||||
HandleConsoleUpdatePlugin);
|
HandleConsoleUpdatePlugin);
|
||||||
|
|
||||||
// Add repository
|
// Add repository
|
||||||
MainConsole.Instance.Commands.AddCommand("Repository", true,
|
MainConsole.Instance.Commands.AddCommand("Repository", true,
|
||||||
"repo add", "repo add \"url\"","Add repository",
|
"repo add", "repo add \"url\"","Add repository",
|
||||||
HandleConsoleAddRepo);
|
HandleConsoleAddRepo);
|
||||||
|
|
||||||
// Refresh repo
|
// Refresh repo
|
||||||
MainConsole.Instance.Commands.AddCommand("Repository", true,
|
MainConsole.Instance.Commands.AddCommand("Repository", true,
|
||||||
"repo refresh", "repo refresh \"url\"", "Sync with a registered repository",
|
"repo refresh", "repo refresh \"url\"", "Sync with a registered repository",
|
||||||
HandleConsoleGetRepo);
|
HandleConsoleGetRepo);
|
||||||
|
|
||||||
// Remove repository from registry
|
// Remove repository from registry
|
||||||
MainConsole.Instance.Commands.AddCommand("Repository", true,
|
MainConsole.Instance.Commands.AddCommand("Repository", true,
|
||||||
"repo remove",
|
"repo remove",
|
||||||
"repo remove \"[url | index]\"",
|
"repo remove \"[url | index]\"",
|
||||||
"Remove repository from registry",
|
"Remove repository from registry",
|
||||||
HandleConsoleRemoveRepo);
|
HandleConsoleRemoveRepo);
|
||||||
|
|
||||||
// Enable repo
|
// Enable repo
|
||||||
MainConsole.Instance.Commands.AddCommand("Repository", true,
|
MainConsole.Instance.Commands.AddCommand("Repository", true,
|
||||||
"repo enable", "repo enable \"[url | index]\"",
|
"repo enable", "repo enable \"[url | index]\"",
|
||||||
"Enable registered repository",
|
"Enable registered repository",
|
||||||
HandleConsoleEnableRepo);
|
HandleConsoleEnableRepo);
|
||||||
|
|
||||||
// Disable repo
|
// Disable repo
|
||||||
MainConsole.Instance.Commands.AddCommand("Repository", true,
|
MainConsole.Instance.Commands.AddCommand("Repository", true,
|
||||||
"repo disable", "repo disable\"[url | index]\"",
|
"repo disable", "repo disable\"[url | index]\"",
|
||||||
"Disable registered repository",
|
"Disable registered repository",
|
||||||
HandleConsoleDisableRepo);
|
HandleConsoleDisableRepo);
|
||||||
|
|
||||||
// List registered repositories
|
// List registered repositories
|
||||||
MainConsole.Instance.Commands.AddCommand("Repository", true,
|
MainConsole.Instance.Commands.AddCommand("Repository", true,
|
||||||
"repo list", "repo list",
|
"repo list", "repo list",
|
||||||
"List registered repositories",
|
"List registered repositories",
|
||||||
HandleConsoleListRepos);
|
HandleConsoleListRepos);
|
||||||
|
|
||||||
// *
|
// *
|
||||||
MainConsole.Instance.Commands.AddCommand("Plugin", true,
|
MainConsole.Instance.Commands.AddCommand("Plugin", true,
|
||||||
"plugin info", "plugin info \"plugin index\"","Show detailed information for plugin",
|
"plugin info", "plugin info \"plugin index\"","Show detailed information for plugin",
|
||||||
HandleConsoleShowAddinInfo);
|
HandleConsoleShowAddinInfo);
|
||||||
|
|
||||||
// Plugin disable
|
// Plugin disable
|
||||||
MainConsole.Instance.Commands.AddCommand("Plugin", true,
|
MainConsole.Instance.Commands.AddCommand("Plugin", true,
|
||||||
"plugin disable", "plugin disable \"plugin index\"",
|
"plugin disable", "plugin disable \"plugin index\"",
|
||||||
"Disable a plugin",
|
"Disable a plugin",
|
||||||
HandleConsoleDisablePlugin);
|
HandleConsoleDisablePlugin);
|
||||||
|
|
||||||
// Enable plugin
|
// Enable plugin
|
||||||
MainConsole.Instance.Commands.AddCommand("Plugin", true,
|
MainConsole.Instance.Commands.AddCommand("Plugin", true,
|
||||||
"plugin enable", "plugin enable \"plugin index\"",
|
"plugin enable", "plugin enable \"plugin index\"",
|
||||||
"Enable the selected plugin plugin",
|
"Enable the selected plugin plugin",
|
||||||
HandleConsoleEnablePlugin);
|
HandleConsoleEnablePlugin);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -355,5 +355,5 @@ namespace OpenSim.Server.Base
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -242,17 +242,17 @@ namespace OpenSim.Server.Base
|
||||||
className = parts[2];
|
className = parts[2];
|
||||||
}
|
}
|
||||||
|
|
||||||
// Handle extra string arguments in a more generic way
|
// Handle extra string arguments in a more generic way
|
||||||
if (dllName.Contains("@"))
|
if (dllName.Contains("@"))
|
||||||
{
|
{
|
||||||
string[] dllNameParts = dllName.Split(new char[] {'@'});
|
string[] dllNameParts = dllName.Split(new char[] {'@'});
|
||||||
dllName = dllNameParts[dllNameParts.Length - 1];
|
dllName = dllNameParts[dllNameParts.Length - 1];
|
||||||
List<Object> argList = new List<Object>(args);
|
List<Object> argList = new List<Object>(args);
|
||||||
for (int i = 0 ; i < dllNameParts.Length - 1 ; ++i)
|
for (int i = 0 ; i < dllNameParts.Length - 1 ; ++i)
|
||||||
argList.Add(dllNameParts[i]);
|
argList.Add(dllNameParts[i]);
|
||||||
|
|
||||||
args = argList.ToArray();
|
args = argList.ToArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
return LoadPlugin<T>(dllName, className, args);
|
return LoadPlugin<T>(dllName, className, args);
|
||||||
}
|
}
|
||||||
|
|
|
@ -175,9 +175,9 @@ namespace OpenSim.Services.AssetService
|
||||||
// m_log.DebugFormat(
|
// m_log.DebugFormat(
|
||||||
// "[ASSET SERVICE]: Storing asset {0} {1}, bytes {2}", asset.Name, asset.FullID, asset.Data.Length);
|
// "[ASSET SERVICE]: Storing asset {0} {1}, bytes {2}", asset.Name, asset.FullID, asset.Data.Length);
|
||||||
if (!m_Database.StoreAsset(asset))
|
if (!m_Database.StoreAsset(asset))
|
||||||
{
|
{
|
||||||
return UUID.Zero.ToString();
|
return UUID.Zero.ToString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// else
|
// else
|
||||||
// {
|
// {
|
||||||
|
|
|
@ -79,7 +79,7 @@ namespace OpenSim.Services.AuthenticationService
|
||||||
{
|
{
|
||||||
if (data.Data.ContainsKey("webLoginKey"))
|
if (data.Data.ContainsKey("webLoginKey"))
|
||||||
{
|
{
|
||||||
string key = data.Data["webLoginKey"].ToString();
|
string key = data.Data["webLoginKey"].ToString();
|
||||||
if (key == password)
|
if (key == password)
|
||||||
{
|
{
|
||||||
data.Data["webLoginKey"] = UUID.Zero.ToString();
|
data.Data["webLoginKey"] = UUID.Zero.ToString();
|
||||||
|
|
|
@ -63,7 +63,7 @@ namespace OpenSim.Services.Connectors
|
||||||
/// In this case, -1 is default timeout (100 seconds), not infinite.
|
/// In this case, -1 is default timeout (100 seconds), not infinite.
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
private int m_requestTimeoutSecs = -1;
|
private int m_requestTimeoutSecs = -1;
|
||||||
private string m_configName = "InventoryService";
|
private string m_configName = "InventoryService";
|
||||||
|
|
||||||
private const double CACHE_EXPIRATION_SECONDS = 20.0;
|
private const double CACHE_EXPIRATION_SECONDS = 20.0;
|
||||||
private static ExpiringCache<UUID, InventoryItemBase> m_ItemCache = new ExpiringCache<UUID,InventoryItemBase>();
|
private static ExpiringCache<UUID, InventoryItemBase> m_ItemCache = new ExpiringCache<UUID,InventoryItemBase>();
|
||||||
|
@ -80,7 +80,7 @@ namespace OpenSim.Services.Connectors
|
||||||
public XInventoryServicesConnector(IConfigSource source, string configName)
|
public XInventoryServicesConnector(IConfigSource source, string configName)
|
||||||
: base(source, configName)
|
: base(source, configName)
|
||||||
{
|
{
|
||||||
m_configName = configName;
|
m_configName = configName;
|
||||||
Initialise(source);
|
Initialise(source);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -315,8 +315,8 @@ namespace OpenSim.Services.Connectors
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (replyData["result"].ToString() == "null")
|
if (replyData["result"].ToString() == "null")
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
m_log.DebugFormat("[PRESENCE CONNECTOR]: Invalid reply (result not dictionary) received from presence server when querying for sessionID {0}", sessionID.ToString());
|
m_log.DebugFormat("[PRESENCE CONNECTOR]: Invalid reply (result not dictionary) received from presence server when querying for sessionID {0}", sessionID.ToString());
|
||||||
}
|
}
|
||||||
|
|
|
@ -301,11 +301,11 @@ namespace OpenSim.Services.HypergridService
|
||||||
|
|
||||||
// Everything is ok
|
// Everything is ok
|
||||||
|
|
||||||
if (!fromLogin)
|
if (!fromLogin)
|
||||||
{
|
{
|
||||||
// Update the perceived IP Address of our grid
|
// Update the perceived IP Address of our grid
|
||||||
m_log.DebugFormat("[USER AGENT SERVICE]: Gatekeeper sees me as {0}", myExternalIP);
|
m_log.DebugFormat("[USER AGENT SERVICE]: Gatekeeper sees me as {0}", myExternalIP);
|
||||||
}
|
}
|
||||||
|
|
||||||
travel.MyIpAddress = myExternalIP;
|
travel.MyIpAddress = myExternalIP;
|
||||||
|
|
||||||
|
|
|
@ -291,7 +291,7 @@ namespace OpenSim.Services.Interfaces
|
||||||
byte[] binary = new byte[vps.Length];
|
byte[] binary = new byte[vps.Length];
|
||||||
|
|
||||||
for (int i = 0; i < vps.Length; i++)
|
for (int i = 0; i < vps.Length; i++)
|
||||||
binary[i] = (byte)Convert.ToInt32(vps[i]);
|
binary[i] = (byte)Convert.ToInt32(vps[i]);
|
||||||
|
|
||||||
appearance.VisualParams = binary;
|
appearance.VisualParams = binary;
|
||||||
}
|
}
|
||||||
|
|
|
@ -180,13 +180,13 @@ namespace OpenSim.Services.LLLoginService
|
||||||
string hgInvServicePlugin = m_LoginServerConfig.GetString("HGInventoryServicePlugin", String.Empty);
|
string hgInvServicePlugin = m_LoginServerConfig.GetString("HGInventoryServicePlugin", String.Empty);
|
||||||
if (hgInvServicePlugin != string.Empty)
|
if (hgInvServicePlugin != string.Empty)
|
||||||
{
|
{
|
||||||
// TODO: Remove HGInventoryServiceConstructorArg after 0.9 release
|
// TODO: Remove HGInventoryServiceConstructorArg after 0.9 release
|
||||||
string hgInvServiceArg = m_LoginServerConfig.GetString("HGInventoryServiceConstructorArg", String.Empty);
|
string hgInvServiceArg = m_LoginServerConfig.GetString("HGInventoryServiceConstructorArg", String.Empty);
|
||||||
if (hgInvServiceArg != String.Empty)
|
if (hgInvServiceArg != String.Empty)
|
||||||
{
|
{
|
||||||
m_log.Warn("[LLOGIN SERVICE]: You are using HGInventoryServiceConstructorArg, which is deprecated. See example file for correct syntax.");
|
m_log.Warn("[LLOGIN SERVICE]: You are using HGInventoryServiceConstructorArg, which is deprecated. See example file for correct syntax.");
|
||||||
hgInvServicePlugin = hgInvServiceArg + "@" + hgInvServicePlugin;
|
hgInvServicePlugin = hgInvServiceArg + "@" + hgInvServicePlugin;
|
||||||
}
|
}
|
||||||
m_HGInventoryService = ServerUtils.LoadPlugin<IInventoryService>(hgInvServicePlugin, args);
|
m_HGInventoryService = ServerUtils.LoadPlugin<IInventoryService>(hgInvServicePlugin, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -28,45 +28,45 @@ using System.Collections.Specialized;
|
||||||
|
|
||||||
namespace Prebuild.Core.Attributes
|
namespace Prebuild.Core.Attributes
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct, AllowMultiple=true)]
|
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct, AllowMultiple=true)]
|
||||||
public sealed class DataNodeAttribute : Attribute
|
public sealed class DataNodeAttribute : Attribute
|
||||||
{
|
{
|
||||||
#region Fields
|
#region Fields
|
||||||
|
|
||||||
private string m_Name = "unknown";
|
private string m_Name = "unknown";
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Constructors
|
#region Constructors
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of the <see cref="DataNodeAttribute"/> class.
|
/// Initializes a new instance of the <see cref="DataNodeAttribute"/> class.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="name">The name.</param>
|
/// <param name="name">The name.</param>
|
||||||
public DataNodeAttribute(string name)
|
public DataNodeAttribute(string name)
|
||||||
{
|
{
|
||||||
m_Name = name;
|
m_Name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Properties
|
#region Properties
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the name.
|
/// Gets the name.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The name.</value>
|
/// <value>The name.</value>
|
||||||
public string Name
|
public string Name
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return m_Name;
|
return m_Name;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,45 +27,45 @@ using System;
|
||||||
|
|
||||||
namespace Prebuild.Core.Attributes
|
namespace Prebuild.Core.Attributes
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[AttributeUsage(AttributeTargets.Field)]
|
[AttributeUsage(AttributeTargets.Field)]
|
||||||
public sealed class OptionNodeAttribute : Attribute
|
public sealed class OptionNodeAttribute : Attribute
|
||||||
{
|
{
|
||||||
#region Fields
|
#region Fields
|
||||||
|
|
||||||
private string m_NodeName;
|
private string m_NodeName;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Constructors
|
#region Constructors
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of the <see cref="OptionNodeAttribute"/> class.
|
/// Initializes a new instance of the <see cref="OptionNodeAttribute"/> class.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="nodeName">Name of the node.</param>
|
/// <param name="nodeName">Name of the node.</param>
|
||||||
public OptionNodeAttribute(string nodeName)
|
public OptionNodeAttribute(string nodeName)
|
||||||
{
|
{
|
||||||
m_NodeName = nodeName;
|
m_NodeName = nodeName;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Properties
|
#region Properties
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the name of the node.
|
/// Gets the name of the node.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The name of the node.</value>
|
/// <value>The name of the node.</value>
|
||||||
public string NodeName
|
public string NodeName
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return m_NodeName;
|
return m_NodeName;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,45 +27,45 @@ using System;
|
||||||
|
|
||||||
namespace Prebuild.Core.Attributes
|
namespace Prebuild.Core.Attributes
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct)]
|
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct)]
|
||||||
public sealed class TargetAttribute : Attribute
|
public sealed class TargetAttribute : Attribute
|
||||||
{
|
{
|
||||||
#region Fields
|
#region Fields
|
||||||
|
|
||||||
private string m_Name;
|
private string m_Name;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Constructors
|
#region Constructors
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of the <see cref="TargetAttribute"/> class.
|
/// Initializes a new instance of the <see cref="TargetAttribute"/> class.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="name">The name.</param>
|
/// <param name="name">The name.</param>
|
||||||
public TargetAttribute(string name)
|
public TargetAttribute(string name)
|
||||||
{
|
{
|
||||||
m_Name = name;
|
m_Name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Properties
|
#region Properties
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the name.
|
/// Gets the name.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The name.</value>
|
/// <value>The name.</value>
|
||||||
public string Name
|
public string Name
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return m_Name;
|
return m_Name;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,58 +28,58 @@ using System.Runtime.Serialization;
|
||||||
|
|
||||||
namespace Prebuild.Core
|
namespace Prebuild.Core
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Serializable()]
|
[Serializable()]
|
||||||
public class FatalException : Exception
|
public class FatalException : Exception
|
||||||
{
|
{
|
||||||
#region Constructors
|
#region Constructors
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of the <see cref="FatalException"/> class.
|
/// Initializes a new instance of the <see cref="FatalException"/> class.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public FatalException()
|
public FatalException()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of the <see cref="FatalException"/> class.
|
/// Initializes a new instance of the <see cref="FatalException"/> class.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="format">The format.</param>
|
/// <param name="format">The format.</param>
|
||||||
/// <param name="args">The args.</param>
|
/// <param name="args">The args.</param>
|
||||||
public FatalException(string format, params object[] args)
|
public FatalException(string format, params object[] args)
|
||||||
: base(String.Format(format, args))
|
: base(String.Format(format, args))
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Exception with specified string
|
/// Exception with specified string
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="message">Exception message</param>
|
/// <param name="message">Exception message</param>
|
||||||
public FatalException(string message): base(message)
|
public FatalException(string message): base(message)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="message"></param>
|
/// <param name="message"></param>
|
||||||
/// <param name="exception"></param>
|
/// <param name="exception"></param>
|
||||||
public FatalException(string message, Exception exception) : base(message, exception)
|
public FatalException(string message, Exception exception) : base(message, exception)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="info"></param>
|
/// <param name="info"></param>
|
||||||
/// <param name="context"></param>
|
/// <param name="context"></param>
|
||||||
protected FatalException(SerializationInfo info, StreamingContext context) : base( info, context )
|
protected FatalException(SerializationInfo info, StreamingContext context) : base( info, context )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,20 +28,20 @@ using System.Xml;
|
||||||
|
|
||||||
namespace Prebuild.Core.Interfaces
|
namespace Prebuild.Core.Interfaces
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public interface IDataNode
|
public interface IDataNode
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the parent.
|
/// Gets or sets the parent.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The parent.</value>
|
/// <value>The parent.</value>
|
||||||
IDataNode Parent { get; set; }
|
IDataNode Parent { get; set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Parses the specified node.
|
/// Parses the specified node.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="node">The node.</param>
|
/// <param name="node">The node.</param>
|
||||||
void Parse(XmlNode node);
|
void Parse(XmlNode node);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,25 +27,25 @@ using System;
|
||||||
|
|
||||||
namespace Prebuild.Core.Interfaces
|
namespace Prebuild.Core.Interfaces
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public interface ITarget
|
public interface ITarget
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Writes the specified kern.
|
/// Writes the specified kern.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="kern">The kern.</param>
|
/// <param name="kern">The kern.</param>
|
||||||
void Write(Kernel kern);
|
void Write(Kernel kern);
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Cleans the specified kern.
|
/// Cleans the specified kern.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="kern">The kern.</param>
|
/// <param name="kern">The kern.</param>
|
||||||
void Clean(Kernel kern);
|
void Clean(Kernel kern);
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the name.
|
/// Gets the name.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The name.</value>
|
/// <value>The name.</value>
|
||||||
string Name { get; }
|
string Name { get; }
|
||||||
}
|
}
|
||||||
}
|
}
|
File diff suppressed because it is too large
Load Diff
|
@ -32,56 +32,56 @@ using Prebuild.Core.Utilities;
|
||||||
|
|
||||||
namespace Prebuild.Core.Nodes
|
namespace Prebuild.Core.Nodes
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DataNode("Author")]
|
[DataNode("Author")]
|
||||||
public class AuthorNode : DataNode
|
public class AuthorNode : DataNode
|
||||||
{
|
{
|
||||||
#region Fields
|
#region Fields
|
||||||
|
|
||||||
private string m_Signature;
|
private string m_Signature;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Properties
|
#region Properties
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the signature.
|
/// Gets the signature.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The signature.</value>
|
/// <value>The signature.</value>
|
||||||
public string Signature
|
public string Signature
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return m_Signature;
|
return m_Signature;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Public Methods
|
#region Public Methods
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Parses the specified node.
|
/// Parses the specified node.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="node">The node.</param>
|
/// <param name="node">The node.</param>
|
||||||
public override void Parse(XmlNode node)
|
public override void Parse(XmlNode node)
|
||||||
{
|
{
|
||||||
if( node == null )
|
if( node == null )
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("node");
|
throw new ArgumentNullException("node");
|
||||||
}
|
}
|
||||||
|
|
||||||
m_Signature = Helper.InterpolateForEnvironmentVariables(node.InnerText);
|
m_Signature = Helper.InterpolateForEnvironmentVariables(node.InnerText);
|
||||||
if(m_Signature == null)
|
if(m_Signature == null)
|
||||||
{
|
{
|
||||||
m_Signature = "";
|
m_Signature = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
m_Signature = m_Signature.Trim();
|
m_Signature = m_Signature.Trim();
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,40 +35,40 @@ namespace Prebuild.Core.Nodes
|
||||||
[DataNode("Cleanup")]
|
[DataNode("Cleanup")]
|
||||||
public class CleanupNode : DataNode
|
public class CleanupNode : DataNode
|
||||||
{
|
{
|
||||||
#region Fields
|
#region Fields
|
||||||
|
|
||||||
private List<CleanFilesNode> m_CleanFiles = new List<CleanFilesNode>();
|
private List<CleanFilesNode> m_CleanFiles = new List<CleanFilesNode>();
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Properties
|
#region Properties
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the signature.
|
/// Gets the signature.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The signature.</value>
|
/// <value>The signature.</value>
|
||||||
public List<CleanFilesNode> CleanFiles
|
public List<CleanFilesNode> CleanFiles
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return m_CleanFiles;
|
return m_CleanFiles;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Public Methods
|
#region Public Methods
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Parses the specified node.
|
/// Parses the specified node.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="node">The node.</param>
|
/// <param name="node">The node.</param>
|
||||||
public override void Parse(XmlNode node)
|
public override void Parse(XmlNode node)
|
||||||
{
|
{
|
||||||
if( node == null )
|
if( node == null )
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("node");
|
throw new ArgumentNullException("node");
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (XmlNode child in node.ChildNodes)
|
foreach (XmlNode child in node.ChildNodes)
|
||||||
{
|
{
|
||||||
|
@ -78,8 +78,8 @@ namespace Prebuild.Core.Nodes
|
||||||
m_CleanFiles.Add((CleanFilesNode)dataNode);
|
m_CleanFiles.Add((CleanFilesNode)dataNode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -32,185 +32,185 @@ using Prebuild.Core.Utilities;
|
||||||
|
|
||||||
namespace Prebuild.Core.Nodes
|
namespace Prebuild.Core.Nodes
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DataNode("Configuration")]
|
[DataNode("Configuration")]
|
||||||
public class ConfigurationNode : DataNode, ICloneable, IComparable
|
public class ConfigurationNode : DataNode, ICloneable, IComparable
|
||||||
{
|
{
|
||||||
#region Fields
|
#region Fields
|
||||||
|
|
||||||
private string m_Name = "unknown";
|
private string m_Name = "unknown";
|
||||||
private string m_Platform = "AnyCPU";
|
private string m_Platform = "AnyCPU";
|
||||||
private OptionsNode m_Options;
|
private OptionsNode m_Options;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Constructors
|
#region Constructors
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of the <see cref="ConfigurationNode"/> class.
|
/// Initializes a new instance of the <see cref="ConfigurationNode"/> class.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public ConfigurationNode()
|
public ConfigurationNode()
|
||||||
{
|
{
|
||||||
m_Options = new OptionsNode();
|
m_Options = new OptionsNode();
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Properties
|
#region Properties
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the parent.
|
/// Gets or sets the parent.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The parent.</value>
|
/// <value>The parent.</value>
|
||||||
public override IDataNode Parent
|
public override IDataNode Parent
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return base.Parent;
|
return base.Parent;
|
||||||
}
|
}
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
base.Parent = value;
|
base.Parent = value;
|
||||||
if(base.Parent is SolutionNode)
|
if(base.Parent is SolutionNode)
|
||||||
{
|
{
|
||||||
SolutionNode node = (SolutionNode)base.Parent;
|
SolutionNode node = (SolutionNode)base.Parent;
|
||||||
if(node != null && node.Options != null)
|
if(node != null && node.Options != null)
|
||||||
{
|
{
|
||||||
node.Options.CopyTo(m_Options);
|
node.Options.CopyTo(m_Options);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Identifies the platform for this specific configuration.
|
/// Identifies the platform for this specific configuration.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Platform
|
public string Platform
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return m_Platform;
|
return m_Platform;
|
||||||
}
|
}
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
switch ((value + "").ToLower())
|
switch ((value + "").ToLower())
|
||||||
{
|
{
|
||||||
case "x86":
|
case "x86":
|
||||||
case "x64":
|
case "x64":
|
||||||
m_Platform = value;
|
m_Platform = value;
|
||||||
break;
|
break;
|
||||||
case "itanium":
|
case "itanium":
|
||||||
m_Platform = "Itanium";
|
m_Platform = "Itanium";
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
m_Platform = "AnyCPU";
|
m_Platform = "AnyCPU";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the name.
|
/// Gets the name.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The name.</value>
|
/// <value>The name.</value>
|
||||||
public string Name
|
public string Name
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return m_Name;
|
return m_Name;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the name and platform for the configuration.
|
/// Gets the name and platform for the configuration.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The name and platform.</value>
|
/// <value>The name and platform.</value>
|
||||||
public string NameAndPlatform
|
public string NameAndPlatform
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
string platform = m_Platform;
|
string platform = m_Platform;
|
||||||
if (platform == "AnyCPU")
|
if (platform == "AnyCPU")
|
||||||
platform = "Any CPU";
|
platform = "Any CPU";
|
||||||
|
|
||||||
return String.Format("{0}|{1}", m_Name, platform);
|
return String.Format("{0}|{1}", m_Name, platform);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the options.
|
/// Gets or sets the options.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The options.</value>
|
/// <value>The options.</value>
|
||||||
public OptionsNode Options
|
public OptionsNode Options
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return m_Options;
|
return m_Options;
|
||||||
}
|
}
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
m_Options = value;
|
m_Options = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Public Methods
|
#region Public Methods
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Parses the specified node.
|
/// Parses the specified node.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="node">The node.</param>
|
/// <param name="node">The node.</param>
|
||||||
public override void Parse(XmlNode node)
|
public override void Parse(XmlNode node)
|
||||||
{
|
{
|
||||||
m_Name = Helper.AttributeValue(node, "name", m_Name);
|
m_Name = Helper.AttributeValue(node, "name", m_Name);
|
||||||
Platform = Helper.AttributeValue(node, "platform", m_Platform);
|
Platform = Helper.AttributeValue(node, "platform", m_Platform);
|
||||||
|
|
||||||
if (node == null)
|
if (node == null)
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("node");
|
throw new ArgumentNullException("node");
|
||||||
}
|
}
|
||||||
foreach(XmlNode child in node.ChildNodes)
|
foreach(XmlNode child in node.ChildNodes)
|
||||||
{
|
{
|
||||||
IDataNode dataNode = Kernel.Instance.ParseNode(child, this);
|
IDataNode dataNode = Kernel.Instance.ParseNode(child, this);
|
||||||
if(dataNode is OptionsNode)
|
if(dataNode is OptionsNode)
|
||||||
{
|
{
|
||||||
((OptionsNode)dataNode).CopyTo(m_Options);
|
((OptionsNode)dataNode).CopyTo(m_Options);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Copies to.
|
/// Copies to.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="conf">The conf.</param>
|
/// <param name="conf">The conf.</param>
|
||||||
public void CopyTo(ConfigurationNode conf)
|
public void CopyTo(ConfigurationNode conf)
|
||||||
{
|
{
|
||||||
m_Options.CopyTo(conf.m_Options);
|
m_Options.CopyTo(conf.m_Options);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region ICloneable Members
|
#region ICloneable Members
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Creates a new object that is a copy of the current instance.
|
/// Creates a new object that is a copy of the current instance.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns>
|
/// <returns>
|
||||||
/// A new object that is a copy of this instance.
|
/// A new object that is a copy of this instance.
|
||||||
/// </returns>
|
/// </returns>
|
||||||
public object Clone()
|
public object Clone()
|
||||||
{
|
{
|
||||||
ConfigurationNode ret = new ConfigurationNode();
|
ConfigurationNode ret = new ConfigurationNode();
|
||||||
ret.m_Name = m_Name;
|
ret.m_Name = m_Name;
|
||||||
ret.m_Platform = m_Platform;
|
ret.m_Platform = m_Platform;
|
||||||
m_Options.CopyTo(ret.m_Options);
|
m_Options.CopyTo(ret.m_Options);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region IComparable Members
|
#region IComparable Members
|
||||||
|
|
||||||
|
@ -221,5 +221,5 @@ namespace Prebuild.Core.Nodes
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,45 +27,45 @@ using System.Collections.Generic;
|
||||||
|
|
||||||
namespace Prebuild.Core.Nodes
|
namespace Prebuild.Core.Nodes
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Implements a specialized list of configuration nodes which allows for lookup via
|
/// Implements a specialized list of configuration nodes which allows for lookup via
|
||||||
/// configuration name and platform.
|
/// configuration name and platform.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class ConfigurationNodeCollection : List<ConfigurationNode>
|
public class ConfigurationNodeCollection : List<ConfigurationNode>
|
||||||
{
|
{
|
||||||
#region Properties
|
#region Properties
|
||||||
|
|
||||||
public ConfigurationNode this[string nameAndPlatform]
|
public ConfigurationNode this[string nameAndPlatform]
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
foreach (ConfigurationNode configurationNode in this)
|
foreach (ConfigurationNode configurationNode in this)
|
||||||
{
|
{
|
||||||
if (configurationNode.NameAndPlatform == nameAndPlatform)
|
if (configurationNode.NameAndPlatform == nameAndPlatform)
|
||||||
{
|
{
|
||||||
return configurationNode;
|
return configurationNode;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
// See if the node
|
// See if the node
|
||||||
ConfigurationNode configurationNode = this[nameAndPlatform];
|
ConfigurationNode configurationNode = this[nameAndPlatform];
|
||||||
|
|
||||||
if (configurationNode != null)
|
if (configurationNode != null)
|
||||||
{
|
{
|
||||||
this[IndexOf(configurationNode)] = value;
|
this[IndexOf(configurationNode)] = value;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Add(value);
|
Add(value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,86 +32,86 @@ using System.IO;
|
||||||
|
|
||||||
namespace Prebuild.Core.Nodes
|
namespace Prebuild.Core.Nodes
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public abstract class DataNode : IDataNode
|
public abstract class DataNode : IDataNode
|
||||||
{
|
{
|
||||||
#region Fields
|
#region Fields
|
||||||
|
|
||||||
private IDataNode parent;
|
private IDataNode parent;
|
||||||
string[] m_WebTypes = new string[] { "aspx", "ascx", "master", "ashx", "asmx" };
|
string[] m_WebTypes = new string[] { "aspx", "ascx", "master", "ashx", "asmx" };
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region IDataNode Members
|
#region IDataNode Members
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the parent.
|
/// Gets or sets the parent.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The parent.</value>
|
/// <value>The parent.</value>
|
||||||
public virtual IDataNode Parent
|
public virtual IDataNode Parent
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return parent;
|
return parent;
|
||||||
}
|
}
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
parent = value;
|
parent = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public string[] WebTypes
|
public string[] WebTypes
|
||||||
{
|
{
|
||||||
get { return m_WebTypes; }
|
get { return m_WebTypes; }
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Parses the specified node.
|
/// Parses the specified node.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="node">The node.</param>
|
/// <param name="node">The node.</param>
|
||||||
public virtual void Parse(XmlNode node)
|
public virtual void Parse(XmlNode node)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
public BuildAction GetBuildActionByFileName(string fileName)
|
public BuildAction GetBuildActionByFileName(string fileName)
|
||||||
{
|
{
|
||||||
string extension = Path.GetExtension(fileName).ToLower();
|
string extension = Path.GetExtension(fileName).ToLower();
|
||||||
foreach (string type in WebTypes)
|
foreach (string type in WebTypes)
|
||||||
{
|
{
|
||||||
if (extension == type)
|
if (extension == type)
|
||||||
return BuildAction.Content;
|
return BuildAction.Content;
|
||||||
}
|
}
|
||||||
return BuildAction.Compile;
|
return BuildAction.Compile;
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Parses the file type to figure out what type it is
|
/// Parses the file type to figure out what type it is
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public SubType GetSubTypeByFileName(string fileName)
|
public SubType GetSubTypeByFileName(string fileName)
|
||||||
{
|
{
|
||||||
string extension = System.IO.Path.GetExtension(fileName).ToLower();
|
string extension = System.IO.Path.GetExtension(fileName).ToLower();
|
||||||
string designer = String.Format(".designer{0}", extension);
|
string designer = String.Format(".designer{0}", extension);
|
||||||
string path = fileName.ToLower();
|
string path = fileName.ToLower();
|
||||||
if (extension == ".resx")
|
if (extension == ".resx")
|
||||||
{
|
{
|
||||||
return SubType.Designer;
|
return SubType.Designer;
|
||||||
}
|
}
|
||||||
else if (path.EndsWith(".settings"))
|
else if (path.EndsWith(".settings"))
|
||||||
{
|
{
|
||||||
return SubType.Settings;
|
return SubType.Settings;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
||||||
foreach (string type in WebTypes)
|
foreach (string type in WebTypes)
|
||||||
{
|
{
|
||||||
if (path.EndsWith(type))
|
if (path.EndsWith(type))
|
||||||
{
|
{
|
||||||
return SubType.CodeBehind;
|
return SubType.CodeBehind;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return SubType.Code;
|
return SubType.Code;
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,56 +32,56 @@ using Prebuild.Core.Utilities;
|
||||||
|
|
||||||
namespace Prebuild.Core.Nodes
|
namespace Prebuild.Core.Nodes
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The object representing the /Prebuild/Solution/Project/Description element
|
/// The object representing the /Prebuild/Solution/Project/Description element
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DataNode("Description")]
|
[DataNode("Description")]
|
||||||
public class DescriptionNode : DataNode
|
public class DescriptionNode : DataNode
|
||||||
{
|
{
|
||||||
#region Fields
|
#region Fields
|
||||||
|
|
||||||
private string m_Value;
|
private string m_Value;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Properties
|
#region Properties
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the description Value.
|
/// Gets the description Value.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The description Value.</value>
|
/// <value>The description Value.</value>
|
||||||
public string Value
|
public string Value
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return m_Value;
|
return m_Value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Public Methods
|
#region Public Methods
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Parses the specified node.
|
/// Parses the specified node.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="node">The node.</param>
|
/// <param name="node">The node.</param>
|
||||||
public override void Parse(XmlNode node)
|
public override void Parse(XmlNode node)
|
||||||
{
|
{
|
||||||
if( node == null )
|
if( node == null )
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("node");
|
throw new ArgumentNullException("node");
|
||||||
}
|
}
|
||||||
|
|
||||||
m_Value = Helper.InterpolateForEnvironmentVariables(node.InnerText);
|
m_Value = Helper.InterpolateForEnvironmentVariables(node.InnerText);
|
||||||
if(m_Value == null)
|
if(m_Value == null)
|
||||||
{
|
{
|
||||||
m_Value = "";
|
m_Value = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
m_Value = m_Value.Trim();
|
m_Value = m_Value.Trim();
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,31 +32,31 @@ using Prebuild.Core.Utilities;
|
||||||
|
|
||||||
namespace Prebuild.Core.Nodes
|
namespace Prebuild.Core.Nodes
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DataNode("Exclude")]
|
[DataNode("Exclude")]
|
||||||
public class ExcludeNode : DataNode
|
public class ExcludeNode : DataNode
|
||||||
{
|
{
|
||||||
#region Fields
|
#region Fields
|
||||||
|
|
||||||
private string m_Pattern = "";
|
private string m_Pattern = "";
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Properties
|
#region Properties
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the name.
|
/// Gets the name.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The name.</value>
|
/// <value>The name.</value>
|
||||||
public string Name
|
public string Name
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return m_Pattern;
|
return m_Pattern;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the pattern.
|
/// Gets the pattern.
|
||||||
|
@ -72,18 +72,18 @@ namespace Prebuild.Core.Nodes
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Public Methods
|
#region Public Methods
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Parses the specified node.
|
/// Parses the specified node.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="node">The node.</param>
|
/// <param name="node">The node.</param>
|
||||||
public override void Parse(XmlNode node)
|
public override void Parse(XmlNode node)
|
||||||
{
|
{
|
||||||
m_Pattern = Helper.AttributeValue( node, "name", m_Pattern );
|
m_Pattern = Helper.AttributeValue( node, "name", m_Pattern );
|
||||||
m_Pattern = Helper.AttributeValue(node, "pattern", m_Pattern );
|
m_Pattern = Helper.AttributeValue(node, "pattern", m_Pattern );
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,190 +34,190 @@ using Prebuild.Core.Targets;
|
||||||
|
|
||||||
namespace Prebuild.Core.Nodes
|
namespace Prebuild.Core.Nodes
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public enum BuildAction
|
public enum BuildAction
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
None,
|
None,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Compile,
|
Compile,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Content,
|
Content,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
EmbeddedResource,
|
EmbeddedResource,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
ApplicationDefinition,
|
ApplicationDefinition,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Page,
|
Page,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Copy
|
Copy
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public enum SubType
|
public enum SubType
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Code,
|
Code,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Component,
|
Component,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Designer,
|
Designer,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Form,
|
Form,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Settings,
|
Settings,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
UserControl,
|
UserControl,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
CodeBehind,
|
CodeBehind,
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum CopyToOutput
|
public enum CopyToOutput
|
||||||
{
|
{
|
||||||
Never,
|
Never,
|
||||||
Always,
|
Always,
|
||||||
PreserveNewest
|
PreserveNewest
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DataNode("File")]
|
[DataNode("File")]
|
||||||
public class FileNode : DataNode
|
public class FileNode : DataNode
|
||||||
{
|
{
|
||||||
#region Fields
|
#region Fields
|
||||||
|
|
||||||
private string m_Path;
|
private string m_Path;
|
||||||
private string m_ResourceName = "";
|
private string m_ResourceName = "";
|
||||||
private BuildAction? m_BuildAction;
|
private BuildAction? m_BuildAction;
|
||||||
private bool m_Valid;
|
private bool m_Valid;
|
||||||
private SubType? m_SubType;
|
private SubType? m_SubType;
|
||||||
private CopyToOutput m_CopyToOutput = CopyToOutput.Never;
|
private CopyToOutput m_CopyToOutput = CopyToOutput.Never;
|
||||||
private bool m_Link = false;
|
private bool m_Link = false;
|
||||||
private string m_LinkPath = string.Empty;
|
private string m_LinkPath = string.Empty;
|
||||||
private bool m_PreservePath = false;
|
private bool m_PreservePath = false;
|
||||||
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Properties
|
#region Properties
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Path
|
public string Path
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return m_Path;
|
return m_Path;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string ResourceName
|
public string ResourceName
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return m_ResourceName;
|
return m_ResourceName;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public BuildAction BuildAction
|
public BuildAction BuildAction
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
if (m_BuildAction != null)
|
if (m_BuildAction != null)
|
||||||
return m_BuildAction.Value;
|
return m_BuildAction.Value;
|
||||||
else
|
else
|
||||||
return GetBuildActionByFileName(this.Path);
|
return GetBuildActionByFileName(this.Path);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public CopyToOutput CopyToOutput
|
public CopyToOutput CopyToOutput
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return this.m_CopyToOutput;
|
return this.m_CopyToOutput;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool IsLink
|
public bool IsLink
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return this.m_Link;
|
return this.m_Link;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public string LinkPath
|
public string LinkPath
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return this.m_LinkPath;
|
return this.m_LinkPath;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public SubType SubType
|
public SubType SubType
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
if (m_SubType != null)
|
if (m_SubType != null)
|
||||||
return m_SubType.Value;
|
return m_SubType.Value;
|
||||||
else
|
else
|
||||||
return GetSubTypeByFileName(this.Path);
|
return GetSubTypeByFileName(this.Path);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool IsValid
|
public bool IsValid
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return m_Valid;
|
return m_Valid;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
|
@ -232,61 +232,61 @@ namespace Prebuild.Core.Nodes
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Public Methods
|
#region Public Methods
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="node"></param>
|
/// <param name="node"></param>
|
||||||
public override void Parse(XmlNode node)
|
public override void Parse(XmlNode node)
|
||||||
{
|
{
|
||||||
string buildAction = Helper.AttributeValue(node, "buildAction", String.Empty);
|
string buildAction = Helper.AttributeValue(node, "buildAction", String.Empty);
|
||||||
if (buildAction != string.Empty)
|
if (buildAction != string.Empty)
|
||||||
m_BuildAction = (BuildAction)Enum.Parse(typeof(BuildAction), buildAction);
|
m_BuildAction = (BuildAction)Enum.Parse(typeof(BuildAction), buildAction);
|
||||||
string subType = Helper.AttributeValue(node, "subType", string.Empty);
|
string subType = Helper.AttributeValue(node, "subType", string.Empty);
|
||||||
if (subType != String.Empty)
|
if (subType != String.Empty)
|
||||||
m_SubType = (SubType)Enum.Parse(typeof(SubType), subType);
|
m_SubType = (SubType)Enum.Parse(typeof(SubType), subType);
|
||||||
|
|
||||||
Console.WriteLine("[FileNode]:BuildAction is {0}", buildAction);
|
Console.WriteLine("[FileNode]:BuildAction is {0}", buildAction);
|
||||||
|
|
||||||
|
|
||||||
m_ResourceName = Helper.AttributeValue(node, "resourceName", m_ResourceName.ToString());
|
m_ResourceName = Helper.AttributeValue(node, "resourceName", m_ResourceName.ToString());
|
||||||
this.m_Link = bool.Parse(Helper.AttributeValue(node, "link", bool.FalseString));
|
this.m_Link = bool.Parse(Helper.AttributeValue(node, "link", bool.FalseString));
|
||||||
if ( this.m_Link == true )
|
if ( this.m_Link == true )
|
||||||
{
|
{
|
||||||
this.m_LinkPath = Helper.AttributeValue( node, "linkPath", string.Empty );
|
this.m_LinkPath = Helper.AttributeValue( node, "linkPath", string.Empty );
|
||||||
}
|
}
|
||||||
this.m_CopyToOutput = (CopyToOutput) Enum.Parse(typeof(CopyToOutput), Helper.AttributeValue(node, "copyToOutput", this.m_CopyToOutput.ToString()));
|
this.m_CopyToOutput = (CopyToOutput) Enum.Parse(typeof(CopyToOutput), Helper.AttributeValue(node, "copyToOutput", this.m_CopyToOutput.ToString()));
|
||||||
this.m_PreservePath = bool.Parse( Helper.AttributeValue( node, "preservePath", bool.FalseString ) );
|
this.m_PreservePath = bool.Parse( Helper.AttributeValue( node, "preservePath", bool.FalseString ) );
|
||||||
|
|
||||||
if( node == null )
|
if( node == null )
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("node");
|
throw new ArgumentNullException("node");
|
||||||
}
|
}
|
||||||
|
|
||||||
m_Path = Helper.InterpolateForEnvironmentVariables(node.InnerText);
|
m_Path = Helper.InterpolateForEnvironmentVariables(node.InnerText);
|
||||||
if(m_Path == null)
|
if(m_Path == null)
|
||||||
{
|
{
|
||||||
m_Path = "";
|
m_Path = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
m_Path = m_Path.Trim();
|
m_Path = m_Path.Trim();
|
||||||
m_Valid = true;
|
m_Valid = true;
|
||||||
if(!File.Exists(m_Path))
|
if(!File.Exists(m_Path))
|
||||||
{
|
{
|
||||||
m_Valid = false;
|
m_Valid = false;
|
||||||
Kernel.Instance.Log.Write(LogType.Warning, "File does not exist: {0}", m_Path);
|
Kernel.Instance.Log.Write(LogType.Warning, "File does not exist: {0}", m_Path);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (System.IO.Path.GetExtension(m_Path) == ".settings")
|
if (System.IO.Path.GetExtension(m_Path) == ".settings")
|
||||||
{
|
{
|
||||||
m_SubType = SubType.Settings;
|
m_SubType = SubType.Settings;
|
||||||
m_BuildAction = BuildAction.None;
|
m_BuildAction = BuildAction.None;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,36 +34,36 @@ using System.IO;
|
||||||
|
|
||||||
namespace Prebuild.Core.Nodes
|
namespace Prebuild.Core.Nodes
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DataNode("Files")]
|
[DataNode("Files")]
|
||||||
public class FilesNode : DataNode
|
public class FilesNode : DataNode
|
||||||
{
|
{
|
||||||
#region Fields
|
#region Fields
|
||||||
|
|
||||||
private readonly List<string> m_Files = new List<string>();
|
private readonly List<string> m_Files = new List<string>();
|
||||||
private readonly Dictionary<string,BuildAction> m_BuildActions = new Dictionary<string, BuildAction>();
|
private readonly Dictionary<string,BuildAction> m_BuildActions = new Dictionary<string, BuildAction>();
|
||||||
private readonly Dictionary<string, SubType> m_SubTypes = new Dictionary<string, SubType>();
|
private readonly Dictionary<string, SubType> m_SubTypes = new Dictionary<string, SubType>();
|
||||||
private readonly Dictionary<string, string> m_ResourceNames = new Dictionary<string, string>();
|
private readonly Dictionary<string, string> m_ResourceNames = new Dictionary<string, string>();
|
||||||
private readonly Dictionary<string, CopyToOutput> m_CopyToOutputs = new Dictionary<string, CopyToOutput>();
|
private readonly Dictionary<string, CopyToOutput> m_CopyToOutputs = new Dictionary<string, CopyToOutput>();
|
||||||
private readonly Dictionary<string, bool> m_Links = new Dictionary<string, bool>();
|
private readonly Dictionary<string, bool> m_Links = new Dictionary<string, bool>();
|
||||||
private readonly Dictionary<string, string> m_LinkPaths = new Dictionary<string, string>();
|
private readonly Dictionary<string, string> m_LinkPaths = new Dictionary<string, string>();
|
||||||
private readonly Dictionary<string, bool> m_PreservePaths = new Dictionary<string, bool>();
|
private readonly Dictionary<string, bool> m_PreservePaths = new Dictionary<string, bool>();
|
||||||
private readonly Dictionary<string, string> m_DestinationPath = new Dictionary<string, string>();
|
private readonly Dictionary<string, string> m_DestinationPath = new Dictionary<string, string>();
|
||||||
private readonly NameValueCollection m_CopyFiles = new NameValueCollection();
|
private readonly NameValueCollection m_CopyFiles = new NameValueCollection();
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Properties
|
#region Properties
|
||||||
|
|
||||||
public int Count
|
public int Count
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return m_Files.Count;
|
return m_Files.Count;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public string[] Destinations
|
public string[] Destinations
|
||||||
{
|
{
|
||||||
|
@ -75,19 +75,19 @@ namespace Prebuild.Core.Nodes
|
||||||
get { return m_CopyFiles.Count; }
|
get { return m_CopyFiles.Count; }
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Public Methods
|
#region Public Methods
|
||||||
|
|
||||||
public BuildAction GetBuildAction(string file)
|
public BuildAction GetBuildAction(string file)
|
||||||
{
|
{
|
||||||
if(!m_BuildActions.ContainsKey(file))
|
if(!m_BuildActions.ContainsKey(file))
|
||||||
{
|
{
|
||||||
return BuildAction.Compile;
|
return BuildAction.Compile;
|
||||||
}
|
}
|
||||||
|
|
||||||
return m_BuildActions[file];
|
return m_BuildActions[file];
|
||||||
}
|
}
|
||||||
|
|
||||||
public string GetDestinationPath(string file)
|
public string GetDestinationPath(string file)
|
||||||
{
|
{
|
||||||
|
@ -103,57 +103,57 @@ namespace Prebuild.Core.Nodes
|
||||||
return m_CopyFiles.GetValues(dest);
|
return m_CopyFiles.GetValues(dest);
|
||||||
}
|
}
|
||||||
|
|
||||||
public CopyToOutput GetCopyToOutput(string file)
|
public CopyToOutput GetCopyToOutput(string file)
|
||||||
{
|
{
|
||||||
if (!m_CopyToOutputs.ContainsKey(file))
|
if (!m_CopyToOutputs.ContainsKey(file))
|
||||||
{
|
{
|
||||||
return CopyToOutput.Never;
|
return CopyToOutput.Never;
|
||||||
}
|
}
|
||||||
return m_CopyToOutputs[file];
|
return m_CopyToOutputs[file];
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool GetIsLink(string file)
|
public bool GetIsLink(string file)
|
||||||
{
|
{
|
||||||
if (!m_Links.ContainsKey(file))
|
if (!m_Links.ContainsKey(file))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return m_Links[file];
|
return m_Links[file];
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool Contains(string file)
|
public bool Contains(string file)
|
||||||
{
|
{
|
||||||
return m_Files.Contains(file);
|
return m_Files.Contains(file);
|
||||||
}
|
}
|
||||||
|
|
||||||
public string GetLinkPath( string file )
|
public string GetLinkPath( string file )
|
||||||
{
|
{
|
||||||
if ( !m_LinkPaths.ContainsKey( file ) )
|
if ( !m_LinkPaths.ContainsKey( file ) )
|
||||||
{
|
{
|
||||||
return string.Empty;
|
return string.Empty;
|
||||||
}
|
}
|
||||||
return m_LinkPaths[ file ];
|
return m_LinkPaths[ file ];
|
||||||
}
|
}
|
||||||
|
|
||||||
public SubType GetSubType(string file)
|
public SubType GetSubType(string file)
|
||||||
{
|
{
|
||||||
if(!m_SubTypes.ContainsKey(file))
|
if(!m_SubTypes.ContainsKey(file))
|
||||||
{
|
{
|
||||||
return SubType.Code;
|
return SubType.Code;
|
||||||
}
|
}
|
||||||
|
|
||||||
return m_SubTypes[file];
|
return m_SubTypes[file];
|
||||||
}
|
}
|
||||||
|
|
||||||
public string GetResourceName(string file)
|
public string GetResourceName(string file)
|
||||||
{
|
{
|
||||||
if(!m_ResourceNames.ContainsKey(file))
|
if(!m_ResourceNames.ContainsKey(file))
|
||||||
{
|
{
|
||||||
return string.Empty;
|
return string.Empty;
|
||||||
}
|
}
|
||||||
|
|
||||||
return m_ResourceNames[file];
|
return m_ResourceNames[file];
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool GetPreservePath( string file )
|
public bool GetPreservePath( string file )
|
||||||
{
|
{
|
||||||
|
@ -165,45 +165,45 @@ namespace Prebuild.Core.Nodes
|
||||||
return m_PreservePaths[ file ];
|
return m_PreservePaths[ file ];
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Parse(XmlNode node)
|
public override void Parse(XmlNode node)
|
||||||
{
|
{
|
||||||
if( node == null )
|
if( node == null )
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("node");
|
throw new ArgumentNullException("node");
|
||||||
}
|
}
|
||||||
foreach(XmlNode child in node.ChildNodes)
|
foreach(XmlNode child in node.ChildNodes)
|
||||||
{
|
{
|
||||||
IDataNode dataNode = Kernel.Instance.ParseNode(child, this);
|
IDataNode dataNode = Kernel.Instance.ParseNode(child, this);
|
||||||
if(dataNode is FileNode)
|
if(dataNode is FileNode)
|
||||||
{
|
{
|
||||||
FileNode fileNode = (FileNode)dataNode;
|
FileNode fileNode = (FileNode)dataNode;
|
||||||
if(fileNode.IsValid)
|
if(fileNode.IsValid)
|
||||||
{
|
{
|
||||||
if (!m_Files.Contains(fileNode.Path))
|
if (!m_Files.Contains(fileNode.Path))
|
||||||
{
|
{
|
||||||
m_Files.Add(fileNode.Path);
|
m_Files.Add(fileNode.Path);
|
||||||
m_BuildActions[fileNode.Path] = fileNode.BuildAction;
|
m_BuildActions[fileNode.Path] = fileNode.BuildAction;
|
||||||
m_SubTypes[fileNode.Path] = fileNode.SubType;
|
m_SubTypes[fileNode.Path] = fileNode.SubType;
|
||||||
m_ResourceNames[fileNode.Path] = fileNode.ResourceName;
|
m_ResourceNames[fileNode.Path] = fileNode.ResourceName;
|
||||||
m_PreservePaths[ fileNode.Path ] = fileNode.PreservePath;
|
m_PreservePaths[ fileNode.Path ] = fileNode.PreservePath;
|
||||||
m_Links[ fileNode.Path ] = fileNode.IsLink;
|
m_Links[ fileNode.Path ] = fileNode.IsLink;
|
||||||
m_LinkPaths[ fileNode.Path ] = fileNode.LinkPath;
|
m_LinkPaths[ fileNode.Path ] = fileNode.LinkPath;
|
||||||
m_CopyToOutputs[ fileNode.Path ] = fileNode.CopyToOutput;
|
m_CopyToOutputs[ fileNode.Path ] = fileNode.CopyToOutput;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(dataNode is MatchNode)
|
else if(dataNode is MatchNode)
|
||||||
{
|
{
|
||||||
foreach(string file in ((MatchNode)dataNode).Files)
|
foreach(string file in ((MatchNode)dataNode).Files)
|
||||||
{
|
{
|
||||||
MatchNode matchNode = (MatchNode)dataNode;
|
MatchNode matchNode = (MatchNode)dataNode;
|
||||||
if (!m_Files.Contains(file))
|
if (!m_Files.Contains(file))
|
||||||
{
|
{
|
||||||
m_Files.Add(file);
|
m_Files.Add(file);
|
||||||
if (matchNode.BuildAction == null)
|
if (matchNode.BuildAction == null)
|
||||||
m_BuildActions[file] = GetBuildActionByFileName(file);
|
m_BuildActions[file] = GetBuildActionByFileName(file);
|
||||||
else
|
else
|
||||||
m_BuildActions[file] = matchNode.BuildAction.Value;
|
m_BuildActions[file] = matchNode.BuildAction.Value;
|
||||||
|
|
||||||
if (matchNode.BuildAction == BuildAction.Copy)
|
if (matchNode.BuildAction == BuildAction.Copy)
|
||||||
|
@ -212,27 +212,27 @@ namespace Prebuild.Core.Nodes
|
||||||
m_DestinationPath[file] = matchNode.DestinationPath;
|
m_DestinationPath[file] = matchNode.DestinationPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_SubTypes[file] = matchNode.SubType == null ? GetSubTypeByFileName(file) : matchNode.SubType.Value;
|
m_SubTypes[file] = matchNode.SubType == null ? GetSubTypeByFileName(file) : matchNode.SubType.Value;
|
||||||
m_ResourceNames[ file ] = matchNode.ResourceName;
|
m_ResourceNames[ file ] = matchNode.ResourceName;
|
||||||
m_PreservePaths[ file ] = matchNode.PreservePath;
|
m_PreservePaths[ file ] = matchNode.PreservePath;
|
||||||
m_Links[ file ] = matchNode.IsLink;
|
m_Links[ file ] = matchNode.IsLink;
|
||||||
m_LinkPaths[ file ] = matchNode.LinkPath;
|
m_LinkPaths[ file ] = matchNode.LinkPath;
|
||||||
m_CopyToOutputs[ file ] = matchNode.CopyToOutput;
|
m_CopyToOutputs[ file ] = matchNode.CopyToOutput;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Check in to why StringCollection's enumerator doesn't implement
|
// TODO: Check in to why StringCollection's enumerator doesn't implement
|
||||||
// IEnumerator?
|
// IEnumerator?
|
||||||
public IEnumerator<string> GetEnumerator()
|
public IEnumerator<string> GetEnumerator()
|
||||||
{
|
{
|
||||||
return m_Files.GetEnumerator();
|
return m_Files.GetEnumerator();
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,51 +35,51 @@ using Prebuild.Core.Utilities;
|
||||||
|
|
||||||
namespace Prebuild.Core.Nodes
|
namespace Prebuild.Core.Nodes
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DataNode("Match")]
|
[DataNode("Match")]
|
||||||
public class MatchNode : DataNode
|
public class MatchNode : DataNode
|
||||||
{
|
{
|
||||||
#region Fields
|
#region Fields
|
||||||
|
|
||||||
private readonly List<string> m_Files = new List<string>();
|
private readonly List<string> m_Files = new List<string>();
|
||||||
private Regex m_Regex;
|
private Regex m_Regex;
|
||||||
private BuildAction? m_BuildAction;
|
private BuildAction? m_BuildAction;
|
||||||
private SubType? m_SubType;
|
private SubType? m_SubType;
|
||||||
string m_ResourceName = "";
|
string m_ResourceName = "";
|
||||||
private CopyToOutput m_CopyToOutput;
|
private CopyToOutput m_CopyToOutput;
|
||||||
private bool m_Link;
|
private bool m_Link;
|
||||||
private string m_LinkPath;
|
private string m_LinkPath;
|
||||||
private bool m_PreservePath;
|
private bool m_PreservePath;
|
||||||
private string m_Destination = "";
|
private string m_Destination = "";
|
||||||
private readonly List<ExcludeNode> m_Exclusions = new List<ExcludeNode>();
|
private readonly List<ExcludeNode> m_Exclusions = new List<ExcludeNode>();
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Properties
|
#region Properties
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public IEnumerable<string> Files
|
public IEnumerable<string> Files
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return m_Files;
|
return m_Files;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public BuildAction? BuildAction
|
public BuildAction? BuildAction
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return m_BuildAction;
|
return m_BuildAction;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public string DestinationPath
|
public string DestinationPath
|
||||||
{
|
{
|
||||||
|
@ -88,50 +88,50 @@ namespace Prebuild.Core.Nodes
|
||||||
return m_Destination;
|
return m_Destination;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public SubType? SubType
|
public SubType? SubType
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return m_SubType;
|
return m_SubType;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public CopyToOutput CopyToOutput
|
public CopyToOutput CopyToOutput
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return m_CopyToOutput;
|
return m_CopyToOutput;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool IsLink
|
public bool IsLink
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return m_Link;
|
return m_Link;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public string LinkPath
|
public string LinkPath
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return m_LinkPath;
|
return m_LinkPath;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string ResourceName
|
public string ResourceName
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return m_ResourceName;
|
return m_ResourceName;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool PreservePath
|
public bool PreservePath
|
||||||
{
|
{
|
||||||
|
@ -141,27 +141,27 @@ namespace Prebuild.Core.Nodes
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Private Methods
|
#region Private Methods
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Recurses the directories.
|
/// Recurses the directories.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="path">The path.</param>
|
/// <param name="path">The path.</param>
|
||||||
/// <param name="pattern">The pattern.</param>
|
/// <param name="pattern">The pattern.</param>
|
||||||
/// <param name="recurse">if set to <c>true</c> [recurse].</param>
|
/// <param name="recurse">if set to <c>true</c> [recurse].</param>
|
||||||
/// <param name="useRegex">if set to <c>true</c> [use regex].</param>
|
/// <param name="useRegex">if set to <c>true</c> [use regex].</param>
|
||||||
private void RecurseDirectories(string path, string pattern, bool recurse, bool useRegex, List<ExcludeNode> exclusions)
|
private void RecurseDirectories(string path, string pattern, bool recurse, bool useRegex, List<ExcludeNode> exclusions)
|
||||||
{
|
{
|
||||||
Match match;
|
Match match;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
string[] files;
|
string[] files;
|
||||||
|
|
||||||
Boolean excludeFile;
|
Boolean excludeFile;
|
||||||
if(!useRegex)
|
if(!useRegex)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
files = Directory.GetFiles(path, pattern);
|
files = Directory.GetFiles(path, pattern);
|
||||||
|
@ -177,20 +177,20 @@ namespace Prebuild.Core.Nodes
|
||||||
files = null;
|
files = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(files != null)
|
if(files != null)
|
||||||
{
|
{
|
||||||
foreach (string file in files)
|
foreach (string file in files)
|
||||||
{
|
{
|
||||||
excludeFile = false;
|
excludeFile = false;
|
||||||
string fileTemp;
|
string fileTemp;
|
||||||
if (file.Substring(0,2) == "./" || file.Substring(0,2) == ".\\")
|
if (file.Substring(0,2) == "./" || file.Substring(0,2) == ".\\")
|
||||||
{
|
{
|
||||||
fileTemp = file.Substring(2);
|
fileTemp = file.Substring(2);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
fileTemp = file;
|
fileTemp = file;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check all excludions and set flag if there are any hits.
|
// Check all excludions and set flag if there are any hits.
|
||||||
foreach ( ExcludeNode exclude in exclusions )
|
foreach ( ExcludeNode exclude in exclusions )
|
||||||
|
@ -205,18 +205,18 @@ namespace Prebuild.Core.Nodes
|
||||||
m_Files.Add( fileTemp );
|
m_Files.Add( fileTemp );
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// don't call return here, because we may need to recursively search directories below
|
// don't call return here, because we may need to recursively search directories below
|
||||||
// this one, even if no matches were found in this directory.
|
// this one, even if no matches were found in this directory.
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
files = Directory.GetFiles(path);
|
files = Directory.GetFiles(path);
|
||||||
}
|
}
|
||||||
catch (IOException)
|
catch (IOException)
|
||||||
{
|
{
|
||||||
// swallow weird IOException error when running in a virtual box
|
// swallow weird IOException error when running in a virtual box
|
||||||
|
@ -248,12 +248,12 @@ namespace Prebuild.Core.Nodes
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(recurse)
|
if(recurse)
|
||||||
{
|
{
|
||||||
string[] dirs = Directory.GetDirectories(path);
|
string[] dirs = Directory.GetDirectories(path);
|
||||||
if(dirs != null && dirs.Length > 0)
|
if(dirs != null && dirs.Length > 0)
|
||||||
{
|
{
|
||||||
foreach (string str in dirs)
|
foreach (string str in dirs)
|
||||||
{
|
{
|
||||||
|
@ -265,96 +265,96 @@ namespace Prebuild.Core.Nodes
|
||||||
RecurseDirectories(Helper.NormalizePath(str), pattern, recurse, useRegex, exclusions);
|
RecurseDirectories(Helper.NormalizePath(str), pattern, recurse, useRegex, exclusions);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch(DirectoryNotFoundException)
|
catch(DirectoryNotFoundException)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
catch(ArgumentException)
|
catch(ArgumentException)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Public Methods
|
#region Public Methods
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="node"></param>
|
/// <param name="node"></param>
|
||||||
public override void Parse(XmlNode node)
|
public override void Parse(XmlNode node)
|
||||||
{
|
{
|
||||||
if( node == null )
|
if( node == null )
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("node");
|
throw new ArgumentNullException("node");
|
||||||
}
|
}
|
||||||
string path = Helper.AttributeValue(node, "path", ".");
|
string path = Helper.AttributeValue(node, "path", ".");
|
||||||
string pattern = Helper.AttributeValue(node, "pattern", "*");
|
string pattern = Helper.AttributeValue(node, "pattern", "*");
|
||||||
string destination = Helper.AttributeValue(node, "destination", string.Empty);
|
string destination = Helper.AttributeValue(node, "destination", string.Empty);
|
||||||
bool recurse = (bool)Helper.TranslateValue(typeof(bool), Helper.AttributeValue(node, "recurse", "false"));
|
bool recurse = (bool)Helper.TranslateValue(typeof(bool), Helper.AttributeValue(node, "recurse", "false"));
|
||||||
bool useRegex = (bool)Helper.TranslateValue(typeof(bool), Helper.AttributeValue(node, "useRegex", "false"));
|
bool useRegex = (bool)Helper.TranslateValue(typeof(bool), Helper.AttributeValue(node, "useRegex", "false"));
|
||||||
string buildAction = Helper.AttributeValue(node, "buildAction", String.Empty);
|
string buildAction = Helper.AttributeValue(node, "buildAction", String.Empty);
|
||||||
if (buildAction != string.Empty)
|
if (buildAction != string.Empty)
|
||||||
m_BuildAction = (BuildAction)Enum.Parse(typeof(BuildAction), buildAction);
|
m_BuildAction = (BuildAction)Enum.Parse(typeof(BuildAction), buildAction);
|
||||||
|
|
||||||
|
|
||||||
//TODO: Figure out where the subtype node is being assigned
|
//TODO: Figure out where the subtype node is being assigned
|
||||||
//string subType = Helper.AttributeValue(node, "subType", string.Empty);
|
//string subType = Helper.AttributeValue(node, "subType", string.Empty);
|
||||||
//if (subType != String.Empty)
|
//if (subType != String.Empty)
|
||||||
// m_SubType = (SubType)Enum.Parse(typeof(SubType), subType);
|
// m_SubType = (SubType)Enum.Parse(typeof(SubType), subType);
|
||||||
m_ResourceName = Helper.AttributeValue(node, "resourceName", m_ResourceName);
|
m_ResourceName = Helper.AttributeValue(node, "resourceName", m_ResourceName);
|
||||||
m_CopyToOutput = (CopyToOutput) Enum.Parse(typeof(CopyToOutput), Helper.AttributeValue(node, "copyToOutput", m_CopyToOutput.ToString()));
|
m_CopyToOutput = (CopyToOutput) Enum.Parse(typeof(CopyToOutput), Helper.AttributeValue(node, "copyToOutput", m_CopyToOutput.ToString()));
|
||||||
m_Link = bool.Parse(Helper.AttributeValue(node, "link", bool.FalseString));
|
m_Link = bool.Parse(Helper.AttributeValue(node, "link", bool.FalseString));
|
||||||
if ( m_Link )
|
if ( m_Link )
|
||||||
{
|
{
|
||||||
m_LinkPath = Helper.AttributeValue( node, "linkPath", string.Empty );
|
m_LinkPath = Helper.AttributeValue( node, "linkPath", string.Empty );
|
||||||
}
|
}
|
||||||
m_PreservePath = bool.Parse( Helper.AttributeValue( node, "preservePath", bool.FalseString ) );
|
m_PreservePath = bool.Parse( Helper.AttributeValue( node, "preservePath", bool.FalseString ) );
|
||||||
|
|
||||||
if ( buildAction == "Copy")
|
if ( buildAction == "Copy")
|
||||||
m_Destination = destination;
|
m_Destination = destination;
|
||||||
|
|
||||||
if(path != null && path.Length == 0)
|
if(path != null && path.Length == 0)
|
||||||
path = ".";//use current directory
|
path = ".";//use current directory
|
||||||
|
|
||||||
//throw new WarningException("Match must have a 'path' attribute");
|
//throw new WarningException("Match must have a 'path' attribute");
|
||||||
|
|
||||||
if(pattern == null)
|
if(pattern == null)
|
||||||
{
|
{
|
||||||
throw new WarningException("Match must have a 'pattern' attribute");
|
throw new WarningException("Match must have a 'pattern' attribute");
|
||||||
}
|
}
|
||||||
|
|
||||||
path = Helper.NormalizePath(path);
|
path = Helper.NormalizePath(path);
|
||||||
if(!Directory.Exists(path))
|
if(!Directory.Exists(path))
|
||||||
{
|
{
|
||||||
throw new WarningException("Match path does not exist: {0}", path);
|
throw new WarningException("Match path does not exist: {0}", path);
|
||||||
}
|
}
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if(useRegex)
|
if(useRegex)
|
||||||
{
|
{
|
||||||
m_Regex = new Regex(pattern);
|
m_Regex = new Regex(pattern);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch(ArgumentException ex)
|
catch(ArgumentException ex)
|
||||||
{
|
{
|
||||||
throw new WarningException("Could not compile regex pattern: {0}", ex.Message);
|
throw new WarningException("Could not compile regex pattern: {0}", ex.Message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
foreach(XmlNode child in node.ChildNodes)
|
foreach(XmlNode child in node.ChildNodes)
|
||||||
{
|
{
|
||||||
IDataNode dataNode = Kernel.Instance.ParseNode(child, this);
|
IDataNode dataNode = Kernel.Instance.ParseNode(child, this);
|
||||||
if(dataNode is ExcludeNode)
|
if(dataNode is ExcludeNode)
|
||||||
{
|
{
|
||||||
ExcludeNode excludeNode = (ExcludeNode)dataNode;
|
ExcludeNode excludeNode = (ExcludeNode)dataNode;
|
||||||
m_Exclusions.Add( excludeNode );
|
m_Exclusions.Add( excludeNode );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
RecurseDirectories( path, pattern, recurse, useRegex, m_Exclusions );
|
RecurseDirectories( path, pattern, recurse, useRegex, m_Exclusions );
|
||||||
|
|
||||||
|
@ -371,8 +371,8 @@ namespace Prebuild.Core.Nodes
|
||||||
throw new WarningException("Match" + projectName + " returned no files: {0}{1}", Helper.EndPath(path), pattern);
|
throw new WarningException("Match" + projectName + " returned no files: {0}{1}", Helper.EndPath(path), pattern);
|
||||||
}
|
}
|
||||||
m_Regex = null;
|
m_Regex = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -32,77 +32,77 @@ using Prebuild.Core.Utilities;
|
||||||
|
|
||||||
namespace Prebuild.Core.Nodes
|
namespace Prebuild.Core.Nodes
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DataNode("Process")]
|
[DataNode("Process")]
|
||||||
public class ProcessNode : DataNode
|
public class ProcessNode : DataNode
|
||||||
{
|
{
|
||||||
#region Fields
|
#region Fields
|
||||||
|
|
||||||
private string m_Path;
|
private string m_Path;
|
||||||
private bool m_IsValid = true;
|
private bool m_IsValid = true;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Properties
|
#region Properties
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the path.
|
/// Gets the path.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The path.</value>
|
/// <value>The path.</value>
|
||||||
public string Path
|
public string Path
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return m_Path;
|
return m_Path;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets a value indicating whether this instance is valid.
|
/// Gets a value indicating whether this instance is valid.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value><c>true</c> if this instance is valid; otherwise, <c>false</c>.</value>
|
/// <value><c>true</c> if this instance is valid; otherwise, <c>false</c>.</value>
|
||||||
public bool IsValid
|
public bool IsValid
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return m_IsValid;
|
return m_IsValid;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Public Methods
|
#region Public Methods
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Parses the specified node.
|
/// Parses the specified node.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="node">The node.</param>
|
/// <param name="node">The node.</param>
|
||||||
public override void Parse(XmlNode node)
|
public override void Parse(XmlNode node)
|
||||||
{
|
{
|
||||||
if( node == null )
|
if( node == null )
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("node");
|
throw new ArgumentNullException("node");
|
||||||
}
|
}
|
||||||
|
|
||||||
m_Path = Helper.InterpolateForEnvironmentVariables(node.InnerText);
|
m_Path = Helper.InterpolateForEnvironmentVariables(node.InnerText);
|
||||||
if(m_Path == null)
|
if(m_Path == null)
|
||||||
{
|
{
|
||||||
m_Path = "";
|
m_Path = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
m_Path = Helper.ResolvePath(m_Path);
|
m_Path = Helper.ResolvePath(m_Path);
|
||||||
}
|
}
|
||||||
catch(ArgumentException)
|
catch(ArgumentException)
|
||||||
{
|
{
|
||||||
Kernel.Instance.Log.Write(LogType.Warning, "Could not find prebuild file for processing: {0}", m_Path);
|
Kernel.Instance.Log.Write(LogType.Warning, "Could not find prebuild file for processing: {0}", m_Path);
|
||||||
m_IsValid = false;
|
m_IsValid = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -32,104 +32,104 @@ using Prebuild.Core.Utilities;
|
||||||
|
|
||||||
namespace Prebuild.Core.Nodes
|
namespace Prebuild.Core.Nodes
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DataNode("Reference")]
|
[DataNode("Reference")]
|
||||||
public class ReferenceNode : DataNode, IComparable
|
public class ReferenceNode : DataNode, IComparable
|
||||||
{
|
{
|
||||||
#region Fields
|
#region Fields
|
||||||
|
|
||||||
private string m_Name = "unknown";
|
private string m_Name = "unknown";
|
||||||
private string m_Path;
|
private string m_Path;
|
||||||
private string m_LocalCopy;
|
private string m_LocalCopy;
|
||||||
private string m_Version;
|
private string m_Version;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Properties
|
#region Properties
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the name.
|
/// Gets the name.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The name.</value>
|
/// <value>The name.</value>
|
||||||
public string Name
|
public string Name
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return m_Name;
|
return m_Name;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the path.
|
/// Gets the path.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The path.</value>
|
/// <value>The path.</value>
|
||||||
public string Path
|
public string Path
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return m_Path;
|
return m_Path;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets a value indicating whether [local copy specified].
|
/// Gets a value indicating whether [local copy specified].
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value><c>true</c> if [local copy specified]; otherwise, <c>false</c>.</value>
|
/// <value><c>true</c> if [local copy specified]; otherwise, <c>false</c>.</value>
|
||||||
public bool LocalCopySpecified
|
public bool LocalCopySpecified
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return ( m_LocalCopy != null && m_LocalCopy.Length == 0);
|
return ( m_LocalCopy != null && m_LocalCopy.Length == 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets a value indicating whether [local copy].
|
/// Gets a value indicating whether [local copy].
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value><c>true</c> if [local copy]; otherwise, <c>false</c>.</value>
|
/// <value><c>true</c> if [local copy]; otherwise, <c>false</c>.</value>
|
||||||
public bool LocalCopy
|
public bool LocalCopy
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
if( m_LocalCopy == null)
|
if( m_LocalCopy == null)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return bool.Parse(m_LocalCopy);
|
return bool.Parse(m_LocalCopy);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the version.
|
/// Gets the version.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The version.</value>
|
/// <value>The version.</value>
|
||||||
public string Version
|
public string Version
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return m_Version;
|
return m_Version;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Public Methods
|
#region Public Methods
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Parses the specified node.
|
/// Parses the specified node.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="node">The node.</param>
|
/// <param name="node">The node.</param>
|
||||||
public override void Parse(XmlNode node)
|
public override void Parse(XmlNode node)
|
||||||
{
|
{
|
||||||
m_Name = Helper.AttributeValue(node, "name", m_Name);
|
m_Name = Helper.AttributeValue(node, "name", m_Name);
|
||||||
m_Path = Helper.AttributeValue(node, "path", m_Path);
|
m_Path = Helper.AttributeValue(node, "path", m_Path);
|
||||||
m_LocalCopy = Helper.AttributeValue(node, "localCopy", m_LocalCopy);
|
m_LocalCopy = Helper.AttributeValue(node, "localCopy", m_LocalCopy);
|
||||||
m_Version = Helper.AttributeValue(node, "version", m_Version);
|
m_Version = Helper.AttributeValue(node, "version", m_Version);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region IComparable Members
|
#region IComparable Members
|
||||||
|
|
||||||
|
@ -140,5 +140,5 @@ namespace Prebuild.Core.Nodes
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,57 +32,57 @@ using Prebuild.Core.Utilities;
|
||||||
|
|
||||||
namespace Prebuild.Core.Nodes
|
namespace Prebuild.Core.Nodes
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DataNode("ReferencePath")]
|
[DataNode("ReferencePath")]
|
||||||
public class ReferencePathNode : DataNode, IComparable
|
public class ReferencePathNode : DataNode, IComparable
|
||||||
{
|
{
|
||||||
#region Fields
|
#region Fields
|
||||||
|
|
||||||
private string m_Path;
|
private string m_Path;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Properties
|
#region Properties
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the path.
|
/// Gets the path.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The path.</value>
|
/// <value>The path.</value>
|
||||||
public string Path
|
public string Path
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return m_Path;
|
return m_Path;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Public Methods
|
#region Public Methods
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Parses the specified node.
|
/// Parses the specified node.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="node">The node.</param>
|
/// <param name="node">The node.</param>
|
||||||
public override void Parse(XmlNode node)
|
public override void Parse(XmlNode node)
|
||||||
{
|
{
|
||||||
if( node == null )
|
if( node == null )
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("node");
|
throw new ArgumentNullException("node");
|
||||||
}
|
}
|
||||||
|
|
||||||
m_Path = Helper.InterpolateForEnvironmentVariables(node.InnerText);
|
m_Path = Helper.InterpolateForEnvironmentVariables(node.InnerText);
|
||||||
if(m_Path == null)
|
if(m_Path == null)
|
||||||
{
|
{
|
||||||
m_Path = "";
|
m_Path = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
m_Path = m_Path.Trim();
|
m_Path = m_Path.Trim();
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region IComparable Members
|
#region IComparable Members
|
||||||
|
|
||||||
|
@ -93,5 +93,5 @@ namespace Prebuild.Core.Nodes
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,35 +34,35 @@ using Prebuild.Core.Utilities;
|
||||||
|
|
||||||
namespace Prebuild.Core.Nodes
|
namespace Prebuild.Core.Nodes
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DataNode("Solution")]
|
[DataNode("Solution")]
|
||||||
[DataNode("EmbeddedSolution")]
|
[DataNode("EmbeddedSolution")]
|
||||||
[DebuggerDisplay("{Name}")]
|
[DebuggerDisplay("{Name}")]
|
||||||
public class SolutionNode : DataNode
|
public class SolutionNode : DataNode
|
||||||
{
|
{
|
||||||
#region Fields
|
#region Fields
|
||||||
|
|
||||||
private Guid m_Guid = Guid.NewGuid();
|
private Guid m_Guid = Guid.NewGuid();
|
||||||
private string m_Name = "unknown";
|
private string m_Name = "unknown";
|
||||||
private string m_Path = "";
|
private string m_Path = "";
|
||||||
private string m_FullPath = "";
|
private string m_FullPath = "";
|
||||||
private string m_ActiveConfig;
|
private string m_ActiveConfig;
|
||||||
private string m_Version = "1.0.0";
|
private string m_Version = "1.0.0";
|
||||||
|
|
||||||
private OptionsNode m_Options;
|
private OptionsNode m_Options;
|
||||||
private FilesNode m_Files;
|
private FilesNode m_Files;
|
||||||
private readonly ConfigurationNodeCollection m_Configurations = new ConfigurationNodeCollection();
|
private readonly ConfigurationNodeCollection m_Configurations = new ConfigurationNodeCollection();
|
||||||
private readonly Dictionary<string, ProjectNode> m_Projects = new Dictionary<string, ProjectNode>();
|
private readonly Dictionary<string, ProjectNode> m_Projects = new Dictionary<string, ProjectNode>();
|
||||||
private readonly Dictionary<string, DatabaseProjectNode> m_DatabaseProjects = new Dictionary<string, DatabaseProjectNode>();
|
private readonly Dictionary<string, DatabaseProjectNode> m_DatabaseProjects = new Dictionary<string, DatabaseProjectNode>();
|
||||||
private readonly List<ProjectNode> m_ProjectsOrder = new List<ProjectNode>();
|
private readonly List<ProjectNode> m_ProjectsOrder = new List<ProjectNode>();
|
||||||
private readonly Dictionary<string, SolutionNode> m_Solutions = new Dictionary<string, SolutionNode>();
|
private readonly Dictionary<string, SolutionNode> m_Solutions = new Dictionary<string, SolutionNode>();
|
||||||
private CleanupNode m_Cleanup;
|
private CleanupNode m_Cleanup;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Properties
|
#region Properties
|
||||||
public override IDataNode Parent
|
public override IDataNode Parent
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
|
@ -84,17 +84,17 @@ namespace Prebuild.Core.Nodes
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public CleanupNode Cleanup
|
public CleanupNode Cleanup
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return m_Cleanup;
|
return m_Cleanup;
|
||||||
}
|
}
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
m_Cleanup = value;
|
m_Cleanup = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Guid Guid
|
public Guid Guid
|
||||||
{
|
{
|
||||||
|
@ -107,119 +107,119 @@ namespace Prebuild.Core.Nodes
|
||||||
m_Guid = value;
|
m_Guid = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the active config.
|
/// Gets or sets the active config.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The active config.</value>
|
/// <value>The active config.</value>
|
||||||
public string ActiveConfig
|
public string ActiveConfig
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return m_ActiveConfig;
|
return m_ActiveConfig;
|
||||||
}
|
}
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
m_ActiveConfig = value;
|
m_ActiveConfig = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the name.
|
/// Gets the name.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The name.</value>
|
/// <value>The name.</value>
|
||||||
public string Name
|
public string Name
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return m_Name;
|
return m_Name;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the path.
|
/// Gets the path.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The path.</value>
|
/// <value>The path.</value>
|
||||||
public string Path
|
public string Path
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return m_Path;
|
return m_Path;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the full path.
|
/// Gets the full path.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The full path.</value>
|
/// <value>The full path.</value>
|
||||||
public string FullPath
|
public string FullPath
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return m_FullPath;
|
return m_FullPath;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the version.
|
/// Gets the version.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The version.</value>
|
/// <value>The version.</value>
|
||||||
public string Version
|
public string Version
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return m_Version;
|
return m_Version;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the options.
|
/// Gets the options.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The options.</value>
|
/// <value>The options.</value>
|
||||||
public OptionsNode Options
|
public OptionsNode Options
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return m_Options;
|
return m_Options;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the files.
|
/// Gets the files.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The files.</value>
|
/// <value>The files.</value>
|
||||||
public FilesNode Files
|
public FilesNode Files
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return m_Files;
|
return m_Files;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the configurations.
|
/// Gets the configurations.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The configurations.</value>
|
/// <value>The configurations.</value>
|
||||||
public ConfigurationNodeCollection Configurations
|
public ConfigurationNodeCollection Configurations
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
ConfigurationNodeCollection tmp = new ConfigurationNodeCollection();
|
ConfigurationNodeCollection tmp = new ConfigurationNodeCollection();
|
||||||
tmp.AddRange(ConfigurationsTable);
|
tmp.AddRange(ConfigurationsTable);
|
||||||
return tmp;
|
return tmp;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the configurations table.
|
/// Gets the configurations table.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The configurations table.</value>
|
/// <value>The configurations table.</value>
|
||||||
public ConfigurationNodeCollection ConfigurationsTable
|
public ConfigurationNodeCollection ConfigurationsTable
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return m_Configurations;
|
return m_Configurations;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the database projects.
|
/// Gets the database projects.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -250,106 +250,106 @@ namespace Prebuild.Core.Nodes
|
||||||
return m_Solutions;
|
return m_Solutions;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the projects.
|
/// Gets the projects.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The projects.</value>
|
/// <value>The projects.</value>
|
||||||
public ICollection<ProjectNode> Projects
|
public ICollection<ProjectNode> Projects
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
List<ProjectNode> tmp = new List<ProjectNode>(m_Projects.Values);
|
List<ProjectNode> tmp = new List<ProjectNode>(m_Projects.Values);
|
||||||
tmp.Sort();
|
tmp.Sort();
|
||||||
return tmp;
|
return tmp;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the projects table.
|
/// Gets the projects table.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The projects table.</value>
|
/// <value>The projects table.</value>
|
||||||
public Dictionary<string, ProjectNode> ProjectsTable
|
public Dictionary<string, ProjectNode> ProjectsTable
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return m_Projects;
|
return m_Projects;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the projects table.
|
/// Gets the projects table.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The projects table.</value>
|
/// <value>The projects table.</value>
|
||||||
public List<ProjectNode> ProjectsTableOrder
|
public List<ProjectNode> ProjectsTableOrder
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return m_ProjectsOrder;
|
return m_ProjectsOrder;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Public Methods
|
#region Public Methods
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Parses the specified node.
|
/// Parses the specified node.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="node">The node.</param>
|
/// <param name="node">The node.</param>
|
||||||
public override void Parse(XmlNode node)
|
public override void Parse(XmlNode node)
|
||||||
{
|
{
|
||||||
m_Name = Helper.AttributeValue(node, "name", m_Name);
|
m_Name = Helper.AttributeValue(node, "name", m_Name);
|
||||||
m_ActiveConfig = Helper.AttributeValue(node, "activeConfig", m_ActiveConfig);
|
m_ActiveConfig = Helper.AttributeValue(node, "activeConfig", m_ActiveConfig);
|
||||||
m_Path = Helper.AttributeValue(node, "path", m_Path);
|
m_Path = Helper.AttributeValue(node, "path", m_Path);
|
||||||
m_Version = Helper.AttributeValue(node, "version", m_Version);
|
m_Version = Helper.AttributeValue(node, "version", m_Version);
|
||||||
|
|
||||||
m_FullPath = m_Path;
|
m_FullPath = m_Path;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
m_FullPath = Helper.ResolvePath(m_FullPath);
|
m_FullPath = Helper.ResolvePath(m_FullPath);
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
throw new WarningException("Could not resolve solution path: {0}", m_Path);
|
throw new WarningException("Could not resolve solution path: {0}", m_Path);
|
||||||
}
|
}
|
||||||
|
|
||||||
Kernel.Instance.CurrentWorkingDirectory.Push();
|
Kernel.Instance.CurrentWorkingDirectory.Push();
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Helper.SetCurrentDir(m_FullPath);
|
Helper.SetCurrentDir(m_FullPath);
|
||||||
|
|
||||||
if( node == null )
|
if( node == null )
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("node");
|
throw new ArgumentNullException("node");
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach(XmlNode child in node.ChildNodes)
|
foreach(XmlNode child in node.ChildNodes)
|
||||||
{
|
{
|
||||||
IDataNode dataNode = Kernel.Instance.ParseNode(child, this);
|
IDataNode dataNode = Kernel.Instance.ParseNode(child, this);
|
||||||
if(dataNode is OptionsNode)
|
if(dataNode is OptionsNode)
|
||||||
{
|
{
|
||||||
m_Options = (OptionsNode)dataNode;
|
m_Options = (OptionsNode)dataNode;
|
||||||
}
|
}
|
||||||
else if(dataNode is FilesNode)
|
else if(dataNode is FilesNode)
|
||||||
{
|
{
|
||||||
m_Files = (FilesNode)dataNode;
|
m_Files = (FilesNode)dataNode;
|
||||||
}
|
}
|
||||||
else if(dataNode is ConfigurationNode)
|
else if(dataNode is ConfigurationNode)
|
||||||
{
|
{
|
||||||
ConfigurationNode configurationNode = (ConfigurationNode) dataNode;
|
ConfigurationNode configurationNode = (ConfigurationNode) dataNode;
|
||||||
m_Configurations[configurationNode.NameAndPlatform] = configurationNode;
|
m_Configurations[configurationNode.NameAndPlatform] = configurationNode;
|
||||||
|
|
||||||
// If the active configuration is null, then we populate it.
|
// If the active configuration is null, then we populate it.
|
||||||
if (ActiveConfig == null)
|
if (ActiveConfig == null)
|
||||||
{
|
{
|
||||||
ActiveConfig = configurationNode.Name;
|
ActiveConfig = configurationNode.Name;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(dataNode is ProjectNode)
|
else if(dataNode is ProjectNode)
|
||||||
{
|
{
|
||||||
m_Projects[((ProjectNode)dataNode).Name] = (ProjectNode) dataNode;
|
m_Projects[((ProjectNode)dataNode).Name] = (ProjectNode) dataNode;
|
||||||
m_ProjectsOrder.Add((ProjectNode)dataNode);
|
m_ProjectsOrder.Add((ProjectNode)dataNode);
|
||||||
}
|
}
|
||||||
else if(dataNode is SolutionNode)
|
else if(dataNode is SolutionNode)
|
||||||
{
|
{
|
||||||
m_Solutions[((SolutionNode)dataNode).Name] = (SolutionNode) dataNode;
|
m_Solutions[((SolutionNode)dataNode).Name] = (SolutionNode) dataNode;
|
||||||
|
@ -369,14 +369,14 @@ namespace Prebuild.Core.Nodes
|
||||||
throw new WarningException("There can only be one Cleanup node.");
|
throw new WarningException("There can only be one Cleanup node.");
|
||||||
m_Cleanup = (CleanupNode)dataNode;
|
m_Cleanup = (CleanupNode)dataNode;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
Kernel.Instance.CurrentWorkingDirectory.Pop();
|
Kernel.Instance.CurrentWorkingDirectory.Pop();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,128 +27,128 @@ using System;
|
||||||
|
|
||||||
namespace Prebuild.Core.Parse
|
namespace Prebuild.Core.Parse
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public enum IfState
|
public enum IfState
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
None,
|
None,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
If,
|
If,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
ElseIf,
|
ElseIf,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Else
|
Else
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Summary description for IfContext.
|
/// Summary description for IfContext.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
// Inspired by the equivalent WiX class (see www.sourceforge.net/projects/wix/)
|
// Inspired by the equivalent WiX class (see www.sourceforge.net/projects/wix/)
|
||||||
public class IfContext
|
public class IfContext
|
||||||
{
|
{
|
||||||
#region Properties
|
#region Properties
|
||||||
|
|
||||||
bool m_Active;
|
bool m_Active;
|
||||||
bool m_Keep;
|
bool m_Keep;
|
||||||
bool m_EverKept;
|
bool m_EverKept;
|
||||||
IfState m_State = IfState.None;
|
IfState m_State = IfState.None;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Constructors
|
#region Constructors
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of the <see cref="IfContext"/> class.
|
/// Initializes a new instance of the <see cref="IfContext"/> class.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="active">if set to <c>true</c> [active].</param>
|
/// <param name="active">if set to <c>true</c> [active].</param>
|
||||||
/// <param name="keep">if set to <c>true</c> [keep].</param>
|
/// <param name="keep">if set to <c>true</c> [keep].</param>
|
||||||
/// <param name="state">The state.</param>
|
/// <param name="state">The state.</param>
|
||||||
public IfContext(bool active, bool keep, IfState state)
|
public IfContext(bool active, bool keep, IfState state)
|
||||||
{
|
{
|
||||||
m_Active = active;
|
m_Active = active;
|
||||||
m_Keep = keep;
|
m_Keep = keep;
|
||||||
m_EverKept = keep;
|
m_EverKept = keep;
|
||||||
m_State = state;
|
m_State = state;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Properties
|
#region Properties
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets a value indicating whether this <see cref="IfContext"/> is active.
|
/// Gets or sets a value indicating whether this <see cref="IfContext"/> is active.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value><c>true</c> if active; otherwise, <c>false</c>.</value>
|
/// <value><c>true</c> if active; otherwise, <c>false</c>.</value>
|
||||||
public bool Active
|
public bool Active
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return m_Active;
|
return m_Active;
|
||||||
}
|
}
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
m_Active = value;
|
m_Active = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets a value indicating whether this <see cref="IfContext"/> is keep.
|
/// Gets or sets a value indicating whether this <see cref="IfContext"/> is keep.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value><c>true</c> if keep; otherwise, <c>false</c>.</value>
|
/// <value><c>true</c> if keep; otherwise, <c>false</c>.</value>
|
||||||
public bool Keep
|
public bool Keep
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return m_Keep;
|
return m_Keep;
|
||||||
}
|
}
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
m_Keep = value;
|
m_Keep = value;
|
||||||
if(m_Keep)
|
if(m_Keep)
|
||||||
{
|
{
|
||||||
m_EverKept = true;
|
m_EverKept = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets a value indicating whether [ever kept].
|
/// Gets a value indicating whether [ever kept].
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value><c>true</c> if [ever kept]; otherwise, <c>false</c>.</value>
|
/// <value><c>true</c> if [ever kept]; otherwise, <c>false</c>.</value>
|
||||||
public bool EverKept
|
public bool EverKept
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return m_EverKept;
|
return m_EverKept;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the state.
|
/// Gets or sets the state.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The state.</value>
|
/// <value>The state.</value>
|
||||||
public IfState State
|
public IfState State
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return m_State;
|
return m_State;
|
||||||
}
|
}
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
m_State = value;
|
m_State = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,336 +31,336 @@ using System.Xml;
|
||||||
|
|
||||||
namespace Prebuild.Core.Parse
|
namespace Prebuild.Core.Parse
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public enum OperatorSymbol
|
public enum OperatorSymbol
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
None,
|
None,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Equal,
|
Equal,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
NotEqual,
|
NotEqual,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
LessThan,
|
LessThan,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
GreaterThan,
|
GreaterThan,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
LessThanEqual,
|
LessThanEqual,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
GreaterThanEqual
|
GreaterThanEqual
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class Preprocessor
|
public class Preprocessor
|
||||||
{
|
{
|
||||||
#region Constants
|
#region Constants
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Includes the regex to look for file tags in the <?include
|
/// Includes the regex to look for file tags in the <?include
|
||||||
/// ?> processing instruction.
|
/// ?> processing instruction.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private static readonly Regex includeFileRegex = new Regex("file=\"(.+?)\"");
|
private static readonly Regex includeFileRegex = new Regex("file=\"(.+?)\"");
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Fields
|
#region Fields
|
||||||
|
|
||||||
readonly XmlDocument m_OutDoc = new XmlDocument();
|
readonly XmlDocument m_OutDoc = new XmlDocument();
|
||||||
readonly Stack<IfContext> m_IfStack = new Stack<IfContext>();
|
readonly Stack<IfContext> m_IfStack = new Stack<IfContext>();
|
||||||
readonly Dictionary<string, object> m_Variables = new Dictionary<string, object>();
|
readonly Dictionary<string, object> m_Variables = new Dictionary<string, object>();
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Constructors
|
#region Constructors
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of the <see cref="Preprocessor"/> class.
|
/// Initializes a new instance of the <see cref="Preprocessor"/> class.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Preprocessor()
|
public Preprocessor()
|
||||||
{
|
{
|
||||||
RegisterVariable("OS", GetOS());
|
RegisterVariable("OS", GetOS());
|
||||||
RegisterVariable("RuntimeVersion", Environment.Version.Major);
|
RegisterVariable("RuntimeVersion", Environment.Version.Major);
|
||||||
RegisterVariable("RuntimeMajor", Environment.Version.Major);
|
RegisterVariable("RuntimeMajor", Environment.Version.Major);
|
||||||
RegisterVariable("RuntimeMinor", Environment.Version.Minor);
|
RegisterVariable("RuntimeMinor", Environment.Version.Minor);
|
||||||
RegisterVariable("RuntimeRevision", Environment.Version.Revision);
|
RegisterVariable("RuntimeRevision", Environment.Version.Revision);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Properties
|
#region Properties
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the processed doc.
|
/// Gets the processed doc.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The processed doc.</value>
|
/// <value>The processed doc.</value>
|
||||||
public XmlDocument ProcessedDoc
|
public XmlDocument ProcessedDoc
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return m_OutDoc;
|
return m_OutDoc;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Private Methods
|
#region Private Methods
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Parts of this code were taken from NAnt and is subject to the GPL
|
/// Parts of this code were taken from NAnt and is subject to the GPL
|
||||||
/// as per NAnt's license. Thanks to the NAnt guys for this little gem.
|
/// as per NAnt's license. Thanks to the NAnt guys for this little gem.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public static string GetOS()
|
public static string GetOS()
|
||||||
{
|
{
|
||||||
PlatformID platId = Environment.OSVersion.Platform;
|
PlatformID platId = Environment.OSVersion.Platform;
|
||||||
if(platId == PlatformID.Win32NT || platId == PlatformID.Win32Windows)
|
if(platId == PlatformID.Win32NT || platId == PlatformID.Win32Windows)
|
||||||
{
|
{
|
||||||
return "Win32";
|
return "Win32";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (File.Exists("/System/Library/Frameworks/Cocoa.framework/Cocoa"))
|
if (File.Exists("/System/Library/Frameworks/Cocoa.framework/Cocoa"))
|
||||||
{
|
{
|
||||||
return "MACOSX";
|
return "MACOSX";
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* .NET 1.x, under Mono, the UNIX code is 128. Under
|
* .NET 1.x, under Mono, the UNIX code is 128. Under
|
||||||
* .NET 2.x, Mono or MS, the UNIX code is 4
|
* .NET 2.x, Mono or MS, the UNIX code is 4
|
||||||
*/
|
*/
|
||||||
if(Environment.Version.Major == 1)
|
if(Environment.Version.Major == 1)
|
||||||
{
|
{
|
||||||
if((int)platId == 128)
|
if((int)platId == 128)
|
||||||
{
|
{
|
||||||
return "UNIX";
|
return "UNIX";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if((int)platId == 4)
|
else if((int)platId == 4)
|
||||||
{
|
{
|
||||||
return "UNIX";
|
return "UNIX";
|
||||||
}
|
}
|
||||||
|
|
||||||
return "Unknown";
|
return "Unknown";
|
||||||
}
|
}
|
||||||
|
|
||||||
private static bool CompareNum(OperatorSymbol oper, int val1, int val2)
|
private static bool CompareNum(OperatorSymbol oper, int val1, int val2)
|
||||||
{
|
{
|
||||||
switch(oper)
|
switch(oper)
|
||||||
{
|
{
|
||||||
case OperatorSymbol.Equal:
|
case OperatorSymbol.Equal:
|
||||||
return (val1 == val2);
|
return (val1 == val2);
|
||||||
case OperatorSymbol.NotEqual:
|
case OperatorSymbol.NotEqual:
|
||||||
return (val1 != val2);
|
return (val1 != val2);
|
||||||
case OperatorSymbol.LessThan:
|
case OperatorSymbol.LessThan:
|
||||||
return (val1 < val2);
|
return (val1 < val2);
|
||||||
case OperatorSymbol.LessThanEqual:
|
case OperatorSymbol.LessThanEqual:
|
||||||
return (val1 <= val2);
|
return (val1 <= val2);
|
||||||
case OperatorSymbol.GreaterThan:
|
case OperatorSymbol.GreaterThan:
|
||||||
return (val1 > val2);
|
return (val1 > val2);
|
||||||
case OperatorSymbol.GreaterThanEqual:
|
case OperatorSymbol.GreaterThanEqual:
|
||||||
return (val1 >= val2);
|
return (val1 >= val2);
|
||||||
}
|
}
|
||||||
|
|
||||||
throw new WarningException("Unknown operator type");
|
throw new WarningException("Unknown operator type");
|
||||||
}
|
}
|
||||||
|
|
||||||
private static bool CompareStr(OperatorSymbol oper, string val1, string val2)
|
private static bool CompareStr(OperatorSymbol oper, string val1, string val2)
|
||||||
{
|
{
|
||||||
switch(oper)
|
switch(oper)
|
||||||
{
|
{
|
||||||
case OperatorSymbol.Equal:
|
case OperatorSymbol.Equal:
|
||||||
return (val1 == val2);
|
return (val1 == val2);
|
||||||
case OperatorSymbol.NotEqual:
|
case OperatorSymbol.NotEqual:
|
||||||
return (val1 != val2);
|
return (val1 != val2);
|
||||||
case OperatorSymbol.LessThan:
|
case OperatorSymbol.LessThan:
|
||||||
return (val1.CompareTo(val2) < 0);
|
return (val1.CompareTo(val2) < 0);
|
||||||
case OperatorSymbol.LessThanEqual:
|
case OperatorSymbol.LessThanEqual:
|
||||||
return (val1.CompareTo(val2) <= 0);
|
return (val1.CompareTo(val2) <= 0);
|
||||||
case OperatorSymbol.GreaterThan:
|
case OperatorSymbol.GreaterThan:
|
||||||
return (val1.CompareTo(val2) > 0);
|
return (val1.CompareTo(val2) > 0);
|
||||||
case OperatorSymbol.GreaterThanEqual:
|
case OperatorSymbol.GreaterThanEqual:
|
||||||
return (val1.CompareTo(val2) >= 0);
|
return (val1.CompareTo(val2) >= 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
throw new WarningException("Unknown operator type");
|
throw new WarningException("Unknown operator type");
|
||||||
}
|
}
|
||||||
|
|
||||||
private static char NextChar(int idx, string str)
|
private static char NextChar(int idx, string str)
|
||||||
{
|
{
|
||||||
if((idx + 1) >= str.Length)
|
if((idx + 1) >= str.Length)
|
||||||
{
|
{
|
||||||
return Char.MaxValue;
|
return Char.MaxValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
return str[idx + 1];
|
return str[idx + 1];
|
||||||
}
|
}
|
||||||
// Very very simple expression parser. Can only match expressions of the form
|
// Very very simple expression parser. Can only match expressions of the form
|
||||||
// <var> <op> <value>:
|
// <var> <op> <value>:
|
||||||
// OS = Windows
|
// OS = Windows
|
||||||
// OS != Linux
|
// OS != Linux
|
||||||
// RuntimeMinor > 0
|
// RuntimeMinor > 0
|
||||||
private bool ParseExpression(string exp)
|
private bool ParseExpression(string exp)
|
||||||
{
|
{
|
||||||
if(exp == null)
|
if(exp == null)
|
||||||
{
|
{
|
||||||
throw new ArgumentException("Invalid expression, cannot be null");
|
throw new ArgumentException("Invalid expression, cannot be null");
|
||||||
}
|
}
|
||||||
|
|
||||||
exp = exp.Trim();
|
exp = exp.Trim();
|
||||||
if(exp.Length < 1)
|
if(exp.Length < 1)
|
||||||
{
|
{
|
||||||
throw new ArgumentException("Invalid expression, cannot be 0 length");
|
throw new ArgumentException("Invalid expression, cannot be 0 length");
|
||||||
}
|
}
|
||||||
|
|
||||||
string id = "";
|
string id = "";
|
||||||
string str = "";
|
string str = "";
|
||||||
OperatorSymbol oper = OperatorSymbol.None;
|
OperatorSymbol oper = OperatorSymbol.None;
|
||||||
bool inStr = false;
|
bool inStr = false;
|
||||||
|
|
||||||
for(int i = 0; i < exp.Length; i++)
|
for(int i = 0; i < exp.Length; i++)
|
||||||
{
|
{
|
||||||
char c = exp[i];
|
char c = exp[i];
|
||||||
if(Char.IsWhiteSpace(c))
|
if(Char.IsWhiteSpace(c))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(Char.IsLetterOrDigit(c) || c == '_')
|
if(Char.IsLetterOrDigit(c) || c == '_')
|
||||||
{
|
{
|
||||||
if(inStr)
|
if(inStr)
|
||||||
{
|
{
|
||||||
str += c;
|
str += c;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
id += c;
|
id += c;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(c == '\"')
|
else if(c == '\"')
|
||||||
{
|
{
|
||||||
inStr = !inStr;
|
inStr = !inStr;
|
||||||
if(inStr)
|
if(inStr)
|
||||||
{
|
{
|
||||||
str = "";
|
str = "";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if(inStr)
|
if(inStr)
|
||||||
{
|
{
|
||||||
str += c;
|
str += c;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
switch(c)
|
switch(c)
|
||||||
{
|
{
|
||||||
case '=':
|
case '=':
|
||||||
oper = OperatorSymbol.Equal;
|
oper = OperatorSymbol.Equal;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case '!':
|
case '!':
|
||||||
if(NextChar(i, exp) == '=')
|
if(NextChar(i, exp) == '=')
|
||||||
{
|
{
|
||||||
oper = OperatorSymbol.NotEqual;
|
oper = OperatorSymbol.NotEqual;
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case '<':
|
case '<':
|
||||||
if(NextChar(i, exp) == '=')
|
if(NextChar(i, exp) == '=')
|
||||||
{
|
{
|
||||||
oper = OperatorSymbol.LessThanEqual;
|
oper = OperatorSymbol.LessThanEqual;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
oper = OperatorSymbol.LessThan;
|
oper = OperatorSymbol.LessThan;
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case '>':
|
case '>':
|
||||||
if(NextChar(i, exp) == '=')
|
if(NextChar(i, exp) == '=')
|
||||||
{
|
{
|
||||||
oper = OperatorSymbol.GreaterThanEqual;
|
oper = OperatorSymbol.GreaterThanEqual;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
oper = OperatorSymbol.GreaterThan;
|
oper = OperatorSymbol.GreaterThan;
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if(inStr)
|
if(inStr)
|
||||||
{
|
{
|
||||||
throw new WarningException("Expected end of string in expression");
|
throw new WarningException("Expected end of string in expression");
|
||||||
}
|
}
|
||||||
|
|
||||||
if(oper == OperatorSymbol.None)
|
if(oper == OperatorSymbol.None)
|
||||||
{
|
{
|
||||||
throw new WarningException("Expected operator in expression");
|
throw new WarningException("Expected operator in expression");
|
||||||
}
|
}
|
||||||
if(id.Length < 1)
|
if(id.Length < 1)
|
||||||
{
|
{
|
||||||
throw new WarningException("Expected identifier in expression");
|
throw new WarningException("Expected identifier in expression");
|
||||||
}
|
}
|
||||||
if(str.Length < 1)
|
if(str.Length < 1)
|
||||||
{
|
{
|
||||||
throw new WarningException("Expected value in expression");
|
throw new WarningException("Expected value in expression");
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ret;
|
bool ret;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
object val = m_Variables[id.ToLower()];
|
object val = m_Variables[id.ToLower()];
|
||||||
if(val == null)
|
if(val == null)
|
||||||
{
|
{
|
||||||
throw new WarningException("Unknown identifier '{0}'", id);
|
throw new WarningException("Unknown identifier '{0}'", id);
|
||||||
}
|
}
|
||||||
|
|
||||||
Type t = val.GetType();
|
Type t = val.GetType();
|
||||||
if(t.IsAssignableFrom(typeof(int)))
|
if(t.IsAssignableFrom(typeof(int)))
|
||||||
{
|
{
|
||||||
int numVal = (int)val;
|
int numVal = (int)val;
|
||||||
int numVal2 = Int32.Parse(str);
|
int numVal2 = Int32.Parse(str);
|
||||||
ret = CompareNum(oper, numVal, numVal2);
|
ret = CompareNum(oper, numVal, numVal2);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
string strVal = val.ToString();
|
string strVal = val.ToString();
|
||||||
string strVal2 = str;
|
string strVal2 = str;
|
||||||
ret = CompareStr(oper, strVal, strVal2);
|
ret = CompareStr(oper, strVal, strVal2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch(ArgumentException ex)
|
catch(ArgumentException ex)
|
||||||
{
|
{
|
||||||
ex.ToString();
|
ex.ToString();
|
||||||
throw new WarningException("Invalid value type for system variable '{0}', expected int", id);
|
throw new WarningException("Invalid value type for system variable '{0}', expected int", id);
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Taken from current Prebuild included in OpenSim 0.7.x
|
/// Taken from current Prebuild included in OpenSim 0.7.x
|
||||||
|
@ -426,85 +426,85 @@ namespace Prebuild.Core.Parse
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Public Methods
|
#region Public Methods
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="name"></param>
|
/// <param name="name"></param>
|
||||||
/// <param name="variableValue"></param>
|
/// <param name="variableValue"></param>
|
||||||
public void RegisterVariable(string name, object variableValue)
|
public void RegisterVariable(string name, object variableValue)
|
||||||
{
|
{
|
||||||
if(name == null || variableValue == null)
|
if(name == null || variableValue == null)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_Variables[name.ToLower()] = variableValue;
|
m_Variables[name.ToLower()] = variableValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Performs validation on the xml source as well as evaluates conditional and flow expresions
|
/// Performs validation on the xml source as well as evaluates conditional and flow expresions
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <exception cref="ArgumentException">For invalid use of conditional expressions or for invalid XML syntax. If a XmlValidatingReader is passed, then will also throw exceptions for non-schema-conforming xml</exception>
|
/// <exception cref="ArgumentException">For invalid use of conditional expressions or for invalid XML syntax. If a XmlValidatingReader is passed, then will also throw exceptions for non-schema-conforming xml</exception>
|
||||||
/// <param name="initialReader"></param>
|
/// <param name="initialReader"></param>
|
||||||
/// <returns>the output xml </returns>
|
/// <returns>the output xml </returns>
|
||||||
public string Process(XmlReader initialReader)
|
public string Process(XmlReader initialReader)
|
||||||
{
|
{
|
||||||
if(initialReader == null)
|
if(initialReader == null)
|
||||||
{
|
{
|
||||||
throw new ArgumentException("Invalid XML reader to pre-process");
|
throw new ArgumentException("Invalid XML reader to pre-process");
|
||||||
}
|
}
|
||||||
|
|
||||||
IfContext context = new IfContext(true, true, IfState.None);
|
IfContext context = new IfContext(true, true, IfState.None);
|
||||||
StringWriter xmlText = new StringWriter();
|
StringWriter xmlText = new StringWriter();
|
||||||
XmlTextWriter writer = new XmlTextWriter(xmlText);
|
XmlTextWriter writer = new XmlTextWriter(xmlText);
|
||||||
writer.Formatting = Formatting.Indented;
|
writer.Formatting = Formatting.Indented;
|
||||||
|
|
||||||
// Create a queue of XML readers and add the initial
|
// Create a queue of XML readers and add the initial
|
||||||
// reader to it. Then we process until we run out of
|
// reader to it. Then we process until we run out of
|
||||||
// readers which lets the <?include?> operation add more
|
// readers which lets the <?include?> operation add more
|
||||||
// readers to generate a multi-file parser and not require
|
// readers to generate a multi-file parser and not require
|
||||||
// XML fragments that a recursive version would use.
|
// XML fragments that a recursive version would use.
|
||||||
Stack<XmlReader> readerStack = new Stack<XmlReader>();
|
Stack<XmlReader> readerStack = new Stack<XmlReader>();
|
||||||
readerStack.Push(initialReader);
|
readerStack.Push(initialReader);
|
||||||
|
|
||||||
while(readerStack.Count > 0)
|
while(readerStack.Count > 0)
|
||||||
{
|
{
|
||||||
// Pop off the next reader.
|
// Pop off the next reader.
|
||||||
XmlReader reader = readerStack.Pop();
|
XmlReader reader = readerStack.Pop();
|
||||||
|
|
||||||
// Process through this XML reader until it is
|
// Process through this XML reader until it is
|
||||||
// completed (or it is replaced by the include
|
// completed (or it is replaced by the include
|
||||||
// operation).
|
// operation).
|
||||||
while(reader.Read())
|
while(reader.Read())
|
||||||
{
|
{
|
||||||
// The prebuild file has a series of processing
|
// The prebuild file has a series of processing
|
||||||
// instructions which allow for specific
|
// instructions which allow for specific
|
||||||
// inclusions based on operating system or to
|
// inclusions based on operating system or to
|
||||||
// include additional files.
|
// include additional files.
|
||||||
if(reader.NodeType == XmlNodeType.ProcessingInstruction)
|
if(reader.NodeType == XmlNodeType.ProcessingInstruction)
|
||||||
{
|
{
|
||||||
bool ignore = false;
|
bool ignore = false;
|
||||||
|
|
||||||
switch(reader.LocalName)
|
switch(reader.LocalName)
|
||||||
{
|
{
|
||||||
case "include":
|
case "include":
|
||||||
// use regular expressions to parse out the attributes.
|
// use regular expressions to parse out the attributes.
|
||||||
MatchCollection matches = includeFileRegex.Matches(reader.Value);
|
MatchCollection matches = includeFileRegex.Matches(reader.Value);
|
||||||
|
|
||||||
// make sure there is only one file attribute.
|
// make sure there is only one file attribute.
|
||||||
if(matches.Count > 1)
|
if(matches.Count > 1)
|
||||||
{
|
{
|
||||||
throw new WarningException("An <?include ?> node was found, but it specified more than one file.");
|
throw new WarningException("An <?include ?> node was found, but it specified more than one file.");
|
||||||
}
|
}
|
||||||
|
|
||||||
if(matches.Count == 0)
|
if(matches.Count == 0)
|
||||||
{
|
{
|
||||||
throw new WarningException("An <?include ?> node was found, but it did not specify the file attribute.");
|
throw new WarningException("An <?include ?> node was found, but it did not specify the file attribute.");
|
||||||
}
|
}
|
||||||
|
|
||||||
// ***** Adding for wildcard handling
|
// ***** Adding for wildcard handling
|
||||||
// Push current reader back onto the stack.
|
// Push current reader back onto the stack.
|
||||||
|
@ -537,116 +537,116 @@ namespace Prebuild.Core.Parse
|
||||||
ignore = true;
|
ignore = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "if":
|
case "if":
|
||||||
m_IfStack.Push(context);
|
m_IfStack.Push(context);
|
||||||
context = new IfContext(context.Keep & context.Active, ParseExpression(reader.Value), IfState.If);
|
context = new IfContext(context.Keep & context.Active, ParseExpression(reader.Value), IfState.If);
|
||||||
ignore = true;
|
ignore = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "elseif":
|
case "elseif":
|
||||||
if(m_IfStack.Count == 0)
|
if(m_IfStack.Count == 0)
|
||||||
{
|
{
|
||||||
throw new WarningException("Unexpected 'elseif' outside of 'if'");
|
throw new WarningException("Unexpected 'elseif' outside of 'if'");
|
||||||
}
|
}
|
||||||
if(context.State != IfState.If && context.State != IfState.ElseIf)
|
if(context.State != IfState.If && context.State != IfState.ElseIf)
|
||||||
{
|
{
|
||||||
throw new WarningException("Unexpected 'elseif' outside of 'if'");
|
throw new WarningException("Unexpected 'elseif' outside of 'if'");
|
||||||
}
|
}
|
||||||
|
|
||||||
context.State = IfState.ElseIf;
|
context.State = IfState.ElseIf;
|
||||||
if(!context.EverKept)
|
if(!context.EverKept)
|
||||||
{
|
{
|
||||||
context.Keep = ParseExpression(reader.Value);
|
context.Keep = ParseExpression(reader.Value);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
context.Keep = false;
|
context.Keep = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
ignore = true;
|
ignore = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "else":
|
case "else":
|
||||||
if(m_IfStack.Count == 0)
|
if(m_IfStack.Count == 0)
|
||||||
{
|
{
|
||||||
throw new WarningException("Unexpected 'else' outside of 'if'");
|
throw new WarningException("Unexpected 'else' outside of 'if'");
|
||||||
}
|
}
|
||||||
if(context.State != IfState.If && context.State != IfState.ElseIf)
|
if(context.State != IfState.If && context.State != IfState.ElseIf)
|
||||||
{
|
{
|
||||||
throw new WarningException("Unexpected 'else' outside of 'if'");
|
throw new WarningException("Unexpected 'else' outside of 'if'");
|
||||||
}
|
}
|
||||||
|
|
||||||
context.State = IfState.Else;
|
context.State = IfState.Else;
|
||||||
context.Keep = !context.EverKept;
|
context.Keep = !context.EverKept;
|
||||||
ignore = true;
|
ignore = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "endif":
|
case "endif":
|
||||||
if(m_IfStack.Count == 0)
|
if(m_IfStack.Count == 0)
|
||||||
{
|
{
|
||||||
throw new WarningException("Unexpected 'endif' outside of 'if'");
|
throw new WarningException("Unexpected 'endif' outside of 'if'");
|
||||||
}
|
}
|
||||||
|
|
||||||
context = m_IfStack.Pop();
|
context = m_IfStack.Pop();
|
||||||
ignore = true;
|
ignore = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(ignore)
|
if(ignore)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}//end pre-proc instruction
|
}//end pre-proc instruction
|
||||||
|
|
||||||
if(!context.Active || !context.Keep)
|
if(!context.Active || !context.Keep)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch(reader.NodeType)
|
switch(reader.NodeType)
|
||||||
{
|
{
|
||||||
case XmlNodeType.Element:
|
case XmlNodeType.Element:
|
||||||
bool empty = reader.IsEmptyElement;
|
bool empty = reader.IsEmptyElement;
|
||||||
writer.WriteStartElement(reader.Name);
|
writer.WriteStartElement(reader.Name);
|
||||||
|
|
||||||
while (reader.MoveToNextAttribute())
|
while (reader.MoveToNextAttribute())
|
||||||
{
|
{
|
||||||
writer.WriteAttributeString(reader.Name, reader.Value);
|
writer.WriteAttributeString(reader.Name, reader.Value);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(empty)
|
if(empty)
|
||||||
{
|
{
|
||||||
writer.WriteEndElement();
|
writer.WriteEndElement();
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case XmlNodeType.EndElement:
|
case XmlNodeType.EndElement:
|
||||||
writer.WriteEndElement();
|
writer.WriteEndElement();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case XmlNodeType.Text:
|
case XmlNodeType.Text:
|
||||||
writer.WriteString(reader.Value);
|
writer.WriteString(reader.Value);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case XmlNodeType.CDATA:
|
case XmlNodeType.CDATA:
|
||||||
writer.WriteCData(reader.Value);
|
writer.WriteCData(reader.Value);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(m_IfStack.Count != 0)
|
if(m_IfStack.Count != 0)
|
||||||
{
|
{
|
||||||
throw new WarningException("Mismatched 'if', 'endif' pair");
|
throw new WarningException("Mismatched 'if', 'endif' pair");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return xmlText.ToString();
|
return xmlText.ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,62 +41,62 @@ using Prebuild.Core.Nodes;
|
||||||
#if (DEBUG && _DEBUG_TARGET)
|
#if (DEBUG && _DEBUG_TARGET)
|
||||||
namespace Prebuild.Core.Targets
|
namespace Prebuild.Core.Targets
|
||||||
{
|
{
|
||||||
[Target("debug")]
|
[Target("debug")]
|
||||||
public class DebugTarget : ITarget
|
public class DebugTarget : ITarget
|
||||||
{
|
{
|
||||||
#region Fields
|
#region Fields
|
||||||
|
|
||||||
private Kernel m_Kernel = null;
|
private Kernel m_Kernel = null;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region ITarget Members
|
#region ITarget Members
|
||||||
|
|
||||||
public void Write()
|
public void Write()
|
||||||
{
|
{
|
||||||
foreach(SolutionNode s in m_Kernel.Solutions)
|
foreach(SolutionNode s in m_Kernel.Solutions)
|
||||||
{
|
{
|
||||||
Console.WriteLine("Solution [ {0}, {1} ]", s.Name, s.Path);
|
Console.WriteLine("Solution [ {0}, {1} ]", s.Name, s.Path);
|
||||||
foreach(string file in s.Files)
|
foreach(string file in s.Files)
|
||||||
{
|
{
|
||||||
Console.WriteLine("\tFile [ {0} ]", file);
|
Console.WriteLine("\tFile [ {0} ]", file);
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach(ProjectNode proj in s.Projects)
|
foreach(ProjectNode proj in s.Projects)
|
||||||
{
|
{
|
||||||
Console.WriteLine("\tProject [ {0}, {1}. {2} ]", proj.Name, proj.Path, proj.Language);
|
Console.WriteLine("\tProject [ {0}, {1}. {2} ]", proj.Name, proj.Path, proj.Language);
|
||||||
foreach(string file in proj.Files)
|
foreach(string file in proj.Files)
|
||||||
Console.WriteLine("\t\tFile [ {0} ]", file);
|
Console.WriteLine("\t\tFile [ {0} ]", file);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Clean()
|
public void Clean()
|
||||||
{
|
{
|
||||||
Console.WriteLine("Not implemented");
|
Console.WriteLine("Not implemented");
|
||||||
}
|
}
|
||||||
|
|
||||||
public string Name
|
public string Name
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return "debug";
|
return "debug";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Kernel Kernel
|
public Kernel Kernel
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return m_Kernel;
|
return m_Kernel;
|
||||||
}
|
}
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
m_Kernel = value;
|
m_Kernel = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -35,481 +35,481 @@ using Prebuild.Core.Utilities;
|
||||||
|
|
||||||
namespace Prebuild.Core.Targets
|
namespace Prebuild.Core.Targets
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Target("monodev")]
|
[Target("monodev")]
|
||||||
public class MonoDevelopTarget : ITarget
|
public class MonoDevelopTarget : ITarget
|
||||||
{
|
{
|
||||||
#region Fields
|
#region Fields
|
||||||
|
|
||||||
private Kernel m_Kernel;
|
private Kernel m_Kernel;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Private Methods
|
#region Private Methods
|
||||||
|
|
||||||
private static string PrependPath(string path)
|
private static string PrependPath(string path)
|
||||||
{
|
{
|
||||||
string tmpPath = Helper.NormalizePath(path, '/');
|
string tmpPath = Helper.NormalizePath(path, '/');
|
||||||
Regex regex = new Regex(@"(\w):/(\w+)");
|
Regex regex = new Regex(@"(\w):/(\w+)");
|
||||||
Match match = regex.Match(tmpPath);
|
Match match = regex.Match(tmpPath);
|
||||||
if(match.Success || tmpPath[0] == '.' || tmpPath[0] == '/')
|
if(match.Success || tmpPath[0] == '.' || tmpPath[0] == '/')
|
||||||
{
|
{
|
||||||
tmpPath = Helper.NormalizePath(tmpPath);
|
tmpPath = Helper.NormalizePath(tmpPath);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
tmpPath = Helper.NormalizePath("./" + tmpPath);
|
tmpPath = Helper.NormalizePath("./" + tmpPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
return tmpPath;
|
return tmpPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static string BuildReference(SolutionNode solution, ReferenceNode refr)
|
private static string BuildReference(SolutionNode solution, ReferenceNode refr)
|
||||||
{
|
{
|
||||||
string ret = "<ProjectReference type=\"";
|
string ret = "<ProjectReference type=\"";
|
||||||
if(solution.ProjectsTable.ContainsKey(refr.Name))
|
if(solution.ProjectsTable.ContainsKey(refr.Name))
|
||||||
{
|
{
|
||||||
ret += "Project\"";
|
ret += "Project\"";
|
||||||
ret += " localcopy=\"" + refr.LocalCopy.ToString() + "\" refto=\"" + refr.Name + "\" />";
|
ret += " localcopy=\"" + refr.LocalCopy.ToString() + "\" refto=\"" + refr.Name + "\" />";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ProjectNode project = (ProjectNode)refr.Parent;
|
ProjectNode project = (ProjectNode)refr.Parent;
|
||||||
string fileRef = FindFileReference(refr.Name, project);
|
string fileRef = FindFileReference(refr.Name, project);
|
||||||
|
|
||||||
if(refr.Path != null || fileRef != null)
|
if(refr.Path != null || fileRef != null)
|
||||||
{
|
{
|
||||||
ret += "Assembly\" refto=\"";
|
ret += "Assembly\" refto=\"";
|
||||||
|
|
||||||
string finalPath = (refr.Path != null) ? Helper.MakeFilePath(refr.Path, refr.Name, "dll") : fileRef;
|
string finalPath = (refr.Path != null) ? Helper.MakeFilePath(refr.Path, refr.Name, "dll") : fileRef;
|
||||||
|
|
||||||
ret += finalPath;
|
ret += finalPath;
|
||||||
ret += "\" localcopy=\"" + refr.LocalCopy.ToString() + "\" />";
|
ret += "\" localcopy=\"" + refr.LocalCopy.ToString() + "\" />";
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret += "Gac\"";
|
ret += "Gac\"";
|
||||||
ret += " localcopy=\"" + refr.LocalCopy.ToString() + "\"";
|
ret += " localcopy=\"" + refr.LocalCopy.ToString() + "\"";
|
||||||
ret += " refto=\"";
|
ret += " refto=\"";
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
Day changed to 28 Mar 2007
|
Day changed to 28 Mar 2007
|
||||||
...
|
...
|
||||||
08:09 < cj> is there anything that replaces Assembly.LoadFromPartialName() ?
|
08:09 < cj> is there anything that replaces Assembly.LoadFromPartialName() ?
|
||||||
08:09 < jonp> no
|
08:09 < jonp> no
|
||||||
08:10 < jonp> in their infinite wisdom [sic], microsoft decided that the
|
08:10 < jonp> in their infinite wisdom [sic], microsoft decided that the
|
||||||
ability to load any assembly version by-name was an inherently
|
ability to load any assembly version by-name was an inherently
|
||||||
bad idea
|
bad idea
|
||||||
08:11 < cj> I'm thinking of a bunch of four-letter words right now...
|
08:11 < cj> I'm thinking of a bunch of four-letter words right now...
|
||||||
08:11 < cj> security through making it difficult for the developer!!!
|
08:11 < cj> security through making it difficult for the developer!!!
|
||||||
08:12 < jonp> just use the Obsolete API
|
08:12 < jonp> just use the Obsolete API
|
||||||
08:12 < jonp> it should still work
|
08:12 < jonp> it should still work
|
||||||
08:12 < cj> alrighty.
|
08:12 < cj> alrighty.
|
||||||
08:12 < jonp> you just get warnings when using it
|
08:12 < jonp> you just get warnings when using it
|
||||||
*/
|
*/
|
||||||
Assembly assem = Assembly.LoadWithPartialName(refr.Name);
|
Assembly assem = Assembly.LoadWithPartialName(refr.Name);
|
||||||
ret += assem.FullName;
|
ret += assem.FullName;
|
||||||
//ret += refr.Name;
|
//ret += refr.Name;
|
||||||
}
|
}
|
||||||
catch (System.NullReferenceException e)
|
catch (System.NullReferenceException e)
|
||||||
{
|
{
|
||||||
e.ToString();
|
e.ToString();
|
||||||
ret += refr.Name;
|
ret += refr.Name;
|
||||||
}
|
}
|
||||||
ret += "\" />";
|
ret += "\" />";
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static string FindFileReference(string refName, ProjectNode project)
|
private static string FindFileReference(string refName, ProjectNode project)
|
||||||
{
|
{
|
||||||
foreach(ReferencePathNode refPath in project.ReferencePaths)
|
foreach(ReferencePathNode refPath in project.ReferencePaths)
|
||||||
{
|
{
|
||||||
string fullPath = Helper.MakeFilePath(refPath.Path, refName, "dll");
|
string fullPath = Helper.MakeFilePath(refPath.Path, refName, "dll");
|
||||||
|
|
||||||
if(File.Exists(fullPath))
|
if(File.Exists(fullPath))
|
||||||
{
|
{
|
||||||
return fullPath;
|
return fullPath;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the XML doc file.
|
/// Gets the XML doc file.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="project">The project.</param>
|
/// <param name="project">The project.</param>
|
||||||
/// <param name="conf">The conf.</param>
|
/// <param name="conf">The conf.</param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public static string GenerateXmlDocFile(ProjectNode project, ConfigurationNode conf)
|
public static string GenerateXmlDocFile(ProjectNode project, ConfigurationNode conf)
|
||||||
{
|
{
|
||||||
if( conf == null )
|
if( conf == null )
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("conf");
|
throw new ArgumentNullException("conf");
|
||||||
}
|
}
|
||||||
if( project == null )
|
if( project == null )
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("project");
|
throw new ArgumentNullException("project");
|
||||||
}
|
}
|
||||||
string docFile = (string)conf.Options["XmlDocFile"];
|
string docFile = (string)conf.Options["XmlDocFile"];
|
||||||
if(docFile != null && docFile.Length == 0)//default to assembly name if not specified
|
if(docFile != null && docFile.Length == 0)//default to assembly name if not specified
|
||||||
{
|
{
|
||||||
return "False";
|
return "False";
|
||||||
}
|
}
|
||||||
return "True";
|
return "True";
|
||||||
}
|
}
|
||||||
|
|
||||||
private void WriteProject(SolutionNode solution, ProjectNode project)
|
private void WriteProject(SolutionNode solution, ProjectNode project)
|
||||||
{
|
{
|
||||||
string csComp = "Mcs";
|
string csComp = "Mcs";
|
||||||
string netRuntime = "Mono";
|
string netRuntime = "Mono";
|
||||||
if(project.Runtime == ClrRuntime.Microsoft)
|
if(project.Runtime == ClrRuntime.Microsoft)
|
||||||
{
|
{
|
||||||
csComp = "Csc";
|
csComp = "Csc";
|
||||||
netRuntime = "MsNet";
|
netRuntime = "MsNet";
|
||||||
}
|
}
|
||||||
|
|
||||||
string projFile = Helper.MakeFilePath(project.FullPath, project.Name, "mdp");
|
string projFile = Helper.MakeFilePath(project.FullPath, project.Name, "mdp");
|
||||||
StreamWriter ss = new StreamWriter(projFile);
|
StreamWriter ss = new StreamWriter(projFile);
|
||||||
|
|
||||||
m_Kernel.CurrentWorkingDirectory.Push();
|
m_Kernel.CurrentWorkingDirectory.Push();
|
||||||
Helper.SetCurrentDir(Path.GetDirectoryName(projFile));
|
Helper.SetCurrentDir(Path.GetDirectoryName(projFile));
|
||||||
|
|
||||||
using(ss)
|
using(ss)
|
||||||
{
|
{
|
||||||
ss.WriteLine(
|
ss.WriteLine(
|
||||||
"<Project name=\"{0}\" description=\"\" standardNamespace=\"{1}\" newfilesearch=\"None\" enableviewstate=\"True\" fileversion=\"2.0\" language=\"C#\" clr-version=\"Net_2_0\" ctype=\"DotNetProject\">",
|
"<Project name=\"{0}\" description=\"\" standardNamespace=\"{1}\" newfilesearch=\"None\" enableviewstate=\"True\" fileversion=\"2.0\" language=\"C#\" clr-version=\"Net_2_0\" ctype=\"DotNetProject\">",
|
||||||
project.Name,
|
project.Name,
|
||||||
project.RootNamespace
|
project.RootNamespace
|
||||||
);
|
);
|
||||||
|
|
||||||
int count = 0;
|
int count = 0;
|
||||||
|
|
||||||
ss.WriteLine(" <Configurations active=\"{0}\">", solution.ActiveConfig);
|
ss.WriteLine(" <Configurations active=\"{0}\">", solution.ActiveConfig);
|
||||||
|
|
||||||
foreach(ConfigurationNode conf in project.Configurations)
|
foreach(ConfigurationNode conf in project.Configurations)
|
||||||
{
|
{
|
||||||
ss.WriteLine(" <Configuration name=\"{0}\" ctype=\"DotNetProjectConfiguration\">", conf.Name);
|
ss.WriteLine(" <Configuration name=\"{0}\" ctype=\"DotNetProjectConfiguration\">", conf.Name);
|
||||||
ss.Write(" <Output");
|
ss.Write(" <Output");
|
||||||
ss.Write(" directory=\"{0}\"", Helper.EndPath(Helper.NormalizePath(".\\" + conf.Options["OutputPath"].ToString())));
|
ss.Write(" directory=\"{0}\"", Helper.EndPath(Helper.NormalizePath(".\\" + conf.Options["OutputPath"].ToString())));
|
||||||
ss.Write(" assembly=\"{0}\"", project.AssemblyName);
|
ss.Write(" assembly=\"{0}\"", project.AssemblyName);
|
||||||
ss.Write(" executeScript=\"{0}\"", conf.Options["RunScript"]);
|
ss.Write(" executeScript=\"{0}\"", conf.Options["RunScript"]);
|
||||||
//ss.Write(" executeBeforeBuild=\"{0}\"", conf.Options["PreBuildEvent"]);
|
//ss.Write(" executeBeforeBuild=\"{0}\"", conf.Options["PreBuildEvent"]);
|
||||||
//ss.Write(" executeAfterBuild=\"{0}\"", conf.Options["PostBuildEvent"]);
|
//ss.Write(" executeAfterBuild=\"{0}\"", conf.Options["PostBuildEvent"]);
|
||||||
if (conf.Options["PreBuildEvent"] != null && conf.Options["PreBuildEvent"].ToString().Length != 0)
|
if (conf.Options["PreBuildEvent"] != null && conf.Options["PreBuildEvent"].ToString().Length != 0)
|
||||||
{
|
{
|
||||||
ss.Write(" executeBeforeBuild=\"{0}\"", Helper.NormalizePath(conf.Options["PreBuildEvent"].ToString()));
|
ss.Write(" executeBeforeBuild=\"{0}\"", Helper.NormalizePath(conf.Options["PreBuildEvent"].ToString()));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ss.Write(" executeBeforeBuild=\"{0}\"", conf.Options["PreBuildEvent"]);
|
ss.Write(" executeBeforeBuild=\"{0}\"", conf.Options["PreBuildEvent"]);
|
||||||
}
|
}
|
||||||
if (conf.Options["PostBuildEvent"] != null && conf.Options["PostBuildEvent"].ToString().Length != 0)
|
if (conf.Options["PostBuildEvent"] != null && conf.Options["PostBuildEvent"].ToString().Length != 0)
|
||||||
{
|
{
|
||||||
ss.Write(" executeAfterBuild=\"{0}\"", Helper.NormalizePath(conf.Options["PostBuildEvent"].ToString()));
|
ss.Write(" executeAfterBuild=\"{0}\"", Helper.NormalizePath(conf.Options["PostBuildEvent"].ToString()));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ss.Write(" executeAfterBuild=\"{0}\"", conf.Options["PostBuildEvent"]);
|
ss.Write(" executeAfterBuild=\"{0}\"", conf.Options["PostBuildEvent"]);
|
||||||
}
|
}
|
||||||
ss.Write(" executeBeforeBuildArguments=\"{0}\"", conf.Options["PreBuildEventArgs"]);
|
ss.Write(" executeBeforeBuildArguments=\"{0}\"", conf.Options["PreBuildEventArgs"]);
|
||||||
ss.Write(" executeAfterBuildArguments=\"{0}\"", conf.Options["PreBuildEventArgs"]);
|
ss.Write(" executeAfterBuildArguments=\"{0}\"", conf.Options["PreBuildEventArgs"]);
|
||||||
ss.WriteLine(" />");
|
ss.WriteLine(" />");
|
||||||
|
|
||||||
ss.Write(" <Build");
|
ss.Write(" <Build");
|
||||||
ss.Write(" debugmode=\"True\"");
|
ss.Write(" debugmode=\"True\"");
|
||||||
if (project.Type == ProjectType.WinExe)
|
if (project.Type == ProjectType.WinExe)
|
||||||
{
|
{
|
||||||
ss.Write(" target=\"{0}\"", ProjectType.Exe.ToString());
|
ss.Write(" target=\"{0}\"", ProjectType.Exe.ToString());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ss.Write(" target=\"{0}\"", project.Type);
|
ss.Write(" target=\"{0}\"", project.Type);
|
||||||
}
|
}
|
||||||
ss.WriteLine(" />");
|
ss.WriteLine(" />");
|
||||||
|
|
||||||
ss.Write(" <Execution");
|
ss.Write(" <Execution");
|
||||||
ss.Write(" runwithwarnings=\"{0}\"", !conf.Options.WarningsAsErrors);
|
ss.Write(" runwithwarnings=\"{0}\"", !conf.Options.WarningsAsErrors);
|
||||||
ss.Write(" consolepause=\"True\"");
|
ss.Write(" consolepause=\"True\"");
|
||||||
ss.Write(" runtime=\"{0}\"", netRuntime);
|
ss.Write(" runtime=\"{0}\"", netRuntime);
|
||||||
ss.Write(" clr-version=\"Net_2_0\"");
|
ss.Write(" clr-version=\"Net_2_0\"");
|
||||||
ss.WriteLine(" />");
|
ss.WriteLine(" />");
|
||||||
|
|
||||||
ss.Write(" <CodeGeneration");
|
ss.Write(" <CodeGeneration");
|
||||||
ss.Write(" compiler=\"{0}\"", csComp);
|
ss.Write(" compiler=\"{0}\"", csComp);
|
||||||
ss.Write(" warninglevel=\"{0}\"", conf.Options["WarningLevel"]);
|
ss.Write(" warninglevel=\"{0}\"", conf.Options["WarningLevel"]);
|
||||||
ss.Write(" nowarn=\"{0}\"", conf.Options["SuppressWarnings"]);
|
ss.Write(" nowarn=\"{0}\"", conf.Options["SuppressWarnings"]);
|
||||||
ss.Write(" includedebuginformation=\"{0}\"", conf.Options["DebugInformation"]);
|
ss.Write(" includedebuginformation=\"{0}\"", conf.Options["DebugInformation"]);
|
||||||
ss.Write(" optimize=\"{0}\"", conf.Options["OptimizeCode"]);
|
ss.Write(" optimize=\"{0}\"", conf.Options["OptimizeCode"]);
|
||||||
ss.Write(" unsafecodeallowed=\"{0}\"", conf.Options["AllowUnsafe"]);
|
ss.Write(" unsafecodeallowed=\"{0}\"", conf.Options["AllowUnsafe"]);
|
||||||
ss.Write(" generateoverflowchecks=\"{0}\"", conf.Options["CheckUnderflowOverflow"]);
|
ss.Write(" generateoverflowchecks=\"{0}\"", conf.Options["CheckUnderflowOverflow"]);
|
||||||
ss.Write(" mainclass=\"{0}\"", project.StartupObject);
|
ss.Write(" mainclass=\"{0}\"", project.StartupObject);
|
||||||
ss.Write(" target=\"{0}\"", project.Type);
|
ss.Write(" target=\"{0}\"", project.Type);
|
||||||
ss.Write(" definesymbols=\"{0}\"", conf.Options["CompilerDefines"]);
|
ss.Write(" definesymbols=\"{0}\"", conf.Options["CompilerDefines"]);
|
||||||
ss.Write(" generatexmldocumentation=\"{0}\"", GenerateXmlDocFile(project, conf));
|
ss.Write(" generatexmldocumentation=\"{0}\"", GenerateXmlDocFile(project, conf));
|
||||||
ss.Write(" win32Icon=\"{0}\"", project.AppIcon);
|
ss.Write(" win32Icon=\"{0}\"", project.AppIcon);
|
||||||
ss.Write(" ctype=\"CSharpCompilerParameters\"");
|
ss.Write(" ctype=\"CSharpCompilerParameters\"");
|
||||||
ss.WriteLine(" />");
|
ss.WriteLine(" />");
|
||||||
ss.WriteLine(" </Configuration>");
|
ss.WriteLine(" </Configuration>");
|
||||||
|
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
ss.WriteLine(" </Configurations>");
|
ss.WriteLine(" </Configurations>");
|
||||||
|
|
||||||
ss.Write(" <DeploymentInformation");
|
ss.Write(" <DeploymentInformation");
|
||||||
ss.Write(" target=\"\"");
|
ss.Write(" target=\"\"");
|
||||||
ss.Write(" script=\"\"");
|
ss.Write(" script=\"\"");
|
||||||
ss.Write(" strategy=\"File\"");
|
ss.Write(" strategy=\"File\"");
|
||||||
ss.WriteLine(">");
|
ss.WriteLine(">");
|
||||||
ss.WriteLine(" <excludeFiles />");
|
ss.WriteLine(" <excludeFiles />");
|
||||||
ss.WriteLine(" </DeploymentInformation>");
|
ss.WriteLine(" </DeploymentInformation>");
|
||||||
|
|
||||||
ss.WriteLine(" <Contents>");
|
ss.WriteLine(" <Contents>");
|
||||||
foreach(string file in project.Files)
|
foreach(string file in project.Files)
|
||||||
{
|
{
|
||||||
string buildAction;
|
string buildAction;
|
||||||
string dependson = "";
|
string dependson = "";
|
||||||
string resource_id = "";
|
string resource_id = "";
|
||||||
string copyToOutput = "";
|
string copyToOutput = "";
|
||||||
|
|
||||||
switch(project.Files.GetBuildAction(file))
|
switch(project.Files.GetBuildAction(file))
|
||||||
{
|
{
|
||||||
case BuildAction.None:
|
case BuildAction.None:
|
||||||
buildAction = "Nothing";
|
buildAction = "Nothing";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BuildAction.Content:
|
case BuildAction.Content:
|
||||||
buildAction = "Exclude";
|
buildAction = "Exclude";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BuildAction.EmbeddedResource:
|
case BuildAction.EmbeddedResource:
|
||||||
buildAction = "EmbedAsResource";
|
buildAction = "EmbedAsResource";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
buildAction = "Compile";
|
buildAction = "Compile";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (project.Files.GetCopyToOutput(file) != CopyToOutput.Never)
|
if (project.Files.GetCopyToOutput(file) != CopyToOutput.Never)
|
||||||
buildAction = "FileCopy";
|
buildAction = "FileCopy";
|
||||||
|
|
||||||
// Sort of a hack, we try and resolve the path and make it relative, if we can.
|
// Sort of a hack, we try and resolve the path and make it relative, if we can.
|
||||||
string extension = Path.GetExtension(file);
|
string extension = Path.GetExtension(file);
|
||||||
string designer_format = string.Format(".Designer{0}", extension);
|
string designer_format = string.Format(".Designer{0}", extension);
|
||||||
|
|
||||||
if (file.EndsWith(designer_format))
|
if (file.EndsWith(designer_format))
|
||||||
{
|
{
|
||||||
string basename = file.Substring(0, file.LastIndexOf(designer_format));
|
string basename = file.Substring(0, file.LastIndexOf(designer_format));
|
||||||
string[] extensions = new string[] { ".cs", ".resx", ".settings" };
|
string[] extensions = new string[] { ".cs", ".resx", ".settings" };
|
||||||
|
|
||||||
foreach(string ext in extensions)
|
foreach(string ext in extensions)
|
||||||
{
|
{
|
||||||
if (project.Files.Contains(basename + ext))
|
if (project.Files.Contains(basename + ext))
|
||||||
{
|
{
|
||||||
dependson = string.Format(" dependson=\"{0}{1}\"", basename, ext);
|
dependson = string.Format(" dependson=\"{0}{1}\"", basename, ext);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (extension == ".resx")
|
if (extension == ".resx")
|
||||||
{
|
{
|
||||||
buildAction = "EmbedAsResource";
|
buildAction = "EmbedAsResource";
|
||||||
string basename = file.Substring(0, file.LastIndexOf(".resx"));
|
string basename = file.Substring(0, file.LastIndexOf(".resx"));
|
||||||
|
|
||||||
// Visual Studio type resx + form dependency
|
// Visual Studio type resx + form dependency
|
||||||
if (project.Files.Contains(basename + ".cs"))
|
if (project.Files.Contains(basename + ".cs"))
|
||||||
{
|
{
|
||||||
dependson = string.Format(" dependson=\"{0}{1}\"", basename, ".cs");
|
dependson = string.Format(" dependson=\"{0}{1}\"", basename, ".cs");
|
||||||
}
|
}
|
||||||
|
|
||||||
// We need to specify a resources file name to avoid MissingManifestResourceExceptions
|
// We need to specify a resources file name to avoid MissingManifestResourceExceptions
|
||||||
// in libraries that are built.
|
// in libraries that are built.
|
||||||
resource_id = string.Format(" resource_id=\"{0}.{1}.resources\"",
|
resource_id = string.Format(" resource_id=\"{0}.{1}.resources\"",
|
||||||
project.AssemblyName, basename.Replace("/", "."));
|
project.AssemblyName, basename.Replace("/", "."));
|
||||||
}
|
}
|
||||||
|
|
||||||
switch(project.Files.GetCopyToOutput(file))
|
switch(project.Files.GetCopyToOutput(file))
|
||||||
{
|
{
|
||||||
case CopyToOutput.Always:
|
case CopyToOutput.Always:
|
||||||
copyToOutput = string.Format(" copyToOutputDirectory=\"Always\"");
|
copyToOutput = string.Format(" copyToOutputDirectory=\"Always\"");
|
||||||
break;
|
break;
|
||||||
case CopyToOutput.PreserveNewest:
|
case CopyToOutput.PreserveNewest:
|
||||||
copyToOutput = string.Format(" copyToOutputDirectory=\"PreserveNewest\"");
|
copyToOutput = string.Format(" copyToOutputDirectory=\"PreserveNewest\"");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Sort of a hack, we try and resolve the path and make it relative, if we can.
|
// Sort of a hack, we try and resolve the path and make it relative, if we can.
|
||||||
string filePath = PrependPath(file);
|
string filePath = PrependPath(file);
|
||||||
ss.WriteLine(" <File name=\"{0}\" subtype=\"Code\" buildaction=\"{1}\"{2}{3}{4} />",
|
ss.WriteLine(" <File name=\"{0}\" subtype=\"Code\" buildaction=\"{1}\"{2}{3}{4} />",
|
||||||
filePath, buildAction, dependson, resource_id, copyToOutput);
|
filePath, buildAction, dependson, resource_id, copyToOutput);
|
||||||
}
|
}
|
||||||
ss.WriteLine(" </Contents>");
|
ss.WriteLine(" </Contents>");
|
||||||
|
|
||||||
ss.WriteLine(" <References>");
|
ss.WriteLine(" <References>");
|
||||||
foreach(ReferenceNode refr in project.References)
|
foreach(ReferenceNode refr in project.References)
|
||||||
{
|
{
|
||||||
ss.WriteLine(" {0}", BuildReference(solution, refr));
|
ss.WriteLine(" {0}", BuildReference(solution, refr));
|
||||||
}
|
}
|
||||||
ss.WriteLine(" </References>");
|
ss.WriteLine(" </References>");
|
||||||
|
|
||||||
|
|
||||||
ss.WriteLine("</Project>");
|
ss.WriteLine("</Project>");
|
||||||
}
|
}
|
||||||
|
|
||||||
m_Kernel.CurrentWorkingDirectory.Pop();
|
m_Kernel.CurrentWorkingDirectory.Pop();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void WriteCombine(SolutionNode solution)
|
private void WriteCombine(SolutionNode solution)
|
||||||
{
|
{
|
||||||
m_Kernel.Log.Write("Creating MonoDevelop combine and project files");
|
m_Kernel.Log.Write("Creating MonoDevelop combine and project files");
|
||||||
foreach(ProjectNode project in solution.Projects)
|
foreach(ProjectNode project in solution.Projects)
|
||||||
{
|
{
|
||||||
if(m_Kernel.AllowProject(project.FilterGroups))
|
if(m_Kernel.AllowProject(project.FilterGroups))
|
||||||
{
|
{
|
||||||
m_Kernel.Log.Write("...Creating project: {0}", project.Name);
|
m_Kernel.Log.Write("...Creating project: {0}", project.Name);
|
||||||
WriteProject(solution, project);
|
WriteProject(solution, project);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
m_Kernel.Log.Write("");
|
m_Kernel.Log.Write("");
|
||||||
string combFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "mds");
|
string combFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "mds");
|
||||||
StreamWriter ss = new StreamWriter(combFile);
|
StreamWriter ss = new StreamWriter(combFile);
|
||||||
|
|
||||||
m_Kernel.CurrentWorkingDirectory.Push();
|
m_Kernel.CurrentWorkingDirectory.Push();
|
||||||
Helper.SetCurrentDir(Path.GetDirectoryName(combFile));
|
Helper.SetCurrentDir(Path.GetDirectoryName(combFile));
|
||||||
|
|
||||||
int count = 0;
|
int count = 0;
|
||||||
|
|
||||||
using(ss)
|
using(ss)
|
||||||
{
|
{
|
||||||
ss.WriteLine("<Combine name=\"{0}\" fileversion=\"2.0\" description=\"\">", solution.Name);
|
ss.WriteLine("<Combine name=\"{0}\" fileversion=\"2.0\" description=\"\">", solution.Name);
|
||||||
|
|
||||||
count = 0;
|
count = 0;
|
||||||
foreach(ConfigurationNode conf in solution.Configurations)
|
foreach(ConfigurationNode conf in solution.Configurations)
|
||||||
{
|
{
|
||||||
if(count == 0)
|
if(count == 0)
|
||||||
{
|
{
|
||||||
ss.WriteLine(" <Configurations active=\"{0}\">", conf.Name);
|
ss.WriteLine(" <Configurations active=\"{0}\">", conf.Name);
|
||||||
}
|
}
|
||||||
|
|
||||||
ss.WriteLine(" <Configuration name=\"{0}\" ctype=\"CombineConfiguration\">", conf.Name);
|
ss.WriteLine(" <Configuration name=\"{0}\" ctype=\"CombineConfiguration\">", conf.Name);
|
||||||
foreach(ProjectNode project in solution.Projects)
|
foreach(ProjectNode project in solution.Projects)
|
||||||
{
|
{
|
||||||
ss.WriteLine(" <Entry configuration=\"{1}\" build=\"True\" name=\"{0}\" />", project.Name, conf.Name);
|
ss.WriteLine(" <Entry configuration=\"{1}\" build=\"True\" name=\"{0}\" />", project.Name, conf.Name);
|
||||||
}
|
}
|
||||||
ss.WriteLine(" </Configuration>");
|
ss.WriteLine(" </Configuration>");
|
||||||
|
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
ss.WriteLine(" </Configurations>");
|
ss.WriteLine(" </Configurations>");
|
||||||
|
|
||||||
count = 0;
|
count = 0;
|
||||||
|
|
||||||
foreach(ProjectNode project in solution.Projects)
|
foreach(ProjectNode project in solution.Projects)
|
||||||
{
|
{
|
||||||
if(count == 0)
|
if(count == 0)
|
||||||
ss.WriteLine(" <StartMode startupentry=\"{0}\" single=\"True\">", project.Name);
|
ss.WriteLine(" <StartMode startupentry=\"{0}\" single=\"True\">", project.Name);
|
||||||
|
|
||||||
ss.WriteLine(" <Execute type=\"None\" entry=\"{0}\" />", project.Name);
|
ss.WriteLine(" <Execute type=\"None\" entry=\"{0}\" />", project.Name);
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
ss.WriteLine(" </StartMode>");
|
ss.WriteLine(" </StartMode>");
|
||||||
|
|
||||||
ss.WriteLine(" <Entries>");
|
ss.WriteLine(" <Entries>");
|
||||||
foreach(ProjectNode project in solution.Projects)
|
foreach(ProjectNode project in solution.Projects)
|
||||||
{
|
{
|
||||||
string path = Helper.MakePathRelativeTo(solution.FullPath, project.FullPath);
|
string path = Helper.MakePathRelativeTo(solution.FullPath, project.FullPath);
|
||||||
ss.WriteLine(" <Entry filename=\"{0}\" />",
|
ss.WriteLine(" <Entry filename=\"{0}\" />",
|
||||||
Helper.MakeFilePath(path, project.Name, "mdp"));
|
Helper.MakeFilePath(path, project.Name, "mdp"));
|
||||||
}
|
}
|
||||||
ss.WriteLine(" </Entries>");
|
ss.WriteLine(" </Entries>");
|
||||||
|
|
||||||
ss.WriteLine("</Combine>");
|
ss.WriteLine("</Combine>");
|
||||||
}
|
}
|
||||||
|
|
||||||
m_Kernel.CurrentWorkingDirectory.Pop();
|
m_Kernel.CurrentWorkingDirectory.Pop();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void CleanProject(ProjectNode project)
|
private void CleanProject(ProjectNode project)
|
||||||
{
|
{
|
||||||
m_Kernel.Log.Write("...Cleaning project: {0}", project.Name);
|
m_Kernel.Log.Write("...Cleaning project: {0}", project.Name);
|
||||||
string projectFile = Helper.MakeFilePath(project.FullPath, project.Name, "mdp");
|
string projectFile = Helper.MakeFilePath(project.FullPath, project.Name, "mdp");
|
||||||
Helper.DeleteIfExists(projectFile);
|
Helper.DeleteIfExists(projectFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void CleanSolution(SolutionNode solution)
|
private void CleanSolution(SolutionNode solution)
|
||||||
{
|
{
|
||||||
m_Kernel.Log.Write("Cleaning MonoDevelop combine and project files for", solution.Name);
|
m_Kernel.Log.Write("Cleaning MonoDevelop combine and project files for", solution.Name);
|
||||||
|
|
||||||
string slnFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "mds");
|
string slnFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "mds");
|
||||||
Helper.DeleteIfExists(slnFile);
|
Helper.DeleteIfExists(slnFile);
|
||||||
|
|
||||||
foreach(ProjectNode project in solution.Projects)
|
foreach(ProjectNode project in solution.Projects)
|
||||||
{
|
{
|
||||||
CleanProject(project);
|
CleanProject(project);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_Kernel.Log.Write("");
|
m_Kernel.Log.Write("");
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region ITarget Members
|
#region ITarget Members
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Writes the specified kern.
|
/// Writes the specified kern.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="kern">The kern.</param>
|
/// <param name="kern">The kern.</param>
|
||||||
public void Write(Kernel kern)
|
public void Write(Kernel kern)
|
||||||
{
|
{
|
||||||
if( kern == null )
|
if( kern == null )
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("kern");
|
throw new ArgumentNullException("kern");
|
||||||
}
|
}
|
||||||
m_Kernel = kern;
|
m_Kernel = kern;
|
||||||
foreach(SolutionNode solution in kern.Solutions)
|
foreach(SolutionNode solution in kern.Solutions)
|
||||||
{
|
{
|
||||||
WriteCombine(solution);
|
WriteCombine(solution);
|
||||||
}
|
}
|
||||||
m_Kernel = null;
|
m_Kernel = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Cleans the specified kern.
|
/// Cleans the specified kern.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="kern">The kern.</param>
|
/// <param name="kern">The kern.</param>
|
||||||
public virtual void Clean(Kernel kern)
|
public virtual void Clean(Kernel kern)
|
||||||
{
|
{
|
||||||
if( kern == null )
|
if( kern == null )
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("kern");
|
throw new ArgumentNullException("kern");
|
||||||
}
|
}
|
||||||
m_Kernel = kern;
|
m_Kernel = kern;
|
||||||
foreach(SolutionNode sol in kern.Solutions)
|
foreach(SolutionNode sol in kern.Solutions)
|
||||||
{
|
{
|
||||||
CleanSolution(sol);
|
CleanSolution(sol);
|
||||||
}
|
}
|
||||||
m_Kernel = null;
|
m_Kernel = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the name.
|
/// Gets the name.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The name.</value>
|
/// <value>The name.</value>
|
||||||
public string Name
|
public string Name
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return "sharpdev";
|
return "sharpdev";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,36 +47,36 @@ using Prebuild.Core.Utilities;
|
||||||
|
|
||||||
namespace Prebuild.Core.Targets
|
namespace Prebuild.Core.Targets
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Target("nant")]
|
[Target("nant")]
|
||||||
public class NAntTarget : ITarget
|
public class NAntTarget : ITarget
|
||||||
{
|
{
|
||||||
#region Fields
|
#region Fields
|
||||||
|
|
||||||
private Kernel m_Kernel;
|
private Kernel m_Kernel;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Private Methods
|
#region Private Methods
|
||||||
|
|
||||||
private static string PrependPath(string path)
|
private static string PrependPath(string path)
|
||||||
{
|
{
|
||||||
string tmpPath = Helper.NormalizePath(path, '/');
|
string tmpPath = Helper.NormalizePath(path, '/');
|
||||||
Regex regex = new Regex(@"(\w):/(\w+)");
|
Regex regex = new Regex(@"(\w):/(\w+)");
|
||||||
Match match = regex.Match(tmpPath);
|
Match match = regex.Match(tmpPath);
|
||||||
//if(match.Success || tmpPath[0] == '.' || tmpPath[0] == '/')
|
//if(match.Success || tmpPath[0] == '.' || tmpPath[0] == '/')
|
||||||
//{
|
//{
|
||||||
tmpPath = Helper.NormalizePath(tmpPath);
|
tmpPath = Helper.NormalizePath(tmpPath);
|
||||||
//}
|
//}
|
||||||
// else
|
// else
|
||||||
// {
|
// {
|
||||||
// tmpPath = Helper.NormalizePath("./" + tmpPath);
|
// tmpPath = Helper.NormalizePath("./" + tmpPath);
|
||||||
// }
|
// }
|
||||||
|
|
||||||
return tmpPath;
|
return tmpPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static string BuildReference(SolutionNode solution, ProjectNode currentProject, ReferenceNode refr)
|
private static string BuildReference(SolutionNode solution, ProjectNode currentProject, ReferenceNode refr)
|
||||||
{
|
{
|
||||||
|
@ -113,7 +113,7 @@ namespace Prebuild.Core.Targets
|
||||||
return refr.Name + ".dll";
|
return refr.Name + ".dll";
|
||||||
}
|
}
|
||||||
|
|
||||||
public static string GetRefFileName(string refName)
|
public static string GetRefFileName(string refName)
|
||||||
{
|
{
|
||||||
if (ExtensionSpecified(refName))
|
if (ExtensionSpecified(refName))
|
||||||
{
|
{
|
||||||
|
@ -140,11 +140,11 @@ namespace Prebuild.Core.Targets
|
||||||
return extension;
|
return extension;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static string FindFileReference(string refName, ProjectNode project)
|
private static string FindFileReference(string refName, ProjectNode project)
|
||||||
{
|
{
|
||||||
foreach (ReferencePathNode refPath in project.ReferencePaths)
|
foreach (ReferencePathNode refPath in project.ReferencePaths)
|
||||||
{
|
{
|
||||||
string fullPath = Helper.MakeFilePath(refPath.Path, refName);
|
string fullPath = Helper.MakeFilePath(refPath.Path, refName);
|
||||||
|
|
||||||
if (File.Exists(fullPath))
|
if (File.Exists(fullPath))
|
||||||
{
|
{
|
||||||
|
@ -153,10 +153,10 @@ namespace Prebuild.Core.Targets
|
||||||
|
|
||||||
fullPath = Helper.MakeFilePath(refPath.Path, refName, "dll");
|
fullPath = Helper.MakeFilePath(refPath.Path, refName, "dll");
|
||||||
|
|
||||||
if (File.Exists(fullPath))
|
if (File.Exists(fullPath))
|
||||||
{
|
{
|
||||||
return fullPath;
|
return fullPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
fullPath = Helper.MakeFilePath(refPath.Path, refName, "exe");
|
fullPath = Helper.MakeFilePath(refPath.Path, refName, "exe");
|
||||||
|
|
||||||
|
@ -164,162 +164,162 @@ namespace Prebuild.Core.Targets
|
||||||
{
|
{
|
||||||
return fullPath;
|
return fullPath;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the XML doc file.
|
/// Gets the XML doc file.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="project">The project.</param>
|
/// <param name="project">The project.</param>
|
||||||
/// <param name="conf">The conf.</param>
|
/// <param name="conf">The conf.</param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public static string GetXmlDocFile(ProjectNode project, ConfigurationNode conf)
|
public static string GetXmlDocFile(ProjectNode project, ConfigurationNode conf)
|
||||||
{
|
{
|
||||||
if (conf == null)
|
if (conf == null)
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("conf");
|
throw new ArgumentNullException("conf");
|
||||||
}
|
}
|
||||||
if (project == null)
|
if (project == null)
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("project");
|
throw new ArgumentNullException("project");
|
||||||
}
|
}
|
||||||
string docFile = (string)conf.Options["XmlDocFile"];
|
string docFile = (string)conf.Options["XmlDocFile"];
|
||||||
// if(docFile != null && docFile.Length == 0)//default to assembly name if not specified
|
// if(docFile != null && docFile.Length == 0)//default to assembly name if not specified
|
||||||
// {
|
// {
|
||||||
// return Path.GetFileNameWithoutExtension(project.AssemblyName) + ".xml";
|
// return Path.GetFileNameWithoutExtension(project.AssemblyName) + ".xml";
|
||||||
// }
|
// }
|
||||||
return docFile;
|
return docFile;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void WriteProject(SolutionNode solution, ProjectNode project)
|
private void WriteProject(SolutionNode solution, ProjectNode project)
|
||||||
{
|
{
|
||||||
string projFile = Helper.MakeFilePath(project.FullPath, project.Name + GetProjectExtension(project), "build");
|
string projFile = Helper.MakeFilePath(project.FullPath, project.Name + GetProjectExtension(project), "build");
|
||||||
StreamWriter ss = new StreamWriter(projFile);
|
StreamWriter ss = new StreamWriter(projFile);
|
||||||
|
|
||||||
m_Kernel.CurrentWorkingDirectory.Push();
|
m_Kernel.CurrentWorkingDirectory.Push();
|
||||||
Helper.SetCurrentDir(Path.GetDirectoryName(projFile));
|
Helper.SetCurrentDir(Path.GetDirectoryName(projFile));
|
||||||
bool hasDoc = false;
|
bool hasDoc = false;
|
||||||
|
|
||||||
using (ss)
|
using (ss)
|
||||||
{
|
{
|
||||||
ss.WriteLine("<?xml version=\"1.0\" ?>");
|
ss.WriteLine("<?xml version=\"1.0\" ?>");
|
||||||
ss.WriteLine("<project name=\"{0}\" default=\"build\">", project.Name);
|
ss.WriteLine("<project name=\"{0}\" default=\"build\">", project.Name);
|
||||||
ss.WriteLine(" <target name=\"{0}\">", "build");
|
ss.WriteLine(" <target name=\"{0}\">", "build");
|
||||||
ss.WriteLine(" <echo message=\"Build Directory is ${project::get-base-directory()}/${build.dir}\" />");
|
ss.WriteLine(" <echo message=\"Build Directory is ${project::get-base-directory()}/${build.dir}\" />");
|
||||||
ss.WriteLine(" <mkdir dir=\"${project::get-base-directory()}/${build.dir}\" />");
|
ss.WriteLine(" <mkdir dir=\"${project::get-base-directory()}/${build.dir}\" />");
|
||||||
|
|
||||||
ss.Write(" <csc ");
|
ss.Write(" <csc ");
|
||||||
ss.Write(" target=\"{0}\"", project.Type.ToString().ToLower());
|
ss.Write(" target=\"{0}\"", project.Type.ToString().ToLower());
|
||||||
ss.Write(" debug=\"{0}\"", "${build.debug}");
|
ss.Write(" debug=\"{0}\"", "${build.debug}");
|
||||||
ss.Write(" platform=\"${build.platform}\"");
|
ss.Write(" platform=\"${build.platform}\"");
|
||||||
|
|
||||||
|
|
||||||
foreach (ConfigurationNode conf in project.Configurations)
|
foreach (ConfigurationNode conf in project.Configurations)
|
||||||
{
|
{
|
||||||
if (conf.Options.KeyFile != "")
|
if (conf.Options.KeyFile != "")
|
||||||
{
|
{
|
||||||
ss.Write(" keyfile=\"{0}\"", conf.Options.KeyFile);
|
ss.Write(" keyfile=\"{0}\"", conf.Options.KeyFile);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
foreach (ConfigurationNode conf in project.Configurations)
|
foreach (ConfigurationNode conf in project.Configurations)
|
||||||
{
|
{
|
||||||
ss.Write(" unsafe=\"{0}\"", conf.Options.AllowUnsafe);
|
ss.Write(" unsafe=\"{0}\"", conf.Options.AllowUnsafe);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
foreach (ConfigurationNode conf in project.Configurations)
|
foreach (ConfigurationNode conf in project.Configurations)
|
||||||
{
|
{
|
||||||
ss.Write(" warnaserror=\"{0}\"", conf.Options.WarningsAsErrors);
|
ss.Write(" warnaserror=\"{0}\"", conf.Options.WarningsAsErrors);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
foreach (ConfigurationNode conf in project.Configurations)
|
foreach (ConfigurationNode conf in project.Configurations)
|
||||||
{
|
{
|
||||||
ss.Write(" define=\"{0}\"", conf.Options.CompilerDefines);
|
ss.Write(" define=\"{0}\"", conf.Options.CompilerDefines);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
foreach (ConfigurationNode conf in project.Configurations)
|
foreach (ConfigurationNode conf in project.Configurations)
|
||||||
{
|
{
|
||||||
ss.Write(" nostdlib=\"{0}\"", conf.Options["NoStdLib"]);
|
ss.Write(" nostdlib=\"{0}\"", conf.Options["NoStdLib"]);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
ss.Write(" main=\"{0}\"", project.StartupObject);
|
ss.Write(" main=\"{0}\"", project.StartupObject);
|
||||||
|
|
||||||
foreach (ConfigurationNode conf in project.Configurations)
|
foreach (ConfigurationNode conf in project.Configurations)
|
||||||
{
|
{
|
||||||
if (GetXmlDocFile(project, conf) != "")
|
if (GetXmlDocFile(project, conf) != "")
|
||||||
{
|
{
|
||||||
ss.Write(" doc=\"{0}\"", "${project::get-base-directory()}/${build.dir}/" + GetXmlDocFile(project, conf));
|
ss.Write(" doc=\"{0}\"", "${project::get-base-directory()}/${build.dir}/" + GetXmlDocFile(project, conf));
|
||||||
hasDoc = true;
|
hasDoc = true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
ss.Write(" output=\"{0}", "${project::get-base-directory()}/${build.dir}/${project::get-name()}");
|
ss.Write(" output=\"{0}", "${project::get-base-directory()}/${build.dir}/${project::get-name()}");
|
||||||
if (project.Type == ProjectType.Library)
|
if (project.Type == ProjectType.Library)
|
||||||
{
|
{
|
||||||
ss.Write(".dll\"");
|
ss.Write(".dll\"");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ss.Write(".exe\"");
|
ss.Write(".exe\"");
|
||||||
}
|
}
|
||||||
if (project.AppIcon != null && project.AppIcon.Length != 0)
|
if (project.AppIcon != null && project.AppIcon.Length != 0)
|
||||||
{
|
{
|
||||||
ss.Write(" win32icon=\"{0}\"", Helper.NormalizePath(project.AppIcon, '/'));
|
ss.Write(" win32icon=\"{0}\"", Helper.NormalizePath(project.AppIcon, '/'));
|
||||||
}
|
}
|
||||||
// This disables a very different behavior between VS and NAnt. With Nant,
|
// This disables a very different behavior between VS and NAnt. With Nant,
|
||||||
// If you have using System.Xml; it will ensure System.Xml.dll is referenced,
|
// If you have using System.Xml; it will ensure System.Xml.dll is referenced,
|
||||||
// but not in VS. This will force the behaviors to match, so when it works
|
// but not in VS. This will force the behaviors to match, so when it works
|
||||||
// in nant, it will work in VS.
|
// in nant, it will work in VS.
|
||||||
ss.Write(" noconfig=\"true\"");
|
ss.Write(" noconfig=\"true\"");
|
||||||
ss.WriteLine(">");
|
ss.WriteLine(">");
|
||||||
ss.WriteLine(" <resources prefix=\"{0}\" dynamicprefix=\"true\" >", project.RootNamespace);
|
ss.WriteLine(" <resources prefix=\"{0}\" dynamicprefix=\"true\" >", project.RootNamespace);
|
||||||
foreach (string file in project.Files)
|
foreach (string file in project.Files)
|
||||||
{
|
{
|
||||||
switch (project.Files.GetBuildAction(file))
|
switch (project.Files.GetBuildAction(file))
|
||||||
{
|
{
|
||||||
case BuildAction.EmbeddedResource:
|
case BuildAction.EmbeddedResource:
|
||||||
ss.WriteLine(" {0}", "<include name=\"" + Helper.NormalizePath(PrependPath(file), '/') + "\" />");
|
ss.WriteLine(" {0}", "<include name=\"" + Helper.NormalizePath(PrependPath(file), '/') + "\" />");
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
if (project.Files.GetSubType(file) != SubType.Code && project.Files.GetSubType(file) != SubType.Settings)
|
if (project.Files.GetSubType(file) != SubType.Code && project.Files.GetSubType(file) != SubType.Settings)
|
||||||
{
|
{
|
||||||
ss.WriteLine(" <include name=\"{0}\" />", file.Substring(0, file.LastIndexOf('.')) + ".resx");
|
ss.WriteLine(" <include name=\"{0}\" />", file.Substring(0, file.LastIndexOf('.')) + ".resx");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//if (project.Files.GetSubType(file).ToString() != "Code")
|
//if (project.Files.GetSubType(file).ToString() != "Code")
|
||||||
//{
|
//{
|
||||||
// ps.WriteLine(" <EmbeddedResource Include=\"{0}\">", file.Substring(0, file.LastIndexOf('.')) + ".resx");
|
// ps.WriteLine(" <EmbeddedResource Include=\"{0}\">", file.Substring(0, file.LastIndexOf('.')) + ".resx");
|
||||||
|
|
||||||
ss.WriteLine(" </resources>");
|
ss.WriteLine(" </resources>");
|
||||||
ss.WriteLine(" <sources failonempty=\"true\">");
|
ss.WriteLine(" <sources failonempty=\"true\">");
|
||||||
foreach (string file in project.Files)
|
foreach (string file in project.Files)
|
||||||
{
|
{
|
||||||
switch (project.Files.GetBuildAction(file))
|
switch (project.Files.GetBuildAction(file))
|
||||||
{
|
{
|
||||||
case BuildAction.Compile:
|
case BuildAction.Compile:
|
||||||
ss.WriteLine(" <include name=\"" + Helper.NormalizePath(PrependPath(file), '/') + "\" />");
|
ss.WriteLine(" <include name=\"" + Helper.NormalizePath(PrependPath(file), '/') + "\" />");
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ss.WriteLine(" </sources>");
|
ss.WriteLine(" </sources>");
|
||||||
ss.WriteLine(" <references basedir=\"${project::get-base-directory()}\">");
|
ss.WriteLine(" <references basedir=\"${project::get-base-directory()}\">");
|
||||||
ss.WriteLine(" <lib>");
|
ss.WriteLine(" <lib>");
|
||||||
ss.WriteLine(" <include name=\"${project::get-base-directory()}\" />");
|
ss.WriteLine(" <include name=\"${project::get-base-directory()}\" />");
|
||||||
foreach(ReferencePathNode refPath in project.ReferencePaths)
|
foreach(ReferencePathNode refPath in project.ReferencePaths)
|
||||||
{
|
{
|
||||||
ss.WriteLine(" <include name=\"${project::get-base-directory()}/" + refPath.Path.TrimEnd('/', '\\') + "\" />");
|
ss.WriteLine(" <include name=\"${project::get-base-directory()}/" + refPath.Path.TrimEnd('/', '\\') + "\" />");
|
||||||
}
|
}
|
||||||
ss.WriteLine(" </lib>");
|
ss.WriteLine(" </lib>");
|
||||||
foreach (ReferenceNode refr in project.References)
|
foreach (ReferenceNode refr in project.References)
|
||||||
{
|
{
|
||||||
string path = Helper.NormalizePath(Helper.MakePathRelativeTo(project.FullPath, BuildReference(solution, project, refr)), '/');
|
string path = Helper.NormalizePath(Helper.MakePathRelativeTo(project.FullPath, BuildReference(solution, project, refr)), '/');
|
||||||
if (refr.Path != null) {
|
if (refr.Path != null) {
|
||||||
if (ExtensionSpecified(refr.Name))
|
if (ExtensionSpecified(refr.Name))
|
||||||
{
|
{
|
||||||
|
@ -334,12 +334,12 @@ namespace Prebuild.Core.Targets
|
||||||
{
|
{
|
||||||
ss.WriteLine (" <include name=\"" + path + "\" />");
|
ss.WriteLine (" <include name=\"" + path + "\" />");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ss.WriteLine(" </references>");
|
ss.WriteLine(" </references>");
|
||||||
|
|
||||||
ss.WriteLine(" </csc>");
|
ss.WriteLine(" </csc>");
|
||||||
|
|
||||||
foreach (ConfigurationNode conf in project.Configurations)
|
foreach (ConfigurationNode conf in project.Configurations)
|
||||||
{
|
{
|
||||||
if (!String.IsNullOrEmpty(conf.Options.OutputPath))
|
if (!String.IsNullOrEmpty(conf.Options.OutputPath))
|
||||||
{
|
{
|
||||||
|
@ -361,170 +361,170 @@ namespace Prebuild.Core.Targets
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ss.WriteLine(" </target>");
|
ss.WriteLine(" </target>");
|
||||||
|
|
||||||
ss.WriteLine(" <target name=\"clean\">");
|
ss.WriteLine(" <target name=\"clean\">");
|
||||||
ss.WriteLine(" <delete dir=\"${bin.dir}\" failonerror=\"false\" />");
|
ss.WriteLine(" <delete dir=\"${bin.dir}\" failonerror=\"false\" />");
|
||||||
ss.WriteLine(" <delete dir=\"${obj.dir}\" failonerror=\"false\" />");
|
ss.WriteLine(" <delete dir=\"${obj.dir}\" failonerror=\"false\" />");
|
||||||
ss.WriteLine(" </target>");
|
ss.WriteLine(" </target>");
|
||||||
|
|
||||||
ss.WriteLine(" <target name=\"doc\" description=\"Creates documentation.\">");
|
ss.WriteLine(" <target name=\"doc\" description=\"Creates documentation.\">");
|
||||||
if (hasDoc)
|
if (hasDoc)
|
||||||
{
|
{
|
||||||
ss.WriteLine(" <property name=\"doc.target\" value=\"\" />");
|
ss.WriteLine(" <property name=\"doc.target\" value=\"\" />");
|
||||||
ss.WriteLine(" <if test=\"${platform::is-unix()}\">");
|
ss.WriteLine(" <if test=\"${platform::is-unix()}\">");
|
||||||
ss.WriteLine(" <property name=\"doc.target\" value=\"Web\" />");
|
ss.WriteLine(" <property name=\"doc.target\" value=\"Web\" />");
|
||||||
ss.WriteLine(" </if>");
|
ss.WriteLine(" </if>");
|
||||||
ss.WriteLine(" <ndoc failonerror=\"false\" verbose=\"true\">");
|
ss.WriteLine(" <ndoc failonerror=\"false\" verbose=\"true\">");
|
||||||
ss.WriteLine(" <assemblies basedir=\"${project::get-base-directory()}\">");
|
ss.WriteLine(" <assemblies basedir=\"${project::get-base-directory()}\">");
|
||||||
ss.Write(" <include name=\"${build.dir}/${project::get-name()}");
|
ss.Write(" <include name=\"${build.dir}/${project::get-name()}");
|
||||||
if (project.Type == ProjectType.Library)
|
if (project.Type == ProjectType.Library)
|
||||||
{
|
{
|
||||||
ss.WriteLine(".dll\" />");
|
ss.WriteLine(".dll\" />");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ss.WriteLine(".exe\" />");
|
ss.WriteLine(".exe\" />");
|
||||||
}
|
}
|
||||||
|
|
||||||
ss.WriteLine(" </assemblies>");
|
ss.WriteLine(" </assemblies>");
|
||||||
ss.WriteLine(" <summaries basedir=\"${project::get-base-directory()}\">");
|
ss.WriteLine(" <summaries basedir=\"${project::get-base-directory()}\">");
|
||||||
ss.WriteLine(" <include name=\"${build.dir}/${project::get-name()}.xml\"/>");
|
ss.WriteLine(" <include name=\"${build.dir}/${project::get-name()}.xml\"/>");
|
||||||
ss.WriteLine(" </summaries>");
|
ss.WriteLine(" </summaries>");
|
||||||
ss.WriteLine(" <referencepaths basedir=\"${project::get-base-directory()}\">");
|
ss.WriteLine(" <referencepaths basedir=\"${project::get-base-directory()}\">");
|
||||||
ss.WriteLine(" <include name=\"${build.dir}\" />");
|
ss.WriteLine(" <include name=\"${build.dir}\" />");
|
||||||
// foreach(ReferenceNode refr in project.References)
|
// foreach(ReferenceNode refr in project.References)
|
||||||
// {
|
// {
|
||||||
// string path = Helper.NormalizePath(Helper.MakePathRelativeTo(project.FullPath, BuildReferencePath(solution, refr)), '/');
|
// string path = Helper.NormalizePath(Helper.MakePathRelativeTo(project.FullPath, BuildReferencePath(solution, refr)), '/');
|
||||||
// if (path != "")
|
// if (path != "")
|
||||||
// {
|
// {
|
||||||
// ss.WriteLine(" <include name=\"{0}\" />", path);
|
// ss.WriteLine(" <include name=\"{0}\" />", path);
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
ss.WriteLine(" </referencepaths>");
|
ss.WriteLine(" </referencepaths>");
|
||||||
ss.WriteLine(" <documenters>");
|
ss.WriteLine(" <documenters>");
|
||||||
ss.WriteLine(" <documenter name=\"MSDN\">");
|
ss.WriteLine(" <documenter name=\"MSDN\">");
|
||||||
ss.WriteLine(" <property name=\"OutputDirectory\" value=\"${project::get-base-directory()}/${build.dir}/doc/${project::get-name()}\" />");
|
ss.WriteLine(" <property name=\"OutputDirectory\" value=\"${project::get-base-directory()}/${build.dir}/doc/${project::get-name()}\" />");
|
||||||
ss.WriteLine(" <property name=\"OutputTarget\" value=\"${doc.target}\" />");
|
ss.WriteLine(" <property name=\"OutputTarget\" value=\"${doc.target}\" />");
|
||||||
ss.WriteLine(" <property name=\"HtmlHelpName\" value=\"${project::get-name()}\" />");
|
ss.WriteLine(" <property name=\"HtmlHelpName\" value=\"${project::get-name()}\" />");
|
||||||
ss.WriteLine(" <property name=\"IncludeFavorites\" value=\"False\" />");
|
ss.WriteLine(" <property name=\"IncludeFavorites\" value=\"False\" />");
|
||||||
ss.WriteLine(" <property name=\"Title\" value=\"${project::get-name()} SDK Documentation\" />");
|
ss.WriteLine(" <property name=\"Title\" value=\"${project::get-name()} SDK Documentation\" />");
|
||||||
ss.WriteLine(" <property name=\"SplitTOCs\" value=\"False\" />");
|
ss.WriteLine(" <property name=\"SplitTOCs\" value=\"False\" />");
|
||||||
ss.WriteLine(" <property name=\"DefaulTOC\" value=\"\" />");
|
ss.WriteLine(" <property name=\"DefaulTOC\" value=\"\" />");
|
||||||
ss.WriteLine(" <property name=\"ShowVisualBasic\" value=\"True\" />");
|
ss.WriteLine(" <property name=\"ShowVisualBasic\" value=\"True\" />");
|
||||||
ss.WriteLine(" <property name=\"AutoDocumentConstructors\" value=\"True\" />");
|
ss.WriteLine(" <property name=\"AutoDocumentConstructors\" value=\"True\" />");
|
||||||
ss.WriteLine(" <property name=\"ShowMissingSummaries\" value=\"${build.debug}\" />");
|
ss.WriteLine(" <property name=\"ShowMissingSummaries\" value=\"${build.debug}\" />");
|
||||||
ss.WriteLine(" <property name=\"ShowMissingRemarks\" value=\"${build.debug}\" />");
|
ss.WriteLine(" <property name=\"ShowMissingRemarks\" value=\"${build.debug}\" />");
|
||||||
ss.WriteLine(" <property name=\"ShowMissingParams\" value=\"${build.debug}\" />");
|
ss.WriteLine(" <property name=\"ShowMissingParams\" value=\"${build.debug}\" />");
|
||||||
ss.WriteLine(" <property name=\"ShowMissingReturns\" value=\"${build.debug}\" />");
|
ss.WriteLine(" <property name=\"ShowMissingReturns\" value=\"${build.debug}\" />");
|
||||||
ss.WriteLine(" <property name=\"ShowMissingValues\" value=\"${build.debug}\" />");
|
ss.WriteLine(" <property name=\"ShowMissingValues\" value=\"${build.debug}\" />");
|
||||||
ss.WriteLine(" <property name=\"DocumentInternals\" value=\"False\" />");
|
ss.WriteLine(" <property name=\"DocumentInternals\" value=\"False\" />");
|
||||||
ss.WriteLine(" <property name=\"DocumentPrivates\" value=\"False\" />");
|
ss.WriteLine(" <property name=\"DocumentPrivates\" value=\"False\" />");
|
||||||
ss.WriteLine(" <property name=\"DocumentProtected\" value=\"True\" />");
|
ss.WriteLine(" <property name=\"DocumentProtected\" value=\"True\" />");
|
||||||
ss.WriteLine(" <property name=\"DocumentEmptyNamespaces\" value=\"${build.debug}\" />");
|
ss.WriteLine(" <property name=\"DocumentEmptyNamespaces\" value=\"${build.debug}\" />");
|
||||||
ss.WriteLine(" <property name=\"IncludeAssemblyVersion\" value=\"True\" />");
|
ss.WriteLine(" <property name=\"IncludeAssemblyVersion\" value=\"True\" />");
|
||||||
ss.WriteLine(" </documenter>");
|
ss.WriteLine(" </documenter>");
|
||||||
ss.WriteLine(" </documenters>");
|
ss.WriteLine(" </documenters>");
|
||||||
ss.WriteLine(" </ndoc>");
|
ss.WriteLine(" </ndoc>");
|
||||||
}
|
}
|
||||||
ss.WriteLine(" </target>");
|
ss.WriteLine(" </target>");
|
||||||
ss.WriteLine("</project>");
|
ss.WriteLine("</project>");
|
||||||
}
|
}
|
||||||
m_Kernel.CurrentWorkingDirectory.Pop();
|
m_Kernel.CurrentWorkingDirectory.Pop();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void WriteCombine(SolutionNode solution)
|
private void WriteCombine(SolutionNode solution)
|
||||||
{
|
{
|
||||||
m_Kernel.Log.Write("Creating NAnt build files");
|
m_Kernel.Log.Write("Creating NAnt build files");
|
||||||
foreach (ProjectNode project in solution.Projects)
|
foreach (ProjectNode project in solution.Projects)
|
||||||
{
|
{
|
||||||
if (m_Kernel.AllowProject(project.FilterGroups))
|
if (m_Kernel.AllowProject(project.FilterGroups))
|
||||||
{
|
{
|
||||||
m_Kernel.Log.Write("...Creating project: {0}", project.Name);
|
m_Kernel.Log.Write("...Creating project: {0}", project.Name);
|
||||||
WriteProject(solution, project);
|
WriteProject(solution, project);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
m_Kernel.Log.Write("");
|
m_Kernel.Log.Write("");
|
||||||
string combFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "build");
|
string combFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "build");
|
||||||
StreamWriter ss = new StreamWriter(combFile);
|
StreamWriter ss = new StreamWriter(combFile);
|
||||||
|
|
||||||
m_Kernel.CurrentWorkingDirectory.Push();
|
m_Kernel.CurrentWorkingDirectory.Push();
|
||||||
Helper.SetCurrentDir(Path.GetDirectoryName(combFile));
|
Helper.SetCurrentDir(Path.GetDirectoryName(combFile));
|
||||||
|
|
||||||
using (ss)
|
using (ss)
|
||||||
{
|
{
|
||||||
ss.WriteLine("<?xml version=\"1.0\" ?>");
|
ss.WriteLine("<?xml version=\"1.0\" ?>");
|
||||||
ss.WriteLine("<project name=\"{0}\" default=\"build\">", solution.Name);
|
ss.WriteLine("<project name=\"{0}\" default=\"build\">", solution.Name);
|
||||||
ss.WriteLine(" <echo message=\"Using '${nant.settings.currentframework}' Framework\"/>");
|
ss.WriteLine(" <echo message=\"Using '${nant.settings.currentframework}' Framework\"/>");
|
||||||
ss.WriteLine();
|
ss.WriteLine();
|
||||||
|
|
||||||
//ss.WriteLine(" <property name=\"dist.dir\" value=\"dist\" />");
|
//ss.WriteLine(" <property name=\"dist.dir\" value=\"dist\" />");
|
||||||
//ss.WriteLine(" <property name=\"source.dir\" value=\"source\" />");
|
//ss.WriteLine(" <property name=\"source.dir\" value=\"source\" />");
|
||||||
ss.WriteLine(" <property name=\"bin.dir\" value=\"bin\" />");
|
ss.WriteLine(" <property name=\"bin.dir\" value=\"bin\" />");
|
||||||
ss.WriteLine(" <property name=\"obj.dir\" value=\"obj\" />");
|
ss.WriteLine(" <property name=\"obj.dir\" value=\"obj\" />");
|
||||||
ss.WriteLine(" <property name=\"doc.dir\" value=\"doc\" />");
|
ss.WriteLine(" <property name=\"doc.dir\" value=\"doc\" />");
|
||||||
ss.WriteLine(" <property name=\"project.main.dir\" value=\"${project::get-base-directory()}\" />");
|
ss.WriteLine(" <property name=\"project.main.dir\" value=\"${project::get-base-directory()}\" />");
|
||||||
|
|
||||||
// Use the active configuration, which is the first configuration name in the prebuild file.
|
// Use the active configuration, which is the first configuration name in the prebuild file.
|
||||||
Dictionary<string,string> emittedConfigurations = new Dictionary<string, string>();
|
Dictionary<string,string> emittedConfigurations = new Dictionary<string, string>();
|
||||||
|
|
||||||
ss.WriteLine(" <property name=\"project.config\" value=\"{0}\" />", solution.ActiveConfig);
|
ss.WriteLine(" <property name=\"project.config\" value=\"{0}\" />", solution.ActiveConfig);
|
||||||
ss.WriteLine();
|
ss.WriteLine();
|
||||||
|
|
||||||
foreach (ConfigurationNode conf in solution.Configurations)
|
foreach (ConfigurationNode conf in solution.Configurations)
|
||||||
{
|
{
|
||||||
// If the name isn't in the emitted configurations, we give a high level target to the
|
// If the name isn't in the emitted configurations, we give a high level target to the
|
||||||
// platform specific on. This lets "Debug" point to "Debug-AnyCPU".
|
// platform specific on. This lets "Debug" point to "Debug-AnyCPU".
|
||||||
if (!emittedConfigurations.ContainsKey(conf.Name))
|
if (!emittedConfigurations.ContainsKey(conf.Name))
|
||||||
{
|
{
|
||||||
// Add it to the dictionary so we only emit one.
|
// Add it to the dictionary so we only emit one.
|
||||||
emittedConfigurations.Add(conf.Name, conf.Platform);
|
emittedConfigurations.Add(conf.Name, conf.Platform);
|
||||||
|
|
||||||
// Write out the target block.
|
// Write out the target block.
|
||||||
ss.WriteLine(" <target name=\"{0}\" description=\"{0}|{1}\" depends=\"{0}-{1}\">", conf.Name, conf.Platform);
|
ss.WriteLine(" <target name=\"{0}\" description=\"{0}|{1}\" depends=\"{0}-{1}\">", conf.Name, conf.Platform);
|
||||||
ss.WriteLine(" </target>");
|
ss.WriteLine(" </target>");
|
||||||
ss.WriteLine();
|
ss.WriteLine();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Write out the target for the configuration.
|
// Write out the target for the configuration.
|
||||||
ss.WriteLine(" <target name=\"{0}-{1}\" description=\"{0}|{1}\">", conf.Name, conf.Platform);
|
ss.WriteLine(" <target name=\"{0}-{1}\" description=\"{0}|{1}\">", conf.Name, conf.Platform);
|
||||||
ss.WriteLine(" <property name=\"project.config\" value=\"{0}\" />", conf.Name);
|
ss.WriteLine(" <property name=\"project.config\" value=\"{0}\" />", conf.Name);
|
||||||
ss.WriteLine(" <property name=\"build.debug\" value=\"{0}\" />", conf.Options["DebugInformation"].ToString().ToLower());
|
ss.WriteLine(" <property name=\"build.debug\" value=\"{0}\" />", conf.Options["DebugInformation"].ToString().ToLower());
|
||||||
ss.WriteLine("\t\t <property name=\"build.platform\" value=\"{0}\" />", conf.Platform);
|
ss.WriteLine("\t\t <property name=\"build.platform\" value=\"{0}\" />", conf.Platform);
|
||||||
ss.WriteLine(" </target>");
|
ss.WriteLine(" </target>");
|
||||||
ss.WriteLine();
|
ss.WriteLine();
|
||||||
}
|
}
|
||||||
|
|
||||||
ss.WriteLine(" <target name=\"net-1.1\" description=\"Sets framework to .NET 1.1\">");
|
ss.WriteLine(" <target name=\"net-1.1\" description=\"Sets framework to .NET 1.1\">");
|
||||||
ss.WriteLine(" <property name=\"nant.settings.currentframework\" value=\"net-1.1\" />");
|
ss.WriteLine(" <property name=\"nant.settings.currentframework\" value=\"net-1.1\" />");
|
||||||
ss.WriteLine(" </target>");
|
ss.WriteLine(" </target>");
|
||||||
ss.WriteLine();
|
ss.WriteLine();
|
||||||
|
|
||||||
ss.WriteLine(" <target name=\"net-2.0\" description=\"Sets framework to .NET 2.0\">");
|
ss.WriteLine(" <target name=\"net-2.0\" description=\"Sets framework to .NET 2.0\">");
|
||||||
ss.WriteLine(" <property name=\"nant.settings.currentframework\" value=\"net-2.0\" />");
|
ss.WriteLine(" <property name=\"nant.settings.currentframework\" value=\"net-2.0\" />");
|
||||||
ss.WriteLine(" </target>");
|
ss.WriteLine(" </target>");
|
||||||
ss.WriteLine();
|
ss.WriteLine();
|
||||||
|
|
||||||
ss.WriteLine(" <target name=\"net-3.5\" description=\"Sets framework to .NET 3.5\">");
|
ss.WriteLine(" <target name=\"net-3.5\" description=\"Sets framework to .NET 3.5\">");
|
||||||
ss.WriteLine(" <property name=\"nant.settings.currentframework\" value=\"net-3.5\" />");
|
ss.WriteLine(" <property name=\"nant.settings.currentframework\" value=\"net-3.5\" />");
|
||||||
ss.WriteLine(" </target>");
|
ss.WriteLine(" </target>");
|
||||||
ss.WriteLine();
|
ss.WriteLine();
|
||||||
|
|
||||||
ss.WriteLine(" <target name=\"mono-1.0\" description=\"Sets framework to mono 1.0\">");
|
ss.WriteLine(" <target name=\"mono-1.0\" description=\"Sets framework to mono 1.0\">");
|
||||||
ss.WriteLine(" <property name=\"nant.settings.currentframework\" value=\"mono-1.0\" />");
|
ss.WriteLine(" <property name=\"nant.settings.currentframework\" value=\"mono-1.0\" />");
|
||||||
ss.WriteLine(" </target>");
|
ss.WriteLine(" </target>");
|
||||||
ss.WriteLine();
|
ss.WriteLine();
|
||||||
|
|
||||||
ss.WriteLine(" <target name=\"mono-2.0\" description=\"Sets framework to mono 2.0\">");
|
ss.WriteLine(" <target name=\"mono-2.0\" description=\"Sets framework to mono 2.0\">");
|
||||||
ss.WriteLine(" <property name=\"nant.settings.currentframework\" value=\"mono-2.0\" />");
|
ss.WriteLine(" <property name=\"nant.settings.currentframework\" value=\"mono-2.0\" />");
|
||||||
ss.WriteLine(" </target>");
|
ss.WriteLine(" </target>");
|
||||||
ss.WriteLine();
|
ss.WriteLine();
|
||||||
|
|
||||||
ss.WriteLine(" <target name=\"mono-3.5\" description=\"Sets framework to mono 3.5\">");
|
ss.WriteLine(" <target name=\"mono-3.5\" description=\"Sets framework to mono 3.5\">");
|
||||||
ss.WriteLine(" <property name=\"nant.settings.currentframework\" value=\"mono-3.5\" />");
|
ss.WriteLine(" <property name=\"nant.settings.currentframework\" value=\"mono-3.5\" />");
|
||||||
ss.WriteLine(" </target>");
|
ss.WriteLine(" </target>");
|
||||||
ss.WriteLine();
|
ss.WriteLine();
|
||||||
|
|
||||||
ss.WriteLine(" <target name=\"init\" description=\"\">");
|
ss.WriteLine(" <target name=\"init\" description=\"\">");
|
||||||
ss.WriteLine(" <call target=\"${project.config}\" />");
|
ss.WriteLine(" <call target=\"${project.config}\" />");
|
||||||
|
@ -625,7 +625,7 @@ namespace Prebuild.Core.Targets
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ss.WriteLine(" <delete dir=\"${obj.dir}\" failonerror=\"false\" />");
|
ss.WriteLine(" <delete dir=\"${obj.dir}\" failonerror=\"false\" />");
|
||||||
foreach (ProjectNode project in solution.Projects)
|
foreach (ProjectNode project in solution.Projects)
|
||||||
{
|
{
|
||||||
string path = Helper.MakePathRelativeTo(solution.FullPath, project.FullPath);
|
string path = Helper.MakePathRelativeTo(solution.FullPath, project.FullPath);
|
||||||
|
|
|
@ -29,11 +29,11 @@ using Prebuild.Core.Attributes;
|
||||||
|
|
||||||
namespace Prebuild.Core.Targets
|
namespace Prebuild.Core.Targets
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Target("sharpdev2")]
|
[Target("sharpdev2")]
|
||||||
public class SharpDevelop2Target : VS2005Target
|
public class SharpDevelop2Target : VS2005Target
|
||||||
{
|
{
|
||||||
#region Properties
|
#region Properties
|
||||||
public override string VersionName
|
public override string VersionName
|
||||||
|
@ -45,38 +45,38 @@ namespace Prebuild.Core.Targets
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Public Methods
|
#region Public Methods
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Writes the specified kern.
|
/// Writes the specified kern.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="kern">The kern.</param>
|
/// <param name="kern">The kern.</param>
|
||||||
public override void Write(Kernel kern)
|
public override void Write(Kernel kern)
|
||||||
{
|
{
|
||||||
base.Write(kern);
|
base.Write(kern);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Cleans the specified kern.
|
/// Cleans the specified kern.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="kern">The kern.</param>
|
/// <param name="kern">The kern.</param>
|
||||||
public override void Clean(Kernel kern)
|
public override void Clean(Kernel kern)
|
||||||
{
|
{
|
||||||
base.Clean(kern);
|
base.Clean(kern);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the name.
|
/// Gets the name.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The name.</value>
|
/// <value>The name.</value>
|
||||||
public override string Name
|
public override string Name
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return "sharpdev2";
|
return "sharpdev2";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,392 +34,392 @@ using Prebuild.Core.Utilities;
|
||||||
|
|
||||||
namespace Prebuild.Core.Targets
|
namespace Prebuild.Core.Targets
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Target("sharpdev")]
|
[Target("sharpdev")]
|
||||||
public class SharpDevelopTarget : ITarget
|
public class SharpDevelopTarget : ITarget
|
||||||
{
|
{
|
||||||
#region Fields
|
#region Fields
|
||||||
|
|
||||||
private Kernel m_Kernel;
|
private Kernel m_Kernel;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Private Methods
|
#region Private Methods
|
||||||
|
|
||||||
private static string PrependPath(string path)
|
private static string PrependPath(string path)
|
||||||
{
|
{
|
||||||
string tmpPath = Helper.NormalizePath(path, '/');
|
string tmpPath = Helper.NormalizePath(path, '/');
|
||||||
Regex regex = new Regex(@"(\w):/(\w+)");
|
Regex regex = new Regex(@"(\w):/(\w+)");
|
||||||
Match match = regex.Match(tmpPath);
|
Match match = regex.Match(tmpPath);
|
||||||
if(match.Success || tmpPath[0] == '.' || tmpPath[0] == '/')
|
if(match.Success || tmpPath[0] == '.' || tmpPath[0] == '/')
|
||||||
{
|
{
|
||||||
tmpPath = Helper.NormalizePath(tmpPath);
|
tmpPath = Helper.NormalizePath(tmpPath);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
tmpPath = Helper.NormalizePath("./" + tmpPath);
|
tmpPath = Helper.NormalizePath("./" + tmpPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
return tmpPath;
|
return tmpPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static string BuildReference(SolutionNode solution, ReferenceNode refr)
|
private static string BuildReference(SolutionNode solution, ReferenceNode refr)
|
||||||
{
|
{
|
||||||
string ret = "<Reference type=\"";
|
string ret = "<Reference type=\"";
|
||||||
if(solution.ProjectsTable.ContainsKey(refr.Name))
|
if(solution.ProjectsTable.ContainsKey(refr.Name))
|
||||||
{
|
{
|
||||||
ret += "Project\" refto=\"" + refr.Name;
|
ret += "Project\" refto=\"" + refr.Name;
|
||||||
ret += "\" localcopy=\"" + refr.LocalCopy.ToString() + "\" />";
|
ret += "\" localcopy=\"" + refr.LocalCopy.ToString() + "\" />";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ProjectNode project = (ProjectNode)refr.Parent;
|
ProjectNode project = (ProjectNode)refr.Parent;
|
||||||
string fileRef = FindFileReference(refr.Name, project);
|
string fileRef = FindFileReference(refr.Name, project);
|
||||||
|
|
||||||
if(refr.Path != null || fileRef != null)
|
if(refr.Path != null || fileRef != null)
|
||||||
{
|
{
|
||||||
ret += "Assembly\" refto=\"";
|
ret += "Assembly\" refto=\"";
|
||||||
|
|
||||||
string finalPath = (refr.Path != null) ? Helper.MakeFilePath(refr.Path, refr.Name, "dll") : fileRef;
|
string finalPath = (refr.Path != null) ? Helper.MakeFilePath(refr.Path, refr.Name, "dll") : fileRef;
|
||||||
|
|
||||||
ret += finalPath;
|
ret += finalPath;
|
||||||
ret += "\" localcopy=\"" + refr.LocalCopy.ToString() + "\" />";
|
ret += "\" localcopy=\"" + refr.LocalCopy.ToString() + "\" />";
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret += "Gac\" refto=\"";
|
ret += "Gac\" refto=\"";
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
//Assembly assem = Assembly.Load(refr.Name);
|
//Assembly assem = Assembly.Load(refr.Name);
|
||||||
ret += refr.Name;// assem.FullName;
|
ret += refr.Name;// assem.FullName;
|
||||||
}
|
}
|
||||||
catch (System.NullReferenceException e)
|
catch (System.NullReferenceException e)
|
||||||
{
|
{
|
||||||
e.ToString();
|
e.ToString();
|
||||||
ret += refr.Name;
|
ret += refr.Name;
|
||||||
}
|
}
|
||||||
ret += "\" localcopy=\"" + refr.LocalCopy.ToString() + "\" />";
|
ret += "\" localcopy=\"" + refr.LocalCopy.ToString() + "\" />";
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static string FindFileReference(string refName, ProjectNode project)
|
private static string FindFileReference(string refName, ProjectNode project)
|
||||||
{
|
{
|
||||||
foreach(ReferencePathNode refPath in project.ReferencePaths)
|
foreach(ReferencePathNode refPath in project.ReferencePaths)
|
||||||
{
|
{
|
||||||
string fullPath = Helper.MakeFilePath(refPath.Path, refName, "dll");
|
string fullPath = Helper.MakeFilePath(refPath.Path, refName, "dll");
|
||||||
|
|
||||||
if(File.Exists(fullPath))
|
if(File.Exists(fullPath))
|
||||||
{
|
{
|
||||||
return fullPath;
|
return fullPath;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the XML doc file.
|
/// Gets the XML doc file.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="project">The project.</param>
|
/// <param name="project">The project.</param>
|
||||||
/// <param name="conf">The conf.</param>
|
/// <param name="conf">The conf.</param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public static string GenerateXmlDocFile(ProjectNode project, ConfigurationNode conf)
|
public static string GenerateXmlDocFile(ProjectNode project, ConfigurationNode conf)
|
||||||
{
|
{
|
||||||
if( conf == null )
|
if( conf == null )
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("conf");
|
throw new ArgumentNullException("conf");
|
||||||
}
|
}
|
||||||
if( project == null )
|
if( project == null )
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("project");
|
throw new ArgumentNullException("project");
|
||||||
}
|
}
|
||||||
string docFile = (string)conf.Options["XmlDocFile"];
|
string docFile = (string)conf.Options["XmlDocFile"];
|
||||||
if(docFile != null && docFile.Length == 0)//default to assembly name if not specified
|
if(docFile != null && docFile.Length == 0)//default to assembly name if not specified
|
||||||
{
|
{
|
||||||
return "False";
|
return "False";
|
||||||
}
|
}
|
||||||
return "True";
|
return "True";
|
||||||
}
|
}
|
||||||
|
|
||||||
private void WriteProject(SolutionNode solution, ProjectNode project)
|
private void WriteProject(SolutionNode solution, ProjectNode project)
|
||||||
{
|
{
|
||||||
string csComp = "Csc";
|
string csComp = "Csc";
|
||||||
string netRuntime = "MsNet";
|
string netRuntime = "MsNet";
|
||||||
if(project.Runtime == ClrRuntime.Mono)
|
if(project.Runtime == ClrRuntime.Mono)
|
||||||
{
|
{
|
||||||
csComp = "Mcs";
|
csComp = "Mcs";
|
||||||
netRuntime = "Mono";
|
netRuntime = "Mono";
|
||||||
}
|
}
|
||||||
|
|
||||||
string projFile = Helper.MakeFilePath(project.FullPath, project.Name, "prjx");
|
string projFile = Helper.MakeFilePath(project.FullPath, project.Name, "prjx");
|
||||||
StreamWriter ss = new StreamWriter(projFile);
|
StreamWriter ss = new StreamWriter(projFile);
|
||||||
|
|
||||||
m_Kernel.CurrentWorkingDirectory.Push();
|
m_Kernel.CurrentWorkingDirectory.Push();
|
||||||
Helper.SetCurrentDir(Path.GetDirectoryName(projFile));
|
Helper.SetCurrentDir(Path.GetDirectoryName(projFile));
|
||||||
|
|
||||||
using(ss)
|
using(ss)
|
||||||
{
|
{
|
||||||
ss.WriteLine(
|
ss.WriteLine(
|
||||||
"<Project name=\"{0}\" standardNamespace=\"{1}\" description=\"\" newfilesearch=\"None\" enableviewstate=\"True\" version=\"1.1\" projecttype=\"C#\">",
|
"<Project name=\"{0}\" standardNamespace=\"{1}\" description=\"\" newfilesearch=\"None\" enableviewstate=\"True\" version=\"1.1\" projecttype=\"C#\">",
|
||||||
project.Name,
|
project.Name,
|
||||||
project.RootNamespace
|
project.RootNamespace
|
||||||
);
|
);
|
||||||
|
|
||||||
ss.WriteLine(" <Contents>");
|
ss.WriteLine(" <Contents>");
|
||||||
foreach(string file in project.Files)
|
foreach(string file in project.Files)
|
||||||
{
|
{
|
||||||
string buildAction = "Compile";
|
string buildAction = "Compile";
|
||||||
switch(project.Files.GetBuildAction(file))
|
switch(project.Files.GetBuildAction(file))
|
||||||
{
|
{
|
||||||
case BuildAction.None:
|
case BuildAction.None:
|
||||||
buildAction = "Nothing";
|
buildAction = "Nothing";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BuildAction.Content:
|
case BuildAction.Content:
|
||||||
buildAction = "Exclude";
|
buildAction = "Exclude";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BuildAction.EmbeddedResource:
|
case BuildAction.EmbeddedResource:
|
||||||
buildAction = "EmbedAsResource";
|
buildAction = "EmbedAsResource";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
buildAction = "Compile";
|
buildAction = "Compile";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Sort of a hack, we try and resolve the path and make it relative, if we can.
|
// Sort of a hack, we try and resolve the path and make it relative, if we can.
|
||||||
string filePath = PrependPath(file);
|
string filePath = PrependPath(file);
|
||||||
ss.WriteLine(" <File name=\"{0}\" subtype=\"Code\" buildaction=\"{1}\" dependson=\"\" data=\"\" />", filePath, buildAction);
|
ss.WriteLine(" <File name=\"{0}\" subtype=\"Code\" buildaction=\"{1}\" dependson=\"\" data=\"\" />", filePath, buildAction);
|
||||||
}
|
}
|
||||||
ss.WriteLine(" </Contents>");
|
ss.WriteLine(" </Contents>");
|
||||||
|
|
||||||
ss.WriteLine(" <References>");
|
ss.WriteLine(" <References>");
|
||||||
foreach(ReferenceNode refr in project.References)
|
foreach(ReferenceNode refr in project.References)
|
||||||
{
|
{
|
||||||
ss.WriteLine(" {0}", BuildReference(solution, refr));
|
ss.WriteLine(" {0}", BuildReference(solution, refr));
|
||||||
}
|
}
|
||||||
ss.WriteLine(" </References>");
|
ss.WriteLine(" </References>");
|
||||||
|
|
||||||
ss.Write(" <DeploymentInformation");
|
ss.Write(" <DeploymentInformation");
|
||||||
ss.Write(" target=\"\"");
|
ss.Write(" target=\"\"");
|
||||||
ss.Write(" script=\"\"");
|
ss.Write(" script=\"\"");
|
||||||
ss.Write(" strategy=\"File\"");
|
ss.Write(" strategy=\"File\"");
|
||||||
ss.WriteLine(" />");
|
ss.WriteLine(" />");
|
||||||
|
|
||||||
int count = 0;
|
int count = 0;
|
||||||
|
|
||||||
ss.WriteLine(" <Configurations active=\"{0}\">", solution.ActiveConfig);
|
ss.WriteLine(" <Configurations active=\"{0}\">", solution.ActiveConfig);
|
||||||
|
|
||||||
foreach(ConfigurationNode conf in project.Configurations)
|
foreach(ConfigurationNode conf in project.Configurations)
|
||||||
{
|
{
|
||||||
ss.Write(" <Configuration");
|
ss.Write(" <Configuration");
|
||||||
ss.Write(" runwithwarnings=\"True\"");
|
ss.Write(" runwithwarnings=\"True\"");
|
||||||
ss.Write(" name=\"{0}\"", conf.Name);
|
ss.Write(" name=\"{0}\"", conf.Name);
|
||||||
ss.WriteLine(">");
|
ss.WriteLine(">");
|
||||||
ss.Write(" <CodeGeneration");
|
ss.Write(" <CodeGeneration");
|
||||||
ss.Write(" runtime=\"{0}\"", netRuntime);
|
ss.Write(" runtime=\"{0}\"", netRuntime);
|
||||||
ss.Write(" compiler=\"{0}\"", csComp);
|
ss.Write(" compiler=\"{0}\"", csComp);
|
||||||
ss.Write(" compilerversion=\"\"");
|
ss.Write(" compilerversion=\"\"");
|
||||||
ss.Write(" warninglevel=\"{0}\"", conf.Options["WarningLevel"]);
|
ss.Write(" warninglevel=\"{0}\"", conf.Options["WarningLevel"]);
|
||||||
ss.Write(" nowarn=\"{0}\"", conf.Options["SuppressWarnings"]);
|
ss.Write(" nowarn=\"{0}\"", conf.Options["SuppressWarnings"]);
|
||||||
ss.Write(" includedebuginformation=\"{0}\"", conf.Options["DebugInformation"]);
|
ss.Write(" includedebuginformation=\"{0}\"", conf.Options["DebugInformation"]);
|
||||||
ss.Write(" optimize=\"{0}\"", conf.Options["OptimizeCode"]);
|
ss.Write(" optimize=\"{0}\"", conf.Options["OptimizeCode"]);
|
||||||
ss.Write(" unsafecodeallowed=\"{0}\"", conf.Options["AllowUnsafe"]);
|
ss.Write(" unsafecodeallowed=\"{0}\"", conf.Options["AllowUnsafe"]);
|
||||||
ss.Write(" generateoverflowchecks=\"{0}\"", conf.Options["CheckUnderflowOverflow"]);
|
ss.Write(" generateoverflowchecks=\"{0}\"", conf.Options["CheckUnderflowOverflow"]);
|
||||||
ss.Write(" mainclass=\"{0}\"", project.StartupObject);
|
ss.Write(" mainclass=\"{0}\"", project.StartupObject);
|
||||||
ss.Write(" target=\"{0}\"", project.Type);
|
ss.Write(" target=\"{0}\"", project.Type);
|
||||||
ss.Write(" definesymbols=\"{0}\"", conf.Options["CompilerDefines"]);
|
ss.Write(" definesymbols=\"{0}\"", conf.Options["CompilerDefines"]);
|
||||||
ss.Write(" generatexmldocumentation=\"{0}\"", GenerateXmlDocFile(project, conf));
|
ss.Write(" generatexmldocumentation=\"{0}\"", GenerateXmlDocFile(project, conf));
|
||||||
ss.Write(" win32Icon=\"{0}\"", Helper.NormalizePath(".\\" + project.AppIcon));
|
ss.Write(" win32Icon=\"{0}\"", Helper.NormalizePath(".\\" + project.AppIcon));
|
||||||
ss.Write(" noconfig=\"{0}\"", "False");
|
ss.Write(" noconfig=\"{0}\"", "False");
|
||||||
ss.Write(" nostdlib=\"{0}\"", conf.Options["NoStdLib"]);
|
ss.Write(" nostdlib=\"{0}\"", conf.Options["NoStdLib"]);
|
||||||
ss.WriteLine(" />");
|
ss.WriteLine(" />");
|
||||||
|
|
||||||
ss.Write(" <Execution");
|
ss.Write(" <Execution");
|
||||||
ss.Write(" commandlineparameters=\"\"");
|
ss.Write(" commandlineparameters=\"\"");
|
||||||
ss.Write(" consolepause=\"True\"");
|
ss.Write(" consolepause=\"True\"");
|
||||||
ss.WriteLine(" />");
|
ss.WriteLine(" />");
|
||||||
|
|
||||||
ss.Write(" <Output");
|
ss.Write(" <Output");
|
||||||
ss.Write(" directory=\".\\{0}\"", Helper.NormalizePath(conf.Options["OutputPath"].ToString()));
|
ss.Write(" directory=\".\\{0}\"", Helper.NormalizePath(conf.Options["OutputPath"].ToString()));
|
||||||
ss.Write(" assembly=\"{0}\"", project.AssemblyName);
|
ss.Write(" assembly=\"{0}\"", project.AssemblyName);
|
||||||
ss.Write(" executeScript=\"{0}\"", conf.Options["RunScript"]);
|
ss.Write(" executeScript=\"{0}\"", conf.Options["RunScript"]);
|
||||||
if (conf.Options["PreBuildEvent"] != null && conf.Options["PreBuildEvent"].ToString().Length != 0)
|
if (conf.Options["PreBuildEvent"] != null && conf.Options["PreBuildEvent"].ToString().Length != 0)
|
||||||
{
|
{
|
||||||
ss.Write(" executeBeforeBuild=\"{0}\"", Helper.NormalizePath(conf.Options["PreBuildEvent"].ToString()));
|
ss.Write(" executeBeforeBuild=\"{0}\"", Helper.NormalizePath(conf.Options["PreBuildEvent"].ToString()));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ss.Write(" executeBeforeBuild=\"{0}\"", conf.Options["PreBuildEvent"]);
|
ss.Write(" executeBeforeBuild=\"{0}\"", conf.Options["PreBuildEvent"]);
|
||||||
}
|
}
|
||||||
if (conf.Options["PostBuildEvent"] != null && conf.Options["PostBuildEvent"].ToString().Length != 0)
|
if (conf.Options["PostBuildEvent"] != null && conf.Options["PostBuildEvent"].ToString().Length != 0)
|
||||||
{
|
{
|
||||||
ss.Write(" executeAfterBuild=\"{0}\"", Helper.NormalizePath(conf.Options["PostBuildEvent"].ToString()));
|
ss.Write(" executeAfterBuild=\"{0}\"", Helper.NormalizePath(conf.Options["PostBuildEvent"].ToString()));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ss.Write(" executeAfterBuild=\"{0}\"", conf.Options["PostBuildEvent"]);
|
ss.Write(" executeAfterBuild=\"{0}\"", conf.Options["PostBuildEvent"]);
|
||||||
}
|
}
|
||||||
ss.Write(" executeBeforeBuildArguments=\"{0}\"", conf.Options["PreBuildEventArgs"]);
|
ss.Write(" executeBeforeBuildArguments=\"{0}\"", conf.Options["PreBuildEventArgs"]);
|
||||||
ss.Write(" executeAfterBuildArguments=\"{0}\"", conf.Options["PreBuildEventArgs"]);
|
ss.Write(" executeAfterBuildArguments=\"{0}\"", conf.Options["PreBuildEventArgs"]);
|
||||||
ss.WriteLine(" />");
|
ss.WriteLine(" />");
|
||||||
ss.WriteLine(" </Configuration>");
|
ss.WriteLine(" </Configuration>");
|
||||||
|
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
ss.WriteLine(" </Configurations>");
|
ss.WriteLine(" </Configurations>");
|
||||||
ss.WriteLine("</Project>");
|
ss.WriteLine("</Project>");
|
||||||
}
|
}
|
||||||
|
|
||||||
m_Kernel.CurrentWorkingDirectory.Pop();
|
m_Kernel.CurrentWorkingDirectory.Pop();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void WriteCombine(SolutionNode solution)
|
private void WriteCombine(SolutionNode solution)
|
||||||
{
|
{
|
||||||
m_Kernel.Log.Write("Creating SharpDevelop combine and project files");
|
m_Kernel.Log.Write("Creating SharpDevelop combine and project files");
|
||||||
foreach(ProjectNode project in solution.Projects)
|
foreach(ProjectNode project in solution.Projects)
|
||||||
{
|
{
|
||||||
if(m_Kernel.AllowProject(project.FilterGroups))
|
if(m_Kernel.AllowProject(project.FilterGroups))
|
||||||
{
|
{
|
||||||
m_Kernel.Log.Write("...Creating project: {0}", project.Name);
|
m_Kernel.Log.Write("...Creating project: {0}", project.Name);
|
||||||
WriteProject(solution, project);
|
WriteProject(solution, project);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
m_Kernel.Log.Write("");
|
m_Kernel.Log.Write("");
|
||||||
string combFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "cmbx");
|
string combFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "cmbx");
|
||||||
StreamWriter ss = new StreamWriter(combFile);
|
StreamWriter ss = new StreamWriter(combFile);
|
||||||
|
|
||||||
m_Kernel.CurrentWorkingDirectory.Push();
|
m_Kernel.CurrentWorkingDirectory.Push();
|
||||||
Helper.SetCurrentDir(Path.GetDirectoryName(combFile));
|
Helper.SetCurrentDir(Path.GetDirectoryName(combFile));
|
||||||
|
|
||||||
using(ss)
|
using(ss)
|
||||||
{
|
{
|
||||||
ss.WriteLine("<Combine fileversion=\"1.0\" name=\"{0}\" description=\"\">", solution.Name);
|
ss.WriteLine("<Combine fileversion=\"1.0\" name=\"{0}\" description=\"\">", solution.Name);
|
||||||
|
|
||||||
int count = 0;
|
int count = 0;
|
||||||
foreach(ProjectNode project in solution.Projects)
|
foreach(ProjectNode project in solution.Projects)
|
||||||
{
|
{
|
||||||
if(count == 0)
|
if(count == 0)
|
||||||
ss.WriteLine(" <StartMode startupentry=\"{0}\" single=\"True\">", project.Name);
|
ss.WriteLine(" <StartMode startupentry=\"{0}\" single=\"True\">", project.Name);
|
||||||
|
|
||||||
ss.WriteLine(" <Execute entry=\"{0}\" type=\"None\" />", project.Name);
|
ss.WriteLine(" <Execute entry=\"{0}\" type=\"None\" />", project.Name);
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
ss.WriteLine(" </StartMode>");
|
ss.WriteLine(" </StartMode>");
|
||||||
|
|
||||||
ss.WriteLine(" <Entries>");
|
ss.WriteLine(" <Entries>");
|
||||||
foreach(ProjectNode project in solution.Projects)
|
foreach(ProjectNode project in solution.Projects)
|
||||||
{
|
{
|
||||||
string path = Helper.MakePathRelativeTo(solution.FullPath, project.FullPath);
|
string path = Helper.MakePathRelativeTo(solution.FullPath, project.FullPath);
|
||||||
ss.WriteLine(" <Entry filename=\"{0}\" />",
|
ss.WriteLine(" <Entry filename=\"{0}\" />",
|
||||||
Helper.MakeFilePath(path, project.Name, "prjx"));
|
Helper.MakeFilePath(path, project.Name, "prjx"));
|
||||||
}
|
}
|
||||||
ss.WriteLine(" </Entries>");
|
ss.WriteLine(" </Entries>");
|
||||||
|
|
||||||
count = 0;
|
count = 0;
|
||||||
foreach(ConfigurationNode conf in solution.Configurations)
|
foreach(ConfigurationNode conf in solution.Configurations)
|
||||||
{
|
{
|
||||||
if(count == 0)
|
if(count == 0)
|
||||||
{
|
{
|
||||||
ss.WriteLine(" <Configurations active=\"{0}\">", conf.Name);
|
ss.WriteLine(" <Configurations active=\"{0}\">", conf.Name);
|
||||||
}
|
}
|
||||||
|
|
||||||
ss.WriteLine(" <Configuration name=\"{0}\">", conf.Name);
|
ss.WriteLine(" <Configuration name=\"{0}\">", conf.Name);
|
||||||
foreach(ProjectNode project in solution.Projects)
|
foreach(ProjectNode project in solution.Projects)
|
||||||
{
|
{
|
||||||
ss.WriteLine(" <Entry name=\"{0}\" configurationname=\"{1}\" build=\"True\" />", project.Name, conf.Name);
|
ss.WriteLine(" <Entry name=\"{0}\" configurationname=\"{1}\" build=\"True\" />", project.Name, conf.Name);
|
||||||
}
|
}
|
||||||
ss.WriteLine(" </Configuration>");
|
ss.WriteLine(" </Configuration>");
|
||||||
|
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
ss.WriteLine(" </Configurations>");
|
ss.WriteLine(" </Configurations>");
|
||||||
ss.WriteLine("</Combine>");
|
ss.WriteLine("</Combine>");
|
||||||
}
|
}
|
||||||
|
|
||||||
m_Kernel.CurrentWorkingDirectory.Pop();
|
m_Kernel.CurrentWorkingDirectory.Pop();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void CleanProject(ProjectNode project)
|
private void CleanProject(ProjectNode project)
|
||||||
{
|
{
|
||||||
m_Kernel.Log.Write("...Cleaning project: {0}", project.Name);
|
m_Kernel.Log.Write("...Cleaning project: {0}", project.Name);
|
||||||
string projectFile = Helper.MakeFilePath(project.FullPath, project.Name, "prjx");
|
string projectFile = Helper.MakeFilePath(project.FullPath, project.Name, "prjx");
|
||||||
Helper.DeleteIfExists(projectFile);
|
Helper.DeleteIfExists(projectFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void CleanSolution(SolutionNode solution)
|
private void CleanSolution(SolutionNode solution)
|
||||||
{
|
{
|
||||||
m_Kernel.Log.Write("Cleaning SharpDevelop combine and project files for", solution.Name);
|
m_Kernel.Log.Write("Cleaning SharpDevelop combine and project files for", solution.Name);
|
||||||
|
|
||||||
string slnFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "cmbx");
|
string slnFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "cmbx");
|
||||||
Helper.DeleteIfExists(slnFile);
|
Helper.DeleteIfExists(slnFile);
|
||||||
|
|
||||||
foreach(ProjectNode project in solution.Projects)
|
foreach(ProjectNode project in solution.Projects)
|
||||||
{
|
{
|
||||||
CleanProject(project);
|
CleanProject(project);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_Kernel.Log.Write("");
|
m_Kernel.Log.Write("");
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region ITarget Members
|
#region ITarget Members
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Writes the specified kern.
|
/// Writes the specified kern.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="kern">The kern.</param>
|
/// <param name="kern">The kern.</param>
|
||||||
public void Write(Kernel kern)
|
public void Write(Kernel kern)
|
||||||
{
|
{
|
||||||
if( kern == null )
|
if( kern == null )
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("kern");
|
throw new ArgumentNullException("kern");
|
||||||
}
|
}
|
||||||
m_Kernel = kern;
|
m_Kernel = kern;
|
||||||
foreach(SolutionNode solution in kern.Solutions)
|
foreach(SolutionNode solution in kern.Solutions)
|
||||||
{
|
{
|
||||||
WriteCombine(solution);
|
WriteCombine(solution);
|
||||||
}
|
}
|
||||||
m_Kernel = null;
|
m_Kernel = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Cleans the specified kern.
|
/// Cleans the specified kern.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="kern">The kern.</param>
|
/// <param name="kern">The kern.</param>
|
||||||
public virtual void Clean(Kernel kern)
|
public virtual void Clean(Kernel kern)
|
||||||
{
|
{
|
||||||
if( kern == null )
|
if( kern == null )
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("kern");
|
throw new ArgumentNullException("kern");
|
||||||
}
|
}
|
||||||
m_Kernel = kern;
|
m_Kernel = kern;
|
||||||
foreach(SolutionNode sol in kern.Solutions)
|
foreach(SolutionNode sol in kern.Solutions)
|
||||||
{
|
{
|
||||||
CleanSolution(sol);
|
CleanSolution(sol);
|
||||||
}
|
}
|
||||||
m_Kernel = null;
|
m_Kernel = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the name.
|
/// Gets the name.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The name.</value>
|
/// <value>The name.</value>
|
||||||
public string Name
|
public string Name
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return "sharpdev";
|
return "sharpdev";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,194 +4,194 @@ using System.Text;
|
||||||
|
|
||||||
namespace Prebuild.Core.Targets
|
namespace Prebuild.Core.Targets
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public struct ToolInfo
|
public struct ToolInfo
|
||||||
{
|
{
|
||||||
string name;
|
string name;
|
||||||
string guid;
|
string guid;
|
||||||
string fileExtension;
|
string fileExtension;
|
||||||
string xmlTag;
|
string xmlTag;
|
||||||
string importProject;
|
string importProject;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the name.
|
/// Gets or sets the name.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The name.</value>
|
/// <value>The name.</value>
|
||||||
public string Name
|
public string Name
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
name = value;
|
name = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the GUID.
|
/// Gets or sets the GUID.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The GUID.</value>
|
/// <value>The GUID.</value>
|
||||||
public string Guid
|
public string Guid
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return guid;
|
return guid;
|
||||||
}
|
}
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
guid = value;
|
guid = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the file extension.
|
/// Gets or sets the file extension.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The file extension.</value>
|
/// <value>The file extension.</value>
|
||||||
public string FileExtension
|
public string FileExtension
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return fileExtension;
|
return fileExtension;
|
||||||
}
|
}
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
fileExtension = value;
|
fileExtension = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public string LanguageExtension
|
public string LanguageExtension
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
switch (this.Name)
|
switch (this.Name)
|
||||||
{
|
{
|
||||||
case "C#":
|
case "C#":
|
||||||
return ".cs";
|
return ".cs";
|
||||||
case "VisualBasic":
|
case "VisualBasic":
|
||||||
return ".vb";
|
return ".vb";
|
||||||
case "Boo":
|
case "Boo":
|
||||||
return ".boo";
|
return ".boo";
|
||||||
default:
|
default:
|
||||||
return ".cs";
|
return ".cs";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the XML tag.
|
/// Gets or sets the XML tag.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The XML tag.</value>
|
/// <value>The XML tag.</value>
|
||||||
public string XmlTag
|
public string XmlTag
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return xmlTag;
|
return xmlTag;
|
||||||
}
|
}
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
xmlTag = value;
|
xmlTag = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the import project property.
|
/// Gets or sets the import project property.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The ImportProject tag.</value>
|
/// <value>The ImportProject tag.</value>
|
||||||
public string ImportProject
|
public string ImportProject
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return importProject;
|
return importProject;
|
||||||
}
|
}
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
importProject = value;
|
importProject = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of the <see cref="ToolInfo"/> class.
|
/// Initializes a new instance of the <see cref="ToolInfo"/> class.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="name">The name.</param>
|
/// <param name="name">The name.</param>
|
||||||
/// <param name="guid">The GUID.</param>
|
/// <param name="guid">The GUID.</param>
|
||||||
/// <param name="fileExtension">The file extension.</param>
|
/// <param name="fileExtension">The file extension.</param>
|
||||||
/// <param name="xml">The XML.</param>
|
/// <param name="xml">The XML.</param>
|
||||||
/// <param name="importProject">The import project.</param>
|
/// <param name="importProject">The import project.</param>
|
||||||
public ToolInfo(string name, string guid, string fileExtension, string xml, string importProject)
|
public ToolInfo(string name, string guid, string fileExtension, string xml, string importProject)
|
||||||
{
|
{
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.guid = guid;
|
this.guid = guid;
|
||||||
this.fileExtension = fileExtension;
|
this.fileExtension = fileExtension;
|
||||||
this.xmlTag = xml;
|
this.xmlTag = xml;
|
||||||
this.importProject = importProject;
|
this.importProject = importProject;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of the <see cref="ToolInfo"/> class.
|
/// Initializes a new instance of the <see cref="ToolInfo"/> class.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="name">The name.</param>
|
/// <param name="name">The name.</param>
|
||||||
/// <param name="guid">The GUID.</param>
|
/// <param name="guid">The GUID.</param>
|
||||||
/// <param name="fileExtension">The file extension.</param>
|
/// <param name="fileExtension">The file extension.</param>
|
||||||
/// <param name="xml">The XML.</param>
|
/// <param name="xml">The XML.</param>
|
||||||
public ToolInfo(string name, string guid, string fileExtension, string xml)
|
public ToolInfo(string name, string guid, string fileExtension, string xml)
|
||||||
{
|
{
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.guid = guid;
|
this.guid = guid;
|
||||||
this.fileExtension = fileExtension;
|
this.fileExtension = fileExtension;
|
||||||
this.xmlTag = xml;
|
this.xmlTag = xml;
|
||||||
this.importProject = "$(MSBuildBinPath)\\Microsoft." + xml + ".Targets";
|
this.importProject = "$(MSBuildBinPath)\\Microsoft." + xml + ".Targets";
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Equals operator
|
/// Equals operator
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="obj">ToolInfo to compare</param>
|
/// <param name="obj">ToolInfo to compare</param>
|
||||||
/// <returns>true if toolInfos are equal</returns>
|
/// <returns>true if toolInfos are equal</returns>
|
||||||
public override bool Equals(object obj)
|
public override bool Equals(object obj)
|
||||||
{
|
{
|
||||||
if (obj == null)
|
if (obj == null)
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("obj");
|
throw new ArgumentNullException("obj");
|
||||||
}
|
}
|
||||||
if (obj.GetType() != typeof(ToolInfo))
|
if (obj.GetType() != typeof(ToolInfo))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
ToolInfo c = (ToolInfo)obj;
|
ToolInfo c = (ToolInfo)obj;
|
||||||
return ((this.name == c.name) && (this.guid == c.guid) && (this.fileExtension == c.fileExtension) && (this.importProject == c.importProject));
|
return ((this.name == c.name) && (this.guid == c.guid) && (this.fileExtension == c.fileExtension) && (this.importProject == c.importProject));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Equals operator
|
/// Equals operator
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="c1">ToolInfo to compare</param>
|
/// <param name="c1">ToolInfo to compare</param>
|
||||||
/// <param name="c2">ToolInfo to compare</param>
|
/// <param name="c2">ToolInfo to compare</param>
|
||||||
/// <returns>True if toolInfos are equal</returns>
|
/// <returns>True if toolInfos are equal</returns>
|
||||||
public static bool operator ==(ToolInfo c1, ToolInfo c2)
|
public static bool operator ==(ToolInfo c1, ToolInfo c2)
|
||||||
{
|
{
|
||||||
return ((c1.name == c2.name) && (c1.guid == c2.guid) && (c1.fileExtension == c2.fileExtension) && (c1.importProject == c2.importProject) && (c1.xmlTag == c2.xmlTag));
|
return ((c1.name == c2.name) && (c1.guid == c2.guid) && (c1.fileExtension == c2.fileExtension) && (c1.importProject == c2.importProject) && (c1.xmlTag == c2.xmlTag));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Not equals operator
|
/// Not equals operator
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="c1">ToolInfo to compare</param>
|
/// <param name="c1">ToolInfo to compare</param>
|
||||||
/// <param name="c2">ToolInfo to compare</param>
|
/// <param name="c2">ToolInfo to compare</param>
|
||||||
/// <returns>True if toolInfos are not equal</returns>
|
/// <returns>True if toolInfos are not equal</returns>
|
||||||
public static bool operator !=(ToolInfo c1, ToolInfo c2)
|
public static bool operator !=(ToolInfo c1, ToolInfo c2)
|
||||||
{
|
{
|
||||||
return !(c1 == c2);
|
return !(c1 == c2);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Hash Code
|
/// Hash Code
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns>Hash code</returns>
|
/// <returns>Hash code</returns>
|
||||||
public override int GetHashCode()
|
public override int GetHashCode()
|
||||||
{
|
{
|
||||||
return name.GetHashCode() ^ guid.GetHashCode() ^ this.fileExtension.GetHashCode() ^ this.importProject.GetHashCode() ^ this.xmlTag.GetHashCode();
|
return name.GetHashCode() ^ guid.GetHashCode() ^ this.fileExtension.GetHashCode() ^ this.importProject.GetHashCode() ^ this.xmlTag.GetHashCode();
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,59 +29,59 @@ using Prebuild.Core.Attributes;
|
||||||
|
|
||||||
namespace Prebuild.Core.Targets
|
namespace Prebuild.Core.Targets
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Target("vs2002")]
|
[Target("vs2002")]
|
||||||
public class VS2002Target : VS2003Target
|
public class VS2002Target : VS2003Target
|
||||||
{
|
{
|
||||||
#region Private Methods
|
#region Private Methods
|
||||||
|
|
||||||
private void SetVS2002()
|
private void SetVS2002()
|
||||||
{
|
{
|
||||||
this.SolutionVersion = "7.00";
|
this.SolutionVersion = "7.00";
|
||||||
this.ProductVersion = "7.0.9254";
|
this.ProductVersion = "7.0.9254";
|
||||||
this.SchemaVersion = "1.0";
|
this.SchemaVersion = "1.0";
|
||||||
this.VersionName = "2002";
|
this.VersionName = "2002";
|
||||||
this.Version = VSVersion.VS70;
|
this.Version = VSVersion.VS70;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Public Methods
|
#region Public Methods
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Writes the specified kern.
|
/// Writes the specified kern.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="kern">The kern.</param>
|
/// <param name="kern">The kern.</param>
|
||||||
public override void Write(Kernel kern)
|
public override void Write(Kernel kern)
|
||||||
{
|
{
|
||||||
SetVS2002();
|
SetVS2002();
|
||||||
base.Write(kern);
|
base.Write(kern);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Cleans the specified kern.
|
/// Cleans the specified kern.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="kern">The kern.</param>
|
/// <param name="kern">The kern.</param>
|
||||||
public override void Clean(Kernel kern)
|
public override void Clean(Kernel kern)
|
||||||
{
|
{
|
||||||
SetVS2002();
|
SetVS2002();
|
||||||
base.Clean(kern);
|
base.Clean(kern);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the name.
|
/// Gets the name.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The name.</value>
|
/// <value>The name.</value>
|
||||||
public override string Name
|
public override string Name
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return "vs2002";
|
return "vs2002";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -11,86 +11,86 @@ using System.CodeDom.Compiler;
|
||||||
namespace Prebuild.Core.Targets
|
namespace Prebuild.Core.Targets
|
||||||
{
|
{
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Target("vs2008")]
|
[Target("vs2008")]
|
||||||
public class VS2008Target : VSGenericTarget
|
public class VS2008Target : VSGenericTarget
|
||||||
{
|
{
|
||||||
#region Fields
|
#region Fields
|
||||||
string solutionVersion = "10.00";
|
string solutionVersion = "10.00";
|
||||||
string productVersion = "9.0.21022";
|
string productVersion = "9.0.21022";
|
||||||
string schemaVersion = "2.0";
|
string schemaVersion = "2.0";
|
||||||
string versionName = "Visual Studio 2008";
|
string versionName = "Visual Studio 2008";
|
||||||
string name = "vs2008";
|
string name = "vs2008";
|
||||||
VSVersion version = VSVersion.VS90;
|
VSVersion version = VSVersion.VS90;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the solution version.
|
/// Gets or sets the solution version.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The solution version.</value>
|
/// <value>The solution version.</value>
|
||||||
public override string SolutionVersion
|
public override string SolutionVersion
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return solutionVersion;
|
return solutionVersion;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the product version.
|
/// Gets or sets the product version.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The product version.</value>
|
/// <value>The product version.</value>
|
||||||
public override string ProductVersion
|
public override string ProductVersion
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return productVersion;
|
return productVersion;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the schema version.
|
/// Gets or sets the schema version.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The schema version.</value>
|
/// <value>The schema version.</value>
|
||||||
public override string SchemaVersion
|
public override string SchemaVersion
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return schemaVersion;
|
return schemaVersion;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the name of the version.
|
/// Gets or sets the name of the version.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The name of the version.</value>
|
/// <value>The name of the version.</value>
|
||||||
public override string VersionName
|
public override string VersionName
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return versionName;
|
return versionName;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the version.
|
/// Gets or sets the version.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The version.</value>
|
/// <value>The version.</value>
|
||||||
public override VSVersion Version
|
public override VSVersion Version
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return version;
|
return version;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the name.
|
/// Gets the name.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The name.</value>
|
/// <value>The name.</value>
|
||||||
public override string Name
|
public override string Name
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override string GetToolsVersionXml(FrameworkVersion frameworkVersion)
|
protected override string GetToolsVersionXml(FrameworkVersion frameworkVersion)
|
||||||
{
|
{
|
||||||
|
@ -110,18 +110,18 @@ namespace Prebuild.Core.Targets
|
||||||
get { return "# Visual Studio 2008"; }
|
get { return "# Visual Studio 2008"; }
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Constructors
|
#region Constructors
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of the <see cref="VS2005Target"/> class.
|
/// Initializes a new instance of the <see cref="VS2005Target"/> class.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public VS2008Target()
|
public VS2008Target()
|
||||||
: base()
|
: base()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,96 +11,96 @@ using System.CodeDom.Compiler;
|
||||||
namespace Prebuild.Core.Targets
|
namespace Prebuild.Core.Targets
|
||||||
{
|
{
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Target("vs2010")]
|
[Target("vs2010")]
|
||||||
public class VS2010Target : VSGenericTarget
|
public class VS2010Target : VSGenericTarget
|
||||||
{
|
{
|
||||||
#region Fields
|
#region Fields
|
||||||
|
|
||||||
string solutionVersion = "11.00";
|
string solutionVersion = "11.00";
|
||||||
string productVersion = "9.0.30729";
|
string productVersion = "9.0.30729";
|
||||||
string schemaVersion = "2.0";
|
string schemaVersion = "2.0";
|
||||||
string versionName = "Visual Studio 2010";
|
string versionName = "Visual Studio 2010";
|
||||||
string name = "vs2010";
|
string name = "vs2010";
|
||||||
VSVersion version = VSVersion.VS10;
|
VSVersion version = VSVersion.VS10;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Properties
|
#region Properties
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the solution version.
|
/// Gets or sets the solution version.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The solution version.</value>
|
/// <value>The solution version.</value>
|
||||||
public override string SolutionVersion
|
public override string SolutionVersion
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return solutionVersion;
|
return solutionVersion;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the product version.
|
/// Gets or sets the product version.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The product version.</value>
|
/// <value>The product version.</value>
|
||||||
public override string ProductVersion
|
public override string ProductVersion
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return productVersion;
|
return productVersion;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the schema version.
|
/// Gets or sets the schema version.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The schema version.</value>
|
/// <value>The schema version.</value>
|
||||||
public override string SchemaVersion
|
public override string SchemaVersion
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return schemaVersion;
|
return schemaVersion;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the name of the version.
|
/// Gets or sets the name of the version.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The name of the version.</value>
|
/// <value>The name of the version.</value>
|
||||||
public override string VersionName
|
public override string VersionName
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return versionName;
|
return versionName;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the version.
|
/// Gets or sets the version.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The version.</value>
|
/// <value>The version.</value>
|
||||||
public override VSVersion Version
|
public override VSVersion Version
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return version;
|
return version;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the name.
|
/// Gets the name.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The name.</value>
|
/// <value>The name.</value>
|
||||||
public override string Name
|
public override string Name
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override string GetToolsVersionXml(FrameworkVersion frameworkVersion)
|
protected override string GetToolsVersionXml(FrameworkVersion frameworkVersion)
|
||||||
{
|
{
|
||||||
|
@ -110,7 +110,7 @@ namespace Prebuild.Core.Targets
|
||||||
case FrameworkVersion.v4_5:
|
case FrameworkVersion.v4_5:
|
||||||
case FrameworkVersion.v4_0:
|
case FrameworkVersion.v4_0:
|
||||||
case FrameworkVersion.v3_5:
|
case FrameworkVersion.v3_5:
|
||||||
return "ToolsVersion=\"4.0\"";
|
return "ToolsVersion=\"4.0\"";
|
||||||
case FrameworkVersion.v3_0:
|
case FrameworkVersion.v3_0:
|
||||||
return "ToolsVersion=\"3.0\"";
|
return "ToolsVersion=\"3.0\"";
|
||||||
default:
|
default:
|
||||||
|
@ -123,18 +123,18 @@ namespace Prebuild.Core.Targets
|
||||||
get { return "# Visual Studio 2010"; }
|
get { return "# Visual Studio 2010"; }
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Constructors
|
#region Constructors
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of the <see cref="VS2005Target"/> class.
|
/// Initializes a new instance of the <see cref="VS2005Target"/> class.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public VS2010Target()
|
public VS2010Target()
|
||||||
: base()
|
: base()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -25,30 +25,30 @@ IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY O
|
||||||
|
|
||||||
namespace Prebuild.Core.Targets
|
namespace Prebuild.Core.Targets
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public enum VSVersion
|
public enum VSVersion
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Visual Studio 2002
|
/// Visual Studio 2002
|
||||||
/// </summary>
|
/// </summary>
|
||||||
VS70,
|
VS70,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Visual Studio 2003
|
/// Visual Studio 2003
|
||||||
/// </summary>
|
/// </summary>
|
||||||
VS71,
|
VS71,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Visual Studio 2005
|
/// Visual Studio 2005
|
||||||
/// </summary>
|
/// </summary>
|
||||||
VS80,
|
VS80,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Visual Studio 2008
|
/// Visual Studio 2008
|
||||||
/// </summary>
|
/// </summary>
|
||||||
VS90,
|
VS90,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Visual Studio 2010
|
/// Visual Studio 2010
|
||||||
/// </summary>
|
/// </summary>
|
||||||
VS10
|
VS10
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,42 +22,42 @@ using System.Runtime.Serialization;
|
||||||
|
|
||||||
namespace Prebuild.Core
|
namespace Prebuild.Core
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Serializable()]
|
[Serializable()]
|
||||||
public class UnknownLanguageException : Exception
|
public class UnknownLanguageException : Exception
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Basic exception.
|
/// Basic exception.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public UnknownLanguageException()
|
public UnknownLanguageException()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Exception with specified string
|
/// Exception with specified string
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="message">Exception message</param>
|
/// <param name="message">Exception message</param>
|
||||||
public UnknownLanguageException(string message): base(message)
|
public UnknownLanguageException(string message): base(message)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="message"></param>
|
/// <param name="message"></param>
|
||||||
/// <param name="exception"></param>
|
/// <param name="exception"></param>
|
||||||
public UnknownLanguageException(string message, Exception exception) : base(message, exception)
|
public UnknownLanguageException(string message, Exception exception) : base(message, exception)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="info"></param>
|
/// <param name="info"></param>
|
||||||
/// <param name="context"></param>
|
/// <param name="context"></param>
|
||||||
protected UnknownLanguageException(SerializationInfo info, StreamingContext context) : base( info, context )
|
protected UnknownLanguageException(SerializationInfo info, StreamingContext context) : base( info, context )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,125 +28,125 @@ using System.Collections.Generic;
|
||||||
|
|
||||||
namespace Prebuild.Core.Utilities
|
namespace Prebuild.Core.Utilities
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The CommandLine class parses and interprets the command-line arguments passed to
|
/// The CommandLine class parses and interprets the command-line arguments passed to
|
||||||
/// prebuild.
|
/// prebuild.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class CommandLineCollection : IEnumerable<KeyValuePair<string, string>>
|
public class CommandLineCollection : IEnumerable<KeyValuePair<string, string>>
|
||||||
{
|
{
|
||||||
#region Fields
|
#region Fields
|
||||||
|
|
||||||
// The raw OS arguments
|
// The raw OS arguments
|
||||||
private readonly string[] m_RawArgs;
|
private readonly string[] m_RawArgs;
|
||||||
|
|
||||||
// Command-line argument storage
|
// Command-line argument storage
|
||||||
private readonly Dictionary<string, string> m_Arguments = new Dictionary<string, string>();
|
private readonly Dictionary<string, string> m_Arguments = new Dictionary<string, string>();
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Constructors
|
#region Constructors
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Create a new CommandLine instance and set some internal variables.
|
/// Create a new CommandLine instance and set some internal variables.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public CommandLineCollection(string[] args)
|
public CommandLineCollection(string[] args)
|
||||||
{
|
{
|
||||||
m_RawArgs = args;
|
m_RawArgs = args;
|
||||||
|
|
||||||
Parse();
|
Parse();
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Private Methods
|
#region Private Methods
|
||||||
|
|
||||||
private void Parse()
|
private void Parse()
|
||||||
{
|
{
|
||||||
if(m_RawArgs.Length < 1)
|
if(m_RawArgs.Length < 1)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
int idx = 0;
|
int idx = 0;
|
||||||
string lastArg = null;
|
string lastArg = null;
|
||||||
|
|
||||||
while(idx <m_RawArgs.Length)
|
while(idx <m_RawArgs.Length)
|
||||||
{
|
{
|
||||||
string arg = m_RawArgs[idx];
|
string arg = m_RawArgs[idx];
|
||||||
|
|
||||||
if(arg.Length > 2 && arg[0] == '/')
|
if(arg.Length > 2 && arg[0] == '/')
|
||||||
{
|
{
|
||||||
arg = arg.Substring(1);
|
arg = arg.Substring(1);
|
||||||
lastArg = arg;
|
lastArg = arg;
|
||||||
m_Arguments[arg] = "";
|
m_Arguments[arg] = "";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if(lastArg != null)
|
if(lastArg != null)
|
||||||
{
|
{
|
||||||
m_Arguments[lastArg] = arg;
|
m_Arguments[lastArg] = arg;
|
||||||
lastArg = null;
|
lastArg = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
idx++;
|
idx++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Public Methods
|
#region Public Methods
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Wases the passed.
|
/// Wases the passed.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="arg">The arg.</param>
|
/// <param name="arg">The arg.</param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public bool WasPassed(string arg)
|
public bool WasPassed(string arg)
|
||||||
{
|
{
|
||||||
return (m_Arguments.ContainsKey(arg));
|
return (m_Arguments.ContainsKey(arg));
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Properties
|
#region Properties
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the parameter associated with the command line option
|
/// Gets the parameter associated with the command line option
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <remarks>Returns null if option was not specified,
|
/// <remarks>Returns null if option was not specified,
|
||||||
/// null string if no parameter was specified, and the value if a parameter was specified</remarks>
|
/// null string if no parameter was specified, and the value if a parameter was specified</remarks>
|
||||||
public string this[string index]
|
public string this[string index]
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
if(m_Arguments.ContainsKey(index))
|
if(m_Arguments.ContainsKey(index))
|
||||||
{
|
{
|
||||||
return (m_Arguments[index]);
|
return (m_Arguments[index]);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region IEnumerable Members
|
#region IEnumerable Members
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns an enumerator that can iterate through a collection.
|
/// Returns an enumerator that can iterate through a collection.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns>
|
/// <returns>
|
||||||
/// An <see cref="T:System.Collections.IDictionaryEnumerator"/>
|
/// An <see cref="T:System.Collections.IDictionaryEnumerator"/>
|
||||||
/// that can be used to iterate through the collection.
|
/// that can be used to iterate through the collection.
|
||||||
/// </returns>
|
/// </returns>
|
||||||
public IEnumerator<KeyValuePair<string, string>> GetEnumerator()
|
public IEnumerator<KeyValuePair<string, string>> GetEnumerator()
|
||||||
{
|
{
|
||||||
return m_Arguments.GetEnumerator();
|
return m_Arguments.GetEnumerator();
|
||||||
}
|
}
|
||||||
|
|
||||||
IEnumerator IEnumerable.GetEnumerator()
|
IEnumerator IEnumerable.GetEnumerator()
|
||||||
{
|
{
|
||||||
return GetEnumerator();
|
return GetEnumerator();
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,41 +28,41 @@ using System.Collections.Generic;
|
||||||
|
|
||||||
namespace Prebuild.Core.Utilities
|
namespace Prebuild.Core.Utilities
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class CurrentDirectory
|
public class CurrentDirectory
|
||||||
{
|
{
|
||||||
#region Fields
|
#region Fields
|
||||||
|
|
||||||
private readonly Stack<string> m_Stack = new Stack<string>();
|
private readonly Stack<string> m_Stack = new Stack<string>();
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Public Methods
|
#region Public Methods
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Pushes this instance.
|
/// Pushes this instance.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void Push()
|
public void Push()
|
||||||
{
|
{
|
||||||
m_Stack.Push(Environment.CurrentDirectory);
|
m_Stack.Push(Environment.CurrentDirectory);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Pops this instance.
|
/// Pops this instance.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void Pop()
|
public void Pop()
|
||||||
{
|
{
|
||||||
if(m_Stack.Count < 1)
|
if(m_Stack.Count < 1)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
string cwd = m_Stack.Pop();
|
string cwd = m_Stack.Pop();
|
||||||
Helper.SetCurrentDir(cwd);
|
Helper.SetCurrentDir(cwd);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,541 +35,541 @@ using Prebuild.Core.Nodes;
|
||||||
|
|
||||||
namespace Prebuild.Core.Utilities
|
namespace Prebuild.Core.Utilities
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class Helper
|
public class Helper
|
||||||
{
|
{
|
||||||
#region Fields
|
#region Fields
|
||||||
|
|
||||||
static bool checkForOSVariables;
|
static bool checkForOSVariables;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static bool CheckForOSVariables
|
public static bool CheckForOSVariables
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return checkForOSVariables;
|
return checkForOSVariables;
|
||||||
}
|
}
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
checkForOSVariables = value;
|
checkForOSVariables = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Public Methods
|
#region Public Methods
|
||||||
|
|
||||||
#region String Parsing
|
#region String Parsing
|
||||||
|
|
||||||
public delegate string StringLookup(string key);
|
public delegate string StringLookup(string key);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets a collection of StringLocationPair objects that represent the matches
|
/// Gets a collection of StringLocationPair objects that represent the matches
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="target">The target.</param>
|
/// <param name="target">The target.</param>
|
||||||
/// <param name="beforeGroup">The before group.</param>
|
/// <param name="beforeGroup">The before group.</param>
|
||||||
/// <param name="afterGroup">The after group.</param>
|
/// <param name="afterGroup">The after group.</param>
|
||||||
/// <param name="includeDelimitersInSubstrings">if set to <c>true</c> [include delimiters in substrings].</param>
|
/// <param name="includeDelimitersInSubstrings">if set to <c>true</c> [include delimiters in substrings].</param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public static StringCollection FindGroups(string target, string beforeGroup, string afterGroup, bool includeDelimitersInSubstrings)
|
public static StringCollection FindGroups(string target, string beforeGroup, string afterGroup, bool includeDelimitersInSubstrings)
|
||||||
{
|
{
|
||||||
if( beforeGroup == null )
|
if( beforeGroup == null )
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("beforeGroup");
|
throw new ArgumentNullException("beforeGroup");
|
||||||
}
|
}
|
||||||
if( afterGroup == null )
|
if( afterGroup == null )
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("afterGroup");
|
throw new ArgumentNullException("afterGroup");
|
||||||
}
|
}
|
||||||
StringCollection results = new StringCollection();
|
StringCollection results = new StringCollection();
|
||||||
if(target == null || target.Length == 0)
|
if(target == null || target.Length == 0)
|
||||||
{
|
{
|
||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
|
|
||||||
int beforeMod = 0;
|
int beforeMod = 0;
|
||||||
int afterMod = 0;
|
int afterMod = 0;
|
||||||
if(includeDelimitersInSubstrings)
|
if(includeDelimitersInSubstrings)
|
||||||
{
|
{
|
||||||
//be sure to not exlude the delims
|
//be sure to not exlude the delims
|
||||||
beforeMod = beforeGroup.Length;
|
beforeMod = beforeGroup.Length;
|
||||||
afterMod = afterGroup.Length;
|
afterMod = afterGroup.Length;
|
||||||
}
|
}
|
||||||
int startIndex = 0;
|
int startIndex = 0;
|
||||||
while((startIndex = target.IndexOf(beforeGroup,startIndex)) != -1) {
|
while((startIndex = target.IndexOf(beforeGroup,startIndex)) != -1) {
|
||||||
int endIndex = target.IndexOf(afterGroup,startIndex);//the index of the char after it
|
int endIndex = target.IndexOf(afterGroup,startIndex);//the index of the char after it
|
||||||
if(endIndex == -1)
|
if(endIndex == -1)
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
int length = endIndex - startIndex - beforeGroup.Length;//move to the first char in the string
|
int length = endIndex - startIndex - beforeGroup.Length;//move to the first char in the string
|
||||||
string substring = substring = target.Substring(startIndex + beforeGroup.Length - beforeMod,
|
string substring = substring = target.Substring(startIndex + beforeGroup.Length - beforeMod,
|
||||||
length - afterMod);
|
length - afterMod);
|
||||||
|
|
||||||
results.Add(substring);
|
results.Add(substring);
|
||||||
//results.Add(new StringLocationPair(substring,startIndex));
|
//results.Add(new StringLocationPair(substring,startIndex));
|
||||||
startIndex = endIndex + 1;
|
startIndex = endIndex + 1;
|
||||||
//the Interpolate*() methods will not work if expressions are expandded inside expression due to an optimization
|
//the Interpolate*() methods will not work if expressions are expandded inside expression due to an optimization
|
||||||
//so start after endIndex
|
//so start after endIndex
|
||||||
|
|
||||||
}
|
}
|
||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Replaces the groups.
|
/// Replaces the groups.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="target">The target.</param>
|
/// <param name="target">The target.</param>
|
||||||
/// <param name="beforeGroup">The before group.</param>
|
/// <param name="beforeGroup">The before group.</param>
|
||||||
/// <param name="afterGroup">The after group.</param>
|
/// <param name="afterGroup">The after group.</param>
|
||||||
/// <param name="lookup">The lookup.</param>
|
/// <param name="lookup">The lookup.</param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public static string ReplaceGroups(string target, string beforeGroup, string afterGroup, StringLookup lookup) {
|
public static string ReplaceGroups(string target, string beforeGroup, string afterGroup, StringLookup lookup) {
|
||||||
if( target == null )
|
if( target == null )
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("target");
|
throw new ArgumentNullException("target");
|
||||||
}
|
}
|
||||||
//int targetLength = target.Length;
|
//int targetLength = target.Length;
|
||||||
StringCollection strings = FindGroups(target,beforeGroup,afterGroup,false);
|
StringCollection strings = FindGroups(target,beforeGroup,afterGroup,false);
|
||||||
if( lookup == null )
|
if( lookup == null )
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("lookup");
|
throw new ArgumentNullException("lookup");
|
||||||
}
|
}
|
||||||
foreach(string substring in strings)
|
foreach(string substring in strings)
|
||||||
{
|
{
|
||||||
target = target.Replace(beforeGroup + substring + afterGroup, lookup(substring) );
|
target = target.Replace(beforeGroup + substring + afterGroup, lookup(substring) );
|
||||||
}
|
}
|
||||||
return target;
|
return target;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Replaces ${var} statements in a string with the corresonding values as detirmined by the lookup delegate
|
/// Replaces ${var} statements in a string with the corresonding values as detirmined by the lookup delegate
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="target">The target.</param>
|
/// <param name="target">The target.</param>
|
||||||
/// <param name="lookup">The lookup.</param>
|
/// <param name="lookup">The lookup.</param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public static string InterpolateForVariables(string target, StringLookup lookup)
|
public static string InterpolateForVariables(string target, StringLookup lookup)
|
||||||
{
|
{
|
||||||
return ReplaceGroups(target, "${" , "}" , lookup);
|
return ReplaceGroups(target, "${" , "}" , lookup);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Replaces ${var} statements in a string with the corresonding environment variable with name var
|
/// Replaces ${var} statements in a string with the corresonding environment variable with name var
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="target"></param>
|
/// <param name="target"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public static string InterpolateForEnvironmentVariables(string target)
|
public static string InterpolateForEnvironmentVariables(string target)
|
||||||
{
|
{
|
||||||
return InterpolateForVariables(target, new StringLookup(Environment.GetEnvironmentVariable));
|
return InterpolateForVariables(target, new StringLookup(Environment.GetEnvironmentVariable));
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Translates the value.
|
/// Translates the value.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="translateType">Type of the translate.</param>
|
/// <param name="translateType">Type of the translate.</param>
|
||||||
/// <param name="translationItem">The translation item.</param>
|
/// <param name="translationItem">The translation item.</param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public static object TranslateValue(Type translateType, string translationItem)
|
public static object TranslateValue(Type translateType, string translationItem)
|
||||||
{
|
{
|
||||||
if(translationItem == null)
|
if(translationItem == null)
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
string lowerVal = translationItem.ToLower();
|
string lowerVal = translationItem.ToLower();
|
||||||
if(translateType == typeof(bool))
|
if(translateType == typeof(bool))
|
||||||
{
|
{
|
||||||
return (lowerVal == "true" || lowerVal == "1" || lowerVal == "y" || lowerVal == "yes" || lowerVal == "on");
|
return (lowerVal == "true" || lowerVal == "1" || lowerVal == "y" || lowerVal == "yes" || lowerVal == "on");
|
||||||
}
|
}
|
||||||
else if(translateType == typeof(int))
|
else if(translateType == typeof(int))
|
||||||
{
|
{
|
||||||
return (Int32.Parse(translationItem));
|
return (Int32.Parse(translationItem));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return translationItem;
|
return translationItem;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch(FormatException)
|
catch(FormatException)
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Deletes if exists.
|
/// Deletes if exists.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="file">The file.</param>
|
/// <param name="file">The file.</param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public static bool DeleteIfExists(string file)
|
public static bool DeleteIfExists(string file)
|
||||||
{
|
{
|
||||||
string resFile = null;
|
string resFile = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
resFile = ResolvePath(file);
|
resFile = ResolvePath(file);
|
||||||
}
|
}
|
||||||
catch(ArgumentException)
|
catch(ArgumentException)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!File.Exists(resFile))
|
if(!File.Exists(resFile))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
File.Delete(resFile);
|
File.Delete(resFile);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static readonly char seperator = Path.DirectorySeparatorChar;
|
static readonly char seperator = Path.DirectorySeparatorChar;
|
||||||
|
|
||||||
// This little gem was taken from the NeL source, thanks guys!
|
// This little gem was taken from the NeL source, thanks guys!
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Makes a relative path
|
/// Makes a relative path
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="startPath">Path to start from</param>
|
/// <param name="startPath">Path to start from</param>
|
||||||
/// <param name="endPath">Path to end at</param>
|
/// <param name="endPath">Path to end at</param>
|
||||||
/// <returns>Path that will get from startPath to endPath</returns>
|
/// <returns>Path that will get from startPath to endPath</returns>
|
||||||
public static string MakePathRelativeTo(string startPath, string endPath)
|
public static string MakePathRelativeTo(string startPath, string endPath)
|
||||||
{
|
{
|
||||||
string tmp = NormalizePath(startPath, seperator);
|
string tmp = NormalizePath(startPath, seperator);
|
||||||
string src = NormalizePath(endPath, seperator);
|
string src = NormalizePath(endPath, seperator);
|
||||||
string prefix = "";
|
string prefix = "";
|
||||||
|
|
||||||
while(true)
|
while(true)
|
||||||
{
|
{
|
||||||
if((String.Compare(tmp, 0, src, 0, tmp.Length) == 0))
|
if((String.Compare(tmp, 0, src, 0, tmp.Length) == 0))
|
||||||
{
|
{
|
||||||
string ret;
|
string ret;
|
||||||
int size = tmp.Length;
|
int size = tmp.Length;
|
||||||
if(size == src.Length)
|
if(size == src.Length)
|
||||||
{
|
{
|
||||||
return "./";
|
return "./";
|
||||||
}
|
}
|
||||||
if((src.Length > tmp.Length) && src[tmp.Length - 1] != seperator)
|
if((src.Length > tmp.Length) && src[tmp.Length - 1] != seperator)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ret = prefix + endPath.Substring(size, endPath.Length - size);
|
ret = prefix + endPath.Substring(size, endPath.Length - size);
|
||||||
ret = ret.Trim();
|
ret = ret.Trim();
|
||||||
if(ret[0] == seperator)
|
if(ret[0] == seperator)
|
||||||
{
|
{
|
||||||
ret = "." + ret;
|
ret = "." + ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
return NormalizePath(ret);
|
return NormalizePath(ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(tmp.Length < 2)
|
if(tmp.Length < 2)
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
int lastPos = tmp.LastIndexOf(seperator, tmp.Length - 2);
|
int lastPos = tmp.LastIndexOf(seperator, tmp.Length - 2);
|
||||||
int prevPos = tmp.IndexOf(seperator);
|
int prevPos = tmp.IndexOf(seperator);
|
||||||
|
|
||||||
if((lastPos == prevPos) || (lastPos == -1))
|
if((lastPos == prevPos) || (lastPos == -1))
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
tmp = tmp.Substring(0, lastPos + 1);
|
tmp = tmp.Substring(0, lastPos + 1);
|
||||||
prefix += ".." + seperator.ToString();
|
prefix += ".." + seperator.ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
return endPath;
|
return endPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Resolves the path.
|
/// Resolves the path.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="path">The path.</param>
|
/// <param name="path">The path.</param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public static string ResolvePath(string path)
|
public static string ResolvePath(string path)
|
||||||
{
|
{
|
||||||
string tmpPath = NormalizePath(path);
|
string tmpPath = NormalizePath(path);
|
||||||
if(tmpPath.Length < 1)
|
if(tmpPath.Length < 1)
|
||||||
{
|
{
|
||||||
tmpPath = ".";
|
tmpPath = ".";
|
||||||
}
|
}
|
||||||
|
|
||||||
tmpPath = Path.GetFullPath(tmpPath);
|
tmpPath = Path.GetFullPath(tmpPath);
|
||||||
if(!File.Exists(tmpPath) && !Directory.Exists(tmpPath))
|
if(!File.Exists(tmpPath) && !Directory.Exists(tmpPath))
|
||||||
{
|
{
|
||||||
throw new ArgumentException("Path could not be resolved: " + tmpPath);
|
throw new ArgumentException("Path could not be resolved: " + tmpPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
return tmpPath;
|
return tmpPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Normalizes the path.
|
/// Normalizes the path.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="path">The path.</param>
|
/// <param name="path">The path.</param>
|
||||||
/// <param name="separatorCharacter">The separator character.</param>
|
/// <param name="separatorCharacter">The separator character.</param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public static string NormalizePath(string path, char separatorCharacter)
|
public static string NormalizePath(string path, char separatorCharacter)
|
||||||
{
|
{
|
||||||
if(path == null || path == "" || path.Length < 1)
|
if(path == null || path == "" || path.Length < 1)
|
||||||
{
|
{
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
string tmpPath = path.Replace('\\', '/');
|
string tmpPath = path.Replace('\\', '/');
|
||||||
tmpPath = tmpPath.Replace('/', separatorCharacter);
|
tmpPath = tmpPath.Replace('/', separatorCharacter);
|
||||||
return tmpPath;
|
return tmpPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Normalizes the path.
|
/// Normalizes the path.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="path">The path.</param>
|
/// <param name="path">The path.</param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public static string NormalizePath(string path)
|
public static string NormalizePath(string path)
|
||||||
{
|
{
|
||||||
return NormalizePath(path, Path.DirectorySeparatorChar);
|
return NormalizePath(path, Path.DirectorySeparatorChar);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Ends the path.
|
/// Ends the path.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="path">The path.</param>
|
/// <param name="path">The path.</param>
|
||||||
/// <param name="separatorCharacter">The separator character.</param>
|
/// <param name="separatorCharacter">The separator character.</param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public static string EndPath(string path, char separatorCharacter)
|
public static string EndPath(string path, char separatorCharacter)
|
||||||
{
|
{
|
||||||
if(path == null || path == "" || path.Length < 1)
|
if(path == null || path == "" || path.Length < 1)
|
||||||
{
|
{
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!path.EndsWith(separatorCharacter.ToString()))
|
if(!path.EndsWith(separatorCharacter.ToString()))
|
||||||
{
|
{
|
||||||
return (path + separatorCharacter);
|
return (path + separatorCharacter);
|
||||||
}
|
}
|
||||||
|
|
||||||
return path;
|
return path;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Ends the path.
|
/// Ends the path.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="path">The path.</param>
|
/// <param name="path">The path.</param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public static string EndPath(string path)
|
public static string EndPath(string path)
|
||||||
{
|
{
|
||||||
return EndPath(path, Path.DirectorySeparatorChar);
|
return EndPath(path, Path.DirectorySeparatorChar);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Makes the file path.
|
/// Makes the file path.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="path">The path.</param>
|
/// <param name="path">The path.</param>
|
||||||
/// <param name="name">The name.</param>
|
/// <param name="name">The name.</param>
|
||||||
/// <param name="ext">The ext.</param>
|
/// <param name="ext">The ext.</param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public static string MakeFilePath(string path, string name, string ext)
|
public static string MakeFilePath(string path, string name, string ext)
|
||||||
{
|
{
|
||||||
string ret = EndPath(NormalizePath(path));
|
string ret = EndPath(NormalizePath(path));
|
||||||
|
|
||||||
if( name == null )
|
if( name == null )
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("name");
|
throw new ArgumentNullException("name");
|
||||||
}
|
}
|
||||||
|
|
||||||
ret += name;
|
ret += name;
|
||||||
if(!name.EndsWith("." + ext))
|
if(!name.EndsWith("." + ext))
|
||||||
{
|
{
|
||||||
ret += "." + ext;
|
ret += "." + ext;
|
||||||
}
|
}
|
||||||
|
|
||||||
//foreach(char c in Path.GetInvalidPathChars())
|
//foreach(char c in Path.GetInvalidPathChars())
|
||||||
//{
|
//{
|
||||||
// ret = ret.Replace(c, '_');
|
// ret = ret.Replace(c, '_');
|
||||||
//}
|
//}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Makes the file path.
|
/// Makes the file path.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="path">The path.</param>
|
/// <param name="path">The path.</param>
|
||||||
/// <param name="name">The name.</param>
|
/// <param name="name">The name.</param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public static string MakeFilePath(string path, string name)
|
public static string MakeFilePath(string path, string name)
|
||||||
{
|
{
|
||||||
string ret = EndPath(NormalizePath(path));
|
string ret = EndPath(NormalizePath(path));
|
||||||
|
|
||||||
if( name == null )
|
if( name == null )
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("name");
|
throw new ArgumentNullException("name");
|
||||||
}
|
}
|
||||||
|
|
||||||
ret += name;
|
ret += name;
|
||||||
|
|
||||||
//foreach (char c in Path.GetInvalidPathChars())
|
//foreach (char c in Path.GetInvalidPathChars())
|
||||||
//{
|
//{
|
||||||
// ret = ret.Replace(c, '_');
|
// ret = ret.Replace(c, '_');
|
||||||
//}
|
//}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="path"></param>
|
/// <param name="path"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public static string MakeReferencePath(string path)
|
public static string MakeReferencePath(string path)
|
||||||
{
|
{
|
||||||
string ret = EndPath(NormalizePath(path));
|
string ret = EndPath(NormalizePath(path));
|
||||||
|
|
||||||
//foreach (char c in Path.GetInvalidPathChars())
|
//foreach (char c in Path.GetInvalidPathChars())
|
||||||
//{
|
//{
|
||||||
// ret = ret.Replace(c, '_');
|
// ret = ret.Replace(c, '_');
|
||||||
//}
|
//}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Sets the current dir.
|
/// Sets the current dir.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="path">The path.</param>
|
/// <param name="path">The path.</param>
|
||||||
public static void SetCurrentDir(string path)
|
public static void SetCurrentDir(string path)
|
||||||
{
|
{
|
||||||
if( path == null )
|
if( path == null )
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("path");
|
throw new ArgumentNullException("path");
|
||||||
}
|
}
|
||||||
if(path.Length < 1)
|
if(path.Length < 1)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Environment.CurrentDirectory = path;
|
Environment.CurrentDirectory = path;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Checks the type.
|
/// Checks the type.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="typeToCheck">The type to check.</param>
|
/// <param name="typeToCheck">The type to check.</param>
|
||||||
/// <param name="attr">The attr.</param>
|
/// <param name="attr">The attr.</param>
|
||||||
/// <param name="inter">The inter.</param>
|
/// <param name="inter">The inter.</param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public static object CheckType(Type typeToCheck, Type attr, Type inter)
|
public static object CheckType(Type typeToCheck, Type attr, Type inter)
|
||||||
{
|
{
|
||||||
if(typeToCheck == null || attr == null)
|
if(typeToCheck == null || attr == null)
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
object[] attrs = typeToCheck.GetCustomAttributes(attr, false);
|
object[] attrs = typeToCheck.GetCustomAttributes(attr, false);
|
||||||
if(attrs == null || attrs.Length < 1)
|
if(attrs == null || attrs.Length < 1)
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
if( inter == null )
|
if( inter == null )
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("inter");
|
throw new ArgumentNullException("inter");
|
||||||
}
|
}
|
||||||
|
|
||||||
if(typeToCheck.GetInterface(inter.FullName) == null)
|
if(typeToCheck.GetInterface(inter.FullName) == null)
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
return attrs[0];
|
return attrs[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Attributes the value.
|
/// Attributes the value.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="node">The node.</param>
|
/// <param name="node">The node.</param>
|
||||||
/// <param name="attr">The attr.</param>
|
/// <param name="attr">The attr.</param>
|
||||||
/// <param name="def">The def.</param>
|
/// <param name="def">The def.</param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public static string AttributeValue(XmlNode node, string attr, string def)
|
public static string AttributeValue(XmlNode node, string attr, string def)
|
||||||
{
|
{
|
||||||
if( node == null )
|
if( node == null )
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("node");
|
throw new ArgumentNullException("node");
|
||||||
}
|
}
|
||||||
if(node.Attributes[attr] == null)
|
if(node.Attributes[attr] == null)
|
||||||
{
|
{
|
||||||
return def;
|
return def;
|
||||||
}
|
}
|
||||||
string val = node.Attributes[attr].Value;
|
string val = node.Attributes[attr].Value;
|
||||||
if(!CheckForOSVariables)
|
if(!CheckForOSVariables)
|
||||||
{
|
{
|
||||||
return val;
|
return val;
|
||||||
}
|
}
|
||||||
|
|
||||||
return InterpolateForEnvironmentVariables(val);
|
return InterpolateForEnvironmentVariables(val);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Parses the boolean.
|
/// Parses the boolean.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="node">The node.</param>
|
/// <param name="node">The node.</param>
|
||||||
/// <param name="attr">The attr.</param>
|
/// <param name="attr">The attr.</param>
|
||||||
/// <param name="defaultValue">if set to <c>true</c> [default value].</param>
|
/// <param name="defaultValue">if set to <c>true</c> [default value].</param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public static bool ParseBoolean(XmlNode node, string attr, bool defaultValue)
|
public static bool ParseBoolean(XmlNode node, string attr, bool defaultValue)
|
||||||
{
|
{
|
||||||
if( node == null )
|
if( node == null )
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("node");
|
throw new ArgumentNullException("node");
|
||||||
}
|
}
|
||||||
if(node.Attributes[attr] == null)
|
if(node.Attributes[attr] == null)
|
||||||
{
|
{
|
||||||
return defaultValue;
|
return defaultValue;
|
||||||
}
|
}
|
||||||
return bool.Parse(node.Attributes[attr].Value);
|
return bool.Parse(node.Attributes[attr].Value);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Enums the attribute value.
|
/// Enums the attribute value.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="node">The node.</param>
|
/// <param name="node">The node.</param>
|
||||||
/// <param name="attr">The attr.</param>
|
/// <param name="attr">The attr.</param>
|
||||||
/// <param name="enumType">Type of the enum.</param>
|
/// <param name="enumType">Type of the enum.</param>
|
||||||
/// <param name="def">The def.</param>
|
/// <param name="def">The def.</param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public static object EnumAttributeValue(XmlNode node, string attr, Type enumType, object def)
|
public static object EnumAttributeValue(XmlNode node, string attr, Type enumType, object def)
|
||||||
{
|
{
|
||||||
if( def == null )
|
if( def == null )
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("def");
|
throw new ArgumentNullException("def");
|
||||||
}
|
}
|
||||||
string val = AttributeValue(node, attr, def.ToString());
|
string val = AttributeValue(node, attr, def.ToString());
|
||||||
return Enum.Parse(enumType, val, true);
|
return Enum.Parse(enumType, val, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="assemblyName"></param>
|
/// <param name="assemblyName"></param>
|
||||||
/// <param name="projectType"></param>
|
/// <param name="projectType"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public static string AssemblyFullName(string assemblyName, ProjectType projectType)
|
public static string AssemblyFullName(string assemblyName, ProjectType projectType)
|
||||||
{
|
{
|
||||||
return assemblyName + (projectType == ProjectType.Library ? ".dll" : ".exe");
|
return assemblyName + (projectType == ProjectType.Library ? ".dll" : ".exe");
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,74 +28,74 @@ using System.IO;
|
||||||
|
|
||||||
namespace Prebuild.Core.Utilities
|
namespace Prebuild.Core.Utilities
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public enum LogType
|
public enum LogType
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
None,
|
None,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Info,
|
Info,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Warning,
|
Warning,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Error
|
Error
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Flags]
|
[Flags]
|
||||||
public enum LogTargets
|
public enum LogTargets
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
None = 0,
|
None = 0,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Null = 1,
|
Null = 1,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
File = 2,
|
File = 2,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Console = 4
|
Console = 4
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Summary description for Log.
|
/// Summary description for Log.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class Log : IDisposable
|
public class Log : IDisposable
|
||||||
{
|
{
|
||||||
#region Fields
|
#region Fields
|
||||||
|
|
||||||
private TextWriter m_Writer;
|
private TextWriter m_Writer;
|
||||||
private LogTargets m_Target = LogTargets.Null;
|
private LogTargets m_Target = LogTargets.Null;
|
||||||
bool disposed;
|
bool disposed;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Constructors
|
#region Constructors
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of the <see cref="Log"/> class.
|
/// Initializes a new instance of the <see cref="Log"/> class.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="target">The target.</param>
|
/// <param name="target">The target.</param>
|
||||||
/// <param name="fileName">Name of the file.</param>
|
/// <param name="fileName">Name of the file.</param>
|
||||||
public Log(LogTargets target, string fileName)
|
public Log(LogTargets target, string fileName)
|
||||||
{
|
{
|
||||||
m_Target = target;
|
m_Target = target;
|
||||||
|
|
||||||
|
@ -111,166 +111,166 @@ namespace Prebuild.Core.Utilities
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Public Methods
|
#region Public Methods
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Writes this instance.
|
/// Writes this instance.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void Write()
|
public void Write()
|
||||||
{
|
{
|
||||||
Write(string.Empty);
|
Write(string.Empty);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Writes the specified MSG.
|
/// Writes the specified MSG.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="msg">The MSG.</param>
|
/// <param name="msg">The MSG.</param>
|
||||||
public void Write(string msg)
|
public void Write(string msg)
|
||||||
{
|
{
|
||||||
if((m_Target & LogTargets.Null) != 0)
|
if((m_Target & LogTargets.Null) != 0)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if((m_Target & LogTargets.Console) != 0)
|
if((m_Target & LogTargets.Console) != 0)
|
||||||
{
|
{
|
||||||
Console.WriteLine(msg);
|
Console.WriteLine(msg);
|
||||||
}
|
}
|
||||||
if((m_Target & LogTargets.File) != 0 && m_Writer != null)
|
if((m_Target & LogTargets.File) != 0 && m_Writer != null)
|
||||||
{
|
{
|
||||||
m_Writer.WriteLine(msg);
|
m_Writer.WriteLine(msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Writes the specified format.
|
/// Writes the specified format.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="format">The format.</param>
|
/// <param name="format">The format.</param>
|
||||||
/// <param name="args">The args.</param>
|
/// <param name="args">The args.</param>
|
||||||
public void Write(string format, params object[] args)
|
public void Write(string format, params object[] args)
|
||||||
{
|
{
|
||||||
Write(string.Format(format,args));
|
Write(string.Format(format,args));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Writes the specified type.
|
/// Writes the specified type.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="type">The type.</param>
|
/// <param name="type">The type.</param>
|
||||||
/// <param name="format">The format.</param>
|
/// <param name="format">The format.</param>
|
||||||
/// <param name="args">The args.</param>
|
/// <param name="args">The args.</param>
|
||||||
public void Write(LogType type, string format, params object[] args)
|
public void Write(LogType type, string format, params object[] args)
|
||||||
{
|
{
|
||||||
if((m_Target & LogTargets.Null) != 0)
|
if((m_Target & LogTargets.Null) != 0)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
string str = "";
|
string str = "";
|
||||||
switch(type)
|
switch(type)
|
||||||
{
|
{
|
||||||
case LogType.Info:
|
case LogType.Info:
|
||||||
str = "[I] ";
|
str = "[I] ";
|
||||||
break;
|
break;
|
||||||
case LogType.Warning:
|
case LogType.Warning:
|
||||||
str = "[!] ";
|
str = "[!] ";
|
||||||
break;
|
break;
|
||||||
case LogType.Error:
|
case LogType.Error:
|
||||||
str = "[X] ";
|
str = "[X] ";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
Write(str + format,args);
|
Write(str + format,args);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Writes the exception.
|
/// Writes the exception.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="type">The type.</param>
|
/// <param name="type">The type.</param>
|
||||||
/// <param name="ex">The ex.</param>
|
/// <param name="ex">The ex.</param>
|
||||||
public void WriteException(LogType type, Exception ex)
|
public void WriteException(LogType type, Exception ex)
|
||||||
{
|
{
|
||||||
if(ex != null)
|
if(ex != null)
|
||||||
{
|
{
|
||||||
Write(type, ex.Message);
|
Write(type, ex.Message);
|
||||||
//#if DEBUG
|
//#if DEBUG
|
||||||
m_Writer.WriteLine("Exception @{0} stack trace [[", ex.TargetSite.Name);
|
m_Writer.WriteLine("Exception @{0} stack trace [[", ex.TargetSite.Name);
|
||||||
m_Writer.WriteLine(ex.StackTrace);
|
m_Writer.WriteLine(ex.StackTrace);
|
||||||
m_Writer.WriteLine("]]");
|
m_Writer.WriteLine("]]");
|
||||||
//#endif
|
//#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Flushes this instance.
|
/// Flushes this instance.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void Flush()
|
public void Flush()
|
||||||
{
|
{
|
||||||
if(m_Writer != null)
|
if(m_Writer != null)
|
||||||
{
|
{
|
||||||
m_Writer.Flush();
|
m_Writer.Flush();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region IDisposable Members
|
#region IDisposable Members
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Performs application-defined tasks associated with freeing, releasing, or
|
/// Performs application-defined tasks associated with freeing, releasing, or
|
||||||
/// resetting unmanaged resources.
|
/// resetting unmanaged resources.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
Dispose(true);
|
Dispose(true);
|
||||||
GC.SuppressFinalize(this);
|
GC.SuppressFinalize(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Dispose objects
|
/// Dispose objects
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="disposing">
|
/// <param name="disposing">
|
||||||
/// If true, it will dispose close the handle
|
/// If true, it will dispose close the handle
|
||||||
/// </param>
|
/// </param>
|
||||||
/// <remarks>
|
/// <remarks>
|
||||||
/// Will dispose managed and unmanaged resources.
|
/// Will dispose managed and unmanaged resources.
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
protected virtual void Dispose(bool disposing)
|
protected virtual void Dispose(bool disposing)
|
||||||
{
|
{
|
||||||
if (!this.disposed)
|
if (!this.disposed)
|
||||||
{
|
{
|
||||||
if (disposing)
|
if (disposing)
|
||||||
{
|
{
|
||||||
if (m_Writer != null)
|
if (m_Writer != null)
|
||||||
{
|
{
|
||||||
m_Writer.Close();
|
m_Writer.Close();
|
||||||
m_Writer = null;
|
m_Writer = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.disposed = true;
|
this.disposed = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
~Log()
|
~Log()
|
||||||
{
|
{
|
||||||
this.Dispose(false);
|
this.Dispose(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Closes and destroys this object
|
/// Closes and destroys this object
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <remarks>
|
/// <remarks>
|
||||||
/// Same as Dispose(true)
|
/// Same as Dispose(true)
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
public void Close()
|
public void Close()
|
||||||
{
|
{
|
||||||
Dispose();
|
Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,57 +28,57 @@ using System.Runtime.Serialization;
|
||||||
|
|
||||||
namespace Prebuild.Core
|
namespace Prebuild.Core
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Serializable]
|
[Serializable]
|
||||||
public class WarningException : Exception
|
public class WarningException : Exception
|
||||||
{
|
{
|
||||||
#region Constructors
|
#region Constructors
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public WarningException()
|
public WarningException()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="format"></param>
|
/// <param name="format"></param>
|
||||||
/// <param name="args"></param>
|
/// <param name="args"></param>
|
||||||
public WarningException(string format, params object[] args)
|
public WarningException(string format, params object[] args)
|
||||||
: base(String.Format(format, args))
|
: base(String.Format(format, args))
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Exception with specified string
|
/// Exception with specified string
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="message">Exception message</param>
|
/// <param name="message">Exception message</param>
|
||||||
public WarningException(string message): base(message)
|
public WarningException(string message): base(message)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="message"></param>
|
/// <param name="message"></param>
|
||||||
/// <param name="exception"></param>
|
/// <param name="exception"></param>
|
||||||
public WarningException(string message, Exception exception) : base(message, exception)
|
public WarningException(string message, Exception exception) : base(message, exception)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="info"></param>
|
/// <param name="info"></param>
|
||||||
/// <param name="context"></param>
|
/// <param name="context"></param>
|
||||||
protected WarningException(SerializationInfo info, StreamingContext context) : base( info, context )
|
protected WarningException(SerializationInfo info, StreamingContext context) : base( info, context )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,48 +44,48 @@ using Prebuild.Core.Utilities;
|
||||||
|
|
||||||
namespace Prebuild
|
namespace Prebuild
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
class Prebuild
|
class Prebuild
|
||||||
{
|
{
|
||||||
#region Main
|
#region Main
|
||||||
|
|
||||||
[STAThread]
|
[STAThread]
|
||||||
static void Main(string[] args)
|
static void Main(string[] args)
|
||||||
{
|
{
|
||||||
Kernel kernel = null;
|
Kernel kernel = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
kernel = Kernel.Instance;
|
kernel = Kernel.Instance;
|
||||||
kernel.Initialize(LogTargets.File | LogTargets.Console, args);
|
kernel.Initialize(LogTargets.File | LogTargets.Console, args);
|
||||||
bool exit = false;
|
bool exit = false;
|
||||||
|
|
||||||
if(kernel.CommandLine.WasPassed("usage"))
|
if(kernel.CommandLine.WasPassed("usage"))
|
||||||
{
|
{
|
||||||
exit = true;
|
exit = true;
|
||||||
OutputUsage();
|
OutputUsage();
|
||||||
}
|
}
|
||||||
if(kernel.CommandLine.WasPassed("showtargets"))
|
if(kernel.CommandLine.WasPassed("showtargets"))
|
||||||
{
|
{
|
||||||
exit = true;
|
exit = true;
|
||||||
OutputTargets(kernel);
|
OutputTargets(kernel);
|
||||||
}
|
}
|
||||||
if(kernel.CommandLine.WasPassed("install"))
|
if(kernel.CommandLine.WasPassed("install"))
|
||||||
{
|
{
|
||||||
exit = true;
|
exit = true;
|
||||||
InstallAssembly(kernel);
|
InstallAssembly(kernel);
|
||||||
}
|
}
|
||||||
if(kernel.CommandLine.WasPassed("remove"))
|
if(kernel.CommandLine.WasPassed("remove"))
|
||||||
{
|
{
|
||||||
exit = true;
|
exit = true;
|
||||||
RemoveAssembly(kernel);
|
RemoveAssembly(kernel);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!exit)
|
if(!exit)
|
||||||
{
|
{
|
||||||
kernel.Process();
|
kernel.Process();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#if !DEBUG
|
#if !DEBUG
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
|
@ -96,70 +96,70 @@ namespace Prebuild
|
||||||
#endif
|
#endif
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
if(kernel != null && kernel.PauseAfterFinish)
|
if(kernel != null && kernel.PauseAfterFinish)
|
||||||
{
|
{
|
||||||
Console.WriteLine("\nPress enter to continue...");
|
Console.WriteLine("\nPress enter to continue...");
|
||||||
Console.ReadLine();
|
Console.ReadLine();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Private Methods
|
#region Private Methods
|
||||||
|
|
||||||
private static void InstallAssembly(Kernel kernel)
|
private static void InstallAssembly(Kernel kernel)
|
||||||
{
|
{
|
||||||
Publish publish = new Publish();
|
Publish publish = new Publish();
|
||||||
string file = kernel.CommandLine["install"];
|
string file = kernel.CommandLine["install"];
|
||||||
//Console.WriteLine(".."+file+"..");
|
//Console.WriteLine(".."+file+"..");
|
||||||
publish.GacInstall(file);
|
publish.GacInstall(file);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void RemoveAssembly(Kernel kernel)
|
private static void RemoveAssembly(Kernel kernel)
|
||||||
{
|
{
|
||||||
Publish publish = new Publish();
|
Publish publish = new Publish();
|
||||||
string file = kernel.CommandLine["remove"];
|
string file = kernel.CommandLine["remove"];
|
||||||
publish.GacRemove(file);
|
publish.GacRemove(file);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void OutputUsage()
|
private static void OutputUsage()
|
||||||
{
|
{
|
||||||
Console.WriteLine("Usage: prebuild /target <target> [options]");
|
Console.WriteLine("Usage: prebuild /target <target> [options]");
|
||||||
Console.WriteLine("Available command-line switches:");
|
Console.WriteLine("Available command-line switches:");
|
||||||
Console.WriteLine();
|
Console.WriteLine();
|
||||||
Console.WriteLine("/target Target for Prebuild");
|
Console.WriteLine("/target Target for Prebuild");
|
||||||
Console.WriteLine("/clean Clean the build files for the given target");
|
Console.WriteLine("/clean Clean the build files for the given target");
|
||||||
Console.WriteLine("/file XML file to process");
|
Console.WriteLine("/file XML file to process");
|
||||||
Console.WriteLine("/log Log file to write to");
|
Console.WriteLine("/log Log file to write to");
|
||||||
Console.WriteLine("/ppo Pre-process the file, but perform no other processing");
|
Console.WriteLine("/ppo Pre-process the file, but perform no other processing");
|
||||||
Console.WriteLine("/pause Pauses the application after execution to view the output");
|
Console.WriteLine("/pause Pauses the application after execution to view the output");
|
||||||
Console.WriteLine("/yes Default to yes to any questions asked");
|
Console.WriteLine("/yes Default to yes to any questions asked");
|
||||||
Console.WriteLine("/install Install assembly into the GAC");
|
Console.WriteLine("/install Install assembly into the GAC");
|
||||||
Console.WriteLine("/remove Remove assembly from the GAC");
|
Console.WriteLine("/remove Remove assembly from the GAC");
|
||||||
Console.WriteLine();
|
Console.WriteLine();
|
||||||
Console.WriteLine("See 'prebuild /showtargets for a list of available targets");
|
Console.WriteLine("See 'prebuild /showtargets for a list of available targets");
|
||||||
Console.WriteLine("See readme.txt or check out http://dnpb.sourceforge.net for more information");
|
Console.WriteLine("See readme.txt or check out http://dnpb.sourceforge.net for more information");
|
||||||
Console.WriteLine();
|
Console.WriteLine();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void OutputTargets(Kernel kern)
|
private static void OutputTargets(Kernel kern)
|
||||||
{
|
{
|
||||||
Console.WriteLine("Targets available in Prebuild:");
|
Console.WriteLine("Targets available in Prebuild:");
|
||||||
Console.WriteLine("");
|
Console.WriteLine("");
|
||||||
if(kern.Targets.Keys.Count > 0)
|
if(kern.Targets.Keys.Count > 0)
|
||||||
{
|
{
|
||||||
string[] targs = new string[kern.Targets.Keys.Count];
|
string[] targs = new string[kern.Targets.Keys.Count];
|
||||||
kern.Targets.Keys.CopyTo(targs, 0);
|
kern.Targets.Keys.CopyTo(targs, 0);
|
||||||
Array.Sort(targs);
|
Array.Sort(targs);
|
||||||
foreach(string target in targs)
|
foreach(string target in targs)
|
||||||
{
|
{
|
||||||
Console.WriteLine(target);
|
Console.WriteLine(target);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Console.WriteLine("");
|
Console.WriteLine("");
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,125 +13,125 @@ namespace Amib.Threading.Internal
|
||||||
{
|
{
|
||||||
#region CallerThreadContext class
|
#region CallerThreadContext class
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// This class stores the caller call context in order to restore
|
/// This class stores the caller call context in order to restore
|
||||||
/// it when the work item is executed in the thread pool environment.
|
/// it when the work item is executed in the thread pool environment.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
internal class CallerThreadContext
|
internal class CallerThreadContext
|
||||||
{
|
{
|
||||||
#region Prepare reflection information
|
#region Prepare reflection information
|
||||||
|
|
||||||
// Cached type information.
|
// Cached type information.
|
||||||
private static readonly MethodInfo getLogicalCallContextMethodInfo =
|
private static readonly MethodInfo getLogicalCallContextMethodInfo =
|
||||||
typeof(Thread).GetMethod("GetLogicalCallContext", BindingFlags.Instance | BindingFlags.NonPublic);
|
typeof(Thread).GetMethod("GetLogicalCallContext", BindingFlags.Instance | BindingFlags.NonPublic);
|
||||||
|
|
||||||
private static readonly MethodInfo setLogicalCallContextMethodInfo =
|
private static readonly MethodInfo setLogicalCallContextMethodInfo =
|
||||||
typeof(Thread).GetMethod("SetLogicalCallContext", BindingFlags.Instance | BindingFlags.NonPublic);
|
typeof(Thread).GetMethod("SetLogicalCallContext", BindingFlags.Instance | BindingFlags.NonPublic);
|
||||||
|
|
||||||
private static string HttpContextSlotName = GetHttpContextSlotName();
|
private static string HttpContextSlotName = GetHttpContextSlotName();
|
||||||
|
|
||||||
private static string GetHttpContextSlotName()
|
private static string GetHttpContextSlotName()
|
||||||
{
|
{
|
||||||
FieldInfo fi = typeof(HttpContext).GetField("CallContextSlotName", BindingFlags.Static | BindingFlags.NonPublic);
|
FieldInfo fi = typeof(HttpContext).GetField("CallContextSlotName", BindingFlags.Static | BindingFlags.NonPublic);
|
||||||
|
|
||||||
if (fi != null)
|
if (fi != null)
|
||||||
{
|
{
|
||||||
return (string) fi.GetValue(null);
|
return (string) fi.GetValue(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
return "HttpContext";
|
return "HttpContext";
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Private fields
|
#region Private fields
|
||||||
|
|
||||||
private HttpContext _httpContext;
|
private HttpContext _httpContext;
|
||||||
private LogicalCallContext _callContext;
|
private LogicalCallContext _callContext;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Constructor
|
/// Constructor
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private CallerThreadContext()
|
private CallerThreadContext()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool CapturedCallContext
|
public bool CapturedCallContext
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return (null != _callContext);
|
return (null != _callContext);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool CapturedHttpContext
|
public bool CapturedHttpContext
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return (null != _httpContext);
|
return (null != _httpContext);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Captures the current thread context
|
/// Captures the current thread context
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public static CallerThreadContext Capture(
|
public static CallerThreadContext Capture(
|
||||||
bool captureCallContext,
|
bool captureCallContext,
|
||||||
bool captureHttpContext)
|
bool captureHttpContext)
|
||||||
{
|
{
|
||||||
Debug.Assert(captureCallContext || captureHttpContext);
|
Debug.Assert(captureCallContext || captureHttpContext);
|
||||||
|
|
||||||
CallerThreadContext callerThreadContext = new CallerThreadContext();
|
CallerThreadContext callerThreadContext = new CallerThreadContext();
|
||||||
|
|
||||||
// TODO: In NET 2.0, redo using the new feature of ExecutionContext class - Capture()
|
// TODO: In NET 2.0, redo using the new feature of ExecutionContext class - Capture()
|
||||||
// Capture Call Context
|
// Capture Call Context
|
||||||
if(captureCallContext && (getLogicalCallContextMethodInfo != null))
|
if(captureCallContext && (getLogicalCallContextMethodInfo != null))
|
||||||
{
|
{
|
||||||
callerThreadContext._callContext = (LogicalCallContext)getLogicalCallContextMethodInfo.Invoke(Thread.CurrentThread, null);
|
callerThreadContext._callContext = (LogicalCallContext)getLogicalCallContextMethodInfo.Invoke(Thread.CurrentThread, null);
|
||||||
if (callerThreadContext._callContext != null)
|
if (callerThreadContext._callContext != null)
|
||||||
{
|
{
|
||||||
callerThreadContext._callContext = (LogicalCallContext)callerThreadContext._callContext.Clone();
|
callerThreadContext._callContext = (LogicalCallContext)callerThreadContext._callContext.Clone();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Capture httpContext
|
// Capture httpContext
|
||||||
if (captureHttpContext && (null != HttpContext.Current))
|
if (captureHttpContext && (null != HttpContext.Current))
|
||||||
{
|
{
|
||||||
callerThreadContext._httpContext = HttpContext.Current;
|
callerThreadContext._httpContext = HttpContext.Current;
|
||||||
}
|
}
|
||||||
|
|
||||||
return callerThreadContext;
|
return callerThreadContext;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Applies the thread context stored earlier
|
/// Applies the thread context stored earlier
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="callerThreadContext"></param>
|
/// <param name="callerThreadContext"></param>
|
||||||
public static void Apply(CallerThreadContext callerThreadContext)
|
public static void Apply(CallerThreadContext callerThreadContext)
|
||||||
{
|
{
|
||||||
if (null == callerThreadContext)
|
if (null == callerThreadContext)
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("callerThreadContext");
|
throw new ArgumentNullException("callerThreadContext");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Todo: In NET 2.0, redo using the new feature of ExecutionContext class - Run()
|
// Todo: In NET 2.0, redo using the new feature of ExecutionContext class - Run()
|
||||||
// Restore call context
|
// Restore call context
|
||||||
if ((callerThreadContext._callContext != null) && (setLogicalCallContextMethodInfo != null))
|
if ((callerThreadContext._callContext != null) && (setLogicalCallContextMethodInfo != null))
|
||||||
{
|
{
|
||||||
setLogicalCallContextMethodInfo.Invoke(Thread.CurrentThread, new object[] { callerThreadContext._callContext });
|
setLogicalCallContextMethodInfo.Invoke(Thread.CurrentThread, new object[] { callerThreadContext._callContext });
|
||||||
}
|
}
|
||||||
|
|
||||||
// Restore HttpContext
|
// Restore HttpContext
|
||||||
if (callerThreadContext._httpContext != null)
|
if (callerThreadContext._httpContext != null)
|
||||||
{
|
{
|
||||||
HttpContext.Current = callerThreadContext._httpContext;
|
HttpContext.Current = callerThreadContext._httpContext;
|
||||||
//CallContext.SetData(HttpContextSlotName, callerThreadContext._httpContext);
|
//CallContext.SetData(HttpContextSlotName, callerThreadContext._httpContext);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,34 +36,34 @@ namespace Amib.Threading.Internal
|
||||||
return waitHandle.WaitOne(millisecondsTimeout, exitContext);
|
return waitHandle.WaitOne(millisecondsTimeout, exitContext);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static IntPtr[] PrepareNativeHandles(WaitHandle[] waitHandles)
|
private static IntPtr[] PrepareNativeHandles(WaitHandle[] waitHandles)
|
||||||
{
|
{
|
||||||
IntPtr[] nativeHandles = new IntPtr[waitHandles.Length];
|
IntPtr[] nativeHandles = new IntPtr[waitHandles.Length];
|
||||||
for (int i = 0; i < waitHandles.Length; i++)
|
for (int i = 0; i < waitHandles.Length; i++)
|
||||||
{
|
{
|
||||||
nativeHandles[i] = waitHandles[i].Handle;
|
nativeHandles[i] = waitHandles[i].Handle;
|
||||||
}
|
}
|
||||||
return nativeHandles;
|
return nativeHandles;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool WaitAll(WaitHandle[] waitHandles, int millisecondsTimeout, bool exitContext)
|
public static bool WaitAll(WaitHandle[] waitHandles, int millisecondsTimeout, bool exitContext)
|
||||||
{
|
{
|
||||||
uint timeout = millisecondsTimeout < 0 ? INFINITE : (uint)millisecondsTimeout;
|
uint timeout = millisecondsTimeout < 0 ? INFINITE : (uint)millisecondsTimeout;
|
||||||
|
|
||||||
IntPtr[] nativeHandles = PrepareNativeHandles(waitHandles);
|
IntPtr[] nativeHandles = PrepareNativeHandles(waitHandles);
|
||||||
|
|
||||||
int result = WaitForMultipleObjects((uint)waitHandles.Length, nativeHandles, true, timeout);
|
int result = WaitForMultipleObjects((uint)waitHandles.Length, nativeHandles, true, timeout);
|
||||||
|
|
||||||
if (result == WAIT_TIMEOUT || result == WAIT_FAILED)
|
if (result == WAIT_TIMEOUT || result == WAIT_FAILED)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static int WaitAny(WaitHandle[] waitHandles, int millisecondsTimeout, bool exitContext)
|
public static int WaitAny(WaitHandle[] waitHandles, int millisecondsTimeout, bool exitContext)
|
||||||
{
|
{
|
||||||
uint timeout = millisecondsTimeout < 0 ? INFINITE : (uint)millisecondsTimeout;
|
uint timeout = millisecondsTimeout < 0 ? INFINITE : (uint)millisecondsTimeout;
|
||||||
|
|
||||||
|
|
|
@ -3,18 +3,18 @@ using System.Threading;
|
||||||
|
|
||||||
namespace Amib.Threading
|
namespace Amib.Threading
|
||||||
{
|
{
|
||||||
#region Delegates
|
#region Delegates
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// A delegate that represents the method to run as the work item
|
/// A delegate that represents the method to run as the work item
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="state">A state object for the method to run</param>
|
/// <param name="state">A state object for the method to run</param>
|
||||||
public delegate object WorkItemCallback(object state);
|
public delegate object WorkItemCallback(object state);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// A delegate to call after the WorkItemCallback completed
|
/// A delegate to call after the WorkItemCallback completed
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="wir">The work item result object</param>
|
/// <param name="wir">The work item result object</param>
|
||||||
public delegate void PostExecuteWorkItemCallback(IWorkItemResult wir);
|
public delegate void PostExecuteWorkItemCallback(IWorkItemResult wir);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -23,11 +23,11 @@ namespace Amib.Threading
|
||||||
/// <param name="wir">The work item result object</param>
|
/// <param name="wir">The work item result object</param>
|
||||||
public delegate void PostExecuteWorkItemCallback<TResult>(IWorkItemResult<TResult> wir);
|
public delegate void PostExecuteWorkItemCallback<TResult>(IWorkItemResult<TResult> wir);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// A delegate to call when a WorkItemsGroup becomes idle
|
/// A delegate to call when a WorkItemsGroup becomes idle
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="workItemsGroup">A reference to the WorkItemsGroup that became idle</param>
|
/// <param name="workItemsGroup">A reference to the WorkItemsGroup that became idle</param>
|
||||||
public delegate void WorkItemsGroupIdleHandler(IWorkItemsGroup workItemsGroup);
|
public delegate void WorkItemsGroupIdleHandler(IWorkItemsGroup workItemsGroup);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// A delegate to call after a thread is created, but before
|
/// A delegate to call after a thread is created, but before
|
||||||
|
@ -41,38 +41,38 @@ namespace Amib.Threading
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public delegate void ThreadTerminationHandler();
|
public delegate void ThreadTerminationHandler();
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region WorkItem Priority
|
#region WorkItem Priority
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Defines the availeable priorities of a work item.
|
/// Defines the availeable priorities of a work item.
|
||||||
/// The higher the priority a work item has, the sooner
|
/// The higher the priority a work item has, the sooner
|
||||||
/// it will be executed.
|
/// it will be executed.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public enum WorkItemPriority
|
public enum WorkItemPriority
|
||||||
{
|
{
|
||||||
Lowest,
|
Lowest,
|
||||||
BelowNormal,
|
BelowNormal,
|
||||||
Normal,
|
Normal,
|
||||||
AboveNormal,
|
AboveNormal,
|
||||||
Highest,
|
Highest,
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region IWorkItemsGroup interface
|
#region IWorkItemsGroup interface
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// IWorkItemsGroup interface
|
/// IWorkItemsGroup interface
|
||||||
/// Created by SmartThreadPool.CreateWorkItemsGroup()
|
/// Created by SmartThreadPool.CreateWorkItemsGroup()
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public interface IWorkItemsGroup
|
public interface IWorkItemsGroup
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get/Set the name of the WorkItemsGroup
|
/// Get/Set the name of the WorkItemsGroup
|
||||||
/// </summary>
|
/// </summary>
|
||||||
string Name { get; set; }
|
string Name { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get/Set the maximum number of workitem that execute cocurrency on the thread pool
|
/// Get/Set the maximum number of workitem that execute cocurrency on the thread pool
|
||||||
|
@ -115,14 +115,14 @@ namespace Amib.Threading
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Wait for all work item to complete.
|
/// Wait for all work item to complete.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
void WaitForIdle();
|
void WaitForIdle();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Wait for all work item to complete, until timeout expired
|
/// Wait for all work item to complete, until timeout expired
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="timeout">How long to wait for the work items to complete</param>
|
/// <param name="timeout">How long to wait for the work items to complete</param>
|
||||||
/// <returns>Returns true if work items completed within the timeout, otherwise false.</returns>
|
/// <returns>Returns true if work items completed within the timeout, otherwise false.</returns>
|
||||||
bool WaitForIdle(TimeSpan timeout);
|
bool WaitForIdle(TimeSpan timeout);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Wait for all work item to complete, until timeout expired
|
/// Wait for all work item to complete, until timeout expired
|
||||||
|
@ -363,37 +363,37 @@ namespace Amib.Threading
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region CallToPostExecute enumerator
|
#region CallToPostExecute enumerator
|
||||||
|
|
||||||
[Flags]
|
[Flags]
|
||||||
public enum CallToPostExecute
|
public enum CallToPostExecute
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Never call to the PostExecute call back
|
/// Never call to the PostExecute call back
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Never = 0x00,
|
Never = 0x00,
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Call to the PostExecute only when the work item is cancelled
|
/// Call to the PostExecute only when the work item is cancelled
|
||||||
/// </summary>
|
/// </summary>
|
||||||
WhenWorkItemCanceled = 0x01,
|
WhenWorkItemCanceled = 0x01,
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Call to the PostExecute only when the work item is not cancelled
|
/// Call to the PostExecute only when the work item is not cancelled
|
||||||
/// </summary>
|
/// </summary>
|
||||||
WhenWorkItemNotCanceled = 0x02,
|
WhenWorkItemNotCanceled = 0x02,
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Always call to the PostExecute
|
/// Always call to the PostExecute
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Always = WhenWorkItemCanceled | WhenWorkItemNotCanceled,
|
Always = WhenWorkItemCanceled | WhenWorkItemNotCanceled,
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region IWorkItemResult interface
|
#region IWorkItemResult interface
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The common interface of IWorkItemResult and IWorkItemResult<T>
|
/// The common interface of IWorkItemResult and IWorkItemResult<T>
|
||||||
|
@ -421,159 +421,159 @@ namespace Amib.Threading
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// IWorkItemResult<TResult> interface.
|
/// IWorkItemResult<TResult> interface.
|
||||||
/// Created when a Func<TResult> work item is queued.
|
/// Created when a Func<TResult> work item is queued.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public interface IWorkItemResult<TResult> : IWaitableResult
|
public interface IWorkItemResult<TResult> : IWaitableResult
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get the result of the work item.
|
/// Get the result of the work item.
|
||||||
/// If the work item didn't run yet then the caller waits.
|
/// If the work item didn't run yet then the caller waits.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns>The result of the work item</returns>
|
/// <returns>The result of the work item</returns>
|
||||||
TResult GetResult();
|
TResult GetResult();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get the result of the work item.
|
/// Get the result of the work item.
|
||||||
/// If the work item didn't run yet then the caller waits until timeout.
|
/// If the work item didn't run yet then the caller waits until timeout.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns>The result of the work item</returns>
|
/// <returns>The result of the work item</returns>
|
||||||
/// On timeout throws WorkItemTimeoutException
|
/// On timeout throws WorkItemTimeoutException
|
||||||
TResult GetResult(
|
TResult GetResult(
|
||||||
int millisecondsTimeout,
|
int millisecondsTimeout,
|
||||||
bool exitContext);
|
bool exitContext);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get the result of the work item.
|
/// Get the result of the work item.
|
||||||
/// If the work item didn't run yet then the caller waits until timeout.
|
/// If the work item didn't run yet then the caller waits until timeout.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns>The result of the work item</returns>
|
/// <returns>The result of the work item</returns>
|
||||||
/// On timeout throws WorkItemTimeoutException
|
/// On timeout throws WorkItemTimeoutException
|
||||||
TResult GetResult(
|
TResult GetResult(
|
||||||
TimeSpan timeout,
|
TimeSpan timeout,
|
||||||
bool exitContext);
|
bool exitContext);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get the result of the work item.
|
/// Get the result of the work item.
|
||||||
/// If the work item didn't run yet then the caller waits until timeout or until the cancelWaitHandle is signaled.
|
/// If the work item didn't run yet then the caller waits until timeout or until the cancelWaitHandle is signaled.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="millisecondsTimeout">Timeout in milliseconds, or -1 for infinite</param>
|
/// <param name="millisecondsTimeout">Timeout in milliseconds, or -1 for infinite</param>
|
||||||
/// <param name="exitContext">
|
/// <param name="exitContext">
|
||||||
/// true to exit the synchronization domain for the context before the wait (if in a synchronized context), and reacquire it; otherwise, false.
|
/// true to exit the synchronization domain for the context before the wait (if in a synchronized context), and reacquire it; otherwise, false.
|
||||||
/// </param>
|
/// </param>
|
||||||
/// <param name="cancelWaitHandle">A cancel wait handle to interrupt the blocking if needed</param>
|
/// <param name="cancelWaitHandle">A cancel wait handle to interrupt the blocking if needed</param>
|
||||||
/// <returns>The result of the work item</returns>
|
/// <returns>The result of the work item</returns>
|
||||||
/// On timeout throws WorkItemTimeoutException
|
/// On timeout throws WorkItemTimeoutException
|
||||||
/// On cancel throws WorkItemCancelException
|
/// On cancel throws WorkItemCancelException
|
||||||
TResult GetResult(
|
TResult GetResult(
|
||||||
int millisecondsTimeout,
|
int millisecondsTimeout,
|
||||||
bool exitContext,
|
bool exitContext,
|
||||||
WaitHandle cancelWaitHandle);
|
WaitHandle cancelWaitHandle);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get the result of the work item.
|
/// Get the result of the work item.
|
||||||
/// If the work item didn't run yet then the caller waits until timeout or until the cancelWaitHandle is signaled.
|
/// If the work item didn't run yet then the caller waits until timeout or until the cancelWaitHandle is signaled.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns>The result of the work item</returns>
|
/// <returns>The result of the work item</returns>
|
||||||
/// On timeout throws WorkItemTimeoutException
|
/// On timeout throws WorkItemTimeoutException
|
||||||
/// On cancel throws WorkItemCancelException
|
/// On cancel throws WorkItemCancelException
|
||||||
TResult GetResult(
|
TResult GetResult(
|
||||||
TimeSpan timeout,
|
TimeSpan timeout,
|
||||||
bool exitContext,
|
bool exitContext,
|
||||||
WaitHandle cancelWaitHandle);
|
WaitHandle cancelWaitHandle);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get the result of the work item.
|
/// Get the result of the work item.
|
||||||
/// If the work item didn't run yet then the caller waits.
|
/// If the work item didn't run yet then the caller waits.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="e">Filled with the exception if one was thrown</param>
|
/// <param name="e">Filled with the exception if one was thrown</param>
|
||||||
/// <returns>The result of the work item</returns>
|
/// <returns>The result of the work item</returns>
|
||||||
TResult GetResult(out Exception e);
|
TResult GetResult(out Exception e);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get the result of the work item.
|
/// Get the result of the work item.
|
||||||
/// If the work item didn't run yet then the caller waits until timeout.
|
/// If the work item didn't run yet then the caller waits until timeout.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="millisecondsTimeout"></param>
|
/// <param name="millisecondsTimeout"></param>
|
||||||
/// <param name="exitContext"></param>
|
/// <param name="exitContext"></param>
|
||||||
/// <param name="e">Filled with the exception if one was thrown</param>
|
/// <param name="e">Filled with the exception if one was thrown</param>
|
||||||
/// <returns>The result of the work item</returns>
|
/// <returns>The result of the work item</returns>
|
||||||
/// On timeout throws WorkItemTimeoutException
|
/// On timeout throws WorkItemTimeoutException
|
||||||
TResult GetResult(
|
TResult GetResult(
|
||||||
int millisecondsTimeout,
|
int millisecondsTimeout,
|
||||||
bool exitContext,
|
bool exitContext,
|
||||||
out Exception e);
|
out Exception e);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get the result of the work item.
|
/// Get the result of the work item.
|
||||||
/// If the work item didn't run yet then the caller waits until timeout.
|
/// If the work item didn't run yet then the caller waits until timeout.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="exitContext"></param>
|
/// <param name="exitContext"></param>
|
||||||
/// <param name="e">Filled with the exception if one was thrown</param>
|
/// <param name="e">Filled with the exception if one was thrown</param>
|
||||||
/// <param name="timeout"></param>
|
/// <param name="timeout"></param>
|
||||||
/// <returns>The result of the work item</returns>
|
/// <returns>The result of the work item</returns>
|
||||||
/// On timeout throws WorkItemTimeoutException
|
/// On timeout throws WorkItemTimeoutException
|
||||||
TResult GetResult(
|
TResult GetResult(
|
||||||
TimeSpan timeout,
|
TimeSpan timeout,
|
||||||
bool exitContext,
|
bool exitContext,
|
||||||
out Exception e);
|
out Exception e);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get the result of the work item.
|
/// Get the result of the work item.
|
||||||
/// If the work item didn't run yet then the caller waits until timeout or until the cancelWaitHandle is signaled.
|
/// If the work item didn't run yet then the caller waits until timeout or until the cancelWaitHandle is signaled.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="millisecondsTimeout">Timeout in milliseconds, or -1 for infinite</param>
|
/// <param name="millisecondsTimeout">Timeout in milliseconds, or -1 for infinite</param>
|
||||||
/// <param name="exitContext">
|
/// <param name="exitContext">
|
||||||
/// true to exit the synchronization domain for the context before the wait (if in a synchronized context), and reacquire it; otherwise, false.
|
/// true to exit the synchronization domain for the context before the wait (if in a synchronized context), and reacquire it; otherwise, false.
|
||||||
/// </param>
|
/// </param>
|
||||||
/// <param name="cancelWaitHandle">A cancel wait handle to interrupt the blocking if needed</param>
|
/// <param name="cancelWaitHandle">A cancel wait handle to interrupt the blocking if needed</param>
|
||||||
/// <param name="e">Filled with the exception if one was thrown</param>
|
/// <param name="e">Filled with the exception if one was thrown</param>
|
||||||
/// <returns>The result of the work item</returns>
|
/// <returns>The result of the work item</returns>
|
||||||
/// On timeout throws WorkItemTimeoutException
|
/// On timeout throws WorkItemTimeoutException
|
||||||
/// On cancel throws WorkItemCancelException
|
/// On cancel throws WorkItemCancelException
|
||||||
TResult GetResult(
|
TResult GetResult(
|
||||||
int millisecondsTimeout,
|
int millisecondsTimeout,
|
||||||
bool exitContext,
|
bool exitContext,
|
||||||
WaitHandle cancelWaitHandle,
|
WaitHandle cancelWaitHandle,
|
||||||
out Exception e);
|
out Exception e);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get the result of the work item.
|
/// Get the result of the work item.
|
||||||
/// If the work item didn't run yet then the caller waits until timeout or until the cancelWaitHandle is signaled.
|
/// If the work item didn't run yet then the caller waits until timeout or until the cancelWaitHandle is signaled.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns>The result of the work item</returns>
|
/// <returns>The result of the work item</returns>
|
||||||
/// <param name="cancelWaitHandle"></param>
|
/// <param name="cancelWaitHandle"></param>
|
||||||
/// <param name="e">Filled with the exception if one was thrown</param>
|
/// <param name="e">Filled with the exception if one was thrown</param>
|
||||||
/// <param name="timeout"></param>
|
/// <param name="timeout"></param>
|
||||||
/// <param name="exitContext"></param>
|
/// <param name="exitContext"></param>
|
||||||
/// On timeout throws WorkItemTimeoutException
|
/// On timeout throws WorkItemTimeoutException
|
||||||
/// On cancel throws WorkItemCancelException
|
/// On cancel throws WorkItemCancelException
|
||||||
TResult GetResult(
|
TResult GetResult(
|
||||||
TimeSpan timeout,
|
TimeSpan timeout,
|
||||||
bool exitContext,
|
bool exitContext,
|
||||||
WaitHandle cancelWaitHandle,
|
WaitHandle cancelWaitHandle,
|
||||||
out Exception e);
|
out Exception e);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets an indication whether the asynchronous operation has completed.
|
/// Gets an indication whether the asynchronous operation has completed.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
bool IsCompleted { get; }
|
bool IsCompleted { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets an indication whether the asynchronous operation has been canceled.
|
/// Gets an indication whether the asynchronous operation has been canceled.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
bool IsCanceled { get; }
|
bool IsCanceled { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the user-defined object that contains context data
|
/// Gets the user-defined object that contains context data
|
||||||
/// for the work item method.
|
/// for the work item method.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
object State { get; }
|
object State { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Same as Cancel(false).
|
/// Same as Cancel(false).
|
||||||
/// </summary>
|
/// </summary>
|
||||||
bool Cancel();
|
bool Cancel();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -590,23 +590,23 @@ namespace Amib.Threading
|
||||||
/// <returns>Returns true if the work item was not completed, otherwise false.</returns>
|
/// <returns>Returns true if the work item was not completed, otherwise false.</returns>
|
||||||
bool Cancel(bool abortExecution);
|
bool Cancel(bool abortExecution);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get the work item's priority
|
/// Get the work item's priority
|
||||||
/// </summary>
|
/// </summary>
|
||||||
WorkItemPriority WorkItemPriority { get; }
|
WorkItemPriority WorkItemPriority { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Return the result, same as GetResult()
|
/// Return the result, same as GetResult()
|
||||||
/// </summary>
|
/// </summary>
|
||||||
TResult Result { get; }
|
TResult Result { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns the exception if occured otherwise returns null.
|
/// Returns the exception if occured otherwise returns null.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
object Exception { get; }
|
object Exception { get; }
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region .NET 3.5
|
#region .NET 3.5
|
||||||
|
|
||||||
|
|
|
@ -5,235 +5,235 @@ using System.Diagnostics;
|
||||||
|
|
||||||
namespace Amib.Threading.Internal
|
namespace Amib.Threading.Internal
|
||||||
{
|
{
|
||||||
#region PriorityQueue class
|
#region PriorityQueue class
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// PriorityQueue class
|
/// PriorityQueue class
|
||||||
/// This class is not thread safe because we use external lock
|
/// This class is not thread safe because we use external lock
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public sealed class PriorityQueue : IEnumerable
|
public sealed class PriorityQueue : IEnumerable
|
||||||
{
|
{
|
||||||
#region Private members
|
#region Private members
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The number of queues, there is one for each type of priority
|
/// The number of queues, there is one for each type of priority
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private const int _queuesCount = WorkItemPriority.Highest-WorkItemPriority.Lowest+1;
|
private const int _queuesCount = WorkItemPriority.Highest-WorkItemPriority.Lowest+1;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Work items queues. There is one for each type of priority
|
/// Work items queues. There is one for each type of priority
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private readonly LinkedList<IHasWorkItemPriority>[] _queues = new LinkedList<IHasWorkItemPriority>[_queuesCount];
|
private readonly LinkedList<IHasWorkItemPriority>[] _queues = new LinkedList<IHasWorkItemPriority>[_queuesCount];
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The total number of work items within the queues
|
/// The total number of work items within the queues
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private int _workItemsCount;
|
private int _workItemsCount;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Use with IEnumerable interface
|
/// Use with IEnumerable interface
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private int _version;
|
private int _version;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Contructor
|
#region Contructor
|
||||||
|
|
||||||
public PriorityQueue()
|
public PriorityQueue()
|
||||||
{
|
{
|
||||||
for(int i = 0; i < _queues.Length; ++i)
|
for(int i = 0; i < _queues.Length; ++i)
|
||||||
{
|
{
|
||||||
_queues[i] = new LinkedList<IHasWorkItemPriority>();
|
_queues[i] = new LinkedList<IHasWorkItemPriority>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Methods
|
#region Methods
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Enqueue a work item.
|
/// Enqueue a work item.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="workItem">A work item</param>
|
/// <param name="workItem">A work item</param>
|
||||||
public void Enqueue(IHasWorkItemPriority workItem)
|
public void Enqueue(IHasWorkItemPriority workItem)
|
||||||
{
|
{
|
||||||
Debug.Assert(null != workItem);
|
Debug.Assert(null != workItem);
|
||||||
|
|
||||||
int queueIndex = _queuesCount-(int)workItem.WorkItemPriority-1;
|
int queueIndex = _queuesCount-(int)workItem.WorkItemPriority-1;
|
||||||
Debug.Assert(queueIndex >= 0);
|
Debug.Assert(queueIndex >= 0);
|
||||||
Debug.Assert(queueIndex < _queuesCount);
|
Debug.Assert(queueIndex < _queuesCount);
|
||||||
|
|
||||||
_queues[queueIndex].AddLast(workItem);
|
_queues[queueIndex].AddLast(workItem);
|
||||||
++_workItemsCount;
|
++_workItemsCount;
|
||||||
++_version;
|
++_version;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Dequeque a work item.
|
/// Dequeque a work item.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns>Returns the next work item</returns>
|
/// <returns>Returns the next work item</returns>
|
||||||
public IHasWorkItemPriority Dequeue()
|
public IHasWorkItemPriority Dequeue()
|
||||||
{
|
{
|
||||||
IHasWorkItemPriority workItem = null;
|
IHasWorkItemPriority workItem = null;
|
||||||
|
|
||||||
if(_workItemsCount > 0)
|
if(_workItemsCount > 0)
|
||||||
{
|
{
|
||||||
int queueIndex = GetNextNonEmptyQueue(-1);
|
int queueIndex = GetNextNonEmptyQueue(-1);
|
||||||
Debug.Assert(queueIndex >= 0);
|
Debug.Assert(queueIndex >= 0);
|
||||||
workItem = _queues[queueIndex].First.Value;
|
workItem = _queues[queueIndex].First.Value;
|
||||||
_queues[queueIndex].RemoveFirst();
|
_queues[queueIndex].RemoveFirst();
|
||||||
Debug.Assert(null != workItem);
|
Debug.Assert(null != workItem);
|
||||||
--_workItemsCount;
|
--_workItemsCount;
|
||||||
++_version;
|
++_version;
|
||||||
}
|
}
|
||||||
|
|
||||||
return workItem;
|
return workItem;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Find the next non empty queue starting at queue queueIndex+1
|
/// Find the next non empty queue starting at queue queueIndex+1
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="queueIndex">The index-1 to start from</param>
|
/// <param name="queueIndex">The index-1 to start from</param>
|
||||||
/// <returns>
|
/// <returns>
|
||||||
/// The index of the next non empty queue or -1 if all the queues are empty
|
/// The index of the next non empty queue or -1 if all the queues are empty
|
||||||
/// </returns>
|
/// </returns>
|
||||||
private int GetNextNonEmptyQueue(int queueIndex)
|
private int GetNextNonEmptyQueue(int queueIndex)
|
||||||
{
|
{
|
||||||
for(int i = queueIndex+1; i < _queuesCount; ++i)
|
for(int i = queueIndex+1; i < _queuesCount; ++i)
|
||||||
{
|
{
|
||||||
if(_queues[i].Count > 0)
|
if(_queues[i].Count > 0)
|
||||||
{
|
{
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The number of work items
|
/// The number of work items
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int Count
|
public int Count
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return _workItemsCount;
|
return _workItemsCount;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Clear all the work items
|
/// Clear all the work items
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void Clear()
|
public void Clear()
|
||||||
{
|
{
|
||||||
if (_workItemsCount > 0)
|
if (_workItemsCount > 0)
|
||||||
{
|
{
|
||||||
foreach(LinkedList<IHasWorkItemPriority> queue in _queues)
|
foreach(LinkedList<IHasWorkItemPriority> queue in _queues)
|
||||||
{
|
{
|
||||||
queue.Clear();
|
queue.Clear();
|
||||||
}
|
}
|
||||||
_workItemsCount = 0;
|
_workItemsCount = 0;
|
||||||
++_version;
|
++_version;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region IEnumerable Members
|
#region IEnumerable Members
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns an enumerator to iterate over the work items
|
/// Returns an enumerator to iterate over the work items
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns>Returns an enumerator</returns>
|
/// <returns>Returns an enumerator</returns>
|
||||||
public IEnumerator GetEnumerator()
|
public IEnumerator GetEnumerator()
|
||||||
{
|
{
|
||||||
return new PriorityQueueEnumerator(this);
|
return new PriorityQueueEnumerator(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region PriorityQueueEnumerator
|
#region PriorityQueueEnumerator
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The class the implements the enumerator
|
/// The class the implements the enumerator
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private class PriorityQueueEnumerator : IEnumerator
|
private class PriorityQueueEnumerator : IEnumerator
|
||||||
{
|
{
|
||||||
private readonly PriorityQueue _priorityQueue;
|
private readonly PriorityQueue _priorityQueue;
|
||||||
private int _version;
|
private int _version;
|
||||||
private int _queueIndex;
|
private int _queueIndex;
|
||||||
private IEnumerator _enumerator;
|
private IEnumerator _enumerator;
|
||||||
|
|
||||||
public PriorityQueueEnumerator(PriorityQueue priorityQueue)
|
public PriorityQueueEnumerator(PriorityQueue priorityQueue)
|
||||||
{
|
{
|
||||||
_priorityQueue = priorityQueue;
|
_priorityQueue = priorityQueue;
|
||||||
_version = _priorityQueue._version;
|
_version = _priorityQueue._version;
|
||||||
_queueIndex = _priorityQueue.GetNextNonEmptyQueue(-1);
|
_queueIndex = _priorityQueue.GetNextNonEmptyQueue(-1);
|
||||||
if (_queueIndex >= 0)
|
if (_queueIndex >= 0)
|
||||||
{
|
{
|
||||||
_enumerator = _priorityQueue._queues[_queueIndex].GetEnumerator();
|
_enumerator = _priorityQueue._queues[_queueIndex].GetEnumerator();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_enumerator = null;
|
_enumerator = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#region IEnumerator Members
|
#region IEnumerator Members
|
||||||
|
|
||||||
public void Reset()
|
public void Reset()
|
||||||
{
|
{
|
||||||
_version = _priorityQueue._version;
|
_version = _priorityQueue._version;
|
||||||
_queueIndex = _priorityQueue.GetNextNonEmptyQueue(-1);
|
_queueIndex = _priorityQueue.GetNextNonEmptyQueue(-1);
|
||||||
if (_queueIndex >= 0)
|
if (_queueIndex >= 0)
|
||||||
{
|
{
|
||||||
_enumerator = _priorityQueue._queues[_queueIndex].GetEnumerator();
|
_enumerator = _priorityQueue._queues[_queueIndex].GetEnumerator();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_enumerator = null;
|
_enumerator = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public object Current
|
public object Current
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
Debug.Assert(null != _enumerator);
|
Debug.Assert(null != _enumerator);
|
||||||
return _enumerator.Current;
|
return _enumerator.Current;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool MoveNext()
|
public bool MoveNext()
|
||||||
{
|
{
|
||||||
if (null == _enumerator)
|
if (null == _enumerator)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(_version != _priorityQueue._version)
|
if(_version != _priorityQueue._version)
|
||||||
{
|
{
|
||||||
throw new InvalidOperationException("The collection has been modified");
|
throw new InvalidOperationException("The collection has been modified");
|
||||||
|
|
||||||
}
|
}
|
||||||
if (!_enumerator.MoveNext())
|
if (!_enumerator.MoveNext())
|
||||||
{
|
{
|
||||||
_queueIndex = _priorityQueue.GetNextNonEmptyQueue(_queueIndex);
|
_queueIndex = _priorityQueue.GetNextNonEmptyQueue(_queueIndex);
|
||||||
if(-1 == _queueIndex)
|
if(-1 == _queueIndex)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
_enumerator = _priorityQueue._queues[_queueIndex].GetEnumerator();
|
_enumerator = _priorityQueue._queues[_queueIndex].GetEnumerator();
|
||||||
_enumerator.MoveNext();
|
_enumerator.MoveNext();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue