bowhunter928
New Member
- Joined
- Jan 20, 2013
- Messages
- 4
Really. you don't think I am running it?try archaeology buddy
Really. you don't think I am running it?try archaeology buddy
<If Condition="(bool)Settings["Research: Primordial Ruby"]" IgnoreCanRun="True">
<CustomAction Code="Log("[ProfessionBuddy] Researching Primordial Ruby.");" />
<If Condition="!RecipeIsOnCD(131686)" IgnoreCanRun="True">
<If Condition="HasMats(131686)" IgnoreCanRun="True">
<CastSpellAction RepeatType="Specific" Repeat="1" Entry="131686" CastOnItem="False" ItemType="Chest" ItemId="0" />
</If>
</If>
</If>
Im using gatherbuddy2 1-600 herbalism, but he's looting 3 times one herb and meanwhile mounting. It looks really "botty", so can anyone help me with this?
private static void LogInvoker(LogLevel level, Color headerColor, string header, Color msgColor, string format,
params object[] args)
{
if (Application.Current.Dispatcher.Thread == Thread.CurrentThread)
LogInternal(level, headerColor, header, msgColor, format, args);
else
Application.Current.Dispatcher.BeginInvoke(new LogDelegate(LogInternal), level, headerColor, header, msgColor,
format, args);
}
private static RichTextBox _rtbLog;
private static void LogInternal(LogLevel level, Color headerColor, string header, Color msgColor, string format,
params object[] args)
{
if (level == LogLevel.None)
return;
try
{
string msg = String.Format(format, args);
if (Styx.Helpers.GlobalSettings.Instance.LogLevel >= level)
{
if (_rtbLog == null)
_rtbLog = (RichTextBox)Application.Current.MainWindow.FindName("rtbLog");
var headerTR = new TextRange(_rtbLog.Document.ContentEnd, _rtbLog.Document.ContentEnd) { Text = header };
headerTR.ApplyPropertyValue(TextElement.ForegroundProperty, new SolidColorBrush(headerColor));
var messageTR = new TextRange(_rtbLog.Document.ContentEnd, _rtbLog.Document.ContentEnd);
messageTR.Text = msg + Environment.NewLine;
messageTR.ApplyPropertyValue(TextElement.ForegroundProperty, new SolidColorBrush(msgColor));
_rtbLog.ScrollToEnd();
}
try
{
char abbr;
switch (level)
{
case LogLevel.Normal:
abbr = 'N';
break;
case LogLevel.Quiet:
abbr = 'Q';
break;
case LogLevel.Diagnostic:
abbr = 'D';
break;
case LogLevel.Verbose:
abbr = 'V';
break;
default:
abbr = 'N';
break;
}
var logMsg = string.Format("[{0} {4}]{1}{2}{3}", DateTime.Now.ToString("HH:mm:ss.fff"), header, msg, Environment.NewLine, abbr);
File.AppendAllText(Logging.LogFilePath, logMsg);
}
catch { }
}
catch
{
Logging.Write(header + format, args);
}
}
private delegate void LogDelegate(LogLevel level,
Color headerColor, string header, Color msgColor, string format, params object[] args);
Thanks Inrego.Hey highvoltz.. I improved your logging methods a little. First off, instead of creating new colors with the same values in LogInternal - I just use the ones that are passed as parameters in the method header. Secondly - I removed the Logging.WriteDiagnostic that you used (which caused everything to be written to log twice). I then added ScrollToEnd to make it scroll down in the window when something is added to the log - and finally I made a variable to contain the logfile message (and made a few changes to it so that it uses the same format as HB's default logging), as this seemed to make it more consistent with actually appending the text to the file. Here's the modified code:
EDIT: Hold on, I'm in the process of adding LogLevel aswell.
EDIT2: Done