Beispiel #1
0
        void WriteMemUsage(string message)
        {
            long percentage;
            long used = ApplicationMemoryUsage() / 1024;

            if (ApplicationMemoryLimit() != 0)
            {
                percentage = ApplicationMemoryUsage() * 100 / ApplicationMemoryLimit();
            }
            else
            {
                percentage = 0;
            }
            string toWrite = string.Format("{3}: {0} - {1} KB ({2}% of available memory)",
                                           message, used, percentage, DateTime.Now.ToString("HH:mm:ss.ff"));

            Debug.WriteLine(toWrite);
            Logger.Add(toWrite);
        }
Beispiel #2
0
        bool ConvertToErpt(SldWorks swApp, ModelDoc2 swModel, string filePath)
        {
            var result = false;

            try
            {
                ChangesTheVisibilityOfItems(swModel);
                swApp.SetUserPreferenceIntegerValue((int)swUserPreferenceIntegerValue_e.swEdrawingsSaveAsSelectionOption, (int)swEdrawingSaveAsOption_e.swEdrawingSaveAll);
                swApp.SetUserPreferenceToggle(((int)(swUserPreferenceToggle_e.swEDrawingsOkayToMeasure)), true);
                var fileParthEprt = filePath.ToUpper().Replace("SLDPRT", "EPRT");
                swModel.Extension.SaveAs(fileParthEprt, (int)swSaveAsVersion_e.swSaveAsCurrentVersion, (int)swSaveAsOptions_e.swSaveAsOptions_Silent, null, 0, 0);
                result = true;
            }
            catch (Exception ex)
            {
                Logger.Add("ERROR CONVERT TO ERPT + " + ex.Message + "; " + ex.StackTrace);
            }
            return(result);
        }
Beispiel #3
0
        //
        // Build And Run Code
        //
        public static bool BuildAndRun(BuildRunType state, FileInfo currentProblem, long pnum = -1, double timelimit = 3000)
        {
            if (IsRunning)
            {
                return(false);
            }

            IsRunning          = true;
            cancelationPending = false;

            CurrentProblem = currentProblem;
            SelectedPNUM   = pnum;
            RunTimeLimit   = timelimit;

            try
            {
                //type of task to be done
                bool buildonly = (state == BuildRunType.BuildOnly);
                bool runtest   = (state == BuildRunType.RunTest);

                //compile task
                CodeCompiler.StartBuildTask();

                //run builded file
                if (!buildonly)
                {
                    CodeCompiler.StartRunTask(runtest);
                }

                return(true);
            }
            catch (Exception ex)
            {
                Logger.Add(ex.Message, "Codes|BuildAndRun()");
                ReportCompileStatus(ex.Message + "\n", HighlightSyntax.CommentStyle);
                return(false);
            }
            finally
            {
                IsRunning = false;
            }
        }
        /// <summary>
        /// Run the application.
        /// </summary>
        public override BoolMessageItem Execute()
        {
            Console.WriteLine("====================================================");
            Console.WriteLine("LOGGING ");

            // 1. Use default logger which logs to console.
            Logger.Info("The default logger log to the console.");

            // 2. Another way to access the default logger.
            Logger.Default.Info("Accessing default logger using Logger.Default", null, null);

            // 3. Append a new logger to the default logger and log.
            Logger.Default.Append(new LogFile("kishores_log", "kishore.txt"));
            Logger.Info("After appending to default logger. Logs both to console and file.");

            // 4. Log only to the named logger "kishores_log" in the default logger.
            Logger.Default["kishores_log"].Info("Logging only to logger named 'kishores_log' in the default logger.", null, null);

            // 5. Get a new instance of a logger( associated with default logger)
            //    that is specific to this type.
            //    - This logger only exists in the current scope and is not appended to any other logger.
            ILog mylog = Logger.GetNew <Example_Logging>();

            mylog.Info("Logger.GetNew<Example_Logging>() is equivalent to log4net.getlogger(typeof(abc));", null, null);

            // 6. Add a new logger
            // ( This is a completely separate logger from "default" logger.
            Logger.Add(new LogMulti("admin_logger", new LogFile("logger1", "admin.txt")));
            Logger.Get("admin_logger").Info("logging to admin_logger, this is NOT the default logger.", null, null);

            // 7. Force a flush only on the "admin_logger"
            Logger.Get("admin_logger").Flush();

            // 8. Always logs the message regardless of log-level.
            Logger.Message("Logger.Message calls always get logged.");

            // 9. Change the log level to error only on the Default loggers named logger "kishores_log".
            Logger.Default["kishores_log"].Level = LogLevel.Error;
            Logger.Default["kishores_log"].Info("this should not get logged.", null, null);

            return(BoolMessageItem.True);
        }
Beispiel #5
0
        /// <summary>
        /// Add an npc to save list
        /// </summary>
        /// <param name="entity"></param>
        public void SaveNpc(ActorItem entity)
        {
            try
            {
                // create new npc
                Entity npc = new Entity("ENPC", entity);
                savedNpcs.Add(npc);

                // Have we hit out minimum?
                if (savedNpcs.Count == Properties.Settings.Default.MinimumSubmitQuantity)
                {
                    SubmitNpcData();
                    Logger.Add("> Save: NPCs");
                }
            }
            catch (Exception ex)
            {
                Logger.Exception(ex, "Saver -> SaveEnemy");
            }
        }
Beispiel #6
0
        static void Main(string[] args)
        {
            Console.WriteLine("hello scribby");
            rbt = new NxtBrain(@"C:\Microsoft Robotics Studio (1.5)\samples\IPRE\Foundation\IPREFoundationClasses\IPREFoundationClasses\NxtConfig\IPRE.LEGO.NXT.TriBot.config.xml");
            //rbt = new ScribblerBrain(@"C:\Microsoft Robotics Studio (1.5)\samples\IPRE\Foundation\IPREFoundationClasses\IPREFoundationClasses\IPRE.Scribbler.standard.config.xml");
            //rbt = new SRV1Brain(@"C:\Microsoft Robotics Studio (1.5)\samples\IPRE\Surveyor\SRV-1\Srv1Services\Config\IPRE.Surveyor.SRV1.Vehicle.config.xml");
            //rbt = new CreateBrain(@"C:\Microsoft Robotics Studio (1.5)\samples\IPRE\Foundation\IPREFoundationClasses\IPREFoundationClasses\CreateConfig\IPRE.iRobot.DriveBumper.config.xml");

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            robotgui = new Form1(rbt);
            logger   = new Logger(robotgui);
            logger.Add(new LogEntry("SRV ready !!!"));

            Thread th = new Thread(new ThreadStart(work));

            th.Start();

            Application.Run(robotgui);
        }
Beispiel #7
0
        static void Main(string[] args)
        {
            using (var mapleSvc = new MapleService())
            {
                if (Environment.UserInteractive)
                {
                    ConsoleLog.InitConsole($"Rebirth v{Constants.Version}");
                    Logger.Add(new ConsoleLog());

                    //mapleSvc.WvsCenter.InsertAccount(20000,1,"admin","123456");
                    //mapleSvc.WvsCenter.InsertAccount(20001, 1, "hontale", "123456");
                    //mapleSvc.WvsCenter.InsertAccount(20002, 1, "123456", "123456");

                    mapleSvc.Start();
                    Console.ReadLine();
                    mapleSvc.Stop();
                }
                else /*TODO: Window Service Code*/ } {
        }
    }
        private void DoNVRead(string fileName, string nvList)
        {
            BackgroundWorker bw = new BackgroundWorker();

            bw.DoWork += (sender, args) => {
                // do your lengthy stuff here -- this will happen in a separate thread
                cdmaTerm.ReadNvList(nvList, fileName);
            };

            bw.RunWorkerCompleted += (sender, args) => {
                if (args.Error != null)                     // if an exception occurred during DoWork,
                {
                    MessageBox.Show(args.Error.ToString()); // do your error handling here
                }
                // do any UI stuff after the long operation here
                Logger.Add("NV Read - long operation done");
            };

            bw.RunWorkerAsync();     // start the background worker
        }
Beispiel #9
0
        public void ProcessManagerEventProvider_DistributionCompleted(object sender, DistributionResultEventArgs e)
        {
            List <ConnectedClient> faultedClients = new List <ConnectedClient>();
            ConnectedClient        client         = GetClientById(e.ClientId);

            if (client != null)
            {
                try
                {
                    Logger.Add(LogType.Verbose, $"Sending DistributionCompleted event: action = {e.DistributionResult.Type}, {e.DistributionResult.SourceMachineHostName} / {e.DistributionResult.GroupID} / {e.DistributionResult.ApplicationID} / {e.DistributionResult.DestinationMachineHostName}");
                    client.Caller.ServiceEvent_DistributionCompleted(new DTODistributionResult(e.DistributionResult));
                }
                catch (Exception ex)
                {
                    Logger.Add($"Failed to send DistributionCompleted event: action = {e.DistributionResult.Type}, {e.DistributionResult.SourceMachineHostName} / {e.DistributionResult.GroupID} / {e.DistributionResult.ApplicationID} / {e.DistributionResult.DestinationMachineHostName}", ex);
                    faultedClients.Add(client);
                }
            }
            RemoveFaultedClients(faultedClients);
        }
Beispiel #10
0
 public void btnPDFClick(object sender, ItemClickEventArgs e)
 {
     try
     {
         SaveFileDialog sfd = new SaveFileDialog();
         sfd.Title            = string.Format("Kaydedeceğiniz Dosya Adını Yazınız");
         sfd.InitialDirectory = Properties.Settings.Default.ExportInitialDir;
         sfd.Filter           = "PDF Dosyası (*.pdf)|*.pdf";
         if (sfd.ShowDialog() == DialogResult.OK && !string.IsNullOrEmpty(sfd.FileName))
         {
             Properties.Settings.Default.ExportInitialDir = Path.GetDirectoryName(sfd.FileName);
             Properties.Settings.Default.Save();
             items.ExportToPdf(sfd.FileName);
         }
     }
     catch (Exception ex)
     {
         Logger.Add(ex);
     }
 }
        public override bool Save()
        {
            if (checkBoxEnabled.Checked)
            {
                if (!plugin.settings.CacheEnabled || plugin.settings.CacheFolder != textBoxCacheFolder.Text)
                {
                    Logger.Add(2, string.Format("缓存设置更新。“{0}”", textBoxCacheFolder.Text));
                }
            }
            else if (plugin.settings.CacheEnabled)
            {
                Logger.Add(2, string.Format("缓存已关闭。"));
            }

            plugin.settings.CacheEnabled = checkBoxEnabled.Checked;
            plugin.settings.CacheFolder  = textBoxCacheFolder.Text;

            plugin.SaveSettings();
            return(true);
        }
Beispiel #12
0
        public static void AddDevices()
        {
            if (SettingsHelper.SettingsFileExists(GenericDeviceCollection.equipmentSettingsFileName))
            {
                Pumps.ReadAllGadgetsFromFile();
                Lighting.ReadAllGadgetsFromFile();
                Heater.ReadAllGadgetsFromFile();
            }
            else
            {
                Logger.Add("Device settings file did not exist, created new device settings");

                var jo = new JObject();
                jo.Add(new JProperty(Pumps.gadgetSettingsArrayName, new JArray()));
                jo.Add(new JProperty(Lighting.gadgetSettingsArrayName, new JArray()));
                jo.Add(new JProperty(Heater.gadgetSettingsArrayName, new JArray()));

                SettingsHelper.WriteSettingsFile(GenericDeviceCollection.equipmentSettingsFileName, jo);
            }
        }
        private void Draw_pacman(Grid grid, PacmanEssence pers, bool IsFirstTime = false)
        {
            try
            {
                AnimationHelper.Move(pacman.MainImage, pacman.ImgAngle, 0.25);

                MealDestroit(grid, pers.NextPoint);
                Grid.SetRow(pacman.MainImage, pers.NextPoint.X);
                Grid.SetColumn(pacman.MainImage, pers.NextPoint.Y);
                if (IsFirstTime)
                {
                    grid.Children.Add(pacman.MainImage);
                    Logger.Add(new Log(this.GetType().Name, MethodBase.GetCurrentMethod().Name, $"Pacman model was added into field"));
                }
            }
            catch (Exception ex)
            {
                Logger.Add(new Log(this.GetType().Name, MethodBase.GetCurrentMethod().Name, $"Error", ex));
            }
        }
Beispiel #14
0
        private static void __DownloadProblemDatabaseCompleted(DownloadTask task)
        {
            _DownloadingProblemDatabase = false;

            string msg = "Failed to update problem list.";

            if (task.Status == ProgressStatus.Completed)
            {
                LocalDatabase.LoadDatabase();
                msg = "Problem list is successfully updated.";
                Logger.Add("Downloaded problem database file", "Downloader");
            }
            else if (task.Error != null)
            {
                Logger.Add(task.Error.Message, "Downloader");
            }

            Interactivity.SetStatus(msg);
            Interactivity.SetProgress(0);
        }
Beispiel #15
0
        private string GetGameParam()
        {
            string tmpString = $"Map Blocks = {ConfigurationManager.AppSettings["Map_Blocks"]} %\n";

            tmpString += $"Map Size = {ConfigurationManager.AppSettings["Map_Size"]} \n";
            if (bool.Parse(ConfigurationManager.AppSettings["IsAdvancedGhostOptionsEnable"]))
            {
                tmpString += $"ADVANCED GHOST PARAMS \n";
                tmpString += $"Green Ghost count = {ConfigurationManager.AppSettings["GreenGhostCount"]} \n";
                tmpString += $"Green Ghost speed = {ConfigurationManager.AppSettings["GreenGhostSpeed"]} \n";

                tmpString += $"Blue Ghost count = {ConfigurationManager.AppSettings["BlueGhostCount"]} \n";
                tmpString += $"Blue Ghost speed = {ConfigurationManager.AppSettings["BlueGhostSpeed"]} \n";

                tmpString += $"Red Ghost count = {ConfigurationManager.AppSettings["RedGhostCount"]} \n";
                tmpString += $"Red Ghost speed = {ConfigurationManager.AppSettings["RedGhostSpeed"]} ";
            }
            Logger.Add(new Log(this.GetType().Name, MethodBase.GetCurrentMethod().Name, " Info from AppConfig was loaded"));
            return(tmpString);
        }
 private byte[] Sign(byte[] data)
 {
     byte[] buffer;
     try
     {
         using (MemoryStream stream = new MemoryStream(data))
         {
             XmlDocument document = new XmlDocument();
             document.Load(stream);
             Encoding encoding = GetEncoding(document);
             buffer = new XmlSigned().SignXml(data, settings.CspProfile, "", encoding);
         }
     }
     catch (Exception exception2)
     {
         Logger.Add(exception2);
         throw new Exception(exception2.Message, exception2);
     }
     return(buffer);
 }
Beispiel #17
0
        private static void __DownloadCategoryFileCompleted(DownloadTask task)
        {
            string msg = "Failed to downloaded category list.";

            if (task.Status == ProgressStatus.Completed)
            {
                LocalDatabase.LoadCategoryData((string)task.Token);
                Interactivity.CategoryDataUpdated();

                msg = "Downloaded Category file: " + (string)task.Token;
                Logger.Add(msg, "__DownloadCategoryFileCompleted");
            }
            else if (task.Error != null)
            {
                Logger.Add(task.Error.Message, "__DownloadCategoryFileCompleted");
            }

            Interactivity.SetStatus(msg);
            Interactivity.SetProgress(0);
        }
Beispiel #18
0
        /// <summary>
        /// Add an enemy to save list
        /// </summary>
        /// <param name="entity"></param>
        public void SaveEnemy(ActorItem entity)
        {
            try
            {
                // create new monster
                Entity monster = new Entity("BNPC", entity);
                savedEnemies.Add(monster);

                // Have we hit out minimum?
                if (savedEnemies.Count == Properties.Settings.Default.MinimumSubmitQuantity)
                {
                    SubmitEnemyData();
                    Logger.Add("> SAVE: Enemies");
                }
            }
            catch (Exception ex)
            {
                Logger.Exception(ex, "Saver -> SaveEnemy");
            }
        }
Beispiel #19
0
 private void ConvertToDxf(SldWorks swApp, Files.Info item, ModelDoc2 swModel, ref Exception exOut, object[] confArray, bool IsBendsFixed)
 {
     if (!item.ExistDXF)
     {
         // Проходимся по всем конфигурациям для Fix, DXF
         foreach (var confName in confArray)
         {
             // Проверка на Dxf
             if (!item.ExistDXF)
             {
                 Exception exc;
                 if (!Dxf.ExistDxf(item.IdPDM, item.CurrentVersion, confName.ToString(), out exc))                                                       // using export part data
                 {
                     swModel.ShowConfiguration2(confName.ToString());
                     if (!IsBendsFixed)
                     {
                         var list = new List <Bends.SolidWorksFixPattern.PartBendInfo>();
                         Bends.Fix(swApp, out list, false);                                                                                              // using export part data
                     }
                     var listDxf = new List <Dxf.DxfFile>();
                     if (Dxf.Save(swApp, out exOut, item.IdPDM, item.CurrentVersion, out listDxf, false, false, confName.ToString()))                    // using export part data
                     {
                         if (exOut != null)
                         {
                             Logger.Add(exOut.Message + "; " + exOut.StackTrace);
                         }
                         var exOutList = new List <Dxf.ResultList>();
                         Dxf.AddToSql(listDxf, true, out exOutList);
                         if (exOutList != null)
                         {
                             foreach (var itemEx in exOutList)
                             {
                                 Logger.Add($"DXF AddToSql err: {itemEx.dxfFile} Exception {itemEx.exc}");
                             }
                         }
                     }
                 }
             }
         }
     }
 }
Beispiel #20
0
        /// <summary>
        /// Download the image
        /// </summary>
        /// <param name="filename"></param>
        /// <returns></returns>
        public static string DownloadImage(string filename)
        {
            if (!Directory.Exists(AppHelper.getApplicationPath() + "/maps/"))
            {
                Directory.CreateDirectory(AppHelper.getApplicationPath() + "/maps/");
            }

            var saveto = AppHelper.getApplicationPath() + "/maps/" + Path.GetFileName(filename);

            // if file does not exist, download it
            if (!File.Exists(saveto))
            {
                Logger.Add("downloading: " + Path.GetFileName(filename));
                using (WebClient client = new WebClient())
                {
                    client.DownloadFile(filename, saveto);
                }
            }

            return(saveto);
        }
 private PacmanEssence PacmanCatchUp(AbstractGhost ghost)
 {
     try
     {
         if (ghost.FieldPointNow == pacman.Point)
         {
             if (!IsPacmanDie)
             {
                 Logger.Add(new Log(this.GetType().Name, MethodBase.GetCurrentMethod().Name, $"Pacman die at {pacman.Point}"));
                 IsPacmanDie = true;
                 PacmanDie();
             }
         }
         return(pacman);
     }
     catch (Exception ex)
     {
         Logger.Add(new Log(this.GetType().Name, MethodBase.GetCurrentMethod().Name, $"Error", ex));
         return(pacman);
     }
 }
Beispiel #22
0
        /// <summary>
        /// Checks how many % of field are blocks
        /// </summary>
        /// <returns>Real max block count for this field</returns>
        private int CheckBloksCount(int blocks)
        {
            try
            {
                if (blocks > 40)
                {
                    blocks = 40;
                }
                else if (blocks < 10)
                {
                    blocks = 10;
                }

                return(Convert.ToInt32(Math.Floor(_range * _range * (Convert.ToDouble(blocks) / 100.0))));
            }
            catch (Exception ex)
            {
                Logger.Add(new Log(this.GetType().Name, MethodBase.GetCurrentMethod().Name, $"Error", ex));
            }
            return(1);
        }
Beispiel #23
0
 internal void CheckField()
 {
     try
     {
         List <FieldPoint> AvailablePoints = A.TakeAllPointsWhere(0);
         //Just for more random
         AvailablePoints.Shuffle();
         foreach (FieldPoint it in AvailablePoints)
         {
             CheckPoint(it);
         }
         foreach (FieldPoint it in AvailablePoints)
         {
             CheckWays(it);
         }
     }
     catch (Exception ex)
     {
         Logger.Add(new Log(this.GetType().Name, MethodBase.GetCurrentMethod().Name, $"Error", ex));
     }
 }
Beispiel #24
0
        protected override bool ProcessPart(FilePart part)
        {
            if (_sourceStream == null)
            {
                var fileName = _sourceFileNameProvider.GetFileName();
                _sourceStream = new FileStream(fileName, FileMode.Open, FileAccess.Read);
                _partReader.Init(_sourceStream, new FileInfo(fileName).Length);
            }
            try
            {
                _processingStopwatch.Reset();
                _processingStopwatch.Start();

                if (_partReader.ReadPart(part))
                {
                    _processingStopwatch.Stop();

                    part.Index = _currentPartIndex;
                    _currentPartIndex++;
                    Logger.Add($"Поток {Thread.CurrentThread.Name} прочитал часть {part} {part.Source.Length} byte за {_processingStopwatch.ElapsedMilliseconds} ms");

                    NextQueue?.Add(part);

                    // часть последняя - сам поток решает, что ему пора остановиться
                    if (part.IsLast)
                    {
                        SetIsNeedStop();
                    }
                    return(true);
                }
                Logger.Add($"!Поток {Thread.CurrentThread.Name} НЕ удалось прочитать часть {part}");
                throw new Exception($"Не удалось прочитать часть {part}");
            }
            catch (Exception)
            {
                Logger.Add($"Поток {Thread.CurrentThread.Name} - ошибка при чтении");
                Close();
                throw;
            }
        }
Beispiel #25
0
        static void Main()
        {
            bool createdNew;

            using (new Mutex(true, "ProcessManager", out createdNew))
            {
                if (createdNew)
                {
                    Logger.Initialize(Settings.Service.Defaults.APPLICATION_NAME, DefaultSourcedLogEntry.Headers, LogSource.Client, Settings.Service.Defaults.LOG_TYPE_MIN_LEVEL);

                    if (Environment.CommandLine.Contains("-migratesettings"))
                    {
                        RegistryHandler.MigrateSettings();

                        if (Settings.Client.StartWithWindows)
                        {
                            RegistryHandler.SetWindowsStartupTrigger(Application.ExecutablePath);
                        }

                        Logger.Add("Settings migrated");
                    }
                    else
                    {
                        Application.EnableVisualStyles();
                        Application.SetCompatibleTextRenderingDefault(false);
                        Application.Run(new ControlPanelForm());
                    }
                    Logger.Flush();
                }
                else
                {
                    Process currentProcess = Process.GetCurrentProcess();
                    Process process        = Process.GetProcessesByName(currentProcess.ProcessName).FirstOrDefault(x => x.Id != currentProcess.Id);
                    if (process != null)
                    {
                        try { NativeMethods.SetForegroundWindow(process.MainWindowHandle); } catch {; }
                    }
                }
            }
        }
Beispiel #26
0
        public void RunComparer(string user1, string user2)
        {
            try
            {
                //get first user
                string   data1 = System.IO.File.ReadAllText(LocalDirectory.GetUserSubPath(user1));
                UserInfo first = Newtonsoft.Json.JsonConvert.DeserializeObject <UserInfo>(data1);
                first.Process();

                //get second user
                string   data2  = System.IO.File.ReadAllText(LocalDirectory.GetUserSubPath(user2));
                UserInfo second = Newtonsoft.Json.JsonConvert.DeserializeObject <UserInfo>(data2);
                second.Process();

                ShowCompareResult(first, second);
            }
            catch (Exception ex)
            {
                MessageBox.Show("Comparison Failed. May be you did not download submission list of selected user.");
                Logger.Add(ex.Message, "CompareUsers|RunComparer");
            }
        }
Beispiel #27
0
        public void btnDetailsClick(object sender, ItemClickEventArgs e)
        {
            try
            {
                int index = items.FocusedRowHandle;
                if (index != -1)
                {
                    T entity = (T)items.GetRow(index);
                    switch (typeof(T).Name)
                    {
                    case "Customer":
                        //new CustomerDetails<T>(entity).ShowDialog();
                        MessageBox.Show(entity.ToString());
                        break;

                    case "Product":
                        MessageBox.Show(entity.ToString());
                        break;

                    case "Waybill":

                        break;

                    case "Order":

                        break;

                    default:
                        break;
                    }

                    //
                }
            }
            catch (Exception ex)
            {
                Logger.Add(ex);
            }
        }
Beispiel #28
0
        public DTODistributionActionResult TakeDistributionAction(DTODistributionAction distributionAction)
        {
            Logger.Add(LogType.Verbose, $"TakeDistributionAction call received: action = {distributionAction.Type}," +
                       $" {distributionAction.SourceMachineHostName} / {distributionAction.GroupID} / {distributionAction.ApplicationID} / {distributionAction.DestinationMachineHostName}");

            ConnectedClient client = GetClient();

            if (client == null)
            {
                return(null);
            }

            DistributionActionResult distributionActionResult = ProcessManager.Instance.TakeDistributionAction(
                distributionAction.SourceMachineHostName,
                distributionAction.GroupID,
                distributionAction.ApplicationID,
                distributionAction.DestinationMachineHostName,
                distributionAction.Type,
                client.Id);

            return(new DTODistributionActionResult(distributionActionResult));
        }
 private void ExitMethod(bool?closing = false)
 {
     try
     {
         IsPacmanDie = true;
         if (closing != true)
         {
             Logger.Add(new Log(this.GetType().Name, MethodBase.GetCurrentMethod().Name, $"Player exit game"));
             (UI.GetTopLevelControl(MyModel.GridParent) as Window).Close();
         }
         else if (closing == true)
         {
             Logger.Add(new Log(this.GetType().Name, MethodBase.GetCurrentMethod().Name, $"Player close window"));
             MenuView menu = new MenuView();
             menu.Visibility = Visibility.Visible;
         }
     }
     catch (Exception ex)
     {
         Logger.Add(new Log(this.GetType().Name, MethodBase.GetCurrentMethod().Name, $"Error", ex));
     }
 }
        /// <summary>
        /// Prova a configurare il gestore delle operazioni di logging, creando la cartella in cui verrà memorizzato
        /// il nuovo file di log e un nuovo file di testo in cui verrà conservato il log delle operazioni di logging
        /// e restituendo true se non si verificano errori durante la procedura. In caso contrario viene mostrato un
        /// errore esplicativo e restituisce false.
        /// </summary>
        /// <returns>true se non si verificano errori durante la configurazione del logger, altrimenti false</returns>
        static bool ConfigureLogger()
        {
            Settings appConfig = Settings.Instance;
            Logger   appLogger = Logger.Instance;

            string logFileName = string.Format("{0:yyyyMMdd_HHmmss}.log", DateTime.Now);

            try
            {
                FileLogHandler handler = new FileLogHandler(Path.Combine(appConfig.LogsFolder, logFileName));
                handler.LogBufferMaxSize = 10;
                appLogger.Add(handler);

                return(true);
            }
            catch (Exception e)
            {
                Console.WriteLine("Error during configuration of the logger: {0}", e.ToString());
                Console.WriteLine();
                return(false);
            }
        }