Ejemplo n.º 1
0
 public WebSocketHandler()
 {
     isLocal        = SunIRCInit.isLocal;
     irc            = SharedData.irc;
     utilityMethods = new UtitlityMethods();
     SharedData.AddToMessageList("HELLO LITTLE WEEB");
     checkMessagesToSend = new Thread(new ThreadStart(messagesToSend));
     checkMessagesToSend.Start();
 }
Ejemplo n.º 2
0
        public HSXDCCDownloader()
        {
            irc = new SimpleIRC();
            irc.DccClient.OnDccEvent += OnDccEvent;

            jikan = new Jikan();

            InitializeComponent();

            AnimeBox.MouseDoubleClick += new MouseEventHandler(AnimeBoxDoubleClick);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Form Contstructor, initializes SimpleIRC Library and registers event handlers.
        /// </summary>
        public IrcClientForm()
        {
            _irc = new SimpleIRC();
            _irc.IrcClient.OnMessageReceived  += OnMessagesReceived;
            _irc.IrcClient.OnUserListReceived += OnUserListReceived;
            _irc.DccClient.OnDccEvent         += OnDccEvent;
            _debugForm = new DebugForm(_irc);
            _defaultDownloadDirectory = Directory.GetCurrentDirectory();

            InitializeComponent();
        }
Ejemplo n.º 4
0
        public IrcHandler()
        {
            isLocal         = SunIRCInit.isLocal;
            websocketserver = SharedData.websocketserver;
            irc             = SharedData.irc;

            usefullstuff = new UtitlityMethods();


            Debug.WriteLine("DEBUG-IRCHANDLER: STARTING DOWNLOADER LOGIC");
            downloaderLogicThread = new Thread(new ThreadStart(downloaderLogic));
            downloaderLogicThread.Start();
        }
Ejemplo n.º 5
0
 private void InitializeSimpleIRC()
 {
     try
     {
         if (irc.isClientRunning())
         {
             irc.stopClient();
         }
     }
     catch
     {
     }
     irc            = new SimpleIRC();
     SharedData.irc = irc;
     irchandler     = new IrcHandler();
 }
Ejemplo n.º 6
0
        public IrcClientHandler(ISettingsHandler settingsHandler, IDebugHandler debugHandler)
        {
            debugHandler.TraceMessage("Constructor Called.", DebugSource.CONSTRUCTOR, DebugType.ENTRY_EXIT);

            SettingsHandler = settingsHandler;
            DebugHandler    = debugHandler;

            IrcSettings        = SettingsHandler.GetIrcSettings();
            LittleWeebSettings = SettingsHandler.GetLittleWeebSettings();

            IrcClient = new SimpleIRC();
            IrcClient.SetCustomDownloadDir(IrcSettings.fullfilepath);
            IrcClient.IrcClient.OnUserListReceived += OnUserListUpdate;
            IrcClient.IrcClient.OnMessageReceived  += OnMessage;
            IrcClient.IrcClient.OnDebugMessage     += OnMessageDebug;
            IrcClient.DccClient.OnDccEvent         += OnDownloadUpdate;
            IrcClient.DccClient.OnDccDebugMessage  += OnDownloadUpdateDebug;
        }
Ejemplo n.º 7
0
        public void Connect(string ipAddress, int port, string username, string channel, string password = "", bool force = false)
        {
            if (force == true && this.Connected == true)
            {
                this.IrcClient.stopClient();
                this.Connected = false;
            }

            if (this.Connected == true)
            {
                throw new Exception("Attempted to establish connection to a new IRC server whilst the current one is still active.");
            }

            this.IrcClient = new SimpleIRC();
            this.IrcClient.setupIrc(ipAddress, port, username, password, channel, this.ChatOutputDelegate);
            this.HookEventsToIrcClient();
            this.IrcClient.startClient();

            this.Connected = true;
        }
Ejemplo n.º 8
0
        private void Start_Click(object sender, EventArgs e)
        {
            SetupDownloadDir(Directory.GetCurrentDirectory() + @"/Downloads/");

            RunningPlatform();

            GetCurrentFiles();

            irc = new SimpleIRC();

            webserver = new HttpServer(HttpMessageReceived, port);
            webserver.SetWebHomeDir(Directory.GetCurrentDirectory() + @"/");
            webserver.SetFileDir(Directory.GetCurrentDirectory() + "/Downloads");
            webserver.SetDefaultPage("index.html");
            streamserver = new HttpServer(HttpMessageReceived, port + 1);
            streamserver.SetWebHomeDir(Directory.GetCurrentDirectory() + @"/Downloads");
            streamserver.SetFileDir(Directory.GetCurrentDirectory() + "/Downloads");
            streamserver.SetDefaultPage("index.html");

            State.Text = "Running (" + GetLocalIPAddress() + ":" + port.ToString() + ")";
        }
Ejemplo n.º 9
0
        public static void StartIRC(string ip, int port, string username, string channel)
        {
            try
            {
                if (irc.isClientRunning())
                {
                    irc.stopClient();
                }
            } catch
            {
            }
            irc = new SimpleIRC();
            irc.setupIrc(ip, port, username, "", channel, chatOutputCallback);
            irc.setDebugCallback(debugOutputCallback);
            irc.setDownloadStatusChangeCallback(downloadStatusCallback);
            irc.setUserListReceivedCallback(userListReceivedCallback);
            irc.setCustomDownloadDir(currentDownloadLocation);
            irc.startClient();

            int x = 3;

            while (x > 0)
            {
                Thread.Sleep(1000);
                x--;
            }

            if (!joinedChannel)
            {
                Console.WriteLine("DID NOT JOIN CHANNEL, RETRY!");
                StartIRC(ip, port, username, channel);
            }


            server.SendGlobalMessage("IrcConnected-CurrentDir^" + currentDownloadLocation);

            // irc.sendMessage("/join #nibl");
        }
Ejemplo n.º 10
0
        static void Main(string[] args)
        {
            //setup vars
            string ip;
            int    port;
            string username;
            string password;
            string channel;

            //setup screen:
            Console.WriteLine("Server IP(default is : 54.229.0.87(irc.rizon.net)) = ");
            if ((ip = Console.ReadLine()) == "")
            {
                ip = "54.229.0.87";
            }

            Console.WriteLine("Server Port(default is : 6667) = ");
            if (Console.ReadLine() != "")
            {
                port = Convert.ToInt32(Console.ReadLine());
            }
            else
            {
                port = 6667;
            }

            Console.WriteLine("Username(default is : RareIRC_Client) = ");
            if ((username = Console.ReadLine()) == "")
            {
                username = "******";
            }

            Console.WriteLine("Password(not working yet, default is : ) = ");
            if ((password = Console.ReadLine()) == "")
            {
                password = "";
            }

            Console.WriteLine("Channel(default is : #RareIRC) = ");
            if ((channel = Console.ReadLine()) == "")
            {
                channel = "#RareIRC";
            }

            irc = new SimpleIRC();
            irc.setupIrc(ip, port, username, password, channel, chatOutputCallback);
            irc.setDebugCallback(debugOutputCallback);
            irc.startClient();
            irc.setDownloadStatusChangeCallback(downloadStatusChanged);

            while (true)
            {
                string Input = Console.ReadLine();
                if (Input != null || Input != "" || Input != String.Empty)
                {
                    irc.sendMessage(Input);
                }
                if (!irc.isClientRunning())
                {
                    Console.WriteLine("CLIENT NOT RUNNING :S");
                    break;
                }
            }
        }
Ejemplo n.º 11
0
 /// <summary>
 /// Constructor for the debug form.
 /// </summary>
 /// <param name="irc">SimpleIRC instance</param>
 public DebugForm(SimpleIRC irc)
 {
     _simpleIrc = irc;
     InitializeComponent();
 }
Ejemplo n.º 12
0
        /// <Main>
        /// <summary>
        ///  Prompts user with the options for saving a log file and printing log messages to the console window
        ///  After that, it sets the default download directory
        ///  Following it checks the current operating system, and performs actions related to the operating system, see '<RunningPlatform>'
        ///  After that, it tries to locate all already downloaded files
        ///  Then initiates the IRC client for later usage
        ///  And after all that, starts the http servers (see class for more information)
        /// </summary
        /// </Main>
        static void Main(string[] args)
        {
            Console.WriteLine("Do you want to save debug messages to a log file? (Yes/No) (Left Empty means No): ");
            string shouldSaveDebug = Console.ReadLine();

            if (shouldSaveDebug.ToLower().Contains("yes"))
            {
                saveDebug = true;
            }
            else
            {
                saveDebug = false;
            }

            Console.WriteLine("Do you want to show debug messages in console? (Yes/No) (Left Empty means No): ");

            string shouldShowDebug = Console.ReadLine();

            if (shouldShowDebug.ToLower().Contains("yes"))
            {
                showDebug = true;
            }
            else
            {
                showDebug = false;
            }

            Console.WriteLine("URL To use in your webbrowser: " + GetLocalIPAddress() + ":" + port.ToString());

            SetupDownloadDir(Directory.GetCurrentDirectory() + @"/Downloads/");

            RunningPlatform();

            GetCurrentFiles();

            irc = new SimpleIRC();

            webserver = new HttpServer(HttpMessageReceived, port);
            webserver.SetWebHomeDir(Directory.GetCurrentDirectory() + @"/Views");
            webserver.SetFileDir(Directory.GetCurrentDirectory() + "/Downloads");
            webserver.SetDefaultPage("index.html");
            streamserver = new HttpServer(HttpMessageReceived, port + 1);
            streamserver.SetWebHomeDir(Directory.GetCurrentDirectory() + @"/Downloads");
            streamserver.SetFileDir(Directory.GetCurrentDirectory() + "/Downloads");
            streamserver.SetDefaultPage("index.html");

            while (true)
            {
                string toSend = Console.ReadLine();
                if (toSend != "")
                {
                    if (toSend == "curanime")
                    {
                        ParseAnimeSeason("http://myanimelist.net/anime/season", "current");
                        Console.WriteLine("starting to parse anime!");
                    }
                    else
                    {
                        webserver.SendMessage(toSend);
                    }
                }
            }
        }