Пример #1
0
        public IEnumerable <Categorie> FavoriteRepostCategories([FromBody] RepostCategoriesRequest request)
        {
            var logger = new MyLogger();

            logger.Log($"repost start ({request.UserName})");

            var vkProvider = new VKProvider(appId, login, password, logger);

            var result = Main.GetUserFavoriteCategories(vkProvider, _context, request);

            logger.Log($"repost finish ({request.UserName})");
            return(result);
        }
Пример #2
0
        public string SearchLoadFromTopNav()
        {
            string actualresult      = null;
            string searchType        = testData.Data("SearchType");
            string searchVal         = testData.Data(searchType);
            By     byLoadSearchInput = By.CssSelector("#load-search-input");

            try
            {
                ClearAndEdit(byLoadSearchInput, searchVal);
                MyLogger.Log("Entered value " + searchVal + " in load search input");
                Edit(byLoadSearchInput, Keys.Enter);
                Assert.IsTrue(_LoadDetailPage.OptionBtn.WaitUntilDisplayed());
                if (_LoadDetailPage.OptionBtn.IsDisplayed())
                {
                    actualresult = "SearchLoadSuccess";
                }
                else
                {
                    actualresult = "SeacrhLoadFailed";
                }
                return(actualresult);
            }
            catch
            {
                return("SearchLoadFailed");
            }
        }
Пример #3
0
        public async Task <IActionResult> Details(int?id)
        {
            {
                if (id == null)
                {
                    MyLogger.Log(messaggio: $"ERRORE: Richiesta GET: nessun id fornito", controller: "ReportController", metodo: "Details");
                    return(NotFound());
                }

                var report = await _context.Report
                             .Include(x => x.Progetto)
                             .ThenInclude(ll => ll.ModuliProgetto)
                             .ThenInclude(mm => mm.Modulo)
                             .Include(x => x.Percorsi)
                             .AsNoTracking()
                             .SingleOrDefaultAsync(r => r.ID == id);

                if (report == null)
                {
                    MyLogger.Log(messaggio: $"ERRORE: Richiesta GET con id {id} fallita: nessun report con questo id", controller: "ReportController", metodo: "Details");
                    return(NotFound());
                }
                ViewData["Lista"] = report.Percorsi.ToList();
                MyLogger.Log(messaggio: $"Richiesta GET con id {id}", controller: "ReportController", metodo: "Details");
                return(View(report));
            }
        }
Пример #4
0
        // POST: Report/EliminaSelezionati
        public async Task <IActionResult> EliminaSelezionati(string[] check)
        {
            if (check == null || check.Count() == 0)
            {
                MyLogger.Log(messaggio: $"ERRORE: Richiesta POST: richiesta malformata", controller: "ReportController", metodo: "EliminaSelezionati");
                return(NotFound());
            }
            List <Report> lista = new List <Report>();

            for (int i = 0; i < check.Length; i++)
            {
                var report = await _context.Report
                             .Include(list => list.Percorsi)
                             .AsNoTracking()
                             .SingleOrDefaultAsync(m => m.ID == int.Parse(check[i]));

                if (report == null)
                {
                    MyLogger.Log(messaggio: $"ERRORE: Richiesta POST: nessun report con id {check[i]}", controller: "ReportController", metodo: "EliminaSelezionati");
                    return(NotFound());
                }
                lista.Add(report);
            }
            MyLogger.Log(messaggio: $"Richiesta POST", controller: "ReportController", metodo: "EliminaSelezionati");
            string concatenated = string.Join(",",
                                              check.Select(x => x.ToString()).ToArray());

            MyLogger.Log(messaggio: $"\tReport selezionati: {concatenated}");
            return(View(lista));
        }
Пример #5
0
 public IActionResult Error()
 {
     MyLogger.Log(messaggio: "ERRORE: " + Activity.Current?.Id ?? HttpContext.TraceIdentifier, controller: "ReportController", metodo: "Error");
     return(View(new ErrorViewModel {
         RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier
     }));
 }
Пример #6
0
        internal bool WaitUtilDisappear(UIItem UI)
        {
            int second = 1;

            for (; second <= this.iGlobalWait; second++)
            {
                try
                {
                    if (!driver.FindElement(UI.By).Displayed)
                    {
                        if (second > 1)
                        {
                            MyLogger.Log("[ " + UI.Name + " ] is not displayed, after [" + second + "] secs");
                        }
                        return(true);
                    }
                }
                catch (NoSuchElementException)
                {
                    if (second > 1)
                    {
                        MyLogger.Log("[ " + UI.Name + " ] is not displayed, after [" + second + "] secs");
                    }
                    return(true);
                }
                Thread.Sleep(1000);
            }
            MyLogger.Log("Waited for [ " + second + " ] secs, but [ " + UI.Name + " ] is still displayed.");
            return(false);
        }
Пример #7
0
 internal List <int> GetElementIndex(UIItem ui, string searchstring)
 {
     try
     {
         List <int>          index    = null;
         IList <IWebElement> elements = driver.FindElements(ui.By);
         for (int iloop = 0; iloop < elements.Count; iloop++)
         {
             if (Regex.IsMatch(elements[iloop].Text, searchstring))
             {
                 index.Add(iloop);
                 MyLogger.Log("<<" + ui.Name + ">> is displayed on <<" + iloop + ">> the data set");
             }
         }
         if (index.Count == 0)
         {
             MyLogger.Log("Given string is not found on the rows.");
         }
         return(index);
     }
     catch (Exception ex)
     {
         MyLogger.Log(ex.Message);
         return(null);
     }
 }
Пример #8
0
        public async Task Load()
        {
            IsLoading.Value = true;
            try
            {
                await DbBackup.Execute();
            }
            catch (Exception ex)
            {
                MyLogger.Log("Exception occured on DB backup.", ex);
            }
            MyLogger.Log("Data loading...");
            DbContext = new AppDbContext();
            var cacheLoading = PortNumberCache.Load();
            var dbLoading    = Task.Run(async() =>
            {
                await SSHConnectionInfo.RefreshAll(DbContext);
                SSHConnectionInfo.All
                .ForEach(x => App.Current.Dispatcher.Invoke(() => SSHConnectionInfos.Items.Add(x)));
                DbContext.RDPConnectionInfos.ToList()
                .ForEach(x => App.Current.Dispatcher.Invoke(() => RDPConnectionInfos.Items.Add(x)));
                DbContext.InitSecurePasswords();
            });
            await Task.WhenAll(new[]
            {
                cacheLoading,
                dbLoading,
            });

            MyLogger.Log("Data loaded.");
            IsLoading.Value = false;
            InitConnectionInvokeTimer();
        }
Пример #9
0
 //Login into claw
 public string Login()
 {
     try
     {
         driver.Url = baseURL;
         WaitUtilDisplayed(byUserName);
         Assert.IsTrue(WaitUtilDisplayed(byUserName));
         Clear(byUserName);
         Edit(byUserName, UserName);
         MyLogger.Log("User name entered := [" + UserName + "]");
         Clear(byPwd);
         Edit(byPwd, PassWord);
         MyLogger.Log("Password entered :=  []");
         Click(bySubmit);
         MyLogger.Log("Clicked on the [Sign in] button");
         Assert.IsTrue(WaitUtilDisplayed(byHeaderLogo));
         MyLogger.Log("Home page displayed");
         return("LoginSuccess");
     }
     catch
     {
         MyLogger.Log("Login Failed");
         return("LOGINFAILED");
     }
 }
Пример #10
0
        private bool SaveStops()
        {
            IWebElement invalidError = null;

            try
            {
                if (_StopsTab.LoadstopConfirmCheckbox.IsDisplayed())
                {
                    Assert.IsTrue(_StopsTab.LoadstopConfirmCheckbox.Click());
                }
                Assert.IsTrue(_StopsTab.Stop_UpdateSave.WaitUtilEnabled());
                Assert.IsTrue(_StopsTab.Stop_UpdateSave.Click());
                try
                {
                    Thread.Sleep(Constants.Wait_Short);
                    invalidError = driver.FindElement(By.CssSelector(".tooltipster-base.tooltipster-error"));
                    if (invalidError.Text == "Invalid")
                    {
                        MyLogger.Log("Error message is shown for invalid departure time");
                        return(false);
                    }
                }
                catch
                {
                    //No error occured
                }
                _StopsTab.Stop_UpdateSave.WaitUtilDisappear();
                Assert.IsTrue(_StopsTab.Stop_UpdateCancel.WaitUtilDisappear());
                return(true);
            }
            catch
            {
                return(false);
            }
        }
Пример #11
0
        public static string DecodeFromImage(Texture2D image)
        {
            MyLogger.Log(LOG_TAG, "DecodeFromImage() ");

            try
            {
                Color32LuminanceSource src = new Color32LuminanceSource(image.GetPixels32(), image.width, image.height);

                Binarizer    bin = new GlobalHistogramBinarizer(src);
                BinaryBitmap bmp = new BinaryBitmap(bin);

                MultiFormatReader mfr    = new MultiFormatReader();
                Result            result = mfr.decode(bmp);

                if (result != null)
                {
                    return(result.Text);
                }
                else
                {
                    MyLogger.LogError(LOG_TAG, "DecodeFromImage()", "Decode failed!");
                }
            }
            catch (Exception e)
            {
                MyLogger.LogError(LOG_TAG, "DecodeFromImage() ", e.Message);
            }

            return("");
        }
        private void CheckAeroMods()
        {
            try
            {
                this.hasCheckedAeroMods = true;

                foreach (var loadedAssembly in AssemblyLoader.loadedAssemblies)
                {
                    switch (loadedAssembly.name)
                    {
                    case "FerramAerospaceResearch":
                        this.farTerminalVelocity = loadedAssembly.assembly.GetType("ferram4.FARAPI").GetMethod("GetActiveControlSys_TermVel");
                        FarInstalled             = true;
                        MyLogger.Log("FAR detected!");
                        break;

                    case "NEAR":
                        NearInstalled = true;
                        MyLogger.Log("NEAR detected! Turning off atmospheric details!");
                        break;
                    }
                }
            }
            catch (Exception ex)
            {
                MyLogger.Exception(ex, "AtmosphericProcessor->CheckAeroMods");
            }
        }
Пример #13
0
    public static void SavePathData(string pdName, Texture2D texture)
    {
        MyLogger.Log(pdName + " SavePathData begin!!!");
        int width  = texture.width;
        int height = texture.height;
        int size   = sizeof(int) + sizeof(int) + sizeof(byte) * width * height;

        ByteArray.StartWrite(size);
        ByteArray.WriteInt(width);
        ByteArray.WriteInt(height);
        int x, y;

        for (x = 0; x < width; x++)
        {
            for (y = 0; y < height; y++)
            {
                byte pixel = (byte)(texture.GetPixel(x, y) == Color.white ? 0 : 1);
                ByteArray.WriteByte(pixel);
            }
        }
        byte[] bytes  = ByteArray.EndWrite();
        string pdPath = GetRealPath(pdName) + s_ExternName;

        FileTools.WriteFile(pdPath, bytes);
        MyLogger.Log(pdPath + " SavePathData ok!!!");
    }
Пример #14
0
        internal string DownloadPOD()
        {
            try
            {
                NavigateToDocuments();
                WebClient myWebClient         = new WebClient();
                string    myStringWebResource = GetUrlOfDownloadable();
                string    filename            = "clawtesting.pdf";

                //Console.WriteLine("Successfully Downloaded File \"{0}\" from \"{1}\"", fileName, myStringWebResource);
                try
                {
                    MyLogger.Log(string.Format("Downloading File \"{0}\" from \"{1}\" .......\n\n", filename, myStringWebResource));
                    myWebClient.DownloadFile(myStringWebResource, @"C:\temp\" + filename);
                    MyLogger.Log("\nDownloaded file saved in the following file system folder:\n\t" + @"C:\temp\" + filename);
                }
                catch (Exception ex)
                {
                    Console.WriteLine("Execption " + ex.Message);
                }
                return("DownloadSuccess");
            }
            catch
            {
                return("DownloadFailed");
            }
        }
Пример #15
0
 private string TakeScreenshot(String strFileName)
 {
     try
     {
         if (TestStartInfo.Driver == null)
         {
             return("ExecutionNotStarted");
         }
         DateTime time   = DateTime.Now;
         string   format = "yyyy_MM_dd_HHMM";
         try
         {
             Screenshot ss = ((ITakesScreenshot)TestStartInfo.Driver).GetScreenshot();
             string     strScreenshotpath = strFileName + "_" + time.ToString(format) + ".png";
             ss.SaveAsFile(strScreenshotpath, System.Drawing.Imaging.ImageFormat.Png);
             return(strScreenshotpath);
         }
         catch
         {
             var    screenshot = ((ITakesScreenshot)TestStartInfo.Driver).GetScreenshot();
             byte[] imageBytes = Convert.FromBase64String(screenshot.ToString());
             using (BinaryWriter bw = new BinaryWriter(new FileStream(strFileName, FileMode.Append, FileAccess.Write)))
             {
                 bw.Write(imageBytes);
                 bw.Close();
             }
             return("");
         }
     }
     catch (Exception ex)
     {
         MyLogger.Log(ex.Message);
         return("");
     }
 }
Пример #16
0
        //------------------------------------------------------------
        public void EnterFrame()
        {
            if (!isRunning)
            {
                return;
            }

            m_Socket.Update();


            if (m_WaitForReconnect)
            {
                if (NetCheck.IsAvailable())
                {
                    Reconnect();
                }
                else
                {
                    MyLogger.Log(LOG_TAG_MAIN, "EnterFrame() wait for reconnection,but network is not available!");
                }
            }

            if (m_WaitForSendAuth)
            {
                VerifyAuth();
            }
        }
Пример #17
0
        // GET: Modulo/Create
        public IActionResult Create()
        {
            var model = TempData.Peek <EditModuloVM>("Model");

            if (model != null)
            {
                TempData.Remove("Model");
                var anchor = TempData.Peek <string>("Anchor");
                TempData.Remove("Anchor");
                ViewData["Anchor"] = anchor;
                if (anchor == "Server")
                {
                    ViewData["TestS"] = TempData.Peek <string>("TestS");
                    TempData.Remove("TestS");
                }
                else if (anchor == "Openvas")
                {
                    ViewData["TestO"] = TempData.Peek <string>("TestO");
                    TempData.Remove("TestO");
                }
                MyLogger.Log(messaggio: $"Richiesta GET in seguito a Test", controller: "ModuloController", metodo: "Create");
                return(View(model));
            }
            else
            {
                MyLogger.Log(messaggio: $"Richiesta GET", controller: "ModuloController", metodo: "Create");
            }
            return(View(new EditModuloVM()));
        }
Пример #18
0
 private string Filter_Ignore()
 {
     try
     {
         Assert.IsTrue(NavAndOpenAdvnFilter());
         if (_Data.SearchBy == "Within 30 days" || _Data.SearchBy == "31 - 60 days" || _Data.SearchBy == "61 - 90 days" || _Data.SearchBy == "Beyond 90 days")
         {
             SelectInvoiceStatus();
             Assert.IsTrue(_AccoutingPage.Within30Days.WaitUntilDisplayed());
             Assert.IsTrue(_AccoutingPage.Within30Days.Click());
             MyLogger.Log("Selected option [" + _Data.InvoiceStatus + "]");
         }
         else
         {
             Assert.IsTrue(_AccoutingPage.DateRange.SelectByText(_Data.SearchBy));
             SelectInvoiceStatus();
             Assert.IsTrue(_AccoutingPage.FromDate.WaitUntilDisplayed());
             Assert.IsTrue(_AccoutingPage.FromDate.ClearAndEdit(_Data.FromDate));
             MyLogger.Log("From date [" + _Data.FromDate + "]");
             Assert.IsTrue(_AccoutingPage.ToDate.WaitUntilDisplayed());
             Assert.IsTrue(_AccoutingPage.ToDate.ClearAndEdit(_Data.ToDate));
             MyLogger.Log("To date [" + _Data.ToDate + "]");
             Assert.IsTrue(_AccoutingPage.AdvSearchBtn.WaitUntilDisplayed());
             Assert.IsTrue(_AccoutingPage.AdvSearchBtn.Click());
         }
         _AccoutingPage.SearchTableHeader.WaitUntilDisplayed();
         return("FilterSuccess");
     }
     catch
     {
         return("FilteringFailed");
     }
 }
Пример #19
0
        internal int GetOneElementIndex(UIItem ui, string searchString)
        {
            try
            {
                List <int> index = GetElementIndex(ui, searchString);

                if (index.Count == 1)
                {
                    MyLogger.Log("<<" + ui.Name + ">> element found on this page");
                    return(index[0]);
                }
                if (index.Count == 0)
                {
                    //return element not found.
                    MyLogger.Log("<<" + ui.Name + ">> element not found on this page");
                    return(-1);
                }
                if (index.Count > 1)
                {
                    //more than one elements are found.
                    MyLogger.Log("<<" + ui.Name + ">> more than one elements are found.");
                    return(-1);
                }
                return(index[0]);
            }
            catch (Exception ex)
            {
                MyLogger.Log(ex.Message);
                return(-1);
            }
        }
Пример #20
0
        private void OnEditorPlayModeChanged()
        {
            if (Application.isPlaying == false)
            {
                MyLogger.Log("OnEditorPlayModeChanged()");
                UnityEditor.EditorApplication.playmodeStateChanged -= OnEditorPlayModeChanged;

                try
                {
                    a.Dispose();
                }
                catch (Exception e)
                {
                    MyLogger.LogError(LOG_TAG, "OnEditorPlayModeChanged() ", e.Message);
                }

                try
                {
                    b.Dispose();
                }
                catch (Exception e)
                {
                    MyLogger.LogError(LOG_TAG, "OnEditorPlayModeChanged()", e.Message);
                }
            }
        }
Пример #21
0
        internal void SelectByValue(UIItem UI, string strAction)
        {
            try
            {
                switch (strAction.ToUpper())
                {
                case "!IGNORE!":
                    MyLogger.Log("Ignoring WebElement < " + UI.Name + ">");
                    break;

                case "!DEFAULT!":
                    Assert.IsTrue(driver.FindElement(UI.By).Displayed);
                    MyLogger.Log("Chekcing < " + UI.Name + ">");
                    break;

                default:
                    new SelectElement(driver.FindElement(UI.By)).SelectByValue(strAction);
                    MyLogger.Log(UI.Name + " := [ " + strAction + " ]");
                    break;
                }
            }
            catch
            {
                MyLogger.Log("Exception occured on  <" + UI.Name + ">");
                onceFailed = false;
            }
        }
Пример #22
0
    public static bool Save(string path, byte[] bytes)
    {
        if (bytes == null)
        {
            if (File.Exists(path))
            {
                File.Delete(path);
            }
            return(true);
        }

#if (UNITY_STANDALONE_WIN || UNITY_EDITOR)
        path = path.Replace("/", "\\");
#endif

        if (!IsExistFile(path))
        {
            FileTools.CreateFile(path, bytes);
            return(true);
        }
        FileStream file = null;
        try
        {
            file = File.Create(path);
        }
        catch (System.Exception ex)
        {
            MyLogger.Log(ex.Message);
            return(false);
        }

        file.Write(bytes, 0, bytes.Length);
        file.Close();
        return(true);
    }
Пример #23
0
        /// <summary>
        ///     Saves the settings when this object is destroyed.
        /// </summary>
        protected void OnDestroy()
        {
            MyLogger.Log("BuildAdvanced->OnDestroy");

            try
            {
                SettingHandler handler = new SettingHandler();
                handler.Set("visible", visible);
                handler.Set("windowPositionX", position.x);
                handler.Set("windowPositionY", position.y);
                handler.Set("compactMode", compactMode);
                handler.Set("compactCollapseRight", compactCollapseRight);
                handler.Set("showAllStages", showAllStages);
                handler.Set("showAtmosphericDetails", showAtmosphericDetails);
                handler.Set("showSettings", showSettings);
                handler.Set("selectedBodyName", CelestialBodies.SelectedBody.Name);
                handler.Save("BuildAdvanced.xml");
                GuiDisplaySize.OnSizeChanged -= OnSizeChanged;
            }
            catch (Exception ex)
            {
                MyLogger.Exception(ex, "BuildAdvanced.OnDestroy()");
            }

            EditorLock(false);
        }
Пример #24
0
 public bool CopyCol(string p)
 {
     string[] datarefrence = p.Split(';');
     if (datarefrence.Count() == 3)
     {
         try
         {
             _testdata = _tables[datarefrence[0] + "$"];
             string   column        = datarefrence[1];
             string[] rows          = datarefrence[2].Split('-');
             int      fromRowNumber = int.Parse(rows[0]);
             int      toRowNumber   = int.Parse(rows[1]);
             DataRow  fromRow       = _testdata.Rows[fromRowNumber - 1];
             DataRow  toRow         = _testdata.Rows[toRowNumber - 1];
             toRow[column] = fromRow[column];
             return(true);
         }
         catch
         {
             MyLogger.Log("Incorrect format. Use 'SheetName;ColumnName;FromRow;ToRow' ");
             return(false);
         }
     }
     else
     {
         MyLogger.Log("Incorrect format. Use 'SheetName;ColumnName;FromRow;ToRow' ");
         return(false);
     }
 }
Пример #25
0
        protected virtual async Task Connect(T item)
        {
            MyLogger.Log($"Connecting to {item.ToString()}...");
            ConnectionViewModel <T> conn = null;

            try
            {
                conn = ConnectionViewModel <T> .CreateFromConnectionInfo(item);

                MainWindow.Connections.Collection.Add(conn);
                await conn.Connect();
            }
            catch (Exception ex)
            {
                if (conn != null)
                {
                    MainWindow.Connections.Collection.Remove(conn);
                }
                switch (ex)
                {
                case OperationCanceledException oce:     // User canceled manually
                    MyLogger.Log($"Canceled to connect to {item.ToString()}.");
                    return;
                }
                MyLogger.Log($"Failed to connect to {item.ToString()}.", ex);
                await MainWindow.ShowMessageDialog(
                    string.Format(Resources.ConnectionInfo_Dialog_Connect_Error, item.ToString(), ex.Message),
                    Resources.ConnectionInfo_Dialog_Connect_Title);
            }
        }
Пример #26
0
        public async Task <IActionResult> Create(Progetto progetto, string progettoDaCopiare)
        {
            if (ModelState.IsValid)
            {
                _context.Add(progetto);
                await _context.SaveChangesAsync();

                if (!string.IsNullOrEmpty(progettoDaCopiare) && !progettoDaCopiare.Equals("0"))
                {
                    List <ModuliProgetto> listaCopiata = await _context.ModuliProgetto.Where(m => m.ProgettoID == int.Parse(progettoDaCopiare)).ToListAsync();

                    int prgNuovo = progetto.ID;
                    foreach (var el in listaCopiata)
                    {
                        _context.ModuliProgetto.Add(new ModuliProgetto {
                            ProgettoID = prgNuovo, ModuloID = el.ModuloID, Target = el.Target
                        });
                    }
                    await _context.SaveChangesAsync();
                }
                MyLogger.Log(messaggio: $"Richiesta POST:\n\tNuovo progetto con nome {progetto.Nome}", controller: "ProgettoController", metodo: "Create");
                return(RedirectToAction(nameof(Edit), new { id = progetto.ID }));
            }
            MyLogger.Log(messaggio: $"ERRORE: Richiesta POST: Richiesta malformata", controller: "ProgettoController", metodo: "Create");
            return(View(progetto));
        }
Пример #27
0
        protected virtual async Task <bool> Remove(T item)
        {
            var result = await MainWindow.ShowConfirmationDialog(
                string.Format(Resources.ConnectionInfo_Dialog_Remove_Message, item.ToString()),
                Resources.ConnectionInfo_Dialog_Remove_Title);

            if (!result)
            {
                return(false);
            }
            try
            {
                MyLogger.Log($"Removing {item}...");
                var currentItem = MainWindow.DbContext.Set <T>().FirstOrDefault(x => x.Id == item.Id);
                if (currentItem != null)
                {
                    MainWindow.DbContext.Set <T>().Remove(currentItem);
                    await MainWindow.DbContext.SaveChangesAsync();
                }
                return(true);
            }
            catch (Exception ex)
            {
                MyLogger.Log($"Failed to remove {item}.", ex);
                await MainWindow.ShowMessageDialog(
                    string.Format(Resources.ConnectionInfo_Dialog_Remove_Error, item.ToString(), ex.Message),
                    Resources.ConnectionInfo_Dialog_Remove_Title);

                return(false);
            }
        }
Пример #28
0
        /// <summary>
        ///     Force the destruction of child objects on core destruction.
        /// </summary>
        private void OnDestroy()
        {
            try
            {
                SectionLibrary.Save();

                foreach (var window in this.SectionWindows)
                {
                    print("[FlightEngineer]: Destroying Floating Window for " + window.ParentSection.Name);
                    Destroy(window);
                }

                foreach (var editor in this.SectionEditors)
                {
                    print("[FlightEngineer]: Destroying Editor Window for " + editor.ParentSection.Name);
                    Destroy(editor);
                }

                MyLogger.Log("FlightEngineerCore->OnDestroy");
            }
            catch (Exception ex)
            {
                MyLogger.Exception(ex);
            }
        }
Пример #29
0
        public void Close()
        {
            MyLogger.Log(LOG_TAG_MAIN, "Close()");

            isRunning = false;

            if (mGame != null)
            {
                mGame.Dispose();
                mGame = null;
            }

            if (mRoom != null)
            {
                mRoom.Dispose();
                mRoom    = null;
                mRoomRPC = null;
            }

            if (mGameSocket != null)
            {
                mGameSocket.Dispose();
                mGameSocket = null;
            }

            if (mThreadMain != null)
            {
                mThreadMain.Interrupt();
                mThreadMain = null;
            }

            DelAllSession();
        }
Пример #30
0
    /// <summary>
    /// Remove all instances held by this pool
    /// </summary>
    public void Clear()
    {
        if (DebugLog && Prefab)
        {
            MyLogger.Log("SmartPool (" + PoolName + "): Clearing all instances of " + Prefab.name);
        }
        mSpawned.ForEach(go =>
        {
            Destroy(go);
        });
        mSpawned.Clear();

        var e = mStock.GetEnumerator();

        while (e.MoveNext())
        {
            Destroy(e.Current);
        }
        mStock.Clear();

        e = mPreStock.GetEnumerator();
        while (e.MoveNext())
        {
            Destroy(e.Current);
        }
        mPreStock.Clear();
        mDealyDespawn.ForEach(go =>
        {
            Destroy(go._obj);
        });
        mDealyDespawn.Clear();
        Prefab = null;
        Resources.UnloadUnusedAssets();
    }
Пример #31
0
 public void ContentGetByRoot()
 {
     using (var _c = new ApplicationDbContext())
     {
         SettingUp();
         var _Logger = new MyLogger();
         _c.Database.Log = s => _Logger.Log("EFApp", s);
         TreeComplete(new ContentBLL().GetByRoot(_SiteID, null, D0.ContentPropertyAlias, _Cultures[0].Name, _c));
         Assert.IsTrue(_Logger.NumberSQLQuery == 2);
         var _Model = new ContentBLL().GetByRoot(_SiteID, null, "una-cosa-loca-que-no-existe", _Cultures[0].Name, _c);
         Assert.IsTrue(_Model == null);
     }
     
 }