我想以编程方式更改双工设置。但是花了近一个星期的时间后,我仍然找不到解决方案。
当前,我只想进行单面打印(与默认的双面打印设置相反)。
我尝试了几乎所有解决方案。我的测试代码片段如下:
using System;
using System.Collections.Generic;
using System.IO;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
Console.Write("Write the path of the old file folder: ");
string pathA = Console.ReadLine();
Console.Write("Write the path of the new file folder: ");
string pathB = Console.ReadLine();
Console.WriteLine("Press Enter to continue:");
List<string> folderA = new List<string>();
foreach (string filePath in Directory.GetFiles(pathA))
{
folderA.Add(Path.GetFileName(filePath));
}
List<string> folderB = new List<string>();
foreach (string filePath in Directory.GetFiles(pathB))
{
folderB.Add(Path.GetFileName(filePath));
}
Console.Write("New files in folder" + pathA + " : ");
Print(folderA, folderB);
Console.WriteLine("------------------------------------");
Console.Write("New files in folder" + pathB + " : ");
Print(folderB, folderA);
Console.Read();
}
static void Print(List<string> lstA, List<string> lstB)
{
foreach (string fileName in lstA)
{
if (!lstB.Contains(fileName))
{
Console.Out.WriteLine(fileName);
}
}
}
}
}
答案 0 :(得分:0)
抱歉,已经过去了很长的一周,我还没来得及回复。无论如何,我去查找结构并遇到了这个问题:
我相信这正是您想要的。