Skip to content

Commit

Permalink
Refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
weeeBox committed Dec 20, 2016
1 parent 883c96e commit e91ff02
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 20 deletions.
2 changes: 1 addition & 1 deletion Project/Assets/LunarPlugin/Editor/Console/CTerminal.cs
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public string DoAutoComplete(string line, int index, bool isDoubleTab)

return result.line;
}
catch (CommandAutoCompleteException e)
catch (CCommandAutoCompleteException e)
{
Add(CCommand.Prompt(line));
Add(e.InnerException, "Exception while auto completing args");
Expand Down
6 changes: 3 additions & 3 deletions Project/Assets/LunarPlugin/Scripts/CDefaultAppImp.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ namespace LunarPluginInternal
{
class DefaultAppImp : AppImp, IUpdatable, IDestroyable, ICCommandDelegate
{
private readonly CommandProcessor m_processor;
private readonly CCommandProcessor m_processor;
private readonly TimerManager m_timerManager;
private readonly NotificationCenter m_notificationCenter;
private readonly UpdatableList m_updatables;
Expand Down Expand Up @@ -219,9 +219,9 @@ protected virtual NotificationCenter CreateNotificationCenter()
return NotificationCenter.SharedInstance;
}

protected virtual CommandProcessor CreateCommandProcessor()
protected virtual CCommandProcessor CreateCommandProcessor()
{
CommandProcessor processor = new CommandProcessor();
CCommandProcessor processor = new CCommandProcessor();
processor.CommandDelegate = this;
return processor;
}
Expand Down
2 changes: 1 addition & 1 deletion Project/Assets/LunarPlugin/Scripts/Console/CCommand.cs
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -707,7 +707,7 @@ internal IList<string> AutoCompleteCustomArgs(string commandLine, string token)
}
catch (Exception e)
{
throw new CommandAutoCompleteException(e);
throw new CCommandAutoCompleteException(e);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@

namespace LunarPluginInternal
{
class CommandAutoCompleteException : Exception
class CCommandAutoCompleteException : Exception
{
public CommandAutoCompleteException(Exception e)
public CCommandAutoCompleteException(Exception e)
: base("Custom command autocomplete exception", e)
{
}
Expand Down
16 changes: 8 additions & 8 deletions Project/Assets/LunarPlugin/Scripts/Console/CCommandProcessor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,17 +42,17 @@ static class CCommandNotifications
public static readonly string KeyName = "name"; // string
}

interface ICommandProcessorDelegate
interface ICCommandProcessorDelegate
{
void OnCommandExecuted(CommandProcessor processor, CCommand cmd);
void OnCommandUnknown(CommandProcessor processor, string cmdName);
void OnCommandExecuted(CCommandProcessor processor, CCommand cmd);
void OnCommandUnknown(CCommandProcessor processor, string cmdName);
}

class CommandProcessor
class CCommandProcessor
{
private ICCommandDelegate m_delegate;

public CommandProcessor()
public CCommandProcessor()
{
CommandDelegate = null;
}
Expand Down Expand Up @@ -161,7 +161,7 @@ private void NotifyCommandUnknown(string cmdName)

#region Properties

public ICommandProcessorDelegate Delegate { get; set; }
public ICCommandProcessorDelegate Delegate { get; set; }
public ICCommandDelegate CommandDelegate
{
get { return m_delegate; }
Expand All @@ -171,9 +171,9 @@ public ICCommandDelegate CommandDelegate
#endregion
}

class TokenizeException : Exception
class CCommandTokenizeException : Exception
{
public TokenizeException(string message)
public CCommandTokenizeException(string message)
: base(message)
{
}
Expand Down
6 changes: 3 additions & 3 deletions Project/Assets/LunarPlugin/Scripts/Console/CCommandSplitter.cs
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -101,12 +101,12 @@ public static void Split(string str, IList<string> list, int options = 0)

if (insideDoubleQuotes && !HasOption(options, OPTION_IGNORE_MISSING_QUOTES))
{
throw new TokenizeException("Missing closing double quote");
throw new CCommandTokenizeException("Missing closing double quote");
}

if (insideSingleQuotes && !HasOption(options, OPTION_IGNORE_MISSING_QUOTES))
{
throw new TokenizeException("Missing closing single quote");
throw new CCommandTokenizeException("Missing closing single quote");
}

if (commandBuffer.Length > 0)
Expand All @@ -120,7 +120,7 @@ private static void AddCommand(StringBuilder buffer, IList<string> list)
string command = buffer.ToString().Trim();
if (command.Length == 0)
{
throw new TokenizeException("Can't add empty command");
throw new CCommandTokenizeException("Can't add empty command");
}

list.Add(command);
Expand Down
4 changes: 2 additions & 2 deletions Project/Assets/LunarPlugin/Scripts/Console/CCommandTokenizer.cs
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -156,12 +156,12 @@ public static void Tokenize(string str, IList<string> tokens, int options = 0)

if (insideDoubleQuotes && !HasOption(options, OPTION_IGNORE_MISSING_QUOTES))
{
throw new TokenizeException("Missing closing double quote: " + str);
throw new CCommandTokenizeException("Missing closing double quote: " + str);
}

if (insideSingleQuotes && !HasOption(options, OPTION_IGNORE_MISSING_QUOTES))
{
throw new TokenizeException("Missing closing single quote: " + str);
throw new CCommandTokenizeException("Missing closing single quote: " + str);
}

AddToken(tokenBuffer, tokens);
Expand Down

0 comments on commit e91ff02

Please sign in to comment.