Пример #1
0
        void CheckForUpdates()
        {
            while (mbRunning)
            {
                Thread.Sleep(1000);

                lock (this)
                {
                    if (mFilesToCheck.Count > 0)
                    {
                        Thread.Sleep(1000);
                    }
                    foreach (string fileName in mFilesToCheck)
                    {
                        int index = fileName.IndexOf("~");
                        if (index == -1)
                        {
                            continue;
                        }
                        string realName = fileName.Substring(0, index);
                        if (((TimeSpan)(DateTime.Now - File.GetLastAccessTime(realName))).TotalMinutes < 2)
                        {
                            XMBProcessor.CreateXMB(mToolPath, realName, this.CheckOutXMBBox.Checked);
                        }
                    }
                    mFilesToCheck.Clear();
                }
            }
        }
Пример #2
0
        void mWatcher_Changed(object sender, FileSystemEventArgs e)
        {
            string ext = Path.GetExtension(e.FullPath).ToLower();

            if (this.PauseCheckBox.Checked == false)
            {
                if (ext == ".tactics" || ext == ".xml")
                {
                    XMBProcessor.CreateXMB(mToolPath, e.FullPath, this.CheckOutXMBBox.Checked);
                    this.Invoke((MethodInvoker)(delegate() { Text = System.DateTime.Now.ToShortTimeString(); }));
                }
                if (ext == ".tmp")
                {
                    lock (this)
                    {
                        mFilesToCheck.Add(e.FullPath);
                    }
                }
            }
        }