Beispiel #1
0
        public Model.OperationResult EditJob(Guid id, string description, bool active, StartType startType, Trigger trigger, string className)
        {
            string message;

            if (string.IsNullOrWhiteSpace(className))
            {
                return OperationResult.Failure("Job类型名称不能为空");
            }
            if (!ValidataeTrigger(trigger, out message))
            {
                return OperationResult.Failure(message);
            }

            var job = JobManager.Instance.GetJob(id);

            if (job == null)
            {
                return OperationResult.Failure("Job不存在");
            }

            bool success = job.Edit(description, active, startType, trigger, className, out message);

            return new Model.OperationResult
            {
                Success = success,
                Message = message
            };
        }
Beispiel #2
0
        public Model.OperationResult AddJob(string name, string description, bool active, StartType startType, Trigger trigger, string className)
        {
            string message;

            if (string.IsNullOrWhiteSpace(name))
            {
                return OperationResult.Failure("Job名称不能为空");
            }
            if (string.IsNullOrWhiteSpace(className))
            {
                return OperationResult.Failure("Job类型名称不能为空");
            }
            if (!ValidataeTrigger(trigger, out message))
            {
                return OperationResult.Failure(message);
            }

            bool success = JobManager.Instance.AddJob(name, description, active, (StartType)startType, className, trigger, out message);

            return new Model.OperationResult
            {
                Success = success,
                Message = message
            };
        }
Beispiel #3
0
 // Multihost constructor using JSON data from API
 public Multihost(JToken multihostProperties)
 {
     switch (multihostProperties.SelectToken("start_type").ToString())
     {
         case "manual":
             startType = StartType.MANUAL;
             break;
         case "set_host":
             startType = StartType.SET_HOST;
             setHostName = multihostProperties.SelectToken("set_host_name").ToString();
             break;
         case "random":
             startType = StartType.RANDOM;
             break;
         default:
             Common.ChatClient.SendMessage(string.Format("Host start type '{0}' is not valid. Defaulting to random.", multihostProperties.SelectToken("start_type").ToString()), Common.DryRun);
             return;
     }
     hosts = WebCalls.downloadMultihostStreamers().Result;
     rotator.Elapsed += rotatorTick;
 }
Beispiel #4
0
        public bool AddJob(string name, string description, bool active, StartType startType, string className, JobConsole.Model.Trigger trigger, out string message)
        {
            var dao = new Data.JobDAO();

            string triggerJson = Newtonsoft.Json.JsonConvert.SerializeObject(trigger);

            Guid? id;
            bool success = dao.Add(name, description, active, startType, triggerJson, className, out message, out id);

            if (success)
            {
                Task.Factory.StartNew(() =>
                {
                    var data = dao.Get(id.Value);
                    var job = new JobItem(data);
                    this.Jobs.Add(job);
                    job.NotifyJobModified();
                });
            }

            return success;
        }
Beispiel #5
0
        public void Reset_Called_NextPacketNotCalledAfter(StartType startType)
        {
            AsyncContext.Run(async() =>
            {
                var demuxerMock = Substitute.For <IDemuxer>();
                var tcs         = new TaskCompletionSource <Packet>();
                demuxerMock.NextPacket().Returns(tcs.Task);
                demuxerMock.IsInitialized().Returns(true);

                using (var controller = new DemuxerController(demuxerMock))
                {
                    StartController(controller, startType);
                    await Task.Yield(); // Demuxer.InitFor completes, first Demuxer.NextPacket is called

                    controller.Reset();
                    tcs.SetResult(new Packet());

                    await Task.Yield(); // first Demuxer.NextPacket completes and another Demuxer.NextPacket is
                    // not called
                    await demuxerMock.Received(1).NextPacket();
                }
            });
        }
Beispiel #6
0
        public void Start_StreamConfigFound_PublishesStreamConfig(StartType startType)
        {
            AsyncContext.Run(async() =>
            {
                var videoConfig = new VideoStreamConfig();
                var demuxerStub = CreateDemuxerStub(new ClipConfiguration
                {
                    StreamConfigs = new List <StreamConfig> {
                        videoConfig
                    }
                }, startType);

                using (var controller = new DemuxerController(demuxerStub))
                {
                    var streamConfigTask = controller.StreamConfigReady().FirstAsync().ToTask();

                    StartController(controller, startType);

                    var receivedConfig = await streamConfigTask;
                    Assert.That(receivedConfig, Is.EqualTo(videoConfig));
                }
            });
        }
        // Multihost constructor using JSON data from API
        public Multihost(JToken multihostProperties)
        {
            switch (multihostProperties.SelectToken("start_type").ToString())
            {
            case "manual":
                startType = StartType.MANUAL;
                break;

            case "set_host":
                startType   = StartType.SET_HOST;
                setHostName = multihostProperties.SelectToken("set_host_name").ToString();
                break;

            case "random":
                startType = StartType.RANDOM;
                break;

            default:
                Common.ChatClient.SendMessage(string.Format("Host start type '{0}' is not valid. Defaulting to random.", multihostProperties.SelectToken("start_type").ToString()), Common.DryRun);
                return;
            }
            hosts            = WebCalls.downloadMultihostStreamers().Result;
            rotator.Elapsed += rotatorTick;
        }
Beispiel #8
0
        private static List <Flight> GenerateFlights(Plane pl1, Plane pl2, Location location, Pilot pilot, StartType start)
        {
            var s = new List <Flight>
            {
                new Flight
                {
                    Departure     = DateTime.Now.AddHours(-3),
                    Landing       = DateTime.Now.AddHours(-3).AddMinutes(15),
                    Plane         = pl1,
                    StartedFrom   = location,
                    LandedOn      = location,
                    Pilot         = pilot,
                    Betaler       = pilot,
                    StartType     = start,
                    Description   = "Demo flight",
                    LastUpdatedBy = pilot.ToString()
                },
                new Flight
                {
                    Plane         = pl2,
                    StartedFrom   = location,
                    Pilot         = pilot,
                    Betaler       = pilot,
                    StartType     = start,
                    Description   = "Demo flight",
                    LastUpdatedBy = pilot.ToString()
                },
                new Flight
                {
                    Departure     = DateTime.Now.AddHours(-2),
                    Plane         = pl2,
                    StartedFrom   = location,
                    Pilot         = pilot,
                    Betaler       = pilot,
                    StartType     = start,
                    LastUpdatedBy = pilot.ToString(),
                    Description   = "Demo flight"
                },
                new Flight
                {
                    Departure     = DateTime.Now.AddHours(-1),
                    Plane         = pl2,
                    StartedFrom   = location,
                    Pilot         = pilot,
                    Betaler       = pilot,
                    StartType     = start,
                    Description   = "Demo flight",
                    LastUpdatedBy = pilot.ToString()
                },
                new Flight
                {
                    Departure     = DateTime.Now.AddHours(-4),
                    Plane         = pl2,
                    StartedFrom   = location,
                    Pilot         = pilot,
                    Betaler       = pilot,
                    StartType     = start,
                    LastUpdatedBy = pilot.ToString(),
                    Description   = "Demo flight"
                },
                new Flight
                {
                    Departure     = DateTime.Now.AddHours(-3).AddMinutes(10),
                    Plane         = pl2,
                    StartedFrom   = location,
                    Pilot         = pilot,
                    Betaler       = pilot,
                    StartType     = start,
                    Description   = "Demo flight",
                    LastUpdatedBy = pilot.ToString()
                }
            };

            return(s);
        }
Beispiel #9
0
        internal static void InitializeDemoFlights(Models.FlightContext context)
        {
            // StartType
            var start = new StartType()
            {
                Name = "Spilstart", ShortName = "S"
            };

            context.StartTypes.Add(start);
            context.StartTypes.Add(new StartType()
            {
                Name = "Flyslæb", ShortName = "F"
            });
            context.StartTypes.Add(new StartType()
            {
                Name = "Selvstart", ShortName = "M"
            });
            context.SaveChanges();

            // Locations
            var location = new Location {
                Name = "Kongsted", Country = "DK", ICAO = "EKKL"
            };

            context.Locations.Add(location);
            var location2 = new Location {
                Name = "True", Country = "DK"
            };

            context.Locations.Add(location2);
            var location3 = new Location {
                Name = "Slaglille", Country = "DK", ICAO = "EKSL"
            };

            context.Locations.Add(location3);
            var location4 = new Location {
                Name = "Tølløse"
            };

            context.Locations.Add(location4);
            var location5 = new Location {
                Name = "Martin", Country = "SK", ICAO = "LZMA"
            };

            context.Locations.Add(location5);

            context.Locations.Add(new Location()
            {
                Name = "Arnborg", Country = "DK", ICAO = "EK51"
            });
            context.SaveChanges();

            // Clubs
            var club = new Club()
            {
                ClubId = 38, ShortName = "ØSF", Name = "Øst-Sjællands Flyveklub", Location = location, Website = "http://flyveklubben.dk"
            };

            context.Clubs.Add(club);
            var club2 = new Club()
            {
                ClubId = 99, ShortName = "AASVK", Name = "Århus Svæveflyveklub", Location = location2, Website = "http://www.aasvk.dk"
            };

            context.Clubs.Add(club2);
            var club3 = new Club()
            {
                ClubId = 199, ShortName = "MSF", Name = "Midtsjællands Svæveflyveklub", Location = location3, Website = "http://slaglille.dk"
            };

            context.Clubs.Add(club3);
            var club4 = new Club()
            {
                ClubId = 210, ShortName = "TØL", Name = "Tølløse Flyveklub", Location = location4, Website = "http://www.cumulus.dk/"
            };

            context.Clubs.Add(club4);
            context.SaveChanges();

            // Planes
            var pl2 = new Plane
            {
                CompetitionId    = "R2",
                Registration     = "OY-XMO",
                Type             = "ASK21",
                Seats            = 2,
                DefaultStartType = start,
                Engines          = 0
            };

            context.Planes.Add(pl2);
            var pla = new Plane
            {
                CompetitionId    = "RR",
                Registration     = "OY-RRX",
                Class            = "Open",
                Type             = "Duo Discus",
                Seats            = 2,
                DefaultStartType = start,
                Engines          = 1
            };

            context.Planes.Add(pla);
            var pl1 = new Plane
            {
                CompetitionId    = "PU",
                Registration     = "OY-XPU",
                Class            = "15-Meter",
                Type             = "LS6",
                Model            = "LS6a",
                Seats            = 1,
                DefaultStartType = start,
                Engines          = 0
            };

            context.Planes.Add(pl1);
            context.SaveChanges();

            // Pilots
            var pilot = new Pilot {
                Name = "Jan Hebnes", MemberId = "1241", Club = club, Email = "*****@*****.**", MobilNumber = "+4500000000"
            };

            context.Pilots.Add(pilot);
            var pilot1 = new Pilot {
                Name = "Mr Demo Manager", MemberId = "9991", Club = club, MobilNumber = "+4500000001"
            };

            context.Pilots.Add(pilot1);
            var pilot2 = new Pilot {
                Name = "Mr Demo Editor", MemberId = "9992", Club = club, MobilNumber = "+4500000002"
            };

            context.Pilots.Add(pilot2);
            var pilot3 = new Pilot {
                Name = "Mr Demo Pilot", MemberId = "9993", Club = club, MobilNumber = "+4500000003"
            };

            context.Pilots.Add(pilot3);
            var pilot1B = new Pilot {
                Name = "Mr Demo OtherClub Manager", MemberId = "9995", Club = club3, MobilNumber = "+4500000005"
            };

            context.Pilots.Add(pilot1B);
            var pilot2B = new Pilot {
                Name = "Mr Demo OtherClub Editor", MemberId = "9996", Club = club3, MobilNumber = "+4500000006"
            };

            context.Pilots.Add(pilot2B);
            var pilot3B = new Pilot {
                Name = "Mr Demo OtherClub Pilot", MemberId = "9997", Club = club3, MobilNumber = "+4500000007"
            };

            context.Pilots.Add(pilot3B);


            context.SaveChanges();

            GenerateFlights(pl1, pl2, location, pilot, start)
            .ForEach(b => context.Flights.Add(b));

            GenerateFlights(pl1, pl2, location, pilot2, start)
            .ForEach(b => context.Flights.Add(b));

            GenerateFlights(pl1, pl2, location, pilot3, start)
            .ForEach(b => context.Flights.Add(b));


            GenerateFlights(pl1, pl2, location3, pilot2B, start)
            .ForEach(b => context.Flights.Add(b));

            GenerateFlights(pl1, pl2, location3, pilot3B, start)
            .ForEach(b => context.Flights.Add(b));

            GenerateFlights(pl1, pl2, location5, pilot3B, start)
            .ForEach(b => context.Flights.Add(b));

            context.SaveChanges();
        }
Beispiel #10
0
        public static void Run(StartType type)
        {
            switch (type)
            {
            case StartType.BaseService:
                mAppHost = new ServiceHost(typeof(BaseService));
                //初始化连接池,默认10分钟清理连接
                ClientLinkPoolCache.Init(true, 200, 30, 600, "wcfserver", 30);

                AppGlobal.AppRootPath = System.Windows.Forms.Application.StartupPath + "\\";
                AppGlobal.appType     = AppType.WCF;
                AppGlobal.IsSaas      = HostSettingConfig.GetValue("issaas") == "1" ? true : false;
                AppGlobal.AppStart();


                ClientManage.IsHeartbeat   = HostSettingConfig.GetValue("heartbeat") == "1" ? true : false;
                ClientManage.HeartbeatTime = Convert.ToInt32(HostSettingConfig.GetValue("heartbeattime"));

                ClientManage.StartHost();
                mAppHost.Open();

                MiddlewareLogHelper.WriterLog(LogType.MidLog, true, Color.Blue, "数据服务启动完成");
                break;

            case StartType.FileService:
                AppGlobal.AppRootPath = System.Windows.Forms.Application.StartupPath + "\\";

                mFileHost = new ServiceHost(typeof(FileService));
                mFileHost.Open();

                MiddlewareLogHelper.WriterLog(LogType.MidLog, true, Color.Blue, "文件服务启动完成");
                break;

            case StartType.HttpService:
                //初始化连接池,默认10分钟清理连接
                ClientLinkPoolCache.Init(true, 200, 30, 600, "httpserver", 30);
                AppGlobal.AppRootPath = System.Windows.Forms.Application.StartupPath + "\\";

                mHttpHost = new WebServiceHost(typeof(HttpService));
                mHttpHost.Open();

                MiddlewareLogHelper.WriterLog(LogType.MidLog, true, Color.Blue, "Http服务启动完成");
                break;

            case StartType.RouterBaseService:
                mRouterHost = new ServiceHost(typeof(RouterBaseService));
                RouterManage.Start();
                mRouterHost.Open();

                MiddlewareLogHelper.WriterLog(LogType.MidLog, true, Color.Blue, "路由数据服务启动完成");
                break;

            case StartType.RouterFileService:
                mFileRouterHost = new ServiceHost(typeof(RouterFileService));
                mFileRouterHost.Open();

                MiddlewareLogHelper.WriterLog(LogType.MidLog, true, Color.Blue, "路由文件服务启动完成");
                break;

            case StartType.SuperClient:
                SuperClient.Start();
                MiddlewareLogHelper.WriterLog(LogType.MidLog, true, Color.Blue, "超级客户端启动完成");

                PublisherManage.Start();
                SubscriberManager.Start();
                MiddlewareLogHelper.WriterLog(LogType.MidLog, true, Color.Blue, "发布订阅启动完成");

                DistributedCacheManage.Start();
                DistributedCacheClient.Start();
                MiddlewareLogHelper.WriterLog(LogType.MidLog, true, Color.Blue, "分布式缓存启动完成");

                UpgradeManage.Start();
                UpgradeClient.Start();
                MiddlewareLogHelper.WriterLog(LogType.MidLog, true, Color.Blue, "升级包管理启动完成");

                MonitorTirggerManage.Start();
                MiddlewareLogHelper.WriterLog(LogType.MidLog, true, Color.Blue, "监视触发器启动完成");
                break;

            case StartType.MiddlewareTask:
                MiddlewareTask.StartTask();    //开启定时任务
                MiddlewareLogHelper.WriterLog(LogType.MidLog, true, Color.Blue, "定时任务启动完成");
                break;
            }
        }
Beispiel #11
0
 public void HotReloadEnd(StartType handlerType)
 {
     WriteEvent(2, handlerType);
 }
Beispiel #12
0
        //
        // GET: /StartType/Details/5

        public ViewResult Details(int id)
        {
            StartType starttype = db.StartTypes.Find(id);

            return(View(starttype));
        }
Beispiel #13
0
 public bool StartsWith(ConnectionType type)
 {
     return(StartType.HasFlag(type));
 }
Beispiel #14
0
        public static void Quit(StartType type)
        {
            switch (type)
            {
            case StartType.BaseService:
                try
                {
                    if (mAppHost != null)
                    {
                        //EFWCoreLib.WcfFrame.ClientLinkPoolCache.Dispose();
                        ClientManage.StopHost();
                        mAppHost.Close();
                        MiddlewareLogHelper.WriterLog(LogType.MidLog, true, Color.Red, "数据服务已关闭!");
                    }
                }
                catch
                {
                    if (mAppHost != null)
                    {
                        mAppHost.Abort();
                    }
                }
                break;

            case StartType.FileService:
                try
                {
                    if (mFileHost != null)
                    {
                        mFileHost.Close();
                        MiddlewareLogHelper.WriterLog(LogType.MidLog, true, Color.Red, "文件传输服务已关闭!");
                    }
                }
                catch
                {
                    if (mFileHost != null)
                    {
                        mFileHost.Abort();
                    }
                }
                break;

            case StartType.HttpService:
                try
                {
                    if (mHttpHost != null)
                    {
                        mHttpHost.Close();
                        MiddlewareLogHelper.WriterLog(LogType.MidLog, true, Color.Red, "Http服务已关闭!");
                    }
                }
                catch
                {
                    if (mHttpHost != null)
                    {
                        mHttpHost.Abort();
                    }
                }
                break;

            case StartType.RouterBaseService:
                try
                {
                    if (mRouterHost != null)
                    {
                        mRouterHost.Close();
                        MiddlewareLogHelper.WriterLog(LogType.MidLog, true, Color.Red, "数据路由服务已关闭!");
                    }
                }
                catch
                {
                    if (mRouterHost != null)
                    {
                        mRouterHost.Abort();
                    }
                }
                break;

            case StartType.RouterFileService:
                try
                {
                    if (mFileRouterHost != null)
                    {
                        mFileRouterHost.Close();
                        MiddlewareLogHelper.WriterLog(LogType.MidLog, true, Color.Red, "文件路由服务已关闭!");
                    }
                }
                catch
                {
                    if (mFileRouterHost != null)
                    {
                        mFileRouterHost.Abort();
                    }
                }
                break;

            case StartType.SuperClient:


                UpgradeManage.Stop();
                UpgradeClient.Stop();
                MiddlewareLogHelper.WriterLog(LogType.MidLog, true, Color.Red, "升级包服务已停止");

                SuperClient.Stop();
                MiddlewareLogHelper.WriterLog(LogType.TimingTaskLog, true, System.Drawing.Color.Red, "超级客户端已关闭!");

                break;

            case StartType.MiddlewareTask:
                MiddlewareTask.StopTask();    //停止任务
                MiddlewareLogHelper.WriterLog(LogType.TimingTaskLog, true, System.Drawing.Color.Red, "定时任务已停止!");
                break;
            }
        }
Beispiel #15
0
 public Column(TwitterStream stream, StartType s, string title)
 {
     if (back != null)
     {
         listView1.BackgroundImage = back;
     }
     InitializeComponent();
     listView1.SmallImageList = new ImageList();
     ts = stream;
     if (s == StartType.UserStream)
     {
         ts.StartUserStream(null, new StreamStoppedCallback((x) => { toolStripStatusLabel1.Text = "Stopped."; }), new StatusCreatedCallback(x => { Add(x); }), null, null, null, new EventCallback(x => { Event(x); }), null);
         var tt = TwitterTimeline.HomeTimeline(stream.Tokens);
         try
         {
             foreach (var tss in tt.ResponseObject)
             {
                 timeline.Add(tss);
             }
         }
         catch
         {
             MessageBox.Show(tt.ErrorMessage);
         }
     }
     else if (s == StartType.FilterStream)
     {
         string query = "";
         if (ts.StreamOptions.Track.Count != 0)
         {
             foreach (string ss in ts.StreamOptions.Track)
             {
                 query += ss + "+AND+";
             }
             query = query.Remove(query.Length - 5, 5);
         }
         ts.StartPublicStream(new StreamStoppedCallback((x) => { toolStripStatusLabel1.Text = "Stopped."; }), new StatusCreatedCallback(x => { Add(x); }), null, new EventCallback(x => { Event(x); }));
         var tt = TwitterSearch.Search(ts.Tokens, query, new SearchOptions()
         {
             ResultType = SearchOptionsResultType.Popular
         });
         try
         {
             foreach (var tss in tt.ResponseObject)
             {
                 timeline.Add(new TwitterStatus()
                 {
                     Text = tss.Text, User = new TwitterUser()
                     {
                         ScreenName = tss.FromUserScreenName
                     }
                 });
             }
         }
         catch
         {
             MessageBox.Show(tt.ErrorMessage);
         }
     }
     else if (s == StartType.Mentions)
     {
         ts.StreamOptions.Track.Add("@" + ExtendedOAuthTokens.Tokens.First <ExtendedOAuthTokens>((x) => { return(x.OAuthTokens == ts.Tokens); }).UserName);
         ts.StartPublicStream(new StreamStoppedCallback((x) => { toolStripStatusLabel1.Text = "Stopped."; }), new StatusCreatedCallback(x => { Add(x); }), null, new EventCallback(x => { Event(x); }));
         var tt = TwitterTimeline.Mentions(stream.Tokens);
         try
         {
             foreach (var tss in tt.ResponseObject)
             {
                 timeline.Add(tss);
             }
         }
         catch
         {
             MessageBox.Show(tt.ErrorMessage);
         }
     }
     st        = s;
     this.Text = title;
     Columns.Add(this);
     ShowF();
 }
Beispiel #16
0
 public Thread(ThreadStart threadStart, int maxStackSize = 0)
 {
     _startType = StartType.Standard;
     _start     = threadStart;
 }
Beispiel #17
0
 public static ServiceInfo ChangeStartType(string serviceName, StartType startType)
 {
     return(Windows.ChangeStartTypeInPlatform(serviceName, startType));
 }
Beispiel #18
0
 public Thread(ParameterizedThreadStart threadStart, int maxStackSize = 0)
 {
     _startType          = StartType.Parameterized;
     _parameterizedStart = threadStart;
 }
Beispiel #19
0
        public static void Run(StartType type)
        {
            switch (type)
            {
            case StartType.BaseService:
                mAppHost = new ServiceHost(typeof(BaseService));
                //初始化连接池,默认10分钟清理连接
                ClientLinkPoolCache.Init(true, 200, 30, 600, "wcfserver", 30);

                AppGlobal.AppRootPath = System.Windows.Forms.Application.StartupPath + "\\";
                AppGlobal.appType     = AppType.WCF;
                AppGlobal.IsSaas      = System.Configuration.ConfigurationManager.AppSettings["IsSaas"] == "true" ? true : false;
                AppGlobal.AppStart();


                ClientManage.IsHeartbeat      = HostSettingConfig.GetValue("heartbeat") == "1" ? true : false;
                ClientManage.HeartbeatTime    = Convert.ToInt32(HostSettingConfig.GetValue("heartbeattime"));
                ClientManage.IsMessage        = HostSettingConfig.GetValue("message") == "1" ? true : false;
                ClientManage.MessageTime      = Convert.ToInt32(HostSettingConfig.GetValue("messagetime"));
                ClientManage.IsCompressJson   = HostSettingConfig.GetValue("compress") == "1" ? true : false;
                ClientManage.IsEncryptionJson = HostSettingConfig.GetValue("encryption") == "1" ? true : false;
                ClientManage.IsToken          = HostSettingConfig.GetValue("token") == "1" ? true : false;
                ClientManage.serializeType    = (SerializeType)Convert.ToInt32(HostSettingConfig.GetValue("serializetype"));
                ClientManage.IsOverTime       = HostSettingConfig.GetValue("overtime") == "1" ? true : false;
                ClientManage.OverTime         = Convert.ToInt32(HostSettingConfig.GetValue("overtimetime"));

                ClientManage.StartHost();
                mAppHost.Open();

                MiddlewareLogHelper.WriterLog(LogType.MidLog, true, Color.Blue, "数据服务启动完成");
                break;

            case StartType.FileService:
                AppGlobal.AppRootPath = System.Windows.Forms.Application.StartupPath + "\\";

                mFileHost = new ServiceHost(typeof(FileService));
                mFileHost.Open();

                MiddlewareLogHelper.WriterLog(LogType.MidLog, true, Color.Blue, "文件服务启动完成");
                break;

            case StartType.RouterBaseService:
                mRouterHost = new ServiceHost(typeof(RouterBaseService));
                RouterManage.Start();
                mRouterHost.Open();

                MiddlewareLogHelper.WriterLog(LogType.MidLog, true, Color.Blue, "数据路由服务启动完成");
                break;

            case StartType.RouterFileService:
                mFileRouterHost = new ServiceHost(typeof(RouterFileService));
                mFileRouterHost.Open();

                MiddlewareLogHelper.WriterLog(LogType.MidLog, true, Color.Blue, "文件路由服务启动完成");
                break;

            case StartType.SuperClient:
                SuperClient.CreateSuperClient();
                MiddlewareLogHelper.WriterLog(LogType.MidLog, true, Color.Blue, "超级客户端启动完成");
                break;

            case StartType.MiddlewareTask:
                MiddlewareTask.StartTask();    //开启定时任务
                MiddlewareLogHelper.WriterLog(LogType.MidLog, true, Color.Blue, "定时任务启动完成");
                break;

            case StartType.PublishService:    //订阅
                PublishServiceManage.InitPublishService();
                PublishSubManager.StartPublish();
                MiddlewareLogHelper.WriterLog(LogType.MidLog, true, Color.Blue, "发布订阅服务完成");
                break;

            case StartType.MongoDB:
                MongodbManager.StartDB();    //开启MongoDB
                MiddlewareLogHelper.WriterLog(LogType.MidLog, true, Color.Blue, "MongoDB启动完成");
                break;

            case StartType.Nginx:
                NginxManager.StartWeb();    //开启Nginx
                MiddlewareLogHelper.WriterLog(LogType.MidLog, true, Color.Blue, "Nginx启动完成");
                break;

            case StartType.KillAllProcess:
                MongodbManager.StopDB();    //停止MongoDB  清理掉所有子进程,因为主进程关闭子进程不关闭的话,占用的端口号一样不会释放
                NginxManager.StopWeb();
                break;
            }
        }
Beispiel #20
0
        public static void Quit(StartType type)
        {
            ClientLinkManage.UnAllConnection();//关闭所有连接
            switch (type)
            {
            case StartType.BaseService:
                try
                {
                    if (mAppHost != null)
                    {
                        EFWCoreLib.WcfFrame.ClientLinkPoolCache.Dispose();
                        ClientManage.StopHost();
                        mAppHost.Close();
                        MiddlewareLogHelper.WriterLog(LogType.MidLog, true, Color.Red, "数据服务已关闭!");
                    }
                }
                catch
                {
                    if (mAppHost != null)
                    {
                        mAppHost.Abort();
                    }
                }
                break;

            case StartType.FileService:
                try
                {
                    if (mFileHost != null)
                    {
                        mFileHost.Close();
                        MiddlewareLogHelper.WriterLog(LogType.MidLog, true, Color.Red, "文件传输服务已关闭!");
                    }
                }
                catch
                {
                    if (mFileHost != null)
                    {
                        mFileHost.Abort();
                    }
                }
                break;

            case StartType.RouterBaseService:
                try
                {
                    if (mRouterHost != null)
                    {
                        mRouterHost.Close();
                        MiddlewareLogHelper.WriterLog(LogType.MidLog, true, Color.Red, "数据路由服务已关闭!");
                    }
                }
                catch
                {
                    if (mRouterHost != null)
                    {
                        mRouterHost.Abort();
                    }
                }
                break;

            case StartType.RouterFileService:
                try
                {
                    if (mFileRouterHost != null)
                    {
                        mFileRouterHost.Close();
                        MiddlewareLogHelper.WriterLog(LogType.MidLog, true, Color.Red, "文件路由服务已关闭!");
                    }
                }
                catch
                {
                    if (mFileRouterHost != null)
                    {
                        mFileRouterHost.Abort();
                    }
                }
                break;

            case StartType.SuperClient:
                SuperClient.UnCreateSuperClient();
                MiddlewareLogHelper.WriterLog(LogType.TimingTaskLog, true, System.Drawing.Color.Red, "超级客户端已关闭!");
                break;

            case StartType.MiddlewareTask:
                MiddlewareTask.StopTask();    //停止任务
                MiddlewareLogHelper.WriterLog(LogType.TimingTaskLog, true, System.Drawing.Color.Red, "定时任务已停止!");
                break;

            case StartType.PublishService:    //订阅
                MiddlewareLogHelper.WriterLog(LogType.MidLog, true, Color.Red, "订阅服务已停止");
                break;

            case StartType.MongoDB:
                MongodbManager.StopDB();    //停止MongoDB
                MiddlewareLogHelper.WriterLog(LogType.MidLog, true, Color.Red, "MongoDB已停止");
                break;

            case StartType.Nginx:
                NginxManager.StopWeb();
                MiddlewareLogHelper.WriterLog(LogType.MidLog, true, Color.Red, "Nginx已停止");
                break;
            }
        }
 public static void SetPersistedStartType(StartType choice)
 {
     Application.Current.Properties[StartTypeSettingKey] = choice.ToString();
 }
Beispiel #22
0
        public bool Edit(string description, bool active, StartType startType, JobConsole.Model.Trigger trigger, string className, out string message)
        {
            if (this.Status == JobStatus.Running)
            {
                message = "Job正在运行";
                return false;
            }

            string triggerJson = Newtonsoft.Json.JsonConvert.SerializeObject(trigger);

            var dao = new Data.JobDAO();
            bool success = dao.Edit(this.ID, description, active, startType, triggerJson, className, out message);

            if (success)
            {
                var data = dao.Get(this.ID);
                this.Data = data;

                XDocument doc = new XDocument();
                doc.Add(
                    new XElement("Job",
                        new XElement("ClassName", this.Data.ClassName)
                    )
                );
                doc.Save(this.JobFolder + @"\" + "job.config");

                this.NotifyJobModified();
            }

            return success;
        }
Beispiel #23
0
        void createService()
        {
            CodeTypeDeclaration td = new CodeTypeDeclaration("ProjectInstaller");

            typeNamespace.Types.Add(td);
            //
            td.BaseTypes.Add(typeof(Installer));
            //
            td.CustomAttributes.Add(new CodeAttributeDeclaration(new CodeTypeReference(typeof(RunInstallerAttribute)), new CodeAttributeArgument(new CodePrimitiveExpression(true))));
            //
            CodeConstructor cc = new CodeConstructor();

            td.Members.Add(cc);
            cc.Attributes = MemberAttributes.Public;
            cc.Statements.Add(new CodeMethodInvokeExpression(new CodeThisReferenceExpression(), "InitializeComponent"));
            //
            CodeMemberField mf = new CodeMemberField(typeof(System.ComponentModel.IContainer), "components");

            td.Members.Add(mf);
            mf = new CodeMemberField(typeof(System.ServiceProcess.ServiceProcessInstaller), "serviceProcessInstaller1");
            td.Members.Add(mf);
            mf = new CodeMemberField(typeof(System.ServiceProcess.ServiceInstaller), "serviceInstaller1");
            td.Members.Add(mf);
            //
            CodeMemberMethod mm = new CodeMemberMethod();

            td.Members.Add(mm);
            mm.Name = "InitializeComponent";
            mm.Statements.Add(new CodeAssignStatement(new CodeFieldReferenceExpression(
                                                          new CodeThisReferenceExpression(), "serviceProcessInstaller1"),
                                                      new CodeObjectCreateExpression(typeof(System.ServiceProcess.ServiceProcessInstaller))));
            mm.Statements.Add(new CodeAssignStatement(new CodeFieldReferenceExpression(
                                                          new CodeThisReferenceExpression(), "serviceInstaller1"),
                                                      new CodeObjectCreateExpression(typeof(System.ServiceProcess.ServiceInstaller))));
            //
            //===set properties========
            mm.Statements.Add(new CodeCommentStatement(new CodeComment()));
            mm.Statements.Add(new CodeCommentStatement(new CodeComment("serviceProcessInstaller1")));
            mm.Statements.Add(new CodeCommentStatement(new CodeComment()));
            //
            CodeAssignStatement cas = new CodeAssignStatement(
                new CodePropertyReferenceExpression(
                    new CodeFieldReferenceExpression(new CodeThisReferenceExpression(),
                                                     "serviceProcessInstaller1"), "Account"),
                new CodeFieldReferenceExpression(new CodeTypeReferenceExpression(typeof(System.ServiceProcess.ServiceAccount)), Account.ToString())
                );

            mm.Statements.Add(cas);
            //
            mm.Statements.Add(new CodeCommentStatement(new CodeComment()));
            mm.Statements.Add(new CodeCommentStatement(new CodeComment("serviceInstaller1")));
            mm.Statements.Add(new CodeCommentStatement(new CodeComment()));
            //
            cas = new CodeAssignStatement(
                new CodePropertyReferenceExpression(
                    new CodeFieldReferenceExpression(new CodeThisReferenceExpression(),
                                                     "serviceInstaller1"), "Description"),
                new CodePrimitiveExpression(Description)
                );
            mm.Statements.Add(cas);
            //
            cas = new CodeAssignStatement(
                new CodePropertyReferenceExpression(
                    new CodeFieldReferenceExpression(new CodeThisReferenceExpression(),
                                                     "serviceInstaller1"), "DisplayName"),
                new CodePrimitiveExpression(DisplayName)
                );
            mm.Statements.Add(cas);
            //
            cas = new CodeAssignStatement(
                new CodePropertyReferenceExpression(
                    new CodeFieldReferenceExpression(new CodeThisReferenceExpression(),
                                                     "serviceInstaller1"), "ServiceName"),
                new CodePrimitiveExpression(ServiceName)
                );
            mm.Statements.Add(cas);
            //
            cas = new CodeAssignStatement(
                new CodePropertyReferenceExpression(
                    new CodeFieldReferenceExpression(new CodeThisReferenceExpression(),
                                                     "serviceInstaller1"), "StartType"),
                new CodeFieldReferenceExpression(new CodeTypeReferenceExpression(typeof(System.ServiceProcess.ServiceStartMode)), StartType.ToString())
                );
            mm.Statements.Add(cas);
            //
            //=========================
            //
            mm.Statements.Add(new CodeCommentStatement(new CodeComment()));
            mm.Statements.Add(new CodeCommentStatement(new CodeComment("ProjectInstaller")));
            mm.Statements.Add(new CodeCommentStatement(new CodeComment()));
            CodeMethodInvokeExpression mie = new CodeMethodInvokeExpression();

            mm.Statements.Add(mie);
            mie.Method = new CodeMethodReferenceExpression(new CodePropertyReferenceExpression(new CodeThisReferenceExpression(), "Installers"), "AddRange");
            CodeArrayCreateExpression ar = new CodeArrayCreateExpression();

            ar.CreateType = new CodeTypeReference(typeof(System.Configuration.Install.Installer[]));
            ar.Initializers.AddRange(new CodeExpression[] {
                new CodeFieldReferenceExpression(new CodeThisReferenceExpression(), "serviceProcessInstaller1"),
                new CodeFieldReferenceExpression(new CodeThisReferenceExpression(), "serviceInstaller1")
            });
            mie.Parameters.Add(ar);
            //
            mm = new CodeMemberMethod();
            td.Members.Add(mm);
            mm.Attributes = MemberAttributes.Family | MemberAttributes.Override;
            mm.Name       = "Dispose";
            mm.Parameters.Add(new CodeParameterDeclarationExpression(typeof(bool), "disposing"));
            CodeBinaryOperatorExpression boe = new CodeBinaryOperatorExpression();

            boe.Left     = new CodeFieldReferenceExpression(new CodeThisReferenceExpression(), "components");
            boe.Operator = CodeBinaryOperatorType.IdentityInequality;
            boe.Right    = new CodePrimitiveExpression(null);
            CodeBinaryOperatorExpression boe2 = new CodeBinaryOperatorExpression();

            boe2.Left     = new CodeArgumentReferenceExpression("disposing");
            boe2.Operator = CodeBinaryOperatorType.BooleanAnd;
            boe2.Right    = boe;
            CodeConditionStatement ccs = new CodeConditionStatement();

            mm.Statements.Add(ccs);
            ccs.Condition = boe2;
            ccs.TrueStatements.Add(new CodeExpressionStatement(new CodeMethodInvokeExpression(new CodeFieldReferenceExpression(new CodeThisReferenceExpression(), "components"), "Dispose")));
            mm.Statements.Add(new CodeExpressionStatement(new CodeMethodInvokeExpression(
                                                              new CodeBaseReferenceExpression(), "Dispose", new CodeArgumentReferenceExpression("disposing")
                                                              )));
        }
            private ServiceInfo ChangeStartTypeInWindows(
                string serviceName,
                StartType startType)
            {
                if (string.IsNullOrWhiteSpace(serviceName))
                {
                    return(new ServiceInfo
                    {
                        ServiceName = serviceName,
                        ErrorCode = (int)Windows.Error.InvalidName,
                        ErrorMessage = $"Service name \"{serviceName}\" is invalid"
                    });
                }

                var managerHandle = Windows.OpenSCManagerW(
                    null,
                    null,
                    Windows.ServiceControlManagerAccessRight.Connect
                    );

                if (managerHandle == IntPtr.Zero)
                {
                    var errorCode = Marshal.GetLastWin32Error();
                    return(new ServiceInfo
                    {
                        ServiceName = serviceName,
                        ErrorCode = errorCode,
                        ErrorMessage = $"Can not open Windows service controller manager, error code: {errorCode}"
                    });
                }

                var serviceInfo = new ServiceInfo
                {
                    ServiceName = serviceName,
                    StartType   = startType
                };
                var serviceHandle = Windows.OpenServiceW(
                    managerHandle,
                    serviceName,
                    Windows.ServiceAccessRight.ChangeConfig |
                    Windows.ServiceAccessRight.QueryConfig |
                    Windows.ServiceAccessRight.QueryStatus
                    );

                if (serviceHandle == IntPtr.Zero)
                {
                    var errorCode = Marshal.GetLastWin32Error();
                    serviceInfo.ErrorCode    = errorCode;
                    serviceInfo.ErrorMessage = $"Can not open Windows service \"{serviceName}\", error code: {errorCode}";
                }
                else
                {
                    var success = Windows.ChangeServiceConfigW(
                        serviceHandle,
                        Windows.ServiceType.NoChange,
                        ConvertToWindows(startType),
                        Windows.ErrorControlType.NoChange,
                        null,
                        null,
                        IntPtr.Zero,
                        null,
                        null,
                        null,
                        null
                        );
                    if (!success)
                    {
                        var errorCode = Marshal.GetLastWin32Error();
                        serviceInfo.ErrorCode    = errorCode;
                        serviceInfo.ErrorMessage = $"Can not change Windows service \"{serviceName}\" config, error code: {errorCode}";
                    }

                    serviceInfo = UpdateCurrentStateInWindows(serviceHandle, serviceInfo);

                    Windows.CloseServiceHandle(serviceHandle);
                }

                Windows.CloseServiceHandle(managerHandle);
                return(serviceInfo);
            }
Beispiel #25
0
        public string getStartType(StartType type)
        {
            int i = Convert.ToInt32(type);

            return(i.ToString("x2"));
        }
Beispiel #26
0
        public override void SetBasicPropertyValues()
        {
            base.SetBasicPropertyValues();

            ResourceProperty propertyValue;

            for (int i = 0; i < ListProperties.Count; i++)
            {
                propertyValue = ListProperties[i];
                switch (propertyValue.PropertyID)
                {
                //启动方式
                case PRO_STARTTYPE:
                    propertyValue.Value = StartType.ToString();
                    break;

                //是否Voip通道
                case PRO_ISVOIPCHANNEL:
                    if (StartType == 1101 ||
                        StartType == 1102 ||
                        StartType == 1103 ||
                        StartType == 1107 ||
                        StartType == 1108 ||
                        StartType == 1113)
                    {
                        propertyValue.Value = "1";
                    }
                    else
                    {
                        propertyValue.Value = "0";
                    }
                    break;

                //提示音
                case PRO_ALERTTONE:
                    int intValue = 0;
                    var value1   = ListProperties.FirstOrDefault(p => p.PropertyID == PRO_ALERTTYPE);
                    if (value1 != null)
                    {
                        int intValue1;
                        if (int.TryParse(value1.Value, out intValue1))
                        {
                            intValue = intValue1;
                            //AlertType为4的时候,取与RecordDelay的复合值
                            if (intValue1 == 2 || intValue == 4)
                            {
                                var value2 = ListProperties.FirstOrDefault(p => p.PropertyID == PRO_RECORDDELAY);
                                if (value2 != null)
                                {
                                    int intValue2;
                                    if (int.TryParse(value2.Value, out intValue2))
                                    {
                                        intValue = intValue | ((intValue2 == 1) ? 8 : 0);
                                    }
                                }
                            }
                        }
                    }
                    propertyValue.Value = intValue.ToString();
                    break;
                }
            }
        }
Beispiel #27
0
 public Column(TwitterStream stream, StartType s, string title)
 {
     if (back != null)
     {
         listView1.BackgroundImage = back;
     }
     InitializeComponent();
     listView1.SmallImageList = new ImageList();
     ts = stream;
     if (s == StartType.UserStream)
     {
         ts.StartUserStream(null, new StreamStoppedCallback((x) => { toolStripStatusLabel1.Text = "Stopped."; }), new StatusCreatedCallback(x => { Add(x); }), null, null, null, new EventCallback(x => { Event(x); }), null);
         var tt = TwitterTimeline.HomeTimeline(stream.Tokens);
         try
         {
             foreach (var tss in tt.ResponseObject)
             {
                 timeline.Add(tss);
             }
         }
         catch
         {
             MessageBox.Show(tt.ErrorMessage);
         }
     }
     else if (s == StartType.FilterStream)
     {
         string query = "";
         if (ts.StreamOptions.Track.Count != 0)
         {
             foreach (string ss in ts.StreamOptions.Track)
             {
                 query += ss + "+AND+";
             }
             query = query.Remove(query.Length - 5, 5);
         }
         ts.StartPublicStream(new StreamStoppedCallback((x) => { toolStripStatusLabel1.Text = "Stopped."; }), new StatusCreatedCallback(x => { Add(x); }), null, new EventCallback(x => { Event(x); }));
         var tt = TwitterSearch.Search(ts.Tokens, query, new SearchOptions() { ResultType = SearchOptionsResultType.Popular });
         try
         {
             foreach (var tss in tt.ResponseObject)
             {
                 timeline.Add(new TwitterStatus() { Text = tss.Text, User = new TwitterUser() { ScreenName = tss.FromUserScreenName } });
             }
         }
         catch
         {
             MessageBox.Show(tt.ErrorMessage);
         }
     }
     else if (s == StartType.Mentions)
     {
         ts.StreamOptions.Track.Add("@" + ExtendedOAuthTokens.Tokens.First<ExtendedOAuthTokens>((x) => { return x.OAuthTokens == ts.Tokens; }).UserName);
         ts.StartPublicStream(new StreamStoppedCallback((x) => { toolStripStatusLabel1.Text = "Stopped."; }), new StatusCreatedCallback(x => { Add(x); }), null, new EventCallback(x => { Event(x); }));
         var tt = TwitterTimeline.Mentions(stream.Tokens);
         try
         {
             foreach (var tss in tt.ResponseObject)
             {
                 timeline.Add(tss);
             }
         }
         catch
         {
             MessageBox.Show(tt.ErrorMessage);
         }
     }
     st = s;
     this.Text = title;
     Columns.Add(this);
     ShowF();
 }
Beispiel #28
0
 public Puzzle(StartType type, MainWindow parent)
 {
     this.winParent = parent;
     shuffle();
 }
Beispiel #29
0
        //
        // GET: /StartType/Delete/5

        public ActionResult Delete(int id)
        {
            StartType starttype = db.StartTypes.Find(id);

            return(View(starttype));
        }
Beispiel #30
0
 public void HotReloadStart(StartType handlerType)
 {
     WriteEvent(1, handlerType);
 }
Beispiel #31
0
            internal static ServiceInfo ChangeStartTypeInPlatform(
                string serviceName,
                StartType startType)
            {
                if (string.IsNullOrWhiteSpace(serviceName))
                {
                    return(new ServiceInfo
                    {
                        ServiceName = serviceName,
                        ErrorCode = (int)Interop.Windows.Error.InvalidName,
                        ErrorMessage = "Service name \"" + serviceName + "\" is invalid"
                    });
                }

                using (var managerHandle = Interop.Windows.OpenSCManagerW(
                           null,
                           null,
                           Interop.Windows.ServiceControlManagerAccessRight.Connect
                           ))
                {
                    if (managerHandle == null || managerHandle.IsInvalid)
                    {
                        var errorCode = Marshal.GetLastWin32Error();
                        return(new ServiceInfo
                        {
                            ServiceName = serviceName,
                            ErrorCode = errorCode,
                            ErrorMessage = "Can not open Windows service controller manager, error code: " + errorCode
                        });
                    }

                    var serviceInfo = new ServiceInfo
                    {
                        ServiceName = serviceName,
                        StartType   = startType
                    };
                    using (var serviceHandle = Interop.Windows.OpenServiceW(
                               managerHandle,
                               serviceName,
                               Interop.Windows.ServiceAccessRight.ChangeConfig |
                               Interop.Windows.ServiceAccessRight.QueryConfig |
                               Interop.Windows.ServiceAccessRight.QueryStatus
                               ))
                    {
                        if (serviceHandle == null || serviceHandle.IsInvalid)
                        {
                            var errorCode = Marshal.GetLastWin32Error();
                            serviceInfo.ErrorCode    = errorCode;
                            serviceInfo.ErrorMessage = "Can not open Windows service \"" + serviceName + "\", error code: " + errorCode;
                        }
                        else
                        {
                            var success = Interop.Windows.ChangeServiceConfigW(
                                serviceHandle,
                                Interop.Windows.ServiceType.NoChange,
                                ConvertToPlatform(startType),
                                Interop.Windows.ErrorControlType.NoChange,
                                null,
                                null,
                                IntPtr.Zero,
                                null,
                                null,
                                null,
                                null
                                );
                            if (!success)
                            {
                                var errorCode = Marshal.GetLastWin32Error();
                                serviceInfo.ErrorCode    = errorCode;
                                serviceInfo.ErrorMessage = "Can not change Windows service \"" + serviceName + "\" config, error code: " + errorCode;
                            }

                            serviceInfo = UpdateCurrentState(serviceHandle, serviceInfo);
                        }

                        return(serviceInfo);
                    }
                }
            }
        /// <summary>
        /// Changes the status and start-up properties for a service
        /// </summary>
        /// <param name="sc">ServiceController instance</param>
        /// <param name="newStatus"></param>
        /// <param name="newStart"></param>
        private static void ChangeServiceProperties(ServiceController sc, StatusType newStatus, StartType newStart)
        {
            try {

                //
                Log.AppendString( logfile, sc.DisplayName + Environment.NewLine );

                // Save the old running status for logging
                string oldStatus = sc.Status.ToString();

                // Change Service running status to 'newStatus'
                switch ( newStatus ) {

                    case StatusType.Start: {

                            if ( sc.Status != ServiceControllerStatus.Running && sc.Status != ServiceControllerStatus.StartPending ) {
                                sc.Start();
                                sc.WaitForStatus( ServiceControllerStatus.Running, new TimeSpan( 0, 0, iServiceChangeTimeout ) );
                                iServiceChangedCount++;
                            }

                        }
                        break;

                    case StatusType.Stop: {

                            if ( sc.Status != ServiceControllerStatus.Stopped && sc.Status != ServiceControllerStatus.StopPending ) {
                                sc.Stop();
                                sc.WaitForStatus( ServiceControllerStatus.Stopped, new TimeSpan( 0, 0, iServiceChangeTimeout ) );
                                iServiceChangedCount++;
                            }

                        }
                        break;

                }

                sc.Refresh();

                // Log status change
                if ( oldStatus.Equals( sc.Status.ToString(), StringComparison.CurrentCultureIgnoreCase ) ) {

                    Log.AppendString( logfile, "Status: '" + sc.Status.ToString() + "' (not changed)" + Environment.NewLine );

                }
                else {

                    Log.AppendString( logfile, "Status changed from '" + oldStatus + "' to '" + sc.Status.ToString() + "'" + Environment.NewLine );

                }

                // Get old start-up type
                object oldStart = RegistryCleaner.GetValue( Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\" + sc.ServiceName, "Start" );
                if ( oldStart != null ) {

                    // Set start-up type
                    if ( (int)newStart != (int)oldStart ) {

                        RegistryCleaner.SetValue( Registry.LocalMachine, @"SYSTEM\CurrentControlSet\Services\" + sc.ServiceName, "Start", (int)newStart );
                        Log.AppendString( logfile, "Start-up changed from '" + ( (StartType)oldStart ).ToString() + "' to '" + newStart.ToString() + "'" + Environment.NewLine );
                        iServiceChangedCount++;

                    }
                    else {

                        Log.AppendString( logfile, "Start-up: '" + ( (StartType)oldStart ).ToString() + "' (not changed)" + Environment.NewLine );

                    }

                }

                Log.AppendString( logfile, Environment.NewLine );

            }
            catch ( Exception ex ) {

                Log.AppendException( logfile, ex );

            }
            finally {

                if ( sc != null ) {

                    sc.Close();
                    sc.Dispose();
                    sc = null;

                }

            }
        }
Beispiel #33
0
 public static extern IntPtr CreateService(IntPtr hSCManager,
                                           string lpServiceName, string lpDisplayName,
                                           ServiceAccessRights dwDesiredAccess, ServiceType dwServiceType,
                                           StartType dwStartType, ErrorControl dwErrorControl,
                                           string lpBinaryPathName, string lpLoadOrderGroup, string lpdwTagId,
                                           string lpDependencies, string lpServiceStartName, string lpPassword);
Beispiel #34
0
	// Update is called once per frame
	void Update () {
        time += Time.deltaTime;
        if (Type == StartType.Shrink)
        {
            if (changeCircle & time > 0.5) { iTween.ScaleTo(circle, normalSize, 2); changeCircle = false; }
            if (changeCore & time > 0.65) 
            {
                iTween.ScaleTo(core, normalSize, 4);
                iTween.ScaleTo(Value, normalValueSize, 4);
                changeCore = false;
                Type = StartType.No;
            }
            
            
            //if(time>12)
            //{
            //    //iTween.(edge, 0, 2);
            //    //iTween.FadeTo(core, 0, 2);
            //    //iTween.FadeTo(circle, 0, 2);
            //    //iTween.FadeTo(Value, 0, 2);
            //    //core.renderer.material.color = new Color(0, 0, 0, 0);
            //    Destroy(gameObject);
            //}
        }
        if (Type == StartType.Rotate)
        {
            if (time > 3)
            {
                Value.transform.localScale = normalValueSize;
                Type = StartType.No;
            }
        }
        if (Type == StartType.Enlarge)
        {
            bool changeEdge = true;
            if(changeEdge & time>0 )
            {
                changeEdge = false;
                iTween.ScaleTo(edge, normalSize, 1f);
            }
            if (changeCircle & time > 0.25)
            {
                iTween.ScaleTo(core, normalSize, 1); changeCircle = false; 
            }
            if (changeCore & time > 0.5)
            {
                iTween.ScaleTo(circle, normalSize, 1);
                changeCore = false;
                
            }
            if(time>1.5f)
            {
                iTween.ScaleTo(Value, normalValueSize, 0.2f);
                Type =StartType.No;
            }
        }
        
	}