Esempio n. 1
0
        //Factory
        public static AccessKeys GetAccessKeys(string bucket)
        {
            var connectionsPath = FileLocationUtilities.GetFileDistributedWithApplication("connections.dll");
            var lines           = RobustFile.ReadAllLines(connectionsPath);

            switch (bucket)
            {
            case BloomS3Client.SandboxBucketName:
                // S3 'uploaderDev' user, who has permission to use the BloomLibraryBooks-Sandbox bucket.
                //parse.com silbloomlibrarysandbox
                return(new AccessKeys(lines[2], lines[3], lines[6], lines[7]));

            case BloomS3Client.UnitTestBucketName:
                return(new AccessKeys(lines[2], lines[3], lines[8], lines[9]));

            case BloomS3Client.ProductionBucketName:
                //S3 'uploader' user, who has permission to use the BloomLibraryBooks bucket
                //parse.com silbloomlibrary
                return(new AccessKeys(lines[0], lines[1], lines[4], lines[5]));

            case BloomS3Client.ProblemBookUploadsBucketName:
                return(new AccessKeys(lines[2], lines[3], null, null));

            case BloomS3Client.BloomDesktopFiles:
                // For now, this is public read, and no one needs to write.
                return(new AccessKeys(null, null, null, null));

            default: throw new ApplicationException("Bucket name not recognized: " + bucket);
            }
        }
Esempio n. 2
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Initializes a new instance of the <see cref="T:PhraseSubstitutionsDlg"/> class.
        /// </summary>
        /// ------------------------------------------------------------------------------------
        public PhraseSubstitutionsDlg(IEnumerable <Substitution> phraseSubstitutions,
                                      IEnumerable <string> previewTestPhrases, int iDefaultTestPhrase)
        {
            InitializeComponent();

            m_regexMatchHelper.CreateControl();
            m_btnMatchSingleWord.Width = m_regexMatchHelper.Width - m_btnMatchSingleWord.Left * 2;
            m_dataGridView.Controls.Remove(m_regexMatchHelper);
            m_regexMatchDropDown.AutoClose = false;
            m_regexMatchDropDown.AutoCloseWhenMouseLeaves = false;
            m_regexReplaceDropDown.AutoClose = false;
            m_regexReplaceDropDown.AutoCloseWhenMouseLeaves = false;
            m_regexMatchDropDown.AddControl(m_regexMatchHelper);
            m_regexReplaceDropDown.AddControl(m_regexReplacementHelper);
            m_sRemoveItem = m_cboMatchGroup.Items[0] as string;
            m_cboMatchGroup.Items.Clear();

            foreach (Substitution substitution in phraseSubstitutions)
            {
                m_dataGridView.Rows.Add(substitution.MatchingPattern, substitution.Replacement,
                                        substitution.IsRegex);
            }

            m_cboPreviewQuestion.Items.AddRange(previewTestPhrases.ToArray());
            if (m_cboPreviewQuestion.Items.Count > 0)
            {
                m_cboPreviewQuestion.SelectedIndex = iDefaultTestPhrase;
            }

            m_txtMatchPrefix.Tag = @"\b{0}";
            m_txtMatchSuffix.Tag = @"{0}\b";

            m_help     = FileLocationUtilities.GetFileDistributedWithApplication(true, "docs", "adjustments.htm");
            HelpButton = !IsNullOrEmpty(m_help);
        }
Esempio n. 3
0
        /// ------------------------------------------------------------------------------------
        private static FwQueries Load(string filename)
        {
            // Find the file that contains the queries.
            var queryFile = FileLocationUtilities.GetFileDistributedWithApplication(App.ConfigFolderName, filename);
            var fwqueries = XmlSerializationHelper.DeserializeFromFile <FwQueries>(queryFile);

            if (fwqueries != null)
            {
                fwqueries.QueryFile = queryFile;
            }
            else if (ShowMsgOnFileLoadFailure)
            {
                string filePath = Utils.PrepFilePathForMsgBox(queryFile);

                var msg = LocalizationManager.GetString("Miscellaneous.Messages.DataSourceReading.LoadingSQLQueriesErrorMsg",
                                                        "The file that contains FieldWorks queries '{0}' is either missing or corrupt. " +
                                                        "Until this problem is corrected, FieldWorks data sources cannot be accessed or " +
                                                        "added as data sources.");

                App.NotifyUserOfProblem(msg, filePath);
                fwqueries = new FwQueries(true);
            }

            return(fwqueries);
        }
Esempio n. 4
0
        private static string GetReferenceTextProjectFileLocation(ReferenceTextType referenceTextType)
        {
            Debug.Assert(IsStandardReferenceText(referenceTextType));
            string projectFileName = referenceTextType.ToString().ToLowerInvariant() + Constants.kProjectFileExtension;

            return(FileLocationUtilities.GetFileDistributedWithApplication(kDistFilesReferenceTextDirectoryName, referenceTextType.ToString(), projectFileName));
        }
        public void VideoHasAudio_correctResult(string fileName, bool result)
        {
            var rvw  = new RecordVideoWindow(null);
            var path = FileLocationUtilities.GetFileDistributedWithApplication(_pathToTestImages, fileName);

            Assert.That(rvw.VideoHasAudio(path), Is.EqualTo(result));
        }
Esempio n. 6
0
        private void m_linkLabelReleaseNotes_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            var path = FileLocationUtilities.GetFileDistributedWithApplication("ReleaseNotes.md");

            using (var dlg = new ShowReleaseNotesDialog(Icon, path))
                dlg.ShowDialog();
        }
Esempio n. 7
0
        /// ------------------------------------------------------------------------------------
        private static AnnotationFileHelper GetOrCreateFile(string eafFile, string mediaFileName)
        {
            if (string.IsNullOrEmpty(eafFile))
            {
                eafFile = ComputeEafFileNameFromOralAnnotationFile(mediaFileName);
            }

            var fileExisted = File.Exists(eafFile);

            if (!fileExisted)
            {
                File.Copy(FileLocationUtilities.GetFileDistributedWithApplication("annotationTemplate.etf"), eafFile, true);
                ChangeMediaFileName(eafFile, mediaFileName);
            }

            var helper = Load(eafFile);

            helper.SetMediaFile(mediaFileName);

            if (!fileExisted)
            {
                helper.GetOrCreateHeader();
                helper.GetOrCreateTranscriptionTierElement();
                helper.GetOrCreateFreeTranslationTierElement();
            }

            helper.Save();
            return(helper);
        }
        /// ------------------------------------------------------------------------------------
        private void LoadToolbarAndContextMenus()
        {
            if (App.DesignMode)
            {
                return;
            }

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

            _tmAdapter = AdapterHelper.CreateTMAdapter();

            if (_tmAdapter != null)
            {
                var defs = new[] { FileLocationUtilities.GetFileDistributedWithApplication(App.ConfigFolderName,
                                                                                           "CVChartsTMDefinition.xml") };

                _tmAdapter.Initialize(this, App.MsgMediator, App.ApplicationRegKeyPath, defs);
                _tmAdapter.AllowUpdates = true;
            }

            // Give the chart Phone search toolbar button a default image.
            var childItemProps  = _tmAdapter.GetItemProperties("tbbChartPhoneSearchAnywhere");
            var parentItemProps = _tmAdapter.GetItemProperties("tbbChartPhoneSearch");

            if (parentItemProps != null && childItemProps != null)
            {
                parentItemProps.Image   = childItemProps.Image;
                parentItemProps.Visible = true;
                parentItemProps.Update  = true;
                _tmAdapter.SetItemProperties("tbbChartPhoneSearch", parentItemProps);
            }
        }
Esempio n. 9
0
        /// ------------------------------------------------------------------------------------
        private void DoConversion(object commandLine)
        {
            var exePath = FileLocationUtilities.GetFileDistributedWithApplication("FFmpeg", "ffmpeg.exe");

            _conversionOutput = new StringBuilder(exePath);
            _conversionOutput.Append(commandLine);

            try
            {
                // ffmpeg always seems to write the output to standarderror.
                // I don't understand why and that's wrong, but we'll deal with it.
                _process = ExternalProcess.StartProcessToMonitor(exePath, commandLine as string,
                                                                 HandleProcessDataReceived, HandleProcessDataReceived, null);
            }
            catch (Exception e)
            {
                ErrorReport.ReportNonFatalException(e);
                return;
            }

            try
            {
                _process.PriorityClass = ProcessPriorityClass.BelowNormal;
            }
            catch (InvalidOperationException)
            {
                // process probably already exited
            }
            _process.WaitForExit();

            if (_conversionReportingAction != null)
            {
                _conversionReportingAction(TimeSpan.FromSeconds(int.MaxValue), null);
            }
        }
Esempio n. 10
0
        public void ShouldChangeFormatToJpeg_OneColor_False()
        {
            var    path     = FileLocationUtilities.GetFileDistributedWithApplication(_pathToTestImages, "bird.png");
            string jpegPath = Path.Combine(Path.GetTempPath(), Path.GetTempFileName() + ".jpg");

            Assert.IsFalse(ImageUtils.TryChangeFormatToJpegIfHelpful(PalasoImage.FromFile(path), jpegPath));
            Assert.IsFalse(File.Exists(jpegPath));
        }
Esempio n. 11
0
        /// ------------------------------------------------------------------------------------
        public static IEnumerable <FFmpegConversionInfo> GetConversions(string fileToConvert)
        {
            var iniFile           = FileLocationUtilities.GetFileDistributedWithApplication("FFmpegConversions.ini");
            var ffmpegConversions = new IniDocument(iniFile);
            var typeToShow        = string.Empty;

            if (FileUtils.AudioFileExtensions.Contains(Path.GetExtension(fileToConvert)))
            {
                typeToShow = "audio";
            }
            else if (FileUtils.VideoFileExtensions.Contains(Path.GetExtension(fileToConvert)))
            {
                typeToShow = "video";
            }

            for (int i = 0; i < ffmpegConversions.Sections.Count; i++)
            {
                var applicableFileType = ffmpegConversions.Sections[i].GetValue("applicableFileType");
                if (applicableFileType != null && applicableFileType.Contains(typeToShow))
                {
                    yield return(new FFmpegConversionInfo
                    {
                        Name = ffmpegConversions.Sections[i].Name,
                        OutputExtension = ffmpegConversions.Sections[i].GetValue("outputFileExtension"),
                        CommandLine = ffmpegConversions.Sections[i].GetValue("commandLine"),
                        Comments = ffmpegConversions.Sections[i].GetValue("comments"),
                        ApplicableFileType = ffmpegConversions.Sections[i].GetValue("applicableFileType")
                    });
                }
            }

            if (typeToShow == "video")
            {
                yield return(new FFmpegConversionInfo
                {
                    Name = ConvertMediaDlg.GetFactoryConvertToH263Mp4ConversionName(),
                    OutputExtension = "mp4",
                    CommandLine = "-vb {vb} -codec:v mpeg4 -ab {ab} -codec:a aac -strict -2",
                    ApplicableFileType = "video"
                });
            }

            yield return(new FFmpegConversionInfo
            {
                Name = ConvertMediaDlg.GetFactoryExtractToStandardPcmConversionName(),
                OutputExtension = "wav",
                CommandLine = "-vn -codec:a {pcm}",
                ApplicableFileType = "audio/video"
            });

            yield return(new FFmpegConversionInfo
            {
                Name = ConvertMediaDlg.GetFactoryExtractToMp3AudioConversionName(),
                OutputExtension = "mp3",
                CommandLine = "-vn -codec:a libmp3lame -ac 1",
                ApplicableFileType = "audio/video"
            });
        }
Esempio n. 12
0
        public override void Execute()
        {
            var path = FileLocationUtilities.GetFileDistributedWithApplication("ReleaseNotes.md");

            using (var dlg = new ShowReleaseNotesDialog(System.Windows.Forms.Application.OpenForms.Count > 0 ? System.Windows.Forms.Application.OpenForms[0].Icon : null, path))
            {
                dlg.ShowDialog();
            }
        }
Esempio n. 13
0
        private void OnAboutLinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            string path = FileLocationUtilities.GetFileDistributedWithApplication(true, "about.htm");

            using (var dlg = new SIL.Windows.Forms.Miscellaneous.SILAboutBox(path))
            {
                dlg.ShowDialog();
            }
        }
Esempio n. 14
0
        /// ------------------------------------------------------------------------------------
        public static void ShowHelpTopic(string topicLink)
        {
            var path = FileLocationUtilities.GetFileDistributedWithApplication("SayMore.chm");

            Help.ShowHelp(new Label(), path, topicLink);

            Analytics.Track("Show Help Topic", new Dictionary <string, string> {
                { "topicLink", topicLink }
            });
        }
Esempio n. 15
0
        public static ScrStylesheet GetUsfmScrStylesheet()
        {
            if (s_usfmStyleSheet != null)
            {
                return(s_usfmStyleSheet);
            }
            string usfmStylesheetPath = FileLocationUtilities.GetFileDistributedWithApplication("sfm", "usfm.sty");

            return(s_usfmStyleSheet = new ScrStylesheet(usfmStylesheetPath));
        }
Esempio n. 16
0
 private static string GetPathToBundledFFmpeg()
 {
     try
     {
         return(FileLocationUtilities.GetFileDistributedWithApplication("ffmpeg", "ffmpeg.exe"));
     }
     catch (Exception)
     {
         return(string.Empty);
     }
 }
Esempio n. 17
0
        public void DrawResizedImage_TestForDashedBorder_SmallSquareImage(bool addBorder)
        {
            var path             = FileLocationUtilities.GetFileDistributedWithApplication(_pathToTestImages, "Othello 199.jpg");
            var image            = new Bitmap(path);
            var desiredThumbSize = new Size(200, 200);

            // SUT
            var result = ImageUtils.ResizeImageIfNecessary(desiredThumbSize, image, addBorder);

            // Testing
            TestImageResult(result, addBorder);
        }
Esempio n. 18
0
        private static string GetLamePath()
        {
            if (s_pathToLame != null)
            {
                return(s_pathToLame);
            }
#if __MonoCS__
            return(s_pathToLame = "/usr/bin/lame");
#else
            return(s_pathToLame = FileLocationUtilities.GetFileDistributedWithApplication("lame.exe"));
#endif
        }
Esempio n. 19
0
        /// ------------------------------------------------------------------------------------
        private static void Load()
        {
            s_loadAttempted = true;

            try
            {
                var filename = FileLocationUtilities.GetFileDistributedWithApplication(App.ConfigFolderName,
                                                                                       "NormalizationExceptions.xml");

                s_exceptionsList = XmlSerializationHelper.DeserializeFromFile <List <NormalizationException> >(filename);
            }
            catch { }
        }
Esempio n. 20
0
        public void ExportInDesignXml(string path)
        {
            var pathToXnDesignXslt = FileLocationUtilities.GetFileDistributedWithApplication("xslts", "BloomXhtmlToDataForMergingIntoInDesign.xsl");

#if DEBUG
            _bookSelection.CurrentSelection.OurHtmlDom.RawDom.Save(path.Replace(".xml", ".xhtml"));
#endif

            var dom = _bookSelection.CurrentSelection.OurHtmlDom.ApplyXSLT(pathToXnDesignXslt);

            using (var writer = XmlWriter.Create(path, CanonicalXmlSettings.CreateXmlWriterSettings()))
            {
                dom.Save(writer);
            }
        }
Esempio n. 21
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Verifies that the templates list has been loaded.
        /// </summary>
        /// ------------------------------------------------------------------------------------
        private static void VerifyListLoaded()
        {
            if (s_list == null)
            {
                string path = FileLocationUtilities.GetFileDistributedWithApplication("FieldTemplatesTemplates.xml");

                // TODO: Do something when there's an exception returned.
                Exception e;
                s_list = XmlSerializationHelper.DeserializeFromFile <FieldTemplateList>(path, out e);

                if (e != null)
                {
                    ErrorReport.ReportNonFatalException(e);
                }
            }
        }
Esempio n. 22
0
        /// ------------------------------------------------------------------------------------
        private void HandleHelpClick(object sender, EventArgs e)
        {
            //nb: when the file is in our source code, and not in the program directory, windows security will squawk and then not show content.
            var path = FileLocationUtilities.GetFileDistributedWithApplication(false, "SayMore.chm");

            try
            {
                Process.Start(path);
            }
            catch (Exception ex)
            {
                //user cancelling a security warning here shouldn't lead to a crash
                Debug.Print(ex.Message);
            }
            Analytics.Track("Show Help from main menu");
        }
Esempio n. 23
0
        public static void Show(Control parent, string helpFileName, string topic)
        {
            // See the comments above related to BL-5993.
            var libpath = Environment.GetEnvironmentVariable("LD_LIBRARY_PATH");

            if (!String.IsNullOrEmpty(libpath))
            {
                Environment.SetEnvironmentVariable("LD_LIBRARY_PATH", null);
            }

            ShowHelpWithTopic(parent, FileLocationUtilities.GetFileDistributedWithApplication(helpFileName), topic);

            if (!String.IsNullOrEmpty(libpath))
            {
                Environment.SetEnvironmentVariable("LD_LIBRARY_PATH", libpath);
            }
        }
Esempio n. 24
0
        public ILocalizationManager CreateLocalizationManager()
        {
            var installedStringFileFolder      = Path.GetDirectoryName(FileLocationUtilities.GetFileDistributedWithApplication("SayMore.es.tmx"));
            var relativePathForWritingTmxFiles = Path.Combine(Program.kCompanyAbbrev, Application.ProductName);

            LocalizationManager.DeleteOldTranslationFiles(kSayMoreLocalizationId,
                                                          Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData), relativePathForWritingTmxFiles),
                                                          installedStringFileFolder);

            var localizationManager = LocalizationManager.Create(TranslationMemory.Tmx, Settings.Default.UserInterfaceLanguage, kSayMoreLocalizationId,
                                                                 "SayMore", Application.ProductVersion, installedStringFileFolder, relativePathForWritingTmxFiles,
                                                                 Resources.SayMore, "*****@*****.**", "SayMore", "SIL.Archiving", "SIL.Windows.Forms.FileSystem");

            Settings.Default.UserInterfaceLanguage = LocalizationManager.UILanguageId;

            return(localizationManager);
        }
Esempio n. 25
0
        [TestCase(true, true)]         // Center image, add dashed border
        public void DrawResizedImage_TestForPresenceOfDashedBorder(bool centerImage, bool addBorder)
        {
            var path             = FileLocationUtilities.GetFileDistributedWithApplication(_pathToTestImages, "bird.png");
            var image            = new Bitmap(path);
            var desiredThumbSize = new Size(70, 70);

            // SUT
            // I don't like conditionals in tests.
            // Unfortunately "DrawResizedImage()" is a private method that is very simply wrapped by two
            // public methods.
            var result = centerImage ?
                         ImageUtils.CenterImageIfNecessary(desiredThumbSize, image, addBorder) :
                         ImageUtils.ResizeImageIfNecessary(desiredThumbSize, image, addBorder);

            // Test image result
            TestImageResult(result, addBorder);
        }
Esempio n. 26
0
        public void ShouldChangeFormatToJpeg_Photo_True()
        {
            var    path     = FileLocationUtilities.GetFileDistributedWithApplication(_pathToTestImages, "man.png");
            string jpegPath = Path.Combine(Path.GetTempPath(), Path.GetTempFileName() + ".jpg");

            try
            {
                Assert.IsTrue(ImageUtils.TryChangeFormatToJpegIfHelpful(PalasoImage.FromFile(path), jpegPath));
                Assert.IsTrue(File.Exists(jpegPath));
            }
            finally
            {
                if (File.Exists(jpegPath))
                {
                    File.Delete(jpegPath);
                }
            }
        }
Esempio n. 27
0
        /// <summary>
        /// This can be used to find the best localized file when there is only one file with the given name,
        /// and the file is part of the files distributed with Bloom (i.e., not something in a downloaded template).
        /// </summary>
        public static string GetBestLocalizableFileDistributedWithApplication(bool existenceOfEnglishVersionIsOptional, params string[] partsOfEnglishFilePath)
        {
            // at this time, FileLocator does not have a way for the app to actually tell it where to find things distributed
            // with the application...
            var englishPath = FileLocationUtilities.GetFileDistributedWithApplication(true, partsOfEnglishFilePath);

            // ... so if it doesn't find it, we have to keep looking
            if (string.IsNullOrWhiteSpace(englishPath))
            {
                //this one will throw if we still can't find it and existenceOfEnglishVersionIsOptional is false
                englishPath = BloomFileLocator.GetBrowserFile(existenceOfEnglishVersionIsOptional, partsOfEnglishFilePath);
            }

            if (!RobustFile.Exists(englishPath))
            {
                return(englishPath);                // just return whatever the original GetFileDistributedWithApplication gave. "", null, whatever it is.
            }
            return(BloomFileLocator.GetBestLocalizedFile(englishPath));
        }
Esempio n. 28
0
        private string GetArguments(string tempFile, string inputFile = null)
        {
            var bldr = new StringBuilder();

            // CompatibilityLevel=1.4 - Acrobat 5.0
            // CompatibilityLevel=1.5 - Acrobat 6.0
            // CompatibilityLevel=1.6 - Acrobat 7.0
            // CompatibilityLevel=1.7 - Acrobat 8.0/9.0 (~2008)
            bldr.Append("-sDEVICE=pdfwrite -dBATCH -dNOPAUSE -dCompatibilityLevel=1.7");                // REVIEW: is this the right compatibility level?
            switch (_type)
            {
            case OutputType.DesktopPrinting:
                // See http://issues.bloomlibrary.org/youtrack/issue/BL-3721 for the need for this operation.
                // See also https://stackoverflow.com/questions/9497120/how-to-downsample-images-within-pdf-file and
                // https://superuser.com/questions/435410/where-are-ghostscript-options-switches-documented.  We are trying
                // for "press quality" (or better), but leaving the color as RGB.
                bldr.Append(" -dColorImageResolution=600");
                bldr.Append(" -dGrayImageResolution=600");
                bldr.Append(" -dMonoImageResolution=1200");
                break;

            case OutputType.Printshop:
                // This reduces images to 300dpi, converting the color to CMYK.
                bldr.Append(" -dPDFSETTINGS=/prepress");
                bldr.Append(" -sColorConversionStrategy=CMYK");
                bldr.Append(" -dOverrideICC=true");
                var rgbProfile  = FileLocationUtilities.GetFileDistributedWithApplication("ColorProfiles/RGB/AdobeRGB1998.icc");
                var cmykProfile = FileLocationUtilities.GetFileDistributedWithApplication("ColorProfiles/CMYK/USWebCoatedSWOP.icc");
                bldr.AppendFormat(" -sDefaultRGBProfile=\"{0}\"", rgbProfile);
                bldr.AppendFormat(" -sDefaultCMYKProfile=\"{0}\"", cmykProfile);
                bldr.AppendFormat(" -sOutputICCProfile=\"{0}\"", cmykProfile);
                break;
            }
            bldr.Append(" -dDownsampleColorImages=true -dColorImageDownsampleThreshold=1.0");
            bldr.Append(" -dDownsampleGrayImages=true -dGrayImageDownsampleThreshold=1.0");
            bldr.Append(" -dDownsampleMonoImages=true -dMonoImageDownsampleThreshold=1.0");
            if (String.IsNullOrEmpty(inputFile))
            {
                inputFile = _inputPdfPath;
            }
            bldr.AppendFormat($" -sOutputFile=\"{tempFile}\" \"{DoubleBracesInInputPath(inputFile)}\"");
            return(bldr.ToString());
        }
Esempio n. 29
0
        /// ------------------------------------------------------------------------------------
        internal static void Load()
        {
            if (s_dbAccessInfo == null)
            {
                // Find the file that contains information about connecting to an FW database.
                s_accessInfoFile = FileLocationUtilities.GetFileDistributedWithApplication(App.ConfigFolderName, "FwDBAccessInfo.xml");
                s_dbAccessInfo   = XmlSerializationHelper.DeserializeFromFile <FwDBAccessInfo>(s_accessInfoFile);
            }

            if (s_dbAccessInfo == null && ShowMsgOnFileLoadFailure)
            {
                ErrorReport.NotifyUserOfProblem(LocalizationManager.GetString(
                                                    "Miscellaneous.Messages.DataSourceReading.LoadingDBAccessInfoErorMsg",
                                                    "The file that contains information to access FieldWork databases " +
                                                    "older than version 7.x '{0}' is either missing or corrupt. Until " +
                                                    "this problem is corrected, FieldWorks data sources cannot be " +
                                                    "accessed or added as data sources."), s_accessInfoFile);
            }
        }
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Initializes a new instance of the <see cref="T:RenderingSelectionRulesDlg"/> class.
        /// </summary>
        /// ------------------------------------------------------------------------------------
        public RenderingSelectionRulesDlg(IEnumerable <RenderingSelectionRule> rules,
                                          Action <bool> selectKeyboard)
        {
            m_selectKeyboard = selectKeyboard;
            InitializeComponent();

            toolStrip1.Renderer = new NoToolStripBorderRenderer();

            if (rules != null && rules.Any())
            {
                foreach (RenderingSelectionRule rule in rules)
                {
                    m_listRules.Items.Add(rule, !rule.Disabled);
                }
                m_listRules.SelectedIndex = 0;
            }
            btnEdit.Enabled = btnCopy.Enabled = btnDelete.Enabled = (m_listRules.SelectedIndex >= 0);

            m_help     = FileLocationUtilities.GetFileDistributedWithApplication(true, "docs", "renderingselectionrules.htm");
            HelpButton = !IsNullOrEmpty(m_help);
        }