public void generateLocalVersion(String DbPath)
        {
            CopyFile copyFile = new CopyFile();

            String          DbName = GetFileName.getFileName(DbPath);
            OleDbDataReader reader = CreateDb.DbConnect(DbPath);

            String path = versionFile;

            System.IO.Directory.CreateDirectory(path + "\\" + "本地版本" + Path.GetFileNameWithoutExtension(DbName));
            DirectoryInfo dir = new DirectoryInfo(path + "\\" + "本地版本" + Path.GetFileNameWithoutExtension(DbName));

            dir.Create();
            while (reader.Read())
            {
                String tempStr   = (String)reader["path"];
                String targetDir = dir + "\\" + Path.GetFileName(tempStr);
                copyFile.copyFile(tempStr, targetDir);
            }
            copyFile.copyFile(DbPath + "\\" + DbName, dir + "\\" + DbName);
            MessageBox.Show("生成版本成功", "提示", MessageBoxButton.OK);
        }
Example #2
0
        public void update(Window oldWindow)
        {
            //判断文件是否存在

            CopyFile        copyFile     = new CopyFile();
            String          serverDbName = GetFileName.getFileName(serverPath);
            OleDbDataReader reader       = CreateDb.DbConnect(serverPath);

            while (reader.Read())
            {
                String tempStr      = (String)reader["fileName"];
                String originFile   = serverPath + "\\" + tempStr;
                String updateMethod = (String)reader["updateMethod"];
                if (updateMethod.Equals("删除") && File.Exists(localPath + "\\" + tempStr))
                {
                    File.Delete(localPath + "\\" + tempStr);
                }
                else
                {
                    copyFile.copyFile(originFile, localPath + "\\" + tempStr);
                }
            }
            if (reader != null)
            {
                reader.Close();
            }

            //最后复制服务器配置文件到本地,并删除原来的配置文件
            String localDbName = GetFileName.getFileName(localPath);

            copyFile.copyFile(serverPath + "\\" + serverDbName, localPath + "\\" + localDbName);

            /*
             * if (serverDbName != localDbName)
             *  File.Delete(localPath + "\\" + localDbName);
             */
            SuccessTips(oldWindow);
        }
Example #3
0
        public bool AntoUpdateOrNot()
        {
            //判断文件是否存在

            String serverDbName = GetFileName.getFileName(serverPath);

            if (serverDbName == null)
            {
                return(false);
            }
            OleDbDataReader serverReader = CreateDb.DbConnect(serverPath);

            while (serverReader.Read())
            {
                if (serverReader["fileName"].Equals(softwareName))
                {
                    serverReader.Close();
                    return(true);
                }
            }
            serverReader.Close();
            return(false);
        }