当前位置: 首页>>代码示例>>C#>>正文


C# Core.Start方法代码示例

本文整理汇总了C#中Core.Start方法的典型用法代码示例。如果您正苦于以下问题:C# Core.Start方法的具体用法?C# Core.Start怎么用?C# Core.Start使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Core的用法示例。


在下文中一共展示了Core.Start方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Bootstrap

        public static bool Bootstrap()
        {
            if (Directory.Exists("bootstrap") && File.Exists(@"bootstrap\iw4mp.exe"))
            {
                //return;
            }

            Directory.CreateDirectory("bootstrap");

            var _core = new Core();
            _core.CacheLocation = Path.Combine(Environment.CurrentDirectory, "bootstrap");
            //_core.WebCacheServer = "http://localhost/ctest_aiwbs/diff/";
            _core.WebCacheServer = "http://alteriw.net/updater/bootstrap/";
            _core.LocalCacheServer = "";
            _core.WantedCaches = new[] { "aiw-updater" };

            var updateScript = Path.Combine(_core.CacheLocation, "update.cmd");

            // delete the update script
            // it'll be re-generated if an update is available, so don't worry. :)
            File.Delete("update.cmd");
            File.Delete(updateScript);

            _core.Start();

            // wait for completion
            completed = false;

            _core.Completed += (s, e) =>
            {
                UpdateUtility.completed = true;
            };

            _core.Failed += (s, e) =>
            {
                UpdateUtility.completed = true;
            };

            while (!completed)
            {
                Thread.Sleep(1);
            }

            // run the update script if it was updated
            if (File.Exists(updateScript))
            {
                var psi = new ProcessStartInfo(updateScript, "iw4mp.exe");
                psi.WorkingDirectory = Environment.CurrentDirectory;

                Process.Start(psi);

                return true;
            }

            return false;
        }
开发者ID:hOlyYy,项目名称:MeGusta2,代码行数:56,代码来源:UpdateUtility.cs

示例2: RegisterControl

 private void RegisterControl(Core.Spider spider)
 {
     var redisScheduler = spider.Scheduler as Scheduler.RedisScheduler;
     if (redisScheduler != null)
     {
         try
         {
             redisScheduler.Redis.Subscribe($"{spider.Identity}", (c, m) =>
             {
                 switch (m)
                 {
                     case "stop":
                         {
                             spider.Stop();
                             break;
                         }
                     case "start":
                         {
                             spider.Start();
                             break;
                         }
                     case "exit":
                         {
                             spider.Exit();
                             break;
                         }
                 }
             });
         }
         catch
         {
             // ignored
         }
     }
 }
开发者ID:GamesDesignArt,项目名称:DotnetSpider,代码行数:35,代码来源:ModelSpider.cs

示例3: Main

        static void Main(string[] args)
        {
            try
            {
                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);

                Environment.CurrentDirectory = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);//Application.StartupPath;

                try
                {
                    var str = File.Create(Environment.CurrentDirectory + @"\test.log");
                    str.Close();

                    Directory.CreateDirectory(Environment.CurrentDirectory + @"\test");

                    Directory.Delete(Environment.CurrentDirectory + @"\test");
                    File.Delete(Environment.CurrentDirectory + @"\test.log");
                }
                catch (UnauthorizedAccessException)
                {
                    if (!Program.ModifyRights())
                    {
                        return;
                    }
                }

                File.Delete("__iw4mp");

                var files = Directory.GetFiles(Environment.CurrentDirectory, "*.exe", SearchOption.TopDirectoryOnly);
                foreach (var file in files)
                {
                    if (Regex.Match(file.Split('.')[0], "([0-9A-F]{7,10})").Success)
                    {
                        File.Delete(file);
                    }
                }

                CheckCaches(@"bootstrap\caches.xml");

                if (aIW.UpdateUtility.Bootstrap())
                {
                    return;
                }

                if (!File.Exists("mss32.dll") || !File.Exists("binkw32.dll") || !File.Exists(@"main\iw_00.iwd"))
                {
                    MessageBox.Show("Some game library files could not be found. It could be you didn't put the updater files in your existing Modern Warfare 2 game folder. Also, you still need the game if you want to run alterIWnet.", "alterIWnet", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }

                ConnectionManager.Install();

                var processes = Process.GetProcessesByName("iw4mp");
                if (processes.Length > 1)
                {
                    ConnectionManager.Handle(args, true);
                    return;
                }

                processes = Process.GetProcessesByName("iw4mp.dat");
                if (processes.Length > 0)
                {
                    ConnectionManager.Handle(args, true);
                    return;
                }

                // pre-run task: remove improper mp_playlists.ff files (english)
                // added 2010-07-23

                if (File.Exists(@"zone\english\mp_playlists.ff"))
                {
                    // delete it in all cases so it updates
                    File.Delete(@"zone\english\mp_playlists.ff");

                    // old code
                    /*
                    var info = new FileInfo(@"zone\english\mp_playlists.ff");
                    if (info.Length < 16384)
                    { // 16 kB should be a proper minimum size
                        File.Delete(@"zone\english\mp_playlists.ff");
                    }
                    */
                }

                var enableUpdates = Config.Get("enable_updates", "1");

                if (enableUpdates == "0")
                {
                    goto skipUpdate;
                }

                CheckCaches(@"caches.xml");

                var icon = new NotifyIcon();
                icon.Icon = System.Drawing.Icon.ExtractAssociatedIcon(Assembly.GetExecutingAssembly().Location);
                icon.Text = "alterIWnet - starting";
                icon.Visible = true;

                var _core = new Core();
//.........这里部分代码省略.........
开发者ID:hOlyYy,项目名称:MeGusta2,代码行数:101,代码来源:Program.cs

示例4: RegisterControl

 private void RegisterControl(Core.Spider spider)
 {
     if (Redis != null)
     {
         try
         {
             Redis.GetSubscriber().Subscribe($"{spider.Identity}", (c, m) =>
             {
                 switch (m)
                 {
                     case "stop":
                         {
                             spider.Stop();
                             break;
                         }
                     case "start":
                         {
                             spider.Start();
                             break;
                         }
                     case "exit":
                         {
                             spider.Exit();
                             break;
                         }
                 }
             });
         }
         catch
         {
             // ignored
         }
     }
 }
开发者ID:yalunwang,项目名称:DotnetSpider,代码行数:34,代码来源:ModelSpider.cs


注:本文中的Core.Start方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。