Exemplo n.º 1
0
        private void FileWatcher()
        {
            var waitHandles = new[]
            {
                disposeWaitHandle,
                fileWaitHandle
            };

            while (!disposed)
            {
                var result = WaitHandle.WaitAny(waitHandles, TinyReadWriteLock.DefaultWaitTimeout);

                // Triggers when disposed
                if (result == 0 || disposed)
                {
                    return;
                }

                // Triggers when the file is changed
                if (result == 1)
                {
                    FileUpdated?.Invoke(this, EventArgs.Empty);
                }
            }
        }
Exemplo n.º 2
0
        private void UpdateList()
        {
            MethodInvoker mi = delegate
            {
                while (ListItem.SubItems.Count < 5)
                {
                    ListItem.SubItems.Add(string.Empty);
                }
                ListItem.Text             = File;
                ListItem.SubItems[1].Text = Path;
                ListItem.SubItems[2].Text = FileUpdated.Ticks != 0 ? FileUpdated.ToString("HH.mm:ss.fff") : string.Empty;
                ListItem.SubItems[3].Text = PluginUpdated.Ticks != 0 ? PluginUpdated.ToString("HH:mm:ss.fff") : string.Empty;
                ListItem.SubItems[4].Text = Status;
                OnChanged();
            };

            if (owner.InvokeRequired)
            {
                owner.Invoke(mi);
            }
            else
            {
                mi();
            }
        }
        public static INotification ToEvent(this EntityEntry entry)
        {
            Type          type = entry.Entity.GetType();
            INotification evt  = null;

            if (type == typeof(Directory))
            {
                evt = new DirectoryUpdated(((Directory)entry.Entity).Id);
            }
            else if (type == typeof(Workspace))
            {
                evt = new WorkspaceUpdated(((Workspace)entry.Entity).Id);
            }
            else if (type == typeof(File))
            {
                evt = new FileUpdated(((File)entry.Entity).Id, true);
            }

            return(evt);
        }
Exemplo n.º 4
0
        private void FileWatcher()
        {
            WaitHandle[] waitHandles = { _disposeWaitHandle, _fileWaitHandle };

            while (!_disposed)
            {
                Int32 result = WaitHandle.WaitAny(waitHandles, InterprocessReadWriteLock.DefaultWaitTimeout);

                // Triggers when disposed
                if (result == 0 || _disposed)
                {
                    return;
                }

                // Triggers when the file is changed
                if (result == 1)
                {
                    FileUpdated?.Invoke(this, EventArgs.Empty);
                }
            }
        }
Exemplo n.º 5
0
 protected virtual void OnFileUpdated(HttpUpdaterFileEventArgs e) => FileUpdated?.Invoke(this, e);
Exemplo n.º 6
0
 protected virtual void OnFileUpdated(string updatedContent)
 {
     FileUpdated?.Invoke(this, updatedContent);
 }
 public void InvokeUpdateFile(File file)
 {
     FileUpdated?.Invoke(file);
 }
Exemplo n.º 8
0
 private void _fileWatcher_Changed(object sender, FileSystemEventArgs e)
 {
     byte[] deltaData = File.ReadAllBytes(_fileName).Skip((int)_fileSize).ToArray();
     FileUpdated.Invoke(Encoding.UTF8.GetString(deltaData));
 }
Exemplo n.º 9
0
 protected virtual void OnFileUpdated()
 {
     FileUpdated?.Invoke(this, EventArgs.Empty);
 }