File: BingoSession.cs

package info (click to toggle)
indigo 1.4.3-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 48,936 kB
  • sloc: ansic: 332,816; cpp: 169,470; python: 20,033; java: 13,701; cs: 9,979; asm: 8,475; sql: 6,743; xml: 6,354; javascript: 1,245; sh: 555; php: 506; makefile: 54
file content (42 lines) | stat: -rw-r--r-- 993 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices;

namespace indigo
{
   class BingoSession : IDisposable
   {
      private ulong _session_id, _previous_session_id;

      public BingoSession()
      {
         _previous_session_id = BingoCore.lib.bingoGetSessionID();
         _session_id = BingoCore.lib.bingoAllocateSessionID();
         setSession();
      }

      public void setSession()
      {
         BingoCore.lib.bingoSetSessionID(_session_id);
      }

      public void Dispose()
      {
         _releaseSesssion();
         GC.SuppressFinalize(this);
      }

      ~BingoSession()
      {
         Dispose();
      }

      private void _releaseSesssion()
      {
         BingoCore.lib.bingoReleaseSessionID(_session_id);
         // Restore session ID because of possible nested BingoSessions
         BingoCore.lib.bingoSetSessionID(_previous_session_id);
      }
   }
}