public static void ReportIssue(Mod mod, string issueTitle, string issueBody, Action <string> onSuccess, Action <Exception, string> onError, Action onCompletion = null)
        {
            if (!ModFeaturesHelpers.HasGithub(mod))
            {
                throw new HamstarException("Mod is not eligable for submitting issues.");
            }

            int maxLines = ModHelpersMod.Instance.Config.ModIssueReportErrorLogMaxLines;

            IEnumerable <Mod> mods       = ModListHelpers.GetAllLoadedModsPreferredOrder();
            string            bodyInfo   = string.Join("\n \n", InfoHelpers.GetGameData(mods).ToArray());
            string            bodyErrors = string.Join("\n", InfoHelpers.GetErrorLog(maxLines).ToArray());

            string url   = "http://hamstar.pw/hamstarhelpers/issue_submit/";
            string title = "Reported from in-game: " + issueTitle;
            string body  = bodyInfo;

            body += "\n \n \n \n" + "Recent error logs:\n```\n" + bodyErrors + "\n```";
            body += "\n \n" + issueBody;

            var json = new GithubModIssueReportData {
                githubuser    = ModFeaturesHelpers.GetGithubUserName(mod),
                githubproject = ModFeaturesHelpers.GetGithubProjectName(mod),
                title         = title,
                body          = body
            };
            string jsonStr = JsonConvert.SerializeObject(json, Formatting.Indented);

            byte[] jsonBytes = Encoding.UTF8.GetBytes(jsonStr);

            Action <String> onResponse = (output) => {
                JObject respJson = JObject.Parse(output);
                //JToken data = respJson.SelectToken( "Data.html_url" );
                JToken msg = respJson.SelectToken("Msg");

                /*if( data != null ) {
                 *      string post_at_url = data.ToObject<string>();
                 *      if( !string.IsNullOrEmpty( post_at_url ) ) {
                 *              SystemHelpers.Start( post_at_url );
                 *      }
                 * }*/

                if (msg == null)
                {
                    onSuccess("Failure.");
                }
                else
                {
                    onSuccess(msg.ToObject <string>());
                }
            };

            Action <Exception, string> wrappedOnError = (Exception e, string str) => {
                LogHelpers.Log("!ModHelpers.PostGithubModIssueReports.ReportIssue - Failed for POST to " + url + " : " + jsonStr);
                onError(e, str);
            };

            NetHelpers.MakePostRequestAsync(url, jsonBytes, onResponse, wrappedOnError, onCompletion);
        }
        public static void ReportIssue(Mod mod, string issue_title, string issue_body, Action <string> on_success, Action <Exception, string> on_error, Action on_completion = null)
        {
            if (!ModMetaDataManager.HasGithub(mod))
            {
                throw new Exception("Mod is not eligable for submitting issues.");
            }

            int max_lines = HamstarHelpersMod.Instance.Config.ModIssueReportErrorLogMaxLines;

            IEnumerable <Mod> mods        = ModHelpers.GetAllMods();
            string            body_info   = string.Join("\n \n", InfoHelpers.GetGameData(mods).ToArray());
            string            body_errors = string.Join("\n", InfoHelpers.GetErrorLog(max_lines).ToArray());

            string url   = "http://hamstar.pw/hamstarhelpers/issue_submit/";
            string title = "In-game: " + issue_title;
            string body  = body_info;

            body += "\n \n \n \n" + "Recent error logs:\n```\n" + body_errors + "\n```";
            body += "\n \n" + issue_body;

            var json = new GithubModIssueReportData {
                githubuser    = ModMetaDataManager.GetGithubUserName(mod),
                githubproject = ModMetaDataManager.GetGithubProjectName(mod),
                title         = title,
                body          = body
            };
            string json_str = JsonConvert.SerializeObject(json, Formatting.Indented);

            byte[] json_bytes = Encoding.UTF8.GetBytes(json_str);

            Action <String> on_response = (output) => {
                JObject resp_json = JObject.Parse(output);
                //JToken data = resp_json.SelectToken( "Data.html_url" );
                JToken msg = resp_json.SelectToken("Msg");

                /*if( data != null ) {
                 *      string post_at_url = data.ToObject<string>();
                 *      if( !string.IsNullOrEmpty( post_at_url ) ) {
                 *              SystemHelpers.Start( post_at_url );
                 *      }
                 * }*/

                if (msg == null)
                {
                    on_success("Failure.");
                }
                else
                {
                    on_success(msg.ToObject <string>());
                }
            };

            NetHelpers.NetHelpers.MakePostRequestAsync(url, json_bytes, on_response, on_error, on_completion);
        }
        public static void ReportIssue(Mod mod, string issueTitle, string issueBody,
                                       Action <Exception, string> onError,
                                       Action <bool, string> onCompletion)
        {
            if (!ModFeaturesHelpers.HasGithub(mod))
            {
                throw new ModHelpersException("Mod is not eligable for submitting issues.");
            }

            int maxLines = ModHelpersMod.Config.ModIssueReportErrorLogMaxLines;

            IEnumerable <Mod> mods       = ModListHelpers.GetAllLoadedModsPreferredOrder();
            string            bodyInfo   = string.Join("\n \n", FormattedGameInfoHelpers.GetFormattedGameInfo(mods).ToArray());
            string            bodyErrors = string.Join("\n", GameInfoHelpers.GetErrorLog(maxLines).ToArray());

            string url   = "http://hamstar.pw/hamstarhelpers/issue_submit/";
            string title = "Reported from in-game: " + issueTitle;
            string body  = bodyInfo;

            body += "\n \n \n \n" + "Recent error logs:\n```\n" + bodyErrors + "\n```";
            body += "\n \n" + issueBody;

            var json = new GithubModIssueReportData {
                githubuser    = ModFeaturesHelpers.GetGithubUserName(mod),
                githubproject = ModFeaturesHelpers.GetGithubProjectName(mod),
                title         = title,
                body          = body
            };
            string jsonStr = JsonConvert.SerializeObject(json, Formatting.Indented);

            Action <bool, string> wrappedOnCompletion = (success, output) => {
                string processedOutput = "";

                if (success)
                {
                    JObject respJson = JObject.Parse(output);
                    JToken  data     = respJson.SelectToken("Data.html_url");
                    JToken  msg      = respJson.SelectToken("Msg");

                    if (data != null)
                    {
                        string issueUrl = data.ToObject <string>();
                        if (!string.IsNullOrEmpty(issueUrl))
                        {
                            SystemHelpers.OpenUrl(issueUrl);
                        }
                    }

                    success = msg != null;
                    if (success)
                    {
                        processedOutput = msg.ToObject <string>();
                    }
                    else
                    {
                        processedOutput = "Failure.";
                    }
                }

                onCompletion(success, processedOutput);
            };

            Action <Exception, string> wrappedOnError = (Exception e, string str) => {
                LogHelpers.Log("!ModHelpers.PostGithubModIssueReports.ReportIssue - Failed for POST to " + url + " : " + jsonStr);
                onError(e, str);
            };

            WebConnectionHelpers.MakePostRequestAsync(url, jsonStr, e => wrappedOnError(e, ""), wrappedOnCompletion);
        }