Here are the examples of the csharp api log4net.ILog.Info(object) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
592 Examples
19
Source : SolutionRenderer.cs
with MIT License
from gtw123
with MIT License
from gtw123
private void RenderProducts()
{
sm_log.Info("Rendering products");
var objects = Solution.GetObjects<Product>();
foreach (var obj in objects)
{
RenderObject(obj, Sidebar.Products, Sidebar.Products[obj.ID]);
}
}
19
Source : SolutionRenderer.cs
with MIT License
from gtw123
with MIT License
from gtw123
private void RenderTrackPath(Track track)
{
var trackPos = track.GetWorldPosition();
sm_log.Info(Invariant($"Rendering track at {trackPos}"));
// To minimize scrollling, first try to get as much as possible of the path visible
Screen.Grid.EnsureCellsVisible(track.GetBounds());
var prevPosition = trackPos;
foreach (var offset in track.Path.Skip(1))
{
var position = trackPos.Add(offset);
Screen.Grid.EnsureCellVisible(position, scrollToCenter: true); // scroll to center to minimise number of scrolls if it's a long track
// We need to recalculate both locations because the grid may have scrolled
var location = Screen.Grid.GetScreenLocationForCell(position);
var prevLocation = Screen.Grid.GetScreenLocationForCell(prevPosition);
MouseUtils.LeftDrag(prevLocation, location);
prevPosition = position;
}
}
19
Source : ScrollableArea.cs
with MIT License
from gtw123
with MIT License
from gtw123
private void DragArea(Point start, Point end)
{
if (start.X != end.X || !VerticalCheckRect.HasValue)
{
MouseUtils.RightDrag(start, end, ScrollDelay);
return;
}
const int maxAttempts = 5;
if (!DragAreaWithVerticalCheck(start, end))
{
for (int i = 1; i < maxAttempts; i++)
{
ScrollDelay += 100;
sm_log.Info("Increasing scroll delay to " + ScrollDelay);
sm_log.Info("Retrying scroll...");
if (DragAreaWithVerticalCheck(start, end))
{
return;
}
}
throw new InvalidOperationException(Invariant($"Attempted to drag from {start} to {end} but no movement detected after {maxAttempts} attempts."));
}
}
19
Source : ScreenCapture.cs
with MIT License
from gtw123
with MIT License
from gtw123
public ScreenCapture Clone(Rectangle rect, bool save = true)
{
sm_log.Info(Invariant($"Cloning rect {rect} from bitmap of size {Bitmap.Size}"));
var bitmap = Bitmap.Clone(rect, PixelFormat.Format32bppArgb);
return new ScreenCapture(bitmap, new Rectangle(Rect.Location.Add(rect.Location), rect.Size), save: save);
}
19
Source : ProgramMain.cs
with MIT License
from gtw123
with MIT License
from gtw123
[STAThread]
static void Main()
{
sm_log.Info("Starting up");
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1());
}
19
Source : AdjustPlaybackSpeedSlider.cs
with MIT License
from gtw123
with MIT License
from gtw123
public void Apply()
{
sm_log.Info("Applying patch");
AdjustControls();
AdjustSandboxPanelTexture();
}
19
Source : IncreaseMaxBoardSize.cs
with MIT License
from gtw123
with MIT License
from gtw123
public void Apply()
{
sm_log.Info("Applying patch");
ChangeMaxBoardSize();
ChangeScrollSize();
AddSizeToPuzzle();
PatchTileCreation();
PatchTraceReading();
PatchTraceWriting();
PatchCustomPuzzleReading();
}
19
Source : IncreaseMaxSpeed.cs
with MIT License
from gtw123
with MIT License
from gtw123
public void Apply()
{
sm_log.Info("Applying patch");
AdjustMaxSpeed();
}
19
Source : Installer.cs
with MIT License
from gtw123
with MIT License
from gtw123
public void Install()
{
sm_log.Info("Finding unpatched SHENZHEN I/O executable");
string exePath = ShenzhenLocator.FindUnpatchedShenzhenExecutable(m_shenzhenDir);
string exeDir = Path.GetDirectoryName(exePath);
if (Path.GetFileName(exePath).Equals("Shenzhen.exe", StringComparison.OrdinalIgnoreCase))
{
string backupPath = Path.Combine(exeDir, "Shenzhen.Unpatched.exe");
sm_log.InfoFormat("Backing up unpatched executable \"{0}\" to \"{1}\"", exePath, backupPath);
File.Copy(exePath, backupPath, overwrite: true);
}
string patchedPath = Path.Combine(exeDir, "Shenzhen.Patched.exe");
if (File.Exists(patchedPath))
{
sm_log.InfoFormat("Deleting existing patched file \"{0}\"", patchedPath);
File.Delete(patchedPath);
}
ApplyPatches(exePath, patchedPath);
string targetPath = Path.Combine(exeDir, "Shenzhen.exe");
if (File.Exists(targetPath))
{
// Rename the existing Shenzhen.exe before overwriting it, in case the user wants to roll back
string timestamp = DateTime.Now.ToString("yyyyMMdd-HHmmss", CultureInfo.InvariantCulture);
string backupPath = Path.Combine(exeDir, Invariant($"Shenzhen.{timestamp}.exe"));
sm_log.InfoFormat("Moving \"{0}\" to \"{1}\"", targetPath, backupPath);
File.Move(targetPath, backupPath);
}
sm_log.InfoFormat("Moving \"{0}\" to \"{1}\"", patchedPath, targetPath);
File.Move(patchedPath, targetPath);
}
19
Source : Installer.cs
with MIT License
from gtw123
with MIT License
from gtw123
private void ApplyPatches(string unpatchedPath, string patchedPath)
{
sm_log.InfoFormat("Reading module \"{0}\"", unpatchedPath);
using (var module = ModuleDefinition.ReadModule(unpatchedPath))
{
sm_log.Info("Locating types");
var types = new ShenzhenTypes(module);
sm_log.Info("Applying patches");
string exeDir = Path.GetDirectoryName(unpatchedPath);
new IncreaseMaxBoardSize(types).Apply();
new AddBiggerSandbox(types, exeDir).Apply();
new AdjustPlaybackSpeedSlider(types, exeDir).Apply();
if (bool.TryParse(ConfigurationManager.AppSettings["IncreaseMaxSpeed"], out bool increaseMaxSpeed) && increaseMaxSpeed)
{
new IncreaseMaxSpeed(types).Apply();
}
sm_log.InfoFormat("Saving patched file to \"{0}\"", patchedPath);
module.Write(patchedPath);
}
}
19
Source : Program.cs
with MIT License
from gtw123
with MIT License
from gtw123
[STAThread]
static void Main(string[] args)
{
sm_log.Info("---------------------------------------------------------------------------------------");
sm_log.Info("Starting up");
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1(args.Length > 0 ? args[0] : null));
}
19
Source : ProgramBuilder.cs
with MIT License
from gtw123
with MIT License
from gtw123
public Program Build()
{
sm_log.Info("Building program");
foreach (var fragment in m_fragments.Reverse())
{
AddFragment(fragment);
}
AddPeriodOverride();
AddRepeats();
sm_log.Info("Final program:" + Environment.NewLine + m_program.ToString());
return m_program;
}
19
Source : HexGridAnalyzer.cs
with MIT License
from gtw123
with MIT License
from gtw123
private Point FindApproximateCenterHex(Rectangle gridRect)
{
var gridCenter = new Point((gridRect.Left + gridRect.Right) / 2, (gridRect.Top + gridRect.Bottom) / 2);
sm_log.Info(Invariant($"Finding center hex. Starting location: {gridCenter}"));
var edges = FindVerticalEdges(gridCenter);
// Determine the edge that gives a hex closest to the center of the grid on the screen
var centers = edges.Select(edge => new Point(edge.Left + HexGrid.HexWidth / 2, edge.Top + edge.Height / 2));
var hexCenter = centers.MinBy(center => center.DistanceToSquared(gridCenter));
// Note that this center is only approximate since we estimated the vertical position based on the height of
// the vertical edge. It's difficult trying to find the exact position of the top of the hex. It doesn't
// matter for now - we'll recalibrate it later on.
sm_log.Info(Invariant($"Approximate center of hex: {hexCenter}"));
if (ScreenCapture.LoggingEnabled)
{
Capture.Bitmap.SetPixel(gridCenter.X, gridCenter.Y, Color.Yellow);
Capture.Bitmap.SetPixel(hexCenter.X, hexCenter.Y, Color.Purple);
Capture.Save();
}
return hexCenter;
}
19
Source : HexGridAnalyzer.cs
with MIT License
from gtw123
with MIT License
from gtw123
private IEnumerable<Rectangle> FindVerticalEdges(Point startLocation)
{
// Use an area covering two hexes to maximise our chances of finding an edge
var searchRect = new Rectangle(startLocation.X - HexGrid.HexWidth, startLocation.Y - HexGrid.HexHeight, HexGrid.HexWidth * 2, HexGrid.HexHeight * 2);
sm_log.Info(Invariant($"Looking for vertical edge of hex in {searchRect}"));
var edges = LineLocator.FindVerticalLines(Capture.Bitmap, searchRect, VerticalEdgeMinLength,
col => col.IsWithinBrightnessThresholds(VerticalEdgeLowerThreshold, VerticalEdgeUpperThreshold)).ToList();
if (ScreenCapture.LoggingEnabled)
{
using (Graphics g = Graphics.FromImage(Capture.Bitmap))
{
g.DrawRectangle(new Pen(Color.White, 1.0f), searchRect);
var pen = new Pen(Color.Red, 1.0f);
foreach (var edge in edges)
{
g.DrawRectangle(pen, edge);
}
}
}
if (!edges.Any())
{
throw new replacedysisException("Can't find any vertical edges in the hex grid.");
}
return edges;
}
19
Source : HexGridCalibrator.cs
with MIT License
from gtw123
with MIT License
from gtw123
public void Calibrate()
{
sm_log.Info("Calibrating center of hex grid");
// Drag a glyph of equilibrium onto the center of the grid
var toolLocation = m_sidebar.ScrollTo(m_sidebar.Glyphs, m_sidebar.Glyphs[GlyphType.Equilibrium]);
var gridLocation = m_grid.GetScreenLocationForCell(new Vector2(0, 0));
MouseUtils.LeftDrag(toolLocation, gridLocation);
// Find where the glyph actually ended up on the screen - this will be the exact center of a hex
// near the center of the screen.
var actualCenter = FindGlyph(m_grid.CenterLocation);
sm_log.Info(Invariant($"Actual hex center is {actualCenter}"));
// Scroll the grid so this actual center is exactly where we want it
var desiredCenter = m_grid.Rect.Location.Add(new Point(m_grid.Rect.Width / 2, m_grid.Rect.Height / 2)).Add(CenterOffset);
MouseUtils.RightDrag(actualCenter, desiredCenter);
m_grid.CenterLocation = desiredCenter;
// Delete the glyph from the grid
KeyboardUtils.KeyPress(Keys.Z);
}
19
Source : ProgramRenderer.cs
with MIT License
from gtw123
with MIT License
from gtw123
public void Render()
{
sm_log.Info("Rendering program");
m_grid.SetMaxY(m_arms.Count);
int width = m_grid.GetNumVisibleCells().X;
int maxTime = m_program.Instructions.Values.Max(x => x.Count());
for (int time = 0; time <= maxTime; time += width)
{
RenderPage(time, width);
}
}
19
Source : ProgramRenderer.cs
with MIT License
from gtw123
with MIT License
from gtw123
private void RenderPage(int startTime, int width)
{
sm_log.Info(Invariant($"Rendering page; startTime: {startTime}; width: {width}"));
for (int armIndex = 0; armIndex < m_arms.Count; armIndex++)
{
var instructions = m_program.GetArmInstructions(m_arms[armIndex]);
int endTime = Math.Min(instructions.Count, startTime + width) - 1;
if (startTime <= endTime)
{
RenderRow(startTime, endTime, armIndex, instructions);
}
}
}
19
Source : ProgramRenderer.cs
with MIT License
from gtw123
with MIT License
from gtw123
private void RenderRow(int startTime, int endTime, int armIndex, List<Instruction> instructions)
{
sm_log.Info(Invariant($"Rendering arm {armIndex} from {startTime} to {endTime}"));
m_grid.EnsureCellVisible(new Vector2(startTime, armIndex));
for (int timeIndex = startTime; timeIndex <= endTime; timeIndex++)
{
if (!instructions[timeIndex].IsRenderable())
{
continue;
}
// It's quite common for an arm to have similar instructions to the previous arm, so
// try to copy them if possible.
int numToCopy = FindCopyableInstructions(timeIndex, endTime, armIndex);
// Don't bother for single instructions as it's quicker to just recreate them
if (numToCopy > 1)
{
m_grid.EnsureCellsVisible(new Vector2(startTime, armIndex - 1), new Vector2(numToCopy, 2));
CopyInstructionsFromPrevious(timeIndex, numToCopy, armIndex);
timeIndex += numToCopy - 1;
}
else
{
m_instructionRenderer.Render(new Vector2(timeIndex, armIndex), instructions[timeIndex], m_renderDelay);
}
}
EnsureRowCorrect(startTime, endTime, armIndex, instructions);
}
19
Source : ProgramRenderer.cs
with MIT License
from gtw123
with MIT License
from gtw123
private void EnsureRowCorrect(int startTime, int endTime, int armIndex, List<Instruction> instructions)
{
const int maxRetries = 5;
int retryCount = 0;
int? prevErrors = null;
var errors = FindErrors(startTime, endTime, armIndex, instructions);
while (errors.Any())
{
if (prevErrors.HasValue && errors.Count() < prevErrors.Value)
{
// The number of errors has decreased, so reset the retry count
retryCount = 0;
}
else
{
// We haven't made any progress, so increment the retry count
retryCount++;
if (retryCount > maxRetries)
{
throw new RenderException(Invariant($"{errors.Count()} instructions for arm {armIndex} between time {startTime} and {endTime} are still incorrect after {retryCount} attempts."));
}
}
m_renderDelay += 10;
sm_log.Info("Increasing render delay to " + m_renderDelay);
foreach (int timeIndex in errors)
{
sm_log.Info(Invariant($"Re-rendering instruction for arm {armIndex} at time {timeIndex}"));
m_instructionRenderer.Render(new Vector2(timeIndex, armIndex), instructions[timeIndex], m_renderDelay);
}
errors = FindErrors(startTime, endTime, armIndex, instructions);
}
}
19
Source : SolutionRenderer.cs
with MIT License
from gtw123
with MIT License
from gtw123
private void RenderTracks()
{
sm_log.Info("Rendering tracks");
var objects = Solution.GetObjects<Track>();
foreach (var obj in objects)
{
var pos = obj.GetWorldPosition();
Screen.Grid.EnsureCellVisible(pos);
var toolLocation = Sidebar.ScrollTo(Sidebar.Mechanisms, Sidebar.Mechanisms[obj.Type]);
var gridLocation = Screen.Grid.GetScreenLocationForCell(pos);
MouseUtils.LeftDrag(toolLocation, gridLocation);
RenderTrackPath(obj);
}
}
19
Source : SolutionRenderer.cs
with MIT License
from gtw123
with MIT License
from gtw123
private void RenderGlyphs()
{
sm_log.Info("Rendering glyphs");
var objects = Solution.GetObjects<Glyph>();
foreach (var obj in objects)
{
RenderObject(obj, Sidebar.Glyphs, Sidebar.Glyphs[obj.Type]);
}
}
19
Source : Form1.cs
with MIT License
from gtw123
with MIT License
from gtw123
private void SolvePuzzle(Screenreplacedyzer replacedyzer)
{
try
{
var screen = replacedyzer.replacedyze();
var solver = new PuzzleSolver(screen.GetPuzzle());
var solution = solver.Solve();
new SolutionRenderer(solution, screen).Render();
}
catch (AbortException)
{
sm_log.Info("Solution aborted");
}
catch (replacedysisException e)
{
HandleError("A problem occurred while replacedyzing the screen. Please ensure a puzzle is open." +
Environment.NewLine + Environment.NewLine + "Error message: " + e.Message, e);
}
catch (SolverException e)
{
HandleError("Unable to solve this puzzle: " + e.Message, e);
}
catch (RenderException e)
{
HandleError("A problem occurred while rendering the solution: " + e.Message, e);
}
catch (Exception e)
{
HandleError("Internal error: " + e.ToString(), e);
}
}
19
Source : Application.cs
with BSD 3-Clause "New" or "Revised" License
from HalcyonGrid
with BSD 3-Clause "New" or "Revised" License
from HalcyonGrid
public static void Main(string[] args)
{
// Under any cirreplacedstance other than an explicit exit the exit code should be 1.
Environment.ExitCode = 1;
// First line, hook the appdomain to the crash reporter
AppDomain.CurrentDomain.UnhandledException +=
new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
ServicePointManager.DefaultConnectionLimit = 12;
// Add the arguments supplied when running the application to the configuration
var configSource = new ArgvConfigSource(args);
configSource.AddSwitch("Startup", "pidfile");
var pidFile = new PIDFileManager(configSource.Configs["Startup"].GetString("pidfile", string.Empty));
pidFile.SetStatus(PIDFileManager.Status.Starting);
// Configure Log4Net
configSource.AddSwitch("Startup", "logconfig");
string logConfigFile = configSource.Configs["Startup"].GetString("logconfig", String.Empty);
if (!String.IsNullOrEmpty(logConfigFile))
{
XmlConfigurator.Configure(new System.IO.FileInfo(logConfigFile));
m_log.InfoFormat("[HALCYON MAIN]: configured log4net using \"{0}\" as configuration file",
logConfigFile);
}
else
{
XmlConfigurator.Configure();
m_log.Info("[HALCYON MAIN]: configured log4net using default Halcyon.exe.config");
}
m_log.Info("Performing compatibility checks... ");
string supported = String.Empty;
if (Util.IsEnvironmentSupported(ref supported))
{
m_log.Info("Environment is compatible.\n");
}
else
{
m_log.Warn("Environment is unsupported (" + supported + ")\n");
}
// Configure nIni aliases and localles
Culture.SetCurrentCulture();
configSource.Alias.AddAlias("On", true);
configSource.Alias.AddAlias("Off", false);
configSource.Alias.AddAlias("True", true);
configSource.Alias.AddAlias("False", false);
configSource.Alias.AddAlias("Yes", true);
configSource.Alias.AddAlias("No", false);
configSource.AddSwitch("Startup", "background");
configSource.AddSwitch("Startup", "inifile");
configSource.AddSwitch("Startup", "inimaster");
configSource.AddSwitch("Startup", "inidirectory");
configSource.AddSwitch("Startup", "gridmode");
configSource.AddSwitch("Startup", "physics");
configSource.AddSwitch("Startup", "gui");
configSource.AddSwitch("Startup", "console");
configSource.AddSwitch("Startup", "save_crashes");
configSource.AddSwitch("Startup", "crash_dir");
configSource.AddConfig("StandAlone");
configSource.AddConfig("Network");
// Check if we're running in the background or not
bool background = configSource.Configs["Startup"].GetBoolean("background", false);
// Check if we're saving crashes
m_saveCrashDumps = configSource.Configs["Startup"].GetBoolean("save_crashes", false);
// load Crash directory config
m_crashDir = configSource.Configs["Startup"].GetString("crash_dir", m_crashDir);
if (background)
{
m_sim = new OpenSimBackground(configSource);
pidFile.SetStatus(PIDFileManager.Status.Running);
m_sim.Startup();
}
else
{
m_sim = new OpenSim(configSource);
m_sim.Startup();
pidFile.SetStatus(PIDFileManager.Status.Running);
while (true)
{
try
{
// Block thread here for input
MainConsole.Instance.Prompt();
}
catch (Exception e)
{
m_log.ErrorFormat("Command error: {0}", e);
}
}
}
}
19
Source : LogOutputListener.cs
with BSD 3-Clause "New" or "Revised" License
from HalcyonGrid
with BSD 3-Clause "New" or "Revised" License
from HalcyonGrid
public void Info(string message)
{
_log.Info("[Phlox]: " + message);
}
19
Source : PhysxScene.cs
with BSD 3-Clause "New" or "Revised" License
from HalcyonGrid
with BSD 3-Clause "New" or "Revised" License
from HalcyonGrid
public override void Initialize(IMesher meshmerizer, Nini.Config.IConfigSource config, OpenMetaverse.UUID regionId)
{
_regionId = regionId;
_mesher = meshmerizer;
m_log.Info("[InWorldz.PhysxPhysics] Creating PhysX scene");
if (config.Configs["InWorldz.PhysxPhysics"] != null)
{
Settings.Instance.UseVisualDebugger = config.Configs["InWorldz.PhysxPhysics"].GetBoolean("use_visual_debugger", false);
Settings.Instance.UseCCD = config.Configs["InWorldz.PhysxPhysics"].GetBoolean("use_ccd", true);
Settings.Instance.Gravity = config.Configs["InWorldz.PhysxPhysics"].GetFloat("gravity", -9.8f);
Settings.Instance.ThrowOnSdkError = config.Configs["InWorldz.PhysxPhysics"].GetBoolean("throw_on_sdk_error", false);
Settings.Instance.InstrumentMeshing = config.Configs["InWorldz.PhysxPhysics"].GetBoolean("instrument_meshing", false);
}
else
{
Settings.Instance.UseVisualDebugger = false;
Settings.Instance.UseCCD = true;
Settings.Instance.Gravity = -9.8f;
Settings.Instance.ThrowOnSdkError = false;
Settings.Instance.InstrumentMeshing = false;
}
Nini.Config.IConfig startupcfg = config.Configs["Startup"];
if (startupcfg != null)
_gridmode = startupcfg.GetBoolean("gridmode", false);
if (_foundation == null)
{
_foundation = new PhysX.Foundation(s_ErrorCallback);
_physics = new PhysX.Physics(_foundation);
Material.BuiltinMaterialInit(_physics);
}
_sceneDesc = new PhysX.SceneDesc(null, Settings.Instance.UseCCD);
_sceneDesc.Gravity = new PhysX.Math.Vector3(0f, 0f, Settings.Instance.Gravity);
_simEventDelegator = new SimulationEventCallbackDelegator();
_simEventDelegator.OnContactCallback += this.OnContact;
_simEventDelegator.OnTriggerCallback += this.OnTrigger;
_sceneDesc.SimulationEventCallback = _simEventDelegator;
_scene = _physics.CreateScene(_sceneDesc);
Preload();
if (Settings.Instance.UseCCD)
{
_scene.SetFlag(PhysX.SceneFlag.SweptIntegration, true);
}
if (Settings.Instance.UseVisualDebugger && _physics.RemoteDebugger != null)
{
_physics.RemoteDebugger.Connect("localhost", null, null, PhysX.VisualDebugger.VisualDebuggerConnectionFlag.Debug, null);
}
_controllerManager = _scene.CreateControllerManager();
CreateDefaults();
_terrainMesher = new Meshing.TerrainMesher(_scene);
_terrainMgr = new TerrainManager(_scene, _terrainMesher, regionId);
_meshingStage = new Meshing.MeshingStage(_scene, meshmerizer, _terrainMesher);
_meshingStage.OnShapeNeedsFreeing += new Meshing.MeshingStage.ShapeNeedsFreeingDelegate(_meshingStage_OnShapeNeedsFreeing);
_kinematicManager = new KinematicManager();
//fire up our work loop
HeartbeatThread = Watchdog.StartThread(new ThreadStart(Heartbeat), "Physics Heartbeat",
ThreadPriority.Normal, false);
TimingThread = Watchdog.StartThread(new ThreadStart(DoTiming), string.Format("Physics Timing"),
ThreadPriority.Highest, false);
}
19
Source : PhysxScene.cs
with BSD 3-Clause "New" or "Revised" License
from HalcyonGrid
with BSD 3-Clause "New" or "Revised" License
from HalcyonGrid
public override void SetStartupTerrain(float[] heightMap, int revision)
{
m_log.Info("[InWorldz.PhysxPhysics] Setting starup terrain");
this.QueueCommand(new Commands.SetTerrainCmd(heightMap, true, revision));
}
19
Source : RemoteAdmin.cs
with BSD 3-Clause "New" or "Revised" License
from HalcyonGrid
with BSD 3-Clause "New" or "Revised" License
from HalcyonGrid
public void AddHandler(BaseHttpServer server)
{
m_log.Info("[RADMIN]: Remote Admin CoreInit");
server.AddStreamHandler(new XmlRpcStreamHandler("POST", Util.XmlRpcRequestPrefix("RemoteAdmin"), XmlRpcCommand));
}
19
Source : RemoteAdminPlugin.cs
with BSD 3-Clause "New" or "Revised" License
from HalcyonGrid
with BSD 3-Clause "New" or "Revised" License
from HalcyonGrid
public void Initialize()
{
m_log.Info("[RADMIN]: " + Name + " cannot be default-initialized!");
throw new PluginNotInitializedException(Name);
}
19
Source : MySQLGridData.cs
with BSD 3-Clause "New" or "Revised" License
from HalcyonGrid
with BSD 3-Clause "New" or "Revised" License
from HalcyonGrid
override public void Initialize()
{
m_log.Info("[MySQLGridData]: " + Name + " cannot be default-initialized!");
throw new PluginNotInitializedException (Name);
}
19
Source : MySQLGridData.cs
with BSD 3-Clause "New" or "Revised" License
from HalcyonGrid
with BSD 3-Clause "New" or "Revised" License
from HalcyonGrid
override public void Initialize(string connect)
{
m_log.Info("[MySQLGridData.InWorldz]: Starting up");
_connFactory = new ConnectionFactory("MySQL", connect);
using (ISimpleDB db = _connFactory.GetConnection())
{
m_log.Info("[MySQLGridData.InWorldz]: Sucessfully made connection to database");
}
}
19
Source : OpenSimBase.cs
with BSD 3-Clause "New" or "Revised" License
from HalcyonGrid
with BSD 3-Clause "New" or "Revised" License
from HalcyonGrid
public void ProcessLogin(bool LoginEnabled)
{
if (LoginEnabled)
{
m_log.Info("[LOGIN]: Login is now enabled.");
m_commsManager.GridService.RegionLoginsEnabled = true;
}
else
{
m_log.Info("[LOGIN]: Login is now disabled.");
m_commsManager.GridService.RegionLoginsEnabled = false;
}
}
19
Source : OpenSimBase.cs
with BSD 3-Clause "New" or "Revised" License
from HalcyonGrid
with BSD 3-Clause "New" or "Revised" License
from HalcyonGrid
private IClientNetworkServer CreateRegion(RegionInfo regionInfo, bool portadd_flag, bool do_post_init, out IScene mscene)
{
int port = regionInfo.InternalEndPoint.Port;
// set initial RegionID to originRegionID in RegionInfo. (it needs for loding prims)
// Commented this out because otherwise regions can't register with
// the grid as there is already another region with the same UUID
// at those coordinates. This is required for the load balancer to work.
// --Mike, 2009.02.25
//regionInfo.originRegionID = regionInfo.RegionID;
// set initial ServerURI
regionInfo.HttpPort = m_httpServerPort;
regionInfo.osSecret = m_osSecret;
if (!String.IsNullOrEmpty(proxyUrl) && (portadd_flag))
{
// set proxy url to RegionInfo
regionInfo.proxyUrl = proxyUrl;
regionInfo.ProxyOffset = proxyOffset;
Util.XmlRpcCommand(proxyUrl, "AddPort", port, port + proxyOffset, regionInfo.ExternalHostName);
}
IClientNetworkServer clientServer;
Scene scene = SetupScene(regionInfo, proxyOffset, m_config.Source, out clientServer);
m_log.Info("[MODULES]: Loading Region's modules (old style)");
List<IRegionModule> modules = m_moduleLoader.PickupModules(scene, ".");
// This needs to be ahead of the script engine load, so the
// script module can pick up events exposed by a module
m_moduleLoader.InitializeSharedModules(scene);
// Use this in the future, the line above will be deprecated soon
m_log.Info("[MODULES]: Loading Region's modules (new style)");
IRegionModulesController controller;
if (ApplicationRegistry.TryGet(out controller))
{
controller.AddRegionToModules(scene);
}
else m_log.Error("[MODULES]: The new RegionModulesController is missing...");
// Check if a (any) permission module has been loaded.
// This can be any permissions module, including the default PermissionsModule with m_bypreplacedPermissions==true.
// To disable permissions, specify [Startup] permissionmodules=DefaultPermissionsModule in the .ini file, and
// serverside_object_permissions=false, optionally propagate_permissions=false.
if (!scene.Permissions.IsAvailable())
{
m_log.Error("[MODULES]: Permissions module is not set, or set incorrectly.");
Environment.Exit(1);
// Note that an Exit here can trigger a PhysX exception but if that happens it is the result of this
// permissions problem and hopefully the lot will show this error and intentional exit.
}
scene.SetModuleInterfaces();
// this must be done before prims try to rez or they'll rez over no land
scene.loadAllLandObjectsFromStorage(regionInfo.originRegionID);
//we need to fire up the scene here. physics may depend ont he heartbeat running
scene.Start();
// Prims have to be loaded after module configuration since some modules may be invoked during the load
scene.LoadPrimsFromStorage(regionInfo.originRegionID);
// moved these here as the terrain texture has to be created after the modules are initialized
// and has to happen before the region is registered with the grid.
scene.CreateTerrainTexture(false);
try
{
scene.RegisterRegionWithGrid();
}
catch (Exception e)
{
m_log.ErrorFormat("[STARTUP]: Registration of region with grid failed, aborting startup - {0}", e);
// Carrying on now causes a lot of confusion down the
// line - we need to get the user's attention
Environment.Exit(1);
}
// We need to do this after we've initialized the
// scripting engines.
scene.CreateScriptInstances();
scene.EventManager.TriggerParcelPrimCountUpdate();
m_sceneManager.Add(scene);
if (m_autoCreateClientStack)
{
m_clientServers.Add(clientServer);
clientServer.Start();
}
if (do_post_init)
{
foreach (IRegionModule module in modules)
{
module.PostInitialize();
}
}
scene.EventManager.OnShutdown += delegate() { ShutdownRegion(scene); };
mscene = scene;
return clientServer;
}
19
Source : OpenSimBase.cs
with BSD 3-Clause "New" or "Revised" License
from HalcyonGrid
with BSD 3-Clause "New" or "Revised" License
from HalcyonGrid
public override void ShutdownSpecific()
{
if (!String.IsNullOrEmpty(proxyUrl))
{
Util.XmlRpcCommand(proxyUrl, "Stop");
}
try
{
m_log.Info("[SHUTDOWN]: Closing scene manager");
m_sceneManager.Close();
}
catch (Exception e)
{
m_log.ErrorFormat("[SHUTDOWN]: Ignoring failure during shutdown - {0}", e);
}
try
{
m_log.Info("[SHUTDOWN]: Disposing replacedet cache and services");
m_replacedetCache.Dispose();
}
catch (Exception e)
{
m_log.ErrorFormat("[SHUTDOWN]: Ignoring failure during shutdown - {0}", e);
}
}
19
Source : LLClientStackModule.cs
with BSD 3-Clause "New" or "Revised" License
from HalcyonGrid
with BSD 3-Clause "New" or "Revised" License
from HalcyonGrid
public void PostInitialize()
{
if ((m_scene != null) && (m_createClientStack))
{
m_log.Info("[LLClientStackModule] Starting up LLClientStack.");
IPEndPoint endPoint = m_scene.RegionInfo.InternalEndPoint;
uint port = (uint)endPoint.Port;
m_clientStackManager = new ClientStackManager(m_clientStackDll);
m_clientServer
= m_clientStackManager.CreateServer(endPoint.Address,
ref port, m_scene.RegionInfo.ProxyOffset, m_scene.RegionInfo.m_allow_alternate_ports, m_source,
m_scene.CommsManager.replacedetCache);
m_clientServer.AddScene(m_scene);
m_clientServer.Start();
}
}
19
Source : LLStandaloneLoginService.cs
with BSD 3-Clause "New" or "Revised" License
from HalcyonGrid
with BSD 3-Clause "New" or "Revised" License
from HalcyonGrid
public override UserProfileData GetTheUser(string firstname, string lastname)
{
UserProfileData profile = m_userManager.GetUserProfile(firstname, lastname);
if (profile != null)
{
return profile;
}
if (!m_authUsers)
{
//no current user account so make one
m_log.Info("[LOGIN]: No user account found so creating a new one.");
m_userManager.AddUser(firstname, lastname, "test", String.Empty, m_defaultHomeX, m_defaultHomeY);
return m_userManager.GetUserProfile(firstname, lastname);
}
return null;
}
19
Source : LLStandaloneLoginService.cs
with BSD 3-Clause "New" or "Revised" License
from HalcyonGrid
with BSD 3-Clause "New" or "Revised" License
from HalcyonGrid
public override bool AuthenticateUser(UserProfileData profile, string preplacedword)
{
if (!m_authUsers)
{
//for now we will accept any preplacedword in sandbox mode
m_log.Info("[LOGIN]: Authorising user (no actual preplacedword check)");
return true;
}
else
{
m_log.Info(
"[LOGIN]: Authenticating " + profile.FirstName + " " + profile.SurName);
if (!preplacedword.StartsWith("$1$"))
preplacedword = "$1$" + Util.Md5Hash(preplacedword);
preplacedword = preplacedword.Remove(0, 3); //remove $1$
string s = Util.Md5Hash(preplacedword + ":" + profile.PreplacedwordSalt);
bool loginresult = (profile.PreplacedwordHash.Equals(s.ToString(), StringComparison.InvariantCultureIgnoreCase)
|| profile.PreplacedwordHash.Equals(preplacedword, StringComparison.InvariantCultureIgnoreCase));
return loginresult;
}
}
19
Source : WHIPAssetClient.cs
with BSD 3-Clause "New" or "Revised" License
from HalcyonGrid
with BSD 3-Clause "New" or "Revised" License
from HalcyonGrid
public virtual void LoadDefaultreplacedets(string preplacedetSetsXml)
{
_log.Info("[replacedET SERVER]: Setting up replacedet database");
var signpostMarkerFilename = $"{preplacedetSetsXml}.loaded";
if (File.Exists(signpostMarkerFilename))
{
_log.Info("[replacedET SERVER]: replacedet database marked as already set up. Not reloading default replacedets.");
}
else
{
_loadingDefaultreplacedets = true;
replacedetLoader.ForEachDefaultXmlreplacedet(preplacedetSetsXml, Storereplacedet);
_loadingDefaultreplacedets = false;
try
{
File.CreateText(signpostMarkerFilename).Close();
}
catch(Exception e)
{
_log.Error($"Unable to create file '{signpostMarkerFilename}' to mark default replacedets as having been already loaded.", e);
}
}
}
19
Source : RegionClient.cs
with BSD 3-Clause "New" or "Revised" License
from HalcyonGrid
with BSD 3-Clause "New" or "Revised" License
from HalcyonGrid
public bool DoCreateChildAgentCall(RegionInfo region, AgentCircuitData aCircuit, string authKey, out string reason)
{
// Eventually, we want to use a caps url instead of the agentID
string uri = "http://" + region.ExternalHostName + ":" + region.HttpPort + "/agent/" + aCircuit.AgentID + "/";
//Console.WriteLine(" >>> DoCreateChildAgentCall <<< " + uri);
HttpWebRequest AgentCreateRequest = (HttpWebRequest)WebRequest.Create(uri);
AgentCreateRequest.Method = "POST";
AgentCreateRequest.ContentType = "application/json";
AgentCreateRequest.Timeout = 10000;
//AgentCreateRequest.KeepAlive = false;
AgentCreateRequest.Headers["authorization"] = GenerateAuthorization();
reason = String.Empty;
// Fill it in
OSDMap args = null;
try
{
args = aCircuit.PackAgentCircuitData();
}
catch (Exception e)
{
m_log.Debug("[REST COMMS]: PackAgentCircuitData failed with exception: " + e.Message);
reason = "PackAgentCircuitData exception";
return false;
}
// Add the regionhandle of the destination region
ulong regionHandle = GetRegionHandle(region.RegionHandle);
args["destination_handle"] = OSD.FromString(regionHandle.ToString());
string strBuffer = String.Empty;
byte[] buffer = new byte[1];
try
{
strBuffer = OSDParser.SerializeJsonString(args);
UTF8Encoding str = new UTF8Encoding();
buffer = str.GetBytes(strBuffer);
}
catch (Exception e)
{
m_log.WarnFormat("[REST COMMS]: Exception thrown on serialization of ChildCreate: {0}", e.Message);
// ignore. buffer will be empty, caller should check.
}
Stream os = null;
try
{ // send the Post
AgentCreateRequest.ContentLength = buffer.Length; //Count bytes to send
os = AgentCreateRequest.GetRequestStream();
os.Write(buffer, 0, strBuffer.Length); //Send it
os.Close();
//m_log.InfoFormat("[REST COMMS]: Posted CreateChildAgent request to remote sim {0}", uri);
}
//catch (WebException ex)
catch
{
//m_log.InfoFormat("[REST COMMS]: Bad send on ChildAgentUpdate {0}", ex.Message);
reason = "cannot contact remote region";
return false;
}
// Let's wait for the response
//m_log.Info("[REST COMMS]: Waiting for a reply after DoCreateChildAgentCall");
try
{
WebResponse webResponse = AgentCreateRequest.GetResponse();
if (webResponse == null)
{
m_log.Info("[REST COMMS]: Null reply on DoCreateChildAgentCall post");
reason = "response is null";
return false;
}
StreamReader sr = new StreamReader(webResponse.GetResponseStream());
string response = sr.ReadToEnd().Trim();
sr.Close();
m_log.InfoFormat("[REST COMMS]: DoCreateChildAgentCall reply was {0} ", response);
if (String.IsNullOrEmpty(response))
{
reason = "response is empty";
return false;
}
try
{
// we replacedume we got an OSDMap back
OSDMap r = GetOSDMap(response);
bool success = r["success"].AsBoolean();
reason = r["reason"].replacedtring();
return success;
}
catch (NullReferenceException e)
{
m_log.InfoFormat("[REST COMMS]: exception on reply of DoCreateChildAgentCall {0}", e.Message);
// check for old style response
if (response.ToLower().StartsWith("true"))
return true;
reason = "null reference exception";
return false;
}
}
catch (WebException ex)
{
m_log.InfoFormat("[REST COMMS]: exception on reply of DoCreateChildAgentCall {0}", ex.Message);
reason = "web exception";
return false;
}
}
19
Source : RegionClient.cs
with BSD 3-Clause "New" or "Revised" License
from HalcyonGrid
with BSD 3-Clause "New" or "Revised" License
from HalcyonGrid
public bool DoDeleteObject2Call(RegionInfo region, UUID sogId, long nonceID)
{
ulong regionHandle = GetRegionHandle(region.RegionHandle);
string uri = "http://" + region.ExternalHostName + ":" + region.HttpPort + "/object2/" + sogId + "/" + regionHandle.ToString() + "/";
HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(uri);
request.Method = "DELETE";
request.Timeout = CREATE_OBJECT_TIMEOUT;
request.ReadWriteTimeout = CREATE_OBJECT_TIMEOUT;
request.Headers["authorization"] = GenerateAuthorization();
request.Headers["x-nonce-id"] = nonceID.ToString();
try
{
WebResponse webResponse = request.GetResponse();
if (webResponse == null)
{
m_log.Info("[REST COMMS]: Null reply on remote object delete ");
return false;
}
StreamReader sr = new StreamReader(webResponse.GetResponseStream());
//reply = sr.ReadToEnd().Trim();
sr.ReadToEnd().Trim();
sr.Close();
//m_log.InfoFormat("[REST COMMS]: DoDeleteObject2Call reply was {0} ", reply);
return true;
}
catch (WebException ex)
{
m_log.InfoFormat("[REST COMMS]: exception on reply of remote object delete {0}", ex.Message);
}
return false;
}
19
Source : RegionClient.cs
with BSD 3-Clause "New" or "Revised" License
from HalcyonGrid
with BSD 3-Clause "New" or "Revised" License
from HalcyonGrid
public bool SendUpdateEstateInfo(RegionInfo region)
{
string uri = "http://" + region.ExternalHostName + ":" + region.HttpPort + "/region/" + region.RegionID + "/" + region.RegionHandle + "/UpdateEstateInfo/";
//m_log.Debug(" >>> DoSendUpdateEstateInfoCall <<< " + uri);
WebRequest sendUpdateEstateInfoRequest = WebRequest.Create(uri);
sendUpdateEstateInfoRequest.Method = "POST";
sendUpdateEstateInfoRequest.ContentType = "application/json";
sendUpdateEstateInfoRequest.Timeout = 10000;
sendUpdateEstateInfoRequest.Headers["authorization"] = GenerateAuthorization();
// Fill it in
OSDMap args = new OSDMap();
string strBuffer = String.Empty;
byte[] buffer = new byte[1];
try
{
strBuffer = OSDParser.SerializeJsonString(args);
UTF8Encoding str = new UTF8Encoding();
buffer = str.GetBytes(strBuffer);
}
catch (Exception e)
{
m_log.WarnFormat("[REST COMMS]: Exception thrown on serialization of DoSendUpdateEstateInfoCall: {0}", e.Message);
// ignore. buffer will be empty, caller should check.
}
Stream os = null;
try
{ // send the Post
sendUpdateEstateInfoRequest.ContentLength = buffer.Length; //Count bytes to send
os = sendUpdateEstateInfoRequest.GetRequestStream();
os.Write(buffer, 0, strBuffer.Length); //Send it
os.Close();
//m_log.InfoFormat("[REST COMMS]: Posted DoSendUpdateEstateInfoCall request to remote sim {0}", uri);
}
//catch (WebException ex)
catch
{
//m_log.InfoFormat("[REST COMMS]: Bad send on DoSendUpdateEstateInfoCall {0}", ex.Message);
return false;
}
// Let's wait for the response
//m_log.Info("[REST COMMS]: Waiting for a reply after DoSendUpdateEstateInfoCall");
try
{
WebResponse webResponse = sendUpdateEstateInfoRequest.GetResponse();
if (webResponse == null)
{
m_log.Info("[REST COMMS]: Null reply on DoSendUpdateEstateInfoCall post");
return false;
}
StreamReader sr = new StreamReader(webResponse.GetResponseStream());
//reply = sr.ReadToEnd().Trim();
sr.ReadToEnd().Trim();
sr.Close();
//m_log.InfoFormat("[REST COMMS]: DoSendUpdateEstateInfoCall reply was {0} ", reply);
return true;
}
catch (WebException ex)
{
m_log.InfoFormat("[REST COMMS]: exception on reply of DoSendUpdateEstateInfoCall {0}", ex.Message);
}
return false;
}
19
Source : RemoteAdminPlugin.cs
with BSD 3-Clause "New" or "Revised" License
from HalcyonGrid
with BSD 3-Clause "New" or "Revised" License
from HalcyonGrid
public object RegionShutdownHandler(IList args, IPEndPoint remoteClient)
{
m_admin.CheckSessionValid(new UUID((string)args[0]));
if (countdownTimeEnd > 0)
{
throw new Exception("remote shutdown already in progress");
}
if (countdownTimeEnd > 0)
{
throw new Exception("remote shutdown already in progress");
}
string regionIDInput = "";
int delay = 30;
// Make the region ID and delay optional. Though if both are sepcified they have to be in order of ID then delay.
// Note that there are always more entries in the args array than were sent.
if (args[1] is Int32) // Delay was provided.
{
delay = Math.Max(0, Convert.ToInt32(args[1]));
// And region ID is not expected.
}
else if (args[1] is String) // Region ID was provided.
{
regionIDInput = Convert.ToString(args[1]);
// Try for both entries.
if (args.Count >= 3 && args[2] is Int32)
{
delay = Math.Max(0, Convert.ToInt32(args[2]));
}
// else Only the region ID was specified.
}
try
{
string message;
if (regionIDInput.Length > 0)
{
var regionID = new UUID(regionIDInput);
if (!m_app.SceneManager.TryGetScene(regionID, out rebootedScene))
throw new Exception("Region not found");
}
else
{
rebootedScene = m_app.SceneManager.CurrentOrFirstScene;
}
message = GenerateShutdownMessage(delay);
m_log.DebugFormat("[RADMIN] Shutdown: {0}", message);
IDialogModule dialogModule = rebootedScene.RequestModuleInterface<IDialogModule>();
if (dialogModule != null)
dialogModule.SendGeneralAlert(message);
// Do the countdown in a timer so the actual shutdown call returns successfully and immediately.
countdownTimeNow = Util.GetLongTickCount();
countdownTimeEnd = countdownTimeNow + (ulong)delay * 1000UL;
shutdownCounter = new Timer(800); // Fine enough resolution to always hit a 1 second window.
shutdownCounter.AutoReset = true;
shutdownCounter.Elapsed += OnTimedShutdown;
shutdownCounter.Start();
}
catch (Exception e)
{
m_log.ErrorFormat("[RADMIN] Shutdown: failed: {0}", e.Message);
m_log.DebugFormat("[RADMIN] Shutdown: failed: {0}", e.ToString());
throw;
}
m_log.Info("[RADMIN]: Shutdown Administrator Request complete");
return true;
}
19
Source : RemoteAdminPlugin.cs
with BSD 3-Clause "New" or "Revised" License
from HalcyonGrid
with BSD 3-Clause "New" or "Revised" License
from HalcyonGrid
public object LoadOARHandler(IList args, IPEndPoint remoteClient)
{
m_admin.CheckSessionValid(new UUID((string)args[0]));
Scene scene;
if (!m_app.SceneManager.TryGetScene((string)args[1], out scene))
throw new Exception("region not found");
String filename = (string)args[2];
bool allowUserRereplacedignment = Convert.ToBoolean(args[3]);
bool skipErrorGroups = Convert.ToBoolean(args[4]);
bool debug = false;
if (args.Count > 5)
debug = Convert.ToBoolean(args[5]);
m_log.Info("[RADMIN]: Received Load OAR Administrator Request");
lock (rslock)
{
try
{
IRegionArchiverModule archiver = scene.RequestModuleInterface<IRegionArchiverModule>();
if (archiver != null)
archiver.DearchiveRegion(filename, allowUserRereplacedignment, skipErrorGroups, null);
else
throw new Exception("Archiver module not present for scene");
m_log.Info("[RADMIN]: Load OAR Administrator Request complete");
return true;
}
catch (Exception e)
{
m_log.InfoFormat("[RADMIN] LoadOAR: {0}", e.Message);
m_log.DebugFormat("[RADMIN] LoadOAR: {0}", e.ToString());
}
return false;
}
}
19
Source : RemoteAdminPlugin.cs
with BSD 3-Clause "New" or "Revised" License
from HalcyonGrid
with BSD 3-Clause "New" or "Revised" License
from HalcyonGrid
public object SaveOARHandler(IList args, IPEndPoint remoteClient)
{
m_admin.CheckSessionValid(new UUID((string)args[0]));
Scene scene;
if (!m_app.SceneManager.TryGetScene((string)args[1], out scene))
throw new Exception("region not found");
String filename = (string)args[2];
bool storereplacedets = Convert.ToBoolean(args[3]);
m_log.Info("[RADMIN]: Received Save OAR Administrator Request");
lock (rslock)
{
try
{
IRegionArchiverModule archiver = scene.RequestModuleInterface<IRegionArchiverModule>();
if (archiver != null)
archiver.ArchiveRegion(filename, storereplacedets);
else
throw new Exception("Archiver module not present for scene");
m_log.Info("[RADMIN]: Save OAR Administrator Request complete");
return true;
}
catch (Exception e)
{
m_log.InfoFormat("[RADMIN] LoadOAR: {0}", e.Message);
m_log.DebugFormat("[RADMIN] LoadOAR: {0}", e.ToString());
}
return false;
}
}
19
Source : RemoteAdminPlugin.cs
with BSD 3-Clause "New" or "Revised" License
from HalcyonGrid
with BSD 3-Clause "New" or "Revised" License
from HalcyonGrid
public object RegionBackupHandler(IList args, IPEndPoint remoteClient)
{
m_admin.CheckSessionValid(new UUID((string)args[0]));
String regionName = (string)args[1];
String filename = (string)args[2];
bool storereplacedets = Convert.ToBoolean(args[3]);
m_log.Info("[RADMIN]: Received Region Backup (SaveExplicitOAR) Administrator Request");
lock (rslock)
{
try
{
m_app.SceneManager.SaveExplicitOar(regionName, filename, storereplacedets);
m_log.Info("[RADMIN]: Save OAR Administrator Request complete");
return true;
}
catch (Exception e)
{
m_log.ErrorFormat("[RADMIN] SaveOAR: {0}", e.ToString());
}
return false;
}
}
19
Source : RemoteAdminPlugin.cs
with BSD 3-Clause "New" or "Revised" License
from HalcyonGrid
with BSD 3-Clause "New" or "Revised" License
from HalcyonGrid
public object RegionRestoreHandler(IList args, IPEndPoint remoteClient)
{
m_admin.CheckSessionValid(new UUID((string)args[0]));
Scene scene;
if (!m_app.SceneManager.TryGetScene((string)args[1], out scene))
throw new Exception("region not found");
String filename = (string)args[2];
bool allowUserRereplacedignment = Convert.ToBoolean(args[3]);
bool skipErrorGroups = Convert.ToBoolean(args[4]);
bool debug = false;
if (args.Count > 5)
debug = Convert.ToBoolean(args[5]);
m_log.Info("[RADMIN]: Received Region Restore Administrator Request");
lock (rslock)
{
try
{
IRegionArchiverModule archiver = scene.RequestModuleInterface<IRegionArchiverModule>();
if (archiver != null)
archiver.DearchiveRegion(filename, allowUserRereplacedignment, skipErrorGroups, null);
else
throw new Exception("Archiver module not present for scene");
m_log.Info("[RADMIN]: Load OAR Administrator Request complete");
return true;
}
catch (Exception e)
{
m_log.InfoFormat("[RADMIN] LoadOAR: {0}", e.Message);
m_log.DebugFormat("[RADMIN] LoadOAR: {0}", e.ToString());
}
return false;
}
}
19
Source : RemoteAdminPlugin.cs
with BSD 3-Clause "New" or "Revised" License
from HalcyonGrid
with BSD 3-Clause "New" or "Revised" License
from HalcyonGrid
public object RegionChangeParcelFlagsHandler(IList args, IPEndPoint remoteClient)
{
m_admin.CheckSessionValid(new UUID((string)args[0]));
Scene scene;
if (!m_app.SceneManager.TryGetScene((string)args[1], out scene))
throw new Exception("region not found");
bool enable = args[2].ToString().ToLower() == "enable";
uint mask = Convert.ToUInt32(args[3]);
m_log.Info("[RADMIN]: Received Region Change Parcel Flags Request");
lock (rslock)
{
try
{
ILandChannel channel = scene.LandChannel;
List<ILandObject> parcels = channel.AllParcels();
foreach (var parcel in parcels)
{
LandData data = parcel.landData.Copy();
if (enable)
{
data.Flags = data.Flags | mask;
}
else
{
data.Flags = data.Flags & ~mask;
}
scene.LandChannel.UpdateLandObject(parcel.landData.LocalID, data);
}
m_log.Info("[RADMIN]: Change Parcel Flags Request complete");
return true;
}
catch (Exception e)
{
m_log.InfoFormat("[RADMIN] ChangeParcelFlags: {0}", e.Message);
m_log.DebugFormat("[RADMIN] ChangeParcelFlags: {0}", e.ToString());
}
return false;
}
}
19
Source : FreeswitchVoiceModule.cs
with BSD 3-Clause "New" or "Revised" License
from HalcyonGrid
with BSD 3-Clause "New" or "Revised" License
from HalcyonGrid
public void Initialize(IConfigSource config)
{
m_config = config.Configs["FreeSwitchVoice"];
if (null == m_config || !m_config.GetBoolean("enabled", false))
{
m_log.Info("[FreeSwitchVoice] config missing or disabled, disabling");
return;
}
try
{
m_accountService = m_config.GetString("account_service", String.Empty);
m_enabled = m_config.GetBoolean("enabled", false);
if (m_enabled)
{
m_log.InfoFormat("[FreeSwitchVoice] using FreeSwitch MGMT gateway: {0}", m_accountService);
}
else
{
m_log.Info("[FreeSwitchVoice] plugin enabled");
}
}
catch (Exception e)
{
m_log.ErrorFormat("[FreeSwitchVoice] plugin initialization failed: {0}", e.Message);
m_log.DebugFormat("[FreeSwitchVoice] plugin initialization failed: {0}", e.ToString());
return;
}
try
{
XmlElement resp = NetworkCall(m_accountService);
XmlNodeList dirs = resp.GetElementsByTagName("Realm");
XmlNode node = dirs[0];
m_log.InfoFormat("[FreeSwitchVoice] using FreeSwitch realm {0}", node.InnerText);
m_realm = node.InnerText;
dirs = resp.GetElementsByTagName("APIPrefix");
node = dirs[0];
m_log.InfoFormat("[FreeSwitchVoice] using FreeSwitch client endpoint: {0}/{1}", m_realm, node.InnerText);
m_apiPrefix = node.InnerText;
}
catch (Exception e)
{
m_enabled = false;
m_log.ErrorFormat("[FreeSwitchVoice] plugin initialization failed: {0}", e.Message);
}
}
19
Source : CreateCommsManagerPlugin.cs
with BSD 3-Clause "New" or "Revised" License
from HalcyonGrid
with BSD 3-Clause "New" or "Revised" License
from HalcyonGrid
public void Initialize()
{
m_log.Info("[LOADREGIONS]: " + Name + " cannot be default-initialized!");
throw new PluginNotInitializedException(Name);
}
19
Source : LoadRegionsPlugin.cs
with BSD 3-Clause "New" or "Revised" License
from HalcyonGrid
with BSD 3-Clause "New" or "Revised" License
from HalcyonGrid
public void PostInitialize()
{
//m_log.Info("[LOADREGIONS]: Load Regions addin being initialized");
IRegionLoader regionLoader;
if (m_openSim.ConfigSource.Source.Configs["Startup"].GetString("region_info_source", "filesystem") == "filesystem")
{
m_log.Info("[LOADREGIONS]: Loading region configurations from filesystem");
regionLoader = new RegionLoaderFileSystem();
}
else
{
m_log.Info("[LOADREGIONSPLUGIN]: Loading region configurations from web");
regionLoader = new RegionLoaderWebServer();
}
regionLoader.SetIniConfigSource(m_openSim.ConfigSource.Source);
RegionInfo[] regionsToLoad = regionLoader.LoadRegions();
m_openSim.ModuleLoader.LoadDefaultSharedModule(new DynamicTextureModule());
m_openSim.ModuleLoader.LoadDefaultSharedModule(new InstantMessageModule());
m_openSim.ModuleLoader.LoadDefaultSharedModule(new LoadImageURLModule());
m_openSim.ModuleLoader.LoadDefaultSharedModule(new XMLRPCModule());
m_openSim.ModuleLoader.LoadDefaultSharedModule(new replacedetTransactionModule());
if (!CheckRegionsForSanity(regionsToLoad))
{
m_log.Error("[LOADREGIONS]: Halting startup due to conflicts in region configurations");
Environment.Exit(1);
}
List<IScene> loadedRegions = new List<IScene>();
for (int i = 0; i < regionsToLoad.Length; i++)
{
IScene scene;
m_log.Debug("[LOADREGIONS]: Creating Region: " + regionsToLoad[i].RegionName + " (ThreadID: " +
Thread.CurrentThread.ManagedThreadId.ToString() +
")");
m_openSim.CreateRegion(regionsToLoad[i], true, out scene);
if (scene != null)
{
loadedRegions.Add(scene);
m_newRegionCreatedHandler = OnNewRegionCreated;
if (m_newRegionCreatedHandler != null)
{
m_newRegionCreatedHandler(scene);
}
}
}
m_openSim.ModuleLoader.PostInitialize();
m_openSim.ModuleLoader.ClearCache();
foreach (var region in loadedRegions)
{
region.InformNeighborsImUp();
}
}
19
Source : OpenSimBackground.cs
with BSD 3-Clause "New" or "Revised" License
from HalcyonGrid
with BSD 3-Clause "New" or "Revised" License
from HalcyonGrid
public override void Shutdown()
{
WorldHasComeToAnEnd.Set();
m_log.Info("[HALCYON MAIN]: World has come to an end");
base.Shutdown();
}
See More Examples