CSharpLogger.Logger.Warning C# (CSharp) Method

Warning() public method

Logs a warning
public Warning ( String message ) : void
message String The message to explain the warning
return void
        public void Warning(String message)
        {
            if (builder == null)
                builder = new StringBuilder();
            builder.AppendLine(DateTime.Now.ToString("MM-dd-yy HH:mm:ss") + " - Warning: " + message);
            if (!flushHold)
                Flush();

            //MessageBox.Show(null, message, "Warning", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
        }

Usage Example

        // Replacement for individual raf reading and individual filetype searching
        // Provide the directory of RADS\projects\lol_game_client\filearchives or the equivalent
        private bool ReadRAFs(DirectoryInfo dir, Logger logger)
        {
            try
            {
                RAFMasterFileList rafFiles = new RAFMasterFileList(dir.FullName);
                logger.Event("Opening the 'filearchives' directory: " + dir.FullName);
                foreach (RAFMasterFileList.RAFSearchResult result in rafFiles.SearchFileEntries(new string[] { ".dds", ".skn", ".skl", ".inibin", "animations.list", ".anm" }, RAFMasterFileList.RAFSearchType.All))
                {
                    RAFFileListEntry e = result.value;

                    // Split off the actual file name from the full path
                    String name = e.FileName.Substring(e.FileName.LastIndexOf('/') + 1).ToLower();

                    switch (result.searchPhrase)
                    {
                        case ".dds":
                            // Try to parse out unwanted textures.
                            if (!e.FileName.ToLower().Contains("loadscreen") &&
                                !e.FileName.ToLower().Contains("circle") &&
                                !e.FileName.ToLower().Contains("square") &&
                                e.FileName.ToLower().Contains("data") &&
                                e.FileName.ToLower().Contains("characters"))
                            {
                                // Check that the file isn't already in the dictionary
                                if (!textures.ContainsKey(name))
                                {
                                    textures.Add(name, e);
                                }
                                else
                                {
                                    logger.Warning("Duplicate texture " + name + ": " + e.FileName);
                                }
                            }
                            break;

                        case ".skn":
                            if (!skns.ContainsKey(name))
                            {
                                skns.Add(name, e);
                            }
                            else
                            {
                                logger.Warning("Duplicate skn " + name + ": " + e.FileName);
                            }
                            break;

                        case ".skl":
                            if (!skls.ContainsKey(name))
                            {
                                skls.Add(name, e);
                            }
                            else
                            {
                                logger.Warning("Duplicate skn " + name + ": " + e.FileName);
                            }
                            break;

                        case ".inibin":
                            // Try to only read champion inibins
                            if (e.FileName.ToLower().Contains("data") &&
                                e.FileName.ToLower().Contains("characters"))
                            {
                                inibins.Add(e);
                            }
                            else
                            {
                                logger.Warning("Excluding inibin " + name + ": " + e.FileName);
                            }
                            break;

                        case "animations.list":
                            // Riot changed their directory structure for some skins.
                            // Originally, champion Animation.list files were stored in a directory structure like
                            // "*/ChampionName/Animation.list".  Now, some are stored like
                            // "*/ChampionName/Skins/Skin01/Animation.list".

                            if (e.FileName.ToLower().Contains("skin") == false &&
                                e.FileName.ToLower().Contains("base") == false)
                            {
                                // Original Case.

                                // Remove the file name.
                                name = e.FileName.Remove(e.FileName.LastIndexOf('/'));

                                // Remove proceeding directories to get the parent directory
                                name = name.Substring(name.LastIndexOf('/') + 1).ToLower();
                            }
                            else
                            {
                                // Newer Case.
                                string path = e.FileName.ToString();
                                string[] splitPath = path.Split('/');

                                // Sanity
                                if (splitPath.Length > 3)
                                {
                                    name = splitPath[splitPath.Length - 4].ToLower();
                                }
                            }

                            // Store.
                            if (!animationLists.ContainsKey(name))
                            {
                                animationLists.Add(name, e);
                            }
                            else
                            {
                                logger.Warning("Duplicate animation list " + name + ": " + e.FileName);
                            }
                            break;

                        case ".anm":
                            // Remove the .anm extension.
                            name = name.Remove(name.Length - 4);

                            if (!animations.ContainsKey(name))
                            {
                                animations.Add(name, e);
                            }
                            else
                            {
                                logger.Warning("Duplicate anm " + name + ": " + e.FileName);
                            }
                            break;
                    }
                }

            }
            catch (Exception e)
            {
                // Something went wrong. Most likely the RAF read failed due to a bad directory.
                logger.Error("Failed to open RAFs");
                logger.Error(e.Message);
                return false;
            }

            return true;
        }
All Usage Examples Of CSharpLogger.Logger::Warning