Ejemplo n.º 1
0
        private void MainWindow_OnLoaded(object sender, RoutedEventArgs e)
        {
            // example add user in list
            //for (int i = 0; i < 10; i++)
            //{
            //    ListViewUser.Items.Add(new Ui()
            //    {
            //        Uicon = new BitmapImage(new Uri(
            //            AppDomain.CurrentDomain.BaseDirectory + "\\icon\\icon1.jpg")),
            //        Uiuser = @"user " + i
            //    });
            //}

            // set ShamiaIsAlive false
            ShamiaIsAlive = false;
            Core.ScoreLoad();
            // set default language US
            switch (Core.Conf.Langflag)
            {
            case @"PT":
                LangMode.SetLang(LangMode.Lang.Portuguese);
                break;

            case @"EN":
                LangMode.SetLang(LangMode.Lang.English);
                break;

            case @"KO":
                LangMode.SetLang(LangMode.Lang.Korean);
                break;
            }

            // example add chat content
            //Listchat.Items.Add(new TemplateUichat
            //{
            //    Yuser = @"System :",
            //    Ycontent = @"Teste message "
            //});

            //Core.Connect();

            //Sdelegates.OnUpStatus(@"shamia , come on ?");
            Sdelegates.OnUpStatus(Application.Current.MainWindow.Resources.MergedDictionaries[0]["Shamialetstart"].ToString());

            // hide listviewchat and checkbox
            Listchat.Visibility = Visibility.Collapsed;
            Chkauto.Visibility  = Visibility.Collapsed;

            // update mainwindow title message
            Title = LblChan.Content.ToString();

            // check flag gist enbled application
            _gist();

            // hide console
            Showconsole.ShowConsole(false);
        }
Ejemplo n.º 2
0
        private void MainWindow_OnLoaded(object sender, RoutedEventArgs e)
        {
            // hide console window
            Showconsole.ShowConsole(false);

            LblversionCore.Content = VersionCore;

            CanvasAllShowHide(false);
            // load configuration in database (SQLite) \\Shamia.db
            SqliteSource.CreateOrAccessDataBase();
            string lang = SqliteSource.GetLang();

            if (lang == string.Empty)
            {
                // load default language
                Clanguage.LoadDefaultLang();
            }
            else
            {
                // load language set in database
                Clanguage.SetLanguage(lang);
            }

            // load user(s) TOP 1 database
            List <TemplateUserDataBase> user = SqliteSource.EnumUserDataBase();

            foreach (TemplateUserDataBase i in user)
            {
                Configuration.StConfiguration.Password = i.Password;                                // user password
                Configuration.StConfiguration.Nick     = i.Nick;                                    // user login
                Configuration.StConfiguration.AuthSsl  = i.Auth;                                    // flag auth user (true or false)
                Configuration.StConfiguration.Owner    = i.Owner;                                   // default nick chat is Shamia
                Configuration.StConfiguration.Port     = i.Port;                                    // default port used quakenet (6667)
                Configuration.StConfiguration.Channel  = SqliteSource.GetLastChannelUsedDataBase(); // last channel connected saved in database
            }
            Configuration.StConfiguration.Server = SqliteSource.GetLastServerUsedDataBase();        // get last server in database used to connection

            // list all game(s) SQLite
            Game.EnumGamesIn();

            // call method create menu
            CreatTopMenu();


            CanvasWelcome.Visibility      = Visibility.Visible;
            CanvasContent.Visibility      = Visibility.Hidden;
            TxtSend.Visibility            = Visibility.Collapsed;
            CanvasProgressring.Visibility = Visibility.Collapsed;
            RingP.IsActive = false;

            // mensagem de boas vindas
            Effectfade(LblChan, Efeitos.Surgir, Resources.MergedDictionaries[0]["Status"].ToString(), 5, Color.DodgerBlue);
        }
Ejemplo n.º 3
0
        public void SendToIrc(string s, bool iscommand = false)
        {
            if (ThIrc == null)
            {
                return;
            }
            string[] r = s.Split(new string[] { "/", " " }, StringSplitOptions.None);

            _output = new StreamWriter(_sock.GetStream());

            try
            {
                // check se for comando
                if (iscommand)
                {
                    if (r[0] == @"QUIT")
                    {
                        Application.Current.Dispatcher.Invoke(
                            DispatcherPriority.Normal, (Action) delegate
                        {
                            _output.Write("QUIT" + "\r\n");
                            _output.Flush();

                            //
                            //_Quit();
                            ListChat.Items.Clear();
                            CanvasWelcome.Visibility      = Visibility.Visible;
                            CanvasContent.Visibility      = Visibility.Hidden;
                            TxtSend.Visibility            = Visibility.Collapsed;
                            CanvasProgressring.Visibility = Visibility.Collapsed;
                            RingP.IsActive = false;
                            // mensagem de boas vindas
                            Effectfade(LblChan, Efeitos.Surgir, Resources.MergedDictionaries[0]["Status"].ToString(), 5, Color.DodgerBlue);
                            Title = Resources.MergedDictionaries[0]["Status"].ToString();
                        });
                        return;
                    }

                    switch (r[1])
                    {
                    // AUTH
                    case "AUTH":
                        string[] content = s.Split(new string[] { " ", "/" }, StringSplitOptions.None);
                        _output.Write(@"AUTH " + content[2] + @" " + content[3] + "\r\n");
                        _output.Flush();

                        MyDelegates.OnChatCallBack(@"system :", "Auth Sucess");
                        break;

                    // kick => KICK <#channel> <nick> <comment banned>
                    // exemplo : /KICK usuario comentario
                    case "KICK":
                        string[] k = s.Split(new string[] { "/", " " }, StringSplitOptions.None);
                        _output.Write(@"KICK " + MainWindow.Configuration.StConfiguration.Channel + " " + k[2] + " " + k[3] + "\r\n");
                        _output.Flush();
                        break;

                    // autokick
                    // exemplo : /ADDKICK usuario
                    case "ADDKICK":
                        string[] ak = s.Split(new string[] { "/", " " }, StringSplitOptions.None);
                        if (ak[2] != string.Empty)
                        {
                            Autokick.AddUser(ak[2]);
                        }

                        break;

                    // removeautokick
                    // ex: /REMOVEAUTOKICK usuario
                    case "REMOVEKICK":
                        string[] rk = s.Split(new string[] { "/", " " }, StringSplitOptions.None);
                        if (rk[2] != string.Empty)
                        {
                            Autokick.RemoveUser(rk[2]);
                        }

                        break;

                    // clearall
                    // ex: /CLEARAUTOKICK
                    case "CLEARKICK":
                        Autokick.ClearAll();

                        break;

                    // clear chat client
                    // exemplo : /CLEAR
                    case "CLEAR":
                        Application.Current.Dispatcher.Invoke(
                            DispatcherPriority.Normal, (Action) delegate
                        {
                            ListChat.Items.Clear();
                            MyDelegates.OnChatCallBack(@"system :", @"clean client chat");
                        });
                        break;

                    // envia comando TCP direto
                    // exemplos no site quakenet => https://www.quakenet.org/help/q-commands
                    case "CMD":
                        Application.Current.Dispatcher.Invoke(
                            DispatcherPriority.Normal, (Action) delegate
                        {
                            _output.Write(s.Replace("/CMD", string.Empty) + "\r\n");
                            _output.Flush();
                        });
                        break;

                    // Debug Show and Hide
                    case "DEBUGON":
                        Showconsole.ShowConsole();
                        break;

                    case "DEBUGOFF":
                        Showconsole.ShowConsole(false);
                        break;
                    }

                    return;
                }


                _output.Write("PRIVMSG " + Configuration.StConfiguration.Channel + " : " + s + "\r\n");
                _output.Flush();
                MyDelegates.OnChatCallBack(@"system :", s);
            }
            catch (Exception ex)
            {
                MyDelegates.OnDebugMessageCallBack(ex.StackTrace);
            }
        }