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


C# Log.Debug方法代码示例

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


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

示例1: DatasetMachineSelectionWindow

        public static Window DatasetMachineSelectionWindow(Application application, Log log)
        {
            const string prefix = "Dialogs - MachineSelectionWindow";
            if ((application == null) || application.HasExited)
            {
                throw new RegressionTestFailedException(prefix + ": Application does not exist or has already exited.");
            }

            // Note that the windows can't be found through an Automation ID for some reason, hence
            // using the title of the window.
            var mainWindow = MainWindow(application, log);
            if (mainWindow == null)
            {
                return null;
            }

            return Retry.Times(
                () =>
                {
                    log.Debug(prefix, "Trying to get the machine selection window.");

                    var window = mainWindow.ModalWindow("Select a machine for the dataset");
                    if (window == null)
                    {
                        log.Error(prefix, "Failed to get the machine selection window.");
                    }

                    return window;
                });
        }
开发者ID:pvandervelde,项目名称:Apollo,代码行数:30,代码来源:DialogProxies.cs

示例2: fmMain_Load

        private void fmMain_Load(object sender, EventArgs e)
        {
            bool r;
            AppMutex = new Mutex(true, "AndonSys.AppHelper", out r);
            if (!r)
            {
                MessageBox.Show("系统已运行!",this.Text);
                Close();
                return;
            }
            
            CONFIG.Load();

            log = new Log(Application.StartupPath, "AppHelper", Log.DEBUG_LEVEL);

            log.Debug("系统运行");
           
            gdApp.AutoGenerateColumns = false;
           
            LoadApp();
            
            tbApp.Show();

            timer.Enabled = true;
        }
开发者ID:puyd,项目名称:AndonSys.Test,代码行数:25,代码来源:fmAppHelper.cs

示例3: Bot

        public Bot(Configuration.BotInfo config, string apiKey, UserHandlerCreator handlerCreator, bool debug = false)
        {
            Username     = config.Username;
            Password     = config.Password;
            DisplayName  = config.DisplayName;
            ChatResponse = config.ChatResponse;
            MaximumTradeTime = config.MaximumTradeTime;
            MaximiumActionGap = config.MaximumActionGap;
            DisplayNamePrefix = config.DisplayNamePrefix;
            TradePollingInterval = config.TradePollingInterval <= 100 ? 800 : config.TradePollingInterval;
            Admins       = config.Admins;
            this.apiKey  = apiKey;
            AuthCode     = null;
            log          = new Log (config.LogFile, this);
            CreateHandler = handlerCreator;

            // Hacking around https
            ServicePointManager.ServerCertificateValidationCallback += SteamWeb.ValidateRemoteCertificate;

            log.Debug ("Initializing Steam Bot...");
            SteamClient = new SteamClient();
            SteamTrade = SteamClient.GetHandler<SteamTrading>();
            SteamUser = SteamClient.GetHandler<SteamUser>();
            SteamFriends = SteamClient.GetHandler<SteamFriends>();
            log.Info ("Connecting...");
            SteamClient.Connect();

            Thread CallbackThread = new Thread(() => // Callback Handling
            {
                while (true)
                {
                    CallbackMsg msg = SteamClient.WaitForCallback (true);
                    HandleSteamMessage (msg);
                }
            });

            new Thread(() => // Trade Polling if needed
            {
                while (true)
                {
                    Thread.Sleep (TradePollingInterval);
                    if (CurrentTrade != null)
                    {
                        try
                        {
                            CurrentTrade.Poll ();
                        }
                        catch (Exception e)
                        {
                            log.Error ("Error Polling Trade: " + e);
                        }
                    }
                }
            }).Start ();

            CallbackThread.Start();
            log.Success ("Done Loading Bot!");
            CallbackThread.Join();
        }
开发者ID:iamnilay3,项目名称:SteamBot,代码行数:59,代码来源:Bot.cs

示例4: LogManager

        public LogManager()
        {
            if (!DesignerProperties.IsInDesignTool)
                m_logs = new ObservableCollection<ILog>();
            else
            {
                Log stringLog = new Log(typeof(string), null);
                stringLog.Debug("Debug");
                stringLog.Info("Info");
                stringLog.Warn("Warn");
                stringLog.Fatal("Fatal");

                m_logs = new ObservableCollection<ILog>();
                m_logs.Add(stringLog);
            }

            m_readonlyLogs = new ReadOnlyObservableCollection<ILog>(m_logs);
            m_globalLog = new Log(typeof(Global), null);
            m_logs.Add(m_globalLog);
        }
开发者ID:rpwjanzen,项目名称:Sunshine,代码行数:20,代码来源:LogManager.cs

示例5: Page_Load

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
              {
            try
            {
              homeSeerApp = (hsapplication)Context.Items["Content"];

              // Used for debugging in VS
              if (homeSeerApp == null)
            homeSeerApp = Global.homeSeerApp;

              if (homeSeerApp == null)
            throw new Exception("Error loading HomeSeer application object");

              log = Log.GetInstance("HSPI_JJLATITUDE.Web.Places", homeSeerApp);

              plugin = (HSPI)homeSeerApp.Plugin(App.PLUGIN_NAME);

              if (plugin == null)
            throw new Exception("Error getting a reference to the plug-in.  Is it loaded and enabled?");
            }
            catch (Exception ex)
            {
              Response.Write(ex.Message + ex.StackTrace);
            }
            log.Debug("Loading Places web page");

            // Inject HomeSeer HTML
            litHSHeader.Text = HomeSeer.GetHeadContent(homeSeerApp);
            litHSBody.Text = HomeSeer.GetBodyContent(homeSeerApp);
            litHSFooter.Text = HomeSeer.GetFooterContent(homeSeerApp);

            txtName.Text = "";
              }  // (!IsPostBack)

              dsPlaces.DataFile = Db.DbPath;
        }
开发者ID:gdrapp,项目名称:JJLatitude,代码行数:38,代码来源:Places.aspx.cs

示例6: Bot

        public Bot(Configuration.BotInfo config, string apiKey, UserHandlerCreator handlerCreator, bool debug = false, bool process = false)
        {
            userHandlers = new Dictionary<SteamID, UserHandler>();
            logOnDetails = new SteamUser.LogOnDetails
            {
                Username = config.Username,
                Password = config.Password
            };
            DisplayName  = config.DisplayName;
            ChatResponse = config.ChatResponse;
            MaximumTradeTime = config.MaximumTradeTime;
            MaximumActionGap = config.MaximumActionGap;
            DisplayNamePrefix = config.DisplayNamePrefix;
            tradePollingInterval = config.TradePollingInterval <= 100 ? 800 : config.TradePollingInterval;
            schemaLang = config.SchemaLang != null && config.SchemaLang.Length == 2 ? config.SchemaLang.ToLower() : "en";
            Admins = config.Admins;
            ApiKey = !String.IsNullOrEmpty(config.ApiKey) ? config.ApiKey : apiKey;
            isProccess = process;
            try
            {
                if( config.LogLevel != null )
                {
                    consoleLogLevel = (Log.LogLevel)Enum.Parse(typeof(Log.LogLevel), config.LogLevel, true);
                    Console.WriteLine(@"(Console) LogLevel configuration parameter used in bot {0} is depreciated and may be removed in future versions. Please use ConsoleLogLevel instead.", DisplayName);
                }
                else consoleLogLevel = (Log.LogLevel)Enum.Parse(typeof(Log.LogLevel), config.ConsoleLogLevel, true);
            }
            catch (ArgumentException)
            {
                Console.WriteLine(@"(Console) ConsoleLogLevel invalid or unspecified for bot {0}. Defaulting to ""Info""", DisplayName);
                consoleLogLevel = Log.LogLevel.Info;
            }

            try
            {
                fileLogLevel = (Log.LogLevel)Enum.Parse(typeof(Log.LogLevel), config.FileLogLevel, true);
            }
            catch (ArgumentException)
            {
                Console.WriteLine(@"(Console) FileLogLevel invalid or unspecified for bot {0}. Defaulting to ""Info""", DisplayName);
                fileLogLevel = Log.LogLevel.Info;
            }

            logFile = config.LogFile;
            Log = new Log(logFile, DisplayName, consoleLogLevel, fileLogLevel);
            createHandler = handlerCreator;
            BotControlClass = config.BotControlClass;
            SteamWeb = new SteamWeb();

            // Hacking around https
            ServicePointManager.ServerCertificateValidationCallback += SteamWeb.ValidateRemoteCertificate;

            Log.Debug ("Initializing Steam Bot...");
            SteamClient = new SteamClient();
            SteamClient.AddHandler(new SteamNotifications());
            SteamTrade = SteamClient.GetHandler<SteamTrading>();
            SteamUser = SteamClient.GetHandler<SteamUser>();
            SteamFriends = SteamClient.GetHandler<SteamFriends>();
            SteamGameCoordinator = SteamClient.GetHandler<SteamGameCoordinator>();
            SteamNotifications = SteamClient.GetHandler<SteamNotifications>();

            botThread = new BackgroundWorker { WorkerSupportsCancellation = true };
            botThread.DoWork += BackgroundWorkerOnDoWork;
            botThread.RunWorkerCompleted += BackgroundWorkerOnRunWorkerCompleted;
            botThread.RunWorkerAsync();
        }
开发者ID:nicolas-martin,项目名称:csgoescrow,代码行数:66,代码来源:Bot.cs

示例7: Bot

        public Bot(Configuration.BotInfo config, string apiKey, UserHandlerCreator handlerCreator, bool debug = false, bool process = false)
        {
            logOnDetails = new SteamUser.LogOnDetails
            {
                Username = config.Username,
                Password = config.Password
            };
            DisplayName  = config.DisplayName;
            ChatResponse = config.ChatResponse;
            MaximumTradeTime = config.MaximumTradeTime;
            MaximiumActionGap = config.MaximumActionGap;
            DisplayNamePrefix = config.DisplayNamePrefix;
            TradePollingInterval = config.TradePollingInterval <= 100 ? 800 : config.TradePollingInterval;
            Admins       = config.Admins;
            this.apiKey  = apiKey;
            this.isprocess = process;
            try
            {
                LogLevel = (Log.LogLevel)Enum.Parse(typeof(Log.LogLevel), config.LogLevel, true);
            }
            catch (ArgumentException)
            {
                Console.WriteLine("Invalid LogLevel provided in configuration. Defaulting to 'INFO'");
                LogLevel = Log.LogLevel.Info;
            }
            log          = new Log (config.LogFile, this.DisplayName, LogLevel);
            CreateHandler = handlerCreator;
            BotControlClass = config.BotControlClass;

            // Hacking around https
            ServicePointManager.ServerCertificateValidationCallback += SteamWeb.ValidateRemoteCertificate;

            log.Debug ("Initializing Steam Bot...");
            SteamClient = new SteamClient();
            SteamTrade = SteamClient.GetHandler<SteamTrading>();
            SteamUser = SteamClient.GetHandler<SteamUser>();
            SteamFriends = SteamClient.GetHandler<SteamFriends>();
            SteamGameCoordinator = SteamClient.GetHandler<SteamGameCoordinator>();

            backgroundWorker = new BackgroundWorker { WorkerSupportsCancellation = true };
            backgroundWorker.DoWork += BackgroundWorkerOnDoWork;
            backgroundWorker.RunWorkerCompleted += BackgroundWorkerOnRunWorkerCompleted;
            backgroundWorker.RunWorkerAsync();
        }
开发者ID:tkphoto,项目名称:SteamBot,代码行数:44,代码来源:Bot.cs

示例8: Bot

        public Bot(Configuration.BotInfo config, string apiKey, UserHandlerCreator handlerCreator, bool debug = false)
        {
            Username     = config.Username;
            Password     = config.Password;
            DisplayName  = config.DisplayName;
            ChatResponse = config.ChatResponse;
            MaximumTradeTime = config.MaximumTradeTime;
            MaximiumActionGap = config.MaximumActionGap;
            DisplayNamePrefix = config.DisplayNamePrefix;
            TradePollingInterval = config.TradePollingInterval <= 100 ? 800 : config.TradePollingInterval;
            Admins       = config.Admins;
            this.apiKey  = apiKey;
            AuthCode     = null;
            try
            {
                LogLevel = (Log.LogLevel)Enum.Parse(typeof(Log.LogLevel), config.LogLevel, true);
            }
            catch (ArgumentException)
            {
                Console.WriteLine("Invalid LogLevel provided in configuration. Defaulting to 'INFO'");
                LogLevel = Log.LogLevel.Info;
            }
            log          = new Log (config.LogFile, this.DisplayName, LogLevel);
            CreateHandler = handlerCreator;

            // Hacking around https
            ServicePointManager.ServerCertificateValidationCallback += SteamWeb.ValidateRemoteCertificate;

            log.Debug ("Initializing Steam Bot...");
            SteamClient = new SteamClient();
            SteamTrade = SteamClient.GetHandler<SteamTrading>();
            SteamUser = SteamClient.GetHandler<SteamUser>();
            SteamFriends = SteamClient.GetHandler<SteamFriends>();
            log.Info ("Connecting...");
            SteamClient.Connect();

            Thread CallbackThread = new Thread(() => // Callback Handling
            {
                while (true)
                {
                    CallbackMsg msg = SteamClient.WaitForCallback (true);
                    HandleSteamMessage (msg);
                }
            });

            new Thread(() => // Trade Polling if needed
            {
                while (true)
                {
                    Thread.Sleep (TradePollingInterval);
                    if (CurrentTrade != null)
                    {
                        try
                        {
                            CurrentTrade.Poll ();

                            if (CurrentTrade.OtherUserCancelled)
                            {
                                log.Info("Other user cancelled the trade.");
                                CurrentTrade = null;
                            }
                        }
                        catch (Exception e)
                        {
                            log.Error ("Error Polling Trade: " + e);
                            // ok then we should stop polling...
                            CurrentTrade = null;
                        }
                    }
                }
            }).Start ();

            CallbackThread.Start();
            log.Success ("Done Loading Bot!");
            CallbackThread.Join();
        }
开发者ID:thehawk93,项目名称:SteamBot,代码行数:76,代码来源:Bot.cs

示例9: MainWindow

        public static Window MainWindow(Application application, Log log)
        {
            const string prefix = "Dialogs - MainWindow";
            if ((application == null) || application.HasExited)
            {
                throw new RegressionTestFailedException(prefix + ": Application does not exists or has already exited.");
            }

            // Note that the windows can't be found through an Automation ID for some reason, hence
            // using the title of the window.
            return Retry.Times(
                () =>
                {
                    log.Debug(prefix, "Trying to get main window.");
                    var window = application.GetWindow("Project explorer", InitializeOption.NoCache);

                    if (window == null)
                    {
                        log.Error(prefix, "Failed to get main window.");
                    }

                    return window;
                });
        }
开发者ID:pvandervelde,项目名称:Apollo,代码行数:24,代码来源:DialogProxies.cs

示例10: Bot

        public Bot(Configuration.BotInfo config, Log log, string apiKey, UserHandlerCreator handlerCreator, Login _login, bool debug = false)
        {
            this.main = _login;
            logOnDetails = new SteamUser.LogOnDetails
            {
                Username = _login.Username,
                Password = _login.Password
            };
            ChatResponse = "";
            TradePollingInterval = 500;
            Admins = new ulong[1];
            Admins[0] = 0;
            this.apiKey = apiKey;
            try
            {
                LogLevel = (Log.LogLevel)Enum.Parse(typeof(Log.LogLevel), "Debug", true);
            }
            catch (ArgumentException)
            {
                Console.WriteLine("Invalid LogLevel provided in configuration. Defaulting to 'INFO'");
                LogLevel = Log.LogLevel.Info;
            }
            this.log = log;
            CreateHandler = handlerCreator;
            BotControlClass = "SteamBot.SimpleUserHandler";

            // Hacking around https
            ServicePointManager.ServerCertificateValidationCallback += SteamWeb.ValidateRemoteCertificate;

            log.Debug ("Initializing Steam account...");
            main.Invoke((Action)(() =>
            {
                main.label_status.Text = "Initializing Steam account...";
            }));
            SteamClient = new SteamClient();
            SteamClient.AddHandler(new ClientPlayerNicknameListHandler());
            SteamTrade = SteamClient.GetHandler<SteamTrading>();
            SteamUser = SteamClient.GetHandler<SteamUser>();
            SteamFriends = SteamClient.GetHandler<SteamFriends>();
            SteamGameCoordinator = SteamClient.GetHandler<SteamGameCoordinator>();
            SteamNicknames = SteamClient.GetHandler<ClientPlayerNicknameListHandler>();
            log.Info ("Connecting...");
            main.Invoke((Action)(() =>
            {
                main.label_status.Text = "Connecting to Steam...";
            }));
            SteamClient.Connect();

            Thread CallbackThread = new Thread(() => // Callback Handling
            {
                while (true)
                {
                    CallbackMsg msg = SteamClient.WaitForCallback(true);

                    new Thread(() => HandleSteamMessage(msg)).Start();
                }
            });

            CallbackThread.Start();
            CallbackThread.Join();
            log.Success("Done loading account!");
            main.Invoke((Action)(() =>
            {
                main.label_status.Text = "Done loading account!";
            }));
        }
开发者ID:The-Mad-Pirate,项目名称:Mist,代码行数:66,代码来源:Bot.cs

示例11: RestartBot

        /// <summary>
        /// Starts the callback thread and connects to Steam via SteamKit2.
        /// </summary>
        /// <remarks>
        /// THIS NEVER RETURNS.
        /// </remarks>
        /// <returns><c>true</c>. See remarks</returns>
        public bool RestartBot()
        {
            if (IsRunning)
                return false;

            log = new Log(LogFile, this.DisplayName, LogLevel);

            // Hacking around https
            ServicePointManager.ServerCertificateValidationCallback += SteamWeb.ValidateRemoteCertificate;

            log.Debug("Initializing Steam Bot...");
            SteamClient = new SteamClient();
            SteamTrade = SteamClient.GetHandler<SteamTrading>();
            SteamUser = SteamClient.GetHandler<SteamUser>();
            SteamFriends = SteamClient.GetHandler<SteamFriends>();
            SteamGameCoordinator = SteamClient.GetHandler<SteamGameCoordinator>();

            backgroundWorker = new BackgroundWorker { WorkerSupportsCancellation = true };
            backgroundWorker.DoWork += BackgroundWorkerOnDoWork;
            backgroundWorker.RunWorkerCompleted += BackgroundWorkerOnRunWorkerCompleted;
            backgroundWorker.RunWorkerAsync();
            log.Info("Connecting...");

            SteamClient.Connect();

            IsRunning = true;

            log.Info("Done Loading Bot!");

            return true; // never get here
        }
开发者ID:narugo,项目名称:SteamBot-Idle,代码行数:38,代码来源:Bot.cs

示例12: Bot

        public Bot(Configuration.BotInfo config, string apiKey, UserHandlerCreator handlerCreator, bool debug = false)
        {
            logOnDetails = new SteamUser.LogOnDetails
            {
                Username = config.Username,
                Password = config.Password
            };
            DisplayName  = config.DisplayName;
            ChatResponse = config.ChatResponse;
            MaximumTradeTime = config.MaximumTradeTime;
            MaximiumActionGap = config.MaximumActionGap;
            DisplayNamePrefix = config.DisplayNamePrefix;
            TradePollingInterval = config.TradePollingInterval <= 100 ? 800 : config.TradePollingInterval;
            Admins       = config.Admins;
            this.apiKey  = apiKey;
            try
            {
                LogLevel = (Log.LogLevel)Enum.Parse(typeof(Log.LogLevel), config.LogLevel, true);
            }
            catch (ArgumentException)
            {
                Console.WriteLine("Invalid LogLevel provided in configuration. Defaulting to 'INFO'");
                LogLevel = Log.LogLevel.Info;
            }
            log          = new Log (config.LogFile, this.DisplayName, LogLevel);
            CreateHandler = handlerCreator;
            BotControlClass = config.BotControlClass;

            // Hacking around https
            ServicePointManager.ServerCertificateValidationCallback += SteamWeb.ValidateRemoteCertificate;

            log.Debug ("Initializing Steam Bot...");
            SteamClient = new SteamClient();
            SteamTrade = SteamClient.GetHandler<SteamTrading>();
            SteamUser = SteamClient.GetHandler<SteamUser>();
            SteamFriends = SteamClient.GetHandler<SteamFriends>();
            log.Info ("Connecting...");
            SteamClient.Connect();

            Thread CallbackThread = new Thread(() => // Callback Handling
            {
                while (true)
                {
                    CallbackMsg msg = SteamClient.WaitForCallback (true);

                    HandleSteamMessage (msg);
                }
            });

            CallbackThread.Start();
            log.Success ("Done Loading Bot!");
            CallbackThread.Join();
        }
开发者ID:Wo0T,项目名称:SteamBot,代码行数:53,代码来源:Bot.cs

示例13: Serial

 /// <summary>
 /// Opens serial connection with and inits Arduino running X10ex.
 /// Serial class is IDisposable, encolse in using section or call dispose to close connection.
 /// </summary>
 /// <param name="portHint">Tells library what port to scan first, speeds up discovery process.</param>
 /// <param name="baudRate">Baudrate: 9600, 115200 e.g.</param>
 /// <param name="logFilePath">Full log file path, "C:\X10ExSerial.log" e.g. When set to null or empty log messages will be written to console.</param>
 /// <param name="syncObject">Synchronization object. Use this to make events fire on UI thread e.g.</param>
 public Serial(string portHint, int baudRate, string logFilePath, ISynchronizeInvoke syncObject)
 {
     _serialBuffer = new StringBuilder();
     _log = new Log(GetType(), logFilePath);
     _syncObject = syncObject;
     // Get list of available serial port names and sort alphabetically
     List<string> portNames = new List<string>();
     portNames.AddRange(SerialPort.GetPortNames());
     portNames.Sort();
     // If porthint is specified, make sure it's the first entry in the list of ports
     if (!String.IsNullOrEmpty(portHint))
     {
         portHint = portHint.ToUpper();
         portNames.Remove(portHint);
         portNames.Insert(0, portHint);
     }
     _log.Info("Scanning serial ports for Arduino running X10ex.");
     foreach (string port in portNames)
     {
         SerialPort = new SerialPort(port, baudRate)
         {
             DtrEnable = true,
             Encoding = Encoding.ASCII
         };
         try
         {
             SerialPort.Open();
             int timeoutMs = 2000;
             while (timeoutMs > 0 && !SerialPort.IsOpen)
             {
                 Thread.Sleep(100);
                 timeoutMs -= 100;
             }
             while (timeoutMs > 0 && !_serialBuffer.ToString().Contains("X10"))
             {
                 Thread.Sleep(100);
                 timeoutMs -= 100;
                 _serialBuffer.Append(SerialPort.ReadExisting());
             }
             if (_serialBuffer.ToString().Contains("X10"))
             {
                 break;
             }
             CloseConnection();
         }
         catch (System.IO.IOException ex)
         {
             CloseConnection();
             _log.Debug(ex.Message);
         }
         catch (UnauthorizedAccessException ex)
         {
             CloseConnection();
             _log.Debug("Serial port \"" + port + "\" is already in use. Error message: " + ex.Message);
         }
         _serialBuffer.Clear();
     }
     if (SerialPort == null)
     {
         throw new Exception("Could not find Arduino running X10ex on any available serial port.");
     }
     SerialPort.DataReceived += DataReceived;
     SerialPort.ErrorReceived += ErrorReceived;
     SerialPort.DiscardInBuffer();
     _serialBuffer.Clear();
     _log.Info("Serial connection with Arduino running X10ex established on port \"" + SerialPort.PortName + "\".");
 }
开发者ID:gerzo,项目名称:x10,代码行数:75,代码来源:Serial.cs

示例14: Start

        public void Start()
        {
            log = new Log (this.GetType ().Name);
            log.Debug ("Start");

            if (gui == null) {
                gui = this.gameObject.AddComponent<MainMenuGui> ();
                gui.UpdateToolbarStock ();
                gui.SetVisible (false);

            }

            config = readConfig ();

            KspIssue3838Fix.ApplyFix (config.enableExperimentalEditorExtensionsCompatibility);

            editorFSM = (KerbalFSM)Refl.GetValue (EditorLogic.fetch, "\u0001");

            cursorLocker = Application.platform == RuntimePlatform.WindowsPlayer ? new WinCursorLocker () : (CursorLocker)new UnityLocker ();

            movementBounds = new Bounds ();
            if (EditorDriver.editorFacility == EditorFacility.VAB) {
                movementBounds = config.vab.bounds;
            } else if (EditorDriver.editorFacility == EditorFacility.SPH) {
                movementBounds = config.sph.bounds;
            }
            if (!config.enforceBounds) {
                movementBounds = new Bounds (Vector3.zero, Vector3.one * float.MaxValue);
            }

            var restartListener = new EventVoid.OnEvent (this.OnEditorRestart);
            GameEvents.onEditorRestart.Add (restartListener);
            OnCleanup += () => GameEvents.onEditorRestart.Remove (restartListener);

            var partEventListener = new EventData<ConstructionEventType, Part>.OnEvent (this.OnPartEvent);
            GameEvents.onEditorPartEvent.Add (partEventListener);
            OnCleanup += () => GameEvents.onEditorPartEvent.Remove (partEventListener);

            if (config.defaultCamera) {
                SwitchMode (false);
                ResetCamera ();
            }
        }
开发者ID:Kerbas-ad-astra,项目名称:WasdEditorCameraContinued,代码行数:43,代码来源:WasdEditorCameraBehaviour.cs

示例15: Bot

        public Bot(Configuration.BotInfo config, string apiKey, UserHandlerCreator handlerCreator, bool debug = false)
        {
            logOnDetails = new SteamUser.LogOnDetails
            {
                Username = config.Username,
                Password = config.Password
            };
            DisplayName  = config.DisplayName;
            ChatResponse = config.ChatResponse;
            MaximumTradeTime = config.MaximumTradeTime;
            MaximiumActionGap = config.MaximumActionGap;
            DisplayNamePrefix = config.DisplayNamePrefix;
            TradePollingInterval = config.TradePollingInterval <= 100 ? 800 : config.TradePollingInterval;
            hatBuyPrice= config.HatBuyPrice;
            hatSellPrice= config.HatSellPrice;
            maxRequestTime= config.MaxRequestTime;
            craftHatSellPrice = config.CraftHatSellPrice;
            Admins       = config.Admins;
            this.apiKey  = apiKey;
            try
            {
                LogLevel = (Log.LogLevel)Enum.Parse(typeof(Log.LogLevel), config.LogLevel, true);
            }
            catch (ArgumentException)
            {
                Console.WriteLine("Invalid LogLevel provided in configuration. Defaulting to 'INFO'");
                LogLevel = Log.LogLevel.Info;
            }
            log          = new Log (config.LogFile, this.DisplayName, LogLevel);
            CreateHandler = handlerCreator;
            BotControlClass = config.BotControlClass;

            // Hacking around https
            ServicePointManager.ServerCertificateValidationCallback += SteamWeb.ValidateRemoteCertificate;

            log.Debug ("Initializing Steam Bot...");
            SteamClient = new SteamClient();
            SteamTrade = SteamClient.GetHandler<SteamTrading>();
            SteamUser = SteamClient.GetHandler<SteamUser>();
            SteamFriends = SteamClient.GetHandler<SteamFriends>();
            log.Info ("Connecting...");
            SteamClient.Connect();
            
            Thread CallbackThread = new Thread(() => // Callback Handling
            {
                while (true)
                {
                    CallbackMsg msg = SteamClient.WaitForCallback (true);

                    HandleSteamMessage (msg);
                }
            });
            new Thread(() =>
                {
                    while (true)
                    {
                        Thread.Sleep(1000);
                        if (currentRequest.User != null)
                        {
                            DateTime RequestTimeout = RequestTime.AddSeconds(maxRequestTime);
                            int untilTradeTimeout = (int)Math.Round((RequestTimeout - DateTime.Now).TotalSeconds);
                            if (untilTradeTimeout <= 0 && (MySQL.getItem().User != null))
                            {
                                SteamFriends.SendChatMessage(currentRequest.User, EChatEntryType.ChatMsg, "Sorry, but your request took too long");
                                NewRequest(MySQL.RequestStatus.Timedout);
                                log.Warn("Request timedout");
                            }
                        }
                    }
                }).Start();
            CallbackThread.Start();
            log.Success ("Done Loading Bot!");
            CallbackThread.Join();
        }
开发者ID:norgalyn,项目名称:SteamBot,代码行数:74,代码来源:Bot.cs


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