Beispiel #1
0
 static HotGlueHandler()
 {
     var debug = ((CompilationSection)ConfigurationManager.GetSection(@"system.web/compilation")).Debug;
     var config = HotGlueConfiguration.Load(debug);
     _configuration = LoadedConfiguration.Load(config);
     _locator = new GraphReferenceLocator(_configuration);
 }
 public GraphReferenceLocator(LoadedConfiguration configuration)
 {
     if (configuration == null)
     {
         throw new ArgumentNullException("configuration");
     }
     _configuration = configuration;
 }
        public void Initialize(IPipelines pipelines)
        {
            _debug = StaticConfiguration.IsRunningDebug;
            var config = HotGlueConfiguration.Load(_debug);
            _configuration = LoadedConfiguration.Load(config);
            _locator = new GraphReferenceLocator(_configuration);

            pipelines.AfterRequest.AddItemToEndOfPipeline(RewriteContents);
        }
Beispiel #4
0
 public HelperContext(LoadedConfiguration configuration, IReferenceLocator locator, bool debug)
 {
     Configuration = configuration;
     Locator = locator;
     Debug = debug;
     DefaultOptions = new HelperOptions
         {
             GenerateHeaderAndFooter = true
         };
 }
Beispiel #5
0
        internal bool SetControlIfCapturing(System.Windows.Input.Key key)
        {
            if (!IsCapturing || _captureState != CaptureState.CaptureKeyboard)
            {
                return(false);
            }

            LoadedConfiguration.SetKeyboardInput(_controlToCapture, key);

            UpdateAllButtonText();

            IsCapturing       = false;
            HasUnsavedChanges = true;
            _captureState     = CaptureState.NotCapturing;
            return(true);
        }
Beispiel #6
0
        internal bool SetControlIfCapturing(GamePadButton pressedButton)
        {
            if (!IsCapturing || _captureState != CaptureState.CaptureController)
            {
                return(false);
            }

            LoadedConfiguration.SetControllerInput(_controlToCapture, pressedButton);

            UpdateAllButtonText();
            UpdateAllButtonIcons();

            IsCapturing       = false;
            _captureState     = CaptureState.NotCapturing;
            HasUnsavedChanges = true;
            return(true);
        }
Beispiel #7
0
        internal bool SetNumpadEnterControlIfCapturing()
        {
            if (!IsCapturing)
            {
                return(false);
            }

            ControlInputSetting numpadEnterSetting = ControlMapper.ControlInputs.Where(c => c.DisplayText == "NUMPADENTER").FirstOrDefault();

            LoadedConfiguration.SetKeyboardInput(_controlToCapture, numpadEnterSetting);

            UpdateAllButtonText();

            IsCapturing       = false;
            HasUnsavedChanges = true;
            _captureState     = CaptureState.NotCapturing;
            return(true);
        }
 protected override void StartActions()
 {
     LogUtils.DoWarnLog($"StartActions!");
     LoadedConfiguration.ReloadFiles();
     CleanCache();
 }
Beispiel #9
0
        private void SetButtonIcon(string propertyToUpdate, GamePadButton?newButton)
        {
            Dictionary <GamePadButton, string> icons = new Dictionary <GamePadButton, string>()
            {
                { GamePadButton.Button1, "/7th Heaven;component/Resources/Icons/PS_Xbox_Icons/Square_X.png" },
                { GamePadButton.Button2, "/7th Heaven;component/Resources/Icons/PS_Xbox_Icons/Cross_A.png" },
                { GamePadButton.Button3, "/7th Heaven;component/Resources/Icons/PS_Xbox_Icons/Circle_B.png" },
                { GamePadButton.Button4, "/7th Heaven;component/Resources/Icons/PS_Xbox_Icons/Triangle_Y.png" },
                { GamePadButton.Button5, "/7th Heaven;component/Resources/Icons/PS_Xbox_Icons/L1_LB.png" },
                { GamePadButton.Button6, "/7th Heaven;component/Resources/Icons/PS_Xbox_Icons/R1_RB.png" },
                { GamePadButton.Button7, "/7th Heaven;component/Resources/Icons/PS_Xbox_Icons/L2_LT.png" },
                { GamePadButton.Button8, "/7th Heaven;component/Resources/Icons/PS_Xbox_Icons/R2_RT.png" },
                { GamePadButton.Button9, "/7th Heaven;component/Resources/Icons/PS_Xbox_Icons/Share_Back.png" },
                { GamePadButton.Button10, "/7th Heaven;component/Resources/Icons/PS_Xbox_Icons/Options_Start.png" },
                { GamePadButton.Button11, "/7th Heaven;component/Resources/Icons/PS_Xbox_Icons/XB_LS_Click.png" },
                { GamePadButton.Button12, "/7th Heaven;component/Resources/Icons/PS_Xbox_Icons/XB_RS_Click.png" },
                { GamePadButton.Up, "/7th Heaven;component/Resources/Icons/PS_Xbox_Icons/XB_LS_Up.png" },
                { GamePadButton.Down, "/7th Heaven;component/Resources/Icons/PS_Xbox_Icons/XB_LS_Down.png" },
                { GamePadButton.Left, "/7th Heaven;component/Resources/Icons/PS_Xbox_Icons/XB_LS_Left.png" },
                { GamePadButton.Right, "/7th Heaven;component/Resources/Icons/PS_Xbox_Icons/XB_LS_Right.png" },
                { GamePadButton.DPadUp, "/7th Heaven;component/Resources/Icons/PS_Xbox_Icons/XBOne_DPad_Up.png" },
                { GamePadButton.DPadDown, "/7th Heaven;component/Resources/Icons/PS_Xbox_Icons/XBOne_DPad_Down.png" },
                { GamePadButton.DPadLeft, "/7th Heaven;component/Resources/Icons/PS_Xbox_Icons/XBOne_DPad_Left.png" },
                { GamePadButton.DPadRight, "/7th Heaven;component/Resources/Icons/PS_Xbox_Icons/XBOne_DPad_Right.png" },
            };

            Dictionary <GamePadButton, string> directionalIcons = new Dictionary <GamePadButton, string>()
            {
                { GamePadButton.Up, "/7th Heaven;component/Resources/Icons/PS_Xbox_Icons/LS_DPad_Up.png" },
                { GamePadButton.Down, "/7th Heaven;component/Resources/Icons/PS_Xbox_Icons/LS_DPad_Down.png" },
                { GamePadButton.Left, "/7th Heaven;component/Resources/Icons/PS_Xbox_Icons/LS_DPad_Left.png" },
                { GamePadButton.Right, "/7th Heaven;component/Resources/Icons/PS_Xbox_Icons/LS_DPad_Right.png" },
            };


            PropertyInfo prop = this.GetType().GetProperty(propertyToUpdate, BindingFlags.Public | BindingFlags.Instance);

            if (newButton == null)
            {
                prop.SetValue(this, null, null);
                return;
            }


            GamePadButton button = newButton.Value;

            if (IsDpadSupportChecked && (button == GamePadButton.Up || button == GamePadButton.Down || button == GamePadButton.Left || button == GamePadButton.Right))
            {
                // check if dpad is binded to other controls; if not then display the image of the dpad/leftstick together
                if (LoadedConfiguration.IsButtonBinded(GamePadButton.DPadUp) || LoadedConfiguration.IsButtonBinded(GamePadButton.DPadDown) || LoadedConfiguration.IsButtonBinded(GamePadButton.DPadLeft) || LoadedConfiguration.IsButtonBinded(GamePadButton.DPadRight))
                {
                    prop.SetValue(this, icons[button], null);
                }
                else
                {
                    prop.SetValue(this, directionalIcons[button], null);
                }
            }
            else
            {
                prop.SetValue(this, icons[button], null);
            }
        }
Beispiel #10
0
        public static void RewriteContent(
            LoadedConfiguration configuration,
            IReferenceLocator locator,
            string root,
            string fullPath,
            Func<String,String> queryString,
            Action<String,String> returnPhysicalFile,
            Action<String,String> returnTransformedContent
            )
        {
            var contentType = "application/x-javascript";

            var extension = Path.GetExtension(fullPath);
            var compiledExtension = configuration.Compilers.Any(x => x.Extensions.Contains(extension));
            if (!compiledExtension && File.Exists(fullPath))
            {
                returnPhysicalFile(fullPath, contentType);
                return;
            }

            // find references
            Reference.TypeEnum type = fullPath.EndsWith("-module")
                                          ? Model.Reference.TypeEnum.Module
                                          : fullPath.EndsWith("-glue")
                                                ? Model.Reference.TypeEnum.App
                                                : fullPath.EndsWith("-gen")
                                                ? Model.Reference.TypeEnum.Generated
                                                : Model.Reference.TypeEnum.Dependency;

            var package = Package.Build(configuration, root);
            string content = null;

            if (fullPath.EndsWith("js-require"))
            {
                content = package.CompileStitch();
            }
            else
            {
                var name = queryString("name");
                var reference = SystemReference.Build(type, fullPath, root, name ?? "");

                switch (type)
                {
                    case Model.Reference.TypeEnum.App:
                        var references = locator.Load(root, reference);
                        content = package.Compile(references);
                        break;
                    case Model.Reference.TypeEnum.Dependency:
                        content = package.CompileDependency(reference);
                        break;
                    case Model.Reference.TypeEnum.Module:
                    case Model.Reference.TypeEnum.Generated:
                        content = package.CompileModule(reference);
                        break;
                    default:
                        throw new ArgumentOutOfRangeException();
                }
            }

            returnTransformedContent(content, contentType);
        }