private static string generateWorksheetName(
            PreparedInformation preparedInformation,
            FileGroup fileGroup,
            Project project)
        {
            // http://social.msdn.microsoft.com/Forums/en-US/vsto/thread/84c0c4d2-52b9-4502-bece-fdc616db05f8

            const int maxLength = 31;

            var ni =
                (preparedInformation.UseCrypticExcelExportSheetNames
                    ? fileGroup.UniqueID.ToString()
                    : fileGroup.GetNameIntelligent(project))
                .Replace('\\', '#')
                .Replace('/', '#')
                .Replace('?', '_')
                .Replace('*', '_')
                .Replace('[', '_')
                .Replace(']', '_')
                .Replace(':', '_');
            //var cs = fileGroup.Checksum.ToString();

            //var s1 = string.Format( @" ({0})", cs );
            //var len = maxLength - s1.Length;

            var ni2 = FileGroup.ShortenFilePath(ni, maxLength);

            return(ni2);
        }
        private void MergeFileGroupForm_Load(object sender, EventArgs e)
        {
            WinFormsPersistanceHelper.RestoreState(this);
            CenterToParent();

            fileGroupToMergeIntoTextBox.Text = _fileGroup.GetNameIntelligent(_project);
        }
 private void updateFileGroupInTree(
     TreeListNode fileGroupNode,
     FileGroup fileGroup)
 {
     fileGroupNode[0]         = fileGroup.GetNameIntelligent(_project);
     fileGroupNode.ImageIndex = fileGroupNode.SelectImageIndex = getImageIndex(@"group");
     fileGroupNode.Tag        = fileGroup;
 }
        public override void FillItemToControls()
        {
            base.FillItemToControls();

            fileGroupTextBox.Text =
                _fileGroup.GetNameIntelligent(
                    MainForm.Current.ProjectFilesControl.Project ?? Project.Empty);

            prefixTextBox.Text = FileGroup.DefaultTranslatedPrefix;

            // --

            var storage =
                (MainForm.Current.ProjectFilesControl.Project ?? Project.Empty).DynamicSettingsGlobalHierarchical;

            referenceLanguageComboBox.SelectedIndex =
                Math.Min(
                    ConvertHelper.ToInt32(
                        PersistanceHelper.RestoreValue(
                            storage,
                            @"CreateNewFileForm.referenceLanguageComboBox.SelectedIndex",
                            referenceLanguageComboBox.SelectedIndex)),
                    referenceLanguageComboBox.Properties.Items.Count - 1);

            newLanguageComboBox.SelectedIndex =
                Math.Min(
                    ConvertHelper.ToInt32(
                        PersistanceHelper.RestoreValue(
                            storage,
                            @"CreateNewFileForm.newLanguageComboBox.SelectedIndex",
                            newLanguageComboBox.SelectedIndex)),
                    newLanguageComboBox.Properties.Items.Count - 1);

            copyTextsCheckBox.Checked =
                ConvertHelper.ToBoolean(
                    PersistanceHelper.RestoreValue(
                        storage,
                        @"CreateNewFileForm.copyTextsCheckBox.Checked",
                        copyTextsCheckBox.Checked));

            automaticallyTranslateCheckBox.Checked =
                ConvertHelper.ToBoolean(
                    PersistanceHelper.RestoreValue(
                        storage,
                        @"CreateNewFileForm.automaticallyTranslateCheckBox.Checked",
                        automaticallyTranslateCheckBox.Checked));

            prefixTextBox.Text =
                ConvertHelper.ToString(
                    PersistanceHelper.RestoreValue(
                        storage,
                        @"CreateNewFileForm.prefixTextBox.Text",
                        prefixTextBox.Text));

            prefixCheckBox.Checked =
                ConvertHelper.ToBoolean(
                    PersistanceHelper.RestoreValue(
                        storage,
                        @"CreateNewFileForm.prefixCheckBox.Checked",
                        prefixCheckBox.Checked));

            // --
            // Select defaults.

            if (referenceLanguageComboBox.SelectedIndex < 0 &&
                referenceLanguageComboBox.Properties.Items.Count > 0)
            {
                referenceLanguageComboBox.SelectedIndex = 0;
            }
        }
		/// <summary>
		/// Updates the file group in tree.
		/// </summary>
		/// <param name="fileGroupNode">The file group node.</param>
		/// <param name="fileGroup">The file group.</param>
		private void updateFileGroupInTree(
			TreeListNode fileGroupNode,
			FileGroup fileGroup)
		{
			fileGroupNode[0] = fileGroup.GetNameIntelligent(Project);
			fileGroupNode.ImageIndex = fileGroupNode.SelectImageIndex = getImageIndex(@"group");
			fileGroupNode.Tag = fileGroup;
			fileGroupNode.StateImageIndex = (int)FileGroupStateColor.Grey; //(int)fileGroup.TranslationStateColor;

			updateNodeStateImage(fileGroupNode, AsynchronousMode.Asynchronous);

			UpdateUI();
		}