我可以成功地将zip文件夹中的文件解压缩到一个文件夹中,但我不太确定如何获取这些文件并将它们添加到现有的zip文件中.我将它们提取到桌面上名为"mod"的目录中,然后我需要将它们添加到另一个zip文件中.救命?这是我的提取代码 -
ZipFile zip = ZipFile.Read(myZip);
zip.ExtractAll(outputDirectory,ExtractExistingFileAction.OverwriteSilently);
Run Code Online (Sandbox Code Playgroud)
感谢帮助,谢谢.
我正在制作类似于"彼得答案"的东西.它被称为"Adrian Answers",因为这是我的名字.但这无关紧要.这个问题之前已经得到了回答,但我无法弄清楚如何将这个应用到我的情况中.我需要退格键才能无法按下.如果你按住它,它应该只在程序中注册一次,但不能在此之后的任何时间注册.顺便说一句,我想在textBox1中使用此功能.这是Peter Answers的参考. http://www.peteranswers.com/
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace PeterAnswers
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
bool secret = false;
string answer;
string normal = "Adrian, please answer my question:";
int i = 0;
bool secret2 = false;
private void textBox1_KeyPress(object sender, KeyEventArgs e)
{
if (e.KeyData == Keys.OemPeriod && textBox1.Text.Length == 0)
{
i = 0;
e.SuppressKeyPress = true;
secret …Run Code Online (Sandbox Code Playgroud) 我需要检查"D"或"A"键是否被快速按下两次,以便精灵更改和动画.一旦该键被释放,精灵应该回到它的原始形式.我有一个简笔画,一旦按下任一键,它应该向下蹲并开始向任一方向"滚动",这取决于按下了哪个键.任何帮助,将不胜感激!
if (rowCount[i] >= 10)
{
for (int j = 0; j < blocks.Count; j++)
{
if (blocks[j].Row == i)
{
blocks.RemoveAt(j);
rowCount[i]--;
}
}
foreach (Block b in blocks)
{
if (b.Row < i)
{
b.Row++;
rowCount[b.Row]++;
}
}
}
Run Code Online (Sandbox Code Playgroud)
所以说我在阻止列表中有20个块.我经历了逐行调试的程序,我看到它没有检查列表中的每个块 - 它通常会留下4或5个未选中状态.我疯了还是有什么我想念的?
我正在创建一个文本文件,如果它不存在,然后立即我将文本添加到该文件后.但是,我的编译器说它被另一个进程使用,我认为这是因为它刚刚被创建.我怎样才能解决这个问题?
代码摘录 -
//If the text document doesn't exist, create it
if (!File.Exists(set.cuLocation))
{
File.CreateText(set.cuLocation);
}
//If the text file after being moved is empty, edit it to say the previous folder's name
System.IO.StreamReader objReader = new System.IO.StreamReader(set.cuLocation);
set.currentUser = objReader.ReadLine();
objReader.Close();
if (set.currentUser == null)
{
File.WriteAllText(set.cuLocation, set.each2);
}
Run Code Online (Sandbox Code Playgroud)