Ejemplo n.º 1
0
        private bool EditMatrixMapping(string name, LipSyncMapData newMapping)
        {
            bool retVal   = false;
            bool doRemove = true;

            LipSyncMapMatrixEditor editor = new LipSyncMapMatrixEditor(newMapping);

            editor.LibraryMappingName = name;

            if (editor.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                if ((name.Equals(editor.LibraryMappingName) == false) &&
                    (this.Contains(editor.LibraryMappingName) == true))
                {
                    DialogResult dr =
                        MessageBox.Show("Overwrite existing " +
                                        editor.LibraryMappingName + " mapping?",
                                        "Map exists",
                                        MessageBoxButtons.YesNo);

                    doRemove = (dr == DialogResult.Yes) ? true : false;
                }

                if (doRemove == true)
                {
                    RemoveMapping(name);
                }

                AddMapping(!doRemove, editor.LibraryMappingName, editor.MapData, true);
                retVal = true;
            }

            return(retVal);
        }
Ejemplo n.º 2
0
        private bool EditMatrixMapping(string name, LipSyncMapData newMapping)
        {
            bool retVal   = false;
            bool doRemove = true;

            LipSyncMapMatrixEditor editor = new LipSyncMapMatrixEditor(newMapping);

            if (editor.ShowDialog() == DialogResult.OK)
            {
                if ((name.Equals(editor.LibraryMappingName) == false) &&
                    (this.Contains(editor.LibraryMappingName) == true))
                {
                    //messageBox Arguments are (Text, Title, No Button Visible, Cancel Button Visible)
                    MessageBoxForm.msgIcon = SystemIcons.Question;                     //this is used if you want to add a system icon to the message form.
                    var messageBox = new MessageBoxForm("Overwrite existing " +
                                                        editor.LibraryMappingName + " mapping?",
                                                        "Map exists", true, false);
                    messageBox.ShowDialog();

                    doRemove = (messageBox.DialogResult == DialogResult.OK) ? true : false;
                }

                if (doRemove == true)
                {
                    RemoveMapping(name);
                }

                AddMapping(!doRemove, editor.LibraryMappingName, editor.MapData, true);
                retVal = true;
            }

            return(retVal);
        }
Ejemplo n.º 3
0
        public bool RemoveMapping(string name, bool removeFileData = false)
        {
            bool           retVal      = false;
            bool           doRemove    = true;
            LipSyncMapData origMapping = GetMapping(name);

            if (origMapping != null)
            {
                Library[name].IsCurrentLibraryMapping = false;
                if (IsDefaultMapping(name) == true)
                {
                    _defaultMap = null;
                }

                if (removeFileData && origMapping.IsMatrix)
                {
                    LipSyncMapMatrixEditor editor = new LipSyncMapMatrixEditor(origMapping);
                    doRemove = editor.RemoveMappingFiles();
                }

                if (doRemove)
                {
                    retVal = Library.Remove(name);
                }
            }
            return(retVal);
        }
Ejemplo n.º 4
0
        public string CloneLibraryMapping(string name, string newName = null)
        {
            bool   success    = false;
            string newTmpName = (newName == null) ? name : newName;

            LipSyncMapData origMapping = GetMapping(name);

            if (origMapping != null)
            {
                LipSyncMapData newMapping = new LipSyncMapData(origMapping);
                newName = AddMapping(true, newTmpName, newMapping, newMapping.IsMatrix);

                if (newName != "")
                {
                    if (newMapping.IsMatrix)
                    {
                        LipSyncMapMatrixEditor editor = new LipSyncMapMatrixEditor(origMapping);
                        success = editor.CloneMappingFiles(newName);
                    }
                }
            }
            return((success) ? newName : "");
        }