Beispiel #1
0
 private void LogText(string message)
 {
     Dispatcher?.Invoke((Action) delegate() {
         MainLog.AppendText(message + "\n");
         MainLog.ScrollToEnd();
     });
 }
        public DGAdmin()
            : base()
        {
            WriteLog.Info("RGAdmin is starting...");
            MainLog.WriteInfo("RGAdmin starting...");

            if (!Directory.Exists(ConfigValues.ConfigPath))
            {
                WriteLog.Info("Creating directory...");
                Directory.CreateDirectory(ConfigValues.ConfigPath);
            }

            #region MODULE LOADING
            MAIN_OnServerStart();
            CFG_OnServerStart();
            UTILS_OnServerStart();
            CMDS_OnServerStart();
            groups_OnServerStart();
            if (ConfigValues.ISNIPE_MODE)
            {
                SNIPE_OnServerStart();
            }
            PersonalPlayerDvars = UTILS_PersonalPlayerDvars_load();
            if (ConfigValues.settings_enable_chat_alias)
            {
                InitChatAlias();
            }
            if (ConfigValues.settings_enable_xlrstats)
            {
                XLR_OnServerStart();
                XLR_InitCommands();
            }
            #endregion
        }
Beispiel #3
0
        public LAdmin()
            : base()
        {
            WriteLog.Info("[ES]Admin v1.0.0.6 by Musta.");
            MainLog.WriteInfo("[ES]Admin v1.0.0.6 by Musta.");

            if (!Directory.Exists(ConfigValues.ConfigPath))
            {
                WriteLog.Info("Creating directories for script.");
                Directory.CreateDirectory(ConfigValues.ConfigPath);
            }

            #region MODULE LOADING
            MAIN_OnServerStart();
            CFG_OnServerStart();
            UTILS_OnServerStart();
            CMDS_OnServerStart();
            groups_OnServerStart();
            if (ConfigValues.PROMOD)
            {
                PROMOD_OnServerStart();
            }
            if (ConfigValues.ISNIPE_MODE)
            {
                SNIPE_OnServerStart();
            }
            if (!ConfigValues.PROMOD && !ConfigValues.ISNIPE_MODE)
            {
                NORMAL_OnServerStart();
            }
            #endregion
        }
Beispiel #4
0
        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                chart1.Series["Series1"].Points.Clear();
                chart1.Series["Series2"].Points.Clear();

                int doors = int.Parse(txtDoors.Text);
                int rep   = int.Parse(txtRep.Text);
                int paus  = int.Parse(txtPause.Text);

                _log = new MainLog(doors, rep, paus);
                _log.OnChangedDecision     += this._log_OnChangedDecision;
                _log.OnDontChangedDecision += _log_OnDontChangedDecision;
                _log.Start();

                btnStart.Enabled = false;
                BtnCont.Enabled  = false;
                btnPause.Enabled = true;
                btnStop.Enabled  = true;
            }
            catch (Exception ex) {
                MessageBox.Show(ex.Message);
            }
        }
Beispiel #5
0
    void ToggleInit()
    {
        isInit = !isInit;

        if (isInit)
        {
            logger = new RemoteLogger();
            MainLog.AddAppender(GetWebRtcAppender());
            logger.Connect("log");

            disposable = new CompositeDisposable();
            logger.remote.OnEvent
            .Where(_ => _.Type == NetEventType.Disconnected)
            .Subscribe(_ => {
                ToggleInit();
                ToggleInit();
            })
            .AddTo(disposable);

            logger.remote.OnEvent
            .Where(_ => _.Type == NetEventType.NewConnection)
            .Subscribe(_ => view.startButton
                       .GetComponentInChildren <Text>().text = "Stop client")
            .AddTo(disposable);
        }
        else
        {
            MainLog.RemoveAppender(GetWebRtcAppender());
            logger.Disconnect();
            disposable.Dispose();
        }

        view.Toggle(isInit);
    }
Beispiel #6
0
        protected override List <UnitOfWork> Filter(IEnumerable <UnitOfWork> unitsOfWork)
        {
            var resList = new List <UnitOfWork>();

            MainLog.WriteLine("╔════════════════════════════════╗");
            MainLog.WriteLine("║   Filtering input resx files   ║");
            MainLog.WriteLine("╚════════════════════════════════╝");

            foreach (var unitOfWork in unitsOfWork)
            {
                if (!unitOfWork.ResourceFile.EndsWith(".resx"))
                {
                    MainLog.WriteLine("Not an resx: {0}", unitOfWork.ResourceFile);
                }
                else if (!File.Exists(unitOfWork.ResourceFile))
                {
                    MainLog.WriteLine("File coudln't be found: {0}", unitOfWork.ResourceFile);
                }
                else
                {
                    resList.Add(unitOfWork);
                }
            }

            MainLog.WriteLine("╔════════════════════════════════╗");
            MainLog.WriteLine("║Ended filtering input resx files║");
            MainLog.WriteLine("╚════════════════════════════════╝");

            return(resList);
        }
        public bool UpdateResponseLog(MainLogDTO log, MyLogDBEntities logContext)
        {
            MainLog dbLog = logContext.MainLog.FirstOrDefault(x => x.ID == log.ID);

            if (dbLog != null)
            {
                dbLog.Succeed   = log.Succeed;
                dbLog.Exception = log.Exception;
                if (dbLog.Exception == true)
                {
                    dbLog.ExceptionDetail             = new MyLogManager.ExceptionDetail();
                    dbLog.ExceptionDetail.Description = log.ExceptionDesc;
                }
                dbLog.Duration = (int)(DateTime.Now.TimeOfDay - dbLog.Time).TotalSeconds;
                foreach (var parameter in log.ResultParameters)
                {
                    var dbparameter = new ResultParameters()
                    {
                        Name = parameter.Name, Value = parameter.Value
                    };
                    dbLog.ResultParameters.Add(dbparameter);
                }
                logContext.SaveChanges();
                return(true);
            }



            return(false);
        }
Beispiel #8
0
        public override EventEat OnSay3(Entity player, ChatType type, string name, ref string message)
        {
            if (!message.StartsWith("!") || type != ChatType.All)
            {
                MainLog.WriteInfo("[CHAT:" + type + "] " + player.Name + ": " + message);

                CHAT_WriteChat(player, type, message);
                return(EventEat.EatGame);
            }

            if (message.ToLowerInvariant().StartsWith("!login"))
            {
                string line = "[SPY] " + player.Name + " : !login ****";
                WriteLog.Info(line);
                MainLog.WriteInfo(line);
                CommandsLog.WriteInfo(line);
            }
            else
            {
                string line = "[SPY] " + player.Name + " : " + message;
                WriteLog.Info(line);
                MainLog.WriteInfo(line);
                CommandsLog.WriteInfo(line);
            }
            ProcessCommand(player, name, message);
            return(EventEat.EatGame);
        }
Beispiel #9
0
        private async void timer1_Tick(object sender, EventArgs e)
        {
            serialPort1.Open();
            serialPort1.Write("1");
            await Task.Delay(100);

            serialPort2.Open();
            serialPort2.Write("0");
            await Task.Delay(100);

            try
            {
                using (DBEntities2 db = new DBEntities2())
                {
                    MainLog Record = new MainLog();
                    Record.Days        = DateTime.Now.Day.ToString();
                    Record.Month       = DateTime.Now.Month.ToString();
                    Record.Time        = DateTime.Now.ToShortTimeString();
                    Record.Years       = DateTime.Now.Year.ToString();
                    Record.Light       = value1;
                    Record.Temperature = value;
                    Record.Damp        = "NO DATA";
                    db.MainLog.Add(Record);
                    db.SaveChanges();
                    value1 = "";
                    value  = "";
                }
            }
            catch
            {
                MessageBox.Show("ERR. Serial Port NOT FOUND");
                toolStripStatusLabel2.Text = "ERR. Serial Port NOT FOUND";
            }
        }
Beispiel #10
0
        public DGAdmin()
            : base()
        {
            WriteLog.Info("RGAdmin is starting...");
            MainLog.WriteInfo("RGAdmin starting...");

            if (!Directory.Exists(ConfigValues.ConfigPath))
            {
                WriteLog.Info("Creating directory...");
                Directory.CreateDirectory(ConfigValues.ConfigPath);
            }

            #region MODULE LOADING
            MAIN_OnServerStart();
            CFG_OnServerStart();
            UTILS_OnServerStart();
            CMDS_OnServerStart();
            groups_OnServerStart();
            if (ConfigValues.ISNIPE_MODE)
            {
                WriteLog.Debug("Initializing iSnipe mode...");
                SNIPE_OnServerStart();
            }
            WriteLog.Debug("Initializing PersonalPlayerDvars...");
            PersonalPlayerDvars = UTILS_PersonalPlayerDvars_load();
            if (ConfigValues.settings_enable_chat_alias)
            {
                WriteLog.Debug("Initializing Chat aliases...");
                InitChatAlias();
            }
            if (ConfigValues.settings_enable_alive_counter)
            {
                PlayerConnected += hud_alive_players;
            }
            if (ConfigValues.settings_enable_xlrstats)
            {
                WriteLog.Debug("Initializing XLRStats...");
                XLR_OnServerStart();
                XLR_InitCommands();
            }

            if (ConfigValues.settings_servertitle)
            {
                AfterDelay(1000, () => {
                    if (ConfigValues.LockServer)
                    {
                        UTILS_ServerTitle("^1::LOCKED", "^1" + File.ReadAllText(ConfigValues.ConfigPath + @"Utils\internal\LOCKSERVER"));
                    }
                    else
                    {
                        UTILS_ServerTitle_MapFormat();
                    }
                });
            }
            #endregion
        }
Beispiel #11
0
 private void StopSim()
 {
     if (_log != null)
     {
         _log.Stop();
         _log.OnDontChangedDecision -= _log_OnDontChangedDecision;
         _log.OnChangedDecision     -= _log_OnChangedDecision;
         _log = null;
     }
 }
Beispiel #12
0
        /// <summary>
        /// 생성자
        /// </summary>
        public AddListForm(string logPath)
        {
            InitializeComponent();

            // Log Class 생성
            log = new MainLog(logPath);

            // 영상 리스트 동적 할당
            videoList = new List <Video>();
        }
Beispiel #13
0
 public void PurgeAllLogMessages()
 {
     MainLog.PurgeMessages();
     ChatLog.PurgeMessages();
     WhisperLog.PurgeMessages();
     CheatLog.PurgeMessages();
     AdminLog.PurgeMessages();
     ReportLog.PurgeMessages();
     MiscLog.PurgeMessages();
 }
Beispiel #14
0
 void CheckLog()
 {
     if (Info.IsLogEnabled)
     {
         OkwyDefaultLog.DefaultInit();
     }
     else
     {
         MainLog.ResetAppenders();
     }
 }
Beispiel #15
0
    public static void Write(string text, ConsoleColor color = ConsoleColor.White)
    {
        MainLog.Add(text);

        foreach (var log in AlternativeLogs)
        {
            log.Value.WriteLine(text);
        }

        OnLogEvent?.Invoke(text, color);
    }
        public bool InsertRequestLog(MainLogDTO log, MyLogDBEntities logContext)
        {
            MainLog dbLog = new MainLog();

            dbLog.UserID = log.UserID;
            if (log.PackageGuid != null && log.PackageGuid != Guid.Empty)
            {
                dbLog.PackageGuid = log.PackageGuid;
            }
            dbLog.Date         = DateTime.Now.ToShortDateString();
            dbLog.Time         = DateTime.Now.TimeOfDay;
            dbLog.Type         = (Int16)log.Type;
            dbLog.LocationInfo = log.LocationInfo;
            if (log.EnityID != 0)
            {
                dbLog.EntityID = log.EnityID;
            }
            else
            {
                dbLog.EntityID = null;
            }

            foreach (var keyColumn in log.KeyColumns)
            {
                var dbKeycolumn = new MyLogManager.EntityKeyColumns()
                {
                    ColumnID = keyColumn.ColumnID, Value = keyColumn.Value
                };
                dbLog.EntityKeyColumns.Add(dbKeycolumn);
            }
            foreach (var dataColumn in log.DataEntryColumns)
            {
                var dbdataColumn = new DataEntryColumns()
                {
                    ColumnID = dataColumn.ColumnID, Value = dataColumn.Value
                };
                dbLog.DataEntryColumns.Add(dbdataColumn);
            }
            foreach (var parameter in log.RecievedParameters)
            {
                var dbparameter = new RecievedParameters()
                {
                    Name = parameter.Name, Value = parameter.Value
                };
                dbLog.RecievedParameters.Add(dbparameter);
            }

            logContext.MainLog.Add(dbLog);
            //logContext.SaveChanges();
            log.ID = dbLog.ID;
            return(true);
        }
Beispiel #17
0
 bool ExecuteAction(Action <ActionExecutionContext> originalInvokeAction,
                    ActionExecutionContext actionExecutionContext)
 {
     using (
         MainLog.Bench("UIAction",
                       actionExecutionContext.Target.GetType().Name + "." + actionExecutionContext.Method.Name)) {
         // TODO: This can deadlock ...
         // TODO: Don't use caliburn micro action handling, but use RXUI's task based Commands
         return
             (_exceptionHandler.TryExecuteAction(() => AsyncWrap(originalInvokeAction, actionExecutionContext))
              .Result);
     }
 }
Beispiel #18
0
 public static void Log(string text, string trace)
 {
     lock (_lockObject)
     {
         if (_inst == null)
         {
             _inst = new MainLog(_infoLogFileName);
         }
         _inst.Log(text, trace);
         _inst.Close();
         _inst = null;
     }
 }
Beispiel #19
0
        void SetupGlobalServices()
        {
            // TODO: Get rid of this monstrosity.
            // Reason for being here: UserSettings.Current calls into a dialog
            // and global services are just horrible...
            using (MainLog.Bench(null, "SimpleInjector.AfterSetup")) {
                // Tsk
                AfterSetup();
                RegisterToolServices();
                SyncEvilGlobal.Setup(Container.GetInstance <EvilGlobalServices>(), () => 3); // todo
#if DEBUG
                // Creates an instance of every registered type, so better not use unless testing
                //_container.Verify();
#endif
            }
        }
Beispiel #20
0
 public sealed override void OnStartup()
 {
     using (this.Bench()) {
         try {
             SetupContainer();
             SetupExceptionHandling();
             using (MainLog.Bench(null, "WpfAppBootstrapper.PreStart"))
                 PreStart();
             using (MainLog.Bench(null, "WpfAppBootstrapper.OnStartup"))
                 base.OnStartup();
         } catch (Exception ex) {
             LogError(ex, "Startup");
             throw;
         }
     }
 }
Beispiel #21
0
    // Use this for initialization
    void Awake()
    {
        _self          = GetComponent <Actor>();
        taskList       = GetComponent <TaskList>();
        intelligence   = GetComponent <Intelligence>();
        free_locations = new List <Location>();
        sprite         = GetComponent <Sprite>();
        ml             = MainLog.mainLog;
        dossier        = Dossier.dossier;
        transform.name = name;
        inventory      = GetComponent <Inventory>();
//		TurnManager.instance.step += TurnManager_instance_step;

        //remove this (placeholder)

//		free_locations.Add(GameObject.Find("Restaurant").GetComponent<Location>());
    }
Beispiel #22
0
 public static void LogException(Exception ex)
 {
     if (ex != null)
     {
         lock (_exceptionLock)
         {
             string path = Settings.SettingsPath;
             using (System.IO.StreamWriter writer = new System.IO.StreamWriter(path + @"exception.log", true))
             {
                 writer.WriteLine(DateTime.Now.ToString(@"yyyy/MM/dd HH\:mm\:ss.fff") + ": Unhandled Exception: " + ex.Message + Environment.NewLine);
                 writer.WriteLine(ex.ToString());
                 writer.WriteLine("--------" + Environment.NewLine + Environment.NewLine);
                 MainLog.WriteError(ex.Message);
             }
         }
     }
 }
Beispiel #23
0
        /// <summary>
        /// Метод формирования и записи лога, вывод в StatusBar
        /// </summary>
        /// <param name="text">Инициатор лога</param>
        /// <param name="error">Признак того, что это ошибка</param>
        /// <param name="balloon">Отображение лога всплывающим окном</param>
        /// <param name="logMore">Расширенный текст лога</param>
        /// <param name="enableProgressBar">Отображение ProgressBar</param>
        public void Log(string text, bool error = false, bool balloon = false, string logMore = "", bool enableProgressBar = false)
        {
            string message = text;

            if (!string.IsNullOrWhiteSpace(logMore))
            {
                message = message + "\r\n" + logMore;
            }
            if (balloon | error)
            {
                if (error)
                {
                    ShowBalloonError(text, "");
                }
                else
                {
                    ShowBalloon(text, "");
                }
            }
            MainLog.WriteToLog(message, error);
            this.ShowTextOnStatusBar("[" + DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToLongTimeString() + "] " + text, error, enableProgressBar);
        }
        private void BuildMainLogs()
        {
            MainLogs = new ObservableCollection <MainLog>();
            SQLiteConnection conn = new SQLiteConnection(Settings.DBPATH, SQLiteOpenFlags.ReadWrite, false);

            IEnumerable <DailyLog> logs = conn.Table <DailyLog>().Reverse();

            foreach (DailyLog log in logs)
            {
                MainLog mainlog = new MainLog();
                mainlog.DailyLogId  = log.DailyLogID;
                mainlog.LogDateTime = log.LogDateTime;
                BloodPressure bp = GetLastBpReading(log.DailyLogID);
                if (bp != null)
                {
                    mainlog.Bp    = $"{bp.BPSystolic} / {bp.BPDiastolic}";
                    mainlog.Pulse = bp.BPPulseRate.ToString();
                }
                Weight wt = GetLastWeightReading(log.DailyLogID);
                mainlog.WeightAmt = wt.WeightAmount.ToString();
                MainLogs.Add(mainlog);
            }
        }
Beispiel #25
0
        public DGAdmin()
            : base()
        {
            WriteLog.Info("RGAdmin is starting...");
            MainLog.WriteInfo("RGAdmin starting...");

            if (!Directory.Exists(ConfigValues.ConfigPath))
            {
                WriteLog.Info("Creating directory...");
                Directory.CreateDirectory(ConfigValues.ConfigPath);
            }

            #region MODULE LOADING
            MAIN_OnServerStart();
            CFG_OnServerStart();
            UTILS_OnServerStart();
            CMDS_OnServerStart();
            groups_OnServerStart();
            if (ConfigValues.ISNIPE_MODE)
            {
                SNIPE_OnServerStart();
            }
            #endregion
        }
Beispiel #26
0
        private void btnServerLog_Click(object sender, EventArgs e)
        {
            MainLog ml = new MainLog();

            ml.Show();
        }
Beispiel #27
0
        public DGAdmin()
            : base()
        {
            WriteLog.Info("DGAdmin#IS1.5 is starting...");
            MainLog.WriteInfo("DGAdmin#IS1.5 starting...");

            if (!Directory.Exists(ConfigValues.ConfigPath))
            {
                WriteLog.Info("Creating directory...");
                Directory.CreateDirectory(ConfigValues.ConfigPath);
            }

            #region MODULE LOADING
            MAIN_OnServerStart();
            CFG_OnServerStart();
            groups_OnServerStart();

            UTILS_OnServerStart();
            CMDS_OnServerStart();

            SetupKnife();

            WriteLog.Debug("Initializing PersonalPlayerDvars...");
            PersonalPlayerDvars = UTILS_PersonalPlayerDvars_load();

            if (ConfigValues.settings_dynamic_properties)
            {
                Delay(400, () =>
                {
                    CFG_Dynprop_Apply();
                });
            }
            else
            {
                if (ConfigValues.ANTIWEAPONHACK)
                {
                    WriteLog.Info("You have to enable \"settings_dynamic_properties\" if you wish to use antiweaponhack");
                }

                if (ConfigValues.settings_servertitle)
                {
                    WriteLog.Info("You have to enable \"settings_dynamic_properties\" if you wish to use \"Server Title\"");
                }

                if (ConfigValues.ISNIPE_MODE)
                {
                    WriteLog.Debug("Initializing iSnipe mode...");
                    SNIPE_OnServerStart();
                }

                if (ConfigValues.settings_enable_xlrstats)
                {
                    WriteLog.Debug("Initializing XLRStats...");
                    XLR_OnServerStart();
                    XLR_InitCommands();
                }

                if (ConfigValues.settings_enable_alive_counter)
                {
                    PlayerConnected += hud_alive_players;
                }

                if (ConfigValues.settings_enable_chat_alias)
                {
                    WriteLog.Debug("Initializing Chat aliases...");
                    InitChatAlias();
                }

                if (ConfigValues.ISNIPE_MODE && ConfigValues.ISNIPE_SETTINGS.ANTIKNIFE)
                {
                    DisableKnife();
                }
                else
                {
                    EnableKnife();
                }

                GSCFunctions.SetDvarIfUninitialized("unlimited_ammo", "2");

                if (ConfigValues.settings_unlimited_ammo || (UTILS_GetDvar("unlimited_ammo") == "1"))
                {
                    WriteLog.Debug("Initializing Unlimited Ammo...");
                    UTILS_UnlimitedAmmo();
                }

                timed_messages_init();
            }
            #endregion
        }
Beispiel #28
0
        /// <summary>
        /// 생성자
        /// </summary>
        public MainForm()
        {
            InitializeComponent();

            // Log Class 생성
            log = new MainLog(PathList.logPath);

            #region ## 저장 로그 파일 불러오기

            randomFolderList = new List <RandomFolder>();

            #region ### 디렉토리 있는지 확인 - 없으면 생성

            DirectoryInfo directoryInfo = new DirectoryInfo(PathList.mainPath);

            if (directoryInfo.Exists == false)
            {
                directoryInfo.Create();
            }

            directoryInfo = new DirectoryInfo(PathList.logPath);

            if (directoryInfo.Exists == false)
            {
                directoryInfo.Create();
            }

            directoryInfo = new DirectoryInfo(PathList.randomPath);

            if (directoryInfo.Exists == false)
            {
                directoryInfo.Create();
            }

            directoryInfo = new DirectoryInfo(PathList.listPath);

            if (directoryInfo.Exists == false)
            {
                directoryInfo.Create();
                listDictionary = new Dictionary <string, List <Video> >();
            }
            else
            {
                listDictionary = new Dictionary <string, List <Video> >();

                foreach (var file in directoryInfo.GetFiles())
                {
                    using (StreamReader streamReader = new StreamReader(file.FullName))
                    {
                        List <Video> videos = new List <Video>();

                        string listString = string.Empty;
                        while ((listString = streamReader.ReadLine()) != null)
                        {
                            string[] listArray = listString.Split(',');

                            Video video = new Video(Int32.Parse(listArray[0]), listArray[1], listArray[2]);
                            videos.Add(video);
                        }

                        listDictionary.Add(Path.GetFileNameWithoutExtension(file.FullName), videos);
                    }
                }

                UpdateVideoCartListView();
            }

            directoryInfo = new DirectoryInfo(PathList.onePath);

            if (directoryInfo.Exists == false)
            {
                directoryInfo.Create();
            }

            #endregion

            // 해당 경로에 리스트 저장 로그 파일 있는지 확인 (로그 + 랜덤리스트)
            FileInfo fileInfo = new FileInfo(PathList.randomPath + PathList.randomVideoFolderLists);

            if (fileInfo.Exists)
            {
                GetListLogMessage();
            }

            // 해당 경로에서 장바구니 리스트 파일 있는지 확인 -> 있으면 리스트 가져오기
            directoryInfo = new DirectoryInfo(PathList.listPath);



            #endregion
        }
Beispiel #29
0
        protected override async Task RunTestAsync()
        {
            Jenkins.MainLog.WriteLine("Running '{0}' on device (candidates: '{1}')", ProjectFile, string.Join("', '", Candidates.Select((v) => v.Name).ToArray()));

            var uninstall_log = Logs.Create($"uninstall-{Timestamp}.log", "Uninstall log");

            using (var device_resource = await NotifyBlockingWaitAsync(Jenkins.GetDeviceResources(Candidates).AcquireAnyConcurrentAsync())) {
                try {
                    // Set the device we acquired.
                    Device = Candidates.First((d) => d.UDID == device_resource.Resource.Name);
                    if (Device.DevicePlatform == DevicePlatform.watchOS)
                    {
                        CompanionDevice = Jenkins.Devices.FindCompanionDevice(Jenkins.DeviceLoadLog, Device);
                    }
                    Jenkins.MainLog.WriteLine("Acquired device '{0}' for '{1}'", Device.Name, ProjectFile);

                    runner = new AppRunner {
                        Harness             = Harness,
                        ProjectFile         = ProjectFile,
                        Target              = AppRunnerTarget,
                        LogDirectory        = LogDirectory,
                        MainLog             = uninstall_log,
                        DeviceName          = Device.Name,
                        CompanionDeviceName = CompanionDevice?.Name,
                        Configuration       = ProjectConfiguration,
                        TimeoutMultiplier   = TimeoutMultiplier,
                        Variation           = Variation,
                        BuildTask           = BuildTask,
                    };

                    // Sometimes devices can't upgrade (depending on what has changed), so make sure to uninstall any existing apps first.
                    if (Jenkins.UninstallTestApp)
                    {
                        runner.MainLog = uninstall_log;
                        var uninstall_result = await runner.UninstallAsync();

                        if (!uninstall_result.Succeeded)
                        {
                            MainLog.WriteLine($"Pre-run uninstall failed, exit code: {uninstall_result.ExitCode} (this hopefully won't affect the test result)");
                        }
                    }
                    else
                    {
                        uninstall_log.WriteLine($"Pre-run uninstall skipped.");
                    }

                    if (!Failed)
                    {
                        // Install the app
                        this.install_log = new AppInstallMonitorLog(Logs.Create($"install-{Timestamp}.log", "Install log"));
                        try {
                            runner.MainLog = this.install_log;
                            var install_result = await runner.InstallAsync(install_log.CancellationToken);

                            if (!install_result.Succeeded)
                            {
                                FailureMessage  = $"Install failed, exit code: {install_result.ExitCode}.";
                                ExecutionResult = TestExecutingResult.Failed;
                                if (Harness.InCI)
                                {
                                    XmlResultParser.GenerateFailure(Logs, "install", runner.AppName, runner.Variation,
                                                                    $"AppInstallation on {runner.DeviceName}", $"Install failed on {runner.DeviceName}, exit code: {install_result.ExitCode}",
                                                                    install_log.FullPath, Harness.XmlJargon);
                                }
                            }
                        } finally {
                            this.install_log.Dispose();
                            this.install_log = null;
                        }
                    }

                    if (!Failed)
                    {
                        // Run the app
                        runner.MainLog = Logs.Create($"run-{Device.UDID}-{Timestamp}.log", "Run log");
                        await runner.RunAsync();

                        if (!string.IsNullOrEmpty(runner.FailureMessage))
                        {
                            FailureMessage = runner.FailureMessage;
                        }
                        else if (runner.Result != TestExecutingResult.Succeeded)
                        {
                            FailureMessage = GuessFailureReason(runner.MainLog);
                        }

                        if (runner.Result == TestExecutingResult.Succeeded && Platform == TestPlatform.iOS_TodayExtension64)
                        {
                            // For the today extension, the main app is just a single test.
                            // This is because running the today extension will not wake up the device,
                            // nor will it close & reopen the today app (but launching the main app
                            // will do both of these things, preparing the device for launching the today extension).

                            AppRunner todayRunner = new AppRunner {
                                Harness             = Harness,
                                ProjectFile         = TestProject.GetTodayExtension().Path,
                                Target              = AppRunnerTarget,
                                LogDirectory        = LogDirectory,
                                MainLog             = Logs.Create($"extension-run-{Device.UDID}-{Timestamp}.log", "Extension run log"),
                                DeviceName          = Device.Name,
                                CompanionDeviceName = CompanionDevice?.Name,
                                Configuration       = ProjectConfiguration,
                                Variation           = Variation,
                                BuildTask           = BuildTask,
                            };
                            additional_runner = todayRunner;
                            await todayRunner.RunAsync();

                            foreach (var log in todayRunner.Logs.Where((v) => !v.Description.StartsWith("Extension ", StringComparison.Ordinal)))
                            {
                                log.Description = "Extension " + log.Description [0].ToString().ToLower() + log.Description.Substring(1);
                            }
                            ExecutionResult = todayRunner.Result;

                            if (!string.IsNullOrEmpty(todayRunner.FailureMessage))
                            {
                                FailureMessage = todayRunner.FailureMessage;
                            }
                        }
                        else
                        {
                            ExecutionResult = runner.Result;
                        }
                    }
                } finally {
                    // Uninstall again, so that we don't leave junk behind and fill up the device.
                    if (Jenkins.UninstallTestApp)
                    {
                        runner.MainLog = uninstall_log;
                        var uninstall_result = await runner.UninstallAsync();

                        if (!uninstall_result.Succeeded)
                        {
                            MainLog.WriteLine($"Post-run uninstall failed, exit code: {uninstall_result.ExitCode} (this won't affect the test result)");
                        }
                    }
                    else
                    {
                        uninstall_log.WriteLine($"Post-run uninstall skipped.");
                    }

                    // Also clean up after us locally.
                    if (Harness.InCI || Jenkins.CleanSuccessfulTestRuns && Succeeded)
                    {
                        await BuildTask.CleanAsync();
                    }
                }
            }
        }
Beispiel #30
0
 protected AbstractTcpSocket(string loggerName)
 {
     this._logger = MainLog.GetLogger(loggerName);
     this._socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
 }