Пример #1
0
        static async void ChangeLConfigField(string[] param, bool isMain = false)
        {
            BenchTime.begin();
            await ChangeSerializableFieldCmd(param, isMain);

            BenchTime.SendResult("ChangeLConfigField took ", "ms.");
        }
Пример #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="command"></param>
        /// <param name="startIndex">The index of initial string (avoid prefix/mention prefix). -1 to include prefix, 0 excludes prefix</param>
        /// <returns></returns>
        internal static async Task <string[]> CommandSplit(string command, int startIndex = 0)
        {
            BenchTime.begin();
            List <string> result       = new List <string>();
            string        str          = "";
            bool          openedNester = false;

            for (int i = startIndex; i < command.Length; i++)
            {
                if (!openedNester)
                {
                    if (nester.Contains(command[i]))
                    {
                        openedNester = true;
                        continue;
                    }
                    if (!splitter.Contains(command[i]))
                    {
                        str += command[i];
                    }
                    else
                    {
                        if (str != "")
                        {
                            result.Add(str);
                            str = "";
                        }
                    }
                }
                else
                {
                    if (nester.Contains(command[i]))
                    {
                        openedNester = false;
                        result.Add(str);
                        str = "";
                        continue;
                    }
                    else
                    {
                        str += command[i];
                    }
                }
            }
            if (openedNester)
            {
                LogHelper.Logln("Nester was opened, but was never closed :(", LogType.Warning);
                await CommandService.ReplyAsync("Nester was never closed.");

                return(new string[0]);
            }
            if (str != "")
            {
                result.Add(str);
            }
            //Done with the processing
#if TRACE
            LogHelper.Logln("Processing is done.");
#endif
            string[] resultArr = result.ToArray();
            BenchTime.SendResult("Splitting command took ", "ms.");
            return(resultArr);
        }