小编The*_*ing的帖子

使用HTTP处理文件下载期间丢失Internet连接

我使用以下代码从http服务器下载文件:

        int bytesSize = 0;
        // A buffer for storing and writing the data retrieved from the server
        byte[] downBuffer = new byte[4096];
        bool exceptionOccured = false;
        try
        {
            // Create a request to the file we are downloading
            webRequest = (HttpWebRequest)WebRequest.Create(url);
            webRequest.Timeout = 60000;
            webRequest.ReadWriteTimeout = System.Threading.Timeout.Infinite;

            // Set default authentication for retrieving the file
            webRequest.UseDefaultCredentials = true;

            // Retrieve the response from the server
            webResponse = (HttpWebResponse)webRequest.GetResponse();

            // Ask the server for the file size and store it …
Run Code Online (Sandbox Code Playgroud)

c#

6
推荐指数
1
解决办法
1843
查看次数

添加删除程序图标

我有一个WIX Installer项目,它安装我的产品.代码不是我写的.它在"添加/删除"程序中显示一个图标.我想知道它指定的源代码在哪里.该图标是我产品的主要可执行文件.我尝试搜索代码,但在整个代码中找不到任何ARPPRODUCTICON字.从哪里可以看到添加/删除程序中显示的图标?

wix

3
推荐指数
1
解决办法
2559
查看次数

在Basic MSI中从Installscript更新INSTALLDIR

我想使用Installscript在安装期间更改我的安装程序的INSTALLDIR值.我该怎么办?我已经尝试过以下操作:创建自定义操作:

function InitializeValues(hMSI)
    STRING svProductName; 
    STRING svInstallDir;  
    NUMBER nvSize;
begin                        
    nvSize=255; 
    MsiGetProperty (hMSI, "ProductName", svProductName, nvSize);  
    if(svProductName = "Notepad Pro") then  
         svInstallDir = PROGRAMFILES ^ svProductName;
 //     MsiSetTargetPath(hMSI,INSTALLDIR,svInstallDir);      
        MsiSetProperty(hMSI,INSTALLDIR,svInstallDir);
        MessageBox(INSTALLDIR,INFORMATION);
    endif;
end;
Run Code Online (Sandbox Code Playgroud)

我的自定义操作已执行但INSTALLDIR的值不会更改.我已经在成本最终确定之前在UI序列中安排了我的自定义操作,并且在成本最终确定之后执行顺序中.

请帮忙.

installshield installscript

1
推荐指数
1
解决办法
3935
查看次数

检查WIX安装程序中的RAM

我想创建一个WIX安装程序,在先决条件检查期间,我想查看系统上安装的RAM数量.如果它小于1 GB,它应该向用户显示一条消息指示"RAM的数量"系统低于此产品所需的最低要求.您是否仍想继续安装?" 显示消息框中有两个按钮(是和否).如果用户单击是,我继续安装,如果用户单击否,我将只显示完成对话框或中止安装.我怎样才能做到这一点?

windows-installer wix

1
推荐指数
1
解决办法
868
查看次数

访问XAML中的类变量

我有一个类定义为:

class Constants
{
   public static string settingsToolTip = "Settings";
}
Run Code Online (Sandbox Code Playgroud)

我想将此字符串设置为按钮的工具提示,如:

<Button Name= "ButtonSettingsWindow" ToolTip="Settings" ToolTipService.ShowDuration="2000"/>
Run Code Online (Sandbox Code Playgroud)

我没有在XAML中对字符串"Settings"进行硬编码,而是希望它使用Constants类中的字符串.我怎么能在WPF XAML中这样做?

c# wpf xaml

1
推荐指数
1
解决办法
2886
查看次数

在批处理文件中获取两个级别的路径

我的要求是从批处理文件的执行位置获取两个级别的路径:假设我的批处理文件位于:D:\ testfolder\system\tools\configuration task\conf.bat

我在批处理文件中使用以下代码:

SET BATCH_FILE_DIR=%~dp0
echo %BATCH_FILE_DIR%
SET PATH_TWO_LEVELS_UP=?????
Run Code Online (Sandbox Code Playgroud)

我尝试在网上搜索,但找不到任何有用的东西.对我来说,应该替换?????哪些东西,PATH_TWO_LEVELS_UP到D:\ testfolder\system \

此外,它应该适用于UNC路径.假设相同的批处理文件可用于:\\ pc-dummy\testfolder\system\tools\configuration task\conf.bat

如果在资源管理器中打开上述位置并双击批处理文件,则应将变量PATH_TWO_LEVELS_UP设置为\\ pc-dummy\testfolder\system \

应该采取什么措施?????对本地驱动以及UNC路径起作用

windows cmd batch-file

1
推荐指数
1
解决办法
1460
查看次数

在WIX中执行DOS命令

我想从WIX执行DOS命令.命令如下:

[SystemFolder]cmd.exe /c rmdir /s /q [INSTALLDIR]
Run Code Online (Sandbox Code Playgroud)

基本上我想在卸载期间从命令提示符下删除安装目录.

我想使用SystemFolder属性指定cmd.exe路径.最重要的是,我不希望在卸载期间出现命令窗口.

wix

0
推荐指数
1
解决办法
937
查看次数

修复FxCop规则:枚举应该是强类型的

我已经定义了一个名为StringResourceCollection的类.我的班级声明如下:

namespace EPGObjectModel.IDE
{
    using System;
    using System.Collections;
    using System.Collections.Generic;
    using System.Text;

    public class StringResourceCollection : CollectionBase, IEnumerator
    {
        #region Fields

        private int index = -1;

        #endregion Fields

        #region Properties

        public object Current
        {
            get { return this.List[index]; }
        }

        #endregion Properties

        #region Indexers

        public EPGString this[string index]
        {
            get
            {
                Reset();
                while (this.MoveNext())
                {
                    if (((EPGString)Current).StringId == index || ((EPGString)Current).StringName.Equals(index))
                        return (EPGString)Current;
                }
                return null;
            }
        }

        #endregion Indexers

        #region Methods

        public int Add(EPGString item)
        {
            try
            {
                return …
Run Code Online (Sandbox Code Playgroud)

c# fxcop

0
推荐指数
1
解决办法
125
查看次数