internal IndentToken(MyLog log, LoggingOptions options) { Debug.Assert(log != null); m_log = log; m_options = options; m_log.IncreaseIndent(options); }
public void Dispose() { Debug.Assert(m_log != null); if (m_log != null) { m_log.DecreaseIndent(m_options); m_log = null; } }
private static void LogInfoFromWMI(MyLog log) { try { //http://wutils.com/wmi/ //create a management scope object ManagementScope scope = new ManagementScope("\\\\.\\ROOT\\cimv2"); //create object query ObjectQuery query = new ObjectQuery("SELECT * FROM Win32_VideoController"); //create object searcher ManagementObjectSearcher searcher = new ManagementObjectSearcher(scope, query); //get collection of WMI objects ManagementObjectCollection queryCollection = searcher.Get(); log.WriteLine("WMI {"); log.IncreaseIndent(); //enumerate the collection. foreach (ManagementObject m in queryCollection) { log.WriteLine("{"); log.IncreaseIndent(); log.WriteLine("Caption = " + m["Caption"]); log.WriteLine("AdapterRam = " + m["AdapterRam"]); log.WriteLine("DriverVersion = " + m["DriverVersion"]); log.WriteLine("DriverDate = " + m["DriverDate"]); log.WriteLine("Description = " + m["Description"]); log.WriteLine("DeviceID = " + m["DeviceID"]); log.WriteLine("Name = " + m["Name"]); log.WriteLine("VideoProcessor = " + m["VideoProcessor"]); log.WriteLine("VideoArchitecture = " + m["VideoArchitecture"]); log.WriteLine("PNPDeviceID = " + m["PNPDeviceID"]); log.WriteLine("InstalledDisplayDrivers = " + m["InstalledDisplayDrivers"]); log.DecreaseIndent(); log.WriteLine("}"); } log.DecreaseIndent(); log.WriteLine("}"); } catch { } }
public MyVoxelPathfindingLog(string filename) { string path = Path.Combine(MyFileSystem.UserDataPath, filename); if (MyFakes.REPLAY_NAVMESH_GENERATION) { StreamReader logFile = new StreamReader(path); string line = null; String nmopRegex = "NMOP: Voxel NavMesh: (\\S+) (ADD|REM) \\[X:(\\d+), Y:(\\d+), Z:(\\d+)\\]"; String voxopRegex = "VOXOP: (\\S*) \\[X:(\\d+), Y:(\\d+), Z:(\\d+)\\] \\[X:(\\d+), Y:(\\d+), Z:(\\d+)\\] (\\S+) (\\S+)"; while ((line = logFile.ReadLine()) != null) { var parts = line.Split('['); var matches = Regex.Matches(line, nmopRegex); if (matches.Count == 1) { string navMeshName = matches[0].Groups[1].Value; if (m_navmeshName == null) { m_navmeshName = navMeshName; } else { Debug.Assert(m_navmeshName == navMeshName, "Pathfinding log contains data from more than one mesh!"); } bool addition = matches[0].Groups[2].Value == "ADD"; int xCoord = Int32.Parse(matches[0].Groups[3].Value); int yCoord = Int32.Parse(matches[0].Groups[4].Value); int zCoord = Int32.Parse(matches[0].Groups[5].Value); Vector3I coord = new Vector3I(xCoord, yCoord, zCoord); m_operations.Add(new NavMeshOp(m_navmeshName, addition, coord)); continue; } matches = Regex.Matches(line, voxopRegex); if (matches.Count == 1) { string voxelMapName = matches[0].Groups[1].Value; int xCoord = Int32.Parse(matches[0].Groups[2].Value); int yCoord = Int32.Parse(matches[0].Groups[3].Value); int zCoord = Int32.Parse(matches[0].Groups[4].Value); Vector3I minCoord = new Vector3I(xCoord, yCoord, zCoord); xCoord = Int32.Parse(matches[0].Groups[5].Value); yCoord = Int32.Parse(matches[0].Groups[6].Value); zCoord = Int32.Parse(matches[0].Groups[7].Value); Vector3I maxCoord = new Vector3I(xCoord, yCoord, zCoord); var flags = (MyStorageDataTypeFlags)Enum.Parse(typeof(MyStorageDataTypeFlags), matches[0].Groups[8].Value); string data = matches[0].Groups[9].Value; m_operations.Add(new VoxelWriteOp(voxelMapName, data, flags, minCoord, maxCoord)); continue; } } logFile.Close(); } if (MyFakes.LOG_NAVMESH_GENERATION) { m_log = new MyLog(); m_log.Init(path, MyFinalBuildConstants.APP_VERSION_STRING); } }
public static void Critical(this MyLog self, StringBuilder buillder) { self.Log(MyLogSeverity.Critical, buillder); }
public static void Critical(this MyLog self, string message, params object[] args) { self.Log(MyLogSeverity.Critical, message, args); }
public static void Error(this MyLog self, StringBuilder buillder) { self.Log(MyLogSeverity.Error, buillder); }
public static void Error(this MyLog self, string message, params object[] args) { self.Log(MyLogSeverity.Error, message, args); }
public static void Warning(this MyLog self, StringBuilder buillder) { self.Log(MyLogSeverity.Warning, buillder); }
public static void Warning(this MyLog self, string message, params object[] args) { self.Log(MyLogSeverity.Warning, message, args); }
public static void Info(this MyLog self, StringBuilder buillder) { self.Log(MyLogSeverity.Info, buillder); }
public static void Info(this MyLog self, string message, params object[] args) { self.Log(MyLogSeverity.Info, message, args); }
public static void Debug(this MyLog self, StringBuilder buillder) { self.Log(MyLogSeverity.Debug, buillder); }
static int s_levelOfStarting = 0; // counter of stating calling static MyPathfindingStopwatch() { s_stopWatch = new Stopwatch(); s_gloabalStopwatch = new Stopwatch(); s_log = new MyLog(); }