public override void execute(StackFrame frame) { long val1 = (long) frame.popOperand(); long val2 = (long) frame.popOperand(); frame.pushOperand(val1 & val2); }
// TODO: Actually implement threads public override void execute(StackFrame frame) { Heap.HeapReference heapRef = (Heap.HeapReference) frame.popOperand(); ToyVMObject obj = (ToyVMObject) heapRef.obj; obj.monitorExit(); }
public void WhoAmI(string arg1) { Assembly assembly = Assembly.GetExecutingAssembly(); System.Type t = assembly.GetType(this.ToString()); // Get only this class Console.WriteLine("This class name is: {0}", t.ToString()); MethodInfo[] mInfo = t.GetMethods(); MemberInfo[] bInfo = t.GetMembers(); FieldInfo[] fInfo = t.GetFields(); foreach (MethodInfo m in mInfo) Console.WriteLine("Method: {0}", m.Name); foreach (MemberInfo b in bInfo) Console.WriteLine("Member: {0}", b.Name); foreach (FieldInfo f in fInfo) Console.WriteLine("Field: {0}", f.Name); StackFrame stackFrame = new StackFrame(); MethodBase methodBase = stackFrame.GetMethod(); Console.WriteLine("This method name is : {0}", methodBase.Name ); /*System.Type[] types = assembly.GetTypes(); foreach (System.Type t in types) { Console.WriteLine("Tipo: {0}", t.ToString()); MethodInfo[] mInfo = t.GetMethods(); MemberInfo[] bInfo = t.GetMembers(); foreach (MethodInfo m in mInfo) Console.WriteLine("Modulo: {0}", m.Name); foreach (MemberInfo b in bInfo) Console.WriteLine("Miembro: {0}", b.Name); }*/ }
public override void execute(StackFrame frame) { frame.popOperand(); if (count == 2){ frame.popOperand(); } }
public StackFrameNode(StackFrame stackFrame) { this.stackFrame = stackFrame; this.Name = stackFrame.MethodInfo.Name; this.ChildNodes = GetChildNodes(); }
public override void execute(StackFrame frame) { if (depth > 0){ throw new ToyVMException("Don't support dup2 with depth of " + depth,frame); } Object obj = frame.popOperand(); Object obj2 = null; if (frame.hasMoreOperands()){ obj2 = frame.popOperand(); } /*System.Collections.Stack temp = new System.Collections.Stack(); for (int i = 0; i < depth; i++){ temp.Push(frame.popOperand()); } frame.pushOperand(obj); // insert at depth depth while (temp.Count > 0){ frame.pushOperand(temp.Pop()); } */ frame.pushOperand(obj); // put the duplicated one back on top if (obj2 != null){ frame.pushOperand(obj2); } frame.pushOperand(obj); // put the duplicated one back on top if (obj2 != null){ frame.pushOperand(obj2); } }
public override void execute(StackFrame frame) { double val1 = (double) frame.popOperand(); double val2 = (double) frame.popOperand(); frame.pushOperand(val2 - val1); }
public override void execute(StackFrame frame) { float val1 = (float) frame.popOperand(); float val2 = (float) frame.popOperand(); frame.pushOperand(val1 + val2); }
public override void execute(StackFrame frame) { ClassFile clazz = ToyVMClassLoader.loadClass(method.GetClassInfo().getClassName()); ConstantPoolInfo_NameAndType nameAndType = method.GetMethodNameAndType(); if (log.IsDebugEnabled) log.DebugFormat("Will be executing {0} on {1}",nameAndType,clazz.GetName()); MethodInfo methodInfo = clazz.getMethod(nameAndType); // TODO: Need better way of handling access to the method if (methodInfo == null){ throw new ToyVMException("Unable to locate method " + nameAndType + " on " + clazz,frame); } StackFrame frame2 = new StackFrame(frame); int paramCount = method.getParameterCount(); frame2.setMethod(clazz,methodInfo,paramCount); if (log.IsDebugEnabled) log.DebugFormat("Have {0} parameters",paramCount); // Store the parameters from the operand stack // into the local variables of the outgoing frame for (int i = paramCount; i > 0; i--){ frame2.getLocalVariables()[i-1]=frame.popOperand(); if (log.IsDebugEnabled) log.DebugFormat("Parameter {0} = {1}",i,frame2.getLocalVariables()[i-1]); } clazz.execute(nameAndType,frame2); /*methodInfo.execute(frame2); if (methodInfo != null){ } else { throw new Exception("Unable to locate " + nameAndType.ToString()); } */ }
public override void execute(StackFrame frame) { Object val = frame.popOperand(); int index = (int) frame.popOperand(); Heap.HeapReference heapRef = (Heap.HeapReference) frame.popOperand(); if (! heapRef.isArray){ throw new ToyVMException("Expected array, got " + heapRef,frame); } if (! heapRef.isPrimitive){ ArrayList arr = (ArrayList) heapRef.obj; arr[index] = val; } else if (heapRef.primitiveType.Equals(Type.GetType("System.Char[]"))){ ArrayList arr = (ArrayList) heapRef.obj; arr[index] = val; //System.Char[][] arr = (System.Char[][]) heapRef.obj; //Heap.HeapReference arrVal = (Heap.HeapReference)val; //arr[index] = (System.Char[])arrVal.obj; } else { throw new ToyVMException("Can't handle " + heapRef,frame); } if (log.IsDebugEnabled) log.DebugFormat("Stored {0} at index {1}",val,index); }
protected override void Analyze(StackFrame frame, string framePointer) { EnsureRelativeUriWithUriBaseId( frame.Uri, frame.UriBaseId, framePointer); }
public SoftEvaluationContext(SoftDebuggerSession session, StackFrame frame, DC.EvaluationOptions options) : base(options) { Frame = frame; Thread = frame.Thread; Domain = frame.Domain; string method = frame.Method.Name; if (frame.Method.DeclaringType != null) method = frame.Method.DeclaringType.FullName + "." + method; var location = new DC.SourceLocation (method, frame.FileName, frame.LineNumber, frame.ColumnNumber, frame.EndLineNumber, frame.EndColumnNumber, frame.Location.SourceFileHash); string language; if (frame.Method != null) { language = frame.IsNativeTransition ? "Transition" : "Managed"; } else { language = "Native"; } Evaluator = session.GetEvaluator (new DC.StackFrame (frame.ILOffset, location, language, session.IsExternalCode (frame), true)); Adapter = session.Adaptor; this.session = session; stackVersion = session.StackVersion; sourceAvailable = !string.IsNullOrEmpty (frame.FileName) && System.IO.File.Exists (frame.FileName); }
/// <summary> /// Gets the stack frame locals. /// </summary> /// <param name="stackFrame">The stack frame.</param> /// <param name="arguments">if set to <c>true</c> only arguments will be returned.</param> public VariableCollection GetFrameLocals(StackFrame stackFrame, bool arguments) { DebugScopeGroup scopeGroup = arguments ? DebugScopeGroup.Arguments : DebugScopeGroup.Locals; using (StackFrameSwitcher switcher = new StackFrameSwitcher(DbgEngDll.StateCache, stackFrame)) { IDebugSymbolGroup2 symbolGroup; dbgEngDll.Symbols.GetScopeSymbolGroup2((uint)scopeGroup, null, out symbolGroup); uint localsCount = symbolGroup.GetNumberSymbols(); Variable[] variables = new Variable[localsCount]; for (uint i = 0; i < localsCount; i++) { StringBuilder name = new StringBuilder(Constants.MaxSymbolName); uint nameSize; symbolGroup.GetSymbolName(i, name, (uint)name.Capacity, out nameSize); var entry = symbolGroup.GetSymbolEntryInformation(i); var module = stackFrame.Process.ModulesById[entry.ModuleBase]; var codeType = module.TypesById[entry.TypeId]; var address = entry.Offset; var variableName = name.ToString(); variables[i] = Variable.CreateNoCast(codeType, address, variableName, variableName); } return new VariableCollection(variables); } }
/// <summary> /// Filters and copies the specified array of .NET stack frames /// </summary> /// <param name="stackFrames"></param> /// <returns></returns> private StackFrame[] GetFilteredFrames(SysStackFrame[] stackFrames) { StackFrame[] result = null; int resultIndex = 0; for (int i = 0; i < stackFrames.Length; i++) { SysStackFrame current = stackFrames[i]; // postpone allocating the array until we know how big it should be if (result == null) { // filter the top irrelevant frames from the stack if (!this._stackTraceFilter.IsRelevant(current)) { continue; } result = new StackFrame[stackFrames.Length + MethodsToKeep - i]; // copy last frames to stack for (int j = i-MethodsToKeep; j < i; j++) { result[resultIndex] = StackFrame.Create(stackFrames[j]); resultIndex++; } } result[resultIndex] = StackFrame.Create(stackFrames[i]); resultIndex ++; } return result; }
/** * * Operand stack * ..., objectref, [arg1, [arg2 ...]] ... */ public override void execute(StackFrame frame) { ClassFile clazz = ToyVMClassLoader.loadClass(method.GetClassInfo().getClassName()); ConstantPoolInfo_NameAndType nameAndType = method.GetMethodNameAndType(); if (log.IsDebugEnabled) log.DebugFormat("Will be executing {0} on {1}",nameAndType,clazz.GetName()); MethodInfo methodInfo = clazz.getMethod(nameAndType); StackFrame frame2 = new StackFrame(frame); int paramCount = method.getParameterCount(); frame2.setMethod(clazz,methodInfo,paramCount); if (log.IsDebugEnabled) log.DebugFormat("Have {0} parameters",paramCount); if (log.IsDebugEnabled) log.DebugFormat("Max Locals: {0}",methodInfo.getMaxLocals()); // push "this" as local variable 0 //frame2.setThis((ToyVMObject)(frame2.getLocalVariables()[0])); // Store the parameters from the operand stack // into the local variables of the outgoing frame for (int i = paramCount;i >= 0; i--){ frame2.getLocalVariables()[i]=frame.popOperand(); if (log.IsDebugEnabled) log.DebugFormat("Set variable {0}={1}",(i),frame2.getLocalVariables()[i]); } clazz.execute(nameAndType,frame2); //Environment.Exit(0); }
public override void execute(StackFrame frame) { Object o = frame.popOperand(); if (! (o is NullValue)){ Heap.HeapReference heapRef = (Heap.HeapReference) o; // we only handle class right now ClassFile tClass = (ClassFile) heapRef.type; do { if (tClass.GetName().Equals(className)){ frame.pushOperand(1); return; } if (tClass.implements(className)){ frame.pushOperand(1); return; } tClass = tClass.GetSuperClassFile(); } while (tClass != null); } frame.pushOperand(0); }
public override void execute(StackFrame frame) { Object val2 = frame.popOperand(); Object val1 = frame.popOperand(); //Heap.HeapReference val2 = (Heap.HeapReference) frame.popOperand(); //Heap.HeapReference val1 = (Heap.HeapReference) frame.popOperand(); bool eval = false; switch (opval){ case OP_EQ:{ eval = (val1 == val2); break; } case OP_NE:{ eval = (val1 != val2); break; } default: throw new ToyVMException("Not handling " + opval,frame); } if (eval){ int pc = frame.getProgramCounter(); frame.setProgramCounter(pc + branch - size); } }
public override void execute(StackFrame frame) { int val1 = (int) frame.popOperand(); int val2 = (int) frame.popOperand(); frame.pushOperand(val1 & val2); }
public TargetLocation GetLocation(StackFrame frame) { return (TargetLocation) frame.Thread.ThreadServant.DoTargetAccess ( delegate (TargetMemoryAccess target) { return GetLocation (frame, target); }); }
// <summary> // Retrieve an instance of this variable from the stack-frame @frame. // May only be called if Type.HasObject is true. // </summary> // <remarks> // An instance of IVariable contains information about a variable (for // instance a parameter of local variable of a method), but it's not // bound to any particular target location. This also means that it won't // get invalid after the target exited. // </remarks> public TargetObject GetObject(StackFrame frame) { return (TargetObject) frame.Thread.ThreadServant.DoTargetAccess ( delegate (TargetMemoryAccess target) { return GetObject (frame, target); }); }
/// <summary> /// Gets the stack frame locals. /// </summary> /// <param name="stackFrame">The stack frame.</param> /// <param name="arguments">if set to <c>true</c> only arguments will be returned.</param> public VariableCollection GetFrameLocals(StackFrame stackFrame, bool arguments) { ulong distance; Module module; ISymbolProviderModule diaModule = GetDiaModule(stackFrame.Process, stackFrame.InstructionOffset, out distance, out module); return diaModule.GetFrameLocals(stackFrame, module, (uint)distance, arguments); }
public override void execute(StackFrame frame) { Object returnVal = frame.popOperand(); if (returnVal is NullValue || returnVal is Heap.HeapReference || returnVal is ClassFile || returnVal is Thread){ frame.getPrev().pushOperand(returnVal); } else throw new ToyVMException("areturn inconsistent " + returnVal,frame); }
public override void execute(StackFrame frame) { //ToyVMObject obj = new ToyVMObject(classRef); Heap.HeapReference heapRef = Heap.GetInstance().newInstance(ToyVMClassLoader.loadClass(classRef.getClassName())); if (log.IsDebugEnabled) log.DebugFormat("executing new from {0}",frame); frame.pushOperand(heapRef); }
protected override Value EvaluateInternal(StackFrame context) { if (context.Thread.CurrentException != null) { return context.Thread.CurrentException.Value; } else { throw new GetValueException("No current exception"); } }
protected override Value EvaluateInternal(StackFrame context) { if (context.MethodInfo != method) { throw new GetValueException("Method " + method.FullName + " expected, " + context.MethodInfo.FullName + " seen"); } return context.GetArgumentValue(index); }
protected override Value EvaluateInternal(StackFrame context) { if (context.MethodInfo != method) { throw new GetValueException("Method " + method.FullName + " expected, " + context.MethodInfo.FullName + " seen"); } return context.GetLocalVariableValue(symVar); }
public Value GetValue(StackFrame context) { if (context == null) throw new ArgumentNullException("context"); if (context.MethodInfo != this.Method) throw new GetValueException("Expected stack frame: " + this.Method.Name); return getter(context); }
// value1,value2 => ... public override void execute(StackFrame frame) { int value2 = (int) frame.popOperand(); int value1 = (int) frame.popOperand(); frame.pushOperand(value1 - (value1 / value2) * value2); // TODO: something is broken up higher //frame.pushOperand(0); }
/** * Left shift val1 by amount in low 5 bits of val2 */ public override void execute(StackFrame frame) { long val2 = (long) frame.popOperand(); long val1 = (long) frame.popOperand(); val1 = (0xFFFFFFFF & ((val1 << (int)(val2 & 0x3F)))); frame.pushOperand(val1); }
/** * Right shift val1 by amount in low 5 bits of val2 */ public override void execute(StackFrame frame) { int val2 = (int) frame.popOperand(); int val1 = (int) frame.popOperand(); val1 = (0xFFFF & ((val1 >> (val2 & 0x1F)))); frame.pushOperand(val1); }
public void Setup() { ds = Start("TestEvaluation"); frame = ds.ActiveThread.Backtrace.GetFrame(0); }
public static void Error(string s) { var caller = new StackFrame(1).GetMethod(); Log.Error($"[{Name}] {s}, Caller is {caller.DeclaringType}::{caller.Name}"); }
public abstract void execute3( RunTimeValueBase thisObj, FunctionDefine functionDefine, SLOT returnSlot,SourceToken token,StackFrame stackframe,out bool success );
/// <summary> /// Runs one or more comparison tests by compiling the source C# or VB.net file, /// running the compiled test method, translating the compiled test method to JS, /// then running the translated JS and comparing the outputs. /// </summary> /// <param name="filenames">The path to one or more test files. If a test file is named 'Common.cs' it will be linked into all tests.</param> /// <param name="stubbedAssemblies">The paths of assemblies to stub during translation, if any.</param> /// <param name="typeInfo">A TypeInfoProvider to use for type info. Using this parameter is not advised if you use proxies or JSIL.Meta attributes in your tests.</param> /// <param name="testPredicate">A predicate to invoke before running each test. If the predicate returns false, the JS version of the test will not be run (though it will be translated).</param> protected void RunComparisonTests( string[] filenames, string[] stubbedAssemblies = null, TypeInfoProvider typeInfo = null, Func <string, bool> testPredicate = null, Action <string, Func <string> > errorCheckPredicate = null, Func <Configuration> getConfiguration = null ) { var started = DateTime.UtcNow.Ticks; string commonFile = null; for (var i = 0; i < filenames.Length; i++) { if (filenames[i].Contains(Path.Combine("", "Common."))) { commonFile = filenames[i]; break; } } const string keyName = @"Software\Squared\JSIL\Tests\PreviousFailures"; StackFrame callingTest = null; for (int i = 1; i < 10; i++) { callingTest = new StackFrame(i); var method = callingTest.GetMethod(); if ((method != null) && method.GetCustomAttributes(true).Any( (ca) => ca.GetType().FullName == "NUnit.Framework.TestAttribute" )) { break; } else { callingTest = null; } } var previousFailures = new HashSet <string>(); MethodBase callingMethod = null; if ((callingTest != null) && ((callingMethod = callingTest.GetMethod()) != null)) { try { using (var rk = Registry.CurrentUser.CreateSubKey(keyName)) { var names = rk.GetValue(callingMethod.Name) as string; if (names != null) { foreach (var name in names.Split(',')) { previousFailures.Add(name); } } } } catch (Exception ex) { Console.WriteLine("Warning: Could not open registry key: {0}", ex); } } var failureList = new List <string>(); var sortedFilenames = new List <string>(filenames); sortedFilenames.Sort( (lhs, rhs) => { var lhsShort = Path.GetFileNameWithoutExtension(lhs); var rhsShort = Path.GetFileNameWithoutExtension(rhs); int result = (previousFailures.Contains(lhsShort) ? 0 : 1).CompareTo( previousFailures.Contains(rhsShort) ? 0 : 1 ); if (result == 0) { result = lhsShort.CompareTo(rhsShort); } return(result); } ); var asmCache = new AssemblyCache(); foreach (var filename in sortedFilenames) { if (filename == commonFile) { continue; } bool shouldRunJs = true; if (testPredicate != null) { shouldRunJs = testPredicate(filename); } RunComparisonTest( filename, stubbedAssemblies, typeInfo, errorCheckPredicate, failureList, commonFile, shouldRunJs, asmCache, getConfiguration ?? MakeConfiguration ); } if (callingMethod != null) { try { using (var rk = Registry.CurrentUser.CreateSubKey(keyName)) rk.SetValue(callingMethod.Name, String.Join(",", failureList.ToArray())); } catch (Exception ex) { Console.WriteLine("Warning: Could not open registry key: {0}", ex); } } var ended = DateTime.UtcNow.Ticks; var elapsedTotalSeconds = TimeSpan.FromTicks(ended - started).TotalSeconds; Console.WriteLine("// Ran {0} test(s) in {1:000.00}s.", sortedFilenames.Count, elapsedTotalSeconds); Assert.AreEqual(0, failureList.Count, String.Format("{0} test(s) failed:\r\n{1}", failureList.Count, String.Join("\r\n", failureList.ToArray())) ); }
static public string get_caller_info() { StackFrame callStack = new StackFrame(1, true); return(callStack.GetFileName() + ":" + (callStack.GetFileLineNumber() + 1)); }
/// <summary> /// Utility function which formats a single <see cref="StackFrame"/> in to a string as similarly as possible to <see cref="Exception"/>'s format. /// </summary> /// <param name="frame">The <see cref="StackFrame"/> to format in to a string.</param> /// <returns>The string containing the <see cref="StackFrame"/>'s function, argument names and (if available) source location.</returns> static string FormatStackFrame(StackFrame frame) { // Note: This code is meant to return the same string as Exception's formatting of a stack trace. Do not modify. var sb = new StringBuilder(255); var method = frame.GetMethod(); if (method != null) { sb.Append(" at "); { var type = method.DeclaringType; if (type != null) { sb.Append(type.FullName.Replace('+', '.')); sb.Append("."); } } sb.Append(method.Name); if (method.IsGenericMethod) { sb.Append("["); var genericTypes = method.GetGenericArguments(); var first = true; foreach (var genericType in genericTypes) { if (!first) { sb.Append(","); } sb.Append(genericType.Name); first = false; } sb.Append("]"); } { sb.Append("("); var parameters = method.GetParameters(); var first = true; foreach (var parameter in parameters) { if (!first) { sb.Append(", "); } if (parameter.ParameterType == null) { sb.Append("<UnknownType>"); } else { sb.Append(parameter.ParameterType.Name); } sb.Append(" "); sb.Append(parameter.Name); first = false; } sb.Append(")"); } if (frame.GetILOffset() != -1) { try { var fileName = frame.GetFileName(); if (fileName != null) { sb.Append(" in "); sb.Append(fileName); sb.Append(":line "); sb.Append(frame.GetFileLineNumber()); } } catch (SecurityException) { } } sb.Append(Environment.NewLine); } return(sb.ToString()); }
public EmpCalcVactionRequestDL GetCalcVactionRequest(string CompanyId, string Branch_Id, decimal Emp_Serial_No, string Request_Id, string StartDate) { StackFrame stackFrame = new StackFrame(); MethodBase methodBase = stackFrame.GetMethod(); // int MaxValue = 0; EmpCalcVactionRequestDL objEmpCalcVactionRequestDLList = new EmpCalcVactionRequestDL(); try { OpenEntityConnection(); object[] param1 = { new SqlParameter("@CompanyId", CompanyId), new SqlParameter("@Branch_Id", Branch_Id), new SqlParameter("@Emp_Serial_No", Emp_Serial_No), new SqlParameter("@Request_Id", Request_Id), new SqlParameter("@StartDate", StartDate) }; var objlist = objPharmaEntities.Database.SqlQuery <EmpCalcVactionRequestDL>("exec dbo.[CalcEmpVactionPerRquest] @CompanyId,@Branch_Id,@Emp_Serial_No,@Request_Id,@StartDate", param1).FirstOrDefault(); if (objlist != null) { EmpCalcVactionRequestDL objEmpCalcVactionRequestDL = new EmpCalcVactionRequestDL(); objEmpCalcVactionRequestDL.Branch_Id_Col = objlist.Branch_Id_Col; objEmpCalcVactionRequestDL.CompanyId_Col = objlist.CompanyId_Col; objEmpCalcVactionRequestDL.Request_Id_Col = objlist.Request_Id_Col; objEmpCalcVactionRequestDL.Emp_Serial_No_Col = objlist.Emp_Serial_No_Col; objEmpCalcVactionRequestDL.HireDate_Col = objlist.HireDate_Col; objEmpCalcVactionRequestDL.TakenDay_Col = objlist.TakenDay_Col; objEmpCalcVactionRequestDL.MaxPeriodYearPerRequest_Col = objlist.MaxPeriodYearPerRequest_Col; objEmpCalcVactionRequestDL.MinPeriodYearPerRequest_Col = objlist.MinPeriodYearPerRequest_Col; objEmpCalcVactionRequestDL.RequestDiscountType_Col = objlist.RequestDiscountType_Col; objEmpCalcVactionRequestDL.RequestRatioValue_Col = objlist.RequestRatioValue_Col; objEmpCalcVactionRequestDL.Contract_Id = objlist.Contract_Id; objEmpCalcVactionRequestDL.ContractPeriod_Id = objlist.ContractPeriod_Id; objEmpCalcVactionRequestDL.FromStartPeriod = objlist.FromStartPeriod; objEmpCalcVactionRequestDL.ToEndPeriod = objlist.ToEndPeriod; return(objEmpCalcVactionRequestDL); } else { return(null); } //foreach (var obj in objlist) //{ // ComboDL objCombDL = new ComboDL(); // objCombDL.Id = Convert.ToString(obj.Id); // objCombDL.Name = obj.Name; // objectList.Add(objCombDL); //} } catch (Exception ex) { catchEntityvalidation((System.Data.Entity.Validation.DbEntityValidationException)ex, System.Runtime.InteropServices.Marshal.GetExceptionCode().ToString(), this.UserNameProperty.ToString(), this.GetType().Name.ToString(), methodBase.Name.ToString()); ex.InnerException.Message.ToString(); return(null); } finally { CloseEntityConnection(); } return(objEmpCalcVactionRequestDLList); }
public List <VacationData> CalcEmpVactionPerRquest(decimal EmpSerial_No, string Company_Id, string Branch_Id, string FromDate, string ToDate) { StackFrame stackFrame = new StackFrame(); MethodBase methodBase = stackFrame.GetMethod(); try { OpenEntityConnection(); List <VacationData> objectList = new List <VacationData>(); object[] param1 = { new SqlParameter("@Company_Id", Company_Id), new SqlParameter("@Branch_Id", Branch_Id), new SqlParameter("@Emp_Serial_No", EmpSerial_No), new SqlParameter("@FromDate", FromDate), }; object[] param2 = { new SqlParameter("@Company_Id", Company_Id), new SqlParameter("@Branch_Id", Branch_Id), new SqlParameter("@FromDate", FromDate), new SqlParameter("@ToDate", ToDate), }; var objlist = objPharmaEntities.Database.SqlQuery <VacationData>("exec dbo.CalcEmpAnnualVactionPerRquest @Company_Id,@Branch_Id,@Emp_Serial_No,@FromDate", param1).ToList(); var balance = objPharmaEntities.Database.SqlQuery <decimal>("select dbo.Fn_get_OfficalVacation(@Company_Id,'@Branch_Id',@FromDate,@ToDate)", param2).FirstOrDefault(); foreach (var obj in objlist) { VacationData VacationData = new VacationData(); VacationData.Company_Id = obj.Company_Id; VacationData.Branch_Id = obj.Branch_Id; VacationData.Emp_Serial_No = obj.Emp_Serial_No; VacationData.AllowedVacationBal_Col = obj.AllowedVacationBal_Col; VacationData.Net_NoOfActuallyVacationDaysTillDate_Col = obj.Net_NoOfActuallyVacationDaysTillDate_Col; VacationData.NewTransferedAfterFinishingContract_Col = obj.NewTransferedAfterFinishingContract_Col; VacationData.NoOfPerviousAnnaulVacTillDate_Col = obj.NoOfPerviousAnnaulVacTillDate_Col; VacationData.NoOfActuallyVacationDaysTillDate_Col = obj.NoOfActuallyVacationDaysTillDate_Col; VacationData.OfficialVacations = obj.OfficialVacations; VacationData.VactionFromPrmEffect = obj.VactionFromPrmEffect; VacationData.NoOfTransferAnnaulVacTillDate_Col = obj.NoOfTransferAnnaulVacTillDate_Col; VacationData.TotalAvailable = (obj.AllowedVacationBal_Col + obj.NoOfTransferAnnaulVacTillDate_Col); VacationData.RemainBalance = Convert.ToDecimal(balance); VacationData.FromStartPeriod = obj.FromStartPeriod; VacationData.ToEndPeriod = obj.ToEndPeriod; VacationData.Contract_Id = obj.Contract_Id; VacationData.ContractPeriod_Id = obj.ContractPeriod_Id; objectList.Add(VacationData); } return(objectList); } catch (Exception ex) { catchEntityvalidation((System.Data.Entity.Validation.DbEntityValidationException)ex, System.Runtime.InteropServices.Marshal.GetExceptionCode().ToString(), this.UserNameProperty.ToString(), this.GetType().Name.ToString(), methodBase.Name.ToString()); ex.InnerException.Message.ToString(); return(null); } finally { CloseEntityConnection(); } }
public List <VcationRecordDL> GetVacationRecordData(decimal EmpSerial_No, string VacationFrom, string VacationTo, string VacationType, string Company_Id, string Branch_Id) { StackFrame stackFrame = new StackFrame(); MethodBase methodBase = stackFrame.GetMethod(); try { OpenEntityConnection(); List <VcationRecordDL> objectList = new List <VcationRecordDL>(); object[] param1 = { new SqlParameter("@Emp_Serial_No", EmpSerial_No), new SqlParameter("@VacationFrom", VacationFrom), //(Convert.ToDateTime(OvertimeFrom)).ToString("yyyyMMdd")), new SqlParameter("@VacationTo", VacationTo), // (Convert.ToDateTime(OvertimeTo)).ToString("yyyyMMdd")) new SqlParameter("@VacationType", VacationType), new SqlParameter("@Company_Id", Company_Id), new SqlParameter("@Branch_Id", Branch_Id) }; //sp_GetEmpOverTimeRecord var objlist = objPharmaEntities.Database.SqlQuery <VcationRecordDL>("exec dbo.sp_GetEmpOtherVacationRecord @Emp_Serial_No, @VacationFrom, @VacationTo,@VacationType,@Company_Id,@Branch_Id", param1).ToList(); foreach (var obj in objlist) { VcationRecordDL VcationRecordDL = new VcationRecordDL(); VcationRecordDL.Rec_Hdr_Id = obj.Rec_Hdr_Id; VcationRecordDL.Company_Id = obj.Company_Id; VcationRecordDL.Branch_Id = obj.Branch_Id; VcationRecordDL.Emp_Serial_No = obj.Emp_Serial_No; VcationRecordDL.FullNameArabic = obj.FullNameArabic; VcationRecordDL.FullNameEn = obj.FullNameEn; VcationRecordDL.TransDate = obj.TransDate; VcationRecordDL.FromDate = obj.FromDate; VcationRecordDL.ToDate = obj.ToDate; VcationRecordDL.FromStartPeriod = obj.FromStartPeriod; VcationRecordDL.ToEndPeriod = obj.ToEndPeriod; VcationRecordDL.Request_Id = obj.Request_Id; VcationRecordDL.PlaceOfResidence = obj.PlaceOfResidence; VcationRecordDL.Reason = obj.Reason; VcationRecordDL.FreeBalancRequest = obj.FreeBalancRequest; VcationRecordDL.ChargeBalancRequest = obj.ChargeBalancRequest; VcationRecordDL.AcuallBackDate = obj.AcuallBackDate; VcationRecordDL.AcuallVaction_Peiod = obj.AcuallVaction_Peiod; VcationRecordDL.Contract_Id = obj.Contract_Id; VcationRecordDL.ContractPeriod_Id = obj.ContractPeriod_Id; VcationRecordDL.Tot_Transferd_Period = obj.Tot_Transferd_Period; VcationRecordDL.Curr_DiscVac_Period = obj.Curr_DiscVac_Period; VcationRecordDL.Curr_DiscTransferd_Period = obj.Curr_DiscTransferd_Period; VcationRecordDL.Prev_Vaction_Period = obj.Prev_Vaction_Period; VcationRecordDL.Vaction_Period = obj.Vaction_Period; VcationRecordDL.CurrAllowedVacTillDate = obj.CurrAllowedVacTillDate; VcationRecordDL.Vac_Place_Type = obj.Vac_Place_Type; VcationRecordDL.Offical_Vaction_Period = obj.Offical_Vaction_Period; VcationRecordDL.VactionFromPrmEffec = obj.VactionFromPrmEffec; VcationRecordDL.RowStatus = obj.RowStatus; VcationRecordDL.Confirmed = obj.Confirmed; objectList.Add(VcationRecordDL); } return(objectList); } catch (Exception ex) { catchEntityvalidation((System.Data.Entity.Validation.DbEntityValidationException)ex, System.Runtime.InteropServices.Marshal.GetExceptionCode().ToString(), this.UserNameProperty.ToString(), this.GetType().Name.ToString(), methodBase.Name.ToString()); ex.InnerException.Message.ToString(); return(null); } finally { CloseEntityConnection(); } }
protected override void Analyze(StackFrame frame, string framePointer) { Analyze(frame.Message, framePointer); }
private object GenerateEventHandler( PSEventManager eventManager, object sender, string sourceIdentifier, PSObject data, MethodInfo invokeSignature) { int length = invokeSignature.GetParameters().Length; StackFrame stackFrame = new StackFrame(0, true); ISymbolDocumentWriter document = (ISymbolDocumentWriter)null; if (this.debugMode) { document = this.eventModule.DefineDocument(stackFrame.GetFileName(), Guid.Empty, Guid.Empty, Guid.Empty); } TypeBuilder typeBuilder = this.eventModule.DefineType("PSEventHandler_" + (object)this.typeId, TypeAttributes.Public, typeof(PSEventHandler)); ++this.typeId; ConstructorInfo constructor = typeof(PSEventHandler).GetConstructor(new Type[4] { typeof(PSEventManager), typeof(object), typeof(string), typeof(PSObject) }); if (this.debugMode) { this.eventAssembly.SetCustomAttribute(new CustomAttributeBuilder(typeof(DebuggableAttribute).GetConstructor(new Type[1] { typeof(DebuggableAttribute.DebuggingModes) }), new object[1] { (object)(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations) })); } ILGenerator ilGenerator1 = typeBuilder.DefineConstructor(MethodAttributes.Public, CallingConventions.Standard, new Type[4] { typeof(PSEventManager), typeof(object), typeof(string), typeof(PSObject) }).GetILGenerator(); ilGenerator1.Emit(OpCodes.Ldarg_0); ilGenerator1.Emit(OpCodes.Ldarg_1); ilGenerator1.Emit(OpCodes.Ldarg_2); ilGenerator1.Emit(OpCodes.Ldarg_3); ilGenerator1.Emit(OpCodes.Ldarg, 4); ilGenerator1.Emit(OpCodes.Call, constructor); ilGenerator1.Emit(OpCodes.Ret); Type[] parameterTypes = new Type[length]; int index1 = 0; foreach (ParameterInfo parameter in invokeSignature.GetParameters()) { parameterTypes[index1] = parameter.ParameterType; ++index1; } MethodBuilder methodBuilder = typeBuilder.DefineMethod("EventDelegate", MethodAttributes.Public, CallingConventions.Standard, invokeSignature.ReturnType, parameterTypes); int position = 1; foreach (ParameterInfo parameter in invokeSignature.GetParameters()) { methodBuilder.DefineParameter(position, parameter.Attributes, parameter.Name); ++position; } ILGenerator ilGenerator2 = methodBuilder.GetILGenerator(); LocalBuilder localBuilder = ilGenerator2.DeclareLocal(typeof(object[])); if (this.debugMode) { localBuilder.SetLocalSymInfo("args"); ilGenerator2.MarkSequencePoint(document, stackFrame.GetFileLineNumber() - 1, 1, stackFrame.GetFileLineNumber(), 100); } ilGenerator2.Emit(OpCodes.Ldc_I4, length); ilGenerator2.Emit(OpCodes.Newarr, typeof(object)); ilGenerator2.Emit(OpCodes.Stloc_0); for (int index2 = 1; index2 <= length; ++index2) { if (this.debugMode) { ilGenerator2.MarkSequencePoint(document, stackFrame.GetFileLineNumber() - 1, 1, stackFrame.GetFileLineNumber(), 100); } ilGenerator2.Emit(OpCodes.Ldloc_0); ilGenerator2.Emit(OpCodes.Ldc_I4, index2 - 1); ilGenerator2.Emit(OpCodes.Ldarg, index2); if (parameterTypes[index2 - 1].IsValueType) { ilGenerator2.Emit(OpCodes.Box, parameterTypes[index2 - 1]); } ilGenerator2.Emit(OpCodes.Stelem_Ref); } ilGenerator2.Emit(OpCodes.Ldarg_0); FieldInfo field1 = typeof(PSEventHandler).GetField(nameof(eventManager), BindingFlags.Instance | BindingFlags.NonPublic); ilGenerator2.Emit(OpCodes.Ldfld, field1); ilGenerator2.Emit(OpCodes.Ldarg_0); FieldInfo field2 = typeof(PSEventHandler).GetField(nameof(sourceIdentifier), BindingFlags.Instance | BindingFlags.NonPublic); ilGenerator2.Emit(OpCodes.Ldfld, field2); ilGenerator2.Emit(OpCodes.Ldarg_0); FieldInfo field3 = typeof(PSEventHandler).GetField(nameof(sender), BindingFlags.Instance | BindingFlags.NonPublic); ilGenerator2.Emit(OpCodes.Ldfld, field3); ilGenerator2.Emit(OpCodes.Ldloc_0); ilGenerator2.Emit(OpCodes.Ldarg_0); FieldInfo field4 = typeof(PSEventHandler).GetField("extraData", BindingFlags.Instance | BindingFlags.NonPublic); ilGenerator2.Emit(OpCodes.Ldfld, field4); MethodInfo method = typeof(PSEventManager).GetMethod("GenerateEvent"); if (this.debugMode) { ilGenerator2.MarkSequencePoint(document, stackFrame.GetFileLineNumber() - 1, 1, stackFrame.GetFileLineNumber(), 100); } ilGenerator2.EmitCall(OpCodes.Callvirt, method, (Type[])null); ilGenerator2.Emit(OpCodes.Pop); ilGenerator2.Emit(OpCodes.Ret); return(typeBuilder.CreateType().GetConstructor(new Type[4] { typeof(PSEventManager), typeof(object), typeof(string), typeof(PSObject) }).Invoke(new object[4] { (object)eventManager, sender, (object)sourceIdentifier, (object)data })); }
public List <ComboDL> FillGeneralComboAllWithOutCondtion(string FldId1, string FldName1, string TblName, string Strwhere) { StackFrame stackFrame = new StackFrame(); MethodBase methodBase = stackFrame.GetMethod(); List <ComboDL> objectList = new List <ComboDL>();; try { OpenEntityConnection(); Strwhere = (Strwhere.Length == 0 ? "@" : Strwhere); //var para1 = new SqlParameter("@FldIdName",FldId1); // var para2 = new SqlParameter("@FldName", FldName1); // var para3 = new SqlParameter("@TblName", TblName); // var para4 = new SqlParameter("@Strwhere", Strwhere); // object[] param = { para1, para2, para3, para4 }; object[] param1 = { new SqlParameter("@FldIdName", FldId1), new SqlParameter("@FldName", FldName1), new SqlParameter("@TblName", TblName), new SqlParameter("@Strwhere", Strwhere) }; // object[] params = { // new SqlParameter("@ParametterWithNummvalue", DBNull.Value), // new SqlParameter("@In_Parameter", "Value"), // new SqlParameter("@Out_Parameter", SqlDbType.INT) //{Direction = ParameterDirection.Output}}; // YourDbContext.Database.ExecuteSqlCommand("exec StoreProcedure_Name @ParametterWithNummvalue, @In_Parameter, @Out_Parameter", params); // YourDbContext.SaveChanges(); //Var ReturnValue = ((SqlParameter)params[2]).Value var objlist = objPharmaEntities.Database.SqlQuery <ComboDL>("exec dbo.SP_GeneralAnyComboWithOutResStatus @FldIdName,@FldName,@TblName,@Strwhere", param1).ToList(); //var objlist = objPharmaEntities.Database.ExecuteSqlCommand("exec dbo.SP_GeneralAnyCombo @FldIdName,@FldName,@TblName,@Strwhere", param1); if (objlist != null) { foreach (var obj in objlist) { ComboDL objCombDL = new ComboDL(); objCombDL.Id = Convert.ToString(obj.Id); objCombDL.Name = obj.Name; objectList.Add(objCombDL); } } } catch (Exception ex) { catchEntityvalidation((System.Data.Entity.Validation.DbEntityValidationException)ex, System.Runtime.InteropServices.Marshal.GetExceptionCode().ToString(), this.UserNameProperty.ToString(), this.GetType().Name.ToString(), methodBase.Name.ToString()); objectList = null; throw ex; } finally { CloseEntityConnection(); } return(objectList); }
/// <summary> /// New item /// </summary> /// <param name="stackFrameIndex">Index of <paramref name="stackFrame"/> on the stack.</param> /// <param name="stackFrame">A stackframe</param> public StackFrameWithIndex(int stackFrameIndex, StackFrame stackFrame) { StackFrameIndex = stackFrameIndex; StackFrame = stackFrame; }
public override void execute3(RunTimeValueBase thisObj,FunctionDefine functionDefine,SLOT returnSlot,SourceToken token,StackFrame stackframe,out bool success) { RefOutStore _this = (RefOutStore)((LinkSystemObject)((ASBinCode.rtData.rtObjectBase)thisObj).value).GetLinkData(); try { string arg0 = TypeConverter.ConvertToString(argements[0],stackframe,token); System.Object arg1; { object _temp; if (!stackframe.player.linktypemapper.rtValueToLinkObject( argements[1], stackframe.player.linktypemapper.getLinkType(argements[1].rtType) , bin,true,out _temp )) { stackframe.throwCastException(token,argements[1].rtType, functionDefine.signature.parameters[1].type ); success = false; return; } arg1 = (System.Object)_temp; } _this.SetValue((System.String)arg0,(System.Object)arg1) ; returnSlot.directSet(ASBinCode.rtData.rtUndefined.undefined); success = true; } catch (ASRunTimeException tlc) { success = false; stackframe.throwAneException(token,tlc.Message); } catch (InvalidCastException ic) { success = false; stackframe.throwAneException(token,ic.Message); } catch (ArgumentException a) { success = false; stackframe.throwAneException(token,a.Message); } catch (IndexOutOfRangeException i) { success = false; stackframe.throwAneException(token,i.Message); } catch (NotSupportedException n) { success = false; stackframe.throwAneException(token,n.Message); } }
void ParseLine(string line) { Match m = null; if (ignoreline) { ignoreline = false; return; } // if (getmodes) // { // m = modeparse.Match(line); // if (m.Success) // { // bool on = m.Groups["v"].Value == "1"; // string mode = m.Groups["mode"].Value; // // Mode mm = (Mode) Enum.Parse(typeof(Mode), mode); // if (on) // { // systemmode |= mm; // } // else // { // systemmode &= ~mm; // } // } // return; // } if (line.StartsWith("Warning:")) { Trace.WriteLine("! " + line); return; } if (line == "Variable unavailable, or not valid" || line == "Error: Variable not found") { vars.Remove(lastvar); currentframe.RemoveAuto(lastvar); return; } if (line == "Failed to find method to match source line. Unable to set breakpoint.") { bp.SetBound(false); return; } if (line == "Process exited.") { OnDebugProcessExited(); return; } if (line == "No local variables in scope.") { return; } if (line == "Process not running.") { return; } m = threadstate.Match(line); if (m.Success) { return; } m = threadmsg.Match(line); if (m.Success) { return; } m = sourceparse.Match(line); if (m.Success) { othervars.Clear(); autos = new Set(); locals.Clear(); frames.Clear(); string src = m.Groups["source"].Value; foreach (Match mm in autoparse.Matches(src)) { if (mm.Groups["var"].Success) { string var = mm.Groups["var"].Value; if (IsAllowed(var)) { autos.Add(var); } } } return; } StackFrame sf = StackFrame.FromDebugger(line); if (sf != null) { if (sf.IsCurrentFrame) { currentframe = sf; currentframe.SetAutos(autos); } frames.Add(sf); return; } m = proccreated.Match(line); if (m.Success) { return; } m = varparse.Match(line); if (m.Success) { string var = m.Groups["var"].Value; string type = m.Groups["type"].Value; if (exinfo == null) { if (var.StartsWith("$")) { othervars.Add(var); } else { if (!dontadd) { locals.Add(var); } else { autos.Add(var); } } Trace.WriteLine(string.Format("n: {0} v: {1}", var, type)); vars[var] = type; } else { switch (var) { case "_message": exinfo.message = type; break; } } return; } m = bpparse.Match(line); if (m.Success) { bool active = m.Groups["active"].Success; bool unbound = m.Groups["unbound"].Success; string bpid = m.Groups["id"].Value; string file = m.Groups["file"].Value; string meth = m.Groups["meth"].Value; if (bp == null) { bp = new Breakpoint(); } bp.id = Convert.ToInt32(bpid); bp.SetBound(active && !unbound); return; } m = bpparse2.Match(line); if (m.Success) { bool unbound = m.Groups["unbound"].Success; string bpid = m.Groups["id"].Value; string file = m.Groups["file"].Value; if (bp == null) { bp = new Breakpoint(); } bp.id = Convert.ToInt32(bpid); bp.SetBound(!unbound); return; } m = bpbound.Match(line); if (m.Success) { int bpid = Convert.ToInt32(m.Groups["id"].Value); Breakpoint bp = bptracker[bpid] as Breakpoint; if (bp != null) { bp.SetBound(true); } return; } m = bpbreak.Match(line); if (m.Success) { int bpid = Convert.ToInt32(m.Groups["id"].Value); Breakpoint bp = bptracker[bpid] as Breakpoint; return; } m = exparse.Match(line); if (m.Success) { int addr = Convert.ToInt32(m.Groups["ex"].Value, 16); string extype = m.Groups["type"].Value; Trace.WriteLine(addr, extype); exinfo = new ExceptionInfo(); exinfo.type = extype; return; } Trace.WriteLine(string.Format("# Line not parsed: {0}", line)); }
private void SetParameters(StackFrame callingFrame) { Parameters = callingFrame?.GetMethod()?.GetParameters().Select(it => it.Name); }
private static string StackTraceToString(StackTrace stackTrace) { DisposeTrackerObject <T> .< > c__DisplayClass8 CS$ < > 8__locals1 = new DisposeTrackerObject <T> .< > c__DisplayClass8(); CS$ < > 8__locals1.stackTrace = stackTrace; int k = 0; CS$ < > 8__locals1.method = null; int num = Util.EvaluateOrDefault <int>(() => CS$ < > 8__locals1.stackTrace.FrameCount, 0); while (k < num) { try { CS$ < > 8__locals1.method = CS$ < > 8__locals1.stackTrace.GetFrame(k++).GetMethod(); Type declaringType = CS$ < > 8__locals1.method.DeclaringType; Type type = typeof(T); if (declaringType == null) { CS$ < > 8__locals1.method = null; } else { if (declaringType.GetTypeInfo().ContainsGenericParameters) { if (!type.GetTypeInfo().ContainsGenericParameters) { CS$ < > 8__locals1.method = null; continue; } type = type.GetGenericTypeDefinition(); } if (CS$ < > 8__locals1.method.IsConstructor && declaringType == type) { break; } } } catch { CS$ < > 8__locals1.method = null; } } if (k == num) { return(null); } string text = Util.EvaluateOrDefault <string>(() => CS$ < > 8__locals1.method.Name, string.Empty); if (k > 0 && !text.Equals(".ctor", StringComparison.Ordinal) && !text.Equals(".cctor", StringComparison.Ordinal)) { k--; } int j = k; Type type2 = null; while (j < CS$ < > 8__locals1.stackTrace.FrameCount) { CS$ < > 8__locals1.method = CS$ < > 8__locals1.stackTrace.GetFrame(j++).GetMethod(); Type declaringType2 = CS$ < > 8__locals1.method.DeclaringType; if (declaringType2 != typeof(T)) { type2 = declaringType2; break; } } if (type2 != null && !type2.GetTypeInfo().ContainsGenericParameters&& DisposeTrackerObject <T> .IsDisposeTrackable(type2)) { bool flag = false; Type type3 = typeof(DisposeTrackerObject <>).MakeGenericType(new Type[] { type2 }); if (type3 != null) { FieldInfo declaredField = type3.GetTypeInfo().GetDeclaredField("isTypeRisky"); if (declaredField != null && declaredField.IsStatic && !declaredField.IsPublic) { flag = (bool)declaredField.GetValue(null); } } if (flag) { return(null); } } StringBuilder stringBuilder = new StringBuilder((CS$ < > 8__locals1.stackTrace.FrameCount - k) * 80); int i; for (i = k; i < CS$ < > 8__locals1.stackTrace.FrameCount; i++) { StackFrame currFrame = null; MethodBase currMethod = null; string text2 = null; string text3 = null; int num2 = 0; currFrame = Util.EvaluateOrDefault <StackFrame>(() => CS$ < > 8__locals1.stackTrace.GetFrame(i), null); if (currFrame != null) { currMethod = Util.EvaluateOrDefault <MethodBase>(() => currFrame.GetMethod(), null); if (currMethod != null) { if (currMethod.DeclaringType != null) { text3 = Util.EvaluateOrDefault <string>(() => currMethod.DeclaringType.ToString(), null); } text = Util.EvaluateOrDefault <string>(() => currMethod.Name, null); } text2 = Util.EvaluateOrDefault <string>(() => currFrame.GetFileName(), null); num2 = Util.EvaluateOrDefault <int>(() => currFrame.GetFileLineNumber(), 0); } stringBuilder.Append(" at "); stringBuilder.Append(text3 ?? "<UnknownType>"); stringBuilder.Append("."); stringBuilder.Append(text ?? "<UnknownMethod>"); stringBuilder.Append("("); try { DisposeTrackerObject <T> .AppendParamsToString(currMethod.GetParameters(), stringBuilder); } catch { stringBuilder.Append("<Error Getting Params>"); } stringBuilder.Append(")"); if (text2 != null) { stringBuilder.Append(" in "); stringBuilder.Append(text2); stringBuilder.Append(":line "); stringBuilder.Append(num2.ToString(CultureInfo.InvariantCulture)); } stringBuilder.Append(Environment.NewLine); } return(stringBuilder.ToString()); }
private bool TryGetStackFrameInfo(StackFrame /*!*/ frame, out string /*!*/ methodName, out string /*!*/ fileName, out int line) { MethodBase method = frame.GetMethod(); methodName = method.Name; fileName = (_hasFileAccessPermission) ? GetFileName(frame) : null; var sourceLine = line = PlatformAdaptationLayer.IsCompactFramework ? 0 : frame.GetFileLineNumber(); if (TryParseRubyMethodName(ref methodName, ref fileName, ref line)) { if (sourceLine == 0) { RubyMethodDebugInfo debugInfo; if (RubyMethodDebugInfo.TryGet(method, out debugInfo)) { var ilOffset = frame.GetILOffset(); if (ilOffset >= 0) { var mappedLine = debugInfo.Map(ilOffset); if (mappedLine != 0) { line = mappedLine; } } } } return(true); } else if (method.IsDefined(typeof(RubyStackTraceHiddenAttribute), false)) { return(false); } else { object[] attrs = method.GetCustomAttributes(typeof(RubyMethodAttribute), false); if (attrs.Length > 0) { // Ruby library method: // TODO: aliases methodName = ((RubyMethodAttribute)attrs[0]).Name; if (!_exceptionDetail) { fileName = null; line = NextFrameLine; } return(true); } else if (_exceptionDetail || IsVisibleClrFrame(method)) { // Visible CLR method: if (String.IsNullOrEmpty(fileName)) { if (method.DeclaringType != null) { fileName = (_hasFileAccessPermission) ? GetAssemblyName(method.DeclaringType.Assembly) : null; line = 0; } } return(true); } else { // Invisible CLR method: return(false); } } }
public bool SaveVacationRecordData(List <VcationRecordDL> objList) { StackFrame stackFrame = new StackFrame(); MethodBase methodBase = stackFrame.GetMethod(); try { OpenEntityConnection(); int Result = 0; if (objList != null) { foreach (var obj in objList) { // data base bind if (obj.RowStatus == 0) { } //Add else if (obj.RowStatus == 1) { Hr_EmpVactionRecord newobj = new Hr_EmpVactionRecord(); newobj.Rec_Hdr_Id = GetNewHeaderId(); newobj.Company_Id = obj.Company_Id; newobj.Branch_Id = obj.Branch_Id; newobj.Emp_Serial_No = obj.Emp_Serial_No; newobj.Rec_Order_HdrId = GetNewHeaderId(); newobj.Rec_Order_No = "0"; newobj.Request_Id = obj.Request_Id; newobj.TransDate = DateTime.Now.ToString("yyyyMMdd"); newobj.FromDate = obj.FromDate; newobj.ToDate = obj.ToDate; newobj.BackDate = Convert.ToString(obj.BackDate); newobj.Vaction_Period = obj.Vaction_Period; newobj.PlaceOfResidence = obj.PlaceOfResidence; newobj.Commissioner_Serial_no = obj.Emp_Serial_No; newobj.Reason = obj.Reason; newobj.InsUser = UserNameProperty; newobj.InsDate = DateTime.Now; newobj.DocumentPath = null; newobj.Reason = obj.Reason; newobj.MessageNotesForEmp = obj.MessageNotesForEmpeason; newobj.HireItem_Id = obj.HireItem_Id; newobj.FreeBalancRequest = obj.FreeBalancRequest; newobj.ChargeBalancRequest = obj.ChargeBalancRequest; newobj.AcuallBackDate = obj.AcuallBackDate; newobj.AcuallVaction_Peiod = obj.AcuallVaction_Peiod; newobj.Contract_Id = obj.Contract_Id; newobj.ContractPeriod_Id = obj.ContractPeriod_Id; newobj.Tot_Transferd_Period = obj.Tot_Transferd_Period; newobj.Curr_DiscVac_Period = obj.Curr_DiscVac_Period; newobj.Curr_DiscTransferd_Period = obj.Curr_DiscTransferd_Period; newobj.Prev_Vaction_Period = obj.Prev_Vaction_Period; newobj.CurrAllowedVacTillDate = obj.CurrAllowedVacTillDate; newobj.Vac_Place_Type = null; newobj.Offical_Vaction_Period = obj.Offical_Vaction_Period; newobj.VactionFromPrmEffec = obj.VactionFromPrmEffec; newobj.Confirmed = 0; objPharmaEntities.Hr_EmpVactionRecord.Add(newobj); Result = objPharmaEntities.SaveChanges(); } //Edit else if (obj.RowStatus == 2) { if (obj.Rec_Hdr_Id != Guid.Empty) { Hr_EmpVactionRecord ObjForUpdate = (from objLinq in objPharmaEntities.Hr_EmpVactionRecord where objLinq.Rec_Hdr_Id == obj.Rec_Hdr_Id select objLinq).FirstOrDefault(); if (ObjForUpdate != null) { ObjForUpdate.Emp_Serial_No = obj.Emp_Serial_No; ObjForUpdate.FromDate = obj.FromDate; ObjForUpdate.ToDate = obj.ToDate; ObjForUpdate.PlaceOfResidence = obj.PlaceOfResidence; ObjForUpdate.Reason = obj.Reason; ObjForUpdate.UpdateUser = UserNameProperty; ObjForUpdate.UpdateDate = DateTime.Now; Result = objPharmaEntities.SaveChanges(); } } else { Hr_EmpVactionRecord newobj = new Hr_EmpVactionRecord(); newobj.Rec_Hdr_Id = GetNewHeaderId(); newobj.Company_Id = obj.Company_Id; newobj.Branch_Id = obj.Branch_Id; newobj.Emp_Serial_No = obj.Emp_Serial_No; newobj.Rec_Order_HdrId = GetNewHeaderId(); newobj.Rec_Order_No = "0"; newobj.Request_Id = obj.Request_Id; newobj.TransDate = DateTime.Now.ToString("yyyyMMdd"); newobj.FromDate = obj.FromDate; newobj.ToDate = obj.ToDate; newobj.BackDate = Convert.ToString(obj.BackDate); newobj.Vaction_Period = obj.Vaction_Period; newobj.PlaceOfResidence = obj.PlaceOfResidence; newobj.Commissioner_Serial_no = obj.Emp_Serial_No; newobj.Reason = obj.Reason; newobj.InsUser = UserNameProperty; newobj.InsDate = DateTime.Now; newobj.DocumentPath = null; newobj.Reason = obj.Reason; newobj.MessageNotesForEmp = obj.MessageNotesForEmpeason; newobj.HireItem_Id = obj.HireItem_Id; newobj.FreeBalancRequest = obj.FreeBalancRequest; newobj.ChargeBalancRequest = obj.ChargeBalancRequest; newobj.AcuallBackDate = obj.AcuallBackDate; newobj.AcuallVaction_Peiod = obj.AcuallVaction_Peiod; newobj.Contract_Id = obj.Contract_Id; newobj.ContractPeriod_Id = obj.ContractPeriod_Id; newobj.Tot_Transferd_Period = obj.Tot_Transferd_Period; newobj.Curr_DiscVac_Period = obj.Curr_DiscVac_Period; newobj.Curr_DiscTransferd_Period = obj.Curr_DiscTransferd_Period; newobj.Prev_Vaction_Period = obj.Prev_Vaction_Period; newobj.CurrAllowedVacTillDate = obj.CurrAllowedVacTillDate; newobj.Vac_Place_Type = null; newobj.Offical_Vaction_Period = obj.Offical_Vaction_Period; newobj.VactionFromPrmEffec = obj.VactionFromPrmEffec; newobj.Confirmed = 0; objPharmaEntities.Hr_EmpVactionRecord.Add(newobj); Result = objPharmaEntities.SaveChanges(); } } //Delete else if (obj.RowStatus == 3) { if (obj.Rec_Hdr_Id != Guid.Empty) { Hr_EmpVactionRecord ObjForDelete = (from objLinq in objPharmaEntities.Hr_EmpVactionRecord where objLinq.Rec_Hdr_Id == obj.Rec_Hdr_Id select objLinq).FirstOrDefault(); if (ObjForDelete != null) { objPharmaEntities.Hr_EmpVactionRecord.Remove(ObjForDelete); objPharmaEntities.SaveChanges(); } } else { } } else { } } return(Result > 0); } else { return(Result < 0); } } catch (Exception ex) { catchEntityvalidation((System.Data.Entity.Validation.DbEntityValidationException)ex, System.Runtime.InteropServices.Marshal.GetExceptionCode().ToString(), this.UserNameProperty.ToString(), this.GetType().Name.ToString(), methodBase.Name.ToString()); ex.InnerException.Message.ToString(); return(false); } finally { CloseEntityConnection(); } }
public static string TraceToString(StackTrace st, TraceFormat tf, int startFrameIndex = 0) { bool isHtml = (tf == TraceFormat.Html); string newLine = (isHtml) ? "<br />" + Environment.NewLine : Environment.NewLine; bool flag = true; string format; bool flag2 = true; var builder = new StringBuilder(0xff); if (isHtml) { builder.Append("<span style=\"font-family: Courier New; font-size: 10pt;\">"); } for (int i = startFrameIndex; i < st.FrameCount; i++) { StackFrame frame = st.GetFrame(i); MethodBase method = frame.GetMethod(); if (method != null) { if (flag2) { flag2 = false; } else { builder.Append(newLine); } if (isHtml) { builder.Append(" <span style=\"color: #808080;\">at</span> "); } else { builder.Append(" at "); } Type declaringType = method.DeclaringType; bool isForm = IsFormStackFrame(frame); if (declaringType != null) { string ns = declaringType.Namespace.Replace('+', '.'); string name = declaringType.Name.Replace('+', '.'); if (isHtml) { if (isForm) { builder.Append("<span style=\"font-weight: bold;\">"); } builder.Append(System.Web.HttpUtility.HtmlEncode(ns)); builder.Append("."); builder.AppendFormat("<span style=\"color: #2B91AF; \">{0}</span>", System.Web.HttpUtility.HtmlEncode(name)); if (isForm) { builder.Append("</span>"); } } else { builder.AppendFormat("{0}.{1}", ns, name); } builder.Append("."); } if (isHtml && isForm) { builder.Append("<span style=\"font-weight: bold; color: #800000;\">"); } builder.Append(method.Name); if ((method is MethodInfo) && ((MethodInfo)method).IsGenericMethod) { Type[] genericArguments = ((MethodInfo)method).GetGenericArguments(); builder.Append("["); int index = 0; bool flag3 = true; while (index < genericArguments.Length) { if (!flag3) { builder.Append(","); } else { flag3 = false; } builder.Append(genericArguments[index].Name); index++; } builder.Append("]"); } builder.Append("("); ParameterInfo[] parameters = method.GetParameters(); bool flag4 = true; for (int j = 0; j < parameters.Length; j++) { var param = parameters[j]; if (!flag4) { builder.Append(", "); } else { flag4 = false; } string paramType = "<UnknownType>"; bool isClass = false; if (param.ParameterType != null) { isClass = param.ParameterType.IsClass; paramType = param.ParameterType.Name; } if (isHtml) { if (isClass) { builder.Append("<span style=\"color: #2B91AF; \">"); } builder.Append(System.Web.HttpUtility.HtmlEncode(paramType)); if (isClass) { builder.Append("</span>"); } builder.Append(" "); builder.Append(System.Web.HttpUtility.HtmlEncode(paramType)); } else { builder.AppendFormat("{0} {1}", paramType, param.Name); } } builder.Append(")"); if (isHtml && isForm) { builder.Append("</span>"); } if (flag && (frame.GetILOffset() != -1)) { string fileName = null; try { fileName = frame.GetFileName(); } catch (NotSupportedException) { flag = false; } catch (SecurityException) { flag = false; } if (fileName != null) { if (isHtml) { builder.Append("<br /> "); var l = System.Web.HttpUtility.UrlEncode(fileName.Replace("\\", "/")).Replace("+", "%20"); var addLink = false; if (addLink) { builder.AppendFormat("<a href=\"file:///{0}\" style=\"text-decoration: none; color: #000000;\">", l); } else { builder.AppendFormat("<span style=\"color: #000000;\">"); } if (isForm) { builder.AppendFormat("<span style=\"color: #800000;\">{0}</span>", System.Web.HttpUtility.HtmlEncode(fileName)); } else { builder.Append(fileName); } if (addLink) { builder.Append("</a>"); } else { builder.Append("</span>"); } builder.Append("<span style=\"color: #808080;\">,</span> "); builder.Append(frame.GetFileLineNumber()); builder.AppendFormat("<span style=\"color: #808080;\">:{0}</span>", frame.GetFileColumnNumber()); } else { format = " in {0}, {1}:{2}"; builder.AppendFormat(CultureInfo.InvariantCulture, format, fileName, frame.GetFileLineNumber(), frame.GetFileColumnNumber()); } } } } } if (isHtml || tf == TraceFormat.TrailingNewLine) { builder.Append(newLine); } if (isHtml) { builder.Append("</span>"); } return(builder.ToString()); }
private static string GetScenarioTextAttribute(StackFrame it) { return(GetScenarioTextAttribute(it.GetMethod())); }
private static string GetCurrentMethod(StackFrame sf) { return(sf.GetMethod().Name); }
[MethodImpl(MethodImplOptions.NoInlining)] // CF private static string GetFileName(StackFrame /*!*/ frame) { return(frame.GetFileName()); }
static void smethod_4() { if (!Class0.bool_0) { Class0.bool_0 = true; BinaryReader binaryReader = new BinaryReader(typeof(Class0).Assembly.GetManifestResourceStream("17821e8f-b9b6-4f35-849b-254960e63287")); binaryReader.BaseStream.Position = 0L; byte[] array = binaryReader.ReadBytes((int)binaryReader.BaseStream.Length); byte[] array2 = new byte[32]; array2[0] = 124; array2[0] = 141; array2[0] = 96; array2[0] = 197; array2[1] = 156; array2[1] = 149; array2[1] = 100; array2[1] = 129; array2[1] = 127; array2[2] = 166; array2[2] = 18; array2[2] = 140; array2[2] = 92; array2[2] = 173; array2[2] = 159; array2[3] = 122; array2[3] = 54; array2[3] = 21; array2[3] = 114; array2[3] = 90; array2[3] = 116; array2[4] = 195; array2[4] = 169; array2[4] = 51; array2[4] = 77; array2[4] = 184; array2[4] = 167; array2[5] = 127; array2[5] = 120; array2[5] = 101; array2[5] = 254; array2[6] = 163; array2[6] = 176; array2[6] = 144; array2[6] = 160; array2[6] = 110; array2[7] = 51; array2[7] = 155; array2[7] = 84; array2[7] = 163; array2[8] = 104; array2[8] = 101; array2[8] = 130; array2[8] = 100; array2[8] = 175; array2[9] = 206; array2[9] = 116; array2[9] = 75; array2[9] = 147; array2[9] = 162; array2[9] = 170; array2[10] = 162; array2[10] = 200; array2[10] = 242; array2[11] = 158; array2[11] = 174; array2[11] = 53; array2[12] = 160; array2[12] = 116; array2[12] = 170; array2[12] = 150; array2[13] = 88; array2[13] = 89; array2[13] = 215; array2[14] = 142; array2[14] = 153; array2[14] = 164; array2[14] = 127; array2[14] = 130; array2[14] = 172; array2[15] = 117; array2[15] = 95; array2[15] = 172; array2[15] = 93; array2[16] = 112; array2[16] = 148; array2[16] = 158; array2[16] = 86; array2[16] = 252; array2[17] = 109; array2[17] = 149; array2[17] = 82; array2[17] = 53; array2[18] = 129; array2[18] = 154; array2[18] = 197; array2[18] = 139; array2[18] = 151; array2[19] = 165; array2[19] = 146; array2[19] = 144; array2[19] = 90; array2[19] = 181; array2[20] = 111; array2[20] = 130; array2[20] = 114; array2[20] = 67; array2[20] = 53; array2[21] = 138; array2[21] = 75; array2[21] = 106; array2[21] = 108; array2[21] = 208; array2[22] = 92; array2[22] = 168; array2[22] = 94; array2[22] = 110; array2[22] = 39; array2[23] = 124; array2[23] = 67; array2[23] = 198; array2[24] = 117; array2[24] = 146; array2[24] = 87; array2[24] = 190; array2[24] = 106; array2[24] = 17; array2[25] = 7; array2[25] = 109; array2[25] = 63; array2[25] = 195; array2[25] = 105; array2[26] = 110; array2[26] = 84; array2[26] = 25; array2[27] = 117; array2[27] = 103; array2[27] = 119; array2[27] = 11; array2[28] = 133; array2[28] = 72; array2[28] = 108; array2[28] = 110; array2[29] = 151; array2[29] = 130; array2[29] = 181; array2[29] = 147; array2[29] = 96; array2[29] = 205; array2[30] = 118; array2[30] = 116; array2[30] = 96; array2[30] = 197; array2[31] = 170; array2[31] = 33; array2[31] = 124; byte[] rgbKey = array2; byte[] array3 = new byte[16]; array3[0] = 124; array3[0] = 144; array3[0] = 56; array3[1] = 55; array3[1] = 97; array3[1] = 90; array3[1] = 145; array3[1] = 186; array3[2] = 224; array3[2] = 129; array3[2] = 95; array3[3] = 160; array3[3] = 146; array3[3] = 77; array3[3] = 211; array3[3] = 106; array3[3] = 243; array3[4] = 141; array3[4] = 163; array3[4] = 169; array3[5] = 144; array3[5] = 114; array3[5] = 114; array3[5] = 110; array3[5] = 139; array3[5] = 243; array3[6] = 102; array3[6] = 132; array3[6] = 157; array3[7] = 87; array3[7] = 169; array3[7] = 204; array3[7] = 132; array3[7] = 167; array3[8] = 96; array3[8] = 78; array3[8] = 223; array3[8] = 124; array3[9] = 110; array3[9] = 165; array3[9] = 137; array3[9] = 95; array3[9] = 97; array3[10] = 150; array3[10] = 144; array3[10] = 88; array3[10] = 60; array3[11] = 136; array3[11] = 127; array3[11] = 163; array3[11] = 92; array3[11] = 86; array3[11] = 91; array3[12] = 76; array3[12] = 130; array3[12] = 88; array3[12] = 163; array3[12] = 29; array3[13] = 222; array3[13] = 130; array3[13] = 148; array3[13] = 164; array3[13] = 100; array3[13] = 46; array3[14] = 118; array3[14] = 151; array3[14] = 150; array3[14] = 32; array3[15] = 211; array3[15] = 154; array3[15] = 166; array3[15] = 126; array3[15] = 129; array3[15] = 232; byte[] array4 = array3; byte[] publicKeyToken = typeof(Class0).Assembly.GetName().GetPublicKeyToken(); if (publicKeyToken != null && publicKeyToken.Length > 0) { array4[1] = publicKeyToken[0]; array4[3] = publicKeyToken[1]; array4[5] = publicKeyToken[2]; array4[7] = publicKeyToken[3]; array4[9] = publicKeyToken[4]; array4[11] = publicKeyToken[5]; array4[13] = publicKeyToken[6]; array4[15] = publicKeyToken[7]; } ICryptoTransform transform = new RijndaelManaged { Mode = CipherMode.CBC }.CreateDecryptor(rgbKey, array4); MemoryStream memoryStream = new MemoryStream(); CryptoStream cryptoStream = new CryptoStream(memoryStream, transform, CryptoStreamMode.Write); cryptoStream.Write(array, 0, array.Length); cryptoStream.FlushFinalBlock(); byte[] buffer = memoryStream.ToArray(); memoryStream.Close(); cryptoStream.Close(); binaryReader.Close(); binaryReader = new BinaryReader(new MemoryStream(buffer)); binaryReader.BaseStream.Position = 0L; IntPtr intptr_ = IntPtr.Zero; Assembly assembly = typeof(Class0).Assembly; intptr_ = Class0.OpenProcess(56u, 1, (uint)Process.GetCurrentProcess().Id); Class0.int_2 = Marshal.GetHINSTANCE(assembly.GetModules()[0]).ToInt32(); Class0.long_0 = Marshal.GetHINSTANCE(assembly.GetModules()[0]).ToInt64(); IntPtr zero = IntPtr.Zero; int num = binaryReader.ReadInt32(); binaryReader.ReadInt32(); for (int i = 0; i < num; i++) { if (IntPtr.Size == 4) { Class0.WriteProcessMemory(intptr_, new IntPtr(Class0.int_2 + binaryReader.ReadInt32()), BitConverter.GetBytes(binaryReader.ReadInt32()), 4u, out zero); } else { Class0.WriteProcessMemory(intptr_, new IntPtr(Class0.long_0 + (long)binaryReader.ReadInt32()), BitConverter.GetBytes(binaryReader.ReadInt32()), 4u, out zero); } } while (binaryReader.BaseStream.Position < binaryReader.BaseStream.Length - 1L) { int num2 = binaryReader.ReadInt32(); int num3 = binaryReader.ReadInt32(); int num4 = binaryReader.ReadInt32(); byte[] byte_ = binaryReader.ReadBytes(num4); if (num3 > 0) { Class0.sortedList_0[num3] = num2; } if (IntPtr.Size == 4) { Class0.WriteProcessMemory(intptr_, new IntPtr(Class0.int_2 + num2), byte_, Convert.ToUInt32(num4), out zero); } else { Class0.WriteProcessMemory(intptr_, new IntPtr(Class0.long_0 + (long)num2), byte_, Convert.ToUInt32(num4), out zero); } } int metadataToken = new StackFrame(1).GetMethod().MetadataToken; object obj = Class0.sortedList_0[metadataToken]; if (obj != null) { if (IntPtr.Size == 4) { Class0.WriteProcessMemory(intptr_, new IntPtr(Class0.int_2 + (int)obj), new byte[] { 255, 255, 255, 255 }, 4u, out zero); } else { Class0.WriteProcessMemory(intptr_, new IntPtr(Class0.long_0 + (long)((int)obj)), new byte[] { 255, 255, 255, 255 }, 4u, out zero); } Class0.sortedList_0.Remove(metadataToken); } StackFrame stackFrame = new StackFrame(2); if (stackFrame.GetMethod() != null) { int metadataToken2 = stackFrame.GetMethod().MetadataToken; object obj2 = Class0.sortedList_0[metadataToken2]; if (obj2 != null) { if (IntPtr.Size == 4) { Class0.WriteProcessMemory(intptr_, new IntPtr(Class0.int_2 + (int)obj2), new byte[] { 255, 255, 255, 255 }, 4u, out zero); } else { Class0.WriteProcessMemory(intptr_, new IntPtr(Class0.long_0 + (long)((int)obj2)), new byte[] { 255, 255, 255, 255 }, 4u, out zero); } Class0.sortedList_0.Remove(metadataToken2); } } Class0.CloseHandle(intptr_); return; } StackFrame stackFrame2 = new StackFrame(1); int metadataToken3 = stackFrame2.GetMethod().MetadataToken; object obj3 = Class0.sortedList_0[metadataToken3]; if (obj3 != null) { IntPtr intptr_2 = IntPtr.Zero; intptr_2 = Class0.OpenProcess(56u, 1, (uint)Process.GetCurrentProcess().Id); IntPtr zero2 = IntPtr.Zero; if (IntPtr.Size == 4) { Class0.WriteProcessMemory(intptr_2, new IntPtr(Class0.int_2 + (int)obj3), new byte[] { 255, 255, 255, 255 }, 4u, out zero2); } else { Class0.WriteProcessMemory(intptr_2, new IntPtr(Class0.long_0 + (long)((int)obj3)), new byte[] { 255, 255, 255, 255 }, 4u, out zero2); } Class0.sortedList_0.Remove(metadataToken3); Class0.CloseHandle(intptr_2); } }
private static string StackCallString(StackFrame stack) { return("(Line " + stack.GetFileLineNumber() + ", " + stack.GetMethod().ReflectedType.Name + ", " + stack.GetMethod() + ")"); }
/// <summary> /// Get the caller of current function /// </summary> /// <param name="level"></param> /// <returns></returns> private static string GetCaller(int level = 2) { var sf = new StackFrame(level); return(sf.GetMethod().Name); }
private static void _HandleException(System.Exception e, string message, bool uncaught) { if (e == null) { return; } if (!IsInitialized) { return; } string name = e.GetType().Name; string reason = e.Message; if (!string.IsNullOrEmpty(message)) { reason = string.Format("{0}{1}***{2}", reason, Environment.NewLine, message); } StringBuilder stackTraceBuilder = new StringBuilder(""); StackTrace stackTrace = new StackTrace(e, true); int count = stackTrace.FrameCount; for (int i = 0; i < count; i++) { StackFrame frame = stackTrace.GetFrame(i); stackTraceBuilder.AppendFormat("{0}.{1}", frame.GetMethod().DeclaringType.Name, frame.GetMethod().Name); ParameterInfo[] parameters = frame.GetMethod().GetParameters(); if (parameters == null || parameters.Length == 0) { stackTraceBuilder.Append(" () "); } else { stackTraceBuilder.Append(" ("); int pcount = parameters.Length; ParameterInfo param = null; for (int p = 0; p < pcount; p++) { param = parameters [p]; stackTraceBuilder.AppendFormat("{0} {1}", param.ParameterType.Name, param.Name); if (p != pcount - 1) { stackTraceBuilder.Append(", "); } } param = null; stackTraceBuilder.Append(") "); } string fileName = frame.GetFileName(); if (!string.IsNullOrEmpty(fileName) && !fileName.ToLower().Equals("unknown")) { fileName = fileName.Replace("\\", "/"); int loc = fileName.ToLower().IndexOf("/assets/"); if (loc < 0) { loc = fileName.ToLower().IndexOf("assets/"); } if (loc > 0) { fileName = fileName.Substring(loc); } stackTraceBuilder.AppendFormat("(at {0}:{1})", fileName, frame.GetFileLineNumber()); } stackTraceBuilder.AppendLine(); } // report _reportException(uncaught, name, reason, stackTraceBuilder.ToString()); }
public List <Table> GetFootballTables() { var tables = new List <Table>(); var web = new HtmlWeb(); HtmlDocument doc; try { //get div 1 var div1 = new Table { League = "Roinn 1", Division = new List <LeagueRow>() }; var link = "http://www.gaa.ie/fixtures-and-results/league-tables/football-league-tables/roinn-1/2015/"; doc = web.Load(link); var nodes = doc.DocumentNode.SelectNodes("//table [@id='league_table2']//tr"); for (var i = 1; i < nodes.Count; i++) { var row = new LeagueRow { Pos = nodes[i].ChildNodes[0].InnerText, Name = nodes[i].ChildNodes[1].InnerText, Played = nodes[i].ChildNodes[2].InnerText, Won = nodes[i].ChildNodes[3].InnerText, Lost = nodes[i].ChildNodes[4].InnerText, Drawn = nodes[i].ChildNodes[5].InnerText, For = nodes[i].ChildNodes[6].InnerText, Aga = nodes[i].ChildNodes[7].InnerText, Points = nodes[i].ChildNodes[8].InnerText }; div1.Division.Add(row); } tables.Add(div1); //get div 2 var div2 = new Table { League = "Roinn 2", Division = new List <LeagueRow>() }; var link2 = "http://www.gaa.ie/fixtures-and-results/league-tables/football-league-tables/roinn-2/2015/"; doc = web.Load(link2); var nodes2 = doc.DocumentNode.SelectNodes("//table [@id='league_table2']//tr"); for (var i = 1; i < nodes2.Count; i++) { var row = new LeagueRow { Pos = nodes2[i].ChildNodes[0].InnerText, Name = nodes2[i].ChildNodes[1].InnerText, Played = nodes2[i].ChildNodes[2].InnerText, Won = nodes2[i].ChildNodes[3].InnerText, Lost = nodes2[i].ChildNodes[4].InnerText, Drawn = nodes2[i].ChildNodes[5].InnerText, For = nodes2[i].ChildNodes[6].InnerText, Aga = nodes2[i].ChildNodes[7].InnerText, Points = nodes2[i].ChildNodes[8].InnerText }; div2.Division.Add(row); } tables.Add(div2); //get div 3 var div3 = new Table { League = "Roinn 3", Division = new List <LeagueRow>() }; var link3 = "http://www.gaa.ie/fixtures-and-results/league-tables/football-league-tables/roinn-3/2015/"; doc = web.Load(link3); var nodes3 = doc.DocumentNode.SelectNodes("//table [@id='league_table2']//tr"); for (var i = 1; i < nodes3.Count; i++) { var row = new LeagueRow { Pos = nodes3[i].ChildNodes[0].InnerText, Name = nodes3[i].ChildNodes[1].InnerText, Played = nodes3[i].ChildNodes[2].InnerText, Won = nodes3[i].ChildNodes[3].InnerText, Lost = nodes3[i].ChildNodes[4].InnerText, Drawn = nodes3[i].ChildNodes[5].InnerText, For = nodes3[i].ChildNodes[6].InnerText, Aga = nodes3[i].ChildNodes[7].InnerText, Points = nodes3[i].ChildNodes[8].InnerText }; div3.Division.Add(row); } tables.Add(div3); //get div 4 var div4 = new Table { League = "Roinn 4", Division = new List <LeagueRow>() }; var link4 = "http://www.gaa.ie/fixtures-and-results/league-tables/football-league-tables/roinn-4/2015/"; doc = web.Load(link4); var nodes4 = doc.DocumentNode.SelectNodes("//table [@id='league_table2']//tr"); for (var i = 1; i < nodes4.Count; i++) { var row = new LeagueRow { Pos = nodes4[i].ChildNodes[0].InnerText, Name = nodes4[i].ChildNodes[1].InnerText, Played = nodes4[i].ChildNodes[2].InnerText, Won = nodes4[i].ChildNodes[3].InnerText, Lost = nodes4[i].ChildNodes[4].InnerText, Drawn = nodes4[i].ChildNodes[5].InnerText, For = nodes4[i].ChildNodes[6].InnerText, Aga = nodes4[i].ChildNodes[7].InnerText, Points = nodes4[i].ChildNodes[8].InnerText }; div4.Division.Add(row); } tables.Add(div4); } catch (Exception ex) { var stackFrame = new StackFrame(); var methodBase = stackFrame.GetMethod(); Database.InsertErrorToDb(methodBase.Name, ex.Message, ex.ToString()); } return(tables); }
public List <EmpRptDL> FillEmployeeBySerialAndRoleWithShow(string Company_Id, string Branch_Id, decimal EmpSerialNo) { StackFrame stackFrame = new StackFrame(); MethodBase methodBase = stackFrame.GetMethod(); List <EmpRptDL> objectList = new List <EmpRptDL>();; try { OpenEntityConnection(); object[] param1 = { new SqlParameter("@Company_Id", Company_Id), new SqlParameter("@Branch_Id", Branch_Id), new SqlParameter("@EmpSerialNo", EmpSerialNo) }; // object[] params = { // new SqlParameter("@ParametterWithNummvalue", DBNull.Value), // new SqlParameter("@In_Parameter", "Value"), // new SqlParameter("@Out_Parameter", SqlDbType.INT) //{Direction = ParameterDirection.Output}}; // YourDbContext.Database.ExecuteSqlCommand("exec StoreProcedure_Name @ParametterWithNummvalue, @In_Parameter, @Out_Parameter", params); // YourDbContext.SaveChanges(); //Var ReturnValue = ((SqlParameter)params[2]).Value var objlist = objPharmaEntities.Database.SqlQuery <EmpRptDL>("exec dbo._SpFillEmployeeBySerialAndRoleWithShow @Company_Id,@Branch_Id,@EmpSerialNo", param1).ToList(); //var objlist = objPharmaEntities.Database.ExecuteSqlCommand("exec dbo.SP_GeneralAnyCombo @FldIdName,@FldName,@TblName,@Strwhere", param1); if (objlist != null) { foreach (var obj in objlist) { EmpRptDL objCombDL = new EmpRptDL(); objCombDL.Id = Convert.ToString(obj.Id); objCombDL.Name = obj.Name; objCombDL.FullNameArabic = obj.FullNameArabic; objectList.Add(objCombDL); } } } catch (Exception ex) { catchEntityvalidation((System.Data.Entity.Validation.DbEntityValidationException)ex, System.Runtime.InteropServices.Marshal.GetExceptionCode().ToString(), this.UserNameProperty.ToString(), this.GetType().Name.ToString(), methodBase.Name.ToString()); objectList = null; throw ex; } finally { CloseEntityConnection(); } return(objectList); }
internal void SaveCallstack(int stackDepth) { StackFrame frame = new StackFrame(stackDepth, true); SaveCallstack_Internal(frame.GetFileName(), frame.GetFileLineNumber()); }