コード例 #1
0
ファイル: ExtensionForm.cs プロジェクト: proxymoron/Sulakore
        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);
            }
        }
コード例 #2
0
ファイル: HSession.cs プロジェクト: jychan98/Sulakore
        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());
        }
コード例 #3
0
ファイル: HSession.cs プロジェクト: proxymoron/Sulakore
        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));
        }
コード例 #4
0
        public ExtensionForm()
        {
            _module = this;
            _unknownDataAttributes = new List <DataCaptureAttribute>();
            _inDataAttributes      = new Dictionary <ushort, List <DataCaptureAttribute> >();
            _outDataAttributes     = new Dictionary <ushort, List <DataCaptureAttribute> >();

            Triggers = new HTriggers();
            foreach (MethodInfo method in GetAllMethods(GetType()))
            {
                foreach (var dataCaptureAtt in method.GetCustomAttributes <DataCaptureAttribute>())
                {
                    if (dataCaptureAtt == null)
                    {
                        continue;
                    }

                    dataCaptureAtt.Method = method;
                    if (_unknownDataAttributes.Any(dca => dca.Equals(dataCaptureAtt)))
                    {
                        continue;
                    }

                    dataCaptureAtt.Target = this;
                    if (dataCaptureAtt.Id != null)
                    {
                        AddCallback(dataCaptureAtt, (ushort)dataCaptureAtt.Id);
                    }
                    else
                    {
                        _unknownDataAttributes.Add(dataCaptureAtt);
                    }
                }
            }

            if (Installer == null && IsRemoteModule)
            {
                _remoteContractor = GetRemoteContractor();
                if (_remoteContractor != null)
                {
                    _connection           = new ContractorProxy(_remoteContractor);
                    _initializationSource = new TaskCompletionSource <bool>();

                    Task receiveRemContDataTask = ReceiveRemoteContractorDataAsync();

                    RequestRemoteContractorData();
                    _initializationSource.Task.Wait();
                    _initializationSource = null;
                }
            }
        }