コード例 #1
0
 public void Reload(string typeOf = "All")
 {
     if (typeOf == "All")
     {
         Engine.Initialize();
     }
     else
     {
         Engine.LoadDocumentType(typeOf);
     }
 }
コード例 #2
0
        public virtual void OnChangeDocument(FileSystemEventArgs e)
        {
            try
            {
                var file = new FileInfo(e.FullPath);

                if (!IsAcceptExtention(file.Extension) || CheckIgnorePrefix(file.FullName))
                {
                    Engine.Logger?.Debug(ScopeType.Watcher, $"Skip File : {file.FullName}");

                    return;
                }

                var types  = Engine.Option.TypeOf;
                var typeOf = file.Directory.Name;
                if (typeOf == DocumentDefaults.Contents)
                {
                    typeOf = file.Directory.Parent.Name;

                    Engine.Logger?.Debug(ScopeType.Watcher, $"TypeOf: {typeOf} Contents changes");
                }

                var trans = Engine.GetThreadTransaction();

                if (trans != null)
                {
                    if (trans.TypeOfLock.Contains(typeOf.ToLowerInvariant()))
                    {
                        Engine.Logger?.Debug(ScopeType.Watcher, $"{typeOf} is Locked");

                        return;
                    }
                }

                if (types.Count(t => t.TypeOf.ToLowerInvariant() == typeOf.ToLowerInvariant()) > 0)
                {
                    Engine.Logger?.Debug(ScopeType.Watcher, $"OnChangeDocument TypeOf: {typeOf} - File: {file.FullName}");

                    Engine.LoadDocumentType(typeOf);
                }
            }
            catch (Exception ex)
            {
                Engine.Logger?.Error("Watcher OnChangeDocument:", ex);
            }
        }