public void Setup()
        {
            _input = Id switch
            {
                0 => @"abc",
                1 => @"100- this is a line of ftp response which contains a message string",
                2 => @"1234-5678-1234-456",
                3 => @"*****@*****.**",
                4 => @"*****@*****.**",
                5 => @"*****@*****.**",
                6 => @"EH10 2QQ",
                7 => @"G1 1AA",
                8 => @"SW1 1ZZ",
                9 => @"4/1/2001",
                10 => @"12/12/2001",
                11 => @"123",
                12 => @"+3.14159",
                _ => @"-3.14159",
            };

            _regex = new Regex(Id switch
            {
                0 => @"abc",
                1 => @"^([0-9]+)(\-| |$)(.*)$",
                2 => @"(\d{4}[- ]){3}\d{3,4}",
                3 or 4 or 5 => @"^([a-zA-Z0-9_\-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([a-zA-Z0-9\-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$",
                6 or 7 or 8 => @"^[a-zA-Z]{1,2}[0-9][0-9A-Za-z]{0,1} {0,1}[0-9][A-Za-z]{2}$",
                9 or 10 => @"^\d{1,2}/\d{1,2}/\d{4}$",
                11 or 12 or _ => @"^[-+]?\d*\.?\d*$",
            }, Options);
Example #2
0
 /// <summary>
 /// Returns an ItemType from a string. Allows for aliases.
 /// </summary>
 /// <param name="s">String</param>
 /// <returns>Corresponding ItemType. Default ItemType.Beverage.</returns>
 public static ItemType FromString(string s)
 {
     return(s.ToUpper() switch
     {
         "FOOD" => ItemType.Food,
         "BEVERAGE" or _ => ItemType.Beverage
     });
Example #3
0
        /// <summary>
        /// Reduces the installer type to its most generic type.
        /// </summary>
        /// <returns>
        /// <see cref="InstallerType.Msix"/> for Windows App Packages,
        /// <see cref="InstallerType.Win32"/> for traditional Win32 installers,
        /// <see cref="InstallerType.Unknown"/> for everything else.
        /// </returns>
        public static InstallerType Reduce(this InstallerType type)
        {
            uint genericId = (uint)type >> 28;

            return(genericId switch
            {
                ((uint)InstallerType.Msix >> 28) => InstallerType.Msix,
                ((uint)InstallerType.Win32 >> 28) => InstallerType.Win32,

                0 or _ => InstallerType.Unknown
            });
Example #4
0
 internal TimestampElement(Timestamp timestamp) : base(timestamp)
 {
     this.DefaultStyleKey = typeof(TimestampElement);
     Text = timestamp.Format switch
     {
         "F" or "" => timestamp.Time.ToString("F"),
         "D" => timestamp.Time.ToString("d MMMM yyyy"),
         "T" => timestamp.Time.ToString("T"),
         "d" => timestamp.Time.ToString("d"),
         "f" => timestamp.Time.ToString("MMMM yyyy HH:mm"),
         "t" => timestamp.Time.ToString("t"),
         "R" or _ => timestamp.Time.Humanize(),
     };
 }
        public async Task <StarfleetBoardingAddressBalanceModel[]> GetAll([FromQuery] int _limit,
                                                                          [FromQuery] int _page,
                                                                          [FromQuery] string _sort,
                                                                          [FromQuery] string _order,
                                                                          [FromQuery] string Address_like)
        {
            _page--;

            await using (var connection = new MySqlConnection(OTHubSettings.Instance.MariaDB.ConnectionString))
            {
                string orderBy = String.Empty;

                switch (_sort)
                {
                case "Address":
                    orderBy = "ORDER BY Address";
                    break;
                    break;
                }

                if (!String.IsNullOrWhiteSpace(orderBy))
                {
                    switch (_order)
                    {
                    case "ASC":
                        orderBy += " ASC";
                        break;

                    case "DESC":
                        orderBy += " DESC";
                        break;
                    }
                }

                string limitSql = string.Empty;

                if (_page >= 0 && _limit >= 0)
                {
                    limitSql = $"LIMIT {_page * _limit},{_limit}";
                }

                HttpContext.Response.Headers["access-control-expose-headers"] = "X-Total-Count";
                HttpContext.Response.Headers["X-Total-Count"] = connection.ExecuteScalar <int>(
                    @$ "SELECT 
COUNT(DISTINCT Address)
FROM xdaibounty WHERE @address is null or Address = @address", new
                {
                    address = Address_like
                }).ToString();
Example #6
0
 static void Main(string[] args)
 {
         Random random = new Random()
         int y = 0;
         int x = random.Next(10);
         string userinput = "";
         do
         {
             Console.WriteLine("Ingresa el numero");
             userinput = Console.ReadLine();
         }
         while (x != int.Parse(userinput) or y = 3);
         Console.WriteLine("Adivinaste");
             y++;
     }
Example #7
0
        private async void StartButton_Click(object sender, RoutedEventArgs e)
        {
            Dispatcher?.Invoke(() =>
            {
                StartButton.IsEnabled = false;
                StopButton.IsEnabled  = true;
                OutputTextBox.Text   += $"{DateTime.Now:h:mm:ss.fff} Started {Environment.NewLine}";
            });

            try
            {
                using var recorder   = new NAudioRecorder();
                using var recognizer = RecognizerComboBox.Text switch
                      {
                          nameof(YandexRecognizer) => new YandexRecognizer
                          {
                              OAuthToken = OAuthTokenTextBox.Text,
                              FolderId   = FolderIdTextBox.Text,
                              Lang       = "ru-RU",
                          },
                          nameof(WitAiRecognizer) or _ => (IRecognizer) new WitAiRecognizer
                          {
                              Token = !string.IsNullOrWhiteSpace(OAuthTokenTextBox.Text)
                            ? OAuthTokenTextBox.Text
                            : "KATWBG4RQCFNBLQTY6QQUKB2SH6EIELG",
                          },
                      };
                var exceptions = new ExceptionsBag();
                exceptions.ExceptionOccurred += (_, exception) => OnException(exception);

                Recognition = await recognizer.StartStreamingRecognitionAsync(recorder, exceptions).ConfigureAwait(false);

                Recognition.PreviewReceived += (_, value) => Dispatcher?.Invoke(() =>
                {
                    OutputTextBox.Text += $"{DateTime.Now:h:mm:ss.fff} Preview: {value}{Environment.NewLine}";
                });
                Recognition.Stopped += (_, value) => Dispatcher?.Invoke(() =>
                {
                    OutputTextBox.Text += $"{DateTime.Now:h:mm:ss.fff} Final: {value}{Environment.NewLine}";
                });
            }
            catch (Exception exception)
            {
                OnException(exception);
            }
        }
Example #8
0
        public void TestMethod16()
        {
            // testing or

            RegisterFile <Vector4> vRF = new RegisterFile <Vector4>(32);
            RegisterFile <Scalar>  sRF = new RegisterFile <Scalar>(32);
            Memory           m         = new Memory(5000);
            Memory           m_ic      = new Memory(5000);
            IntersectionCore ic        = new IntersectionCore(m_ic);



            sRF[1] = 10;
            sRF[2] = 9;
            or o = new or(0, 1, 2);



            o.Process(vRF, sRF, m, ic);

            Assert.AreEqual <int>(11, sRF[0].i);
        }
Example #9
0
        private static async Task <ISymbol?> GetSelectedSymbolAsync(TextSpan textSpan, Document document, CancellationToken cancellationToken)
        {
            var root = await document.GetRequiredSyntaxRootAsync(cancellationToken).ConfigureAwait(false);

            var selectedNode = root.FindNode(textSpan);

            if (selectedNode is null)
            {
                return(null);
            }

            var semanticModel = await document.GetRequiredSemanticModelAsync(cancellationToken).ConfigureAwait(false);

            var selectedSymbol =
                semanticModel.GetSymbolInfo(selectedNode, cancellationToken).Symbol
                ?? semanticModel.GetDeclaredSymbol(selectedNode, cancellationToken);

            if (selectedSymbol is null)
            {
                return(null);
            }

            return(selectedSymbol switch
            {
                ILocalSymbol
                or IPropertySymbol {
                    SetMethod : not null
                }
                or IFieldSymbol {
                    IsReadOnly : false
                }
                or IEventSymbol
                or IParameterSymbol
                => selectedSymbol,

                _ => null
            });
Example #10
0
        internal UserSettings(JsonUserSettings jsonUserSettings, QuarrelClient context) :
            base(context)
        {
            GuildOrder            = jsonUserSettings.GuildOrder;
            IsDeveloperMode       = jsonUserSettings.DeveloperMode;
            RenderReactions       = jsonUserSettings.RenderReactions;
            RenderEmbeds          = jsonUserSettings.RenderEmbeds;
            InlineEmbedMedia      = jsonUserSettings.InlineEmbedMedia;
            InlineAttachmentMedia = jsonUserSettings.InlineAttachementMedia;
            Locale             = jsonUserSettings.Locale;
            ShowCurrentGame    = jsonUserSettings.ShowCurrentGame;
            ContentFilterLevel = jsonUserSettings.ExplicitContentFilter;
            RestrictedGuilds   = jsonUserSettings.RestrictedGuilds;

            Status = jsonUserSettings.Status switch
            {
                "online" => UserStatus.Online,
                "idle" => UserStatus.Idle,
                "afk" => UserStatus.AFK,
                "dnd" => UserStatus.DoNotDisturb,
                "invisible" => UserStatus.Invisible,
                "offline" or _ => UserStatus.Offline,
            };

            Theme = jsonUserSettings.Theme switch
            {
                "light" => Theme.Light,
                "dark" or _ => Theme.Dark,
            };

            Folders = new GuildFolder[jsonUserSettings.GuildFolders.Length];
            for (int i = 0; i < jsonUserSettings.GuildFolders.Length; i++)
            {
                Folders[i] = new GuildFolder(jsonUserSettings.GuildFolders[i], context);
            }
        }
Example #11
0
 Improved error reporting now lets you set the message level so you can go from quiet to verbose to find out what's going on (or wrong) 
Example #12
0
 public SelectList(or some IEnumerable) DeliveryRun_Id
 If a single space delimits the control word, the space does not appear in the document(it’s ignored).Any characters following the single space delimiter, including any subsequent spaces, will appear as text or spaces in the document.For this reason, you should use spaces only where necessary.It is recommended to avoid spaces as a means of breaking up RTF syntax to make it easier to read.You can use paragraph marks(CR, LF, or CRLF) to break up lines without changing the meaning except in destinations that contain \ binN.
Example #14
0
 Important: The moment you call AddJob (or AddJobFromOtherThreads), you hand over the job item to the scheduler and you should no longer touch any of the data inside the job item until IsDataReady turns true. Usually you would use one of the callbacks to further process the jobitem on the main thread once it's finished.This can be implemented directly inside the JobItem by overriding "OnFinished", or in a more general manner by subscribing to the "OnJobFinished" event in the JobQueue.Those callbacks will be invoked from inside the Update method.So as long as Update is only called from the main thread those callbacks will always be executed on the main thread.
Example #15
0
	go doc json.Number.Int64 (or go doc json.number.int64)
Example #16
0
	go doc json.Number (or go doc json.number)
Example #17
0
to standard output, describing each downloaded module(or failure),
        internal AIMLTagHandler GetTagHandlerU(User user, SubQuery query, Request request, Result result, XmlNode node, bool liText)
        {
            AIMLTagHandler tagHandlerU   = getBespokeTags(user, query, request, result, node);
            string         nodeNameLower = StaticAIMLUtils.ToLower(node.LocalName);
            AltBot         targetBot     = query.TargetBot;

            if (Equals(null, tagHandlerU))
            {
                switch (nodeNameLower)
                {
                case "template":
                case "answer":     //CML
                    tagHandlerU = new template(targetBot, user, query, request, result, node);
                    break;

                case "aiml":
                case "cml":     //CML
                    tagHandlerU = new aiml(targetBot, user, query, request, result, node);
                    break;

                case "aimlexec":
                case "eval":
                    tagHandlerU = new aimlexec(targetBot, user, query, request, result, node);
                    break;

                case "vars":
                case "root":
                case "predicates":     //CML
                    tagHandlerU = new root(targetBot, user, query, request, result, node, (() => query.TargetSettings));
                    break;

                case "properties":
                case "bots":
                    tagHandlerU = new root(targetBot, user, query, request, result, node,
                                           (() => request.TargetBot.GlobalSettings));
                    break;

                case "substitutions":
                    tagHandlerU = new root(targetBot, user, query, request, result, node,
                                           (() => request.TargetBot.InputSubstitutions));
                    break;

                case "topic":
                case "conversation":     //CML
                    tagHandlerU = new topic(targetBot, user, query, request, result, node);
                    break;

                case "category":
                case "conv":     //CML
                    tagHandlerU = new category(targetBot, user, query, request, result, node);
                    break;

                case "and":
                    tagHandlerU = new and(targetBot, user, query, request, result, node);
                    break;

                case "or":
                    tagHandlerU = new or(targetBot, user, query, request, result, node);
                    break;

                case "optional":
                    tagHandlerU = new optional(targetBot, user, query, request, result, node);
                    break;

                case "isa":
                    tagHandlerU = new isa(targetBot, user, query, request, result, node);
                    break;

                case "bot":
                    tagHandlerU = new bot(targetBot, user, query, request, result, node);
                    break;

                case "condition":
                case "options":     //cml
                    tagHandlerU = new condition_aima(targetBot, user, query, request, result, node);
                    break;

                case "li":
                    if (liText)
                    {
                        tagHandlerU = new liif(targetBot, user, query, request, result, node);
                    }
                    break;

                case "if":
                    tagHandlerU = new liif(targetBot, user, query, request, result, node);
                    break;

                case "personf":
                    tagHandlerU = new format(targetBot, user, query, request, result, node,
                                             new Func <string, string>(HttpUtility.UrlEncode),
                                             null);
                    break;

                case "date":
                    tagHandlerU = new date(targetBot, user, query, request, result, node);
                    break;

                case "formal":
                    tagHandlerU = new formal(targetBot, user, query, request, result, node);
                    break;

                case "gender":
                    tagHandlerU = new gender(targetBot, user, query, request, result, node);
                    break;

                case "get":
                    tagHandlerU = new get(targetBot, user, query, request, result, node);
                    break;

                case "gossip":
                    tagHandlerU = new gossip(targetBot, user, query, request, result, node);
                    break;

                case "get_ip":
                case "id":
                    tagHandlerU = new id(targetBot, user, query, request, result, node);
                    break;

                case "inputreq":
                    tagHandlerU = new inputreq(targetBot, user, query, request, result, node);
                    break;

                case "request":
                    tagHandlerU = new input(targetBot, user, query, request, result, node, 1);
                    break;

                case "input":
                    tagHandlerU = new input(targetBot, user, query, request, result, node, 1);
                    break;

                case "justthat":     // <input index="2"/>
                    tagHandlerU = new input(targetBot, user, query, request, result, node, 2);
                    break;

                case "beforethat":     // <input index="3"/>
                    tagHandlerU = new input(targetBot, user, query, request, result, node, 3);
                    break;

#if !(__MonoCS__)
                case "javascript":
                    tagHandlerU = new javascript(targetBot, user, query, request, result, node);
                    break;
#endif
                case "learn":
                case "load":
                case "noload":     // the commented version of <load>
                    tagHandlerU = new learn(targetBot, user, query, request, result, node);
                    break;

                case "lowercase":
                    tagHandlerU = new lowercase(targetBot, user, query, request, result, node);
                    break;

                case "person":
                    tagHandlerU = new substitute(targetBot, user, query, request, result, node);
                    break;

                case "person2":
                    tagHandlerU = new substitute(targetBot, user, query, request, result, node);
                    break;

                case "random":
                    tagHandlerU = new random(targetBot, user, query, request, result, node);
                    break;

                case "sentence":
                    tagHandlerU = new sentence(targetBot, user, query, request, result, node);
                    break;

                case "set":
                    tagHandlerU = new set(targetBot, user, query, request, result, node);
                    break;

                case "size":
                case "getsize":
                    tagHandlerU = new size(targetBot, user, query, request, result, node);
                    break;

                case "sr":
                    tagHandlerU = new sr(targetBot, user, query, request, result, node);
                    break;

                case "srai_odd":
                    tagHandlerU = new srai_odd(targetBot, user, query, request, result, node);
                    break;

                case "star":
                    tagHandlerU = new star(targetBot, user, query, request, result, node);
                    break;

                case "system":
                    tagHandlerU = new system(targetBot, user, query, request, result, node);
                    break;

                case "that":     //default <that index="1,1"/>
                    tagHandlerU = new that(targetBot, user, query, request, result, node, 1);
                    break;

                case "justbeforethat":     //treated as <that index="2,1"/>
                    tagHandlerU = new that(targetBot, user, query, request, result, node, 2);
                    break;

                case "response":     //treated as <that index="1,1"/>
                    tagHandlerU = new that(targetBot, user, query, request, result, node, 2);
                    break;

                case "thatstar":
                    tagHandlerU = new thatstar(targetBot, user, query, request, result, node);
                    break;

                case "think":
                    tagHandlerU = new think(targetBot, user, query, request, result, node);
                    break;

                case "topicstar":
                    tagHandlerU = new topicstar(targetBot, user, query, request, result, node);
                    break;

                case "uppercase":
                    tagHandlerU = new uppercase(targetBot, user, query, request, result, node);
                    break;

                case "version":
                case "getversion":
                    tagHandlerU = new version(targetBot, user, query, request, result, node);
                    break;

                case "cycsystem":
                    tagHandlerU = new cycsystem(targetBot, user, query, request, result, node);
                    break;

                case "cycretract":
                    tagHandlerU = new cycretract(targetBot, user, query, request, result, node);
                    break;

                case "cycassert":
                    tagHandlerU = new cycassert(targetBot, user, query, request, result, node);
                    break;

                case "cycterm":
                    tagHandlerU = new cycterm(targetBot, user, query, request, result, node);
                    break;

                case "cycquery":
                    tagHandlerU = new cycquery(targetBot, user, query, request, result, node);
                    break;

                case "cyccondition":
                    tagHandlerU = new cyccondition(targetBot, user, query, request, result, node);
                    break;

                case "cycphrase":
                    tagHandlerU = new cycphrase(targetBot, user, query, request, result, node);
                    break;

                case "cycparaphrase":
                    tagHandlerU = new cycphrase(targetBot, user, query, request, result, node);
                    break;

                case "guard":
                    tagHandlerU = new guard(targetBot, user, query, request, result, node);
                    break;

                case "guardstar":
                    tagHandlerU = new guardstar(targetBot, user, query, request, result, node);
                    break;

                case "cycrandom":
                    tagHandlerU = new cycrandom(targetBot, user, query, request, result, node);
                    break;

                case "tscore":
                    tagHandlerU = new tscore(targetBot, user, query, request, result, node);
                    break;

                case "space":
                    tagHandlerU = new space(targetBot, user, query, request, result, node);
                    break;

                case "markov":
                    tagHandlerU = new markov(targetBot, user, query, request, result, node);
                    break;

                case "soundcode":
                    tagHandlerU = new soundcode(targetBot, user, query, request, result, node);
                    break;

                // MSM
                case "msm":
                    tagHandlerU = new msm(targetBot, user, query, request, result, node);
                    break;

                case "processmsm":
                    tagHandlerU = new process_msm(targetBot, user, query, request, result, node);
                    break;

                case "setstate":
                    tagHandlerU = new setstate(targetBot, user, query, request, result, node);
                    break;

                case "state":
                    tagHandlerU = new state(targetBot, user, query, request, result, node);
                    break;

                case "transition":
                    tagHandlerU = new transition(targetBot, user, query, request, result, node);
                    break;

                case "setevidence":
                    tagHandlerU = new setevidence(targetBot, user, query, request, result, node);
                    break;

                case "evidenceassoc":
                    tagHandlerU = new evidence_assoc(targetBot, user, query, request, result, node);
                    break;

                case "evidencepattern":
                    tagHandlerU = new evidence_pattern(targetBot, user, query, request, result, node);
                    break;

                case "evidencestate":
                    tagHandlerU = new evidencestate(targetBot, user, query, request, result, node);
                    break;

                case "dependentmachine":
                    tagHandlerU = new dependentmachine(targetBot, user, query, request, result, node);
                    break;

                case "responsetopic":
                    tagHandlerU = new response_topic(targetBot, user, query, request, result, node);
                    break;

                case "push":
                    tagHandlerU = new push(targetBot, user, query, request, result, node);
                    break;

                case "pop":
                    tagHandlerU = new pop(targetBot, user, query, request, result, node);
                    break;

                case "peekstack":
                    tagHandlerU = new peekstack(targetBot, user, query, request, result, node);
                    break;

                case "lex":
                    tagHandlerU = new lex(targetBot, user, query, request, result, node);
                    break;

                case "lexset":
                    tagHandlerU = new lexset(targetBot, user, query, request, result, node);
                    break;

                case "lexis":
                    tagHandlerU = new lexis(targetBot, user, query, request, result, node);
                    break;

                case "dbpush":
                    tagHandlerU = new dbpush(targetBot, user, query, request, result, node);
                    break;

                case "dbquery":
                    tagHandlerU = new dbquery(targetBot, user, query, request, result, node);
                    break;

                case "dbupdate":
                    tagHandlerU = new dbupdate(targetBot, user, query, request, result, node);
                    break;

                case "dbdelete":
                    tagHandlerU = new dbdelete(targetBot, user, query, request, result, node);
                    break;

                case "dbload":
                    tagHandlerU = new dbload(targetBot, user, query, request, result, node);
                    break;


                case "regex":
                    tagHandlerU = new regex(targetBot, user, query, request, result, node);
                    break;

                case "bind":     // <bind>#$isa</bind>
                    tagHandlerU = new bind(targetBot, user, query, request, result, node);
                    break;

                case "#text":
                    if (!liText)
                    {
                        return(null);
                    }
                    return(new verbatum(node.Value, targetBot, user, query, request, result, node));

                case "#comment":
                    return(new verbatum(node.OuterXml, targetBot, user, query, request, result, node));

                case "br":
                    return(new verbatum("\n", targetBot, user, query, request, result, node));

                case "pre":
                    return(new verbatum(StaticXMLUtils.InnerXmlText(node), targetBot, user, query, request, result, node));

                case "p":
                    return(new verbatum("\n\n", targetBot, user, query, request, result, node));

                case "meta":
                    return(new verbatum(node.OuterXml, targetBot, user, query, request, result, node));

                default:
                    break;
                }
            }
            if (tagHandlerU != null)
            {
                return(tagHandlerU);
            }
            if (StaticAIMLUtils.IsHtmlTag(node.Name))
            {
                return(new recursiveVerbatum(node, targetBot, user, query, request, result, node, true));
            }
            if (tagHandlerU == null)
            {
                // "bot", "favorite", "fav"
                foreach (KeyValuePair <string, string> prefix in new[]
                {
                    new KeyValuePair <string, string>("get_", "get"),
                    new KeyValuePair <string, string>("set_", "set"),
                    new KeyValuePair <string, string>("bot_", "bot"),
                    new KeyValuePair <string, string>("favorite_", "bot"),
                    new KeyValuePair <string, string>("favorite", "bot"),
                    new KeyValuePair <string, string>("fav_", "bot"),
                    new KeyValuePair <string, string>("fav", "bot"),

                    new KeyValuePair <string, string>("get", "get"),
                    new KeyValuePair <string, string>("set", "set"),
                    new KeyValuePair <string, string>("bot", "bot"),
                })
                {
                    if (nodeNameLower.StartsWith(prefix.Key) && node.Name.Length > prefix.Key.Length)
                    {
                        string               name    = node.Name.Substring(prefix.Key.Length);
                        XmlNode              pn      = node.ParentNode;
                        LineInfoElementImpl  newnode = StaticXMLUtils.CopyNode(prefix.Value, node, false);
                        XmlAttributeLineInfo atr     = (XmlAttributeLineInfo)newnode.OwnerDocument.CreateAttribute("name");
                        atr.ReadOnly = false;
                        atr.Value    = name;
                        newnode.Attributes.Append(atr);
                        if (node.Name.ToLower() != newnode.Name.ToLower())
                        {
                            writeToLog("AIMLLOADER: converted " + node.OuterXml + " -> " + newnode.OuterXml);
                            return(targetBot.GetTagHandler(newnode, query, request, result, user, liText));
                        }
                        writeToLog("AIMLLOADER: ! convert " + node.OuterXml + " -> " + newnode.OuterXml);
                    }
                }
            }
            if (tagHandlerU != null)
            {
                return(tagHandlerU);
            }
            if (nodeNameLower == "name")
            {
                return(new bot(targetBot, user, query, request, result, node));
            }

            tagHandlerU = new lazyClosure(targetBot, user, query, request, result, node);
            writeToLog("AIMLLOADER:  lazyClosure: " + node.OuterXml);
            return(tagHandlerU);
        }
Example #19
0
        public void TestMethod33()
        {
            // ToString test
            and and = new and(1, 2, 3);

            Assert.AreEqual("and r1 r2 r3", and.ToString());
            bne bne = new bne(1);

            Assert.AreEqual("bne 1", bne.ToString());
            bg bg = new bg(1);

            Assert.AreEqual("bg 1", bg.ToString());
            bl bl = new bl(1);

            Assert.AreEqual("bl 1", bl.ToString());
            bge_rt bge_rt = new bge_rt(1);

            Assert.AreEqual("bge_rt 1", bge_rt.ToString());
            ble_rt ble_rt = new ble_rt(1);

            Assert.AreEqual("ble_rt 1", ble_rt.ToString());
            cmp_i cmpi = new cmp_i(1, 2);

            Assert.AreEqual("cmp_i r1 r2", cmpi.ToString());
            cmp_f cmpf = new cmp_f(1, 2);

            Assert.AreEqual("cmp_f r1 r2", cmpf.ToString());
            cmp_v cmpv = new cmp_v(1, 2);

            Assert.AreEqual("cmp_v r1 r2", cmpv.ToString());
            ff_add ff_add = new ff_add(1, 2, 3);

            Assert.AreEqual("ff_add r1 r2 r3", ff_add.ToString());
            ff_sub ff_sub = new ff_sub(1, 2, 3);

            Assert.AreEqual("ff_sub r1 r2 r3", ff_sub.ToString());
            ff_mul ff_mul = new ff_mul(1, 2, 3);

            Assert.AreEqual("ff_mul r1 r2 r3", ff_mul.ToString());
            ff_div ff_div = new ff_div(1, 2, 3);

            Assert.AreEqual("ff_div r1 r2 r3", ff_div.ToString());
            fin fin = new fin();

            Assert.AreEqual("fin", fin.ToString());
            ftoi ftoi = new ftoi(1, 2);

            Assert.AreEqual("ftoi r1 r2", ftoi.ToString());
            ii_add ii_add = new ii_add(1, 2, 3);

            Assert.AreEqual("ii_add r1 r2 r3", ii_add.ToString());
            ii_addi ii_addi = new ii_addi(1, 2, 3);

            Assert.AreEqual("ii_addi r1 r2 3", ii_addi.ToString());
            ii_sub ii_sub = new ii_sub(1, 2, 3);

            Assert.AreEqual("ii_sub r1 r2 r3", ii_sub.ToString());
            ii_subi ii_subi = new ii_subi(1, 2, 3);

            Assert.AreEqual("ii_subi r1 r2 3", ii_subi.ToString());
            ii_mul ii_mul = new ii_mul(1, 2, 3);

            Assert.AreEqual("ii_mul r1 r2 r3", ii_mul.ToString());
            ii_muli ii_muli = new ii_muli(1, 2, 3);

            Assert.AreEqual("ii_muli r1 r2 3", ii_muli.ToString());
            ii_div ii_div = new ii_div(1, 2, 3);

            Assert.AreEqual("ii_div r1 r2 r3", ii_div.ToString());
            ii_divi ii_divi = new ii_divi(1, 2, 3);

            Assert.AreEqual("ii_divi r1 r2 3", ii_divi.ToString());
            itof itof = new itof(1, 2);

            Assert.AreEqual("itof r1 r2", itof.ToString());
            real_jmp real_jmp = new real_jmp(1);

            Assert.AreEqual("real_jmp 1", real_jmp.ToString());
            jmp_link jmp_link = new jmp_link(1);

            Assert.AreEqual("jmp_link 1", jmp_link.ToString());
            not not = new not(1, 2);

            Assert.AreEqual("not r1 r2", not.ToString());
            or or = new or(1, 2, 3);

            Assert.AreEqual("or r1 r2 r3", or.ToString());
            ret ret = new ret();

            Assert.AreEqual("ret", ret.ToString());
            s_get_from_v sgfv = new s_get_from_v(1, 2, 3);

            Assert.AreEqual("s_get_from_v r1 r2 3", sgfv.ToString());
            s_load_4byte sl4b = new s_load_4byte(1, 2, 3);

            Assert.AreEqual("s_load_4byte r1 r2 3", sl4b.ToString());
            s_store_4byte ss4b = new s_store_4byte(1, 2, 3);

            Assert.AreEqual("s_store_4byte r1 r2 3", ss4b.ToString());
            s_write_high swh = new s_write_high(1, 5);

            Assert.AreEqual("s_write_high r1 5", swh.ToString());
            s_write_low swl = new s_write_low(1, 5);

            Assert.AreEqual("s_write_low r1 5", swl.ToString());
            s_push s_push = new s_push(1);

            Assert.AreEqual("s_push r1", s_push.ToString());
            s_pop s_pop = new s_pop(1);

            Assert.AreEqual("s_pop r1", s_pop.ToString());
            v_push v_push = new v_push(1);

            Assert.AreEqual("v_push r1", v_push.ToString());
            v_pop v_pop = new v_pop(1);

            Assert.AreEqual("v_pop r1", v_pop.ToString());
            v_get_from_s vgfs = new v_get_from_s(1, 2, 3);

            Assert.AreEqual("v_get_from_s r1 r2 3", vgfs.ToString());
            v_load_16byte vl16 = new v_load_16byte(1, 2, 3);

            Assert.AreEqual("v_load_16byte r1 r2 3", vl16.ToString());
            v_magn v_magn = new v_magn(1, 2);

            Assert.AreEqual("v_magn r1 r2", v_magn.ToString());
            v_store_16byte vs16 = new v_store_16byte(1, 2, 3);

            Assert.AreEqual("v_store_16byte r1 r2 3", vs16.ToString());
            vf_add vf_add = new vf_add(1, 2, 3);

            Assert.AreEqual("vf_add r1 r2 r3", vf_add.ToString());
            vf_sub vf_sub = new vf_sub(1, 2, 3);

            Assert.AreEqual("vf_sub r1 r2 r3", vf_sub.ToString());
            vf_mul vf_mul = new vf_mul(1, 2, 3);

            Assert.AreEqual("vf_mul r1 r2 r3", vf_mul.ToString());
            vf_div vf_div = new vf_div(1, 2, 3);

            Assert.AreEqual("vf_div r1 r2 r3", vf_div.ToString());
            vi_add vi_add = new vi_add(1, 2, 3);

            Assert.AreEqual("vi_add r1 r2 r3", vi_add.ToString());
            vi_sub vi_sub = new vi_sub(1, 2, 3);

            Assert.AreEqual("vi_sub r1 r2 r3", vi_sub.ToString());
            vi_mul vi_mul = new vi_mul(1, 2, 3);

            Assert.AreEqual("vi_mul r1 r2 r3", vi_mul.ToString());
            vi_div vi_div = new vi_div(1, 2, 3);

            Assert.AreEqual("vi_div r1 r2 r3", vi_div.ToString());
            vv_add vv_add = new vv_add(1, 2, 3);

            Assert.AreEqual("vv_add r1 r2 r3", vv_add.ToString());
            vv_sub vv_sub = new vv_sub(1, 2, 3);

            Assert.AreEqual("vv_sub r1 r2 r3", vv_sub.ToString());
            vv_mul_ele vv_mul_ele = new vv_mul_ele(1, 2, 3);

            Assert.AreEqual("vv_mul_ele r1 r2 r3", vv_mul_ele.ToString());
            vv_mul_dot vv_mul_dot = new vv_mul_dot(1, 2, 3);

            Assert.AreEqual("vv_mul_dot r1 r2 r3", vv_mul_dot.ToString());
            vv_div vv_div = new vv_div(1, 2, 3);

            Assert.AreEqual("vv_div r1 r2 r3", vv_div.ToString());
            xor xor = new xor(1, 2, 3);

            Assert.AreEqual("xor r1 r2 r3", xor.ToString());
        }
 Cause behind the MissingReferenceException and solution It turned out, that the MissingReferenceException bug appeared, when a new level was loaded(or current one was reloaded).For example, we have a message "start game", declared as follows :
Example #21
0
    public void Solve(ReadOnlySpan <byte> input, Solution solution)
    {
        Span <byte> stack = stackalloc byte[4096];
        int         sp    = 0;

        Span <long> scores    = stackalloc long[1024];
        int         numScores = 0;

        int totalSyntaxError = 0;

        for (int i = 0; i < input.Length; i++)
        {
            byte c = input[i];
            switch (c & 0b111)
            {
            case 0b010:     // '\n'
                long score = 0;
                while (sp > 0)
                {
                    score *= 5;
                    score += stack[--sp] switch
                    {
                        (byte)'(' => 1,
                        (byte)'[' => 2,
                        (byte)'{' => 3,
                        (byte)'<' or _ => 4
                    };
                }

                scores[numScores++] = score;
                break;

            case 0b011:     // '[', '{'
            case 0b000:     // '('
            case 0b100:     // '<'
                stack[sp++] = c;
                break;

            default:                        // will match all the closing characters
                byte top = stack[--sp];
                if (c - top is not(1 or 2)) // all closing characters are 1 or 2 away from the opening character
                {
                    totalSyntaxError += c switch
                    {
                        (byte)')' => 3,
                        (byte)']' => 57,
                        (byte)'}' => 1197,
                        (byte)'>' or _ => 25137
                    };

                    // skip to next line
                    sp = 0;
                    while (input[++i] != '\n')
                    {
                        ;
                    }
                }
                break;
            }
        }

        solution.SubmitPart1(totalSyntaxError);
        solution.SubmitPart2(FindMedian(scores.Slice(0, numScores)));
    }
Example #22
0
 The startup manager is a singleton class that calls an initialization function on participating objects created in the last frame (or at startup) in the order dictated by their priority variable. Participating classes must be derived from the provided BaseBehaviour class (which in turn derives from MonoBehaviour as per usual). This class registers with the startup manager singleton in Start() which then calls Initialize() on it at the begining of the next frame (again, in the appropriate order). 
Example #23
0
serving $GOPATH/pkg/mod/cache/download at (or copying it to)
Example #24
0
 2. Derive your scripts (or at least the ones which you need to control the order they start in) from BaseBehaviour instead of MonoBehaviour