string.Equals(string)

Here are the examples of the csharp api string.Equals(string) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

12591 Examples 7

19 View Source File : RegisterInput.cs
License : MIT License
Project Creator : 52ABP

public IEnumerable<ValidationResult> Validate(ValidationContext validationContext)
        {
            if (!UserName.IsNullOrEmpty())
            {
                if (!UserName.Equals(EmailAddress) && ValidationHelper.IsEmail(UserName))
                {
                    yield return new ValidationResult("Username cannot be an email address unless it's the same as your email address!");
                }
            }
        }

19 View Source File : MangaDex.cs
License : GNU General Public License v3.0
Project Creator : 9vult

public override Chapter[] GetUpdates()
        {
            List<Chapter> result = new List<Chapter>();
            string jsonText = MangaDexHelper.GetMangaJSON(MangaDexHelper.GetMangaUrl(GetID()));
            JObject jobj = JObject.Parse(jsonText);

            String[] dlc = GetDLChapters();
            bool doFullSetup = true;

            foreach (JProperty p in jobj["chapter"])
            {
                JToken value = p.Value;
                if (value.Type == JTokenType.Object)
                {
                    JObject o = (JObject)value;
                    string chapNum = (String)o["chapter"];
                    if (usergroup == "^any-group")
                    {
                        if (((string)o["lang_code"]).Equals(userlang))
                        {
                            if ((!doFullSetup) || (doFullSetup && dlc == null) || (doFullSetup && dlc[0].Equals("-1")) || (doFullSetup && dlc.Contains(chapNum)))
                            {
                                string chapID = ((JProperty)value.Parent).Name;
                                if (!Directory.Exists(Path.Combine(mangaRoot.FullName, chapID)))
                                {
                                    DirectoryInfo chapDir = FileHelper.CreateFolder(mangaRoot, chapID);
                                    Chapter newchapter = new Chapter(chapDir, chapID, chapNum, doFullSetup);
                                    chapters.Add(newchapter);
                                    result.Add(newchapter);
                                }
                            }
                        }
                    }
                    else
                    {
                        if (((string)o["lang_code"]).Equals(userlang) && ((string)o["group_name"]).Equals(usergroup))
                        {
                            // Console.WriteLine(chapNum);
                            string chapID = ((JProperty)value.Parent).Name;
                            if (!Directory.Exists(Path.Combine(mangaRoot.FullName, chapID)))
                            {
                                if ((!doFullSetup) || (doFullSetup && dlc == null) || (doFullSetup && dlc[0].Equals("-1")) || (doFullSetup && dlc.Contains(chapNum)))
                                {
                                    DirectoryInfo chapDir = FileHelper.CreateFolder(mangaRoot, chapID);
                                    Chapter newchapter = new Chapter(chapDir, chapID, chapNum, doFullSetup);
                                    chapters.Add(newchapter);
                                    result.Add(newchapter);
                                }
                            }
                        }
                    }
                    
                }
            }
            return result.ToArray();
        }

19 View Source File : Godzilla.cs
License : GNU General Public License v3.0
Project Creator : 1330-Studios

[HarmonyPrefix]
            public static bool Prefix(Factory __instance, string objectId,
                Il2CppSystem.Action<UnityDisplayNode> onComplete) {
                if (!protos.ContainsKey(objectId) && objectId.Equals("Godzilla0")) {
                    var udn = GetGodzilla(__instance.PrototypeRoot);
                    udn.name = "Godzilla";
                    var a = replacedets.Loadreplacedet("GodzillaMaterial");
                    udn.genericRenderers[0].material = a.Cast<Material>();
                    udn.RecalculateGenericRenderers();
                    udn.isSprite = false;
                    onComplete.Invoke(udn);
                    protos.Add(objectId, udn);
                    return false;
                }

                if (!protos.ContainsKey(objectId) && objectId.Equals("Godzilla1")) {
                    var udn = GetGodzilla(__instance.PrototypeRoot);
                    udn.name = "Godzilla1";
                    udn.RecalculateGenericRenderers();
                    udn.isSprite = false;
                    var a = replacedets.Loadreplacedet("GodzillaMaterialBlu");
                    udn.genericRenderers[0].material = a.Cast<Material>();
                    onComplete.Invoke(udn);
                    protos.Add(objectId, udn);
                    return false;
                }

                if (!protos.ContainsKey(objectId) && objectId.Equals("Godzilla2")) {
                    var udn = GetGodzilla(__instance.PrototypeRoot);
                    udn.name = "Godzilla2";
                    udn.RecalculateGenericRenderers();
                    udn.isSprite = false;
                    var a = replacedets.Loadreplacedet("GodzillaMaterialRed");
                    udn.genericRenderers[0].material = a.Cast<Material>();
                    onComplete.Invoke(udn);
                    protos.Add(objectId, udn);
                    return false;
                }

                if (objectId.Equals("GodzillaBreath")) {
                    UnityDisplayNode udn = null;
                    __instance.FindAndSetupPrototypeAsync("bdbeaa256e6c63b45829535831843376",
                        new Action<UnityDisplayNode>(oudn => {
                            var nudn = Object.Instantiate(oudn, __instance.PrototypeRoot);
                            nudn.name = objectId + "(Clone)";
                            nudn.isSprite = true;
                            nudn.RecalculateGenericRenderers();
                            for (var i = 0; i < nudn.genericRenderers.Length; i++) {
                                if (nudn.genericRenderers[i].GetIl2CppType() == Il2CppType.Of<SpriteRenderer>()) {
                                    var smr = nudn.genericRenderers[i].Cast<SpriteRenderer>();
                                    var text = replacedets.Loadreplacedet("BluePlasma").Cast<Texture2D>();
                                    smr.sprite = Sprite.Create(text, new(0, 0, text.width, text.height), new(0.5f, 0.5f), 5.4f);
                                    nudn.genericRenderers[i] = smr;
                                }
                            }

19 View Source File : SpeedtestHandler.cs
License : GNU General Public License v3.0
Project Creator : 2dust

private string FormatOut(object time, string unit)
        {
            if (time.ToString().Equals("-1"))
            {
                return "Timeout";
            }
            return string.Format("{0}{1}", time, unit).PadLeft(8, ' ');
        }

19 View Source File : EnumExtensions.cs
License : MIT License
Project Creator : 17MKH

public static OptionCollectionResultModel ToResult(this Enum value, bool ignoreUnKnown = false)
    {
        var enumType = value.GetType();

        if (!enumType.IsEnum)
            return null;

        var options = Enum.GetValues(enumType).Cast<Enum>()
            .Where(m => !ignoreUnKnown || !m.ToString().Equals("UnKnown"));

        return Options2Collection(options);
    }

19 View Source File : Exploit.cs
License : GNU General Public License v3.0
Project Creator : 0x00-0x00

private static Boolean HasFullControl(string path, string username)
        {

            bool fc = false;
            FileInfo file = new FileInfo([email protected]"{path}");
            FileSecurity acl = file.GetAccessControl();

            foreach (FileSystemAccessRule rule in acl.GetAccessRules(true, true, typeof(NTAccount)))
            {
                if (rule.IdenreplacedyReference.Value.Equals(username) & rule.FileSystemRights.Equals(FileSystemRights.FullControl))
                    fc = true;
            }

            return fc;

        }

19 View Source File : Foto.cs
License : MIT License
Project Creator : 6tail

public bool isDayZhaiGuanYin()
        {
            string k = getMonth() + "-" + getDay();
            foreach (string d in FotoUtil.DAY_ZHAI_GUAN_YIN)
            {
                if (k.Equals(d))
                {
                    return true;
                }
            }
            return false;
        }

19 View Source File : Settings.xaml.cs
License : GNU General Public License v3.0
Project Creator : 00000vish

private void settingsChanged(object sender, RoutedEventArgs e)
        {

            CheckBox item = (CheckBox)sender;
            //encryption

            SteamTwoProperties.jsonSetting.encryptedSetting = (bool)enableEncryption.IsChecked;
            if (SteamTwoProperties.jsonSetting.encryptedSetting == true && item.Name.ToString().Equals("enableEncryption"))
            {
                changeKeyClicked();
            }

            //auto start
            SteamTwoProperties.jsonSetting.autoStartSetting = (bool)autoStart.IsChecked;
            if (SteamTwoProperties.jsonSetting.autoStartSetting == true && item.Name.ToString().Equals("autoStart"))
            {
                createRegKey();
            }
            else if (SteamTwoProperties.jsonSetting.autoStartSetting != true && item.Name.ToString().Equals("autoStart"))
            {
                deleteRegKey();
            }
            SteamTwoProperties.jsonSetting.forwardCheckSetting = (bool)Forward2.IsChecked;
            SteamTwoProperties.jsonSetting.autoLoginSetting = (bool)autoLogin.IsChecked;
            SteamTwoProperties.jsonSetting.badAttemptSetting = (bool)badAttempt.IsChecked;
            SteamTwoProperties.jsonSetting.multipleBotSetting = (bool)multipleBots.IsChecked;
            SteamTwoProperties.jsonSetting.copyPreplacedwordSetting = (bool)copyPreplacedword.IsChecked;
            SteamTwoProperties.jsonSetting.closeStemLaunchSetting = (bool)closeStemLaunch.IsChecked;
            SteamTwoProperties.jsonSetting.chatComSetting = (bool)chatCommandButton.IsChecked;
            SteamTwoProperties.jsonSetting.chatSetting = (bool)enableChat.IsChecked;
            SteamTwoProperties.jsonSetting.autoAddFriendSetting = (bool)autoAddFriends.IsChecked;
            SteamTwoProperties.jsonSetting.notifyOnMessageSetting = (bool)notifyOnMessage.IsChecked;
            SteamTwoProperties.updateSettingFile();
            updateGUI();
        }

19 View Source File : FrmSettings.cs
License : GNU General Public License v3.0
Project Creator : 9vult

private void BtnSave_Click(object sender, EventArgs e)
        {
            // Save Update Checking preference 
            Properties.Settings.Default["checkForUpdates"] = chkUpdates.Checked;

            // Save Double-Page Reader preference
            Properties.Settings.Default["doublePageReader"] = chkDblReader.Checked;

            // Save language preference
            Properties.Settings.Default["languageCode"] = cmboLang.SelectedItem.ToString().Substring(0, 2);

            // Check if the home directory was changed
            if (!(new DirectoryInfo(txtDirectory.Text).ToString().Equals(new DirectoryInfo((string)Properties.Settings.Default["homeDirectory"]).ToString())))
            {
                DialogResult result = MessageBox.Show("Changing the save directory will require a restart. Continue?", "MikuReader", MessageBoxButtons.YesNo);
                if (result == DialogResult.Yes)
                {
                    Properties.Settings.Default["homeDirectory"] = txtDirectory.Text;
                    Properties.Settings.Default.Save();
                    Application.Restart();
                } else
                {
                    txtDirectory.Text = (string)Properties.Settings.Default["homeDirectory"];
                }
            }
            Properties.Settings.Default.Save();
            MessageBox.Show("Requested changes were saved", "MikuReader");
            startPage.RefreshContents();
        }

19 View Source File : MessageController.cs
License : Apache License 2.0
Project Creator : 0nise

public static MessageModel main(String message,string fromQQ) {
            string resultContent = "\n无数据";
            string content = message;
            MessageModel messageModel = null;
            if (message == null || message == "" || message.Length == 0)
            {
                messageModel = new MessageModel(sendMessage: MessageConstant.HELP_CONTENT, isAdmin: false, code: "");
                return messageModel;
            }
            resultContent = "\n无数据";
            message = executeCodeReplace(message);
            message = message.Trim();
            if (message.Length == 0 || message == "")
            {
                messageModel = new MessageModel(sendMessage: MessageConstant.HELP_CONTENT, isAdmin: false, code: "");
                return messageModel;
            }
            else if (message.Contains(MessageConstant.RANDOM_CONTENT_replacedLE)) {
                // 标题查询随机文章
                message = message.Replace(MessageConstant.RANDOM_CONTENT_replacedLE, "").Trim();
                resultContent = DBHelperMySQL.GetContentRandomByreplacedle(message);
                // 标题查询随机课程
                string clreplacedContent = DBHelperMySQL.getClreplacedRandomByreplacedle(message);
                if (clreplacedContent.Length > 0 && !"".Equals(clreplacedContent))
                {
                    resultContent += clreplacedContent;
                }
                messageModel = new MessageModel(sendMessage: resultContent, isAdmin: false, code: MessageConstant.RANDOM_CONTENT_replacedLE);
            }
            else if (message.Contains(MessageConstant.DESC_CONTENT_replacedLE)) {
                // 标题查询最新文章
                message = message.Replace(MessageConstant.DESC_CONTENT_replacedLE, "").Trim();
                string clreplacedContent = "";
                if (message.Length == 0 || message == "" || "".Equals(message) || message == null)
                {
                    // 调用每日最新
                    resultContent = DBHelperMySQL.getContentDateByToday();
                    // 标题查询最新课程
                    clreplacedContent = DBHelperMySQL.getClreplacedDateByreplacedle("");
                }
                else
                {
                    resultContent = DBHelperMySQL.getContentDateByreplacedle(message);
                    clreplacedContent = DBHelperMySQL.getClreplacedDateByreplacedle(message);
                }
                if (clreplacedContent.Length > 0 && !"".Equals(clreplacedContent))
                {
                    resultContent += clreplacedContent;
                }
                messageModel = new MessageModel(sendMessage: resultContent, isAdmin: false, code: MessageConstant.DESC_CONTENT_replacedLE);
            }
            else if (message.Contains(MessageConstant.DESC_CONTENT_AUTHOR)) {
                // 作者查询最新文章
                message = message.Replace(MessageConstant.DESC_CONTENT_AUTHOR, "").Trim();
                resultContent = DBHelperMySQL.getContentDateByAuthor(message);
                // 作者查询最新课程
                string clreplacedContent = DBHelperMySQL.getClreplacedDateByAuthor(message);
                if (clreplacedContent.Length > 0 && !"".Equals(clreplacedContent))
                {
                    resultContent += clreplacedContent;
                }
                messageModel = new MessageModel(sendMessage: resultContent, isAdmin: false, code: MessageConstant.DESC_CONTENT_AUTHOR);
            } else if (message.Contains(MessageConstant.RANDOM_CONTENT_AUTHOR)) {
                // 作者查询随机文章
                message = message.Replace(MessageConstant.RANDOM_CONTENT_AUTHOR, "").Trim();
                resultContent = DBHelperMySQL.getContentRandomByAuthor(message);
                // 作者查询随机课程
                string clreplacedContent = DBHelperMySQL.getClreplacedRandomByAuthor(message);
                if (clreplacedContent.Length > 0 && !"".Equals(clreplacedContent))
                {
                    resultContent += clreplacedContent;
                }
                messageModel = new MessageModel(sendMessage: resultContent, isAdmin: false, code: MessageConstant.RANDOM_CONTENT_AUTHOR);
            }
            else if (message.Contains(MessageConstant.DESC_CONTENT_TODAY) || message.Contains(MessageConstant.DESC_CONTENT))
            {
                // 今日最新
                message = message.Replace(MessageConstant.DESC_CONTENT_TODAY, "").Trim();
                resultContent = DBHelperMySQL.getContentDateByToday();
                string clreplacedContent = DBHelperMySQL.getClreplacedDateByreplacedle("");
                if (clreplacedContent.Length > 0 && !"".Equals(clreplacedContent))
                {
                    resultContent += clreplacedContent;
                }
                messageModel = new MessageModel(sendMessage: resultContent, isAdmin: false, code: MessageConstant.DESC_CONTENT_TODAY);
            } else if (message.Contains(MessageConstant.GONG_GAO)) {
                // 公告处理
                bool flag = DBHelperMySQL.isAdmin(fromQQ);
                // 判断是否管理员
                if (flag) {
                    message = message.Replace(MessageConstant.GONG_GAO, "来自i春秋机器人的智能推送\n");
                    resultContent = message;
                    messageModel = new MessageModel(sendMessage: resultContent, isAdmin: true, code: MessageConstant.GONG_GAO);
                }
                else {
                    resultContent = "您不是管理员!请联系坏蛋,QQ286894635!";
                    messageModel = new MessageModel(sendMessage: resultContent, isAdmin: false, code: MessageConstant.GONG_GAO);
                }
            }
            else if (message.Contains(MessageConstant.AITE_ALL))
            {
                // 艾特全体处理
                bool flag = DBHelperMySQL.isAdmin(fromQQ);
                if (flag)
                {
                    message = message.Replace(MessageConstant.AITE_ALL, "来自i春秋机器人的智能推送\n");
                    resultContent = message;
                    messageModel = new MessageModel(sendMessage: resultContent, isAdmin: true, code: MessageConstant.AITE_ALL);
                }
                else
                {
                    resultContent = "您不是管理员!请联系坏蛋,QQ286894635!";
                    messageModel = new MessageModel(sendMessage: resultContent, isAdmin: false, code: MessageConstant.AITE_ALL);
                }
            }
            else if (message.Contains(MessageConstant.HELP) || message.Contains(MessageConstant.HELP_TWO))
            {
                // Help 帮助等指令
                resultContent = MessageConstant.HELP_CONTENT;
                messageModel = new MessageModel(sendMessage: resultContent, isAdmin: false, code: MessageConstant.HELP_TWO);
            } else if (message.Contains(MessageConstant.DESC_VIDEO)) {
                // 标题查询最新教程
                message = message.Replace(MessageConstant.DESC_VIDEO, "").Trim();
                resultContent = DBHelperMySQL.getCourseDateByreplacedle(message);
                // 标题查询最新课程
                string clreplacedContent = DBHelperMySQL.getClreplacedDateByreplacedle(message);
                if (clreplacedContent.Length > 0 && !"".Equals(clreplacedContent))
                {
                    resultContent += clreplacedContent;
                }
                messageModel = new MessageModel(sendMessage: resultContent, isAdmin: false, code: MessageConstant.DESC_VIDEO);
            }
            else if (message.Contains(MessageConstant.RANDOM_VIDEO))
            {
                // 标题查询随机教程
                message = message.Replace(MessageConstant.RANDOM_VIDEO, "").Trim();
                resultContent = DBHelperMySQL.getCourseRandomByreplacedle(message);
                // 标题查询随机课程
                string clreplacedContent = DBHelperMySQL.getClreplacedRandomByreplacedle(message);
                if (clreplacedContent.Length > 0 && !"".Equals(clreplacedContent))
                {
                    resultContent += clreplacedContent;
                }
                messageModel = new MessageModel(sendMessage: resultContent, isAdmin: false, code: MessageConstant.RANDOM_VIDEO);
            }
            else if (message.Contains(MessageConstant.TEST))
            {
                // 测试命令
                resultContent = " [CQ:image,file=photo.jpg]";
                messageModel = new MessageModel(sendMessage: resultContent, isAdmin: false, code: MessageConstant.TEST);
            } else if (message.Contains(MessageConstant.SELECT_MONEY)) {
                string tmpStr = message.Replace(MessageConstant.SELECT_MONEY, "").Trim();
                // 判断是否为管理员
                bool isAdmin = DBHelperMySQL.isAdmin(fromQQ);
                string money = "";
                if (tmpStr.Length > 0 && isAdmin)
                {
                    // 查询余额
                    money = DBHelperMySQL.getBlankMoney(tmpStr);
                }
                else
                {
                    // 查询余额
                    money = DBHelperMySQL.getBlankMoney(fromQQ);
                }
                if (money == "" || money == null || money.Length == 0)
                {
                    resultContent = "没有数据,请联系QQ:758841765 给予昵称QQ等信息。";
                }
                else
                {
                    resultContent = "\n当前余额为 " + money;
                }
                messageModel = new MessageModel(sendMessage: resultContent, isAdmin: isAdmin, code: MessageConstant.SELECT_MONEY);
            }
            else if (message.Contains(MessageConstant.HISTORY_MONEY))
            {
                // 提现记录
                string historyMoney = DBHelperMySQL.getBlankHistory(fromQQ);
                // 查询当前余额
                string money = DBHelperMySQL.getBlankMoney(fromQQ);
                if (money == "" || money == null || money.Length == 0) {
                    resultContent = "没有数据,请联系QQ:758841765 给予昵称QQ等信息。";
                }
                else {
                    resultContent = "\n当前余额为 " + money + "\n";
                    // 查询历史记录
                    resultContent += "提现记录\n";
                    resultContent += "金额\t\t时间\n" + historyMoney;
                }
                messageModel = new MessageModel(sendMessage: resultContent, isAdmin: false, code: MessageConstant.HISTORY_MONEY);
            }
            else if (message.Contains(MessageConstant.APPLY_MONEY))
            {
                // 申请提现
                resultContent = "请联系【坏蛋】,QQ号:286894635。\n[CQ:at,qq=286894635]";
                messageModel = new MessageModel(sendMessage: resultContent, isAdmin: false, code: MessageConstant.APPLY_MONEY);
            } else if (message.Contains(MessageConstant.ABOUT)) {
                resultContent = "i春秋社区机器人,研发人员为:0nise,产品设计为:坏蛋!";
                messageModel = new MessageModel(sendMessage: resultContent, isAdmin: false, code: MessageConstant.ABOUT);
            } else if (message.Contains(MessageConstant.UPDATE_MONEY)) {
                // 更新金额
                bool isAdmin = DBHelperMySQL.isAdmin(fromQQ);
                if (isAdmin) {
                    try
                    {
                        decimal tmpMoney = 0.0M;
                        // 提现
                        if (message.Contains(MessageConstant.PUT_FORWARD))
                        {
                            int moneyIndex = message.IndexOf(MessageConstant.PUT_FORWARD + ":");
                            int index = message.IndexOf(MessageConstant.UPDATE_MONEY);
                            if (moneyIndex >= 0 && index >= 0)
                            {
                                decimal money = Convert.ToDecimal(message.Substring(moneyIndex).Replace("提现:", "").Replace(" ", ""));
                                if (money > tmpMoney)
                                {
                                    string qq = message.Replace(message.Substring(moneyIndex), "").Replace(MessageConstant.UPDATE_MONEY, "").Replace(" ", "");
                                    resultContent = DBHelperMySQL.updateBlank(qq, money,"0");
                                }
                                else
                                {
                                    resultContent = "提现金额必须大于0!";
                                }
                            }
                        }
                        // 加钱
                        else if (message.Contains(MessageConstant.ADD_MONEY))
                        {
                            int moneyIndex = message.IndexOf(MessageConstant.ADD_MONEY + ":");
                            int index = message.IndexOf(MessageConstant.ADD_MONEY);
                            if (moneyIndex >= 0 && index >= 0)
                            {
                                decimal money = Convert.ToDecimal(message.Substring(moneyIndex).Replace("加钱:", "").Replace(" ", ""));
                                if (money > tmpMoney)
                                {
                                    string qq = message.Replace(message.Substring(moneyIndex), "").Replace(MessageConstant.UPDATE_MONEY, "").Replace(" ", "");
                                    resultContent = DBHelperMySQL.updateBlank(qq, money,"1");
                                }
                                else
                                {
                                    resultContent = "加钱金额必须大于0!";
                                }
                            }
                        }
                    }
                    catch (Exception)
                    {
                        resultContent = "更新失败。";
                    }
                }
                else
                {
                    resultContent = "您不是管理员!请联系坏蛋,QQ286894635!";
                }
                messageModel = new MessageModel(sendMessage: resultContent, isAdmin: isAdmin, code: MessageConstant.UPDATE_MONEY);
            }
            else if (message.Contains(MessageConstant.TODAY_COUNT))
            {
                // 今日使用数量
                bool isAdmin = DBHelperMySQL.isAdmin(fromQQ);
                if (isAdmin)
                {
                    int count = DBHelperMySQL.getToday();
                    resultContent = "今日使用人数达"+count+"人";
                }
                else
                {
                    resultContent = "您不是管理员!请联系坏蛋,QQ286894635!";
                }
                messageModel = new MessageModel(sendMessage: resultContent, isAdmin: isAdmin, code: MessageConstant.TODAY_COUNT);
            }
            else if (message.Contains(MessageConstant.USER_TOTAL))
            {
                // 总人数
                // 判定是否为管理员
                bool isAdmin = DBHelperMySQL.isAdmin(fromQQ);
                if (isAdmin)
                {
                    int count = DBHelperMySQL.getUserTotal();
                    DateTime dt = DateTime.Now;
                    // 获取日期
                    string date = dt.ToLongDateString().ToString();
                    resultContent = "截止" + date + ",机器人历史使用人数达"+count+"人。";
                }
                else
                {
                    resultContent = "您不是管理员!请联系坏蛋,QQ286894635!";
                }
                messageModel = new MessageModel(sendMessage: resultContent, isAdmin: isAdmin, code: MessageConstant.USER_TOTAL);
            }
            else if (message.Contains(MessageConstant.THIS_WEEK))
            {
                // 七日使用
                // 判定是否为管理员
                bool isAdmin = DBHelperMySQL.isAdmin(fromQQ);
                if (isAdmin)
                {
                    Hashtable hashtable = DBHelperMySQL.getThisWeek();
                    resultContent = "";
                    foreach (Object item in hashtable.Keys)
                    {
                        string dateData =  item.ToString();
                        string count = hashtable[item].ToString();
                        resultContent += dateData + " 使用人数为:" + count + "人;\n";
                    }
                }
                else
                {
                    resultContent = "您不是管理员!请联系坏蛋,QQ286894635!";
                }
                messageModel = new MessageModel(sendMessage: resultContent, isAdmin: isAdmin, code: MessageConstant.USER_TOTAL);
            }
            else if (message.Contains(MessageConstant.QUN_TOTAL))
            {
                // 群数量
                // 判定是否为管理员
                bool isAdmin = DBHelperMySQL.isAdmin(fromQQ);
                if (isAdmin)
                {
                    resultContent = "群数量";
                }
                else
                {
                    resultContent = "您不是管理员!请联系坏蛋,QQ286894635!";
                }
                messageModel = new MessageModel(sendMessage: resultContent, isAdmin: isAdmin, code: MessageConstant.QUN_TOTAL);
            }
            else if (message.Contains(MessageConstant.MONEY_DESC))
            {
                // 财富榜
                bool isAdmin = DBHelperMySQL.isAdmin(fromQQ);
                // 检索是否为做作家团
                if (DBHelperMySQL.exitsUser(fromQQ) || isAdmin)
                {
                    resultContent = DBHelperMySQL.Top30Money();
                }
                else
                {
                    resultContent = "您不是作家团成员!";
                }
                messageModel = new MessageModel(sendMessage: resultContent, isAdmin: isAdmin, code: MessageConstant.MONEY_DESC);
            }
            else
            {
                // 其他内容
                resultContent = MessageConstant.HELP_CONTENT;
                messageModel = new MessageModel(sendMessage: resultContent, isAdmin: false, code: "");
            }

            if (resultContent == "" || resultContent == null || resultContent.Length == 0) {
                messageModel.SendMessage = "\n无数据";
                messageModel = new MessageModel(sendMessage: resultContent, isAdmin: false, code: MessageConstant.HELP);
            }
            // 记录用户操作数据
            DBHelperMySQL.addUserData(fromQQ, content, resultContent);
            return messageModel;
        }

19 View Source File : Utils.cs
License : GNU General Public License v3.0
Project Creator : 2dust

public static bool IsNullOrEmpty(string text)
        {
            if (string.IsNullOrEmpty(text))
            {
                return true;
            }
            if (text.Equals("null"))
            {
                return true;
            }
            return false;
        }

19 View Source File : EnumExtensions.cs
License : MIT License
Project Creator : 17MKH

public static OptionCollectionResultModel ToResult<T>(bool ignoreUnKnown = false)
    {
        var enumType = typeof(T);

        if (!enumType.IsEnum)
            return null;

        if (ignoreUnKnown)
        {
            #region ==忽略UnKnown属性==

            if (!ListCacheNoIgnore.TryGetValue(enumType.TypeHandle, out OptionCollectionResultModel list))
            {
                var options = Enum.GetValues(enumType).Cast<Enum>()
                    .Where(m => !m.ToString().Equals("UnKnown"));

                list = Options2Collection(options);

                ListCacheNoIgnore.TryAdd(enumType.TypeHandle, list);
            }

            return list;

            #endregion ==忽略UnKnown属性==
        }
        else
        {
            #region ==包含UnKnown选项==

            if (!ListCache.TryGetValue(enumType.TypeHandle, out OptionCollectionResultModel list))
            {
                var options = Enum.GetValues(enumType).Cast<Enum>();
                list = Options2Collection(options);
                ListCache.TryAdd(enumType.TypeHandle, list);
            }

            return list;

            #endregion ==包含UnKnown选项==
        }
    }

19 View Source File : MessageController.cs
License : Apache License 2.0
Project Creator : 0nise

public static MessageModel main(String message,string fromQQ) {
            string resultContent = "\n无数据";
            string content = message;
            MessageModel messageModel = null;
            if (message == null || message == "" || message.Length == 0)
            {
                messageModel = new MessageModel(sendMessage: MessageConstant.HELP_CONTENT, isAdmin: false, code: "");
                return messageModel;
            }
            resultContent = "\n无数据";
            message = executeCodeReplace(message);
            message = message.Trim();
            if (message.Length == 0 || message == "")
            {
                messageModel = new MessageModel(sendMessage: MessageConstant.HELP_CONTENT, isAdmin: false, code: "");
                return messageModel;
            }
            else if (message.Contains(MessageConstant.RANDOM_CONTENT_replacedLE)) {
                // 标题查询随机文章
                message = message.Replace(MessageConstant.RANDOM_CONTENT_replacedLE, "").Trim();
                resultContent = DBHelperMySQL.GetContentRandomByreplacedle(message);
                // 标题查询随机课程
                string clreplacedContent = DBHelperMySQL.getClreplacedRandomByreplacedle(message);
                if (clreplacedContent.Length > 0 && !"".Equals(clreplacedContent))
                {
                    resultContent += clreplacedContent;
                }
                messageModel = new MessageModel(sendMessage: resultContent, isAdmin: false, code: MessageConstant.RANDOM_CONTENT_replacedLE);
            }
            else if (message.Contains(MessageConstant.DESC_CONTENT_replacedLE)) {
                // 标题查询最新文章
                message = message.Replace(MessageConstant.DESC_CONTENT_replacedLE, "").Trim();
                string clreplacedContent = "";
                if (message.Length == 0 || message == "" || "".Equals(message) || message == null)
                {
                    // 调用每日最新
                    resultContent = DBHelperMySQL.getContentDateByToday();
                    // 标题查询最新课程
                    clreplacedContent = DBHelperMySQL.getClreplacedDateByreplacedle("");
                }
                else
                {
                    resultContent = DBHelperMySQL.getContentDateByreplacedle(message);
                    clreplacedContent = DBHelperMySQL.getClreplacedDateByreplacedle(message);
                }
                if (clreplacedContent.Length > 0 && !"".Equals(clreplacedContent))
                {
                    resultContent += clreplacedContent;
                }
                messageModel = new MessageModel(sendMessage: resultContent, isAdmin: false, code: MessageConstant.DESC_CONTENT_replacedLE);
            }
            else if (message.Contains(MessageConstant.DESC_CONTENT_AUTHOR)) {
                // 作者查询最新文章
                message = message.Replace(MessageConstant.DESC_CONTENT_AUTHOR, "").Trim();
                resultContent = DBHelperMySQL.getContentDateByAuthor(message);
                // 作者查询最新课程
                string clreplacedContent = DBHelperMySQL.getClreplacedDateByAuthor(message);
                if (clreplacedContent.Length > 0 && !"".Equals(clreplacedContent))
                {
                    resultContent += clreplacedContent;
                }
                messageModel = new MessageModel(sendMessage: resultContent, isAdmin: false, code: MessageConstant.DESC_CONTENT_AUTHOR);
            } else if (message.Contains(MessageConstant.RANDOM_CONTENT_AUTHOR)) {
                // 作者查询随机文章
                message = message.Replace(MessageConstant.RANDOM_CONTENT_AUTHOR, "").Trim();
                resultContent = DBHelperMySQL.getContentRandomByAuthor(message);
                // 作者查询随机课程
                string clreplacedContent = DBHelperMySQL.getClreplacedRandomByAuthor(message);
                if (clreplacedContent.Length > 0 && !"".Equals(clreplacedContent))
                {
                    resultContent += clreplacedContent;
                }
                messageModel = new MessageModel(sendMessage: resultContent, isAdmin: false, code: MessageConstant.RANDOM_CONTENT_AUTHOR);
            }
            else if (message.Contains(MessageConstant.DESC_CONTENT_TODAY) || message.Contains(MessageConstant.DESC_CONTENT))
            {
                // 今日最新
                message = message.Replace(MessageConstant.DESC_CONTENT_TODAY, "").Trim();
                resultContent = DBHelperMySQL.getContentDateByToday();
                string clreplacedContent = DBHelperMySQL.getClreplacedDateByreplacedle("");
                if (clreplacedContent.Length > 0 && !"".Equals(clreplacedContent))
                {
                    resultContent += clreplacedContent;
                }
                messageModel = new MessageModel(sendMessage: resultContent, isAdmin: false, code: MessageConstant.DESC_CONTENT_TODAY);
            } else if (message.Contains(MessageConstant.GONG_GAO)) {
                // 公告处理
                bool flag = DBHelperMySQL.isAdmin(fromQQ);
                // 判断是否管理员
                if (flag) {
                    message = message.Replace(MessageConstant.GONG_GAO, "来自i春秋机器人的智能推送\n");
                    resultContent = message;
                    messageModel = new MessageModel(sendMessage: resultContent, isAdmin: true, code: MessageConstant.GONG_GAO);
                }
                else {
                    resultContent = "您不是管理员!请联系坏蛋,QQ286894635!";
                    messageModel = new MessageModel(sendMessage: resultContent, isAdmin: false, code: MessageConstant.GONG_GAO);
                }
            }
            else if (message.Contains(MessageConstant.AITE_ALL))
            {
                // 艾特全体处理
                bool flag = DBHelperMySQL.isAdmin(fromQQ);
                if (flag)
                {
                    message = message.Replace(MessageConstant.AITE_ALL, "来自i春秋机器人的智能推送\n");
                    resultContent = message;
                    messageModel = new MessageModel(sendMessage: resultContent, isAdmin: true, code: MessageConstant.AITE_ALL);
                }
                else
                {
                    resultContent = "您不是管理员!请联系坏蛋,QQ286894635!";
                    messageModel = new MessageModel(sendMessage: resultContent, isAdmin: false, code: MessageConstant.AITE_ALL);
                }
            }
            else if (message.Contains(MessageConstant.HELP) || message.Contains(MessageConstant.HELP_TWO))
            {
                // Help 帮助等指令
                resultContent = MessageConstant.HELP_CONTENT;
                messageModel = new MessageModel(sendMessage: resultContent, isAdmin: false, code: MessageConstant.HELP_TWO);
            } else if (message.Contains(MessageConstant.DESC_VIDEO)) {
                // 标题查询最新教程
                message = message.Replace(MessageConstant.DESC_VIDEO, "").Trim();
                resultContent = DBHelperMySQL.getCourseDateByreplacedle(message);
                // 标题查询最新课程
                string clreplacedContent = DBHelperMySQL.getClreplacedDateByreplacedle(message);
                if (clreplacedContent.Length > 0 && !"".Equals(clreplacedContent))
                {
                    resultContent += clreplacedContent;
                }
                messageModel = new MessageModel(sendMessage: resultContent, isAdmin: false, code: MessageConstant.DESC_VIDEO);
            }
            else if (message.Contains(MessageConstant.RANDOM_VIDEO))
            {
                // 标题查询随机教程
                message = message.Replace(MessageConstant.RANDOM_VIDEO, "").Trim();
                resultContent = DBHelperMySQL.getCourseRandomByreplacedle(message);
                // 标题查询随机课程
                string clreplacedContent = DBHelperMySQL.getClreplacedRandomByreplacedle(message);
                if (clreplacedContent.Length > 0 && !"".Equals(clreplacedContent))
                {
                    resultContent += clreplacedContent;
                }
                messageModel = new MessageModel(sendMessage: resultContent, isAdmin: false, code: MessageConstant.RANDOM_VIDEO);
            }
            else if (message.Contains(MessageConstant.TEST))
            {
                // 测试命令
                resultContent = " [CQ:image,file=photo.jpg]";
                messageModel = new MessageModel(sendMessage: resultContent, isAdmin: false, code: MessageConstant.TEST);
            } else if (message.Contains(MessageConstant.SELECT_MONEY)) {
                // 查询余额
                string money = DBHelperMySQL.getBlankMoney(fromQQ);
                if (money == "" || money == null || money.Length == 0)
                {
                    resultContent = "没有数据,请联系QQ:758841765 给予昵称QQ等信息。";
                }
                else
                {
                    resultContent = "\n当前余额为 " + money;
                }
                messageModel = new MessageModel(sendMessage: resultContent, isAdmin: false, code: MessageConstant.SELECT_MONEY);
            }
            else if (message.Contains(MessageConstant.HISTORY_MONEY))
            {
                // 提现记录
                string historyMoney = DBHelperMySQL.getBlankHistory(fromQQ);
                // 查询当前余额
                string money = DBHelperMySQL.getBlankMoney(fromQQ);
                if (money == "" || money == null || money.Length == 0) {
                    resultContent = "没有数据,请联系QQ:758841765 给予昵称QQ等信息。";
                }
                else {
                    resultContent = "\n当前余额为 " + money + "\n";
                    // 查询历史记录
                    resultContent += "提现记录\n";
                    resultContent += "金额\t\t时间\n" + historyMoney;
                }
                messageModel = new MessageModel(sendMessage: resultContent, isAdmin: false, code: MessageConstant.HISTORY_MONEY);
            }
            else if (message.Contains(MessageConstant.APPLY_MONEY))
            {
                // 申请提现
                resultContent = "请联系【坏蛋】,QQ号:286894635。\n[CQ:at,qq=286894635]";
                messageModel = new MessageModel(sendMessage: resultContent, isAdmin: false, code: MessageConstant.APPLY_MONEY);
            } else if (message.Contains(MessageConstant.ABOUT)) {
                resultContent = "i春秋社区机器人,研发人员为:0nise!";
                messageModel = new MessageModel(sendMessage: resultContent, isAdmin: false, code: MessageConstant.ABOUT);
            } else if (message.Contains(MessageConstant.UPDATE_MONEY)) {
                // 更新金额
                bool isAdmin = DBHelperMySQL.isAdmin(fromQQ);
                if (isAdmin) {
                    try
                    {
                        int moneyIndex = message.IndexOf("提现:");
                        int index = message.IndexOf(MessageConstant.UPDATE_MONEY);
                        if (moneyIndex >= 0 && index >= 0)
                        {
                           decimal money = Convert.ToDecimal(message.Substring(moneyIndex).Replace("提现:", "").Replace(" ",""));
                           string qq = message.Replace(message.Substring(moneyIndex), "").Replace(MessageConstant.UPDATE_MONEY, "").Replace(" ", "");
                           resultContent = DBHelperMySQL.updateBlank(qq,money);
                        }
                    }
                    catch (Exception)
                    {
                        resultContent = "更新失败。";
                    }
                }
                else
                {
                    resultContent = "您不是管理员!请联系坏蛋,QQ286894635!";
                }
                messageModel = new MessageModel(sendMessage: resultContent, isAdmin: isAdmin, code: MessageConstant.UPDATE_MONEY);
            }
            else if (message.Contains(MessageConstant.TODAY_COUNT))
            {
                // 今日使用数量
                bool isAdmin = DBHelperMySQL.isAdmin(fromQQ);
                if (isAdmin)
                {
                    int count = DBHelperMySQL.getToday();
                    resultContent = "今日使用人数达"+count+"人";
                }
                else
                {
                    resultContent = "您不是管理员!请联系坏蛋,QQ286894635!";
                }
                messageModel = new MessageModel(sendMessage: resultContent, isAdmin: isAdmin, code: MessageConstant.TODAY_COUNT);
            }
            else if (message.Contains(MessageConstant.USER_TOTAL))
            {
                // 总人数
                // 判定是否为管理员
                bool isAdmin = DBHelperMySQL.isAdmin(fromQQ);
                if (isAdmin)
                {
                    int count = DBHelperMySQL.getUserTotal();
                    DateTime dt = DateTime.Now;
                    // 获取日期
                    string date = dt.ToLongDateString().ToString();
                    resultContent = "截止" + date + ",机器人历史使用人数达"+count+"人。";
                }
                else
                {
                    resultContent = "您不是管理员!请联系坏蛋,QQ286894635!";
                }
                messageModel = new MessageModel(sendMessage: resultContent, isAdmin: isAdmin, code: MessageConstant.USER_TOTAL);
            }
            else if (message.Contains(MessageConstant.THIS_WEEK))
            {
                // 七日使用
                // 判定是否为管理员
                bool isAdmin = DBHelperMySQL.isAdmin(fromQQ);
                if (isAdmin)
                {
                    Hashtable hashtable = DBHelperMySQL.getThisWeek();
                    resultContent = "";
                    foreach (Object item in hashtable.Keys)
                    {
                        string dateData =  item.ToString();
                        string count = hashtable[item].ToString();
                        resultContent += dateData + " 使用人数为:" + count + "人;\n";
                    }
                }
                else
                {
                    resultContent = "您不是管理员!请联系坏蛋,QQ286894635!";
                }
                messageModel = new MessageModel(sendMessage: resultContent, isAdmin: isAdmin, code: MessageConstant.USER_TOTAL);
            }
            else if (message.Contains(MessageConstant.QUN_TOTAL))
            {
                // 群数量
                // 判定是否为管理员
                bool isAdmin = DBHelperMySQL.isAdmin(fromQQ);
                if (isAdmin)
                {
                    resultContent = "群数量";
                }
                else
                {
                    resultContent = "您不是管理员!请联系坏蛋,QQ286894635!";
                }
                messageModel = new MessageModel(sendMessage: resultContent, isAdmin: isAdmin, code: MessageConstant.QUN_TOTAL);
            }
            else
            {
                // 其他内容
                resultContent = MessageConstant.HELP_CONTENT;
                messageModel = new MessageModel(sendMessage: resultContent, isAdmin: false, code: "");
            }

            if (resultContent == "" || resultContent == null || resultContent.Length == 0) {
                messageModel.SendMessage = "\n无数据";
                messageModel = new MessageModel(sendMessage: resultContent, isAdmin: false, code: MessageConstant.HELP);
            }
            // 记录用户操作数据
            DBHelperMySQL.addUserData(fromQQ, content, resultContent);
            return messageModel;
        }

19 View Source File : JsonData.cs
License : MIT License
Project Creator : 404Lcc

public bool Equals (JsonData x)
        {
            if (x == null)
                return false;

            if (x.type != this.type)
                return false;

            switch (this.type) {
            case JsonType.None:
                return true;

            case JsonType.Object:
                return this.inst_object.Equals (x.inst_object);

            case JsonType.Array:
                return this.inst_array.Equals (x.inst_array);

            case JsonType.String:
                return this.inst_string.Equals (x.inst_string);

            case JsonType.Int:
                return this.inst_int.Equals (x.inst_int);

            case JsonType.Long:
                return this.inst_long.Equals (x.inst_long);

            case JsonType.Double:
                return this.inst_double.Equals (x.inst_double);

            case JsonType.Boolean:
                return this.inst_boolean.Equals (x.inst_boolean);
            }

            return false;
        }

19 View Source File : LocalSteamController.cs
License : GNU General Public License v3.0
Project Creator : 00000vish

private  static void killSteam()
        {
            Process[] proc = Process.GetProcesses();
            foreach (Process item in proc)
            {
                if (item.ProcessName.ToLower().Equals("steam") || item.ProcessName.Equals("gameOverlayui"))
                {
                    item.Kill();
                }
            }
        }

19 View Source File : Solar.cs
License : MIT License
Project Creator : 6tail

public static List<Solar> fromBaZi(string yearGanZhi, string monthGanZhi, string dayGanZhi, string timeGanZhi, int sect, int baseYear)
        {
            sect = (1 == sect) ? 1 : 2;
            List<Solar> l = new List<Solar>();
            Solar today = new Solar();
            Lunar lunar = today.getLunar();
            int offsetYear = LunarUtil.getJiaZiIndex(lunar.getYearInGanZhiExact()) - LunarUtil.getJiaZiIndex(yearGanZhi);
            if (offsetYear < 0)
            {
                offsetYear = offsetYear + 60;
            }
            int startYear = today.getYear() - offsetYear;
            int hour = 0;
            string timeZhi = timeGanZhi.Substring(1);
            for (int i = 0, j = LunarUtil.ZHI.Length; i < j; i++)
            {
                if (LunarUtil.ZHI[i].Equals(timeZhi))
                {
                    hour = (i - 1) * 2;
                }
            }
            while (startYear >= baseYear)
            {
                int year = startYear - 1;
                int counter = 0;
                int month = 12;
                int day;
                bool found = false;
                while (counter < 15)
                {
                    if (year >= baseYear)
                    {
                        day = 1;
                        Solar solar = new Solar(year, month, day, hour, 0, 0);
                        lunar = solar.getLunar();
                        if (lunar.getYearInGanZhiExact().Equals(yearGanZhi) && lunar.getMonthInGanZhiExact().Equals(monthGanZhi))
                        {
                            found = true;
                            break;
                        }
                    }
                    month++;
                    if (month > 12)
                    {
                        month = 1;
                        year++;
                    }
                    counter++;
                }
                if (found)
                {
                    counter = 0;
                    month--;
                    if (month < 1)
                    {
                        month = 12;
                        year--;
                    }
                    day = 1;
                    Solar solar = new Solar(year, month, day, hour, 0, 0);
                    while (counter < 61)
                    {
                        lunar = solar.getLunar();
                        string dgz = (2 == sect) ? lunar.getDayInGanZhiExact2() : lunar.getDayInGanZhiExact();
                        if (lunar.getYearInGanZhiExact().Equals(yearGanZhi) && lunar.getMonthInGanZhiExact().Equals(monthGanZhi) && dgz.Equals(dayGanZhi) && lunar.getTimeInGanZhi().Equals(timeGanZhi))
                        {
                            l.Add(solar);
                            break;
                        }
                        solar = solar.next(1);
                        counter++;
                    }
                }
                startYear -= 60;
            }
            return l;
        }

19 View Source File : MiniPekka.cs
License : GNU General Public License v3.0
Project Creator : 1330-Studios

[HarmonyPrefix]
            public static bool Prefix(Factory __instance, string objectId, Il2CppSystem.Action<UnityDisplayNode> onComplete) {
                if (!protos.ContainsKey(objectId) && objectId.Equals("MiniPekka")) {
                    var udn = GetMiniPekka(__instance.PrototypeRoot);
                    udn.name = "MiniPekka";
                    onComplete.Invoke(udn);
                    protos.Add(objectId, udn);
                    return false;
                }
                if (!protos.ContainsKey(objectId) && objectId.Equals("MiniPekka1")) {
                    var udn = GetMiniPekka1(__instance.PrototypeRoot);
                    udn.name = "MiniPekka1";
                    onComplete.Invoke(udn);
                    protos.Add(objectId, udn);
                    return false;
                }
                if (!protos.ContainsKey(objectId) && objectId.Equals("MiniPekka2")) {
                    var udn = GetMiniPekka2(__instance.PrototypeRoot);
                    udn.name = "MiniPekka2";
                    onComplete.Invoke(udn);
                    protos.Add(objectId, udn);
                    return false;
                }
                if (!protos.ContainsKey(objectId) && objectId.Equals("MiniPekka3")) {
                    var udn = GetMiniPekka3(__instance.PrototypeRoot);
                    udn.name = "MiniPekka3";
                    onComplete.Invoke(udn);
                    protos.Add(objectId, udn);
                    return false;
                }
                if (!protos.ContainsKey(objectId) && objectId.Equals("MiniPekka4")) {
                    var udn = GetMiniPekka4(__instance.PrototypeRoot);
                    udn.name = "MiniPekka4";
                    onComplete.Invoke(udn);
                    protos.Add(objectId, udn);
                    return false;
                }
                if (!protos.ContainsKey(objectId) && objectId.Equals("MiniPekka5")) {
                    var udn = GetMiniPekka5(__instance.PrototypeRoot);
                    udn.name = "MiniPekka5";
                    onComplete.Invoke(udn);
                    protos.Add(objectId, udn);
                    return false;
                }

                if (protos.ContainsKey(objectId)) {
                    onComplete.Invoke(protos[objectId]);
                    return false;
                }

                return true;
            }

19 View Source File : KissManga.cs
License : GNU General Public License v3.0
Project Creator : 9vult

public override Chapter[] GetUpdates()
        {
            List<Chapter> result = new List<Chapter>();

            String[] dlc = GetDLChapters();
            bool doFullSetup = true;

            foreach (string chapterUrl in KissMangaHelper.GetChapterUrls(KissMangaHelper.KISS_URL + "/manga/" + mangaRoot.Name))
            {
                string[] urlSplits = chapterUrl.Split('/');
                string chapID = urlSplits[urlSplits.Length - 1];
                string chapNum = chapID.Substring(8); // remove "chapter_"
                if ((!doFullSetup) || (doFullSetup && dlc == null) || (doFullSetup && dlc[0].Equals("-1")) || (doFullSetup && dlc.Contains(chapNum)))
                {
                    if (!Directory.Exists(Path.Combine(mangaRoot.FullName, chapID)))
                    {
                        DirectoryInfo chapDir = FileHelper.CreateFolder(mangaRoot, chapID);
                        Chapter newchapter = new Chapter(chapDir, chapID, chapNum, doFullSetup);
                        chapters.Add(newchapter);
                        result.Add(newchapter);
                    }
                }
            }

            return result.ToArray();
        }

19 View Source File : AccountController.cs
License : GNU General Public License v3.0
Project Creator : 00000vish

public string getFriendsName(Friend input)
        {
            foreach (var item in friendArray)
            {
                Friend temp = (Friend)item;
                if (temp.steamFrindsID.Equals(input.steamFrindsID))
                {
                    return temp.name;

                }
            }
            return "";
        }

19 View Source File : FrmBrowser.cs
License : GNU General Public License v3.0
Project Creator : 9vult

private void BtnAdd_Click(object sender, EventArgs e)
        {
            string url = gfxBrowser.Url.ToString();
            string name = string.Empty;
            string num = string.Empty;
            switch (cmboSource.SelectedItem.ToString().ToLower())
            {
                case "mangadex":
                    name = url.Split('/')[5];
                    num = url.Split('/')[4];
                    url = MangaDexHelper.MANGADEX_URL + "/api/manga/" + num;

                    Manga m = new MangaDex(FileHelper.CreateDI(Path.Combine(FileHelper.APP_ROOT.FullName, num)), url);

                    FrmEdit editor = new FrmEdit(m, false);
                    DialogResult result = editor.ShowDialog();

                    if (result == DialogResult.OK)
                    {
                        // cleanup
                        foreach (Chapter ch in m.GetChapters())
                        {
                            try
                            {
                                string s = ch.GetChapterRoot().ToString();
                                Directory.Delete(ch.GetChapterRoot().ToString());
                            } catch (Exception) { }
                        }

                        WFClient.dbm.GetMangaDB().Add(m);

                        String[] dls = m.GetDLChapters();
                        if (dls == null || dls[0].Equals("-1"))
                        {
                            foreach (Chapter c in m.GetSetPrunedChapters(false))
                            {
                                WFClient.dlm.AddToQueue(new MangaDexDownload(c));
                            }
                        } else
                        {   // Only download selected chapters
                            foreach (Chapter c in m.GetSetPrunedChapters(false))
                            {
                                if (dls.Contains(c.GetNum()))
                                {
                                    WFClient.dlm.AddToQueue(new MangaDexDownload(c));
                                }
                            }
                        }
                        // Start downloading the first one
                        WFClient.dlm.DownloadNext();
                    } else
                    {

                    }
                    break;
                case "kissmanga":

                    // MessageBox.Show("Sorry, can't do this yet! ;(\n\n(ignore the download started box)");
                    // break;
                    // TODO

                    string kName = KissMangaHelper.GetName(url);
                    string kHash = KissMangaHelper.GetHash(url);

                    // Manga km = new Manga(FileHelper.CreateDI(Path.Combine(FileHelper.APP_ROOT.FullName, num)), url);

                    Manga km = new KissManga(FileHelper.CreateDI(Path.Combine(FileHelper.APP_ROOT.FullName, kHash)), url);

                    FrmEdit editor1 = new FrmEdit(km, false);
                    DialogResult result1 = editor1.ShowDialog();

                    if (result1 == DialogResult.OK)
                    {
                        // cleanup
                        foreach (Chapter ch in km.GetChapters())
                        {
                            try
                            {
                                string s = ch.GetChapterRoot().ToString();
                                Directory.Delete(ch.GetChapterRoot().ToString());
                            }
                            catch (Exception) { }
                        }

                        WFClient.dbm.GetMangaDB().Add(km);

                        String[] dls = km.GetDLChapters();
                        if (dls == null || dls[0].Equals("-1"))
                        {
                            foreach (Chapter c in km.GetSetPrunedChapters(false))
                            {
                                WFClient.dlm.AddToQueue(new KissMangaDownload(c));
                            }
                        }
                        else
                        {   // Only download selected chapters
                            foreach (Chapter c in km.GetSetPrunedChapters(false))
                            {
                                if (dls.Contains(c.GetNum()))
                                {
                                    WFClient.dlm.AddToQueue(new KissMangaDownload(c));
                                }
                            }
                        }
                        // Start downloading the first one
                        WFClient.dlm.DownloadNext();
                    }
                    else
                    {

                    }
                    break;
                case "nhentai": 
                    num = url.Split('/')[4];
                    name = gfxBrowser.Doreplacedentreplacedle.Substring(0, gfxBrowser.Doreplacedentreplacedle.IndexOf("nhentai:") - 3);

                    JObject hJson = new JObject(
                        new JProperty("hentai",
                            new JObject(
                                new JProperty("replacedle", name),
                                new JProperty("num",  num),
                                new JProperty("url",  url))));

                    DirectoryInfo hDir = FileHelper.CreateDI(Path.Combine(FileHelper.APP_ROOT.FullName, "h" + num));

                    Hentai h = new Nhentai(hDir, hJson.ToString());

                    FrmEdit edit = new FrmEdit(h, false);
                    DialogResult rezult = edit.ShowDialog();

                    if (rezult == DialogResult.OK)
                    {
                        WFClient.dbm.GetMangaDB().Add(h);

                        Chapter ch = h.GetChapters()[0];
                        WFClient.dlm.AddToQueue(new NhentaiDownload(ch));
                        // Start downloading the first one
                        WFClient.dlm.DownloadNext();
                    } 
                    break;
            }
            MessageBox.Show("Download started! You may close the browser at any time, but please keep MikuReader open until the download has completed.");
        }

19 View Source File : Venom.cs
License : GNU General Public License v3.0
Project Creator : 1330-Studios

[HarmonyPrefix]
            public static bool Prefix(Factory __instance, string objectId, Il2CppSystem.Action<UnityDisplayNode> onComplete) {
                if (!protos.ContainsKey(objectId) && objectId.Equals("Venom")) {
                    var udn = GetVenom(__instance.PrototypeRoot);
                    udn.name = "Venom";
                    udn.RecalculateGenericRenderers();
                    udn.isSprite = false;
                    onComplete.Invoke(udn);
                    protos.Add(objectId, udn);
                    return false;
                }
                if (!protos.ContainsKey(objectId) && objectId.Equals("AVenom")) {
                    var udn = GetAVenom(__instance.PrototypeRoot);
                    udn.name = "Anti-Venom";
                    udn.RecalculateGenericRenderers();
                    udn.isSprite = false;
                    onComplete.Invoke(udn);
                    protos.Add(objectId, udn);
                    return false;
                }

                if (protos.ContainsKey(objectId)) {
                    onComplete.Invoke(protos[objectId]);
                    return false;
                }

                return true;
            }

19 View Source File : Assets.cs
License : GNU General Public License v3.0
Project Creator : 1330-Studios

[HarmonyPrefix]
            public static bool Prefix(Factory __instance, string objectId, Il2CppSystem.Action<UnityDisplayNode> onComplete) {
                var replacedets = ShaderBundle.LoadAllreplacedets();

                using (var enumerator = allreplacedetsKnown.GetEnumerator()) {
                    while (enumerator.MoveNext()) {
                        var curreplacedet = enumerator.Current;
                        if (objectId.Equals(curreplacedet.CustomreplacedetName)) {
                            UnityDisplayNode udn = null;
                            __instance.FindAndSetupPrototypeAsync(curreplacedet.BTDreplacedetName,
                                new Action<UnityDisplayNode>(
                                    btdUdn => {
                                        var instance = Object.Instantiate(btdUdn, __instance.PrototypeRoot);
                                        instance.name = objectId + "(Clone)";
                                        if (curreplacedet.RendererType == RendererType.SPRITERENDERER)
                                            instance.isSprite = true;
                                        instance.RecalculateGenericRenderers();

                                        Type rendererType = null;
                                        switch (curreplacedet.RendererType) {
                                            case RendererType.MESHRENDERER:
                                                rendererType = Il2CppType.Of<MeshRenderer>();
                                                break;
                                            case RendererType.SPRITERENDERER:
                                                rendererType = Il2CppType.Of<SpriteRenderer>();
                                                break;
                                            case RendererType.SKINNEDMESHRENDERER:
                                                rendererType = Il2CppType.Of<SkinnedMeshRenderer>();
                                                break;
                                            case RendererType.PARTICLESYSTEMRENDERER:
                                                rendererType = Il2CppType.Of<ParticleSystemRenderer>();
                                                break;
                                        }

                                        if (rendererType == null && curreplacedet.RendererType != RendererType.SKINNEDANDUNSKINNEDMESHRENDERER)
                                            throw new NullReferenceException("rendererType is still null, don't leave things unset.");

                                        for (var i = 0; i < instance.genericRenderers.Length; i++) {
                                            if (instance.genericRenderers[i].GetIl2CppType() == rendererType) {
                                                if (curreplacedet.RendererType != RendererType.SPRITERENDERER && curreplacedet.RendererType != RendererType.SKINNEDANDUNSKINNEDMESHRENDERER && curreplacedet.RendererType != RendererType.PARTICLESYSTEMRENDERER) {
                                                    var renderer = instance.genericRenderers[i].Cast<Renderer>();
                                                    if (!SpecialShaderIndicies.ContainsKey(objectId))
                                                        renderer.material.shader = replacedets.First(a => a.name.StartsWith("Unlit/CelShading")).Cast<Shader>();
                                                    else
                                                        renderer.material.shader = replacedets.First(SpecialShaderIndicies[objectId]).Cast<Shader>();
                                                    renderer.material.SetColor("_OutlineColor", Color.black);
                                                    renderer.material.mainTexture = CacheBuilder.Get(objectId);
                                                } else if (curreplacedet.RendererType == RendererType.SPRITERENDERER) {
                                                    var spriteRenderer = instance.genericRenderers[i].Cast<SpriteRenderer>();
                                                    if (SpriteCreation.ContainsKey(objectId))
                                                        spriteRenderer.sprite = SpriteCreation[objectId](objectId);
                                                    else
                                                        spriteRenderer.sprite = SpriteBuilder.createProjectile(CacheBuilder.Get(objectId));
                                                    if (Types.ContainsKey(objectId)) {
                                                        spriteRenderer.gameObject.AddComponent(Types[objectId]);
                                                    }
                                                }
                                            } else if (curreplacedet.RendererType == RendererType.SKINNEDANDUNSKINNEDMESHRENDERER) {
                                                if (instance.genericRenderers[i].GetIl2CppType() == Il2CppType.Of<SkinnedMeshRenderer>()) {
                                                    var skinnedRenderer = instance.genericRenderers[i].Cast<SkinnedMeshRenderer>();
                                                    if (!SpecialShaderIndicies.ContainsKey(objectId))
                                                        skinnedRenderer.material.shader = replacedets.First(a => a.name.StartsWith("Unlit/CelShading")).Cast<Shader>();
                                                    else
                                                        skinnedRenderer.material.shader = replacedets.First(SpecialShaderIndicies[objectId]).Cast<Shader>();
                                                    skinnedRenderer.material.SetColor("_OutlineColor", Color.black);
                                                    skinnedRenderer.material.mainTexture = CacheBuilder.Get(objectId);

                                                } else if (instance.genericRenderers[i].GetIl2CppType() == Il2CppType.Of<MeshRenderer>()) {
                                                    var meshRenderer = instance.genericRenderers[i].Cast<MeshRenderer>();
                                                    if (!SpecialShaderIndicies.ContainsKey(objectId))
                                                        meshRenderer.material.shader = replacedets.First(a => a.name.StartsWith("Unlit/CelShading")).Cast<Shader>();
                                                    else
                                                        meshRenderer.material.shader = replacedets.First(SpecialShaderIndicies[objectId]).Cast<Shader>();
                                                    meshRenderer.material.SetColor("_OutlineColor", Color.black);
                                                    meshRenderer.material.mainTexture = CacheBuilder.Get(objectId);
                                                }
                                            }
                                        }


                                        if (Actions.ContainsKey(objectId))
                                            Actions[objectId](instance);

                                        udn = instance;
                                        onComplete.Invoke(udn);
                                    }));
                            return false;
                        }
                    }
                }

                if (objectId.Equals("UpgradedText")) {
                    UnityDisplayNode udn = null;
                    __instance.FindAndSetupPrototypeAsync("3dcdbc19136c60846ab944ada06695c0",
                        new Action<UnityDisplayNode>(oudn => {
                            var nudn = Object.Instantiate(oudn, __instance.PrototypeRoot);
                            nudn.name = objectId + "(Clone)";
                            nudn.isSprite = true;
                            nudn.RecalculateGenericRenderers();
                            var nktmp = nudn.GetComponentInChildren<NK_TextMeshPro>();
                            nktmp.m_fontColorGradient = new(Color.red, Color.red, new(255, 255, 0), Color.white);
                            nktmp.capitalize = false;
                            udn = nudn;
                            onComplete.Invoke(udn);
                        }));
                    return false;
                }

19 View Source File : AccountController.cs
License : GNU General Public License v3.0
Project Creator : 00000vish

public void updateChatLogs(Friend input, String mgs, bool outgoing)
        {
            foreach (var item in friendArray)
            {

                Friend temp = (Friend)item;
                if (temp.steamFrindsID.Equals(input.steamFrindsID))
                {
                    if (outgoing)
                    {
                        temp.newMessage("Me", mgs);
                    }
                    else
                    {
                        temp.newMessage(temp.name, mgs);
                    }

                }
            }
        }

19 View Source File : GroupBySqlBuilder.cs
License : MIT License
Project Creator : 17MKH

private string GetColumnName(MemberExpression memberExp)
        {
            /*
             * 通过比对分组表达式中成员名称与选择列的Key中的成员名称来判断使用的是哪一个实体
             * 分组表达式:m => new { m.replacedle }
             * 选择列表达式:
             * m => new
                {
                    Sum = m.Sum(n => n.Id),
                    m.Key.replacedle
                }
             */

            //获取查询列对应的实体
            var groupByExp = _queryBody.GroupBy.Body as NewExpression;
            for (var t = 0; t < groupByExp.Members.Count; t++)
            {
                if (groupByExp.Members[t].Name.Equals(memberExp.Member.Name))
                {
                    var groupByArg = groupByExp.Arguments[t];
                    string columnName;
                    switch (groupByArg.NodeType)
                    {
                        case ExpressionType.MemberAccess:
                            var memExp = groupByArg as MemberExpression;
                            columnName = _queryBody.GetColumnName(memExp);
                            if (memExp!.Expression!.Type.IsString())
                            {
                                return _queryBody.DbAdapter.FunctionMapper(memExp.Member.Name, columnName);
                            }
                            return columnName;
                        case ExpressionType.Call:
                            var callExp = groupByArg as MethodCallExpression;
                            columnName = _queryBody.GetColumnName(callExp!.Object);
                            var args = ExpressionResolver.Arguments2Object(callExp.Arguments);
                            return _dbAdapter.FunctionMapper(callExp.Method.Name, columnName, callExp.Object!.Type, args);
                        default:
                            throw new Exception("不支持的语法");
                    }

19 View Source File : DBHelperMySQL.cs
License : Apache License 2.0
Project Creator : 0nise

public static string GetContent(string sql,List<MySqlParameter> parameter,string content)
        {
            string resultStr = "";
            if (content == "" || "".Equals(content)|| content.Length == 0 || content == null) {
                content = "\n【文章】";
            }
            MySqlConnection connection = new MySqlConnection(Constants.connectionStr);
            try
            {
                connection.Open();
                MySqlCommand mySqlCommand = new MySqlCommand(sql,connection);
                // 添加参数
                if (parameter.Count > 0)
                {
                    mySqlCommand.Parameters.AddRange(parameter.ToArray());
                }
                // 提取数据
                MySqlDataReader myDataReader = mySqlCommand.ExecuteReader();
                while (myDataReader.Read()==true)
                {
                    string tmpStr = content + myDataReader["replacedle"]+"\n"+ myDataReader["url"]+"\n";
                    resultStr += tmpStr;
                }
                myDataReader.Close();
            }
            catch (Exception e)
            {
                throw e;
            }
            finally {
                connection.Close();
            }
            return resultStr;
        }

19 View Source File : Config.cs
License : GNU General Public License v3.0
Project Creator : 2dust

public int GetLocalPort(string protocol)
        {
            if (protocol == Global.InboundHttp)
            {
                return GetLocalPort(Global.InboundSocks) + 1;
            }

            else if (protocol == "speedtest")
            {
                return GetLocalPort(Global.InboundSocks) + 103;
            }

            int localPort = 0;
            foreach (InItem inItem in inbound)
            {
                if (inItem.protocol.Equals(protocol))
                {
                    localPort = inItem.localPort;
                    break;
                }
            }
            return localPort;
        }

19 View Source File : TextEditorForm.cs
License : Apache License 2.0
Project Creator : 214175590

private void TextEditorForm_FormClosing(object sender, FormClosingEventArgs e)
        {
            try
            {
                if (ischange)
                {
                    string content = editor.Text;
                    if (!content.Equals(org_content))
                    {
                        YSTools.YSFile.writeFileByString(local_file, content);

                        if (mode == "remote")
                        {
                            shellForm.RunSftpShell("put", local_file, remote_file, false, false);
                        }
                    }
                }
            }
            catch { }
            File.Delete(local_file);
        }

19 View Source File : DBHelperMySQL.cs
License : Apache License 2.0
Project Creator : 0nise

public static bool isSuperAdmin(string qq) {
            string sql = "SELECT is_admin FROM ichunqiu_admin WHERE qq = @qq ";
            var parameter = new List<MySqlParameter>();
            parameter.Add(new MySqlParameter("@qq", qq));
            MySqlConnection connection = null;
            bool flag = false;
            try
            {
                connection = ConnectionPool.getPool().getConnection();
                while (connection == null)
                {

                }
                using (MySqlCommand cmd = new MySqlCommand(sql,connection))
                {
                    using (MySqlDataReader myReader = cmd.ExecuteReader())
                    {
                        while (myReader.Read() == true)
                        {
                            if ("1".Equals(myReader["is_admin"].ToString()))
                            {
                                flag = true;
                            }
                        }
                    }
                }
            }
            catch (Exception)
            {
                flag = false;
            }
            finally
            {
                if (connection != null)
                {
                    connection.Close();
                }
                // 关闭数据库链接
                ConnectionPool.getPool().closeConnection(connection);
            }
            return flag;
        }

19 View Source File : Utils.cs
License : GNU General Public License v3.0
Project Creator : 2dust

public static bool IsAutoRun()
        {
            try
            {
                string value = RegReadValue(autoRunRegPath, autoRunName, "");
                string exePath = GetExePath();
                if (value?.Equals(exePath) == true || value?.Equals($"\"{exePath}\"") == true)
                {
                    return true;
                }
            }
            catch (Exception ex)
            {
                SaveLog(ex.Message, ex);
            }
            return false;
        }

19 View Source File : GetInput.xaml.cs
License : GNU General Public License v3.0
Project Creator : 00000vish

private void PreplacedwordBox1_KeyDown(object sender, System.Windows.Input.KeyEventArgs e)
        {
            if (e.Key.ToString().Equals("Return"))
            {
                givenInput = true;
            }
        }

19 View Source File : MainWindow.xaml.cs
License : MIT License
Project Creator : 3RD-Dimension

private void Default_SettingChanging(object sender, System.Configuration.SettingChangingEventArgs e)
		{
			if (e.SettingName.Equals("JogFeed") ||
				e.SettingName.Equals("JogDistance") ||
				e.SettingName.Equals("ProbeFeed") ||
				e.SettingName.Equals("ProbeSafeHeight") ||
				e.SettingName.Equals("ProbeMaxDepth") ||
				e.SettingName.Equals("SplitSegmentLength") ||
				e.SettingName.Equals("ViewportArcSplit") ||
				e.SettingName.Equals("ArcToLineSegmentLength") ||
				e.SettingName.Equals("ConsoleFadeTime"))
			{
				if (((double)e.NewValue) <= 0)
					e.Cancel = true;
			}

			if (e.SettingName.Equals("SerialPortBaud") ||
				e.SettingName.Equals("StatusPollInterval") ||
				e.SettingName.Equals("ControllerBufferSize"))
			{
				if (((int)e.NewValue) <= 0)
					e.Cancel = true;
			}
		}

19 View Source File : DBHelperMySQL.cs
License : Apache License 2.0
Project Creator : 0nise

public static string updateBlank(string qq, decimal money,string operation)
        {
            string resultStr = "";
            string sql = "UPDATE ichunqiu_blank SET user_money = user_money - @user_money WHERE user_qq [email protected] ";
            // 加钱
            if ("1".Equals(operation))
            {
                sql = "UPDATE ichunqiu_blank SET user_money = user_money + @user_money WHERE user_qq [email protected] ";
            }
            else
            {
                string tmpMoney = getBlankMoney(qq);
                if (tmpMoney != null && tmpMoney.Length > 0)
                {
                    if (Convert.ToDecimal(tmpMoney) < money)
                    {
                        return "提现金额必须小于存款金额。";
                    }
                }
                else
                {
                    return "没有该作家!";
                }
            }
            var parameter = new List<MySqlParameter>();
            parameter.Add(new MySqlParameter("@user_money", money));
            parameter.Add(new MySqlParameter("@qq", qq));
            MySqlConnection connection = null;
            try
            {
                connection = ConnectionPool.getPool().getConnection();
                while (connection == null)
                {

                }
                using (MySqlCommand mySqlCommand = new MySqlCommand(sql, connection))
                {
                    // 添加参数
                    if (parameter.Count > 0)
                    {
                        mySqlCommand.Parameters.AddRange(parameter.ToArray());
                    }
                    // 提取数据
                    int count = mySqlCommand.ExecuteNonQuery();
                    // 执行数据插入
                    int flagCount = inserMoneyHistory(qq, money, operation);
                    if (count > 0 && flagCount > 0)
                    {
                        resultStr = "更新成功!";
                    }
                    else
                    {
                        resultStr = "更新失败!";
                    }
                }
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                if (connection != null)
                {
                    connection.Close();
                }
                // 关闭数据库链接
                ConnectionPool.getPool().closeConnection(connection);
            }
            return resultStr;
        }

19 View Source File : HotKeys.cs
License : MIT License
Project Creator : 3RD-Dimension

public static void UpdateHotkey(string keyfunction, string newSetting)
        {
            var root = new XmlDoreplacedent();
            root.Load(@HotKeyFile);

            foreach (XmlNode e in root.GetElementsByTagName("bind"))
            {
                if (e.Attributes["keyfunction"].Value.Equals(keyfunction))
                {
                    e.Attributes["keycode"].Value = newSetting; // FirstChild because the inner node is actually the inner text, yeah XmlNode is weird.
                    MainWindow.Logger.Info($"Added Keycode {newSetting} for KeyFunction {keyfunction}");
                    break;
                }
            }
            root.Save(@HotKeyFile);
        }

19 View Source File : AccountController.cs
License : GNU General Public License v3.0
Project Creator : 00000vish

public void setFriendsName(Friend input)
        {
            foreach (var item in friendArray)
            {

                Friend temp = (Friend)item;
                if (temp.steamFrindsID.Equals(input.steamFrindsID))
                {
                    temp.name = input.name;

                }
            }
        }

19 View Source File : LiuYue.cs
License : MIT License
Project Creator : 6tail

public string getGanZhi()
        {
            int offset = 0;
            string yearGan = liuNian.getGanZhi().Substring(0, 1);
            if ("甲".Equals(yearGan) || "己".Equals(yearGan))
            {
                offset = 2;
            }
            else if ("乙".Equals(yearGan) || "庚".Equals(yearGan))
            {
                offset = 4;
            }
            else if ("丙".Equals(yearGan) || "辛".Equals(yearGan))
            {
                offset = 6;
            }
            else if ("丁".Equals(yearGan) || "壬".Equals(yearGan))
            {
                offset = 8;
            }
            string gan = LunarUtil.GAN[(index + offset) % 10 + 1];
            string zhi = LunarUtil.ZHI[(index + LunarUtil.BASE_MONTH_ZHI_INDEX) % 12 + 1];
            return gan + zhi;
        }

19 View Source File : Grim_Reaper.cs
License : GNU General Public License v3.0
Project Creator : 1330-Studios

[HarmonyPrefix]
        public static bool Prefix(Factory __instance, string objectId, Il2CppSystem.Action<UnityDisplayNode> onComplete) {
            if (!protos.ContainsKey(objectId)) {
                if (objectId.Equals("GrimReaper0")) {
                    UnityDisplayNode udn = null;
                    __instance.FindAndSetupPrototypeAsync("191cc21b4fb5dfa4ba4b81565d2a5d4c", new Action<UnityDisplayNode>(btdUdn => {
                        var instance = Object.Instantiate(btdUdn, __instance.PrototypeRoot);
                        instance.name = objectId + "(Clone)";
                        instance.RecalculateGenericRenderers();
                        foreach (Renderer r in instance.genericRenderers)
                            try {
                                r.material.mainTexture = LoadTextureFromBytes(Properties.Resources.GrimReaper0);
                            } catch {
                                MelonLogger.Error("You Suck! " + objectId);
                            }

                        udn = instance;
                        onComplete.Invoke(udn);
                    }));
                    return false;
                }
                if (objectId.Equals("GrimReaper1")) {
                    UnityDisplayNode udn = null;
                    __instance.FindAndSetupPrototypeAsync("191cc21b4fb5dfa4ba4b81565d2a5d4c", new Action<UnityDisplayNode>(btdUdn => {
                        var instance = Object.Instantiate(btdUdn, __instance.PrototypeRoot);
                        instance.name = objectId + "(Clone)";
                        instance.RecalculateGenericRenderers();
                        foreach (Renderer r in instance.genericRenderers)
                            if (r.name.Contains("SpookyFarmer"))
                                try {
                                    r.material.mainTexture = LoadTextureFromBytes(Properties.Resources.GrimReaper1);
                                } catch {
                                    MelonLogger.Error("You Suck! " + objectId);
                                }

                        udn = instance;
                    }));
                    udn.name = objectId;
                    onComplete.Invoke(udn);
                    protos.Add(objectId, udn);
                    return false;
                }
                if (objectId.Equals("GrimReaper2")) {
                    UnityDisplayNode udn = null;
                    __instance.FindAndSetupPrototypeAsync("191cc21b4fb5dfa4ba4b81565d2a5d4c", new Action<UnityDisplayNode>(btdUdn => {
                        var instance = Object.Instantiate(btdUdn, __instance.PrototypeRoot);
                        instance.name = objectId + "(Clone)";
                        instance.RecalculateGenericRenderers();
                        foreach (Renderer r in instance.genericRenderers)
                            if (r.name.Contains("SpookyFarmer"))
                                try {
                                    r.material.mainTexture = LoadTextureFromBytes(Properties.Resources.GrimReaper2);
                                } catch {
                                    MelonLogger.Error("You Suck! " + objectId);
                                }

                        udn = instance;
                    }));
                    udn.name = objectId;
                    onComplete.Invoke(udn);
                    protos.Add(objectId, udn);
                    return false;
                }
                if (objectId.Equals("GrimReaper3")) {
                    UnityDisplayNode udn = null;
                    __instance.FindAndSetupPrototypeAsync("191cc21b4fb5dfa4ba4b81565d2a5d4c", new Action<UnityDisplayNode>(btdUdn => {
                        var instance = Object.Instantiate(btdUdn, __instance.PrototypeRoot);
                        instance.name = objectId + "(Clone)";
                        instance.RecalculateGenericRenderers();
                        foreach (Renderer r in instance.genericRenderers)
                            if (r.name.Contains("SpookyFarmer"))
                                try {
                                    r.material.mainTexture = LoadTextureFromBytes(Properties.Resources.GrimReaper3);
                                } catch {
                                    MelonLogger.Error("You Suck! " + objectId);
                                }

                        udn = instance;
                    }));
                    udn.name = objectId;
                    onComplete.Invoke(udn);
                    protos.Add(objectId, udn);
                    return false;
                }
                if (objectId.Equals("GrimReaper4")) {
                    UnityDisplayNode udn = null;
                    __instance.FindAndSetupPrototypeAsync("191cc21b4fb5dfa4ba4b81565d2a5d4c", new Action<UnityDisplayNode>(btdUdn => {
                        var instance = Object.Instantiate(btdUdn, __instance.PrototypeRoot);
                        instance.name = objectId + "(Clone)";
                        instance.RecalculateGenericRenderers();
                        foreach (Renderer r in instance.genericRenderers)
                            if (r.name.Contains("SpookyFarmer"))
                                try {
                                    r.material.mainTexture = LoadTextureFromBytes(Properties.Resources.GrimReaper4);
                                } catch {
                                    MelonLogger.Error("You Suck! " + objectId);
                                }

                        udn = instance;
                    }));
                    udn.name = objectId;
                    onComplete.Invoke(udn);
                    protos.Add(objectId, udn);
                    return false;
                }
                if (objectId.Equals("GrimReaper5")) {
                    UnityDisplayNode udn = null;
                    __instance.FindAndSetupPrototypeAsync("191cc21b4fb5dfa4ba4b81565d2a5d4c", new Action<UnityDisplayNode>(btdUdn => {
                        var instance = Object.Instantiate(btdUdn, __instance.PrototypeRoot);
                        instance.name = objectId + "(Clone)";
                        instance.RecalculateGenericRenderers();
                        foreach (Renderer r in instance.genericRenderers)
                            if (r.name.Contains("SpookyFarmer"))
                                try {
                                    r.material.mainTexture = LoadTextureFromBytes(Properties.Resources.GrimReaper5);
                                } catch {
                                    MelonLogger.Error("You Suck! " + objectId);
                                }

                        udn = instance;
                    }));
                    udn.name = objectId;
                    onComplete.Invoke(udn);
                    protos.Add(objectId, udn);
                    return false;
                }
            }

            if (protos.ContainsKey(objectId)) {
                onComplete.Invoke(protos[objectId]);
                return false;
            }

            return true;
        }

19 View Source File : Solar.cs
License : MIT License
Project Creator : 6tail

public Solar next(int days, bool onlyWorkday)
        {
            DateTime c = ExactDate.fromYmdHms(year, month, day, hour, minute, second);
            if (0 != days)
            {
                if (!onlyWorkday)
                {
                    c = c.AddDays(days);
                }
                else
                {
                    int rest = Math.Abs(days);
                    int add = days < 1 ? -1 : 1;
                    while (rest > 0)
                    {
                        c = c.AddDays(add);
                        bool work = true;
                        Holiday holiday = HolidayUtil.getHoliday(c.Year, c.Month, c.Day);
                        if (null == holiday)
                        {
                            string week = c.DayOfWeek.ToString("d");
                            if ("0".Equals(week)||"6".Equals(week))
                            {
                                work = false;
                            }
                        }
                        else
                        {
                            work = holiday.isWork();
                        }
                        if (work)
                        {
                            rest--;
                        }
                    }
                }
            }
            return new Solar(c);
        }

19 View Source File : Settings.xaml.cs
License : GNU General Public License v3.0
Project Creator : 00000vish

private void updateGUI()
        {
            comboBoxLogin.Items.Clear();
            Forward2.IsChecked = SteamTwoProperties.jsonSetting.forwardCheckSetting;
            enableChat.IsChecked = SteamTwoProperties.jsonSetting.chatSetting;
            autoStart.IsChecked = SteamTwoProperties.jsonSetting.autoStartSetting;
            autoLogin.IsChecked = SteamTwoProperties.jsonSetting.autoLoginSetting;
            badAttempt.IsChecked = SteamTwoProperties.jsonSetting.badAttemptSetting;
            multipleBots.IsChecked = SteamTwoProperties.jsonSetting.multipleBotSetting;
            copyPreplacedword.IsChecked = SteamTwoProperties.jsonSetting.copyPreplacedwordSetting;
            closeStemLaunch.IsChecked = SteamTwoProperties.jsonSetting.closeStemLaunchSetting;
            autoAddFriends.IsChecked = SteamTwoProperties.jsonSetting.autoAddFriendSetting;
            enableEncryption.IsChecked = SteamTwoProperties.jsonSetting.encryptedSetting;
            changeKey.IsEnabled = SteamTwoProperties.jsonSetting.encryptedSetting;
            chatCommand.IsEnabled = SteamTwoProperties.jsonSetting.chatComSetting;
            chatCommandButton.IsChecked = SteamTwoProperties.jsonSetting.chatComSetting;
            notifyOnMessage.IsChecked = SteamTwoProperties.jsonSetting.notifyOnMessageSetting;
            SteamLink.Content = SteamTwoProperties.jsonSetting.steamLocation;
            if (SteamTwoProperties.jsonSetting.SDALinkSetting.Equals(""))
            {
                Link.Content = "Link";
            }
            else
            {
                Link.Content = "Linked";
            }
            foreach (var item in AccountController.userAccounts)
            {
                UserAccount acc = (UserAccount)item;
                comboBoxLogin.Items.Add(acc.username);
            }
            comboBoxLogin.Text = SteamTwoProperties.jsonSetting.selectedAccountSetting;
            if (!SteamTwoProperties.jsonSetting.forwardSetting.Equals(""))
            {
                Forward.Content = SteamTwoProperties.jsonSetting.forwardSetting;
            }
            else
            {
                Forward.Content = "No one";
            }
        }

19 View Source File : KissManga.cs
License : GNU General Public License v3.0
Project Creator : 9vult

public override Chapter[] GetSetPrunedChapters(bool overrideDlc)
        {
            chapters.Clear();
            
            List<Chapter> result = new List<Chapter>();

            String[] dlc = GetDLChapters();
            bool doFullSetup;

            if (!overrideDlc)
            {
                doFullSetup = true;
            }
            else // override
            {
                doFullSetup = false;
            }

            foreach (string chapterUrl in KissMangaHelper.GetChapterUrls(KissMangaHelper.KISS_URL + "/manga/" + mangaRoot.Name))
            {
                string[] urlSplits = chapterUrl.Split('/');
                string chapID = urlSplits[urlSplits.Length - 1];
                string chapNum = chapID.Substring(8); // remove "chapter_"
                if ((!doFullSetup) || (doFullSetup && dlc == null) || (doFullSetup && dlc[0].Equals("-1")) || (doFullSetup && dlc.Contains(chapNum)))
                {                    
                    DirectoryInfo chapDir = null; // Only create folder if doing full setup
                    if (doFullSetup)
                        chapDir = FileHelper.CreateFolder(mangaRoot, chapID);
                    Chapter newchapter = new Chapter(chapDir, chapID, chapNum, doFullSetup);
                    chapters.Add(newchapter);
                    result.Add(newchapter);
                }
            }

            chapters = result;
            return result.ToArray();
        }

19 View Source File : Carnage.cs
License : GNU General Public License v3.0
Project Creator : 1330-Studios

[HarmonyPrefix]
            public static bool Prefix(Factory __instance, string objectId, Il2CppSystem.Action<UnityDisplayNode> onComplete) {
                if (!protos.ContainsKey(objectId) && objectId.Equals("CarnageMax")) {
                    var udn = GetCarnageMax(__instance.PrototypeRoot);
                    udn.name = "CarnageMax";
                    udn.RecalculateGenericRenderers();
                    udn.isSprite = false;
                    onComplete.Invoke(udn);
                    protos.Add(objectId, udn);
                    return false;
                }
                if (!protos.ContainsKey(objectId) && objectId.Equals("Carnage")) {
                    var udn = GetCarnage(__instance.PrototypeRoot);
                    udn.name = "Carnage";
                    udn.RecalculateGenericRenderers();
                    udn.isSprite = false;
                    onComplete.Invoke(udn);
                    protos.Add(objectId, udn);
                    return false;
                }
                if (!protos.ContainsKey(objectId) && objectId.Equals("CarnageLG")) {
                    var udn = GetCarnageLG(__instance.PrototypeRoot);
                    udn.name = "CarnageLG";
                    udn.RecalculateGenericRenderers();
                    udn.isSprite = false;
                    onComplete.Invoke(udn);
                    protos.Add(objectId, udn);
                    return false;
                }

                if (objectId.Equals("CarnageSpike")) {
                    UnityDisplayNode udn = null;
                    __instance.FindAndSetupPrototypeAsync("bdbeaa256e6c63b45829535831843376",
                        new Action<UnityDisplayNode>(oudn => {
                            var nudn = Object.Instantiate(oudn, __instance.PrototypeRoot);
                            nudn.name = objectId + "(Clone)";
                            nudn.isSprite = true;
                            nudn.RecalculateGenericRenderers();
                            for (var i = 0; i < nudn.genericRenderers.Length; i++) {
                                if (nudn.genericRenderers[i].GetIl2CppType() == Il2CppType.Of<SpriteRenderer>()) {
                                    var smr = nudn.genericRenderers[i].Cast<SpriteRenderer>();
                                    var text = replacedets.Loadreplacedet("CarnageSpike").Cast<Texture2D>();
                                    smr.sprite = Sprite.Create(text, new(0, 0, text.width, text.height), new(0.5f, 0.5f), 22.5f);
                                    nudn.genericRenderers[i] = smr;
                                }
                            }

19 View Source File : MangaDex.cs
License : GNU General Public License v3.0
Project Creator : 9vult

public override Chapter[] GetSetPrunedChapters(bool overrideDlc)
        {
            chapters.Clear();
            List<Chapter> result = new List<Chapter>();
            string jsonText = MangaDexHelper.GetMangaJSON(id);
            JObject jobj = JObject.Parse(jsonText);

            String[] dlc = GetDLChapters();
            bool doFullSetup;

            if (!overrideDlc)
            {
                doFullSetup = true;
            }
            else // override
            {
                doFullSetup = false;
            }

            foreach (JProperty p in jobj["chapter"])
            {
                JToken value = p.Value;
                if (value.Type == JTokenType.Object)
                {
                    JObject o = (JObject)value;
                    string chapNum = (String)o["chapter"];
                    if (usergroup == "^any-group")
                    {
                        if (((string)o["lang_code"]).Equals(userlang))
                        {
                            if ((!doFullSetup) || (doFullSetup && dlc == null) || (doFullSetup && dlc[0].Equals("-1")) || (doFullSetup && dlc.Contains(chapNum)))
                            {
                                string chapID = ((JProperty)value.Parent).Name;
                                DirectoryInfo chapDir = null; // Only create folder if doing full setup
                                if (doFullSetup)
                                    chapDir = FileHelper.CreateFolder(mangaRoot, chapID);
                                Chapter newchapter = new Chapter(chapDir, chapID, chapNum, doFullSetup);
                                chapters.Add(newchapter);
                                result.Add(newchapter);
                            }
                        }
                    }
                    else
                    {
                        if (((string)o["lang_code"]).Equals(userlang) && ((string)o["group_name"]).Equals(usergroup))
                        {
                            if ((!doFullSetup) || (doFullSetup && dlc == null) || (doFullSetup && dlc[0].Equals("-1")) || (doFullSetup && dlc.Contains(chapNum)))
                            {
                                string chapID = ((JProperty)value.Parent).Name;
                                DirectoryInfo chapDir = FileHelper.CreateFolder(mangaRoot, chapID);
                                Chapter newchapter = new Chapter(chapDir, chapID, chapNum, doFullSetup);
                                chapters.Add(newchapter);
                                result.Add(newchapter);
                            }
                        }
                    }

                }
            }
            chapters = result;
            return result.ToArray(); 
        }

19 View Source File : AccountController.cs
License : GNU General Public License v3.0
Project Creator : 00000vish

public static UserAccount getAccount(String username)
        {
            foreach (var item in userAccounts)
            {
                UserAccount temp = (UserAccount)item;
                if (temp.username.ToLower().Equals(username.ToLower()))
                {
                    return temp;
                }
            }
            return null;
        }

19 View Source File : MangaDex.cs
License : GNU General Public License v3.0
Project Creator : 9vult

public override string[] GetGroups(string langCode)
        {
            List<string> result = new List<string>();
            string jsonText = MangaDexHelper.GetMangaJSON(MangaDexHelper.GetMangaUrl(GetID()));
            JObject jobj = JObject.Parse(jsonText);

            foreach (JProperty p in jobj["chapter"])
            {
                JToken value = p.Value;
                if (value.Type == JTokenType.Object)
                {
                    JObject o = (JObject)value;
                    if (((string)o["lang_code"]).Equals(langCode))
                    {
                        string groupName = (String)o["group_name"];
                        if (!result.Contains(groupName))
                        {
                            result.Add(groupName);
                        }
                    }
                }
            }
            return result.ToArray();
        }

19 View Source File : SpiderMan.cs
License : GNU General Public License v3.0
Project Creator : 1330-Studios

[HarmonyPrefix]
            public static bool Prefix(Factory __instance, string objectId, Il2CppSystem.Action<UnityDisplayNode> onComplete) {
                if (!protos.ContainsKey(objectId) && objectId.Equals("SpiderMan3")) {
                    var udn = GetSpiderManBGS(__instance.PrototypeRoot);
                    udn.name = "SpiderManBGS";
                    udn.RecalculateGenericRenderers();
                    udn.isSprite = false;
                    for (int mI = 0; mI < 9; mI++) {
                        var m = replacedets.Loadreplacedet($"BGS{mI + 1}").Cast<Material>();
                        udn.genericRenderers[mI].material = m ?? throw new Exception($"Cry :cry: {mI}");
                    }
                    onComplete.Invoke(udn);
                    protos.Add(objectId, udn);
                    return false;
                }
                if (!protos.ContainsKey(objectId) && objectId.Equals("SpiderMan2")) {
                    var udn = GetSpiderManFFH(__instance.PrototypeRoot);
                    udn.name = "SpiderManFFH";
                    udn.RecalculateGenericRenderers();
                    udn.isSprite = false;
                    for (int mI = 0; mI < 6; mI++) {
                        var m = replacedets.Loadreplacedet("FFHM").Cast<Material>();
                        if (udn.genericRenderers[mI].material.name.Contains("Material37"))
                            m = replacedets.Loadreplacedet("FFMH2").Cast<Material>();
                        udn.genericRenderers[mI].material = m ?? throw new Exception($"Cry :cry: {mI}");
                    }
                    onComplete.Invoke(udn);
                    protos.Add(objectId, udn);
                    return false;
                }
                if (!protos.ContainsKey(objectId) && objectId.Equals("SpiderMan1")) {
                    var udn = GetSpiderManIS(__instance.PrototypeRoot);
                    udn.name = "SpiderManIS";
                    udn.RecalculateGenericRenderers();
                    udn.isSprite = false;
                    for (int mI = 0; mI < 1; mI++) {
                        var m = replacedets.Loadreplacedet("ISM").Cast<Material>();
                        udn.genericRenderers[mI].material = m ?? throw new Exception($"Cry :cry: {mI}");
                    }
                    onComplete.Invoke(udn);
                    protos.Add(objectId, udn);
                    return false;
                }
                if (!protos.ContainsKey(objectId) && objectId.Equals("SpiderMan")) {
                    var udn = GetSpiderManFFH(__instance.PrototypeRoot);
                    udn.name = "SpiderManCW";
                    udn.RecalculateGenericRenderers();
                    udn.isSprite = false;
                    for (int mI = 0; mI < 6; mI++) {
                        var m = replacedets.Loadreplacedet("CWM").Cast<Material>();
                        if (udn.genericRenderers[mI].material.name.Contains("Material37"))
                            m = replacedets.Loadreplacedet("FFMH2").Cast<Material>();
                        udn.genericRenderers[mI].material = m ?? throw new Exception($"Cry :cry: {mI}");
                    }
                    onComplete.Invoke(udn);
                    protos.Add(objectId, udn);
                    return false;
                }

                if (protos.ContainsKey(objectId)) {
                    onComplete.Invoke(protos[objectId]);
                    return false;
                }

                return true;
            }

19 View Source File : steamChatWindow.xaml.cs
License : GNU General Public License v3.0
Project Creator : 00000vish

private void textbox1_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.Key.ToString().Equals("Return"))
            {
                sendMessage();
                textbox1.Text = "";
            }
        }

19 View Source File : AccountController.cs
License : GNU General Public License v3.0
Project Creator : 00000vish

public static void addAccount(String paraUsername, String paraPreplacedword, bool paraDesktopAuth)
        {
            bool found = false;
            foreach (var item in userAccounts)
            {
                UserAccount temp = (UserAccount)item;
                if (temp.username.ToLower().Equals(paraUsername.ToLower()))
                {
                    found = true;
                }
            }
            if (!found)
            {
                userAccounts.Add(new UserAccount { username = paraUsername, preplacedword = paraPreplacedword, desktopAuth = paraDesktopAuth });
            }
        }

19 View Source File : AccountController.cs
License : GNU General Public License v3.0
Project Creator : 00000vish

public void AddFriend(Friend item)
        {
            bool found = false;
            foreach (Friend var in friendArray)
            {
                Friend temp = (Friend)var;
                if (temp.steamFrindsID.ToLower().Equals(item.steamFrindsID.ToLower()))
                {
                    found = true;
                }
            }
            if (!found)
            {                
                friendArray.Add(item);
            }                
        }

19 View Source File : GetInput.xaml.cs
License : GNU General Public License v3.0
Project Creator : 00000vish

private void textBox1_KeyDown(object sender, System.Windows.Input.KeyEventArgs e)
        {
            if (e.Key.ToString().Equals("Return"))
            {
                givenInput = true;
            }
        }

19 View Source File : DBHelperMySQL.cs
License : Apache License 2.0
Project Creator : 0nise

public static string GetContent(string sql, List<MySqlParameter> parameter, string content)
        {
            string resultStr = "";
            if (content == "" || "".Equals(content) || content.Length == 0 || content == null)
            {
                content = "\n【文章】";
            }
            MySqlConnection connection = null;
            try
            {
                connection = ConnectionPool.getPool().getConnection();
                using (MySqlCommand mySqlCommand = new MySqlCommand(sql, connection))
                {
                    // 添加参数
                    if (parameter.Count > 0)
                    {
                        mySqlCommand.Parameters.AddRange(parameter.ToArray());
                    }
                    // 提取数据
                    using (MySqlDataReader myDataReader = mySqlCommand.ExecuteReader())
                    {
                        while (myDataReader.Read() == true)
                        {
                            string tmpStr = content + myDataReader["replacedle"] + "\n" + myDataReader["url"] + "\n";
                            resultStr += tmpStr;
                        }
                    }
                }
            }
            catch (Exception e)
            {
                throw e;
            }
            finally
            {
                if (connection != null)
                {
                    connection.Close();
                }
                // 关闭数据库链接
                ConnectionPool.getPool().closeConnection(connection);
            }
            return resultStr;
        }

19 View Source File : AddServer5Form.cs
License : GNU General Public License v3.0
Project Creator : 2dust

private void SetHeaderType()
        {
            cmbHeaderType.Items.Clear();

            string network = cmbNetwork.Text;
            if (Utils.IsNullOrEmpty(network))
            {
                cmbHeaderType.Items.Add(Global.None);
                return;
            }

            if (network.Equals(Global.DefaultNetwork))
            {
                cmbHeaderType.Items.Add(Global.None);
                cmbHeaderType.Items.Add(Global.TcpHeaderHttp);
            }
            else if (network.Equals("kcp") || network.Equals("quic"))
            {
                cmbHeaderType.Items.Add(Global.None);
                cmbHeaderType.Items.Add("srtp");
                cmbHeaderType.Items.Add("utp");
                cmbHeaderType.Items.Add("wechat-video");
                cmbHeaderType.Items.Add("dtls");
                cmbHeaderType.Items.Add("wireguard");
            }
            else if (network.Equals("grpc"))
            {
                cmbHeaderType.Items.Add(Global.GrpcgunMode);
                cmbHeaderType.Items.Add(Global.GrpcmultiMode);
            }
            else
            {
                cmbHeaderType.Items.Add(Global.None);
            }
            cmbHeaderType.SelectedIndex = 0;
        }

See More Examples