Exemple #1
0
		override protected void LoadXML(XmlNode cXmlNode)
		{
            if (null == cXmlNode || _bInitialized)
				return;
			_sRestartFile = cXmlNode.AttributeValueGet("restart", false);
			XmlNode[] aNodeChilds = cXmlNode.NodesGet("process", false);
			if (null != aNodeChilds)
			{
				List<Process> aProcesses = new List<Process>();
				for (int nIndx = 0; aNodeChilds.Length > nIndx; nIndx++)
				{
					aProcesses.Add(new Process()
					{
						sName = aNodeChilds[nIndx].AttributeValueGet("name"),
						sOwner = aNodeChilds[nIndx].AttributeValueGet("owner"),
						sArguments = aNodeChilds[nIndx].AttributeValueGet("arguments", false)
					});
				}
				_aProcesses = aProcesses.ToArray();
			}
			XmlNode cXNBlender = cXmlNode.NodeGet("blender", false);
			if (null != cXNBlender)
			{
				_cBlender = new Blender() { sPath = cXNBlender.AttributeValueGet("path"), sTasks = cXNBlender.AttributeValueGet("tasks"), nQueue = (cXNBlender.AttributeValueGet("queue", false) ?? "1").ToByte() };
				if (!System.IO.File.Exists(_cBlender.sPath) || !System.IO.Directory.Exists(_cBlender.sTasks))
					throw new Exception("cannot find blender executable or tasks folder[" + _cBlender.sPath +"][" + _cBlender.sTasks + "]");
			}
		}
 void Awake()
 {
     CharacterController cc = GetComponent<CharacterController>();
     cc.collider.isTrigger = true;
     this.dWeight = new Blender(2.0f);
     this.ragdollPose = this.NewTransformArray();
     this.locomotionPose = this.NewTransformArray();
 }
        static void CopyOrBlend_BasedOnAlphaAndCover(IPixelBlender recieveBlender, byte[] destBuffer, int bufferOffset, Color sourceColor, int cover)
        {
            if (cover == 255)
            {
                CopyOrBlend_BasedOnAlpha(recieveBlender, destBuffer, bufferOffset, sourceColor);
            }
            else
            {
                //if (sourceColor.m_A != 0)
                {
                    sourceColor.alpha = (byte)((sourceColor.alpha * (cover + 1)) >> 8);
#if false // we blend regardless of the alpha so that we can get Light Opacity working (used this way we have addative and faster blending in one blender) LBB
                    if (sourceColor.m_A == base_mask)
                    {
                        Blender.CopyPixel(pDestBuffer, sourceColor);
                    }
                    else
#endif
                    {
                        recieveBlender.BlendPixel(destBuffer, bufferOffset, sourceColor);
                    }
                }
            }
        }
Exemple #4
0
        public static void Register()
        {
            Blender.MapUri("/useradmin/menu", string.Empty, new string[] { "menu" });
            Blender.MapUri("/useradmin/app-name", string.Empty, new string[] { "app", "icon" });
            Blender.MapUri("/useradmin/search/{?}", string.Empty, new string[] { "search" });
            Blender.MapUri("/useradmin/partial/unauthenticated?return_uri={?}", string.Empty, new string[] { "redirection" });
            Blender.MapUri("/useradmin/user/authentication/password/{?}", string.Empty, new string[] { "authentication-password" });
            Blender.MapUri("/useradmin/user/authentication/settings/{?}", string.Empty, new string[] { "authentication-settings" });
            // Mapping issue
            // https://github.com/Starcounter/Starcounter/issues/2902
            Blender.MapUri <Person>("/UserAdmin/persons/{?}",
                                    paramsFrom =>
            {
                var objectId = paramsFrom[0];
                var user     = Db.SQL <SystemUser>("SELECT o FROM Simplified.Ring3.SystemUser o WHERE o.ObjectID=?", objectId).First;
                if (user != null)
                {
                    paramsFrom[0] = user.WhatIs.Key;
                }

                return(null);
            },
                                    paramsTo =>
            {
                var objectId = paramsTo[0];
                var user     = Db.SQL <SystemUser>("SELECT o FROM Simplified.Ring3.SystemUser o WHERE o.WhatIs.ObjectID=?", objectId).First;

                if (user != null)
                {
                    paramsTo[0] = user.Key;
                    return(paramsTo);
                }
                return(null);
            }
                                    , new string[] { "page" });
        }
Exemple #5
0
 internal BlendedNode(Lua.LuaSyntaxNode?node, SyntaxToken?token, Blender blender)
 {
     Node    = node;
     Token   = token;
     Blender = blender;
 }
Exemple #6
0
 private void Awake()
 {
     blender = GameObject.Find("Blender").GetComponent <Blender>();
 }
Exemple #7
0
        static void Main(string[] args)
        {
            Pixel pixel = new Pixel(new RGBColor(255, 0, 0));

            pixel.animateToNewColor(new RGBColor(0, 255, 0), 10);

            for (int i = 0; i < 10; i++)
            {
                RGBColor color = pixel.RGBColor;
                Console.WriteLine(color);
                pixel.update();
            }
            return;



            Adafruit_NeoPixel strip = new Adafruit_NeoPixel(5);

            Mapper mapper = new Mapper(strip);


            RGBColor red   = new RGBColor(255, 0, 0);
            RGBColor green = new RGBColor(0, 255, 0);
            RGBColor blue  = new RGBColor(0, 0, 255);

            Blender blender = new Blender(30);

            blender.addBlend(red, green, 10);
            blender.addBlend(green, blue, 10);
            blender.addBlend(blue, red, 10);

            var chunk2 = blender.getChunk();

            Animator animator = new Animator(mapper, chunk2);

            animator.setOffset(0, 30, 4, 1);

            while (animator.Run())
            {
                ;
            }

            animator.setOffset(0, 30, 4, 1);

            while (animator.Run())
            {
                ;
            }



            return;


            Chunk chunk = new Chunk(5);

            chunk.setPixel(0, 10, 11, 12);
            chunk.setPixel(1, 22, 23, 24);
            chunk.setPixel(2, 33, 33, 33);
            chunk.setPixel(3, 44, 44, 44);
            chunk.setPixel(4, 55, 55, 55);

            for (ushort i = 0; i < 5; i++)
            {
                chunk.setOffset(i);
                mapper.renderAndShow(chunk);
                strip.show();
            }
        }
        protected override void RenderModel(float elapsedMs)
        {
            using (Blender.AveragingBlender())
            {
                // Draw the body.

                GL.Color4(Color);

                GL.Begin(PrimitiveType.Quads);

                GL.Vertex3(-HalfSize.X, -HalfSize.Y, -HalfSize.Z);
                GL.Vertex3(HalfSize.X, -HalfSize.Y, -HalfSize.Z);
                GL.Vertex3(HalfSize.X, HalfSize.Y, -HalfSize.Z);
                GL.Vertex3(-HalfSize.X, HalfSize.Y, -HalfSize.Z);

                GL.Vertex3(-HalfSize.X, -HalfSize.Y, HalfSize.Z);
                GL.Vertex3(HalfSize.X, -HalfSize.Y, HalfSize.Z);
                GL.Vertex3(HalfSize.X, HalfSize.Y, HalfSize.Z);
                GL.Vertex3(-HalfSize.X, HalfSize.Y, HalfSize.Z);

                GL.Vertex3(-HalfSize.X, -HalfSize.Y, -HalfSize.Z);
                GL.Vertex3(-HalfSize.X, HalfSize.Y, -HalfSize.Z);
                GL.Vertex3(-HalfSize.X, HalfSize.Y, HalfSize.Z);
                GL.Vertex3(-HalfSize.X, -HalfSize.Y, HalfSize.Z);

                GL.Vertex3(HalfSize.X, -HalfSize.Y, -HalfSize.Z);
                GL.Vertex3(HalfSize.X, HalfSize.Y, -HalfSize.Z);
                GL.Vertex3(HalfSize.X, HalfSize.Y, HalfSize.Z);
                GL.Vertex3(HalfSize.X, -HalfSize.Y, HalfSize.Z);

                GL.Vertex3(-HalfSize.X, -HalfSize.Y, -HalfSize.Z);
                GL.Vertex3(HalfSize.X, -HalfSize.Y, -HalfSize.Z);
                GL.Vertex3(HalfSize.X, -HalfSize.Y, HalfSize.Z);
                GL.Vertex3(-HalfSize.X, -HalfSize.Y, HalfSize.Z);

                GL.Vertex3(-HalfSize.X, HalfSize.Y, -HalfSize.Z);
                GL.Vertex3(HalfSize.X, HalfSize.Y, -HalfSize.Z);
                GL.Vertex3(HalfSize.X, HalfSize.Y, HalfSize.Z);
                GL.Vertex3(-HalfSize.X, HalfSize.Y, HalfSize.Z);

                GL.End();

                // Draw the borders.

                GL.Color4(0.7f, 0.7f, 0.7f, 0.1f);
                GL.LineWidth(2f);

                GL.Begin(PrimitiveType.LineLoop);

                GL.Vertex3(-HalfSize.X, -HalfSize.Y, -HalfSize.Z);
                GL.Vertex3(-HalfSize.X, -HalfSize.Y, HalfSize.Z);
                GL.Vertex3(-HalfSize.X, HalfSize.Y, HalfSize.Z);
                GL.Vertex3(-HalfSize.X, HalfSize.Y, -HalfSize.Z);

                GL.End();

                GL.Begin(PrimitiveType.LineLoop);

                GL.Vertex3(HalfSize.X, -HalfSize.Y, -HalfSize.Z);
                GL.Vertex3(HalfSize.X, -HalfSize.Y, HalfSize.Z);
                GL.Vertex3(HalfSize.X, HalfSize.Y, HalfSize.Z);
                GL.Vertex3(HalfSize.X, HalfSize.Y, -HalfSize.Z);

                GL.End();

                GL.Begin(PrimitiveType.Lines);

                GL.Vertex3(-HalfSize.X, -HalfSize.Y, -HalfSize.Z);
                GL.Vertex3(HalfSize.X, -HalfSize.Y, -HalfSize.Z);

                GL.Vertex3(-HalfSize.X, HalfSize.Y, HalfSize.Z);
                GL.Vertex3(HalfSize.X, HalfSize.Y, HalfSize.Z);

                GL.Vertex3(-HalfSize.X, -HalfSize.Y, HalfSize.Z);
                GL.Vertex3(HalfSize.X, -HalfSize.Y, HalfSize.Z);

                GL.Vertex3(-HalfSize.X, HalfSize.Y, -HalfSize.Z);
                GL.Vertex3(HalfSize.X, HalfSize.Y, -HalfSize.Z);

                GL.End();
            }
        }
Exemple #9
0
 public void Register()
 {
     Blender.MapUri("/launchpad/applications", string.Empty, new string[] { "app", "icon" });
 }
 public void setBlender(Blender blender)
 {
     this.m_blender = blender;
 }
Exemple #11
0
 internal BlendedNode(CSharp.CSharpSyntaxNode node, SyntaxToken token, Blender blender)
 {
     this.Node    = node;
     this.Token   = token;
     this.Blender = blender;
 }
 public static void Register()
 {
     Blender.MapUri2 <Item>("/ShoppingCart/Partials/Item/{?}", new[] { "small" });
     Blender.MapUri2 <Item>("/ShoppingCart/Partials/AddItem1/{?}", new[] { "page" });
     Blender.MapUri2 <Item>("/ShoppingCart/Partials/AddItem2/{?}", new[] { "detail" });
 }
Exemple #13
0
        public static Int32 Main(String[] args)
        {
            Utils.LogLevel   = LogLevelEnum.Warning;
            Utils.DebugLevel = LogLevelEnum.Debug;

            String oldTitle = Console.Title;

#if DEV_DOLKENSP
            Utils.LogLevel   = LogLevelEnum.None;    // Display NO error logs
            Utils.DebugLevel = LogLevelEnum.Debug;

            args = new String[] { @"O:\Mods\Models\*.cg?", @"O:\Mods\Models\*.skin", @"O:\Mods\Models\*.chr", "-objectdir", @"O:\Mods\SC\Latest", "-tif", "-merge", "-obj", "-outdir", @"O:\Mods\Models\Export" };
            args = new String[] { @"O:\Mods\SC\Latest\*.cg?", @"O:\Mods\SC\Latest\*.skin", @"O:\Mods\SC\Latest\*.chr", "-objectdir", @"O:\Mods\SC\Latest", "-tif", "-merge", "-obj", "-outdir", @"O:\Mods\Assets_Out" };
            args = new String[] { @"Objects\*.cg?", @"Objects\*.skin", @"Objects\*.chr", "-objectdir", @"O:\Mods\SC\Latest", "-tif", "-merge", "-obj", "-outdir", @"Export" };
            // args = new String[] { @"O:\Mods\Assets\*.cg?", "-objectdir", @"O:\Mods\SC\Latest", "-tif", "-merge", "-dae", "-outdir", @"O:\Mods\Assets_Out" };
            args = new String[] { @"Objects\*.cg?", @"Objects\*.skin", @"Objects\*.chr", "-objectdir", @"O:\Mods\SC\Latest", "-tif", "-merge", "-obj", "-cry", "-dae", "-outdir", @"Export", "-skipshield", "-skipproxy" };
            args = new String[] { @"Starfarer\*.cg?", "-objectdir", @"D:\Workspaces\github\Cryengine-Converter\cgf-converter\bin\dev_dolkensp", "-tif", "-merge", "-obj", "-cry", "-outdir", @"Export", "-skipshield", "-skipproxy" };
#endif

#if DEV_MARKEMP
            Utils.LogLevel   = LogLevelEnum.Verbose; // Display ALL error logs in the console
            Utils.DebugLevel = LogLevelEnum.Debug;   // Send all to the IDE Output window
            //args = new String[] { @"c:\users\geoff\source\repos\cgf-converter\cgf-converter\bin\Debug\raptor.chr", "-dds", "-dae" };
            //args = new String[] { @"c:\users\geoff\source\repos\cgf-converter\cgf-converter\bin\Debug\ar03.chr", "-dds", "-dae" };
            //args = new String[] { @"D:\depot\mwo\Objects\environments\frontend\mechlab_a\lights\industrial_wetlamp_a.cgf", "-dds", "-dae", "-objectdir", @"d:\depot\mwo\" };
            //args = new String[] { @"D:\depot\mwo\Objects\mechs\timberwolf\body\timberwolf.chr", "-dds", "-dae", "-objectdir", @"d:\depot\mwo\" };
            //args = new String[] { @"D:\depot\mwo\Objects\mechs\hellbringer\body\hbr_right_torso_uac5_bh1.cga", "-dds", "-dae", "-objectdir", @"d:\depot\mwo\" };
            //args = new String[] { @"D:\depot\mwo\Objects\environments\frontend\mechlab_a\mechbay_ceilings\mechbay_ceilinga.cgf", "-dds", "-dae", "-objectdir", @"d:\depot\mwo\" };
            args = new String[] { @"D:\depot\mwo\Objects\environments\industrial\mf_maglev_loader_a.cgf", "-dds", "-dae", "-objectdir", @"d:\depot\mwo\" };
            //args = new String[] { @"D:\Blender Projects\Mechs\Objects\characters\pilot\pilot_body.chr", "-dds", "-dae", "-objectdir", @"d:\blender projects\mechs\" };
            //args = new String[] { @"D:\Blender Projects\Star Citizen\Objects\animals\crab\props\crab_thorshu_prop_01.chr", "-objectdir", @"d:\blender projects\star citizen", "-dae", "-tif" };
            //args = new String[] { @"D:\Blender Projects\Star Citizen\Objects\animals\fish\CleanerFish_clean_prop_animal_01.chr", "-objectdir", @"d:\blender projects\star citizen", "-dae", "-tif" };
            //args = new String[] { @"d:\Blender Projects\Star Citizen\Objects\Spaceships\Ships\AEGS\Gladius\AEGS_Gladius.cga", "-objectdir", @"d:\blender projects\star citizen", "-dae", "-tif" };
            //args = new String[] { @"d:\Blender Projects\Star Citizen\Objects\Spaceships\Ships\AEGS\Retaliator\AEGS_retaliator.cga", "-objectdir", @"d:\blender projects\star citizen", "-dae", "-tif" };
            //args = new String[] { @"D:\Blender Projects\Star Citizen\Objects\Spaceships\Ships\AEGS\Redeemer\AEGS_Redeemer.cga", "-objectdir", @"d:\blender projects\star citizen", "-dae", "-tif" };
            //args = new String[] { @"D:\Blender Projects\Star Citizen\Objects\Spaceships\Ships\DRAK\Cutlass\DRAK_Cutlass.cga", "-objectdir", @"d:\blender projects\star citizen", "-dae", "-tif" };
            //args = new String[] { @"d:\Blender Projects\Star Citizen\Objects\buildingsets\human\lowtech\bravo\grimhex\anchor\anchor_gun_a.cgf", "-objectdir", @"d:\blender projects\star citizen", "-dds", "-dae", "-tif" };
            //args = new String[] { @"d:\Blender Projects\Star Citizen\Objects\buildingsets\human\hightech\alpha\ext\landingpad\ext_landingpad_floor_center_stair_16x08x10_b.cgf", "-objectdir", @"d:\blender projects\star citizen", "-dae", "-tif" };
            //args = new String[] { @"d:\Blender Projects\Star Citizen\Objects\buildingsets\human\hightech\alpha\ext\landingpad\landingpad_decal_landingzone_a.cgf", "-objectdir", @"d:\blender projects\star citizen", "-dae", "-tif" };
            //args = new String[] { @"D:\depot\SC\Objects\Characters\Human\heads\male\npc\male09\male09_t1_head.skin", "-objectdir", @"d:\blender projects\star citizen", "-dae", "-tif" };
            //args = new String[] { @"D:\Blender Projects\Star Citizen\Objects\Characters\Human\male_v7\export\bhm_skeleton_v7.chr", "-objectdir", @"d:\blender projects\star citizen", "-dae", "-tif" };
            //args = new String[] { @"D:\Blender Projects\Star Citizen\Objects\buildingsets\human\universal\org\trees\tree_ash_a.cgf", "-objectdir", @"d:\blender projects\star citizen", "-dae", "-tif" };
            //args = new String[] { @"D:\Blender Projects\Star Citizen\Objects\Characters\Human\male_v7\armor\rsi\m_rsi_pilot_flightsuit_01.skin", "-objectdir", @"d:\blender projects\star citizen\", "-dae", "-tif" };
            //args = new String[] { @"D:\Blender Projects\Star Citizen\Objects\Characters\Human\male_v7\armor\slaver\m_slaver_medium_armor_01_core.skin", "-objectdir", @"d:\blender projects\star citizen", "-dae", "-tif" };
            //args = new String[] { @"D:\Blender Projects\Mechs\Objects\environments\city\im_roads_zone_05\im_zone05_block16.cgf", "-objectdir", @"d:\blender projects\mechs", "-dae" };
            //args = new String[] { @"d:\temp\prey\dahl_genmalebody01.skin", "-objectdir", @"d:\temp\prey", "-dae", "-dds" };
#endif

            ArgsHandler argsHandler = new ArgsHandler();
            Int32       result      = argsHandler.ProcessArgs(args);

#if !DEBUG
            try
            {
#endif
            System.Globalization.CultureInfo customCulture = (System.Globalization.CultureInfo)System.Threading.Thread.CurrentThread.CurrentCulture.Clone();
            customCulture.NumberFormat.NumberDecimalSeparator = ".";

            System.Threading.Thread.CurrentThread.CurrentCulture = customCulture;

            if (result == 0)
            {
                foreach (String inputFile in argsHandler.InputFiles)
                {
                    try
                    {
                        // Read CryEngine Files
                        CryEngine cryData = new CryEngine(inputFile, argsHandler.DataDir.FullName);

                        #region Render Output Files

                        if (argsHandler.Output_Blender == true)
                        {
                            Blender blendFile = new Blender(argsHandler, cryData);

                            blendFile.Render(argsHandler.OutputDir, argsHandler.InputFiles.Count > 1);
                        }

                        if (argsHandler.Output_Wavefront == true)
                        {
                            Wavefront objFile = new Wavefront(argsHandler, cryData);

                            objFile.Render(argsHandler.OutputDir, argsHandler.InputFiles.Count > 1);
                        }

                        if (argsHandler.Output_CryTek == true)
                        {
                            CryRender cryFile = new CryRender(argsHandler, cryData);

                            cryFile.Render(argsHandler.OutputDir, argsHandler.InputFiles.Count > 1);
                        }

                        if (argsHandler.Output_Collada == true)
                        {
                            COLLADA daeFile = new COLLADA(argsHandler, cryData);

                            daeFile.Render(argsHandler.OutputDir, argsHandler.InputFiles.Count > 1);
                        }

                        #endregion
                    }
                    catch (Exception ex)
                    {
                        Utils.Log(LogLevelEnum.Critical);
                        Utils.Log(LogLevelEnum.Critical, "********************************************************************************");
                        Utils.Log(LogLevelEnum.Critical, "There was an error rendering {0}", inputFile);
                        Utils.Log(LogLevelEnum.Critical);
                        Utils.Log(LogLevelEnum.Critical, ex.Message);
                        Utils.Log(LogLevelEnum.Critical);
                        Utils.Log(LogLevelEnum.Critical, ex.StackTrace);
                        Utils.Log(LogLevelEnum.Critical, "********************************************************************************");
                        Utils.Log(LogLevelEnum.Critical);
                    }
                }
            }

#if !DEBUG
        }

        catch (Exception)
        {
            if (argsHandler.Throw)
            {
                throw;
            }
        }
#endif

            Console.Title = oldTitle;

#if (DEV_DOLKENSP || DEV_MARKEMP)
            Console.WriteLine("Done...");
            Console.ReadKey();
#endif

            return(result);
        }
Exemple #14
0
        public void Register()
        {
            Application.Current.Use(new HtmlFromJsonProvider());
            Application.Current.Use(new PartialToStandaloneHtmlProvider());

            Handle.GET("/Timeline", () =>
            {
                return(Self.GET("/timeline/eventList"));
            });

            Handle.GET("/timeline/eventList", () =>
            {
                return(Db.Scope <MasterPage>(() => {
                    var master = this.GetMasterPageFromSession();

                    master.ActionRowPage = Self.GET("/timeline/partials/action-row");
                    master.CurrentPage = Self.GET("/timeline/partials/event-list");

                    return master;
                }));
            }, new HandlerOptions {
                SelfOnly = true
            });

            Handle.GET("/timeline/partials/event-list", () =>
            {
                EventListPage page = new EventListPage()
                {
                    Data = null
                };
                return(page);
            }, new HandlerOptions {
                SelfOnly = true
            });

            Handle.GET("/timeline/partials/action-row", () =>
            {
                ActionsPage page = new ActionsPage();
                page.LoadContributions();
                return(page);
            }, new HandlerOptions {
                SelfOnly = true
            });

            Handle.GET("/timeline/eventList/{?}", (string personId) =>
            {
                return(Db.Scope <MasterPage>(() => {
                    var master = this.GetMasterPageFromSession();

                    master.ActionRowPage = Self.GET("/timeline/partials/action-row/" + personId);
                    master.CurrentPage = Self.GET("/timeline/partials/event-list/" + personId);

                    return master;
                }));
            }, new HandlerOptions {
                SelfOnly = true
            });

            Handle.GET("/timeline/partials/event-list/{?}", (string personId) =>
            {
                EventListPage page = new EventListPage()
                {
                    PersonId = personId, Data = null
                };
                return(page);
            }, new HandlerOptions {
                SelfOnly = true
            });

            Handle.GET("/timeline/partials/action-row/{?}", (string personId) =>
            {
                ActionsPage page = new ActionsPage()
                {
                    PersonId = personId, Data = null
                };
                page.LoadContributions();
                return(page);
            }, new HandlerOptions {
                SelfOnly = true
            });


            Handle.GET("/timeline/contributions", () =>
            {
                return(new Json());
            }, new HandlerOptions {
                SelfOnly = true
            });
            Blender.MapUri("/timeline/contributions", "contributions");

            Handle.GET("/timeline/timeline-item/{?}", (string eventId) =>
            {
                return(new Json());
            }, new HandlerOptions {
                SelfOnly = true
            });
            Blender.MapUri("/timeline/timeline-item/{?}", "timeline-item");

            // Provides the People app with a timeline (+ an actions row, where events can be created)
            Handle.GET("/timeline/partial/timeline/{?}", (string personId) => {
                return(Self.GET("/timeline/eventList/" + personId));
            }, new HandlerOptions {
                SelfOnly = true
            });

            //Add Blender.MapUri<Simplified.Ring2.Person>("/people/partials/persons/{?}"); to the People app > will cause this to open in people app
            Blender.MapUri <Simplified.Ring2.Person>("/timeline/partial/timeline/{?}");


            // Instead of having the "delete this event" code in every app, the call to this handler triggers the deletion event.
            // That way timeline app will have full control of the deletion of events, no matter if the "cancel" button (from inside an event) is clicked,
            // or if the "X" (delete) button from the timeline app is clicked
            Handle.GET("/timeline/partial/delete-event/{?}", (string eventKey) =>
            {
                Event thisEvent = DbHelper.FromID(DbHelper.Base64DecodeObjectID(eventKey)) as Event;
                HelperFunctions.DeleteEvent(thisEvent);
                return(new Json());
            }, new HandlerOptions {
                SelfOnly = true
            });
            Blender.MapUri("/timeline/partial/delete-event/{?}", "delete-event");
        }
        public static int Main(string[] args)
        {
            Utils.LogLevel   = LogLevelEnum.Warning;
            Utils.DebugLevel = LogLevelEnum.Debug;

            string oldTitle = Console.Title;

#if DEV_DOLKENSP
            Utils.LogLevel   = LogLevelEnum.None;    // Display NO error logs
            Utils.DebugLevel = LogLevelEnum.Debug;

            args = new String[] { @"C:\Users\PeterDolkens\Downloads\SOC'n'destroy\socpak\pisces_int.soc", "-objectdir", @"C:\Users\PeterDolkens\Downloads\SOC'n'destroy\socpak", "-obj", "-outdir", @"C:\Users\PeterDolkens\Downloads\SOC'n'destroy\socpak\out" };
#endif

#if DEV_MARKEMP
            Utils.LogLevel   = LogLevelEnum.Verbose; // Display ALL error logs in the console
            Utils.DebugLevel = LogLevelEnum.Debug;   // Send all to the IDE Output window

            //args = new String[] { @"D:\depot\mwo\Objects\mechs\catapult\body\catapult.chr", "-dds", "-dae", "-objectdir", @"d:\depot\mwo\" };
            //args = new String[] { @"D:\depot\mwo\Objects\environments\frontend\mechlab_a\mechbay_ceilings\mechbay_ceilinga.cgf", "-dds", "-dae", "-objectdir", @"d:\depot\mwo\" };
            //args = new String[] { @"D:\depot\mwo\Objects\environments\industrial\mf_maglev_loader_a.cgf", "-dds", "-dae", "-objectdir", @"d:\depot\mwo\" };
            //args = new String[] { @"D:\depot\MWO\Objects\characters\pilot\pilot_body.chr", "-dds", "-dae", "-objectdir", @"d:\blender projects\mechs\" };
            //args = new String[] { @"D:\depot\MWO\Objects\environments\city\im_roads_zone_05\im_zone05_block16.cgf", "-objectdir", @"d:\blender projects\mechs", "-dae" };
            //args = new String[] { @"D:\depot\SC\Data\Objects\animals\fish\Fish_JellyFish_prop_animal_01.cga", "-objectdir", @"d:\depot\sc\data", "-dae" };
            //args = new String[] { @"D:\depot\SC\Data\Objects\animals\fish\CleanerFish_clean_prop_animal_01.chr", "-objectdir", @"d:\depot\sc\data", "-dae", "-tif" };
            //args = new String[] { @"d:\depot\SC\Data\Objects\Spaceships\Ships\AEGS\Gladius\AEGS_Gladius.cga", "-objectdir", @"d:\depot\sc\data", "-dae", "-tif" };
            //args = new String[] { @"d:\depot\SC\Data\Objects\Spaceships\Ships\AEGS\Retaliator\AEGS_retaliator.cga", "-objectdir", @"d:\depot\sc\data", "-dae", "-tif" };
            //args = new String[] { @"D:\depot\SC\Data\Objects\Spaceships\Ships\AEGS\Redeemer\AEGS_Redeemer.cga", "-objectdir", @"d:\depot\sc\data", "-dae", "-tif" };
            //args = new String[] { @"D:\depot\SC\Data\Objects\Spaceships\Ships\DRAK\Cutlass\DRAK_Cutlass.cga", "-objectdir", @"d:\depot\sc\data", "-dae", "-tif" };
            //args = new String[] { @"d:\depot\SC\Data\Objects\buildingsets\human\lowtech\bravo\grimhex\anchor\anchor_gun_a.cgf", "-objectdir", @"d:\depot\sc\data", "-dds", "-dae", "-tif" };
            //args = new String[] { @"D:\depot\SC\Data\Objects\Characters\Human\heads\male\npc\male09\male09_t1_head.skin", "-objectdir", @"d:\depot\sc\data", "-dae", "-tif" };
            //args = new String[] { @"D:\depot\SC\Data\Objects\Characters\Human\male_v7\export\bhm_skeleton_v7.chr", "-objectdir", @"d:\depot\sc\data", "-dae", "-tif" };
            //args = new String[] { @"D:\depot\SC\Data\Objects\buildingsets\human\universal\org\trees\tree_ash_a.cgf", "-objectdir", @"d:\depot\sc\data", "-dae", "-tif" };
            //args = new String[] { @"D:\depot\SC\Data\Objects\Characters\Human\male_v7\armor\rsi\m_rsi_pilot_flightsuit_01.skin", "-objectdir", @"d:\depot\sc\data", "-dae", "-tif" };
            //args = new String[] { @"D:\depot\SC\Data\Objects\Characters\Human\male_v7\armor\slaver\m_slaver_medium_armor_01_core.skin", "-objectdir", @"d:\depot\sc\data", "-dae", "-tif" };
            //args = new String[] { @"d:\temp\prey\dahl_genmalebody01.skin", "-objectdir", @"d:\temp\prey", "-dae", "-dds" };
            //args = new string[] { @"c:\users\ggerb\source\repos\Cryengine-Converter\cgfconvertertests\resourcefiles\sonicboom\checkpoint.cgf" };
#endif


            CultureInfo customCulture = (CultureInfo)Thread.CurrentThread.CurrentCulture.Clone();
            customCulture.NumberFormat.NumberDecimalSeparator = ".";

            Thread.CurrentThread.CurrentCulture = customCulture;
            ArgsHandler argsHandler = new ArgsHandler();
#if !DEBUG
            try
            {
#endif
            if (argsHandler.ProcessArgs(args) == 0)
            {
                foreach (String inputFile in argsHandler.InputFiles)
                {
                    try
                    {
                        // Read CryEngine Files
                        CryEngine cryData = new CryEngine(inputFile, argsHandler.DataDir.FullName);
                        cryData.ProcessCryengineFiles();

                        if (argsHandler.OutputBlender == true)
                        {
                            Blender blendFile = new Blender(argsHandler, cryData);

                            blendFile.Render(argsHandler.OutputDir, argsHandler.InputFiles.Count > 1);
                        }

                        if (argsHandler.OutputWavefront == true)
                        {
                            Wavefront objFile = new Wavefront(argsHandler, cryData);

                            objFile.Render(argsHandler.OutputDir, argsHandler.InputFiles.Count > 1);
                        }

                        if (argsHandler.OutputCryTek == true)
                        {
                            CryRender cryFile = new CryRender(argsHandler, cryData);

                            cryFile.Render(argsHandler.OutputDir, argsHandler.InputFiles.Count > 1);
                        }

                        if (argsHandler.OutputCollada == true)
                        {
                            COLLADA daeFile = new COLLADA(argsHandler, cryData);

                            daeFile.Render(argsHandler.OutputDir, argsHandler.InputFiles.Count > 1);
                        }
                    }
                    catch (Exception ex)
                    {
                        Utils.Log(LogLevelEnum.Critical);
                        Utils.Log(LogLevelEnum.Critical, "********************************************************************************");
                        Utils.Log(LogLevelEnum.Critical, "There was an error rendering {0}", inputFile);
                        Utils.Log(LogLevelEnum.Critical);
                        Utils.Log(LogLevelEnum.Critical, ex.Message);
                        Utils.Log(LogLevelEnum.Critical);
                        Utils.Log(LogLevelEnum.Critical, ex.StackTrace);
                        Utils.Log(LogLevelEnum.Critical, "********************************************************************************");
                        Utils.Log(LogLevelEnum.Critical);
                        return(1);
                    }
                }
            }

#if !DEBUG
        }

        catch (Exception)
        {
            if (argsHandler.Throw)
            {
                throw;
            }
        }
#endif

            Console.Title = oldTitle;

#if (DEV_DOLKENSP || DEV_MARKEMP)
            Console.WriteLine("Done...");
            Console.ReadKey();
#endif
            return(0);
        }
Exemple #16
0
 public void Register()
 {
     Blender.MapUri("/website/app-name", "app-name");
 }
Exemple #17
0
        static void Main()
        {
            var app = Application.Current;

            app.Use(new HtmlFromJsonProvider());
            app.Use(new PartialToStandaloneHtmlProvider());

            DummyData.Create();

            Handle.GET("/KitchenSink/json", () => { return(new Json()); });

            Handle.GET("/KitchenSink/partial/mainpage", () => new MainPage());
            Handle.GET("/KitchenSink/mainpage", () => WrapPage <MainPage>("/KitchenSink/partial/mainpage"));

            Handle.GET("/KitchenSink", () => { return(Self.GET("/KitchenSink/mainpage")); });

            Handle.GET("/KitchenSink/partial/button", () => new ButtonPage());
            Handle.GET("/KitchenSink/button", () => WrapPage <ButtonPage>("/KitchenSink/partial/button"));

            Handle.GET("/KitchenSink/partial/breadcrumb",
                       () => { return(Db.Scope(() => { return new BreadcrumbPage(); })); });
            Handle.GET("/KitchenSink/breadcrumb", () => WrapPage <BreadcrumbPage>("/KitchenSink/partial/breadcrumb"));

            Handle.GET("/KitchenSink/partial/chart", () => new ChartPage());
            Handle.GET("/KitchenSink/chart", () => WrapPage <ChartPage>("/KitchenSink/partial/chart"));

            Handle.GET("/KitchenSink/partial/checkbox", () => new CheckboxPage());
            Handle.GET("/KitchenSink/checkbox", () => WrapPage <CheckboxPage>("/KitchenSink/partial/checkbox"));

            Handle.GET("/KitchenSink/partial/togglebutton", () => new ToggleButtonPage());
            Handle.GET("/KitchenSink/togglebutton",
                       () => WrapPage <ToggleButtonPage>("/KitchenSink/partial/togglebutton"));

            Handle.GET("/KitchenSink/partial/datagrid", () => new DatagridPage());
            Handle.GET("/KitchenSink/datagrid", () => WrapPage <DatagridPage>("/KitchenSink/partial/datagrid"));

            Handle.GET("/KitchenSink/partial/decimal", () => new DecimalPage());
            Handle.GET("/KitchenSink/decimal", () => WrapPage <DecimalPage>("/KitchenSink/partial/decimal"));

            Handle.GET("/KitchenSink/partial/dropdown", () => new DropdownPage());
            Handle.GET("/KitchenSink/dropdown", () => WrapPage <DropdownPage>("/KitchenSink/partial/dropdown"));

            Handle.GET("/KitchenSink/partial/html", () => new HtmlPage());
            Handle.GET("/KitchenSink/html", () => WrapPage <HtmlPage>("/KitchenSink/partial/html"));

            Handle.GET("/KitchenSink/partial/integer", () => new IntegerPage());
            Handle.GET("/KitchenSink/integer", () => WrapPage <IntegerPage>("/KitchenSink/partial/integer"));

            Handle.GET("/KitchenSink/partial/Geo", () =>
            {
                return(Db.Scope(() =>
                {
                    var geoPage = new GeoPage();
                    geoPage.Init();
                    return geoPage;
                }));
            });
            Handle.GET("/KitchenSink/Geo", () => WrapPage <GeoPage>("/KitchenSink/partial/Geo"));

            Handle.GET("/KitchenSink/partial/markdown", () => new MarkdownPage());
            Handle.GET("/KitchenSink/markdown", () => WrapPage <MarkdownPage>("/KitchenSink/partial/markdown"));

            Handle.GET("/KitchenSink/partial/nested", () => new NestedPartial
            {
                Data = new AnyData()
            });
            Handle.GET("/KitchenSink/nested", () => WrapPage <NestedPartial>("/KitchenSink/partial/nested"));

            Handle.GET("/KitchenSink/partial/radiolist", () => new RadiolistPage());
            Handle.GET("/KitchenSink/radiolist", () => WrapPage <RadiolistPage>("/KitchenSink/partial/radiolist"));

            Handle.GET("/KitchenSink/partial/multiselect", () => new MultiselectPage());
            Handle.GET("/KitchenSink/multiselect", () => WrapPage <MultiselectPage>("/KitchenSink/partial/multiselect"));

            Handle.GET("/KitchenSink/partial/password", () => new PasswordPage());
            Handle.GET("/KitchenSink/password", () => WrapPage <PasswordPage>("/KitchenSink/partial/password"));

            Handle.GET("/KitchenSink/partial/table", () => new TablePage());
            Handle.GET("/KitchenSink/table", () => WrapPage <TablePage>("/KitchenSink/partial/table"));

            Handle.GET("/KitchenSink/partial/text", () => new TextPage());
            Handle.GET("/KitchenSink/text", () => WrapPage <TextPage>("/KitchenSink/partial/text"));

            Handle.GET("/KitchenSink/partial/textarea", () => new TextareaPage());
            Handle.GET("/KitchenSink/textarea", () => WrapPage <TextareaPage>("/KitchenSink/partial/textarea"));

            Handle.GET("/KitchenSink/partial/radio", () => new RadioPage());
            Handle.GET("/KitchenSink/radio", () => WrapPage <RadioPage>("/KitchenSink/partial/radio"));

            Handle.GET("/KitchenSink/partial/Redirect", () => new RedirectPage());
            Handle.GET("/KitchenSink/Redirect", () => WrapPage <RedirectPage>("/KitchenSink/partial/Redirect"));

            Handle.GET("/KitchenSink/partial/Validation", () => new ValidationPage());
            Handle.GET("/KitchenSink/Validation", () => WrapPage <ValidationPage>("/KitchenSink/partial/Validation"));

            Handle.GET("/KitchenSink/Redirect/{?}", (string param) =>
            {
                var master            = WrapPage <RedirectPage>("/KitchenSink/partial/Redirect") as MasterPage;
                var page              = master.CurrentPage as RedirectPage;
                page.YourFavoriteFood = "You've got some tasty " + param;
                return(master);
            });

            Handle.GET("/KitchenSink/partial/url", () => new UrlPage());
            Handle.GET("/KitchenSink/url", () => WrapPage <UrlPage>("/KitchenSink/partial/url"));

            Handle.GET("/KitchenSink/partial/datepicker", () => new DatepickerPage());
            Handle.GET("/KitchenSink/datepicker", () => WrapPage <DatepickerPage>("/KitchenSink/partial/datepicker"));

            Handle.GET("/KitchenSink/partial/fileupload", () => new FileUploadPage());
            Handle.GET("/KitchenSink/fileupload", () => WrapPage <FileUploadPage>("/KitchenSink/partial/fileupload"));

            Handle.GET("/KitchenSink/partial/callback", () => new CallbackPage());
            Handle.GET("/KitchenSink/callback", () => WrapPage <CallbackPage>("/KitchenSink/partial/callback"));

            Handle.GET("/KitchenSink/partial/dialog", () => new DialogPage());
            Handle.GET("/KitchenSink/dialog", () => WrapPage <DialogPage>("/KitchenSink/partial/dialog"));

            Handle.GET("/KitchenSink/partial/progressbar", () => new ProgressBarPage());
            Handle.GET("/Kitchensink/progressbar", () => WrapPage <ProgressBarPage>("/KitchenSink/partial/progressbar"));

            Handle.GET("/KitchenSink/partial/lazyloading", () => new LazyLoadingPage());
            Handle.GET("/Kitchensink/lazyloading", () => WrapPage <LazyLoadingPage>("/KitchenSink/partial/lazyloading"));

            Handle.GET("/KitchenSink/partial/pagination", () => new PaginationPage());
            Handle.GET("/Kitchensink/pagination", () => WrapPage <PaginationPage>("/KitchenSink/partial/pagination"));

            Handle.GET("/KitchenSink/partial/flashmessage", () => new FlashMessagePage());
            Handle.GET("/Kitchensink/flashmessage", () => WrapPage <FlashMessagePage>("/KitchenSink/partial/flashmessage"));

            Handle.GET("/KitchenSink/partial/clientlocalstate", () => new ClientLocalStatePage());
            Handle.GET("/KitchenSink/clientlocalstate", () => WrapPage <ClientLocalStatePage>("/KitchenSink/partial/clientlocalstate"));

            Handle.GET("/KitchenSink/partial/cookie", (Request request) =>
            {
                string name     = "KitchenSink";
                CookiePage page = new CookiePage();
                Cookie cookie   = request.Cookies.Select(x => new Cookie(x)).FirstOrDefault(x => x.Name == name);

                if (cookie != null)
                {
                    page.RequestCookie = cookie.Value;
                }

                cookie = new Cookie()
                {
                    Name    = name,
                    Value   = string.Format("KitchenSinkCookie-{0}", DateTime.Now.ToString()),
                    Expires = DateTime.Now.AddDays(1)
                };

                Handle.AddOutgoingCookie(name, cookie.GetFullValueString());

                return(page);
            });
            Handle.GET("/KitchenSink/cookie", () => WrapPage <CookiePage>("/KitchenSink/partial/cookie"));

            HandleFile.GET("/KitchenSink/fileupload/upload", task =>
            {
                Session.ScheduleTask(task.SessionId, (session, id) =>
                {
                    var master = session.Store[nameof(MasterPage)] as MasterPage;

                    if (master == null)
                    {
                        return;
                    }

                    var page = master.CurrentPage as FileUploadPage;

                    if (page == null)
                    {
                        return;
                    }

                    var item = page.Tasks.FirstOrDefault(x => x.FileName == task.FileName);

                    if (task.State == HandleFile.UploadTaskState.Error)
                    {
                        if (item != null)
                        {
                            page.Tasks.Remove(item);
                        }
                    }
                    else if (task.State == HandleFile.UploadTaskState.Completed)
                    {
                        if (item != null)
                        {
                            page.Tasks.Remove(item);
                        }

                        var file = page.Files.FirstOrDefault(x => x.FileName == task.FileName);

                        if (file == null)
                        {
                            file = page.Files.Add();
                        }

                        file.FileName = task.FileName;
                        file.FileSize = task.FileSize;
                        file.FilePath = task.FilePath;
                    }
                    else
                    {
                        if (item == null)
                        {
                            item = page.Tasks.Add();
                        }

                        item.FileName = task.FileName;
                        item.FileSize = task.FileSize;
                        item.Progress = task.Progress;
                    }

                    session.CalculatePatchAndPushOnWebSocket();
                });
            });

            Handle.GET("/KitchenSink/partial/autocomplete", () => Db.Scope(() => new AutocompletePage()));
            Handle.GET("/KitchenSink/autocomplete", () => WrapPage <AutocompletePage>("/KitchenSink/partial/autocomplete"));

            Handle.GET("/KitchenSink/nav", () => { return(new NavPage()); }, new HandlerOptions()
            {
                SelfOnly = true
            });

            Handle.GET("/KitchenSink/app-name", () => { return(new AppName()); });

            Handle.GET("/KitchenSink/menu", () => { return(new AppMenuPage()); });

            Blender.MapUri("/KitchenSink/menu", string.Empty, new string[] { "menu" });
            Blender.MapUri("/KitchenSink/app-name", string.Empty, new string[] { "app", "icon" });
        }
Exemple #18
0
        public void Register()
        {
            Application.Current.Use(new HtmlFromJsonProvider());
            Application.Current.Use(new PartialToStandaloneHtmlProvider());

            //Testing JWT

            /*Handle.GET("/signin/jwt/{?}/{?}", (string Username, string Password) => {
             *  string message;
             *  SystemUserSession session = SignInOut.SignInSystemUser(Username, Password, null, out message);
             *
             *  if (session != null) {
             *      string jwt = JWT.JsonWebToken.Encode(new { Username = Username, Issuer = "Polyjuice.SignIn" }, session.Token.User.Password, JWT.JwtHashAlgorithm.HS256);
             *      Handle.AddOutgoingHeader("x-jwt", jwt);
             *  }
             *
             *  return 200;
             * });*/

            Application.Current.Use((Request req) =>
            {
                Cookie cookie = GetSignInCookie();

                if (cookie != null)
                {
                    if (Session.Current == null)
                    {
                        Session.Current = new Session(SessionOptions.PatchVersioning);
                    }

                    SystemUserSession session = SystemUser.SignInSystemUser(cookie.Value);

                    if (session != null)
                    {
                        RefreshAuthCookie(session);
                    }
                }

                return(null);
            });

            Handle.GET("/signin/user", () =>
            {
                MasterPage master = this.GetMaster();

                if (master.SignInPage != null)
                {
                    return(master.SignInPage);
                }

                Cookie cookie   = GetSignInCookie();
                SignInPage page = new SignInPage()
                {
                    Data = null
                };

                master.SignInPage = page;

                if (cookie != null)
                {
                    SystemUser.SignInSystemUser(cookie.Value);
                    master.RefreshSignInState();
                }

                //Testing JWT

                /*if (Handle.IncomingRequest.HeadersDictionary.ContainsKey("x-jwt")) {
                 *  System.Web.Script.Serialization.JavaScriptSerializer serializer = new System.Web.Script.Serialization.JavaScriptSerializer();
                 *  string jwt = Handle.IncomingRequest.HeadersDictionary["x-jwt"];
                 *  Dictionary<string, string> payload = JWT.JsonWebToken.DecodeToObject<Dictionary<string, string>>(jwt, string.Empty, false);
                 *  string username = payload["Username"];
                 *  SystemUser user = Db.SQL<SystemUser>("SELECT su FROM Simplified.Ring3.SystemUser su WHERE su.Username = ?", username).First;
                 *
                 *  try {
                 *      JWT.JsonWebToken.DecodeToObject<Dictionary<string, string>>(jwt, user.Password, true);
                 *      page.SetAuthorizedState(SignInOut.SignInSystemUser(user));
                 *  } catch (JWT.SignatureVerificationException) {
                 *  }
                 * }*/

                return(page);
            });

            Handle.GET("/signin/partial/signout", HandleSignOut, new HandlerOptions()
            {
                SkipRequestFilters = true
            });

            Handle.GET("/signin/signinuser", HandleSignInForm);
            Handle.GET <string>("/signin/signinuser?{?}", HandleSignInForm);

            Handle.GET("/signin/profile", () =>
            {
                MasterPage master = this.GetMaster();

                master.RequireSignIn = true;
                master.Open("/signin/partial/profile-form");

                return(master);
            });

            Handle.GET("/signin/partial/signin-form", () => new SignInFormPage()
            {
                Data = null
            }, new HandlerOptions()
            {
                SelfOnly = true
            });
            Handle.GET("/signin/partial/alreadyin-form", () => new AlreadyInPage()
            {
                Data = null
            },
                       new HandlerOptions()
            {
                SelfOnly = true
            });
            Handle.GET("/signin/partial/restore-form", () => new RestorePasswordFormPage(),
                       new HandlerOptions()
            {
                SelfOnly = true
            });
            Handle.GET("/signin/partial/profile-form", () => new ProfileFormPage()
            {
                Data = null
            },
                       new HandlerOptions()
            {
                SelfOnly = true
            });
            Handle.GET("/signin/partial/accessdenied-form", () => new AccessDeniedPage(),
                       new HandlerOptions()
            {
                SelfOnly = true
            });

            Handle.GET("/signin/partial/main-form", () => new MainFormPage()
            {
                Data = null
            },
                       new HandlerOptions()
            {
                SelfOnly = true
            });

            Handle.GET("/signin/partial/user/image", () => new UserImagePage());
            Handle.GET("/signin/partial/user/image/{?}", (string objectId) => new Json(),
                       new HandlerOptions {
                SelfOnly = true
            });

            Handle.GET("/signin/generateadminuser", (Request request) =>
            {
                if (Db.SQL("SELECT o FROM Simplified.Ring3.SystemUser o").First != null)
                {
                    Handle.SetOutgoingStatusCode(403);
                    return("Unable to generate admin user: database is not empty!");
                }

                string ip = request.ClientIpAddress.ToString();

                if (ip == "127.0.0.1" || ip == "localhost")
                {
                    SignInOut.AssureAdminSystemUser();

                    return("Default admin user has been successfully generated.");
                }

                Handle.SetOutgoingStatusCode(403);
                return("Access denied.");
            }, new HandlerOptions()
            {
                SkipRequestFilters = true
            });

            Handle.POST("/signin/partial/signin", (Request request) =>
            {
                NameValueCollection values = HttpUtility.ParseQueryString(request.Body);
                string username            = values["username"];
                string password            = values["password"];
                string rememberMe          = values["rememberMe"];

                HandleSignIn(username, password, rememberMe);
                Session.Current.CalculatePatchAndPushOnWebSocket();

                return(200);
            }, new HandlerOptions()
            {
                SkipRequestFilters = true
            });

            Handle.GET("/signin/admin/settings", (Request request) =>
            {
                Json page;
                if (!AuthorizationHelper.TryNavigateTo("/signin/admin/settings", request, out page))
                {
                    return(page);
                }

                return(Db.Scope(() =>
                {
                    var settingsPage = new SettingsPage
                    {
                        Html = "/SignIn/viewmodels/SettingsPage.html",
                        Uri = request.Uri,
                        Data = MailSettingsHelper.GetSettings()
                    };
                    return settingsPage;
                }));
            });

            // Reset password
            Handle.GET("/signin/user/resetpassword?{?}", (string query, Request request) =>
            {
                NameValueCollection queryCollection = HttpUtility.ParseQueryString(query);
                string token = queryCollection.Get("token");

                MasterPage master = this.GetMaster();

                if (token == null)
                {
                    // TODO:
                    master.Partial = null; // (ushort)System.Net.HttpStatusCode.NotFound;
                    return(master);
                }

                // Retrive the resetPassword instance
                ResetPassword resetPassword = Db.SQL <ResetPassword>("SELECT o FROM Simplified.Ring6.ResetPassword o WHERE o.Token=? AND o.Expire>?", token, DateTime.UtcNow).First;

                if (resetPassword == null)
                {
                    // TODO: Show message "Reset token already used or expired"
                    master.Partial = null; // (ushort)System.Net.HttpStatusCode.NotFound;
                    return(master);
                }

                if (resetPassword.User == null)
                {
                    // TODO: Show message "User deleted"
                    master.Partial = null; // (ushort)System.Net.HttpStatusCode.NotFound;
                    return(master);
                }

                SystemUser systemUser = resetPassword.User;

                ResetPasswordPage page = new ResetPasswordPage()
                {
                    Html = "/SignIn/viewmodels/ResetPasswordPage.html",
                    Uri  = "/signin/user/resetpassword"
                           //Uri = request.Uri // TODO:
                };

                page.ResetPassword = resetPassword;

                if (systemUser.WhoIs != null)
                {
                    page.FullName = systemUser.WhoIs.FullName;
                }
                else
                {
                    page.FullName = systemUser.Username;
                }

                master.Partial = page;

                return(master);
            });

            Handle.GET("/signin/user/authentication/settings/{?}", (string userid, Request request) =>
            {
                Json page;
                if (!AuthorizationHelper.TryNavigateTo("/signin/user/authentication/settings/{?}", request, out page))
                {
                    return(new Json());
                }

                // Get system user
                SystemUser user = Db.SQL <SystemUser>("SELECT o FROM Simplified.Ring3.SystemUser o WHERE o.ObjectID = ?", userid).FirstOrDefault();

                if (user == null)
                {
                    // TODO: Return a "User not found" page
                    return(new Json());
                    //return (ushort)System.Net.HttpStatusCode.NotFound;
                }

                SystemUser systemUser      = SystemUser.GetCurrentSystemUser();
                SystemUserGroup adminGroup = Db.SQL <SystemUserGroup>("SELECT o FROM Simplified.Ring3.SystemUserGroup o WHERE o.Name = ?",
                                                                      AuthorizationHelper.AdminGroupName).FirstOrDefault();

                // Check if current user has permission to get this user instance
                if (AuthorizationHelper.IsMemberOfGroup(systemUser, adminGroup))
                {
                    if (user.WhoIs is Person)
                    {
                        page = Db.Scope(() => new SystemUserAuthenticationSettings
                        {
                            Html         = "/SignIn/viewmodels/SystemUserAuthenticationSettings.html",
                            Uri          = request.Uri,
                            Data         = user,
                            UserPassword = Self.GET("/signin/user/authentication/password/" + user.GetObjectID())
                        });

                        return(page);
                    }
                }

                return(new Json());
            }, new HandlerOptions {
                SelfOnly = true
            });

            Handle.GET("/signin/user/authentication/password/{?}", (string userid, Request request) =>
            {
                // Get system user
                SystemUser user = Db.SQL <SystemUser>("SELECT o FROM Simplified.Ring3.SystemUser o WHERE o.ObjectID = ?", userid).FirstOrDefault();

                if (user == null)
                {
                    return(new Json());
                }

                Json page = Db.Scope(() => new SetPasswordPage
                {
                    Html = "/SignIn/viewmodels/SetPasswordPage.html",
                    Data = user
                });

                return(page);
            }, new HandlerOptions {
                SelfOnly = true
            });

            Blender.MapUri("/signin/user", "user");                      //expandable icon; used in Launcher
            Blender.MapUri("/signin/signinuser", "userform");            //inline form; used in RSE Launcher
            Blender.MapUri("/signin/signinuser?{?}", "userform-return"); //inline form; used in UserAdmin
            Blender.MapUri("/signin/admin/settings", "settings");
            Blender.MapUri("/signin/user/authentication/password/{?}", "authentication-password");
            Blender.MapUri("/signin/user/authentication/settings/{?}", "authentication-settings");
            Blender.MapUri("/signin/partial/user/image", "userimage-default");  // default user image
        }