Ejemplo n.º 1
0
 public ChatMsgType(ChatMsgType chatMsgType)
 {
     ChatCode = chatMsgType.ChatCode;
     MsgType  = chatMsgType.MsgType;
     Name     = chatMsgType.Name;
     Color    = chatMsgType.Color;
 }
Ejemplo n.º 2
0
        public async Task OnFFChatMessageArrived(ChatMessageArrivedEventArgs ea)
        {
            ChatMsgType msgType = new ChatMsgType();

            if (!MsgBlackList.Contains(ea.ChatMessage.Text))
            {
                await ProcessChatMsg(ea, msgType);
            }

            if (CmdArgsStatus.LogAllChat || CmdArgsStatus.LogPlotChat)
            {
                Logger.WriteChatLog(String.Format("{0} {1}: {2}", ea.ChatMessage.TimeStamp, ea.ChatMessage.Code, ea.ChatMessage.Text));
            }
        }
Ejemplo n.º 3
0
        private async Task ProcessChatMsg(ChatMessageArrivedEventArgs ea, ChatMsgType msgType)
        {
            switch (msgType.MsgType)
            {
            default:
            {
                var translation = new ChatMessageArrivedEventArgs(ea);

                await _TextArrivedArrived.InvokeAsync(translation);

                break;
            }
            }
        }
Ejemplo n.º 4
0
        void LoadOldSettings(UserSettings userSettings)
        {
            if (!File.Exists(GlobalSettings.OldSettings))
            {
                return;
            }

            try
            {
                var oldSettings = Helper.LoadJsonData <UserSettingsOld>(GlobalSettings.OldSettings);

                try
                {
                    File.Delete(GlobalSettings.OldSettings);
                }
                catch (Exception ex)
                {
                    Logger.WriteLog(ex);
                }

                if (userSettings.ChatWindows.Count == 0)
                {
                    ChatWindowViewModelSettings windowSettings = new ChatWindowViewModelSettings("1", 0);

                    windowSettings.ChatFontSize    = oldSettings.FontSize;
                    windowSettings.LineBreakHeight = oldSettings.LineBreakHeight;
                    windowSettings.SpacingCount    = oldSettings.InsertSpaceCount;

                    windowSettings.IsAlwaysOnTop  = oldSettings.IsAlwaysOnTop;
                    windowSettings.IsClickThrough = oldSettings.IsClickThrough;
                    windowSettings.IsAutoHide     = oldSettings.IsAutoHide;

                    windowSettings.AutoHideTimeout = oldSettings.AutoHideTimeout;

                    windowSettings.BackGroundColor = oldSettings.BackgroundColor;
                    windowSettings.IsAutoHide      = oldSettings.IsAutoHide;

                    windowSettings.TranslationEngineName = (TranslationEngineName)oldSettings.CurrentTranslationEngine;

                    var eng = WebTranslator.TranslationEngines.FirstOrDefault(x => x.EngineName == windowSettings.TranslationEngineName);
                    if (eng != null)
                    {
                        var lang1 = eng.SupportedLanguages.FirstOrDefault(x => x.ShownName == oldSettings.CurrentFFXIVLanguage);
                        var lang2 = eng.SupportedLanguages.FirstOrDefault(x => x.ShownName == oldSettings.CurrentTranslateToLanguage);
                        if (lang1 != null && lang2 != null)
                        {
                            windowSettings.FromLanguague = new TranslatorLanguague(lang1);
                            windowSettings.ToLanguague   = new TranslatorLanguague(lang2);
                        }
                    }

                    windowSettings.ChatWindowRectangle = oldSettings.ChatWindowLocation;

                    foreach (var ck in windowSettings.ChatCodes)
                    {
                        ChatMsgType msgType = null;
                        if (oldSettings.ChatCodes.TryGetValue(ck.Code, out msgType))
                        {
                            bool isCheked = (msgType.MsgType == MsgType.Translate) ? true : false;

                            ck.IsChecked = isCheked;
                            ck.Color     = msgType.Color;
                        }
                    }

                    windowSettings.ShowHideChatKeys     = new WinUtils.HotKeyCombination(oldSettings.ShowHideChatKeys.Name + "0", oldSettings.ShowHideChatKeys);
                    windowSettings.ClickThoughtChatKeys = new WinUtils.HotKeyCombination(oldSettings.ClickThoughtChatKeys.Name + "0", oldSettings.ClickThoughtChatKeys);
                    windowSettings.ClearChatKeys        = new WinUtils.HotKeyCombination(oldSettings.ClearChatKeys.Name + "0", oldSettings.ClearChatKeys);

                    userSettings.ChatWindows.Add(new ChatWindowViewModelSettings(windowSettings));
                }
            }
            catch (Exception exx)
            {
                Logger.WriteLog(exx);
            }
        }