CmlLib
한국어 (v3)
한국어 (v3)
  • 🧊CmlLib Projects
  • [AD] 커스텀 런처 주문제작
  • 🚀CmlLib.Core
    • 홈
    • 시작하기
      • CMLauncher
      • 게임 경로 설정
      • 실행 옵션 설정
      • 이벤트 처리
    • 로그인과 세션
      • 마이크로소프트 엑스박스 계정
      • 예전 모장 계정
      • 오프라인 계정
    • 고급 기능
      • VersionLoader
      • Version
      • FileChecker
      • Downloader
    • 모드 로더 인스톨러
      • Forge Installer
      • Fabric Installer
      • LiteLoader Installer
    • 유틸리티
      • Minecraft Changelogs
    • 자료
      • 자주 묻는 질문
      • 알려진 문제
      • 예시 런처
      • 라이센스
  • 🔓Auth.Microsoft
    • 홈
    • CmlLib.Core.Auth.Microsoft
      • JELoginHandler
      • JELoginHandlerBuilder
      • JEAuthenticator
    • XboxAuthNet.Game
      • OAuth
      • XboxAuth
      • XboxAuthException
      • AccountManager
      • Accounts
    • XboxAuthNet.Game.Msal
      • ClientID
      • MsalClientHelper
      • OAuth
    • CmlLib.Core.Bedrock.Auth
    • 자료
  • 🌐MojangAPI
    • 홈
    • Mojang API
    • SecurityQuestion
  • ⚒️Installer.Forge
    • 홈
    • 지원되는 버전
    • 시작하기
    • MForge
    • ForgeVersionLoader
Powered by GitBook
On this page
  • 예시
  • DownloadFileChangedEventHandler
  • DownloadFileChangedEventArgs
  • Properties
  • ProgressChangedEventHandler
  • MFile
  • Fields
Edit on GitHub
  1. CmlLib.Core
  2. 시작하기

이벤트 처리

실행 과정을 유저에게 보여줍니다.

Previous실행 옵션 설정Next로그인과 세션

Last updated 1 year ago

런처의 진행 상황을 유저에게 보여주고 싶다면 이벤트 헨들러를 등록하세요. CmlLib.Core 는 오직 두가지의 이벤트 헨들러만 사용합니다. 는 처리중인 파일이 바뀌었을 때, 어떤 파일을 처리 중인지, 남은 파일의 수는 얼마나 되는지 등을 알려주기 위한 헨들러입니다. 는 진행 상황을 바이트 단위로 계산하여 백분율을 알려주기 위한 헨들러입니다.

예시

// 이벤트 헨들러 등록
var launcher = new CMLauncher(new MinecraftPath());
launcher.FileChanged += Launcher_FileChanged;
launcher.ProgressChanged += Launcher_ProgressChanged;
// 이벤트 헨들러
private void Launcher_FileChanged(DownloadFileChangedEventArgs e)
{
    Console.WriteLine("파일종류: " + e.FileKind.ToString());
    Console.WriteLine("파일이름: " + e.FileName);
    Console.WriteLine("전체 파일개수: " + e.TotalFileCount);
    Console.WriteLine("진행한 파일개수: " + e.ProgressedFileCount);
}

private void Launcher_ProgressChanged(object sender, System.ComponentModel.ProgressChangedEventArgs e)
{
    Console.WriteLine(e.ProgressPercentage + "%");
}

DownloadFileChangedEventHandler

public delegate void DownloadFileChangedHandler(DownloadFileChangedEventArgs e);

Represents the method that will handle download progress events.

DownloadFileChangedEventArgs contains the download progress.

DownloadFileChangedEventArgs

Represents the download progress data of IDownloader.

Properties

FileKind

Specifies the type of file currently being downloaded.

FileName

Type: string

The name of the file currently being downloaded. Note: if FileKind is equal to MFile.Resource, this property would be an empty string.

Source

Type: object

The source of event. You can determine what object raised the event. Example:

if (e.Source is IFileChecker)
{
    // raised by IFileChecker
    // game file checking
}
else if (e.Source is IDownloader)
{
    // raised by IDownloader
    // file downloading
}
else
{
    // etc (MForge, or )
}

TotalFileCount;

Type: int

The total number of files to download.

ProgressedFileCount;

Type: int

The number of files already downloaded.

ProgressChangedEventHandler

MFile

Indicates the game file type.

public enum MFile { Runtime, Library, Resource, Minecraft };

Fields

Runtime

Java runtime. CMLauncher.CheckJRE() raises FileChange event with this type.

Library

Libraries (GAME_DIR/libraries)

Resource

Resources and assets (GAME_DIR/assets)

Minecraft

Minecraft jar file (GAME_DIR/versions)

Type:

🚀
Source Code
docs.microsoft.com
ProgressChangedEventHandler
DownloadFileChangedHandler
MFile