本文整理汇总了C#中InstallerLib.ConfigFile.GetResources方法的典型用法代码示例。如果您正苦于以下问题:C# ConfigFile.GetResources方法的具体用法?C# ConfigFile.GetResources怎么用?C# ConfigFile.GetResources使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类InstallerLib.ConfigFile
的用法示例。
在下文中一共展示了ConfigFile.GetResources方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TestGetResourcesNoFile
public void TestGetResourcesNoFile()
{
string supportdir = @"C:\SupportFiles\SupportFile";
ConfigFile configFile = new ConfigFile();
ResourceFileCollection resources = configFile.GetResources(supportdir);
Assert.AreEqual(0, resources.Count);
}
示例2: CreateInstaller
//.........这里部分代码省略.........
{
html_files.Add(new EmbedFilePair(fullpath, Path.GetFileName(filename)));
}
}
}
IEnumerator<EmbedFilePair> html_files_enumerator = html_files.GetEnumerator();
while (html_files_enumerator.MoveNext())
{
EmbedFilePair pair = html_files_enumerator.Current;
String id = "";
for (int i = 0; i < pair.relativepath.Length; i++)
{
id += Char.IsLetterOrDigit(pair.relativepath[i]) ? pair.relativepath[i] : '_';
}
args.WriteLine(string.Format("Embedding HTML resource \"{0}\": {1}", id, pair.fullpath));
ResourceUpdate.WriteFile(h, new ResourceId("HTM"), new ResourceId(id.ToUpper()),
ResourceUtil.NEUTRALLANGID, pair.fullpath);
}
#endregion
#region Embed CABs
if (args.embed)
{
args.WriteLine("Embedding CABs");
foreach (string cabfile in Directory.GetFiles(cabtemp))
{
args.WriteLine(string.Format(" {0} - {1}", Path.GetFileName(cabfile),
EmbedFileCollection.FormatBytes(new FileInfo(cabfile).Length)));
ResourceUpdate.WriteFile(h, new ResourceId("RES_CAB"), new ResourceId(Path.GetFileName(cabfile)),
ResourceUtil.NEUTRALLANGID, cabfile);
}
// cab directory
args.WriteLine("Embedding CAB directory");
StringBuilder filesDirectory = new StringBuilder();
filesDirectory.AppendLine(string.Format("Total CAB size: {0}\r\n", EmbedFileCollection.FormatBytes(totalSize)));
filesDirectory.AppendLine(string.Join("\r\n\r\n", allFilesList.ToArray()));
byte[] filesDirectory_b = Encoding.Unicode.GetBytes(filesDirectory.ToString());
ResourceUpdate.Write(h, new ResourceId("CUSTOM"), new ResourceId("RES_CAB_LIST"),
ResourceUtil.NEUTRALLANGID, filesDirectory_b);
}
#endregion
// resource files
ResourceFileCollection resources = configfile.GetResources(supportdir);
foreach (ResourceFilePair r_pair in resources)
{
args.WriteLine(string.Format("Embedding resource \"{0}\": {1}", r_pair.id, r_pair.path));
ResourceUpdate.WriteFile(h, new ResourceId("CUSTOM"), new ResourceId(r_pair.id),
ResourceUtil.NEUTRALLANGID, r_pair.path);
}
if (args.mslu)
{
args.WriteLine("Embedding MSLU unicows.dll");
string unicowsdll = Path.Combine(templatepath, "unicows.dll");
if (! File.Exists(unicowsdll)) unicowsdll = Path.Combine(supportdir, "unicows.dll");
if (! File.Exists(unicowsdll)) unicowsdll = Path.Combine(Environment.CurrentDirectory, "unicows.dll");
if (! File.Exists(unicowsdll))
{
throw new Exception(string.Format("Error locating \"{0}\\unicows.dll\"", templatepath));
}
ResourceUpdate.WriteFile(h, new ResourceId("CUSTOM"), new ResourceId("RES_UNICOWS"),
ResourceUtil.NEUTRALLANGID, unicowsdll);
}
args.WriteLine(string.Format("Writing {0}", EmbedFileCollection.FormatBytes(totalSize)));
if (!ResourceUpdate.EndUpdateResource(h, false))
throw new Win32Exception(Marshal.GetLastWin32Error());
#endregion
}
finally
{
if (Directory.Exists(cabtemp))
{
args.WriteLine(string.Format("Cleaning up \"{0}\"", cabtemp));
Directory.Delete(cabtemp, true);
}
if (!string.IsNullOrEmpty(configTemp))
{
args.WriteLine(string.Format("Cleaning up \"{0}\"", configTemp));
File.Delete(configTemp);
}
}
args.WriteLine(string.Format("Successfully created \"{0}\" ({1})",
args.output, EmbedFileCollection.FormatBytes(new FileInfo(args.output).Length)));
}