Exemple #1
0
        public ExtensionForm()
        {
            Triggers = new HTriggers(false);
            var extensionAssembly = Assembly.GetCallingAssembly();

            ExtensionInfo extensionInfo =
                Contractor.GetExtensionInfo(extensionAssembly);

            if (IsInstalled = (extensionInfo != null))
            {
                _contractor = extensionInfo.Contractor;

                Hash = extensionInfo.Hash;
                FileLocation = extensionInfo.FileLocation;

                var fileInfo = FileVersionInfo.GetVersionInfo(FileLocation);
                Version = new Version(fileInfo.ProductVersion);
                Identifier = fileInfo.FileDescription;
                Description = fileInfo.Comments;
                Creator = fileInfo.CompanyName;
            }
            else if (IsExternal)
            {
                _contractor = new Contractor();
                var externalContractor = HNode.ConnectAsync("127.0.0.1", 8787).Result;
                
                HMessage initializationMessage = externalContractor.ReceiveAsync().Result;
                _contractor.Hotel = (HHotel)initializationMessage.ReadShort();

                _contractor.GameData = new HGameData(initializationMessage.ReadString());
                _contractor.GameData.UniqueId = initializationMessage.ReadString();

                _contractor.Connection = new ExtensionBridge(externalContractor, this);
            }
        }
Exemple #2
0
        public HConnection()
        {
            _filters  = new HFilters();
            _triggers = new HTriggers(false);

            _resetHostLock    = new object();
            _disconnectLock   = new object();
            _sendToClientLock = new object();
            _sendToServerLock = new object();
        }
Exemple #3
0
        public HSession(string email, string password, HHotel hotel)
        {
            Email = email;
            Hotel = hotel;
            Password = password;

            Requester = new HRequest();
            Triggers = new HTriggers(false);

            _disconnectLock = new object();
            _hotelUri = new Uri(Hotel.ToUrl(true));
        }
Exemple #4
0
        /// <summary>
        /// Initializes a new instance of the <see cref="HConnection"/> class.
        /// </summary>
        public HConnection()
        {
            _disconnectLock = new object();

            Triggers         = new HTriggers(false);
            BlockedOutgoing  = new List <ushort>();
            BlockedIncoming  = new List <ushort>();
            ReplacedOutgoing = new Dictionary <ushort, byte[]>();
            ReplacedIncoming = new Dictionary <ushort, byte[]>();

            if (!File.Exists(_hostsFile))
            {
                File.Create(_hostsFile).Dispose();
            }

            File.SetAttributes(_hostsFile, FileAttributes.Normal);
        }
Exemple #5
0
        /// <summary>
        /// Initializes a new instance of the <see cref="HConnection"/> class.
        /// </summary>
        public HConnection()
        {
            _disconnectLock = new object();

            Triggers = new HTriggers(false);
            BlockedOutgoing = new List<ushort>();
            BlockedIncoming = new List<ushort>();
            ReplacedOutgoing = new Dictionary<ushort, byte[]>();
            ReplacedIncoming = new Dictionary<ushort, byte[]>();

            if (!File.Exists(_hostsFile))
                File.Create(_hostsFile).Dispose();

            File.SetAttributes(_hostsFile, FileAttributes.Normal);
        }
Exemple #6
0
        public HSession(string email, string password, HHotel hotel)
        {
            Email = email;
            Hotel = hotel;
            Password = password;
            Triggers = new HTriggers(false);
            Cookies = new CookieContainer();

            _disconnectLock = new object();
            _hotelUri = new Uri(Hotel.ToUrl());
        }