public void FixSlashes() { string temp = null; const string alreadyFixed = @"C:\usr\local\cell"; var fix1 = SledUtil.FixSlashes(temp); Assert.AreEqual(0, string.Compare(string.Empty, fix1)); temp = @"C:/usr/local/cell/"; fix1 = SledUtil.FixSlashes(temp); Assert.AreEqual(0, string.Compare(fix1, alreadyFixed)); temp = @"C:/usr/local/cell"; fix1 = SledUtil.FixSlashes(temp); Assert.AreEqual(0, string.Compare(fix1, alreadyFixed)); temp = @"C:\usr/local\cell/"; fix1 = SledUtil.FixSlashes(temp); Assert.AreEqual(0, string.Compare(fix1, alreadyFixed)); temp = @"C:/usr\local/cell"; fix1 = SledUtil.FixSlashes(temp); Assert.AreEqual(0, string.Compare(fix1, alreadyFixed)); }
private void DebugServiceDataReady(object sender, SledDebugServiceEventArgs e) { var typeCode = (Scmp.LuaTypeCodes)e.Scmp.TypeCode; switch (typeCode) { case Scmp.LuaTypeCodes.LuaCallStackBegin: RemoteTargetCallStackClear(); break; case Scmp.LuaTypeCodes.LuaCallStack: { var var = m_debugService.GetScmpBlob <Scmp.LuaCallStack>(); var node = new DomNode(SledSchema.SledCallStackType.Type); var cs = node.As <SledCallStackType>(); cs.File = SledUtil.FixSlashes(var.RelScriptPath); cs.CurrentLine = var.CurrentLine; cs.LineDefined = var.LineDefined; cs.LineEnd = var.LastLineDefined; cs.Function = m_luaFunctionParserService.Value.LookUpFunction(var.FunctionName); cs.Level = var.StackLevel; cs.NodeCanBeLookedUp = true; cs.NodeNeedsLookedUp = (cs.Level != 0); cs.IsCursorInFunction = (cs.Level == 0); RemoteTargetCallStackNew(cs); } break; case Scmp.LuaTypeCodes.LuaCallStackEnd: break; case Scmp.LuaTypeCodes.LuaCallStackLookupBegin: break; case Scmp.LuaTypeCodes.LuaCallStackLookup: { var scmp = m_debugService.GetScmpBlob <Scmp.LuaCallStackLookup>(); int iLevel = scmp.StackLevel; // Save this so the call stack GUI knows where it is CurrentStackLevel = iLevel; // Find existing callstack entry at iLevel and update // it to not need to be looked up anymore m_callStackCollection.CallStack[iLevel].NodeNeedsLookedUp = false; } break; case Scmp.LuaTypeCodes.LuaCallStackLookupEnd: { var cssea = new SledLuaCallStackServiceEventArgs(PreviousStackLevel, CurrentStackLevel); // Fire event indicating stack level has finished being looked up StackLevelLookedUp.Raise(this, cssea); // Fire event indicating stack level has changed StackLevelChanged.Raise(this, cssea); } break; } }