Data.BasicTeraData.LogError C# (CSharp) Method

LogError() public static method

public static LogError ( string error, bool local = false, bool debug = false ) : void
error string
local bool
debug bool
return void
        public static void LogError(string error, bool local = false, bool debug = false)
        {
            if (debug && _errorCount-- <= 0) return;
            Task.Run(() =>
            {
                try
                {
                    error = $"##### (version={UpdateManager.Version}):\r\n" + (debug?"##### Debug: ":"") + error;
                    _log.Error(error);
                    if (!Instance.WindowData.Debug || local)
                    {
                        return;
                    }

                    using (var client = new HttpClient())
                    {
                        var formContent = new FormUrlEncodedContent(new[]
                        {
                            new KeyValuePair<string, string>("error", error)
                        });

                        var response = client.PostAsync("http://diclah.com/~yukikoo/debug/debug.php", formContent);
                        var responseString = response.Result.Content.ReadAsStringAsync();
                        Console.WriteLine(responseString.Result);
                    }
                }
                catch
                {
                    // Ignore
                }
            });
        }

Usage Example

Example #1
0
        public void Load(PlayerClass playerClass)
        {
            var       windowFile = Path.Combine(_basicData.ResourceDirectory, "config/events/events-" + playerClass.ToString().ToLowerInvariant() + ".xml");
            XDocument xml;

            try
            {
                var filestreamClass = new FileStream(windowFile, FileMode.Open, FileAccess.Read);
                xml = XDocument.Load(filestreamClass);
            }
            catch (Exception ex) when(ex is XmlException || ex is InvalidOperationException)
            {
                BasicTeraData.LogError(ex.Message, true, true);
                Save();
                return;
            }
            catch (Exception ex)
            {
                BasicTeraData.LogError(ex.Message, true, true);
                return;
            }
            EventsClass               = new Dictionary <Event, List <Action> >();
            MissingAbnormalities      = new Dictionary <Event, List <Action> >();
            AddedRemovedAbnormalities = new Dictionary <Event, List <Action> >();
            Cooldown = new Dictionary <Event, List <Action> >();
            Events   = new Dictionary <Event, List <Action> >();
            AFK      = null;
            ParseAbnormalities(EventsClass, xml);
            ParseCooldown(EventsClass, xml);
            AssociateEvent(EventsCommon);
            AssociateEvent(EventsClass);
        }
All Usage Examples Of Data.BasicTeraData::LogError