Exemplo n.º 1
0
        public static void Watch(string path, string pattern, Action <T> callback, bool relativePath = true)
        {
            _callback += callback;

            if (relativePath)
            {
                path = Pathfinder.ToRelativeToConfigPath(path);
            }

            InitWatcher(path, pattern);
        }
Exemplo n.º 2
0
        public static bool TryLoad(string path, out T result, bool relativePath = true)
        {
            try
            {
                if (relativePath)
                {
                    path = Pathfinder.ToRelativeToConfigPath(path);
                    Logger.Log(path);
                }

                result = Load(path);

                return(true);
            }
            catch (Exception ex)
            {
                Logger.Log("Error while loading from path: " + path, ex);
                result = default(T);
                return(false);
            }
        }