Autoupdater

IT/C# 2014. 1. 10. 17:10

Description

Fixing bugs and adding new features is a part of developing software applications. From my experience, sending application updates to users is also a critical part of developing applications, especially when the user has no advanced knowledge of computers. In the Internet era today, the software developer must make application deployment and updating easier and often makes automatic application updates to do this.I already searched through the internet on this topic, but not much seems suited to my needs. So, I tried to create one myself. This sample application is developed in C# as a library with the project name “AutoUpdater”. The DLL “AutoUpdater” can be used in a C# Windows application(WinForm and WPF).

About the features

There are certain features about the AutoUpdater:

1,Easy to implement and use.
2,Application automatic re-run after checking update.
3,Update process transparent to the user .
4,To avoid blocking the main thread using multi-threaded download.
5,Ability to upgrade the system and also the auto update program.
6,A code that doesn't need change when used by different systems and could be compiled in a library.
7,Easy for user to download the update files.

 


Codeplex에서 퍼온 링크이다. Client-side에 실제 배포된 dll, exe 등의 버전 정보를 확인하지는 않는다.
Server와 Client 상에 XML 파일을 두고 이를 통해 Version 정보를 관리한다. 프로그램이 오동작할 경우, Update된 XML 정보와 실제 dll이 어긋날 가능성은 있어보인다.
실제 배포파일에서 버전정보를 확인하는 방법은 없는지 찾아보면 좀 더 나은 Autoupdater가 될 수 있을 것 같다.

 

 

Posted by lI헐헐Il
,
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
body
{
    margin: 0;
    padding: 0;
    border: 0;
    overflow: hidden;
    height: 100%;
    max-height: 100%;
}
 
#framecontentLeft, #framecontentTop
{
    position: absolute;
    top: 0;
    left: 0;
    width: 200px; /*Width of left frame div*/
    height: 100%;
    overflow: hidden; /*Disable scrollbars. Set to "scroll" to enable*/
    background-color: navy;
    color: white;
}
 
#framecontentTop
{
    left: 200px; /*Set left value to WidthOfLeftFrameDiv*/
    right: 0px;
    width: auto;
    min-width: 800px;
    height: 120px; /*Height of top frame div*/
    overflow: hidden; /*Disable scrollbars. Set to "scroll" to enable*/
    background-color: navy;
    color: white;
}
 
#maincontent
{
    position: fixed;
    left: 200px; /*Set left value to WidthOfLeftFrameDiv*/
    top: 120px; /*Set top value to HeightOfTopFrameDiv*/
    right: 0;
    bottom: 0;
    min-width: 600px;
    overflow: auto;
    background: #fff;
}
 
.innertube
{
    margin: 15px; /*Margins for inner DIV inside each DIV (to provide padding)*/
}
 
* html body
{
    /*IE6 hack*/
    padding: 120px 0 0 200px; /*Set value to (HeightOfTopFrameDiv 0 0 WidthOfLeftFrameDiv)*/
}
 
* html #maincontent
{
    /*IE6 hack*/
    height: 100%;
    width: 100%;
}
 
* html #framecontentTop
{
    /*IE6 hack*/
    width: 100%;
}
 
div#HomeButton
{
    margin: 0px;
    padding: 0px;
    border: 1px solid red;
    width: 198px;
    height: 118px;
    font-size:12pt;
    color: White;
}

 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
<form id="form1" runat="server">
     
<div id="framecontentLeft">
    <div id="HomeButton">
        여기에는 HomeButton이 놓임.
    </div>
    <div class="innertube">
        <h3>
            Sub Menu가 놓이는 자리</h3>
    </div>
</div>
<div id="framecontentTop">
    <div class="innertube">
        <h1>
            CSS Left and Top Frames Layout</h1>
        <h3>
            Main Menu가 놓이는 자리</h3>
    </div>
</div>
<div id="maincontent">
    <div class="innertube">
        <asp:contentplaceholder id="MainContent" runat="server"></asp:contentplaceholder>
    </div>
</div>
</form>
Posted by lI헐헐Il
,

 멤버 이름

 설명

 Localservice

 로컬 컴퓨터에서 권한이 없는 사용자 역할을 하고 모든 원격 서버에 익명 자격 증명을 제시

 하는 계정입니다.

 LocalSystem

 서비스 제어 관리자에서 사용되고 로컬 컴퓨터에 대한 확장된 권한을 가지며 네트워크에서

 컴퓨터 역할을 하는 계정입니다.

 NetworkService

 광범위한 로컬 권한을 제공하고 모든 원격 서버에 컴퓨터의 자격 증명을 제시하는 계정입

 니다.

 User

 네트워크에서 특정 사용자가 정의한 계정입니다.

 ServiceProcessInstaller 인스턴스의  UserName 및 Password 속성 값을 둘 다 설정하지

 않은 경우 ServiceProcessInstaller.Account 멤버에 대한 User를 지정하면 서비스가 설치

 될 때 올바른 사용자 이름과 암호를 묻는 메시지가 표시됩니다.

 

ServiceProcessInstaller 를 초기화할 때 ServiceAccount 열거형을 사용하여 설치할 서비스의 보안 컨텍스트를 지정합니다. 이러한 보안 컨텍스트는 시스템에서 서비스의 권한을 나타내며 네트워크에서 서비스가 작동하는 방식을 나타냅니다. 예를 들어, 서비스가 원격 서버에 컴퓨터의 자격 증명 또는 익명 자격 증명을 제시하는지 여부를 나타냅니다. ServiceAccount 열거형 특정 서비스에 필요한 권한을 정확하게 지정할 수 있도록 다양한 범위의 권한을 제공합니다.

 

LocalSystem 값은 높은 권한의 계정을 정의하지만 대부분의 서비스에는 그와 같은 높은 권한 수준이 필요하지 않습니다. LocalService 및 NetworkService 열거형 멤버는 보안 컨텍스트에 더 낮은 권한 수준을 제공합니다.

 

다음 코드 예제에서는 ServiceAccount 열거형을 통해 시스템 계정의 보안 컨텍스트를 사용하여 새 프로그램을 설치하는 방법을 보여줍니다.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
using System;
using System.Collections;
using System.Configuration.Install;
using System.ServiceProcess;
using System.ComponentModel;
 
[RunInstaller(true)]
public class MyProjectInstaller : Installer
{
    private ServiceInstaller serviceInstaller1;
    private ServiceInstaller serviceInstaller2;
    private ServiceProcessInstaller processInstaller;
 
    public MyProjectInstaller()
    {
        // Instantiate installers for process and services.
        processInstaller = new ServiceProcessInstaller();
        serviceInstaller1 = new ServiceInstaller();
        serviceInstaller2 = new ServiceInstaller();
 
        // The services run under the system account.
        processInstaller.Account = ServiceAccount.LocalSystem;
 
        // The services are started manually.
        serviceInstaller1.StartType = ServiceStartMode.Manual;
        serviceInstaller2.StartType = ServiceStartMode.Manual;
 
        // ServiceName must equal those on ServiceBase derived classes.
        serviceInstaller1.ServiceName = "Hello-World Service 1";
        serviceInstaller2.ServiceName = "Hello-World Service 2";
 
        // Add installers to collection. Order is not important.
        Installers.Add(serviceInstaller1);
        Installers.Add(serviceInstaller2);
        Installers.Add(processInstaller);
    }
 
    public static void Main()
    {
        Console.WriteLine("Usage: InstallUtil.exe [<service>.exe]");
    }
}
</service>

 

[출처]http://msdn.microsoft.com/ko-kr/library/system.serviceprocess.serviceaccount(v=vs.110).aspx
[참고]http://msdn.microsoft.com/ko-kr/library/zt39148a(VS.80).aspx
Posted by lI헐헐Il
,