Exemple #1
0
        public async Task Check()
        {
            if (StorageFile == null)
            {
                if (string.IsNullOrWhiteSpace(Token))
                {
                    Log.Error("File has no token!");
                }
                else
                {
                    try
                    {
                        StorageFile = await StorageApplicationPermissions.FutureAccessList.GetFileAsync(token : Token);

                        // StorageFile = await Windows.Storage.StorageFile.GetFileFromPathAsync(FullPath);
                    }
                    catch (Exception e)
                    {
                        if (PrintErrors)
                        {
                            Log.Error("Check:StorageFile: ", e);
                        }
                        else
                        {
                            Log.Debug("Check:StorageFile: ", e);
                        }
                    }
                }
            }

            if (string.IsNullOrWhiteSpace(FullPath))
            {
                if (StorageFile != null)
                {
                    FullPath = StorageFile.Path;
                }
                else
                {
                    Log.Error("Bug! Both StorageFile and FullPath are null!");
                }
            }

            IsFullPathSupported = FullPath != null;
            IsValid             = StorageFile != null && Token != null;

            Language = LanguageSupport.FindByExtension(fullPath: FullPath);
            if (Language != null)
            {
                BackgroundColor = Language.Color;
            }
            else
            {
                BackgroundColor = "#ffffffff";
            }
            //Log._Test(BackgroundColor);
        }