Пример #1
0
        public void UpdateInlineString(InlineStringEditor editor)
        {
            if (editor.InlineString.Id == editor.NewInlineStringAlias && editor.InlineString.Strings.SequenceEqual(editor.NewInlineStringStrings))
            {
                EditorUtility.DisplayDialog("Inline string update error.", "Inline string must be changed, before save.", "OK");

                return;
            }

            string oldAlias = editor.InlineString.Id;

            string[] oldStrings = editor.InlineString.Strings;

            editor.InlineString.Id      = editor.NewInlineStringAlias;
            editor.InlineString.Strings = editor.NewInlineStringStrings;

            if (!this._inlineStringValidator.Validate(editor.InlineString, out string error))
            {
                EditorUtility.DisplayDialog("Inline string update error.", error, "OK");

                editor.InlineString.Id      = oldAlias;
                editor.InlineString.Strings = oldStrings;

                return;
            }

            this._inlineStringsRepository.UpdateInlineString(editor.InlineString);
        }
Пример #2
0
        public void AddPluralForm(InlineStringEditor editor)
        {
            string[] strings = editor.NewInlineStringStrings;

            editor.NewInlineStringStrings = new string[strings.Length + 1];
            Array.Copy(strings, editor.NewInlineStringStrings, strings.Length);
        }
Пример #3
0
        public void DeleteInlineString(InlineStringEditor editor)
        {
            if (!EditorUtility.DisplayDialog("Delete Inline string",
                                             $"Delete Inline string with Alias: '{editor.InlineString.Id}'?", "OK", "Cancel"))
            {
                return;
            }

            this._inlineStringsRepository.RemoveInlineString(editor.InlineString);
            this._inlineStringsWindow.InlineStringsListView.RemoveInlineString(editor.InlineString);
        }
Пример #4
0
        public void RemovePluralForm(InlineStringEditor editor)
        {
            string[] strings = editor.NewInlineStringStrings;

            if (strings.Length == 1)
            {
                return;
            }

            editor.NewInlineStringStrings = new string[strings.Length - 1];
            Array.Copy(strings, editor.NewInlineStringStrings, editor.NewInlineStringStrings.Length);
        }
Пример #5
0
        public void AddInlineString(InlineString inlineString, InlineStringsPresenter inlineStringsPresenter)
        {
            InlineStringEditor freeEditor = this._inlineStringEditorsPool.FirstOrDefault(e => e.InlineString == null);

            if (freeEditor == null)
            {
                this._inlineStringEditorsPool.Add(new InlineStringEditor(inlineString, inlineStringsPresenter));
            }
            else
            {
                freeEditor.InlineString = inlineString;
            }
        }
Пример #6
0
        public void RemoveInlineString(StoredString inlineString)
        {
            InlineStringEditor editor = this._inlineStringEditorsPool.First(e => e.InlineString.Equals(inlineString));

            editor.InlineString = null;
        }