Пример #1
0
 protected void btnTurn_Click(object sender, EventArgs e)
 {
     UniverseHelper uh = new UniverseHelper ();
     uh.Universe = ActiveUniverse;
     uh.Tick ();
     PlayerHelper ph = new PlayerHelper ();
     ph.Player = ActivePlayer;
     ph.Tick ();
     //			Star st = uh.Universe.Galaxies [0].Stars.First (s => s.OrbitalBodies.Exists(ob => !ob.IsSaved));
     LoadStarData ();
     //			DBCommandResult res = dh.EndTurn (7);
     //			if (res.ResultCode == 0) {
     //				Galaxy g = new Galaxy ();
     //			}
 }
Пример #2
0
        protected override void OnStart(string[] args)
        {
            t = new Timer(60000);
            t.Elapsed += T_Elapsed;
            uHelper = new UniverseHelper();

            if (this.host != null)
            {
                this.host.Close();
            }

            try
            {
                log.Entry.MethodName = "Timer.Elapsed";
                log.Entry.StepName = "Start";
                if (World == null || World.Count < 1)
                {
                    this.World = uHelper.AllUniverses();
                    log.Entry.StepName = "World loaded";
                    if (World.Count > 0)
                        log.Debug(String.Format("Universes: {0}, Galaxies: {1}", this.World.Count, this.World[0].Galaxies.Count));
                    else
                        log.Debug(String.Format("Universes: {0}", this.World.Count));
                }

                this.host = new HOOServiceHost(this.World, typeof(HOOService), new Uri[0]);
                this.host.CloseTimeout = TimeSpan.MaxValue;
                this.host.OpenTimeout = TimeSpan.MaxValue;
                NetTcpBinding binding = new NetTcpBinding(SecurityMode.None)
                {
                    MaxBufferPoolSize = 0x7fffffffL,
                    MaxBufferSize = 0x7fffffff,
                    MaxConnections = 0x4b0,
                    MaxReceivedMessageSize = 0x7fffffffL
                };
                this.host.AddServiceEndpoint(typeof(IHOOService), binding, "net.tcp://localhost:8000/HOOService");
                foreach (ServiceEndpoint endpoint in this.host.Description.Endpoints)
                {
                    endpoint.Behaviors.Add(new HOOBehavior());
                }
                ServiceDebugBehavior behavior = this.host.Description.Behaviors.Find<ServiceDebugBehavior>();
                if (behavior == null)
                {
                    ServiceDebugBehavior item = new ServiceDebugBehavior
                    {
                        IncludeExceptionDetailInFaults = true
                    };
                    this.host.Description.Behaviors.Add(item);
                }
                else if (!behavior.IncludeExceptionDetailInFaults)
                {
                    behavior.IncludeExceptionDetailInFaults = true;
                }
                foreach (ServiceEndpoint endpoint2 in this.host.Description.Endpoints)
                {
                    foreach (OperationDescription description in endpoint2.Contract.Operations)
                    {
                        DataContractSerializerOperationBehavior behavior3 = description.Behaviors.Find<DataContractSerializerOperationBehavior>();
                        if (behavior3 != null)
                        {
                            behavior3.MaxItemsInObjectGraph = 0x989680;
                        }
                    }
                }
                this.host.Open();
                this.EventLog.WriteEntry("Open OK");
            }
            catch (Exception exception)
            {
                this.EventLog.WriteEntry(exception.Message);
            }

            t.Start();
        }