Ejemplo n.º 1
0
        public DocsPaVO.Caching.InfoFileCaching[] getDocumentiInCache(string aggiornato, string idAmministrazione)
        {
            DocsPaVO.Caching.InfoFileCaching[] Info = null;
            try
            {
                Info = CacheFileManager.GetDocumentiInCache(aggiornato, idAmministrazione);
            }
            catch (Exception e)
            {
                logger.Debug("errore nel web method getDocumentiIncache errore: " + e.Message);
                Info = new DocsPaVO.Caching.InfoFileCaching[0];
            }

            return(Info);
        }
Ejemplo n.º 2
0
        public string ricercaPathComponents(string docNumber, string versionId)
        {
            string path = string.Empty;

            try
            {
                path = CacheFileManager.ricercaPathComponents(docNumber, versionId);
            }
            catch (Exception e)
            {
                logger.Debug("errore nel web method ricercaPathcomponets errore: " + e.Message);
            }

            return(path);
        }
Ejemplo n.º 3
0
        public bool cancellaFileTrasferitoInCache(string pathDestinazione)
        {
            bool retval = false;

            try
            {
                retval = CacheFileManager.cancellaFileTrasferitoInCache(pathDestinazione);
            }
            catch (Exception e)
            {
                logger.Debug("errore nel web method cancellafiletrasferitoincahe errore: " + e.Message);
            }

            return(retval);
        }
Ejemplo n.º 4
0
        public virtual DocsPaVO.Caching.CacheConfig getConfigurazioneCache(string idAmministrazione)
        {
            DocsPaVO.Caching.CacheConfig info = null;

            try{
                info = CacheFileManager.getConfigurazioneCache(idAmministrazione);
            }
            catch (Exception e)
            {
                logger.Debug("errore nel web method getconfigurazionecache errore: " + e.Message);
            }


            return(info);
        }
Ejemplo n.º 5
0
        public bool insertCacheConStream(DocsPaVO.Caching.InfoFileCaching fileInfo, byte[] stream)
        {
            bool retval = false;

            try
            {
                retval = CacheFileManager.insertCacheConStream(fileInfo, stream);
            }
            catch (Exception e)
            {
                logger.Debug("errore nel web method GetDocPathAdvanced errore: " + e.Message);
            }


            return(retval);
        }
Ejemplo n.º 6
0
        public bool insertCache(DocsPaVO.Caching.InfoFileCaching fileInfo)
        {
            bool retval = false;

            try
            {
                retval = CacheFileManager.inserimentoCaching(fileInfo);
            }
            catch (Exception e)
            {
                logger.Debug("errore nel web method insertcache errore: " + e.Message);
            }


            return(retval);
        }
Ejemplo n.º 7
0
        public bool updateCache(DocsPaVO.Caching.InfoFileCaching info)
        {
            bool retval = false;

            try
            {
                retval = CacheFileManager.updateCaching(info);
            }
            catch (Exception e)
            {
                logger.Debug("errore nel web method updatecache errore: " + e.Message);
            }


            return(retval);
        }
Ejemplo n.º 8
0
        public string GetWallpaperImage()
        {
            if (File.Exists(_temporaryWaitForDeleteFiles))
            {
                return(_temporaryWaitForDeleteFiles);
            }

            var fileName = "10." + RegularExpressionHelpers.AlphabetCleaner($"{_player.Track}-{_player.Album}-{_player.Artist}") + ".jpg";

            if (!CacheFileManager.IsFileExists(fileName))
            {
                using var image = this.CalculateBackgroundImage((int)System.Windows.SystemParameters.PrimaryScreenWidth, (int)System.Windows.SystemParameters.PrimaryScreenHeight);
                var bytes = image.ToByteArray(ImageFormat.Jpeg);
                CacheFileManager.SaveCache(fileName, bytes);
            }

            return(CacheFileManager.GetFullCachePath(fileName));
        }
Ejemplo n.º 9
0
        public bool inCache(string docNumber, string versionId, string idAmministrazione)
        {
            bool retval = false;

            try
            {
                DocsPaVO.documento.FileRequest fr = new DocsPaVO.documento.FileRequest();
                fr.versionId = versionId;
                fr.docNumber = docNumber;
                retval       = CacheFileManager.verificaEsistenzaFileInCache(fr, idAmministrazione);
            }
            catch (Exception e)
            {
                logger.Debug("errore nel web method incache errore: " + e.Message);
            }

            return(retval);
        }
Ejemplo n.º 10
0
        public ExceptionConfigurationWindow()
        {
            InitializeComponent();

            using var cacheFs      = CacheFileManager.GetFileCache("exclude.json");
            using var streamReader = new StreamReader(cacheFs);
            var exceptions = JsonConvert.DeserializeObject <List <string> >(streamReader.ReadToEnd());

            var stackPanel = new StackPanel();

            stackPanel.HorizontalAlignment = HorizontalAlignment.Left;
            stackPanel.VerticalAlignment   = VerticalAlignment.Top;

            foreach (var session in GetSessionNames())
            {
                var checkBox = new CheckBox();
                checkBox.Content = session;
                if (exceptions.Contains(session))
                {
                    checkBox.IsChecked = true;
                }
                checkBox.Click += (s, e) =>
                {
                    if (checkBox.IsChecked.Value)
                    {
                        exceptions.Add(session);
                    }
                    else
                    {
                        exceptions.Remove(session);
                    }
                };

                stackPanel.Children.Add(checkBox);
            }

            this.ScrollViewer.Content = stackPanel;
            this.Closing += (s, e) =>
            {
                MessageBox.Show($"Exclude list has been updated, restart the program to take effect.");
                CacheFileManager.SaveCache("exclude.json", JsonConvert.SerializeObject(exceptions));
            };
        }
Ejemplo n.º 11
0
        private async ValueTask <Image> GetImageAsync(string artworkUrl)
        {
            Image image;
            var   lookupKey = artworkUrl.Substring(artworkUrl.LastIndexOf("/") + 1);

            if (CacheFileManager.TryGetFileCache(lookupKey, out var fs))
            {
                using (fs)
                {
                    image = Image.FromStream(fs);
                }
            }
            else
            {
                var imageBytes = await httpClient.GetByteArrayAsync(new Uri(artworkUrl));

                image = (Image)(new ImageConverter()).ConvertFrom(imageBytes);
                CacheFileManager.SaveCache(lookupKey, imageBytes);
            }
            return(image);
        }
Ejemplo n.º 12
0
 private void Settings_Load_1(object sender, EventArgs e)
 {
     this.CacheSize.Text = CacheFileManager.GetCacheSize();
 }
Ejemplo n.º 13
0
 private void ClearCache_Click(object sender, EventArgs e)
 {
     CacheFileManager.ClearCache();
     CacheSize.Text = CacheFileManager.GetCacheSize();
 }