Ejemplo n.º 1
0
 private void AutoInjectToggler_CheckedChanged(object sender)
 {
     {
         bool flag = AutoInjectToggler.Checked == true;
         if (flag)
         {
             AutoInjection.Start();
             MessageBox.Show("Zer0 AutoInjection has been turned on." + "\n" + "Settings successfully Saved.", "AutoInjection turned on.", MessageBoxButtons.OK, MessageBoxIcon.Warning);
             TogglerLabel.Text = ("rodfpq");
         }
         else
         {
             AutoInjection.Stop();
             MessageBox.Show("Zer0 AutoInjection has been turned off." + "\n" + "Settings successfully Saved.", "AutoInjection turned off.", MessageBoxButtons.OK, MessageBoxIcon.Warning);
             TogglerLabel.Text = ("fkoesd");
         }
     }
 }
Ejemplo n.º 2
0
        private void Zer0UI_Load(object sender, EventArgs e)
        {
            //Timers Start
            TogglerLabel.Text  = Properties.Settings.Default.AutoInjToggler;
            TogglerLabel2.Text = Properties.Settings.Default.TopMostToggler;
            // Start of AutoInjection Toggle
            if (TogglerLabel.Text == "rodfpq")
            {
                AutoInjection.Start();
                AutoInjectToggler.Checked = true;
            }
            else
            {
                AutoInjection.Stop();
                AutoInjectToggler.Checked = false;
            }
            // End of AutoInjection Toggle
            // Start of TopMost Toggle
            if (TogglerLabel2.Text == "wrjiow")
            {
                TopMost = true;
                TopMostToggler.Checked = true;
            }
            else
            {
                TopMost = false;
                TopMostToggler.Checked = false;
            }
            // End of TopMost Toggle
            CheckForUpdates();
            Zer0CheckForUpdates();
            Zer0AutoRefresh.Start();
            AutoRefresh.Start();
            //Timers End
            //Bleu TextBox
            string Bleustr  = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
            string Bleustr2 = "0123456789";
            string Bleustr3 = "ŠšŒœŸÿÀàÁáÂâÃãÄäÅåÆæÇçÈèÉéÊêËëÌìÍíÎîÏïÐðÑñÒòÓóÔôÕõÖØøÙùÚúÛûÜüÝýÞþßö";

            this.BleuTextBox.StyleResetDefault();
            this.BleuTextBox.Styles[32].Font = "Consolas";
            this.BleuTextBox.Styles[32].Size = 10;
            this.BleuTextBox.StyleClearAll();
            this.BleuTextBox.Styles[0].ForeColor  = Color.Silver;
            this.BleuTextBox.Styles[1].ForeColor  = Color.FromArgb(0, 0, 127, 0);
            this.BleuTextBox.Styles[2].ForeColor  = Color.FromArgb(0, 0, 127, 0);
            this.BleuTextBox.Styles[4].ForeColor  = Color.FromArgb(0, 0, 127, 127);
            this.BleuTextBox.Styles[5].ForeColor  = Color.FromArgb(0, 0, 0, 127);
            this.BleuTextBox.Styles[13].ForeColor = Color.FromArgb(0, 255, 128, 0);
            this.BleuTextBox.Styles[14].ForeColor = Color.FromArgb(0, 255, 0, 0);
            this.BleuTextBox.Styles[15].ForeColor = Color.DarkSlateBlue;
            this.BleuTextBox.Styles[6].ForeColor  = Color.FromArgb(0, 127, 0, 127);
            this.BleuTextBox.Styles[7].ForeColor  = Color.FromArgb(0, 127, 0, 127);
            this.BleuTextBox.Styles[8].ForeColor  = Color.FromArgb(0, 127, 0, 127);
            this.BleuTextBox.Styles[10].ForeColor = Color.FromArgb(0, 127, 127, 127);
            this.BleuTextBox.Styles[9].ForeColor  = Color.Maroon;
            this.BleuTextBox.Lexer     = Lexer.Lua;
            this.BleuTextBox.WordChars = Bleustr + Bleustr2 + Bleustr3;
            this.BleuTextBox.SetKeywords(0, "info and break do else elseif end for function if in local nil not or repeat return then until while false true goto assert collectgarbage dofile _G getmetatable ipairs loadfile next pairs pcall print rawequal rawget rawset setmetatable tonumber tostring type _VERSION xpcall string table math coroutine io os debug getfenv gcinfo load loadlib loadstring require select setfenv unpack _LOADED LUA_PATH _REQUIREDNAME package rawlen package bit32 utf8 _ENV string.byte string.char string.dump string.find string.format string.gsub string.len string.lower string.rep string.sub string.upper table.concat table.insert table.remove table.sort math.abs math.acos math.asin math.atan math.atan2 math.ceil math.cos math.deg math.exp math.floor math.frexp math.ldexp math.log math.max math.min math.pi math.pow math.rad math.random math.randomseed math.sin math.sqrt math.tan string.gfind string.gmatch string.match string.reverse string.pack string.packsize string.unpack table.foreach table.foreachi table.getn table.setn table.maxn table.pack table.unpack table.move math.cosh math.fmod math.huge math.log10 math.modf math.mod math.sinh math.tanh math.maxinteger math.mininteger math.tointeger math.type math.ult bit32.arshift bit32.band bit32.bnot bit32.bor bit32.btest bit32.bxor bit32.extract bit32.replace bit32.lrotate bit32.lshift bit32.rrotate bit32.rshift utf8.char utf8.charpattern utf8.codes utf8.codepoint utf8.len utf8.offset coroutine.create coroutine.resume coroutine.status coroutine.wrap coroutine.yield io.close io.flush io.input io.lines io.open io.output io.read io.tmpfile io.type io.write io.stdin io.stdout io.stderr os.clock os.date os.difftime os.execute os.exit os.getenv os.remove os.rename os.setlocale os.time os.tmpname coroutine.isyieldable coroutine.running io.popen module package.loaders package.seeall package.config package.searchers package.searchpath require package.cpath package.loaded package.loadlib package.path package.preload wait");
            this.BleuTextBox.SetKeywords(1, "warn");
            this.BleuTextBox.SetKeywords(2, "error");
            this.BleuTextBox.SetKeywords(3, "");
            this.BleuTextBox.SetProperty("fold", "1");
            this.BleuTextBox.SetProperty("fold.compact", "1");
            this.BleuTextBox.Margins[1].Type      = MarginType.Symbol;
            this.BleuTextBox.Margins[1].Mask      = 4261412864u;
            this.BleuTextBox.Margins[1].Sensitive = true;
            this.BleuTextBox.Margins[1].Width     = 15;
            for (int i = 25; i <= 31; i++)
            {
                this.BleuTextBox.Markers[i].SetForeColor(SystemColors.ControlLightLight);
                this.BleuTextBox.Markers[i].SetBackColor(SystemColors.ControlDark);
            }
            this.BleuTextBox.Markers[30].Symbol = MarkerSymbol.BoxPlus;
            this.BleuTextBox.Markers[31].Symbol = MarkerSymbol.BoxMinus;
            this.BleuTextBox.Markers[25].Symbol = MarkerSymbol.BoxPlusConnected;
            this.BleuTextBox.Markers[27].Symbol = MarkerSymbol.TCorner;
            this.BleuTextBox.Markers[26].Symbol = MarkerSymbol.BoxMinusConnected;
            this.BleuTextBox.Markers[29].Symbol = MarkerSymbol.VLine;
            this.BleuTextBox.Markers[28].Symbol = MarkerSymbol.LCorner;
            this.BleuTextBox.AutomaticFold      = (AutomaticFold.Show | AutomaticFold.Click | AutomaticFold.Change);
            int Bleulength = this.BleuTextBox.Lines.Count.ToString().Length;

            BleuTextBox.Margins[0].Width = this.BleuTextBox.TextWidth(33, new string('9', Bleulength + 1)) + 2;
            // End Bleu TextBox
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Reads XML component definition from a stream and creates
        /// <see cref="IComponentInfo"/> and
        /// <see cref="IServiceInfo"/>-based
        /// objects from it.
        /// </summary>
        /// <param name="sourceStream">Source stream with XML definition data.</param>
        /// <param name="componentInfo">Receives a reference to an info object describing the component.</param>
        /// <param name="serviceInfos">Receives a reference to an array of service information objects.</param>
        /// <returns><c>True</c>, if the component information could be read successfully, <c>false</c> otherwise.</returns>
        public bool ReadComponentInfo(Stream sourceStream, out IComponentInfo componentInfo, out IServiceInfo[] serviceInfos)
        {
            ComponentInfo       tempCompInfo      = new ComponentInfo();
            List <IServiceInfo> servInfoTempArray = new List <IServiceInfo>();

            // We don't catch exceptions here, let the caller do that
            //try
            //{
            XmlSerializer serializer = new XmlSerializer(typeof(XmlStub.DefinitionRootType));

            XmlStub.DefinitionRootType compDef = (XmlStub.DefinitionRootType)serializer.Deserialize(sourceStream);

            tempCompInfo.Name           = compDef.name;
            tempCompInfo.DisplayName    = compDef.displayname;
            tempCompInfo.DisplayVersion = compDef.displayversion;
//			tempCompInfo.UpdaterURL = compDef.updaterurl;

            // Resource definitions
            if (compDef.resources != null)
            {
                if (compDef.resources.nontranslatedresource != null)
                {
                    XmlStub.ResourceType resource = compDef.resources.nontranslatedresource;
//					tempCompInfo.NonTranslatedResKey = resource.key;
//					tempCompInfo.NonTranslatedRes = resource.@namespace;
//					tempCompInfo.NonTranslatedPath = resource.path;
                }
                if (compDef.resources.translatedresource != null)
                {
                    XmlStub.ResourceType resource = compDef.resources.translatedresource;
//					tempCompInfo.TranslatedResKey = resource.key;
//					tempCompInfo.TranslatedRes = resource.@namespace;
                }
            }

            // Requirements
            if (compDef.requirements != null)
            {
                foreach (var req in compDef.requirements)
                {
                    ComponentRequirement compreq = new ComponentRequirement();
                    compreq.ComponentName = req.name;
                    compreq.Version       = new Version(req.version);
                    compreq.Condition     = this.GetConditionFromXml(req.@operator);
                }
            }

            // Compatibility information
            if (compDef.compatibility != null)
            {
                foreach (var comp in compDef.compatibility)
                {
                    ComponentRequirement compCompat = new ComponentRequirement();
                    compCompat.Version = new Version(comp.version);
                    if (comp.operatorSpecified)
                    {
                        compCompat.Condition = this.GetConditionFromXml(comp.@operator);
                    }
                    else
                    {
                        compCompat.Condition = Condition.Equal;
                    }
                }
            }

            // Assembly information
            if (compDef.assemblies != null)
            {
                List <string> partAssemblyNames = new List <string>();
                //foreach (var assemblyDef in compDef.assemblies)
                //{
                //  // Collect assembly full names
                //  if (assemblyDef.ismainSpecified && assemblyDef.ismain)
                //  {
                //    tempCompInfo.MainAssemblyFullName = Path.GetFileNameWithoutExtension(assemblyDef.file);
                //  }
                //  else
                //  {
                //    partAssemblyNames.Add(Path.GetFileNameWithoutExtension(assemblyDef.file));
                //  }
                //}

                foreach (var assemblyDef in compDef.assemblies)
                {
                    // Collect assembly full names
                    AssemblyName assemblyName     = null;
                    string       assemblyFullName = String.Empty;
                    try
                    {
                        assemblyName     = AssemblyName.GetAssemblyName(assemblyDef.file);
                        assemblyFullName = assemblyName.Name;
                    }
                    catch (Exception)
                    {
                        _logger.Error("NQComponentInfoSerializer: Assembly " + assemblyDef + " not found or not accessible.");
                        continue;
                    }

                    if (assemblyDef.ismainSpecified && assemblyDef.ismain)
                    {
                        tempCompInfo.MainAssemblyFullName = assemblyFullName;
                    }
                    else
                    {
                        partAssemblyNames.Add(assemblyFullName);
                    }

                    foreach (var serviceDef in assemblyDef.services)
                    {
                        ServiceInfo servInfo = new ServiceInfo();
                        servInfo.ServiceInterfaceName = serviceDef.name;
                        servInfo.ServiceTypeName      = serviceDef.@class;
                        servInfo.ParentComponent      = tempCompInfo.Name;
                        // TODO How to handle this in future?
//						if (serviceDef.categorySpecified)
//						{
//							servInfo.ServiceCategory = this.GetHostModeFromXml(serviceDef.category);
//						}
//						else
//						{
//							servInfo.ServiceCategory = HostMode.General;
//						}
                        // TODO How to handle this in future?
//						servInfo.SingleInstance = (serviceDef.singleinstanceSpecified && serviceDef.singleinstance);

                        // Read invokable service settings
                        // TODO How to handle this in future?
//						servInfo.InvokeMethodName = serviceDef.invokemethod;
//						servInfo.QuitMethodName = serviceDef.quitmethod;

                        // Handle substitutes
                        if (serviceDef.substitutions != null)
                        {
                            servInfo.SubstituteNames = serviceDef.substitutions;
                        }

                        // Handle AttachLists
                        if (serviceDef.attachedto != null)
                        {
                            servInfo.MemberOfLists = serviceDef.attachedto;
                        }

                        // Handle requirements
                        if (serviceDef.requirements != null)
                        {
                            foreach (var req in serviceDef.requirements)
                            {
                                ComponentRequirement compreq = new ComponentRequirement();
                                compreq.ComponentName = req.name;
                                compreq.Version       = new Version(req.version);
                                compreq.Condition     = this.GetConditionFromXml(req.@operator);
                            }
                        }

                        // Handle auto-injection
                        if (serviceDef.autoinjection != null)
                        {
                            var autoInjectionDefCollection = serviceDef.autoinjection;
                            if (autoInjectionDefCollection.Items != null)
                            {
                                List <IAutoInjection> autoInjections = new List <IAutoInjection>();

                                for (int i = 0; i < autoInjectionDefCollection.Items.Length; i++)
                                {
                                    var           autoInjectionDef = autoInjectionDefCollection.Items[i];
                                    AutoInjection autoInjection    = new AutoInjection();

                                    // Injection source depends on the name of the XML element (<list> or <service>)
                                    if (autoInjectionDefCollection.ItemsElementName[i] == XmlStub.ItemsChoiceType.list)
                                    {
                                        autoInjection.InjectFromAttachList = true;
                                        autoInjection.BoundAttachList      = autoInjectionDef.name;
                                    }
                                    else
                                    {
                                        autoInjection.InjectFromAttachList = false;
                                        autoInjection.BoundServiceName     = autoInjectionDef.name;
                                    }

                                    autoInjection.InjectAsDependent    = (autoInjectionDef.asdependentSpecified && autoInjectionDef.asdependent);
                                    autoInjection.Overridable          = (autoInjectionDef.overridableSpecified && autoInjectionDef.overridable);
                                    autoInjection.ServiceInterfaceName = autoInjectionDef.type;

                                    autoInjections.Add(autoInjection);
                                }

                                servInfo.AutoInjections = servInfo.AutoInjections;
                            }
                        }

                        servInfoTempArray.Add(servInfo);
                    }
                }

                if (partAssemblyNames.Count > 0)
                {
                    tempCompInfo.PartAssembliesFullNames = new string[partAssemblyNames.Count];
                    partAssemblyNames.CopyTo(tempCompInfo.PartAssembliesFullNames);
                }
            }

            componentInfo = tempCompInfo;
            serviceInfos  = new IServiceInfo[servInfoTempArray.Count];
            servInfoTempArray.CopyTo(serviceInfos);
            return(true);
            //}
            //catch (Exception)
            //{
            //  // Component information could not be retrieved from stream
            //  componentInfo = null;
            //  serviceInfos = null;
            //  return false;
            //}
        }