コード例 #1
0
 public GameOverScreen(Bindings activeBindings)
     : base(activeBindings)
 {
     TransitionOutEnabled = false;
     switch (activeBindings.PlayerIndex)
     {
         case PlayerIndex.One:
             activePlayerFolder = Player.One;
             break;
         case PlayerIndex.Two:
             activePlayerFolder = Player.Two;
             break;
     }
     gameOverOptions = new MenuOptions("Game Over",
         new Dictionary<string, Action<MenuOptionAction>>()
         {
             {"Retry", delegate { DisplayConfirmationDialog("Retry?", delegate{
                 RetroGame.PopScreen();
                 SaveGame loadedGame = RetroGame.Load(Saves.LastSaveFilename);
                 if (loadedGame != null)
                 {
                     Type[] powerupTypes = new Type[loadedGame.storePowerupTypeNames.Length];
                     for (int i = 0; i < powerupTypes.Length; i++)
                         powerupTypes[i] = Type.GetType(loadedGame.storePowerupTypeNames[i]);
                     RetroGame.AddScreen(new StoreScreen(powerupTypes), true);
                 }
                 }); }},
             {"Settings", delegate { settingsMode = SettingsMode.Menu; SetMenuOptions(GetSettingsOptions()); }},
             {"Quit to title", delegate { RetroGame.Reset(); RetroGame.PopScreen(true); RetroGame.AddScreen(new StartScreen(activeBindings), true); }},
         }
         , (Action<MenuOptionAction>)null);
     SetMenuOptions(gameOverOptions);
 }
コード例 #2
0
        /// <summary>
        /// Searches for local interfaces. Hints how to search for those interfaces are
        /// provided by the user through the <see cref="Bindings"/> instance.
        /// The results of that search are stored in this <see cref="Bindings"/> instance as well.
        /// </summary>
        /// <param name="bindings">The hints for the search and where to store the results.</param>
        /// <returns>The status of the search.</returns>
        public static string DiscoverInterfaces(Bindings bindings)
        {
            var sb = new StringBuilder("Discover status: ");
            var interfaces = NetworkInterface.GetAllNetworkInterfaces();

            foreach (var netInterface in interfaces)
            {
                if (netInterface.OperationalStatus != OperationalStatus.Up)
                {
                    continue;
                }
                if (bindings.AnyInterfaces)
                {
                    sb.Append(" ++").Append(netInterface.Name);
                    sb.Append(DiscoverNetwork(netInterface, bindings)).Append(", ");
                }
                else
                {
                    if (bindings.ContainsInterface(netInterface.Name))
                    {
                        sb.Append(" +").Append(netInterface.Name);
                        sb.Append(DiscoverNetwork(netInterface, bindings)).Append(", ");
                    }
                    else
                    {
                        sb.Append(" -").Append(netInterface.Name);
                    }
                }
            }
            // delete last char
            sb.Remove(sb.Length - 1, 1);
            return sb.Append(".").ToString();
        }
コード例 #3
0
ファイル: SlurpFunction.cs プロジェクト: tormaroe/mist
 public SlurpFunction(Bindings scope)
     : base("slurp", scope)
 {
     DocString = @"(slurp f)
     Reads the file named by f into a list of strings (separated by
     line breaks) and returns it.".ToExpression();
 }
コード例 #4
0
        //dummy screen that doesn't draw anything, just waits for a cancel action and disables all other input
        public RetroPortScreen(Hero controllingHero, InputAction cancelAction)
        {
            DrawPreviousScreen = true;

            bindings = controllingHero.bindings;
            this.controllingHero = controllingHero;
            this.cancelAction = cancelAction;
        }
コード例 #5
0
ファイル: DocFunction.cs プロジェクト: tormaroe/mist
        // Change to Special form, then get doc through the Scope (from the symbol, not the value)
        public DocFunction(Bindings scope)
            : base("doc", scope)
        {
            DocString =
                "Prints documentation for a var or special form given its name."
                .ToExpression();

            // TODO: print doc instead of returning, include info about formal parameters
            // Could also print a ruler
            // see http://clojuredocs.org/clojure_core/clojure.core/doc
        }
コード例 #6
0
ファイル: Let.cs プロジェクト: tormaroe/mist
        public override Expression Call(Expression expr)
        {
            var bindings = expr.Elements.Second().Elements;
            var tempScope = new Bindings() { ParentScope = Environment.CurrentScope };

            for (int i = 0; i < bindings.Count - 1; i = i + 2)
                tempScope.AddBinding(
                    bindings[i],
                    bindings[i + 1].Evaluate(tempScope));

            return Environment.WithScope(tempScope,
                () => expr.Elements.Skip(2).Evaluate(tempScope));
        }
コード例 #7
0
ファイル: PauseScreen.cs プロジェクト: foolmoron/Retroverse
 public PauseScreen(Bindings activeBindings)
     : base(activeBindings)
 {
     switch (activeBindings.PlayerIndex)
     {
         case PlayerIndex.One:
             activePlayerFolder = Player.One;
             break;
         case PlayerIndex.Two:
             activePlayerFolder = Player.Two;
             break;
     }
     Action onStoreTransition = delegate
         {
             RetroGame.storeChargeTime = 0;
             RetroGame.StoreCharge = 0;
             options["Go to Store"] = null;
             RetroGame.AddScreen(new StoreScreen(null), true);
             Highscores.Save();
             RetroGame.Save();
         };
     Action<MenuOptionAction> storeAction = delegate { SoundManager.SetMusicVolumeSmooth(0); RetroGame.AddScreen(new StaticTransitionScreen(TransitionMode.ToStatic, STATIC_TRANSITION_TIME, onStoreTransition, true)); };
     pauseOptions = new MenuOptions("Paused",
         new Dictionary<string, Action<MenuOptionAction>>()
         {
             {"Resume", delegate{ mode = MenuScreenMode.TransitioningOut; }},
             {"Go to Store", (RetroGame.StoreCharge >= 1) ? storeAction : null},
             {"Inventory", delegate{ RetroGame.AddScreen(new InventoryScreen(bindings)); }},
             {"Settings", delegate { settingsMode = SettingsMode.Menu; SetMenuOptions(GetSettingsOptions()); }},
             {"Restart", delegate { DisplayConfirmationDialog("Restart?", delegate{
                 RetroGame.PopScreen();
                 SaveGame loadedGame = RetroGame.Load(Saves.LastSaveFilename);
                 if (loadedGame != null)
                 {
                     Type[] powerupTypes = new Type[loadedGame.storePowerupTypeNames.Length];
                     for (int i = 0; i < powerupTypes.Length; i++)
                         powerupTypes[i] = Type.GetType(loadedGame.storePowerupTypeNames[i]);
                     RetroGame.AddScreen(new StoreScreen(powerupTypes), true);
                 }
                 }); }},
             {"Quit Game", delegate { DisplayConfirmationDialog("Quit?", delegate
                 {
                     RetroGame.Reset();
                     RetroGame.PopScreen();
                     RetroGame.AddScreen(new StartScreen(RetroGame.getHeroes()[0].bindings), true);
                     ((StartScreen)RetroGame.TopScreen).folderPositionRelative = StartScreen.FOLDER_SCREEN_POSITION_RELATIVE_SHOWN;
                 }); }},
         }
         , 0);
     SetMenuOptions(pauseOptions);
 }
コード例 #8
0
        /// <summary>
        /// Discovers network interfaces and addresses.
        /// </summary>
        /// <param name="networkInterface">The network interface to search for addresses to listen to.</param>
        /// <param name="bindings">The hints for the search and where to store the results.</param>
        /// <returns>The status of the discovery.</returns>
        public static string DiscoverNetwork(NetworkInterface networkInterface, Bindings bindings)
        {
            var sb = new StringBuilder("(");

            // this part is very .NET-specific
            var unicastIpc = networkInterface.GetIPProperties().UnicastAddresses;
            foreach (var addressInfo in unicastIpc)
            {
                if (addressInfo == null)
                {
                    continue;
                }
                IPAddress inet = addressInfo.Address;

                // getting the broadcast address
                var ipv4Mask = addressInfo.IPv4Mask; // 0.0.0.0 in case of IPv6
                var broadcastAddress = inet.GetBroadcastAddress(ipv4Mask);
                if (broadcastAddress != null && !bindings.BroadcastAddresses.Contains(broadcastAddress))
                {
                    bindings.BroadcastAddresses.Add(broadcastAddress);
                }

                if (bindings.ContainsAddress(inet))
                {
                    continue;
                }
                // ignore, if a user specifies an address and inet is not part of it
                if (!bindings.AnyAddresses)
                {
                    if (!bindings.Addresses.Contains(inet))
                    {
                        continue;
                    }
                }

                if (inet.IsIPv4() && bindings.IsIPv4)
                {
                    sb.Append(inet).Append(", ");
                    bindings.AddFoundAddress(inet);
                }
                else if (inet.IsIPv6() && bindings.IsIPv6)
                {
                    sb.Append(inet).Append(", ");
                    bindings.AddFoundAddress(inet);
                }
            }

            sb.Remove(sb.Length - 1, 1);
            return sb.Append(")").ToString();
        }
コード例 #9
0
        public InventoryScreen(Bindings activeBindings)
        {
            DrawPreviousScreen = true;

            bindingsOne = RetroGame.getHeroes()[0].bindings;
            if (RetroGame.NUM_PLAYERS > 1)
                bindingsTwo = RetroGame.getHeroes()[1].bindings;

            if (bindingsOne == activeBindings)
                activePlayerIndex = Player.One;
            else
                activePlayerIndex = Player.Two;

            Inventory.Reset();
        }
コード例 #10
0
ファイル: Hero.cs プロジェクト: foolmoron/Retroverse
        public Hero(PlayerIndex PlayerIndex)
            : base(new Vector2(Level.TEX_SIZE * LevelManager.STARTING_LEVEL.X + (Level.TILE_SIZE * (LevelManager.STARTING_TILE.X + 0.5f)), 
                               Level.TEX_SIZE * LevelManager.STARTING_LEVEL.Y + (Level.TILE_SIZE * (LevelManager.STARTING_TILE.Y + 0.5f))),
                   new Hitbox(32, 32))
        {
            Alive = true;
            this.PlayerIndex = PlayerIndex;
            this.playerIndex = (int)PlayerIndex;
            bindings = new Bindings(PlayerIndex);
            updateCurrentLevelAndTile();

            Powerups = new Dictionary<string, Powerup>();
            setTexture("hero");
            direction = Direction.Up;
            scale = 32f / getTexture().Width;
        }
コード例 #11
0
 /// <summary>
 /// Internal constructor since this is created by <see cref="Reservation"/> and should never be called directly.
 /// </summary>
 /// <param name="tcsChannelShutdownDone"></param>
 /// <param name="maxPermitsUdp"></param>
 /// <param name="maxPermitsTcp"></param>
 /// <param name="channelClientConfiguration"></param>
 internal ChannelCreator(TaskCompletionSource<object> tcsChannelShutdownDone,
     int maxPermitsUdp, int maxPermitsTcp,
     ChannelClientConfiguration channelClientConfiguration)
 {
     _tcsChannelShutdownDone = tcsChannelShutdownDone;
     _maxPermitsUdp = maxPermitsUdp;
     _maxPermitsTcp = maxPermitsTcp;
     _channelClientConfiguration = channelClientConfiguration;
     _externalBindings = channelClientConfiguration.BindingsOutgoing;
     if (maxPermitsUdp > 0)
     {
         _semaphoreUdp = new Semaphore(maxPermitsUdp, maxPermitsUdp);
     }
     if (maxPermitsTcp > 0)
     {
         _semaphoreTcp = new Semaphore(maxPermitsTcp, maxPermitsTcp);
     }
 }
コード例 #12
0
ファイル: MenuScreen.cs プロジェクト: foolmoron/Retroverse
        public MenuScreen(Bindings activeBindings)
        {
            DrawPreviousScreen = true;
            mode = MenuScreenMode.TransitioningIn;
            TransitionOutEnabled = true;

            bindings = activeBindings;

            settingsOptions = new MenuOptions("Settings",
                new Dictionary<string, Action<MenuOptionAction>>()
                {
                    {"<P1 Bindings>", bindingsMenuOptionDelegate},
                    {"Sound", delegate{ settingsMode = SettingsMode.Sound; SetMenuOptions(soundOptions); }},
                    {"Screen Size", delegate { settingsMode = SettingsMode.ScreenSize; SetMenuOptions(screenSizeOptions); }},
                    {"Reset Scores", delegate{ DisplayConfirmationDialog("Reset Scores?", delegate { RetroGame.ResetScores(); SetMenuOptions(settingsOptions); }); } },
                    {"Back", null }, //set dynamically
                }
                , "Back");

            soundOptions = new MenuOptions("Sound",
                new Dictionary<string, Action<MenuOptionAction>>()
                {
                    {"<Master>", delegate(MenuOptionAction action)
                        {
                            switch (action)
                            {
                                case MenuOptionAction.Click:
                                    if(SoundManager.MasterVolume != 0)
                                    {
                                        previousMasterVolume = SoundManager.MasterVolume;
                                        SoundManager.SetMasterVolume(0);
                                    }
                                    else
                                        SoundManager.SetMasterVolume(previousMasterVolume);
                                    break;
                                case MenuOptionAction.Left:
                                    SoundManager.SetMasterVolume(SoundManager.MasterVolume - VOLUME_SETTINGS_STEP);
                                    break;
                                case MenuOptionAction.Right:
                                    SoundManager.SetMasterVolume(SoundManager.MasterVolume + VOLUME_SETTINGS_STEP);
                                    break;
                            }
                            RetroGame.SaveConfig();
                        }},
                    {"<Music>", delegate(MenuOptionAction action)
                        {
                            switch (action)
                            {
                                case MenuOptionAction.Click:
                                    if (SoundManager.MusicMasterVolume != 0)
                                    {
                                        previousMusicVolume = SoundManager.MusicMasterVolume;
                                        SoundManager.SetMusicMasterVolume(0);
                                    }
                                    else
                                        SoundManager.SetMusicMasterVolume(previousMusicVolume);
                                    break;
                                case MenuOptionAction.Left:
                                    SoundManager.SetMusicMasterVolume(SoundManager.MusicMasterVolume - VOLUME_SETTINGS_STEP);
                                    break;
                                case MenuOptionAction.Right:
                                    SoundManager.SetMusicMasterVolume(SoundManager.MusicMasterVolume + VOLUME_SETTINGS_STEP);
                                    break;
                            }
                            RetroGame.SaveConfig();
                        }},
                    {"<Sounds>", delegate(MenuOptionAction action)
                        {
                            switch (action)
                            {
                                case MenuOptionAction.Click:
                                    if (SoundManager.SoundMasterVolume != 0)
                                    {
                                        previousSoundVolume = SoundManager.SoundMasterVolume;
                                        SoundManager.SetSoundMasterVolume(0);
                                    }
                                    else
                                        SoundManager.SetSoundMasterVolume(previousSoundVolume);
                                    break;
                                case MenuOptionAction.Left:
                                    SoundManager.SetSoundMasterVolume(SoundManager.SoundMasterVolume - VOLUME_SETTINGS_STEP);
                                    break;
                                case MenuOptionAction.Right:
                                    SoundManager.SetSoundMasterVolume(SoundManager.SoundMasterVolume + VOLUME_SETTINGS_STEP);
                                    break;
                            }
                            RetroGame.SaveConfig();
                        }},
                    {"Back", delegate{ settingsMode = SettingsMode.Menu; SetMenuOptions(settingsOptions); }},
                }
                , "Back");
            screenSizeOptions = new MenuOptions("Screen Size",
                new Dictionary<string, Action<MenuOptionAction>>()
                {
                    {"Small", delegate{ RetroGame.SetScreenSize(ScreenSize.Small); RetroGame.SaveConfig(); }},
                    {"Medium", delegate{ RetroGame.SetScreenSize(ScreenSize.Medium); RetroGame.SaveConfig(); }},
                    {"Large", delegate{ RetroGame.SetScreenSize(ScreenSize.Large); RetroGame.SaveConfig(); }},
                    {"Huge", delegate{ RetroGame.SetScreenSize(ScreenSize.Huge); RetroGame.SaveConfig(); }},
                    {"Back", delegate{ settingsMode = SettingsMode.Menu;  SetMenuOptions(settingsOptions); }},
                }
                , 4);
        }
コード例 #13
0
 private void OnStopTracking()
 {
     Bindings.StopTracking();
 }
コード例 #14
0
 public SetCategoryItemTemplate()
 {
     InitializeComponent();
     DataContextChanged += (s, e) => Bindings.Update();
 }
コード例 #15
0
 /// <summary>
 /// Initializes a new instance of the <see cref="MainPage"/> class
 /// </summary>
 public MainPage()
 {
     InitializeComponent();
     DataContextChanged += (s, e) => Bindings.Update();
 }
コード例 #16
0
ファイル: GtEqFunction.cs プロジェクト: tormaroe/mist
 public GtEqFunction(Bindings scope)
     : base(">=", scope)
 {
     Comparer = (a, b) => a >= b;
 }
コード例 #17
0
 public MyUserControl()
 {
     this.InitializeComponent();
     this.DataContextChanged += (s, e) => Bindings.Update();
     //MyCheckBox.IsChecked = App.SomeImportantValue;
 }
コード例 #18
0
 public void UpdateUI()
 {
     Bindings.Update();
     UpdateTotalStatistics();
 }
コード例 #19
0
 public DetailView()
 {
     InitializeComponent();
     DataContextChanged += (s, e) => Bindings.Update();
 }
コード例 #20
0
 public void Construct(Bindings bindings)
 {
 }
コード例 #21
0
 public virtual void Construct(Bindings bindings)
 {
     this.bindings = bindings;
 }
コード例 #22
0
 public NewsItemControl()
 {
     this.InitializeComponent();
     this.DataContextChanged += (s, e) => Bindings.Update();
 }
コード例 #23
0
 private void OnLoaded(object sender, RoutedEventArgs e)
 {
     Bindings.Update();
 }
コード例 #24
0
 private void OnUpdateBinding()
 {
     Bindings.Update();
 }
コード例 #25
0
    public static void Main(System.String[] args)
    {
        // Startup the prolog and show its err output!
          int test = 1;
          PrologSession session = null;
          PBTest evalTest = new PBTest();
          evalTest.prolog = args[0];

          try
        {
        //	  SupportClass.ThreadClass t = new SupportClass.ThreadClass(new ThreadStart(evalTest.Run));
          Thread t = new Thread(new ThreadStart(evalTest.Run));
          t.IsBackground = true;
          t.Start();

          // Get the port from the SICStus process (and fail if port is an error value)
          int port = evalTest.Port;
          if (port <= 0)
        {
          evalTest.fail("could not start sicstus", test);
        }

          session = new PrologSession();
        System.Console.Error.WriteLine("DBG: setting port; port==" + port);
        //	  session.Port = port;		// PrologBeans.NET.c# -version
          session.setPort(port);	// PrologBeans.NET.j# -version

          {
        System.Console.Error.WriteLine("DBG: setting timeout=0");
        //	    session.Timeout = 0; 	// PrologBeans.NET.c# -version
        session.setTimeout(0); 	// PrologBeans.NET.j# -version
          }

          // Test 1. - evaluation!
          Bindings bindings = new Bindings().bind("E", "10+20.");
          session.connect();	/* This will connect if neccessary. */
          QueryAnswer answer = session.executeQuery("evaluate(E,R)", bindings);
          PBTerm result = answer.getValue("R");
          if (result != null)
        {
          if (result.intValue() == 30)
        {
          success("10+20=" + result, test++);
        }
          else
        {
          evalTest.fail("Execution failed: " + result, test);
        }
        }
          else
        {
          evalTest.fail("Error " + answer.getError(), test);
        }

          // Test 2 - list reverse!
          bindings = new Bindings().bind("E", "reverse");
          answer = session.executeQuery("reverse(E,R)", bindings);
          result = answer.getValue("R");
          if (result != null)
        {
        //	      if ("esrever".Equals(result.ToString()))
        if (listcompare(result,"esrever"))
        {
          success("rev(reverse) -> " + result, test++);
        }
          else
        {
          evalTest.fail("Execution failed: " + result, test);
        }
        }
          else
        {
          evalTest.fail("Error " + answer.getError(), test);
        }

          // Test 2b - SPRM 13863 transfer lists of small integers
          PBTerm NIL = PBTerm.makeAtom("[]");
          PBTerm eTerm = PBTerm.makeTerm(PBTerm.makeTerm((int)127), PBTerm.makeTerm(PBTerm.makeTerm((int)128), PBTerm.makeTerm(PBTerm.makeTerm((int)129), NIL)));
          PBTerm rTerm = PBTerm.makeTerm(PBTerm.makeTerm((int)129), PBTerm.makeTerm(PBTerm.makeTerm((int)128), PBTerm.makeTerm(PBTerm.makeTerm((int)127), NIL)));
          bindings = new Bindings().bind("E", eTerm);
          answer = session.executeQuery("reverse(E,R)", bindings);
          result = answer.getValue("R");
          if (result != null) {
        if (listcompare(result,rTerm)) {
          success("rev(" + eTerm + ") -> " + result, test++);
        } else {
          evalTest.fail("Execution failed: " + "rev(" + eTerm + ") -> " + result, test);
        }
          } else {
        evalTest.fail("Error " + answer.getError(), test);
          }

          // Test 3 - show developers
          // [PD] 3.12.3 Test non-ascii character in query name
          answer = session.executeQuery("devel\x00f6pers(Dev)");
          result = answer.getValue("Dev");
          if (result != null)
        {
        //		if (result.ProperList)     // PrologBeans.NET.c# -version
        if (result.isProperList()) // PrologBeans.NET.j# -version
        {
          PBTerm list = result;
          if (list.length() == 4 &&
              "Joakim".Equals(list.head().ToString()) &&
              "Niclas".Equals(list.tail().head().ToString()) &&
              "Per".Equals(list.tail().tail().head().ToString()) &&
        // [PD] 3.12.2 Do not use non-ASCII literals
        //		      "едц≈ƒ÷".Equals(list.getTermAt(4).ToString()))
          "\u00e5\u00e4\u00f6\u00c5\u00c4\u00d6".Equals(list.tail().tail().tail().head().ToString())) {
          // [PD] 3.12.3 Test non-ascii character in query name
              success("devel\x00f6pers -> " + result, test++);
            }
          else
            {
              evalTest.fail("Execution failed: " + result, test);
            }
        }
          else
        {
          evalTest.fail("Execution failed: " + result, test);
        }
        }
          else
        {
          evalTest.fail("Error " + answer.getError(), test);
        }

          // Test 4 - send and receive a complex string-list
          String str = "foo\u1267bar";
          bindings = new Bindings().bind("L1", str);
          answer = session.executeQuery("send_receive(L1,L2)", bindings);
          result = answer.getValue("L2");
          if( result != null) {
        //	    if (((PBString)result).equals(str)) {
        if (listcompare(result, str)) {
          success("send_receive(" + str + ") -> " + result, test++);
        } else {
          evalTest.fail("Execution failed: " + result, test);
        }
          } else {
        evalTest.fail("Error " + answer.getError(), test);
          }

          // Test 5 - send and receive a very large atom
          int stringLength = 100000;
          String longStr = new String('x', stringLength);
          bindings = new Bindings().bind("L1", longStr);
          answer = session.executeQuery("send_receive(L1,L2)", bindings);
          result = answer.getValue("L2");
          if( result != null) {
        if (result.getString().Equals(longStr)) {
          success("OK (" + stringLength + " characters)", test++);
        } else {
          evalTest.fail("Execution failed: " + stringLength + " characters",
                test);
        }
          } else {
        evalTest.fail("Error " + answer.getError() + ", " + stringLength
              + " characters", test);
          }

          // Test 6. Attributed variables
          bindings = new Bindings();
          bindings.bind("N",1);
          bindings.bind("M",5);
          answer = session.executeQuery("newVar(X,N,M)",bindings);
          result = answer.getValue("X");
          if( result != null) {
          if (result.isVariable()) {
              success("OK", test++);
          } else {
              evalTest.fail("Execution failed: " + stringLength + " characters", test);
          }
          } else {
          evalTest.fail("Error " + answer.getError() + ", " + stringLength
               + " characters", test);
          }

          // Test 7. shutdown server...
          session.executeQuery("shutdown");
          if (!evalTest.waitForShutdown())
        {
          evalTest.fail("shutdown", test++);
        }
          else
        {
          success("shutdown", test++);
        }
        }
          catch (System.Exception e)
        {
          if (error == 0)
        {
          Console.Error.WriteLine("PBTest.Main caught an exception.");
          System.Console.Error.WriteLine(e);
        //	      SupportClass.WriteStackTrace(e, Console.Error);
              Console.Error.WriteLine(e.ToString());
          Console.Error.Flush();
          evalTest.fail("Exception " + e.Message, test);
        }
        }
          finally
        {
          if (session != null)
        {
          session.disconnect();
        }
          evalTest.shutdown();
          System.Environment.Exit(error);
        }
    }
コード例 #26
0
ファイル: TriggerBlock.xaml.cs プロジェクト: jcsbmwxyha/UWP
 public TriggerBlock()
 {
     this.InitializeComponent();
     this.DataContextChanged += (s, e) => Bindings.Update();
 }
コード例 #27
0
        /// <summary>
        /// Needs 3 connections. Cleans up channel creator, which means they will be released.
        /// </summary>
        /// <param name="tcsDiscover"></param>
        /// <param name="peerAddress"></param>
        /// <param name="cc"></param>
        /// <param name="configuration"></param>
        private void Discover(TcsDiscover tcsDiscover, PeerAddress peerAddress, ChannelCreator cc,
            IConnectionConfiguration configuration)
        {
            _peer.PingRpc.AddPeerReachableListener(new DiscoverPeerReachableListener(tcsDiscover));

            var taskResponseTcp = _peer.PingRpc.PingTcpDiscoverAsync(peerAddress, cc, configuration, SenderAddress);
            taskResponseTcp.ContinueWith(taskResponse =>
            {
                var serverAddress = _peer.PeerBean.ServerPeerAddress;
                if (!taskResponse.IsFaulted)
                {
                    var tmp = taskResponseTcp.Result.NeighborsSet(0).Neighbors;
                    tcsDiscover.SetReporter(taskResponseTcp.Result.Sender);
                    if (tmp.Count == 1)
                    {
                        var seenAs = tmp.First();
                        Logger.Info("This peer is seen as {0} by peer {1}. This peer sees itself as {2}.", seenAs, peerAddress, _peer.PeerAddress.InetAddress);
                        if (!_peer.PeerAddress.InetAddress.Equals(seenAs.InetAddress))
                        {
                            // check if we have this interface on that we can listen to
                            var bindings = new Bindings().AddAddress(seenAs.InetAddress);
                            var status = DiscoverNetworks.DiscoverInterfaces(bindings);
                            Logger.Info("2nd interface discovery: {0}.", status);
                            if (bindings.FoundAddresses.Count > 0
                                && bindings.FoundAddresses.Contains(seenAs.InetAddress))
                            {
                                serverAddress = serverAddress.ChangeAddress(seenAs.InetAddress);
                                _peer.PeerBean.SetServerPeerAddress(serverAddress);
                                Logger.Info("This peer had the wrong interface. Changed it to {0}.", serverAddress);
                            }
                            else
                            {
                                // now we know our internal IP, where we receive packets
                                var ports =
                                    _peer.ConnectionBean.ChannelServer.ChannelServerConfiguration.PortsForwarding;
                                if (ports.IsManualPort)
                                {
                                    serverAddress = serverAddress.ChangePorts(ports.TcpPort, ports.UdpPort);
                                    serverAddress = serverAddress.ChangeAddress(seenAs.InetAddress);
                                    _peer.PeerBean.SetServerPeerAddress(serverAddress);
                                    Logger.Info("This peer had manual ports. Changed it to {0}.", serverAddress);
                                }
                                else
                                {
                                    // we need to find a relay, because there is a NAT in the way
                                    tcsDiscover.SetExternalHost(
                                        "We are most likely behind a NAT. Try to UPNP, NAT-PMP or relay " + peerAddress, taskResponseTcp.Result.Recipient.InetAddress, seenAs.InetAddress);
                                    return;
                                }
                            }
                        }
                        // else -> we announce exactly how the other peer sees us
                        var taskResponse1 = _peer.PingRpc.PingTcpProbeAsync(peerAddress, cc, configuration);
                        taskResponse1.ContinueWith(tr1 =>
                        {
                            if (tr1.IsFaulted)
                            {
                                tcsDiscover.SetException(new TaskFailedException("TcsDiscover (2): We need at least the TCP connection.", tr1));
                            }
                        });
                        
                        var taskResponse2 = _peer.PingRpc.PingUdpProbeAsync(peerAddress, cc, configuration);
                        taskResponse2.ContinueWith(tr2 =>
                        {
                            if (tr2.IsFaulted)
                            {
                                Logger.Warn("TcsDiscover (2): UDP failed connection.");
                            }
                        });

                        // from here we probe, set the timeout here
                        tcsDiscover.Timeout(serverAddress, _peer.ConnectionBean.Timer, DiscoverTimeoutSec);
                        return;
                    }
                    tcsDiscover.SetException(new TaskFailedException(String.Format("Peer {0} did not report our IP address.", peerAddress)));
                }
                else
                {
                    tcsDiscover.SetException(new TaskFailedException("TcsDiscover (1): We need at least the TCP connection.", taskResponse));
                }
            });
        }
コード例 #28
0
 private void OnDataContextChanged(FrameworkElement sender, DataContextChangedEventArgs args)
 {
     Bindings.Update();
 }
コード例 #29
0
 public unsafe static int QueryContextChannelBinding(SafeDeleteContext phContext, Interop.Secur32.ContextAttribute contextAttribute, Bindings* buffer, SafeFreeContextBufferChannelBinding refHandle)
 {
     return QueryContextChannelBinding_SECURITY(phContext, contextAttribute, buffer, refHandle);
 }
コード例 #30
0
 /// <summary>
 /// Constructor for <see cref="ApplyToData"/> method.
 /// </summary>
 private GenericScorer(IHostEnvironment env, GenericScorer transform, IDataView data)
     : base(env, data, RegistrationName, transform.Bindable)
 {
     _bindings = transform._bindings.ApplyToSchema(env, data.Schema);
     Schema    = Schema.Create(_bindings);
 }
コード例 #31
0
ファイル: PeerBuilder.cs プロジェクト: lanicon/TomP2P.NET
 public PeerBuilder SetExternalBindings(Bindings externalBindings)
 {
     ExternalBindings = externalBindings;
     return(this);
 }
コード例 #32
0
 public ProposalListUserControl()
 {
     this.InitializeComponent();
     this.DataContextChanged += (s, e) => Bindings.Update();
 }
コード例 #33
0
ファイル: MultiBind.cs プロジェクト: DrJohnMelville/Melville
 private void AddBinding(object item)
 {
     Bindings.Add(BindTo(item));
 }
コード例 #34
0
 public MomentItem()
 {
     this.InitializeComponent();
     this.DataContextChanged += (s, e) => Bindings.Update();
 }
コード例 #35
0
 /// <summary>
 /// Reset the index list to default
 /// </summary>
 public void ResetIndices()
 {
     StaticIndices = new ObservableCollection <SeriesIndex>(DataManager.WatchedIdx);
     Bindings.Update();
 }
コード例 #36
0
ファイル: Lambda.cs プロジェクト: 1tgr/FirstClassLisp
 public ArgBody(Datum argDatum, Datum body)
 {
     this.argDatum = argDatum;
     this.binding = BindingTypes.parse(argDatum);
     this.body = body;
 }
コード例 #37
0
ファイル: AllBindingsFunction.cs プロジェクト: tormaroe/mist
 public AllBindingsFunction(Bindings scope)
     : base("all-bindings", scope)
 {
 }
コード例 #38
0
ファイル: ApplyFunction.cs プロジェクト: tormaroe/mist
 public ApplyFunction(Bindings scope)
     : base("apply", scope)
 {
 }
コード例 #39
0
ファイル: ReduceFunction.cs プロジェクト: tormaroe/mist
 public ReduceFunction(Bindings scope)
     : base("reduce", scope)
 {
 }
コード例 #40
0
ファイル: Controller.cs プロジェクト: glocklueng/px360
        public X360State GetState(Bindings bindings, int w, int h)
        {
            this.state.UpdateState(bindings, w, h);

            return this.state;
        }
コード例 #41
0
ファイル: ReverseFunction.cs プロジェクト: tormaroe/mist
 public ReverseFunction(Bindings scope)
     : base("reverse", scope)
 {
 }
コード例 #42
0
            // Note that we don't filter out rows with parsing issues since it's not acceptable to
            // produce a different set of rows when subsetting columns. Any parsing errors need to be
            // translated to NaN, not result in skipping the row. We should produce some diagnostics
            // to alert the user to the issues.
            private Cursor(TextLoader parent, ParseStats stats, bool[] active, LineReader reader, int srcNeeded, int cthd)
                : base(parent._host)
            {
                Ch.Assert(active == null || active.Length == parent._bindings.OutputSchema.Count);
                Ch.AssertValue(reader);
                Ch.AssertValue(stats);
                Ch.Assert(srcNeeded >= 0);
                Ch.Assert(cthd > 0);

                _total     = -1;
                _batch     = -1;
                _bindings  = parent._bindings;
                _parser    = parent._parser;
                _active    = active;
                _reader    = reader;
                _stats     = stats;
                _srcNeeded = srcNeeded;

                ParallelState state = null;

                if (cthd > 1)
                {
                    state = new ParallelState(this, out _rows, cthd);
                }
                else
                {
                    _rows = _parser.CreateRowSet(_stats, 1, _active);
                }

                try
                {
                    _getters = new Delegate[_bindings.Infos.Length];
                    for (int i = 0; i < _getters.Length; i++)
                    {
                        if (_active != null && !_active[i])
                        {
                            continue;
                        }
                        ColumnPipe v = _rows.Pipes[i];
                        Ch.Assert(v != null);
                        _getters[i] = v.GetGetter();
                        Ch.Assert(_getters[i] != null);
                    }

                    if (state != null)
                    {
                        _ator = ParseParallel(state).GetEnumerator();
                        state = null;
                    }
                    else
                    {
                        _ator = ParseSequential().GetEnumerator();
                    }
                }
                finally
                {
                    if (state != null)
                    {
                        state.Dispose();
                    }
                }
            }
コード例 #43
0
 private NltTokenizeTransform(IHostEnvironment env, NltTokenizeTransform xf, IDataView newSource)
     : base(env, RegistrationName, newSource)
 {
     _bindings = Bindings.Create(xf._bindings, newSource.Schema);
 }
コード例 #44
0
        private async void TimeSlotBox_DropDownOpened(object sender, object e)
        {
            await viewModel.GetTimeSlots(viewModel.app.DOC_ID, viewModel.app.HOS_ID, app_date);

            Bindings.Update();
        }
コード例 #45
0
ファイル: FirstFunction.cs プロジェクト: tormaroe/mist
 public FirstFunction(Bindings scope)
     : base("first", scope)
 {
 }
コード例 #46
0
ファイル: Program.cs プロジェクト: xamarin-forks/ImmutableUI
        static void BindType(TypeBinding type, Bindings bindings)
        {
            try {
                var t  = type.Definition;
                var h  = GetHierarchy(type.Definition).ToList();
                var bh = h.Select(x => bindings.Types.FirstOrDefault(y => y.Name == x.Item2.FullName))
                         .Where(x => x != null)
                         .ToList();

                string Name(TypeReference tref)
                {
                    if (tref.IsGenericParameter)
                    {
                        var r = ResolveGenericParameter(tref, h);
                        return(Name(r));
                    }
                    if (tref.IsGenericInstance)
                    {
                        var n  = tref.Name.Substring(0, tref.Name.IndexOf('`'));
                        var ns = tref.Namespace;
                        if (tref.IsNested)
                        {
                            n  = tref.DeclaringType.Name + "." + n;
                            ns = tref.DeclaringType.Namespace;
                        }
                        var args = string.Join(", ", ((GenericInstanceType)tref).GenericArguments.Select(Name));
                        return($"{ns}.{n}<{args}>");
                    }
                    switch (tref.FullName)
                    {
                    case "System.String": return("string");

                    case "System.Boolean": return("bool");

                    case "System.Int32": return("int");

                    case "System.Double": return("double");

                    case "System.Single": return("float");

                    default:
                        if (bindings.Types.FirstOrDefault(x => x.Name == tref.FullName) is TypeBinding tb)
                        {
                            return(tb.BoundName);
                        }
                        return(tref.FullName.Replace('/', '.'));
                    }
                }

                var ctor = t.Methods
                           .Where(x => x.IsConstructor && x.IsPublic)
                           .OrderBy(x => x.Parameters.Count)
                           .FirstOrDefault();

                var w = new StringWriter();
                w.Write($"public partial class {type.BoundName}");
                var baseType = bh.Count > 1 ? bh[1] : null;
                if (baseType != null)
                {
                    w.WriteLine($" : {baseType.BoundName}");
                }
                else
                {
                    w.WriteLine();
                }
                w.WriteLine("{");

                //
                // Properties
                //
                var allmembers = (from x in bh from y in x.Members select y).ToList();

                foreach (var m in type.Members)
                {
                    w.WriteLine($"\tpublic {Name(m.BoundType)} {m.Name} {{ get; }}");
                }

                //
                // Constructor
                //
                w.Write($"\tpublic {type.BoundName}(");
                var head = "";
                foreach (var m in allmembers)
                {
                    w.Write($"{head}{Name(m.BoundType)} {m.LowerName} = {m.BoundConstDefault}");
                    head = ", ";
                }
                w.Write($")");
                if (baseType != null)
                {
                    w.WriteLine();
                    w.Write("\t\t: base(");
                    head = "";
                    foreach (var b in bh.Skip(1))
                    {
                        foreach (var m in b.Members)
                        {
                            w.Write($"{head}{m.LowerName}");
                            head = ", ";
                        }
                    }
                    w.Write($")");
                }
                w.WriteLine(" {");
                foreach (var m in type.Members)
                {
                    var v = m.LowerName;
                    if (m.BoundConstDefault != m.Default)
                    {
                        v = $"{m.LowerName} == {m.ConstDefault} ? {m.Default} : {m.LowerName}";
                    }
                    w.WriteLine($"\t\t{m.Name} = {v};");
                }
                w.WriteLine("\t}");

                //
                // With*
                //
                foreach (var m in allmembers)
                {
                    var owner = bh.FirstOrDefault(x => x.Members.Contains(m));
                    if (owner == type)
                    {
                        w.Write($"\tpublic virtual {type.BoundName} With{m.Name}({Name(m.BoundType)} {m.LowerName}) => new {type.BoundName}(");
                    }
                    else
                    {
                        w.Write($"\tpublic override {owner.BoundName} With{m.Name}({Name(m.BoundType)} {m.LowerName}) => new {type.BoundName}(");
                    }
                    head = "";
                    foreach (var o in allmembers)
                    {
                        var v = o == m ? m.LowerName : o.Name;
                        w.Write($"{head}{v}");
                        head = ", ";
                    }
                    w.WriteLine(");");
                }

                //
                // Equality
                //
                w.WriteLine("\tpublic override bool Equals(object obj) {");
                w.WriteLine($"\t\tif (obj == null || GetType() != obj.GetType()) return false;");
                w.WriteLine($"\t\tvar o = ({type.BoundName})obj;");
                w.Write("\t\treturn ");
                if (allmembers.Count > 0)
                {
                    head = "";
                    foreach (var m in allmembers)
                    {
                        if (!string.IsNullOrEmpty(m.Equality))
                        {
                            w.Write($"{head}{m.Equality}");
                        }
                        else
                        {
                            w.Write($"{head}{m.Name} == o.{m.Name}");
                        }
                        head = " && ";
                    }
                    w.WriteLine(";");
                }
                else
                {
                    w.WriteLine("true;");
                }
                w.WriteLine("\t}");

                //
                // Hash Code
                //
                w.WriteLine("\tpublic override int GetHashCode() {");
                if (baseType != null)
                {
                    w.WriteLine($"\t\tvar hash = base.GetHashCode();");
                }
                else
                {
                    w.WriteLine($"\t\tvar hash = 17;");
                }
                foreach (var m in type.Members)
                {
                    var bt = ResolveGenericParameter(m.BoundType, h);
                    if (bt.IsValueType)
                    {
                        w.WriteLine($"\t\thash = hash * 37 + {m.Name}.GetHashCode();");
                    }
                    else
                    {
                        w.WriteLine($"\t\thash = hash * 37 + ({m.Name} != null ? {m.Name}.GetHashCode() : 0);");
                    }
                }
                w.WriteLine("\t\treturn hash;");
                w.WriteLine("\t}");

                //
                // Creates
                //
                if (t.IsAbstract || ctor == null || ctor.Parameters.Count != 0)
                {
                    w.WriteLine($"\tpublic virtual {t.FullName} Create{t.Name}() => throw new System.NotSupportedException(\"Cannot create {t.FullName} from \" + GetType().FullName);");
                }
                else
                {
                    w.WriteLine($"\tpublic virtual {t.FullName} Create{t.Name}() {{");
                    w.WriteLine($"\t\tvar target = new {t.FullName}();");
                    w.WriteLine($"\t\tApply(target);");
                    w.WriteLine($"\t\treturn target;");
                    w.WriteLine("\t}");
                    foreach (var b in bh.Skip(1))
                    {
                        w.WriteLine($"\tpublic override {b.Definition.FullName} Create{b.Definition.Name}() => Create{t.Name}();");
                    }
                }

                //
                // Apply
                //
                var refToken = t.IsValueType ? "ref " : "";
                w.WriteLine($"\tpublic virtual void Apply({refToken}{t.FullName} target) {{");
                if (baseType != null)
                {
                    w.WriteLine($"\t\tbase.Apply(target);");
                }
                foreach (var m in type.Members)
                {
                    var bt = ResolveGenericParameter(m.BoundType, h);
                    if (!string.IsNullOrEmpty(m.Apply))
                    {
                        w.WriteLine($"\t\t{m.Apply}");
                    }
                    else if (GetListItemType(m.BoundType, h) is var etype && etype != null)
                    {
                        w.WriteLine($"\t\tif ({m.Name} == null || {m.Name}.Count == 0) target.{m.Name}?.Clear();");
                        w.WriteLine($"\t\telse {{");
                        w.WriteLine($"\t\t\twhile (target.{m.Name}.Count > {m.Name}.Count) target.{m.Name}.RemoveAt(target.{m.Name}.Count - 1);");
                        w.WriteLine($"\t\t\tvar n = target.{m.Name}.Count;");
                        w.WriteLine($"\t\t\tfor (var i = n; i < {m.Name}.Count; i++) target.{m.Name}.Insert(i, {m.Name}[i].Create{etype.Name}());");
                        w.WriteLine($"\t\t\tfor (var i = 0; i < n; i++) {m.Name}[i].Apply(target.{m.Name}[i]);");
                        w.WriteLine($"\t\t}}");
                    }
                    else
                    {
                        if (bindings.FindType(bt.FullName) is TypeBinding b)
                        {
                            if (bt.IsValueType)
                            {
                                w.WriteLine($"\t\ttarget.{m.Name} = {m.Name}.Create{bt.Name}();");
                            }
                            else
                            {
                                w.WriteLine($"\t\tif ({m.Name} != null) {{");
                                w.WriteLine($"\t\t\tif (target.{m.Name} is {bt.FullName} {m.LowerName}) {m.Name}.Apply({m.LowerName});");
                                w.WriteLine($"\t\t\telse target.{m.Name} = {m.Name}.Create{bt.Name}();");
                                w.WriteLine($"\t\t}} else target.{m.Name} = null;");
                            }
                        }
                        else
                        {
                            w.WriteLine($"\t\ttarget.{m.Name} = {m.Name};");
                        }
                    }
                }
コード例 #47
0
ファイル: FilterFunction.cs プロジェクト: tormaroe/mist
 public FilterFunction(Bindings scope)
     : base("filter", scope)
 {
 }
コード例 #48
0
 private void firstTimeSetup()
 {
     Bindings.setDefaults();
     PlayerPrefs.SetInt("firstTimeCheck", 0);//TODO will no longer flag the first time setup
 }
コード例 #49
0
ファイル: EqualsFunction.cs プロジェクト: tormaroe/mist
 public EqualsFunction(Bindings scope)
     : base("=", scope)
 {
 }
コード例 #50
0
 private void normalSetup()
 {
     Bindings.initializeKeys();
 }
コード例 #51
0
ファイル: LTGTFunctionBase.cs プロジェクト: tormaroe/mist
 public LTGTFunctionBase(string symbol, Bindings scope)
     : base(symbol, scope)
 {
 }
コード例 #52
0
 public void UpdateBindings()
 {
     Bindings.Update();
 }
コード例 #53
0
ファイル: RestFunction.cs プロジェクト: tormaroe/mist
 public RestFunction(Bindings scope)
     : base("rest", scope)
 {
 }
コード例 #54
0
 public override Expression ToExpression( )
 {
     return(Expression.MemberInit(( NewExpression )NewExpression.ToExpression( ), Bindings.GetMemberBindings( )));
 }
コード例 #55
0
ファイル: LTFunction.cs プロジェクト: tormaroe/mist
 public LTFunction(Bindings scope)
     : base("<", scope)
 {
     Comparer = (a, b) => a < b;
 }
コード例 #56
0
ファイル: PeerBuilder.cs プロジェクト: lanicon/TomP2P.NET
        /// <summary>
        /// Creates a peer and starts to listen for incoming connections.
        /// </summary>
        /// <returns>The peer that can operate in the P2P network.</returns>
        public Peer Start()
        {
            if (_behindFirewall == null)
            {
                _behindFirewall = false;
            }

            if (ChannelServerConfiguration == null)
            {
                ChannelServerConfiguration = CreateDefaultChannelServerConfiguration();
                ChannelServerConfiguration.SetPortsForwarding(new Ports(TcpPortForwarding, UdpPortForwarding));
                if (TcpPort == -1)
                {
                    TcpPort = Ports.DefaultPort;
                }
                if (UdpPort == -1)
                {
                    UdpPort = Ports.DefaultPort;
                }
                ChannelServerConfiguration.SetPorts(new Ports(TcpPort, UdpPort));
                ChannelServerConfiguration.SetIsBehindFirewall(_behindFirewall.Value);
            }
            if (ChannelClientConfiguration == null)
            {
                ChannelClientConfiguration = CreateDefaultChannelClientConfiguration();
            }

            if (KeyPair == null)
            {
                KeyPair = EmptyKeyPair;
            }
            if (P2PId == -1)
            {
                P2PId = 1;
            }

            if (InterfaceBindings == null)
            {
                InterfaceBindings = new Bindings();
            }
            ChannelServerConfiguration.SetBindingsIncoming(InterfaceBindings);
            if (ExternalBindings == null)
            {
                ExternalBindings = new Bindings();
            }
            ChannelClientConfiguration.SetBindingsOutgoing(ExternalBindings);

            if (PeerMap == null)
            {
                PeerMap = new PeerMap(new PeerMapConfiguration(PeerId));
            }

            if (MasterPeer == null && Timer == null)
            {
                Timer = new ExecutorService();
            }

            PeerCreator peerCreator;

            if (MasterPeer != null)
            {
                // create slave peer
                peerCreator = new PeerCreator(MasterPeer.PeerCreator, PeerId, KeyPair);
            }
            else
            {
                // create master peer
                peerCreator = new PeerCreator(P2PId, PeerId, KeyPair, ChannelServerConfiguration, ChannelClientConfiguration, Timer);
            }

            var peer = new Peer(P2PId, PeerId, peerCreator);

            var peerBean = peerCreator.PeerBean;

            peerBean.AddPeerStatusListener(PeerMap);

            var connectionBean = peerCreator.ConnectionBean;

            peerBean.SetPeerMap(PeerMap);
            peerBean.SetKeyPair(KeyPair);

            if (BloomfilterFactory == null)
            {
                peerBean.SetBloomfilterFactory(new DefaultBloomFilterFactory());
            }

            if (BroadcastHandler == null)
            {
                BroadcastHandler = new DefaultBroadcastHandler(peer, new Random());
            }

            // set/enable RPC
            if (IsEnabledHandshakeRpc)
            {
                var pingRpc = new PingRpc(peerBean, connectionBean);
                peer.SetPingRpc(pingRpc);
            }
            if (IsEnabledQuitRpc)
            {
                var quitRpc = new QuitRpc(peerBean, connectionBean);
                quitRpc.AddPeerStatusListener(PeerMap);
                peer.SetQuitRpc(quitRpc);
            }
            if (IsEnabledNeighborRpc)
            {
                var neighborRpc = new NeighborRpc(peerBean, connectionBean);
                peer.SetNeighborRpc(neighborRpc);
            }
            if (IsEnabledDirectDataRpc)
            {
                var directDataRpc = new DirectDataRpc(peerBean, connectionBean);
                peer.SetDirectDataRpc(directDataRpc);
            }
            if (IsEnabledBroadcastRpc)
            {
                var broadcastRpc = new BroadcastRpc(peerBean, connectionBean, BroadcastHandler);
                peer.SetBroadcastRpc(broadcastRpc);
            }
            if (IsEnabledRoutingRpc && IsEnabledNeighborRpc)
            {
                var routing = new DistributedRouting(peerBean, peer.NeighborRpc);
                peer.SetDistributedRouting(routing);
            }

            if (MaintenanceTask == null && IsEnabledMaintenance)
            {
                MaintenanceTask = new MaintenanceTask();
            }
            if (MaintenanceTask != null)
            {
                MaintenanceTask.Init(peer, connectionBean.Timer);
                MaintenanceTask.AddMaintainable(PeerMap);
            }
            peerBean.SetMaintenanceTask(MaintenanceTask);

            // set the ping builder for the heart beat
            connectionBean.Sender.SetPingBuilderFactory(new PingBuilderFactory(peer));

            foreach (var peerInit in _toInitialize)
            {
                peerInit.Init(peer);
            }
            return(peer);
        }
コード例 #57
0
 public ChannelClientConfiguration SetBindingsOutgoing(Bindings bindingsOutgoing)
 {
     BindingsOutgoing = bindingsOutgoing;
     return this;
 }
コード例 #58
0
ファイル: PeerBuilder.cs プロジェクト: lanicon/TomP2P.NET
 /// <summary>
 /// Sets the interface- and external bindings to the specified value.
 /// </summary>
 /// <param name="bindings"></param>
 /// <returns></returns>
 public PeerBuilder SetBindings(Bindings bindings)
 {
     InterfaceBindings = bindings;
     ExternalBindings  = bindings;
     return(this);
 }
コード例 #59
0
        private unsafe static int QueryContextChannelBinding_SECURITY(SafeDeleteContext phContext, Interop.Secur32.ContextAttribute contextAttribute, Bindings* buffer, SafeFreeContextBufferChannelBinding refHandle)
        {
            int status = (int)Interop.SecurityStatus.InvalidHandle;

            // SCHANNEL only supports SECPKG_ATTR_ENDPOINT_BINDINGS and SECPKG_ATTR_UNIQUE_BINDINGS which
            // map to our enum ChannelBindingKind.Endpoint and ChannelBindingKind.Unique.
            if (contextAttribute != Interop.Secur32.ContextAttribute.EndpointBindings &&
                contextAttribute != Interop.Secur32.ContextAttribute.UniqueBindings)
            {
                return status;
            }

            try
            {
                bool ignore = false;
                phContext.DangerousAddRef(ref ignore);
                status = Interop.Secur32.QueryContextAttributesW(ref phContext._handle, contextAttribute, buffer);
            }
            finally
            {
                phContext.DangerousRelease();
            }

            if (status == 0 && refHandle != null)
            {
                refHandle.Set((*buffer).pBindings);
                refHandle._size = (*buffer).BindingsLength;
            }

            if (status != 0 && refHandle != null)
            {
                refHandle.SetHandleAsInvalid();
            }

            return status;
        }
コード例 #60
0
ファイル: PeerBuilder.cs プロジェクト: lanicon/TomP2P.NET
 public PeerBuilder SetInterfaceBindings(Bindings interfaceBindings)
 {
     InterfaceBindings = interfaceBindings;
     return(this);
 }