Esempio n. 1
0
 //撤销
 public void Undo()
 {
     if (undoSQL.Count == 0)
     {
         return;
     }
     DataBase.Command(dataform.GetOpenFile(), undoSQL[undoSQL.Count - 1]);
     undoSQL.RemoveAt(undoSQL.Count - 1);
     if (undoModified[undoModified.Count - 1].modifiled)
     {
         FileModified lastmodify = undoModified[undoModified.Count - 1];
         YGOUtil.CardRename(lastmodify.oldid, lastmodify.newid, dataform.GetPath(), lastmodify.delold);
     }
     undoModified.RemoveAt(undoModified.Count - 1);
     if (undoDeleted[undoDeleted.Count - 1].deleted)
     {
         FileDeleted lastdelete = undoDeleted[undoDeleted.Count - 1];
         foreach (long id in lastdelete.ids)
         {
             YGOUtil.CardDelete(id, dataform.GetPath(), YGOUtil.DeleteOption.RESTORE);
         }
     }
     undoDeleted.RemoveAt(undoDeleted.Count - 1);
     if (undoCopied[undoCopied.Count - 1].copied)
     {
         DBcopied lastcopied = undoCopied[undoCopied.Count - 1];
         DataBase.DeleteDB(dataform.GetOpenFile(), lastcopied.NewCards);
         DataBase.CopyDB(dataform.GetOpenFile(), !lastcopied.replace, lastcopied.OldCards);
     }
     undoCopied.RemoveAt(undoCopied.Count - 1);
     dataform.Search(true);
 }
        void CallChanged(FMWEventArgs args)
        {
            List <EventHandler> calls = null;

            if (FileModified != null)
            {
                try
                {
                    calls = FileModified.GetInvocationList().Cast <EventHandler>().ToList();
                }
                catch { }
            }

            foreach (EventHandler c in calls)
            {
                try
                {
                    c(this, args);
                }
                catch (Exception ex)
                {
                    STEM.Sys.EventLog.WriteEntry("STEM.Sys.IO.CallChanged", ex, EventLog.EventLogEntryType.Error);
                }
            }
        }
    public FileModified[] GetUpdateInfo()
    {
        // Get the physical directory
        string updateDir = HostingEnvironment.MapPath("website.com/updater");
        IList <FileModified> updateInfo = new List <FileModified>();

        foreach (string path in Directory.GetFiles(updateDir))
        {
            FileModified fm = new FileModified();
            fm.Path =     // You may need to adjust path so that it is local with respect to updateDir
                      fm.Modified = new FileInfo(path).LastWriteTime;
            updateInfo.Add(fm);
        }
        return(updateInfo.ToArray());
    }
Esempio n. 4
0
        private void OnFileModified(FileModified e)
        {
            using (var stream = new MemoryStream(e.Data)) {
                var image = Image.FromStream(stream);
                var path  = GetLocalImagePath();

                if (!Directory.Exists(path))
                {
                    Directory.CreateDirectory(path);
                }

                image.Save(path + e.Name);
            }
            //FileProvider.Upload(e.Data, Partition, e.Name);
        }
Esempio n. 5
0
        public void RefreshModifiedFile(IDnSpyFile file)
        {
            var fileHash = GetModifiedFiles(file);

            decompilationCache.Clear(fileHash);

            var tabs = new List <IFileTab>();

            foreach (var tab in VisibleFirstTabs)
            {
                if (MustRefresh(tab, fileHash))
                {
                    tabs.Add(tab);
                }
            }
            if (tabs.Count > 0)
            {
                Refresh(tabs);
            }

            FileModified?.Invoke(this, new FileModifiedEventArgs(fileHash.ToArray()));
        }
Esempio n. 6
0
        //修改
        public bool ModCard(bool modfiles)
        {
            if (!dataform.CheckOpen())
            {
                return(false);
            }
            Card c       = dataform.GetCard();
            Card oldCard = dataform.GetOldCard();

            if (c.Equals(oldCard))//没有修改
            {
                MyMsg.Show(LMSG.ItIsNotChanged);
                return(false);
            }
            if (c.id <= 0)
            {
                MyMsg.Error(LMSG.CodeCanNotIsZero);
                return(false);
            }
            string sql;

            if (c.id != oldCard.id)                    //修改了id
            {
                sql = DataBase.GetInsertSQL(c, false); //插入
                bool delold = MyMsg.Question(LMSG.IfDeleteCard);
                if (delold)                            //是否删除旧卡片
                {
                    if (DataBase.Command(dataform.GetOpenFile(),
                                         DataBase.GetDeleteSQL(oldCard)) < 2)
                    {
                        //删除失败
                        MyMsg.Error(LMSG.DeleteFail);
                    }
                    else
                    {//删除成功,添加还原sql
                        undoSQL.Add(DataBase.GetDeleteSQL(c) + DataBase.GetInsertSQL(oldCard, false));
                    }
                }
                else
                {
                    undoSQL.Add(DataBase.GetDeleteSQL(c));                    //还原就是删除
                }
                //如果删除旧卡片,则把资源修改名字,否则复制资源
                if (modfiles)
                {
                    YGOUtil.CardRename(c.id, oldCard.id, dataform.GetPath(), delold);
                    FileModified modify = new FileModified();
                    modify.modifiled = true;
                    modify.oldid     = oldCard.id;
                    modify.newid     = c.id;
                    modify.delold    = delold;
                    undoModified.Add(modify);
                    undoDeleted.Add(new FileDeleted());
                    undoCopied.Add(new DBcopied());
                }
                else
                {
                    undoModified.Add(new FileModified());
                    undoDeleted.Add(new FileDeleted());
                    undoCopied.Add(new DBcopied());
                }
            }
            else
            {//更新数据
                sql = DataBase.GetUpdateSQL(c);
                undoSQL.Add(DataBase.GetUpdateSQL(oldCard));
                undoModified.Add(new FileModified());
                undoDeleted.Add(new FileDeleted());
                undoCopied.Add(new DBcopied());
            }
            if (DataBase.Command(dataform.GetOpenFile(), sql) > 0)
            {
                MyMsg.Show(LMSG.ModifySucceed);
                dataform.Search(true);
                dataform.SetCard(c);
                return(true);
            }
            else
            {
                MyMsg.Error(LMSG.ModifyFail);
            }
            return(false);
        }
 /// <summary>
 /// Fired when a file is modified in the watched directory.
 /// </summary>
 /// <param name="e"></param>
 protected virtual void OnFileModified(FileSystemEventArgs e)
 {
     FileModified?.Invoke(this, e);
 }
Esempio n. 8
0
 private void OnFileModified(FileWatchEventArgs e)
 {
     FileModified?.Invoke(this, e);
 }
Esempio n. 9
0
 //修改
 public bool ModCard(bool modfiles)
 {
     if (!dataform.CheckOpen())
         return false;
     Card c = dataform.GetCard();
     Card oldCard = dataform.GetOldCard();
     if (c.Equals(oldCard))//没有修改
     {
         MyMsg.Show(LMSG.ItIsNotChanged);
         return false;
     }
     if (c.id <= 0)
     {
         MyMsg.Error(LMSG.CodeCanNotIsZero);
         return false;
     }
     string sql;
     if (c.id != oldCard.id)//修改了id
     {
         sql = DataBase.GetInsertSQL(c, false);//插入
         bool delold = MyMsg.Question(LMSG.IfDeleteCard);
         if (delold)//是否删除旧卡片
         {
             if (DataBase.Command(dataform.GetOpenFile(),
                 DataBase.GetDeleteSQL(oldCard)) < 2)
             {
                 //删除失败
                 MyMsg.Error(LMSG.DeleteFail);
             }
             else
             {//删除成功,添加还原sql
                 undoSQL.Add(DataBase.GetDeleteSQL(c)+DataBase.GetInsertSQL(oldCard, false));
             }
         } else
             undoSQL.Add(DataBase.GetDeleteSQL(c));//还原就是删除
         //如果删除旧卡片,则把资源修改名字,否则复制资源
         if (modfiles)
         {
             YGOUtil.CardRename(c.id, oldCard.id, dataform.GetPath(), delold);
             FileModified modify = new FileModified();
             modify.modifiled = true;
             modify.oldid = oldCard.id;
             modify.newid = c.id;
             modify.delold = delold;
             undoModified.Add(modify);
             undoDeleted.Add(new FileDeleted());
             undoCopied.Add(new DBcopied());
         }
         else
         {
             undoModified.Add(new FileModified());
             undoDeleted.Add(new FileDeleted());
             undoCopied.Add(new DBcopied());
         }
     }
     else
     {//更新数据
         sql = DataBase.GetUpdateSQL(c);
         undoSQL.Add(DataBase.GetUpdateSQL(oldCard));
         undoModified.Add(new FileModified());
         undoDeleted.Add(new FileDeleted());
         undoCopied.Add(new DBcopied());
     }
     if (DataBase.Command(dataform.GetOpenFile(), sql) > 0)
     {
         MyMsg.Show(LMSG.ModifySucceed);
         dataform.Search(true);
         dataform.SetCard(c);
         return true;
     }
     else
         MyMsg.Error(LMSG.ModifyFail);
     return false;
 }