public void ExportSong(Executer fileAccess, string folderPath, string format = "%ARTIST% - %TITLE%") { #if DEBUG #else try { #endif var beatmap = this.Beatmap; var copiedFilePath = Path.Combine(folderPath, beatmap.FormattedOutputFilename(format).AsValidPath()); fileAccess.AddAction(() => File.Copy(Path.Combine(this.path, beatmap.FileName), copiedFilePath, true), "Copying file : " + copiedFilePath); using (var copiedFile = fileAccess.AddFunc(() => TagLib.File.Create(copiedFilePath), "Creating taggable file from : " + copiedFilePath)) { copiedFile.RemoveTags(TagLib.TagTypes.Id3v2); copiedFile.Tag.Title = beatmap.Title; copiedFile.Tag.Performers = new string[] { beatmap.Artist }; var artworkPath = this.ArtworkPath; if (artworkPath != null) { copiedFile.Tag.Pictures = new[] { new TagLib.Picture(artworkPath) }; } fileAccess.AddAction(() => copiedFile.Save(), "Saving tagged file : " + copiedFilePath); } #if DEBUG #else } catch (Exception ex) { ExportLogger.GetInstance().LogError(ex, "put info"); } #endif }
public override BaseNode GetNextNode(Executer exec, BaseNode alreadyUsedChildNode, object nodesResult) { //Hmm, could I execute the if-statement directly here? Must I really wait //for executer to execute it and then proceed based on the result?? //I'll go for direct if-clause execution for now: if (alreadyUsedChildNode == null) { // if (this.m_ifExpression==null || Convert.ToInt32(this.m_ifExpression.Evaluate(exec)) != 0) if (this.m_ifExpression==null || Convert.ToInt32(this.m_ifExpression.Evaluate(exec).GetUnboxed(exec)) != 0) return (BaseNode)this.FirstChild; if (this.m_nextIfNode!=null) return this.m_nextIfNode; return null; } return base.GetNextNode(exec, alreadyUsedChildNode, nodesResult); // int nIndex = this.ChildNodes.IndexOfValue(alreadyUsedChildNode); // if (nIndex == 0) //it was the "if" clause // { // if ((int)((Types.Object)nodesResult).GetUnboxed() != 0) // return (BaseNode)this.ChildNodes.GetByIndex(2); //this is where the statements begin if it's true // if (this.ChildNodes.Count > 1) // return (BaseNode)this.ChildNodes.GetByIndex(1); // } // return null; }
public override Object PerformOperation(Executer exec, Operator op, Object otherTerm) { Object oNew = this.Evaluate(exec); if (op == null) return oNew; return oNew.PerformOperation(exec, op, otherTerm); }
public override Object Evaluate(Executer exec) { object[] args = new object[this.Arguments.Count]; System.Type[] argTypes = new Type[this.Arguments.Count]; for (int i = 0; i < this.Arguments.Count; i++) { Expression expr = (Expression)this.Arguments[i]; //terms for functions *always* have an Expression and no Value. args[i] = expr.Evaluate(exec).GetUnboxed(exec); argTypes[i] = args[i].GetType(); } if (this.BelongsToObject == null) this.BelongsToObject = MemberSearch.FindMethodObject(this.Name, argTypes); if (this.BelongsToObject.GetType() == typeof(Nodes.ClassNode)) { Nodes.MethodNode method = ((Nodes.ClassNode)this.BelongsToObject).GetMethod(this.Name); //TODO: arguments can't be set like this - another thread may call the same //method *while* this call is in execution, so arguments must be put on a stack! method.SetArguments(args); Executer exe = new Executer(method); object o = exe.Run(); //method.Execute(); return Object.CreateType(o); } return Object.CreateType(Endogine.Serialization.Access.CallMethod( this.BelongsToObject, this.Name, args)); }
public override Object Evaluate(Executer exec) { //EH.Put("var:"+this.Name); //this.ValueWrapper = null; object oNewVal = this.EvaluateToWrapper(exec).Value; return Object.CreateType(oNewVal); }
public override Object PerformOperation(Executer exec, Operator op, Object otherTerm) { if (op == null) return this; this.CheckOperation(op); string sReturn = ""; string sThis = (string)this.GetUnboxed(exec); string sOther = otherTerm.GetUnboxed(exec).ToString(); switch (op.InternalTokens) { case "+": sReturn = sThis + sOther; break; case "-": sReturn = sThis.Replace(sOther, ""); break; case "*": for (int i = Convert.ToInt32(sOther)-1; i>=0; i--) sReturn+=sThis; break; } //this.m_value = sReturn; //return this; return Types.Object.CreateType(sReturn); }
public MemberValueWrapper EvaluateToWrapper(Executer exec) { if (this.ValueWrapper == null) this.ValueWrapper = new MemberValueWrapper(this.Name, this.BelongsToObject); if (this.ValueWrapper.IsExec) this.ValueWrapper.Value = exec; return this.ValueWrapper; }
public virtual BaseNode GetNextNode(Executer exec, BaseNode alreadyUsedChildNode, object nodesResult) { if (alreadyUsedChildNode != null) return (BaseNode)alreadyUsedChildNode.NextSibling; if (this.HasChildNodes) return (BaseNode)this.FirstChild; return null; }
public override Object PerformOperation(Executer exec, Operator op, Object otherTerm) { if (op == null) return this; if (op.InternalTokens == ".") { object oUnboxed = null; oUnboxed = this.Evaluate(exec).GetUnboxed(exec); if (otherTerm.GetType() == typeof(Method)) { Method func = (Method)otherTerm; func.BelongsToObject = oUnboxed; return func.Evaluate(exec); } if (otherTerm.GetType() == typeof(Variable)) { Variable var = (Variable)otherTerm; var.BelongsToObject = oUnboxed; var.EvaluateToWrapper(exec); return var; } return null; } if (op.IsSettingOperator) { this.EvaluateToWrapper(exec); if (!op.IsBinary) { //TODO: ++ and -- operators return this; } Object oNewVal = otherTerm.Evaluate(exec); if (op.InternalTokens!="=") { //for other than "=", we need to know the current value string sSubOp = op.InternalTokens.Substring(0,1); Operator subOp = Parser.GetOperator(sSubOp); this.PerformOperation(exec, op, oNewVal); oNewVal = this; } this.ValueWrapper.Value = oNewVal.GetUnboxed(exec); return oNewVal; } Object oEvaluated = this.Evaluate(exec); return oEvaluated.PerformOperation(exec, op, otherTerm); }
private static int PrintOutput(Executer<Person, StatePopulation> executer) { var value = executer.Query("CA").Concat(executer.Query("TX")).Sum(x => x.Count); var results = executer.Query("CA"); foreach (var population in results) { Console.WriteLine(population); } results = executer.Query("TX"); foreach (var population in results) { Console.WriteLine(population); } Console.WriteLine(value); return value; }
public async void Logout() { IsBusy = true; try { await Executer.Execute(() => _userManagmentFacade.LogoutAsync()); } catch (Exception ex) { IsBusy = false; _errorHandler.Handle(ex); return; } _applicationSettings.RememberMe = false; _applicationSettings.UserCredentials = null; _analyticsService.Logout(); _navigationService.UriFor <LoginPageViewModel>().Navigate(); }
public async Task should_add_extension_object_when_exception_is_thrown_with_error_code() { string query = "{ firstSync }"; string code = "FIRST"; var result = await Executer.ExecuteAsync(_ => { _.Schema = Schema; _.Query = query; }); var errors = new ExecutionErrors(); var error = new ValidationError(query, code, "Error trying to resolve firstSync.", new SystemException("Just inner exception 1", new DllNotFoundException("just inner exception 2"))); error.AddLocation(1, 3); error.Path = new[] { "firstSync" }; errors.Add(error); var expectedResult = "{firstSync: null}"; AssertQuery(query, CreateQueryResult(expectedResult, errors), null, null); }
public void executer_get_should_be_throw_webexception() { byte[] buffer = Encoding.UTF8.GetBytes("{ IsSuccess : true }"); byte[] exBuffer = Encoding.UTF8.GetBytes("{ Message : \"Test Error\" }"); var mockHttpWebRequest = new Mock <HttpWebRequest>(); var mockHttpWebResponse = new Mock <HttpWebResponse>(); mockHttpWebResponse.Setup(x => x.StatusCode).Returns(HttpStatusCode.Unauthorized); mockHttpWebResponse.Setup(x => x.GetResponseStream()).Returns(new MemoryStream(exBuffer)); mockHttpWebRequest.Setup(x => x.GetResponse()) .Throws(new WebException("foo", null, WebExceptionStatus.ConnectFailure, mockHttpWebResponse.Object)); IExecuter executer = new Executer(mockHttpWebRequest.Object, new JsonResponseHandler()); var result = executer.Get <TestObject>(); bool actual = result.Status == HttpStatusCode.Unauthorized && result.ErrorMessage == "Test Error"; Assert.IsTrue(actual); }
public static void Main(string[] args) { KillAllPhantomjs(); var configuration = CreateConfiguration(); var executer = new Executer(configuration); var setting = new Setting() { PiplelineNames = new string[] { "Store" }, TotalConcurrency = 10 }; executer.AddSpider(new TMaill(), setting); executer.AddSpider(new MovieSpider(), setting); executer.AddSpider(new SimpleSpider(), setting); var spiderName = default(string); if (args != null && args.Length > 0) { spiderName = args[0].Trim(); } else { Console.WriteLine("please input spider name. empty will run all spider."); spiderName = Console.ReadLine().Trim(); } if (!string.IsNullOrEmpty(spiderName)) { executer.Start(spiderName); } else { executer.Start(); } Console.Read(); }
public VoyageViewModel() { //генерируем случайные рейсы Services.CreateVoyagesXML(100); //загружаем Voyages = Services.LoadVoyagesXML(); // создаем коллекцию с источником startViewVoyage = new CollectionViewSource() { Source = Voyages }; destViewVoyage = new CollectionViewSource() { Source = Voyages }; //добавляем фильтры startViewVoyage.Filter += new FilterEventHandler(startFilter); destViewVoyage.Filter += new FilterEventHandler(destFilter); StartInProgress = Voyages.Where(d => d.Status >= -1 && d.Status < 3).Count(); DestInProgress = Voyages.Where(d => d.Status >= 3).Count(); //сервис для потокового обновления коллекций UI Executer.Initialize(); //инициализция графиков graphVoyage = new GraphVoyage(); graphVoyage.ConfigChart(); //настраиваем таймер и запускаем таймер (имитатор времени) RealDateTime = DateTime.Now; dtimer = new DTimeService(RealDateTime); dtimer.OnChangeTime += Dtimer_OnChangeTime; dtimer.Start(); }
public async Task <GraphQLOutput> Query(GraphQLQuery query) { GraphQLOutput output = null; try { var executionResult = await Executer.ExecuteAsync(Schema, null, query.Query, null, query.GetInputs()); output = new GraphQLOutput(executionResult.Data, executionResult.Errors?.ToArray()); } catch (Exception ex) { output = new GraphQLOutput(null, new[] { new ExecutionError("Controller exception", ex), }); } if (!DisplayStackTrace && output.Errors != null) { foreach (var error in output.Errors) { error.StackTrace = null; } } return(output); }
protected override async void LoadItemsAsync() { IsBusy = true; IList <Event> events; try { events = (await Executer.Execute(() => EventProxyServer.GetEvents(null, EVENTS_LIMIT, EventSortField.EventId, Select.Extend, Select.Extend))).ToList(); } catch (Exception ex) { ErrorHandler.Handle(ex); return; } finally { IsBusy = false; } Items = InitDuration(events); }
private async Task <bool> CheckServer() { IsBusy = true; try { bool isValidZabbixServer = await Executer.Execute(() => _serverChecker.CheckUriAsync(Uri)); IsBusy = false; if (!isValidZabbixServer) { _messagingService.Alert(AppResources.Attention, AppResources.InvalidZabbixServerUri); return(false); } return(true); } catch (Exception e) { _errorHandler.Handle(e); IsBusy = false; return(false); } }
public override void Execute(Executer exec) { if (!Header.Text.EndsWithIgnoreCase(" then")) { throw ThrowHelper.ExpectedToken("THEN"); } Evaluator eval = new Evaluator( new StringSegment(Header.Text, Header.Text.IndexOf(' ') + 1, // Get rid of the IF Header.Text.LastIndexOf(' ') - 2), // Get rid of the THEN exec ); if (eval.EvaluateBool()) { exec.Execute(Body); } else if (HasElseBlock) { exec.Execute(Else.Body); } }
public async Task LoadAssemblyFromFile_DLL_MissingAsync() { var emptyFile = Path.GetTempFileName(); try { var errorDisplay = new ErrorDisplay(new AssertingConsole()); var exe = await Executer.GetDefaultExecuterAsync(errorDisplay); await exe.LoadAssemblyFromFileAsync(emptyFile); await exe.ExecuteAsync(string.Empty); Assert.Fail(); } catch (CompilationErrorException) { } finally { File.Delete(emptyFile); } }
private static void Main(string[] args) { Console.Title = "Server"; var output = new Output(); var input = new Input(); listener = new HttpListener(); listener.Prefixes.Add("http://localhost:10666/"); output.Execute("input \"stop\" to close app\n"); var check = new Thread(CheckInput); check.Start(); try { listener.Start(); } catch (Exception e) { output.Execute($"{e}"); input.ReadKey(); return; } do { var context = listener.GetContext(); var request = context.Request; var executer = new Executer(request); executer.Execute(); var buffer = Encoding.UTF8.GetBytes(executer.GetResult()); var response = context.Response; response.ContentLength64 = buffer.Length; using (var newOutput = response.OutputStream) { newOutput.Write(buffer, 0, buffer.Length); } } while (true); }
public override void Execute(Executer exec) { TFunctionData parameters = new TFunctionData(exec, Header.Text); if (parameters.ParameterCount < 3) { throw ThrowHelper.NoCondition(); } StringSegment condition = new StringSegment(Header.Text, Header.Text.IndexOf(' ', 3)); if (parameters.GetParameter <string>(1).EqualsIgnoreCase("UNTIL")) { condition = new StringSegment(string.Format("NOT ({0})", condition)); // Until means inverted } else if (parameters.GetParameter <string>(1).EqualsIgnoreCase("WHILE")) { // don't do anything, you're golden } else { throw ThrowHelper.ExpectedToken("UNTIL' or 'WHILE"); } Evaluator eval = new Evaluator(condition, exec); do { exec.Execute(Body); if (exec.BreakRequest) { exec.HonorBreak(); break; } eval.ShouldParse = true; }while (eval.EvaluateBool()); }
public GLForm(int scaleX, int scaleY, params string[] expr) { Random r = new Random(); exe = new Executer[expr.Length]; Colors = new float[expr.Length][]; for (int i = 0; i < expr.Length; i++) { exe[i] = Executer.Create(expr[i]); //x^sin(x) exe[i].RegisterFunction("abs", typeof(Math).GetMethod("Abs", new Type[] { typeof(double) })); exe[i].RegisterFunction("sin", typeof(Math).GetMethod("Sin")); exe[i].RegisterFunction("cos", typeof(Math).GetMethod("Cos")); exe[i].RegisterFunction("log", typeof(Math).GetMethod("Log", new Type[] { typeof(double), typeof(double) })); Colors[i] = new float[3]; Colors[i][0] = (float)(r.Next() % 100) / 100; Colors[i][1] = (float)(r.Next() % 100) / 100; Colors[i][2] = (float)(r.Next() % 100) / 100; } this.ScaleX = scaleX; this.ScaleY = scaleY; InitializeComponent(); oc = new OpenGLControl(); ((ISupportInitialize)(oc)).BeginInit(); oc.Dock = DockStyle.Fill; oc.DrawFPS = true; oc.FrameRate = 20; oc.RenderContextType = RenderContextType.FBO; oc.OpenGLInitialized += Oc_OpenGLInitialized; oc.OpenGLDraw += Oc_OpenGLDraw; oc.Resized += Oc_Resized; Controls.Add(oc); ((ISupportInitialize)(oc)).EndInit(); }
public double Execute(long conID, GraphType type, Dictionary <string, Dictionary <int, Dictionary <long, Tuple <double, uint, List <float> > > > > guLoss) { ExposureDataAdaptor expData = PDataAdaptor.GetExposureAdaptor(conID); string error; //Stopwatch watch = new Stopwatch(); //watch.Start(); Graph graph = GetGraph(type, expData); //watch.Stop(); //long graphTime = watch.ElapsedMilliseconds; GraphExecuter Executer; if (graph is PrimaryGraph) { Executer = new PrimaryGraphExecuter(graph as PrimaryGraph); } else if (graph is TreatyGraph) { Executer = new TreatyGraphExecuter(graph as TreatyGraph); } else { throw new NotSupportedException("Can only handle graph of type Treaty and Primary"); } //Execute Graph and Allocate graph double payout = Executer.Execute(guLoss); //Allocate Graph //GraphAllocation Allocater = new GraphAllocation(graph); //Allocater.AllocateGraph(); return(payout); }
public void CheckParams_Test() { //set string[][] commands = new string[3][]; commands[0] = new string[] {}; commands[1] = new string[] {}; commands[2] = new string[] {}; bool[] expectedValue = new bool[3] { false, false, false }; commands[0] = "clear 2019".Split(' '); commands[1] = "purchase 2019-01-01 50 UAH".Split(' '); commands[2] = "report 2019-01-01 50 USD Beer".Split(' '); //act Executer executer = new Executer(); //assert for (int i = 0; i < 3; i++) { Assert.AreEqual(expectedValue[i], executer.CheckParams(commands[i])); } }
public override void Execute(Executer exec) { TFunctionData parameters = new TFunctionData(exec, Header.Text); if (parameters.ParameterCount < 2) { throw ThrowHelper.NoCondition(); } StringSegment condition = new StringSegment(Header.Text, Header.Text.IndexOf(' ')); Evaluator eval = new Evaluator(condition, exec); while (eval.EvaluateBool()) { exec.Execute(Body); if (exec.BreakRequest) { exec.HonorBreak(); break; } eval.ShouldParse = true; } }
public void ExcecuteCommandReport_Test() { //set ProductINFO.Products = new System.Collections.Generic.List <ProductINFO> { { new ProductINFO { Date = Convert.ToDateTime("01.01.2019"), Price = 50.0, Currency = "EUR", Name = "Beer" } }, { new ProductINFO { Date = Convert.ToDateTime("01.02.2019"), Price = 50.0, Currency = "UAH", Name = "Beer" } } }; double expectedValue = 1527.0641; // Change Value depening on rates string command = "report 2019 UAH"; string[] words = command.Split(' '); //act Executer executer = new Executer(); executer.ExecuteCommand(words); //assert Assert.AreEqual(expectedValue, ProductINFO.ProfitPerYear[Int32.Parse(words[1])]); }
public BackgroundWorker ExportSongs(string folder) { var retVal = new BackgroundWorker() { WorkerReportsProgress = true, WorkerSupportsCancellation = false }; var i = 0; var count = this.CountBeatmapsFolders; Directory.CreateDirectory(folder); retVal.DoWork += (sender, e) => { using (var fileWriteExecuter = new Executer()) // subclass executer to give a more specialized class { this.BeatmapsFolders.AsParallel().Where(x => x.ValidForExport).ForAll(x => { retVal.ReportProgress((int)Math.Round((((double)Interlocked.Increment(ref i) / (double)count)) * 100)); x.ExportSong(fileWriteExecuter, folder); }); } }; return retVal; }
public virtual Object PerformOperation(Executer exec, Operator op, Object otherTerm) { return(null); }
public void extension_has_expected_format() { var query = @" query { hero { name friends { name } } }"; var start = DateTime.UtcNow; var result = Executer.ExecuteAsync(_ => { _.Schema = Schema; _.Query = query; _.EnableMetrics = true; _.FieldMiddleware.Use <InstrumentFieldsMiddleware>(); }).Result; result.EnrichWithApolloTracing(start); var trace = (ApolloTrace)result.Extensions["tracing"]; trace.Version.ShouldBe(1); trace.Parsing.StartOffset.ShouldNotBe(0); trace.Parsing.Duration.ShouldNotBe(0); trace.Validation.StartOffset.ShouldNotBe(0); trace.Validation.Duration.ShouldNotBe(0); trace.Validation.StartOffset.ShouldNotBeSameAs(trace.Parsing.StartOffset); trace.Validation.Duration.ShouldNotBeSameAs(trace.Parsing.Duration); var expectedPaths = new HashSet <List <object> > { new List <object> { "hero" }, new List <object> { "hero", "name" }, new List <object> { "hero", "friends" }, new List <object> { "hero", "friends", 0, "name" }, new List <object> { "hero", "friends", 1, "name" }, }; var paths = new List <List <object> >(); foreach (var resolver in trace.Execution.Resolvers) { resolver.StartOffset.ShouldNotBe(0); resolver.Duration.ShouldNotBe(0); resolver.ParentType.ShouldNotBeNull(); resolver.ReturnType.ShouldNotBeNull(); resolver.FieldName.ShouldBe((string)resolver.Path.Last()); paths.Add(resolver.Path); } paths.Count.ShouldBe(expectedPaths.Count); new HashSet <List <object> >(paths).ShouldBe(expectedPaths); }
IAsyncResult beginOperation(BaseCommand command, AsyncCallback callback, object state) { TransferAsyncResult result = new TransferAsyncResult(callback, state); Executer exe = new Executer(result, command); Thread thread = new Thread(new ThreadStart(exe.Execute)); thread.Start(); return result; }
public static NpgsqlRange <T> ParseNpgsqlRange <T>(string s) { return(Executer.ParseNpgsqlRange <T>(s)); }
public IDisposeWhen Begin() { Executer.ExecuteNode(this); return(this); }
private void BtnRate_Click(object sender, RoutedEventArgs e) { Executer.RateApp(); }
public static BitArray Parse1010(string _1010) { return(Executer.Parse1010(_1010)); }
static IAsyncResult beginOperation(BaseCommand command, AsyncCallback callback, object state) { Executer exe = new Executer(callback, state, command); ThreadPool.QueueUserWorkItem(s => exe.Execute()); return exe.AsyncResult; }
public override void Execute(Executer exec) { throw new NotImplementedException(); }
public virtual object Execute(Executer exec) { return null; }
public override object Execute(Executer exec) { //EH.Put(m_expression.Print()); return m_expression.Evaluate(exec); }
public override Object PerformOperation(Executer exec, Operator op, Object otherTerm) { if (op == null) return this; this.CheckOperation(op); double dReturn = 0; double dThis = Convert.ToDouble(this.GetUnboxed(exec)); if (op.IsBinary) { double dOther = Convert.ToDouble(otherTerm.GetUnboxed(exec)); switch (op.InternalTokens) { case "+": dReturn = dThis + dOther; break; case "-": dReturn = dThis - dOther; break; case "*": dReturn = dThis * dOther; break; case "/": dReturn = dThis / dOther; break; case "==": return Types.Object.CreateType(dThis == dOther); case ">=": return Types.Object.CreateType(dThis >= dOther); case "<=": return Types.Object.CreateType(dThis <= dOther); case ">": return Types.Object.CreateType(dThis > dOther); case "<": return Types.Object.CreateType(dThis < dOther); case "!=": return Types.Object.CreateType(dThis != dOther); } } else //unary { switch (op.InternalTokens) { case "pre-": dReturn=-dThis; break; } } System.Type type = this.GetType(); //Nope - never change the actual value, instead return a new object with the value! // if (type == typeof(Int)) // this.m_value = (int)dReturn; // else if (type == typeof(Float)) // this.m_value = (float)dReturn; // return this; if (type == typeof(Int)) return Types.Object.CreateType((int)dReturn); else if (type == typeof(Float)) return Types.Object.CreateType((float)dReturn); throw new Exception("Unknown number type"); }
/// <summary> /// If it's a method or variable, evaluate and return the Object. /// Always an EScript-Object-based value (not dotnet-object) /// </summary> /// <returns></returns> public virtual Object Evaluate(Executer exec) { //return Object.CreateType(this.GetUnboxed(exec)); return(this); //if not overridden, it evaluated to itself }
private void BtnGithub_Click(object sender, RoutedEventArgs e) { Executer.VisitGithub(); }
private object YieldJToken(Type ctype, JToken jt, int rank) { if (rank == 0) { if (ctype == typeof_BitArray) { return(Executer.Parse1010(jt.ToString())); } if (ctype == typeof_NpgsqlPoint) { return(NpgsqlPoint.Parse(jt.ToString())); } if (ctype == typeof_NpgsqlLine) { return(NpgsqlLine.Parse(jt.ToString())); } if (ctype == typeof_NpgsqlLSeg) { return(NpgsqlLSeg.Parse(jt.ToString())); } if (ctype == typeof_NpgsqlBox) { return(NpgsqlBox.Parse(jt.ToString())); } if (ctype == typeof_NpgsqlPath) { return(NpgsqlPath.Parse(jt.ToString())); } if (ctype == typeof_NpgsqlPolygon) { return(NpgsqlPolygon.Parse(jt.ToString())); } if (ctype == typeof_NpgsqlCircle) { return(NpgsqlCircle.Parse(jt.ToString())); } if (ctype == typeof_NpgsqlInet) { return(new NpgsqlInet(jt.ToString())); } if (ctype == typeof_IPAddress) { return(new NpgsqlInet(jt.ToString())); } if (ctype == typeof_PhysicalAddress) { return(PhysicalAddress.Parse(jt.ToString())); } if (ctype == typeof_NpgsqlRange_int) { return(Executer.ParseNpgsqlRange <int>(jt.ToString())); } if (ctype == typeof_NpgsqlRange_long) { return(Executer.ParseNpgsqlRange <long>(jt.ToString())); } if (ctype == typeof_NpgsqlRange_decimal) { return(Executer.ParseNpgsqlRange <decimal>(jt.ToString())); } if (ctype == typeof_NpgsqlRange_DateTime) { return(Executer.ParseNpgsqlRange <DateTime>(jt.ToString())); } return(null); } return(jt.Select <JToken, object>(a => YieldJToken(ctype, a, rank - 1))); }
/// <summary> /// Get the dotnet value /// </summary> /// <returns></returns> public virtual object GetUnboxed(Executer exec) { //Methods and Variables have no value, they must be evaluated into basic types first: if (this.IsNull) return null; if (this.m_value == null) { Object o = this.Evaluate(exec); return o.GetUnboxed(exec); } return this.m_value; }
public static string Addslashes(string filter, params object[] parms) { return(Executer.Addslashes(filter, parms)); }
public virtual Object PerformOperation(Executer exec, Operator op, Object otherTerm) { return null; }
public void ModuleInitialize(Executer exec) { }
/// <summary> /// If it's a method or variable, evaluate and return the Object. /// Always an EScript-Object-based value (not dotnet-object) /// </summary> /// <returns></returns> public virtual Object Evaluate(Executer exec) { //return Object.CreateType(this.GetUnboxed(exec)); return this; //if not overridden, it evaluated to itself }
public override object Execute(Executer exec) { //EH.Put(m_expression.Print()); return(m_expression.Evaluate(exec)); }
static IAsyncResult beginOperation(BaseCommand command, AsyncCallback callback, object state) { TransferAsyncResult result = new TransferAsyncResult(callback, state); Executer exe = new Executer(result, command); ThreadPool.QueueUserWorkItem(s => exe.Execute()); return result; }