Skip to content

Commit

Permalink
Added Gifslinks to Readme
Browse files Browse the repository at this point in the history
Workaround for the Socket closed bug (reopening socket)
  • Loading branch information
Versalkul committed Jun 28, 2016
1 parent ce81a69 commit ccb40d7
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 12 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ The session-cookie is what the website uses to "remember you".

## How to get your session cookie
Usually you can find the cookie in your browser. Search for a cookie named *'session'* on warframe.market and copy its content.
[How to get your session cookie in firefox] (http://imgur.com/7tamenv)
[How to get your session cookie in chrome] (http://imgur.com/NddsKgc)
Start the application and insert the cookie into the Session-Token field.

**Don't share this code with anyone as it allows full access to your account as long as you are logged in!**
Expand Down
12 changes: 8 additions & 4 deletions WarframeMarketClient/Logic/MarketManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ private void StateChecker(object o, ElapsedEventArgs args)



public void UpdateState() // change to parralell invoke
public void UpdateState()
{
if (socket.SocketWasClosed&&ApplicationState.getInstance().OnlineState.IsOnline())
{
Expand Down Expand Up @@ -277,12 +277,16 @@ public void UpdateChatOnlineState()
{
List<ChatMessage> msg = GetMessages(user); // the init with the chat messages is part of the forech below
ChatViewModel chat = new ChatViewModel(new User(user), msg);
chat.HasInfo = true;
ApplicationState.getInstance().Chats.Insert(0,chat);

ApplicationState.getInstance().Logger.Log(" Getting a new chat ");

ApplicationState.getInstance().InvokeNewMessage(this, chat.ChatMessages.ToList());
if (!chat.ChatMessages.Last().IsFromMe)
{
chat.HasInfo = true;
ApplicationState.getInstance().InvokeNewMessage(this, chat.ChatMessages.ToList());

}

elem--;
}

Expand Down
12 changes: 11 additions & 1 deletion WarframeMarketClient/Logic/SaveLoadFile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,9 @@ public void RemoveRegEntry()
public void ExtractStandartSounds()
{


try
{

File.WriteAllBytes(Path.Combine(soundFolderPath, "NewMessage.mp3"),Properties.Resources.NewMessage);
File.WriteAllBytes(Path.Combine(soundFolderPath, "NewMessage2.mp3"), Properties.Resources.NewMessage2);
File.WriteAllBytes(Path.Combine(soundFolderPath, "NewMessage3.mp3"), Properties.Resources.NewMessage3);
Expand All @@ -256,6 +258,14 @@ public void ExtractStandartSounds()
File.WriteAllBytes(Path.Combine(soundFolderPath, "NewMessage6.mp3"), Properties.Resources.NewMessage6);
File.WriteAllBytes(Path.Combine(soundFolderPath, "NewMessage7.mp3"), Properties.Resources.NewMessage7);
File.WriteAllBytes(Path.Combine(soundFolderPath, "NewMessage8.mp3"), Properties.Resources.NewMessage8);
}

catch(Exception e)
{
// will get logged automatically
//should not happen if not running from visual studio
//Thanks XDesProc -.-'
}


}
Expand Down
17 changes: 10 additions & 7 deletions WarframeMarketClient/Logic/SocketManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WarframeMarketClient.Extensions;
using WarframeMarketClient.Model;
using WebSocket4Net;

Expand Down Expand Up @@ -31,19 +32,22 @@ public SocketManager()
socket.Closed += Socket_Closed;
socket.EnableAutoSendPing = false;

}




}

#region events

private void Socket_Closed(object sender, EventArgs e)
{

ApplicationState.getInstance().Logger.Log("CLOSED SOCKET",false);
ApplicationState.getInstance().Logger.Log("CLOSED SOCKET was active " +socket.LastActiveTime,false);
SocketWasClosed = true;
if (ApplicationState.getInstance().OnlineState.IsOnline())
{
ApplicationState.getInstance().Market.EnsureSocketState(); // hacky solution for socket closing every 30 min (+-3 min)
ApplicationState.getInstance().Logger.Log("REOPENING CLOSED SOCKET", false);

}

}

Expand Down Expand Up @@ -100,8 +104,7 @@ public void EnsureOpenSocket()
{
lock (socket)
{

if (socket.State == WebSocketState.Closed||socket.State==WebSocketState.None) socket.Open();
if (socket.State == WebSocketState.Closed||socket.State==WebSocketState.None) socket.Open();
}
}

Expand Down
1 change: 1 addition & 0 deletions WarframeMarketClient/Model/ApplicationState.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ private ApplicationState()

private void Initialize() // Initializes that need the ApplicationState
{
if (Logger != null) return; // just to be sure
Logger = new Logger();
ItemMap.LoadMap();
(new SaveLoadFile()).ExtractStandartSounds();
Expand Down

0 comments on commit ccb40d7

Please sign in to comment.