⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 uclientcfg.pas

📁 一个用Delpi写的视频聊天的SDK
💻 PAS
字号:

unit uClientCFG;

interface
uses Graphics, windows, IniFiles, forms, SysUtils, classes,
  rfClientProj1_TLB,
  dialogs
  ;
type
  TLoginInfo = record
    RoomID: Integer;
    UserID: Cardinal;
    NickName: string;
    Sex: string;
    PassWord: string;
    RoomPassWord: string;
    MngPassword: string;
  end;
  TRoom = class
  public
    RoomID: Integer;
    NeedPassWord: Boolean;
    RoomName: string;
    RoomMemo: string;
    RoomType: Byte;
    MaxUserCount: Integer;
    ChannelCount: Integer;
    CurUserCount: Integer;
  end;
  ////////
  TCFG_Path = record
    TempPath: string;
    AppPath: string;
    EmotionPath: string;
    WavPath: string;
    DatPath:string;
  end;

  TCFG_URL = record
    ServerList: string;
  end;

  TCFG_SysInfo = record
    BaseColor: TColor;
    SkinFileName: string;
    HallListFileName: string;
    AudioVolDrawFileName: string;
    RoomHost: string;
    RoomPort: Word;
  end;

  TCFG_Str = record
    Title: string; //应用程序标题
    //////
    Html_Sys_Msg: string; //系统消息
    Html_User_Msg: string;
    Html_User_ErrorMsg: string;
    Html_ChatHeader_Self: string; //与自己有关的
    Html_ChatHeader_Public: string; //公聊信息

    /////////
    Str_Tick_Chat: string; // = '对不起,您发言的速度太快!';
    Str_Self_Droped: string; //被管理员踢出
    Str_Other_Droped: string; //被管理员踢出

    str_SetTempMng: string;
    str_UnSetTempMng: string;

    str_MicReqError: string;
    str_MicReqOk: string;

    str_RoomInfoChanged: string;

    str_Chat_SilentError: string;
  end;

  TCFG = class
  private
    Fini: TIniFile;
  protected
  public
    UserInfo: TLoginInfo;
    FRoom: TRoom;

    FSelUserID: Cardinal;

    FSDKClient: TrfClient;
    Path: TCFG_Path;
    URL: TCFG_URL;
    SysInfo: TCFG_SysInfo;
    Str: TCFG_Str;

    Logined: Boolean;
    constructor Create;
    destructor Destroy; override;

    procedure Load;
    procedure Save;
  published
  end;

procedure Delay(Msecs: Integer);

var
  FCFG: TCFG;

implementation

{ TCFG }

constructor TCFG.Create;
begin
  Path.AppPath := ExtractFilePath(Application.ExeName);

  Fini := TIniFile.Create(ChangeFileExt(ParamStr(0), '.ini'));

end;

destructor TCFG.Destroy;
begin
  Save;

  Fini.Free;
  inherited;
end;

procedure TCFG.Load;
begin
  URL.ServerList := Fini.ReadString('URL', 'serverListUrl', '');

  path.TempPath := Path.AppPath + 'temp\';
  if not DirectoryExists(Path.TempPath) then
    CreateDir(Path.TempPath);

  path.EmotionPath := path.AppPath + 'Emotion\';
  path.WavPath := path.AppPath + 'wave\';
  path.DatPath:=Path.AppPath+'dat\';

  str.Title := Fini.ReadString('Str', 'Title', '');

  ////////
  Str.Html_Sys_Msg := Fini.ReadString('ConstStr', 'Html_Sys_Msg', '系统信息:');
  Str.Html_User_Msg := Fini.ReadString('ConstStr', 'Html_User_Msg', '用户信息:');
  Str.Html_User_ErrorMsg := Fini.ReadString('ConstStr', 'Html_User_ErrorMsg', '%s');
  str.Html_ChatHeader_Self := Fini.ReadString('ConstStr', 'Html_ChatHeader_Self', '');
  str.Html_ChatHeader_Public := Fini.ReadString('ConstStr', 'Html_ChatHeader_Public', '');

  str.Str_Tick_Chat := '对不起,你发言的速度太快';
  str.Str_Self_Droped := '您已被管理员踢出房间';
  str.Str_Other_Droped := '已被管理员请出房间';
  str.str_SetTempMng := '已被提升为临时管理员';
  str.str_UnSetTempMng := '临时管理员权限被取消';
  str.str_MicReqError := '抢麦失败';
  str.str_MicReqOk := '抢麦成功';
  str.str_RoomInfoChanged := '房间设置已更改';
  str.str_Chat_SilentError := '您不能对所有人说悄悄话';

  SysInfo.SkinFileName := Path.AppPath + 'skin\' + Fini.ReadString('SysInfo', 'SkinFileName', '');
  SysInfo.AudioVolDrawFileName := Path.AppPath + 'bmp\' + Fini.ReadString('SysInfo', 'AudioVolDrawFileName', '');
  SysInfo.HallListFileName := path.AppPath + Fini.ReadString('SysInfo', 'HallListFileName', 'hallList.htm');
  ////////////
end;

procedure TCFG.Save;
begin

end;

procedure Delay(Msecs: Integer);
var
  FirstTickCount: real;
begin
  FirstTickCount := GetTickCount;
  repeat
    Application.ProcessMessages;
  until ((GetTickCount - FirstTickCount) >= LongInt(Msecs));
end;

end.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -