Example #1
0
 /// <summary>Configure the service provider if not configured.</summary>
 public static void EnsureServiceProvider()
 {
     if (DefaultInstance.ServiceProvider == null)
     {
         DefaultInstance.BuildServiceProviderWithDescriptors();
     }
 }
Example #2
0
        protected override System.IdentityModel.Tokens.SecurityToken ReadTokenCore(XmlReader reader, SecurityTokenResolver tokenResolver)
        {
            if (reader == null)
            {
                throw new ArgumentNullException("reader");
            }

            if (reader.IsStartElement(Constants.UsernameTokenName, Constants.UsernameTokenNamespace))
            {
                //string id = reader.GetAttribute( Constants.IdAttributeName, Constants.WsUtilityNamespace );

                reader.ReadStartElement();

                // read the user name
                string userName = reader.ReadElementString(Constants.UsernameElementName, Constants.UsernameTokenNamespace);

                // read the password hash
                string password = reader.ReadElementString(Constants.PasswordElementName, Constants.UsernameTokenNamespace);

                // read nonce
                string nonce = reader.ReadElementString(Constants.NonceElementName, Constants.UsernameTokenNamespace);

                // read created
                string created = reader.ReadElementString(Constants.CreatedElementName, Constants.WsUtilityNamespace);

                reader.ReadEndElement();

                var info = new Info(userName, password);

                return(new SecurityToken(info, nonce, created));
            }

            return(DefaultInstance.ReadToken(reader, tokenResolver));
        }
 void Awake()
 {
     if (isDefault)
     {
         DefaultInstance <PointLightsImageEffect> .Set(this);
     }
 }
Example #4
0
        void RemoveFromDefaultPointLights()
        {
            PointLightsImageEffect imageEffect = DefaultInstance <PointLightsImageEffect> .Get();

            if (imageEffect != null)
            {
                imageEffect.Remove(this);
            }
        }
Example #5
0
        void AddToDefaultPointLights()
        {
            PointLightsImageEffect imageEffect = DefaultInstance <PointLightsImageEffect> .Get();

            if (imageEffect != null)
            {
                imageEffect.Add(this);
            }
        }
 void OnValidate()
 {
     if (isDefault)
     {
         DefaultInstance <PointLightsImageEffect> .Set(this);
     }
     else
     {
         DefaultInstance <PointLightsImageEffect> .Unset(this);
     }
 }
        public void Build_happy_path()
        {
            var mocks        = new MockRepository();
            var buildSession =
                mocks.StrictMock <BuildSession>();

            var theDefault = new DefaultClass();


            using (mocks.Record())
            {
                Expect.Call(buildSession.CreateInstance(typeof(IDefault))).Return(theDefault);
            }

            using (mocks.Playback())
            {
                var instance = new DefaultInstance();
                Assert.AreSame(theDefault, instance.Build(typeof(IDefault), buildSession));
            }
        }
        protected override SecurityToken ReadTokenCore(XmlReader reader, SecurityTokenResolver tokenResolver)
        {
            if (reader == null)
            {
                throw new ArgumentNullException("reader");
            }
            if (reader.IsStartElement(EchoConstants.EchoTokenName, EchoConstants.EchoNamespace))
            {
                string id = reader.GetAttribute(EchoConstants.Id, EchoConstants.WsUtilityNamespace);

                reader.ReadStartElement();

                string licenseKey = reader.ReadElementString(EchoConstants.EchoLicenseKeyElementName, EchoConstants.EchoNamespace);
                string companyKey = reader.ReadElementString(EchoConstants.EchoUniqueCodeElementName, EchoConstants.EchoNamespace);
                string machineKey = reader.ReadElementString(EchoConstants.EchoUniqueCodeElementName, EchoConstants.EchoNamespace);

                reader.ReadEndElement();

                return(new EchoToken(licenseKey, companyKey, machineKey, id));
            }
            return(DefaultInstance.ReadToken(reader, tokenResolver));
        }
        protected override SecurityToken ReadTokenCore(XmlReader reader, SecurityTokenResolver tokenResolver)
        {
            if (reader == null)
            {
                throw new ArgumentNullException("reader");
            }
            if (reader.IsStartElement(ConnectConstants.ConnectTokenName, ConnectConstants.ConnectNamespace))
            {
                string id  = reader.GetAttribute(ConnectConstants.Id, ConnectConstants.WsUtilityNamespace);
                string url = reader.GetAttribute(ConnectConstants.ConnectUrlPrefix, ConnectConstants.ConnectNamespace);

                reader.ReadStartElement();

                string licenseKey = reader.ReadElementString(ConnectConstants.ConnectLicenseKeyElementName, ConnectConstants.ConnectNamespace);
                string companyKey = reader.ReadElementString(ConnectConstants.ConnectCompanyKeyElementName, ConnectConstants.ConnectNamespace);
                string machineKey = reader.ReadElementString(ConnectConstants.ConnectMachineKeyElementName, ConnectConstants.ConnectNamespace);
                string depotKey   = reader.ReadElementString(ConnectConstants.ConnectDepotKeyElementName, ConnectConstants.ConnectNamespace);

                reader.ReadEndElement();

                return(new ConnectToken(new ConnectKeys(url, int.Parse(licenseKey), companyKey, machineKey, depotKey), id));
            }
            return(DefaultInstance.ReadToken(reader, tokenResolver));
        }
Example #10
0
 public void Play()
 {
     DefaultInstance.Play();
 }
Example #11
0
 public void Apply3D(AudioListener listener, AudioEmitter emitter)
 {
     DefaultInstance.Apply3D(listener, emitter);
 }
Example #12
0
 void Awake()
 {
     Application.runInBackground = _runInBackground;
     DefaultInstance <AppManager> .Set(this);
 }
Example #13
0
 public void ExitLoop()
 {
     DefaultInstance.ExitLoop();
 }
        internal static void TriggerEvent(uint ID)
        {
            bool InEvent = false;

            for (long i = Labels.ContainsKey(ID) ? Labels[ID] : 0; i < EventList.LongLength; i++)
            {
                string CMD = EventList[i].Trim();
                if (string.IsNullOrWhiteSpace(CMD) || CMD.StartsWith("#"))
                {
                    continue;
                }


                if (CMD == ":" + ID && !InEvent)
                {
                    InEvent = true;
                    continue;
                }

                if (!InEvent)
                {
                    continue;
                }


                string CMDN = CMD.Split(':')[0];
                string CMDV = null;
                if (CMD.Contains(":"))
                {
                    CMDV = CMD.Substring(CMD.IndexOf(":") + 1).Trim();
                }


                try {
                    switch (CMDN.ToLower())
                    {
                    case "show text":
                    case "subtitle":
                    case "set text":
                    case "text":
                        OverlayVisible       = true;
                        DefaultInstance.Text = CMDV.Replace("\\n", "\n");
                        break;

                    case "clear":
                    case "clear text":
                    case "remove text":
                    case "cls":
                        DefaultInstance.Text = string.Empty;
                        break;

                    case "hide":
                    case "close":
                    case "hide overlay":
                    case "close overlay":
                        OverlayVisible = false;
                        DefaultInstance.Invoke(new MethodInvoker(() => {
                            DefaultInstance.Opacity = 0;
                            DefaultInstance?.Close();
                        }));
                        break;

                    case "show":
                    case "open":
                    case "show overlay":
                    case "open overlay":
                        OverlayVisible = true;
                        DefaultInstance.Invoke(new MethodInvoker(() => {
                            DefaultInstance.Opacity = 1.0d;
                            DefaultInstance.Show();
                        }));
                        break;

                    case "window opacity":
                    case "overlay opacity":
                    case "global opacity":
                    case "opacity":
                        double Opacity = double.Parse(CMDV);
                        DefaultInstance.Invoke(new MethodInvoker(() => {
                            DefaultInstance.Opacity = Opacity;
                        }));
                        break;

                    case "set background color":
                    case "background color":
                    case "back color":
                    case "backcolor":
                        DefaultInstance.TextBackColor = LoadColor(CMDV, Color.Black);
                        break;

                    case "text color":
                    case "set text color":
                    case "fore color":
                    case "forecolor":
                        DefaultInstance.TextForeColor = LoadColor(CMDV, Color.FromArgb(40, 40, 40));
                        break;

                    case "set padding":
                    case "force padding":
                    case "change padding":
                    case "padding":
                        if (CMDV.ToLower() == "reset")
                        {
                            WindowDiff = new Padding(0, 0, 0, 0);
                            break;
                        }
                        GetWindowArea(HookHandler, out Point WPoint, out Size WSize);
                        int Top = 0, Bottom = 0, Right = 0, Left = 0;
                        foreach (string Parameter in CMDV.Split('|'))
                        {
                            string Border     = Parameter.Split(':')[0].Trim().ToLower();
                            string SVal       = Parameter.Split(':')[1].Trim();
                            bool   Negative   = false;
                            bool   Percentage = false;
                            if (SVal.EndsWith("%"))
                            {
                                SVal       = SVal.Substring(0, SVal.Length - 1);
                                Percentage = true;
                            }
                            if (SVal.StartsWith("-"))
                            {
                                SVal     = SVal.Substring(1);
                                Negative = true;
                            }
                            int Value = int.Parse(SVal);
                            switch (Border)
                            {
                            case "top":
                                Top = (int)(Percentage ? ((double)Value / 100) * WSize.Height : Value) * (Negative ? -1 : 1);
                                break;

                            case "bottom":
                                Bottom = (int)(Percentage ? ((double)Value / 100) * WSize.Height : Value) * (Negative ? -1 : 1);
                                break;

                            case "rigth":
                                Right = (int)(Percentage ? ((double)Value / 100) * WSize.Width : Value) * (Negative ? -1 : 1);
                                break;

                            case "left":
                                Left = (int)(Percentage ? ((double)Value / 100) * WSize.Width : Value) * (Negative ? -1 : 1);
                                break;
                            }
                        }
                        WindowDiff = new Padding(Left, Top, Right, Bottom);
                        UpdateWindow(HookHandler);
                        break;

                    case "font size":
                    case "set font size":
                    case "font resize":
                    case "resize font":
                        DefaultInstance.Font = new Font(DefaultInstance.Font.FontFamily, float.Parse(CMDV), DefaultInstance.Font.Style);
                        break;

                    case "auto font size":
                    case "auto resize text":
                    case "auto font resize":
                    case "resize text":
                        DefaultInstance.AutoSize = CMDV.ToLower() == "true";
                        break;

                    case "set dock":
                    case "change dock":
                    case "dock at":
                    case "dock":
                        switch (CMDV.Trim().ToLower())
                        {
                        case "bottom":
                            Dock = DockStyle.Bottom;
                            break;

                        case "top":
                            Dock = DockStyle.Top;
                            break;

                        case "center":
                            Dock = DockStyle.Fill;
                            break;
                        }
                        break;

                    case "text only":
                    case "no background":
                    case "subtitle mode":
                    case "hide background":
                        string Text = DefaultInstance?.Text;
                        DefaultInstance?.Close();
                        DefaultInstance?.Dispose();
                        TextOnly = CMDV.ToLower() == "true";
                        DefaultInstance.Show();
                        DefaultInstance.Text = Text;
                        UpdateWindow(HookHandler);
                        break;

                    case "centralize":
                    case "center":
                    case "align":
                    case "alignment":
                        bool Center = CMDV.ToLower() == "true";
                        DefaultInstance.TextAlignment = (Center ? ContentAlignment.MiddleCenter : ContentAlignment.MiddleLeft);
                        break;

                    case "hook text":
                    case "enable hook":
                    case "auto show":
                    case "auto hook":
                        HookText = true;
                        break;

                    case "call event":
                    case "call":
                    case "run event":
                    case "run":
                        TriggerEvent(uint.Parse(CMDV));
                        break;

                    case "call async":
                    case "async":
                    case "async invoke":
                    case "invoke async":
                        new Thread(() => { TriggerEvent(uint.Parse(CMDV)); }).Start();
                        break;

                    case "wait":
                    case "sleep":
                    case "delay":
                    case "suspend":
                        Thread.Sleep(int.Parse(CMDV));
                        break;

                    case "continue to event":
                    case "jump to event":
                    case "go to":
                    case "jump":
                        TriggerEvent(uint.Parse(CMDV));
                        return;

                    case "end event":
                    case "event end":
                    case "return":
                    case "die":
                        return;
                    }
                } catch (Exception ex) {
#if DEBUG
                    MessageBox.Show(ex.ToString());
#endif
                }
            }
        }
Example #15
0
 public void Pause()
 {
     DefaultInstance.Pause();
 }
Example #16
0
 public void Stop()
 {
     DefaultInstance.Stop();
 }
 public static ISetupOperation <TContract> FindDefaultService <TContract>() where TContract : class
 {
     return(DefaultInstance.FindService <TContract>());
 }
Example #18
0
 public void Reset3D()
 {
     DefaultInstance.Reset3D();
 }
Example #19
0
 public virtual AllowedQueryOptions?IgnoreQueryOptions(bool ordered)
 => DefaultInstance.IgnoreQueryOptions(ordered);