예제 #1
0
        private void SocketOpened(object sender, System.EventArgs e)
        {
            //invoke when socket opened
            m_log.Info("Connnected to HappyFunTimes");
            m_connected = true;

            List <String> .Enumerator i = m_sendQueue.GetEnumerator();
            while (i.MoveNext())
            {
                m_socket.Send(i.Current);
            }
            m_sendQueue.Clear();

            try
            {
                // Inform the relayserver we're a server
                SendSysCmd("server", "-1", m_options);

                #if UNITY_STANDALONE_OSX
                if (m_options.sendFilesToServer)
                {
                    // Send the files
                    HFTWebFileLoader.LoadFiles((string filename, byte[] bytes) => {
                        m_log.Info("Send File: " + filename + ", size: " + bytes.Length);
                        SendSysCmd("addFile", "", new HFTMessageAddFile(filename, System.Convert.ToBase64String(bytes)));
                    });
                }
                #endif
            }
            catch (Exception ex)
            {
                m_log.Error(ex);
            }
        }
예제 #2
0
 HFTWebFileDB()
 {
     HFTWebFileLoader.LoadFiles((filename, bytes) => {
         AddFile(filename, bytes);
     });
 }