コード例 #1
0
ファイル: Main.cs プロジェクト: zendbit/monoberry
        public static void Main(string[] args)
        {
            using (var nav = new Navigator())
                using (var ctx = Context.GetInstance(ContextType.Application)) {
                    nav.OnInvokeResult = (InvokeTargetReply e) => {
                        var info = new StringBuilder();
                        info.AppendLine(String.Format("Id: {0}", e.Id));
                        info.AppendLine(String.Format("Code: {0}", e.Code));
                        info.AppendLine(String.Format("Error Message: {0}", e.ErrorMessage));
                        info.AppendLine(String.Format("Error: {0}", e.Error));
                        var i = e.Invocation;
                        Dialog.Alert("Got InvokeTargetReply", info + "\n\n" + (i == null ? "?" : i.MimeType),
                                     new Button("Quit", () => PlatformServices.Stop()));
                    };

                    using (var req = new InvokeRequest()) {
                        req.Source = "com.burningsoda.monoberry.samples.invocation";
                        req.Action = "bb.action.CAPTURE";
                        req.Target = "sys.camera.card";
                        //req.Data = new System.Text.ASCIIEncoding ().GetBytes ("photo");
                        //req.Action = "";
                        //req.MimeType = "image/jpeg";
                        nav.Invoke(req);
                    }

                    PlatformServices.Run();
                    PlatformServices.Shutdown(0);
                }
        }
コード例 #2
0
        public static bool IsPathMapped(this PlatformServices services, string path)
        {
            var result = path ?? string.Empty;

            return(result.StartsWith(services.Application.ApplicationBasePath,
                                     StringComparison.Ordinal));
        }
コード例 #3
0
        public static string MapPath(this PlatformServices services, string path)
        {
            var result = path ?? string.Empty;

            if (services.IsPathMapped(path) == false)
            {
                var wwwroot = services.WwwRoot();
                if (result.StartsWith("~", StringComparison.Ordinal))
                {
                    result = result.Substring(1);
                }
                if (result.StartsWith("/", StringComparison.Ordinal))
                {
                    result = result.Substring(1);
                }
                if (IsWindowRunTime())
                {
                    result = Path.Combine(wwwroot, result.Replace('/', '\\'));
                }
                else
                {
                    result = Path.Combine(wwwroot, result.Replace('\\', '/'));
                }
            }

            return(result);
        }
コード例 #4
0
        public static void Main(string[] args)
        {
            using (var nav = new Navigator())
                using (var ctx = new Context())
                    using (var win = new Window(ctx)) {
                        win.Usage = Usage.SCREEN_USAGE_NATIVE;
                        win.AddBuffers(2);
                        var bufs  = win.Buffers;
                        var pic   = bufs[0];
                        var brush = bufs[1];

                        pic.Fill(0xffff0000);
                        brush.Fill(0xff000000);
                        win.Render(pic);

                        //nav.OnSwipeDown = () => Dialog.Alert ("#MonoBerry", "Another Event Loop", new Button ("Ack"));
                        ctx.OnFingerTouch = (x, y) => {
                            pic.Blit(brush, 0, 0, 10, 10, Math.Max(x - 5, 0), Math.Max(y - 5, 0));
                            win.Render(pic);
                        };
                        ctx.OnFingerMove    = ctx.OnFingerTouch;
                        ctx.OnFingerRelease = ctx.OnFingerTouch;

                        PlatformServices.Run();
                    }
        }
コード例 #5
0
        public static string WwwRoot(this PlatformServices services)
        {
            // todo: take it from project.json!!!
            var result = Path.Combine(services.Application.ApplicationBasePath, "wwwroot");

            return(result);
        }
コード例 #6
0
        /// <summary>
        /// Action method to present.
        /// </summary>
        /// <param name="org">The Organization code for the service owner.</param>
        /// <param name="service">The service code for the current service.</param>
        /// <param name="instanceId">The instanceId.</param>
        /// <returns>The receipt view.</returns>
        public IActionResult Receipt(string org, string service, int instanceId)
        {
            // Dependency Injection: Getting the Service Specific Implementation based on the service parameter data store
            // Will compile code and load DLL in to memory for AltinnCore
            IServiceImplementation serviceImplementation = _execution.GetServiceImplementation(org, service, false);

            // Get the serviceContext containing all metadata about current service
            ServiceContext serviceContext = _execution.GetServiceContext(org, service, false);

            // Create and populate the RequestContext object and make it available for the service implementation so
            // service developer can implement logic based on information about the request and the user performing
            // the request
            RequestContext requestContext = RequestHelper.GetRequestContext(Request.Query, instanceId);

            requestContext.UserContext = _userHelper.GetUserContext(HttpContext);
            requestContext.Reportee    = requestContext.UserContext.Reportee;

            PlatformServices platformServices = new PlatformServices(_authorization, _repository, _execution, org, service);

            serviceImplementation.SetPlatformServices(platformServices);

            // Assign data to the ViewBag so it is available to the service views or service implementation
            PopulateViewBag(org, service, instanceId, 0, requestContext, serviceContext, platformServices);

            object serviceModel = _archive.GetArchivedServiceModel(instanceId, serviceImplementation.GetServiceModelType(), org, service, requestContext.Reportee.PartyId);
            List <ServiceInstance> formInstances = _testdata.GetFormInstances(requestContext.Reportee.PartyId, org, service, AuthenticationHelper.GetDeveloperUserName(_httpContextAccessor.HttpContext));

            ViewBag.ServiceInstance = formInstances.Find(i => i.ServiceInstanceID == instanceId);

            return(View());
        }
コード例 #7
0
        public void Run()
        {
            _rateOfRotationPS = new float[] { 30, 45, 60 };
            _rot = new float[] { 0, 0, 0 };

            BBUtil util;

            using (var nav = new Navigator())
                using (var ctx = new Context(ContextType.SCREEN_APPLICATION_CONTEXT))
                    using (var win = new Window(ctx))
                    {
                        util = new BBUtil(ctx, BBUtil.OpenGLESVersion.ES11);

                        Egl.QuerySurface(util.Display, util.Surface, Egl.WIDTH, out _viewportWidth);
                        Egl.QuerySurface(util.Display, util.Surface, Egl.HEIGHT, out _viewportHeight);

                        this.OnLoad(util);

                        nav.OnExit += () =>
                        {
                            Console.WriteLine("I am asked to shutdown!?!");
                            PlatformServices.Shutdown(0);
                        };
                    }
        }
コード例 #8
0
ファイル: AutosaveController.cs プロジェクト: Bisa/Autosave
        internal static string GetSavePath()
        {
            PlatformServices platformServices = PlatformUtils.main.GetServices();
            DirectoryInfo    SavedGames       = null;

            if (platformServices is PlatformServicesEpic)
            {
                SavedGames = new DirectoryInfo(Path.Combine(
                                                   Application.persistentDataPath,
                                                   "Subnautica",
                                                   "SavedGames"));
            }
            else if (platformServices is PlatformServicesSteam)
            {
                SavedGames = new DirectoryInfo(Path.Combine(
                                                   new DirectoryInfo(Application.dataPath).Parent.FullName,
                                                   "SNAppData",
                                                   "SavedGames"));
            }

            if (SavedGames.Exists)
            {
                return(SavedGames.FullName);
            }

            return(string.Empty);
        }
コード例 #9
0
        internal async void Init()
        {
            var host = Settings.Host;

            if (string.IsNullOrWhiteSpace(host))
            {
                host = "nohost";
            }
            var port = (int)Settings.Port;

            if (port == 0)
            {
                port = 80;
            }

            if (XBMC != null)
            {
                XBMC.Dispose();
            }
            XBMC = new KODIRPC.Client(new ConnectionSettings(host, port, Settings.User, Settings.Password), PlatformServices);

            ImageManager = PlatformServices.GetImageManager(XBMC, !string.IsNullOrEmpty(Settings.Password));

            var t = XBMC.StartNotificationListener();

            t.ContinueWith(t2 => { NotificationsEnabled = !t2.IsFaulted; });

            Upnp = new UpnpManager(this);
        }
コード例 #10
0
        public override bool FinishedLaunching(UIApplication app, NSDictionary options)
        {
            global::Xamarin.Forms.Forms.Init();

            PlatformServices.Init();

            // Code for starting up the Xamarin Test Cloud Agent
                        #if ENABLE_TEST_CLOUD
            Xamarin.Calabash.Start();
                        #endif

            PlatformServices.UpdateVersionPreference();

                        #if DEBUG
            (null as IOnlineContextConfiguration).HttpClient(() => {
                var handler         = new HttpMessageHandlerWrapper();
                handler.RequestLog += Console.WriteLine;
                return(new HttpClient(handler));
            });
                        #endif

            LoadApplication(new App());

            app.SetStatusBarHidden(false, false);

            return(base.FinishedLaunching(app, options));
        }
コード例 #11
0
        public async Task <IActionResult> Index(string org, string service, string edition, int instanceId)
        {
            // Getting the Service Specific Implementation contained in external DLL migrated from TUL
            IServiceImplementation serviceImplementation = _execution.GetServiceImplementation(org, service, edition);

            // Create and populate the RequestContext object and make it available for the service implementation so
            // service developer can implement logic based on information about the request and the user performing
            // the request
            RequestContext requestContext = RequestHelper.GetRequestContext(Request.Query, instanceId);

            requestContext.UserContext = _userHelper.GetUserContext(HttpContext);
            requestContext.Reportee    = requestContext.UserContext.Reportee;

            // Get the serviceContext containing all metadata about current service
            ServiceContext serviceContext = _execution.GetServiceContext(org, service, edition);

            // Assign data to the ViewBag so it is available to the service views or service implementation
            ViewBag.ServiceContext = serviceContext;
            ViewBag.RequestContext = requestContext;
            ViewBag.Org            = org;
            ViewBag.Service        = service;
            ViewBag.Edition        = edition;
            ViewBag.FormID         = instanceId;

            // Assign the RequestContext and ViewBag to the serviceImplementation so
            // service developer can use the information in any of the service events that is called
            serviceImplementation.SetContext(requestContext, ViewBag, serviceContext, null, ModelState);

            // Set the platform services to the ServiceImplementation so the AltinnCore service can take
            // use of the plattform services
            PlatformServices platformServices = new PlatformServices(_authorization, _repository, _execution, org, service, edition);

            serviceImplementation.SetPlatformServices(platformServices);

            ViewBag.PlatformServices = platformServices;

            // Getting the Form Data from datastore
            object serviceModel = this._form.GetFormModel(
                instanceId,
                serviceImplementation.GetServiceModelType(),
                org,
                service,
                edition,
                requestContext.UserContext.ReporteeId);

            // Assing the populated service model to the service implementation
            serviceImplementation.SetServiceModel(serviceModel);

            // ServiceEvent 1: HandleGetDataEvent
            // Runs the event where the service developer can implement functionality to retrieve data from internal/external sources
            // based on the data in the service model
            await serviceImplementation.RunServiceEvent(AltinnCore.ServiceLibrary.Enums.ServiceEventType.DataRetrieval);

            // ServiceEvent 2: HandleCalculationEvent
            // Perform Calculation defined by the service developer
            await serviceImplementation.RunServiceEvent(AltinnCore.ServiceLibrary.Enums.ServiceEventType.Calculation);

            return(Ok(serviceModel));
        }
コード例 #12
0
        void MockRuntime(string runtimeType)
        {
            var runtime = new StubRuntimeEnvironment(runtimeType, _defaultPlatformService.Runtime);

            var customPlatformService = PlatformServices.Create(_defaultPlatformService, _defaultPlatformService.Application, runtime);

            PlatformServices.SetDefault(customPlatformService);
        }
コード例 #13
0
 public ApplicationHostPlatformServices(PlatformServices previous,
                                        ApplicationEnvironment applicationEnvironment,
                                        RuntimeLibraryManager runtimeLibraryManager)
 {
     _previous      = previous;
     LibraryManager = runtimeLibraryManager;
     Application    = applicationEnvironment;
 }
コード例 #14
0
        public async Task <IActionResult> CompleteAndSendIn(string org, string service, int instanceId, string view)
        {
            // Dependency Injection: Getting the Service Specific Implementation based on the service parameter data store
            // Will compile code and load DLL in to memory for AltinnCore
            IServiceImplementation serviceImplementation = _execution.GetServiceImplementation(org, service, false);

            // Get the serviceContext containing all metadata about current service
            ServiceContext serviceContext = _execution.GetServiceContext(org, service, false);

            // Create and populate the RequestContext object and make it available for the service implementation so
            // service developer can implement logic based on information about the request and the user performing
            // the request
            RequestContext requestContext = PopulateRequestContext(instanceId);

            PlatformServices platformServices = new PlatformServices(_authorization, _repository, _execution, org, service);

            serviceImplementation.SetPlatformServices(platformServices);

            // Assign data to the ViewBag so it is available to the service views or service implementation
            PopulateViewBag(org, service, instanceId, 0, requestContext, serviceContext, platformServices);

            // Getting the Form Data from database
            object serviceModel = _form.GetFormModel(instanceId, serviceImplementation.GetServiceModelType(), org, service, requestContext.UserContext.ReporteeId, AuthenticationHelper.GetDeveloperUserName(_httpContextAccessor.HttpContext));

            serviceImplementation.SetServiceModel(serviceModel);

            ViewBag.FormID         = instanceId;
            ViewBag.ServiceContext = serviceContext;

            serviceImplementation.SetContext(requestContext, ViewBag, serviceContext, null, ModelState);
            await serviceImplementation.RunServiceEvent(ServiceEventType.Validation);

            ApiResult apiResult = new ApiResult();

            if (ModelState.IsValid)
            {
                ServiceState currentState = _workflowSI.MoveServiceForwardInWorkflow(instanceId, org, service, requestContext.UserContext.ReporteeId);
                if (currentState.State == WorkflowStep.Archived)
                {
                    _archive.ArchiveServiceModel(serviceModel, instanceId, serviceImplementation.GetServiceModelType(), org, service, requestContext.UserContext.ReporteeId);
                    apiResult.NextState = currentState.State;
                }
            }

            ModelHelper.MapModelStateToApiResult(ModelState, apiResult, serviceContext);

            if (apiResult.Status.Equals(ApiStatusType.ContainsError))
            {
                Response.StatusCode = 202;
            }
            else
            {
                Response.StatusCode = 200;
            }

            return(new ObjectResult(apiResult));
        }
コード例 #15
0
        /// <summary>
        /// Applies the Binding represented by the SetterValueBindingHelper.
        /// </summary>
        /// <param name="element">Element to apply the Binding to.</param>
        /// <param name="item">SetterValueBindingHelper representing the Binding.</param>
        private static void ApplyBinding(FrameworkElement element, SetterValueBinding item)
        {
            // Get the type on which to set the Binding
            Type type = null;

            if (null == item.Type)
            {
                // No type specified; setting for the specified element
                type = element.GetType();
            }
            else
            {
                // Try to get the type from the type system
                type = Type.GetType(item.Type);
                if (null == type)
                {
                    // Search for the type in the list of assemblies
                    foreach (var assembly in PlatformServices.GetAssemblies().ToList())
                    {
                        // Match on short or full name
                        var typeInfo = assembly.DefinedTypes.FirstOrDefault(t => (t.FullName == item.Type) || (t.Name == item.Type));
                        if (null != typeInfo)
                        {
                            // Found; done searching
                            type = typeInfo.AsType();
                            break;
                        }
                    }
                    if (null == type)
                    {
                        // Unable to find the requested type anywhere
                        throw new ArgumentException(string.Format(CultureInfo.CurrentCulture,
                                                                  "Unable to access type \"{0}\". Try using an assembly qualified type name.",
                                                                  item.Type));
                    }
                }
            }

            // Get the DependencyProperty for which to set the Binding
            DependencyProperty property = null;
            var field = type.GetTypeInfo().DeclaredProperties.FirstOrDefault(fi => fi.Name == item.Property + "Property");

            if (null != field)
            {
                property = field.GetValue(null) as DependencyProperty;
            }
            if (null == property)
            {
                // Unable to find the requested property
                throw new ArgumentException(string.Format(CultureInfo.CurrentCulture,
                                                          "Unable to access DependencyProperty \"{0}\" on type \"{1}\".",
                                                          item.Property, type.Name));
            }

            // Set the specified Binding on the specified property
            element.SetBinding(property, item.Binding);
        }
コード例 #16
0
        /// <summary>
        /// Constructor.
        /// </summary>
        /// <param name="url">URL.</param>

        ///<summary>
        ///Constrctor.
        ///</summary>
        ///<param name="services">Param</param>
        public RequestController(string url = null, PlatformServices services = null)
        {
            _services = services ?? new PlatformServices();
            Url       = url;

            _client = new HttpClient {
                Timeout = TimeSpan.FromSeconds(_timeoutSeconds)
            };
        }
コード例 #17
0
        public static Auth IsSteamAuth()
        {
            if (currentState == Auth.Good)
            {
                return(currentState);
            }
            try
            {
                PlatformServices.Initialize();
                var providerName = PlatformServices.ProviderName;
                if (providerName == "Epic")
                {
                    onAuthEvent?.Invoke(Auth.Good);
                    currentState = Auth.Good;
                    return(Auth.Good);
                }
                if (providerName == "Steam")
                {
                    var userid = PlatformServices.UserId;
                    //first web req
                    WebRequest request = WebRequest.Create($"https://steamcommunity.com/profiles/{userid}");

                    WebResponse response = request.GetResponse();
                    using (Stream dataStream = response.GetResponseStream())
                    {
                        // Open the stream using a StreamReader for easy access.
                        StreamReader reader             = new StreamReader(dataStream);
                        string       responseFromServer = reader.ReadToEnd();
                        if (responseFromServer.Contains("The specified profile could not be found."))
                        {
                            onAuthEvent?.Invoke(Auth.FailedByFoundPage);
                            return(Auth.FailedByFoundPage);
                        }
                    }
                    if (userid == "76561201195729065") //짱깨 id
                    {
                        onAuthEvent?.Invoke(Auth.FailedByKnownCrackID);
                        return(Auth.FailedByKnownCrackID);
                    }
                    else if (userid == "0")
                    {
                        onAuthEvent?.Invoke(Auth.FailedByOwnerShip);
                        return(Auth.FailedByOwnerShip);
                    }
                }
                currentState = Auth.Good;
                onAuthEvent?.Invoke(Auth.Good);

                return(Auth.Good);
            }
            catch (Exception e)
            {
                onAuthEvent?.Invoke(Auth.Unknown);
                return(Auth.Unknown);
            }
        }
コード例 #18
0
        public NewsDetailsPageView(string title, string body)
        {
            Title = CrossLocalization.Translate("news_details_title");
            var dynSize = FontSizeController.GetDynamicSize(_bodyFontSize);

            _services      = new PlatformServices();
            BindingContext = new NewsDetailsPageViewModel(dynSize, title, body, _services);
            setToolbar();
            createViews();
        }
コード例 #19
0
    public static string UnmapPath(this PlatformServices services, string path)
    {
        var result  = path ?? string.Empty;
        var appPath = services.Application.ApplicationBasePath;
        var wwwroot = Path.Combine(appPath, "wwwroot");        // todo: take it from project.json!

        result = result.Remove(0, wwwroot.Length);
        result = result.Replace('\\', '/');
        return((result.StartsWith("/", StringComparison.Ordinal) ? "~" : "~/") + result);
    }
コード例 #20
0
ファイル: AudioPlayer.cs プロジェクト: ptuckey/monoberry
        static void Initialize()
        {
            if (initialized)
            {
                return;
            }
            PlatformServices.Initialize();

            initialized = true;
        }
コード例 #21
0
            static bool Prefix(uGUI_SceneLoading __instance, bool useFastLoadMode)
            {
                PlatformServices services = PlatformUtils.main.GetServices();

                if (services != null)
                {
                    services.SetUseFastLoadMode(useFastLoadMode);
                }
                return(false);
            }
コード例 #22
0
 Context(ContextType type)
 {
     PlatformServices.Initialize();
     this.type = type;
     if (screen_create_context(out handle, type) != 0)
     {
         // TODO: read errno to describe problem
         throw new Exception("Unable to create screen context");
     }
     screen_request_events(handle);
     eventDomain = screen_get_domain();
     PlatformServices.AddEventHandler(eventDomain, HandleEvent);
 }
コード例 #23
0
    public static string UnmapPath(this PlatformServices services, string path)
    {
        var result = path ?? string.Empty;

        if (services.IsPathMapped(path))
        {
            var wwwroot = services.WwwRoot();
            result = result.Remove(0, wwwroot.Length);
            result = result.Replace('\\', '/');
            result = (result.StartsWith("/", StringComparison.Ordinal) ? "~" : "~/") + result;
        }
        return(result);
    }
コード例 #24
0
        public void Dispose()
        {
            if (disposed)
            {
                return;
            }

            PlatformServices.RemoveEventHandler(eventDomain);
            screen_stop_events(handle);
            screen_destroy_context(handle);
            RemoveInstance(type);

            disposed = true;
        }
コード例 #25
0
        private string GetSavePath()
        {
            PlatformServices platformServices = PlatformUtils.main.GetServices();

            if (platformServices is PlatformServicesEpic)
            {
                savePath = Path.Combine(Application.persistentDataPath, "Subnautica/SavedGames");
            }
            else if (platformServices is PlatformServicesSteam)
            {
                savePath = Path.Combine(SNUtils.applicationRootDir, "SNAppData/SavedGames");
            }
            return(savePath);
        }
コード例 #26
0
        private string GetSavePath()
        {
            PlatformServices platformServices = PlatformUtils.main.GetServices();

            if (platformServices is PlatformServicesEpic)
            {
                savePath = Path.Combine(Application.persistentDataPath, "Subnautica/SavedGames");
            }
            else if (platformServices is PlatformServicesSteam)
            {
                savePath = Path.Combine(
                    new DirectoryInfo(Application.dataPath).Parent.FullName,
                    "SNAppData/SavedGames");
            }
            return(savePath);
        }
コード例 #27
0
        /// <summary>
        /// Initialize registered views.
        /// </summary>
        private void Initialize()
        {
            if (!this._haveLoadedVisuals)
            {
                var assemblies = PlatformServices.GetAssemblies();
                foreach (var asm in assemblies)
                {
                    foreach (ExportUIVisualizerAttribute attr in asm.GetCustomAttributes(typeof(ExportUIVisualizerAttribute), true))
                    {
                        this.Add(attr.Key, attr.Type);
                    }
                }

                this._haveLoadedVisuals = true;
            }
        }
コード例 #28
0
        public async Task <IActionResult> Lookup([FromBody] AltinnCoreApiModel model, string reportee, string org, string service, string edition)
        {
            ApiResult apiResult = new ApiResult();

            // Load the service implementation for the requested service
            IServiceImplementation serviceImplementation = _execution.GetServiceImplementation(org, service, edition);

            // Get the service context containing metadata about the service
            ServiceContext serviceContext = _execution.GetServiceContext(org, service, edition);

            // Create and populate the RequestContext object and make it available for the service implementation so
            // service developer can implement logic based on information about the request and the user performing
            // the request
            RequestContext requestContext = RequestHelper.GetRequestContext(Request.Query, 0);

            requestContext.UserContext = _userHelper.GetUserContext(HttpContext);
            requestContext.Reportee    = requestContext.UserContext.Reportee;

            // Create platform service and assign to service implementation making it possible for the service implementation
            // to use plattform services. Also make it avaiable in ViewBag so it can be used from Views
            PlatformServices platformServices = new PlatformServices(_authorization, _repository, _execution, org, service, edition);

            serviceImplementation.SetPlatformServices(platformServices);
            ViewBag.PlatformServices = platformServices;

            // Create a new instance of the service model (a Get to lookup will always create a new service model)
            dynamic serviceModel = null;

            // Assign the different context information to the service implementation making it possible for
            // the service developer to take use of this information
            serviceImplementation.SetContext(requestContext, ViewBag, serviceContext, null, ModelState);

            // Do Model Binding and update form data
            serviceModel = ParseApiBody(serviceImplementation.GetServiceModelType(), out apiResult, model);
            if (serviceModel == null)
            {
                Response.StatusCode = 403;
                return(new ObjectResult(apiResult));
            }

            serviceImplementation.SetServiceModel(serviceModel);

            // Run the Data Retriavel event where service developer can potensial load any data without any user input
            await serviceImplementation.RunServiceEvent(AltinnCore.ServiceLibrary.Enums.ServiceEventType.DataRetrieval);

            return(Ok(serviceModel));
        }
コード例 #29
0
        /// <summary>
        /// Method to compare two objects
        /// </summary>
        /// <param name="leftOperand"></param>
        /// <param name="operatorType"></param>
        /// <param name="rightOperand"></param>
        /// <returns></returns>
        internal static bool Evaluate(object leftOperand, ComparisonConditionType operatorType, object rightOperand)
        {
            if (leftOperand != null)
            {
                if (rightOperand != null)
                {
                    object newValue = PlatformServices.ConvertType(rightOperand, leftOperand.GetType());
                    if (newValue != null)
                    {
                        rightOperand = newValue;
                    }
                }
            }

            IComparable comparable  = leftOperand as IComparable;
            IComparable comparable2 = rightOperand as IComparable;

            if ((comparable != null) && (comparable2 != null))
            {
                return(EvaluateComparable(comparable, operatorType, comparable2));
            }

            switch (operatorType)
            {
            case ComparisonConditionType.Equal:
                return(Equals(leftOperand, rightOperand));

            case ComparisonConditionType.NotEqual:
                return(!Equals(leftOperand, rightOperand));

            case ComparisonConditionType.LessThan:
            case ComparisonConditionType.LessThanOrEqual:
            case ComparisonConditionType.GreaterThan:
            case ComparisonConditionType.GreaterThanOrEqual:
                if ((comparable == null) && (comparable2 == null))
                {
                    throw new ArgumentException("Operands must implement IComparable");
                }
                if (comparable == null)
                {
                    throw new ArgumentException("Invalid left operand - must implement IComparable");
                }
                throw new ArgumentException("Invalid right operand - must implement IComparable.");
            }

            return(false);
        }
コード例 #30
0
        protected void OnLoad(BBUtil util)
        {
            GL.Enable(All.CullFace);
            GL.ShadeModel(All.Smooth);

            GL.Hint(All.PerspectiveCorrectionHint, All.Nicest);

            // Run the render loop
            PlatformServices.Run(delegate
            {
                for (int j = 0; j < 3; j++)
                {
                    _rot[j] += (float)(_rateOfRotationPS[j] * 0.02);
                }
                this.RenderCube(util);
            });
        }