Ejemplo n.º 1
0
            internal void XmlSerialize(XmlWriter xw)
            {
                string def = $"{DisplayType} {InternalName}";

                if (ParamUtil.IsBitType(DisplayType) && BitSize != -1)
                {
                    def += $":{BitSize}";
                }
                else if (ParamUtil.IsArrayType(DisplayType))
                {
                    def += $"[{ArrayLength}]";
                }

                if (Default != 0)
                {
                    def += $" = {Default.ToString("R", CultureInfo.InvariantCulture)}";
                }

                xw.WriteAttributeString("Def", def);
                xw.WriteDefaultElement(nameof(DisplayName), DisplayName, InternalName);
                xw.WriteDefaultElement("Enum", InternalType, DisplayType.ToString());
                xw.WriteDefaultElement(nameof(Description), Description, null);
                xw.WriteDefaultElement(nameof(DisplayFormat), DisplayFormat, ParamUtil.GetDefaultFormat(DisplayType));
                xw.WriteDefaultElement(nameof(EditFlags), EditFlags.ToString(), ParamUtil.GetDefaultEditFlags(DisplayType).ToString());
                xw.WriteDefaultElement(nameof(Minimum), Minimum, ParamUtil.GetDefaultMinimum(DisplayType), "R", CultureInfo.InvariantCulture);
                xw.WriteDefaultElement(nameof(Maximum), Maximum, ParamUtil.GetDefaultMaximum(DisplayType), "R", CultureInfo.InvariantCulture);
                xw.WriteDefaultElement(nameof(Increment), Increment, ParamUtil.GetDefaultIncrement(DisplayType), "R", CultureInfo.InvariantCulture);
                xw.WriteDefaultElement(nameof(SortID), SortID, 0);
            }
Ejemplo n.º 2
0
        //----------------------------------------------------------------
        #region ** EditOptions

        void _chkEditOption_CheckedChanged(object sender, EventArgs e)
        {
            CheckBox  cb   = sender as CheckBox;
            EditFlags flag = (EditFlags)Enum.Parse(typeof(EditFlags), cb.Text);

            _flexEditOptions.EditOptions = cb.Checked
                ? _flexEditOptions.EditOptions | flag
                : _flexEditOptions.EditOptions & ~flag;
        }
Ejemplo n.º 3
0
        /// <summary>
        ///     Sets a value that determines numerous shell options for extension as well as limitations on how extension
        ///     properties can be edited by programs that honor <see cref="EditFlags" />
        /// </summary>
        /// <param name="flags"><see cref="EditFlags" /> for program file type.</param>
        protected void SetEditFlags(EditFlags flags)
        {
            if (!Exists)
            {
                throw new Exception("Extension does not exist");
            }

            //registryWrapper.Write(info.progId, "EditFlags", (uint)flags);
            _registryWrapper.Write(ProgId, "EditFlags", flags);

            ShellNotification.NotifyOfChange();
        }
Ejemplo n.º 4
0
        private static void AssociateMainData(string ProgID, string Description, EditFlags flags, IconIndex IconIndex)
        {
            ProgramAssociationInfo a = new ProgramAssociationInfo(ProgID);

            if (!a.Exists)
            {
                a.Create();
            }
            Registry.LocalMachine.OpenSubKey("SOFTWARE", true).OpenSubKey("Classes", true).OpenSubKey(ProgID, true).CreateSubKey("DefaultIcon", RegistryKeyPermissionCheck.ReadWriteSubTree).SetValue("", PathToIcons + ',' + (int)IconIndex);
            a.Description = Description;
            a.EditFlags   = flags;
        }
Ejemplo n.º 5
0
        //Update values related to program id that have changed
        private void updateProgIdButton_Click(object sender, EventArgs e)
        {
            string extension          = (string)extensionsListBox.SelectedItem;
            ProgramAssociationInfo pa = new ProgramAssociationInfo(programIdTextBox.Text);

            int[] tmpArray;

            if (pa.Exists)
            {
                if ((string)descriptionTextBox.Tag != descriptionTextBox.Text)
                {
                    pa.Description = descriptionTextBox.Text;
                }

                EditFlags editFlags = EditFlags.None;

                tmpArray = GetIntArray(editFlagsListBox);
                if (!IntArraysEqual(tmpArray, (int[])editFlagsListBox.Tag))
                {
                    for (int x = 0; x < tmpArray.Length; x++)
                    {
                        //If value == 0 then None was selected and will override all others
                        //Do not handle first index, is None
                        if (tmpArray[x] == 0)
                        {
                            break;
                        }

                        editFlags |= (EditFlags)(1 << (tmpArray[x] - 1));
                    }

                    pa.EditFlags = editFlags;
                }

                pa.DefaultIcon = new FileAssociation.ProgramIcon(iconPathTextBox.Text, 0);

                if (alwaysShowExtCheckBox.Checked != (bool)alwaysShowExtCheckBox.Tag)
                {
                    pa.AlwaysShowExtension = alwaysShowExtCheckBox.Checked;
                }
            }

            refreshExtensionsButton_Click(null, null);
            extensionsListBox.SelectedItem = extension;
        }
Ejemplo n.º 6
0
 get => new MixtureSettings()
 {
     widthScale      = 1.0f,
     heightScale     = 1.0f,
     depthScale      = 1.0f,
     width           = 1024,
     height          = 1024,
     depth           = 1,
     sizeMode        = OutputSizeMode.InheritFromParent,
     dimension       = OutputDimension.InheritFromParent,
     outputChannels  = OutputChannel.InheritFromParent,
     outputPrecision = OutputPrecision.InheritFromParent,
     editFlags       = ~EditFlags.POTSize,
     doubleBuffered  = false,
     wrapMode        = OutputWrapMode.InheritFromParent,
     filterMode      = OutputFilterMode.InheritFromParent,
     refreshMode     = RefreshMode.OnLoad,
 };
Ejemplo n.º 7
0
 get => new MixtureRTSettings()
 {
     widthPercent   = 1.0f,
     heightPercent  = 1.0f,
     depthPercent   = 1.0f,
     width          = 512,
     height         = 512,
     sliceCount     = 1,
     widthMode      = OutputSizeMode.Default,
     heightMode     = OutputSizeMode.Default,
     depthMode      = OutputSizeMode.Default,
     dimension      = OutputDimension.Default,
     targetFormat   = OutputFormat.Default,
     editFlags      = EditFlags.None,
     doubleBuffered = false,
     wrapMode       = TextureWrapMode.Repeat,
     filterMode     = FilterMode.Bilinear,
 };
Ejemplo n.º 8
0
        /// <summary>
        /// Sets a value that determines numerous shell options for extension as well as limitations on how extension properties can be edited by programs that honor <see cref="EditFlags"/>
        /// </summary>
        /// <param name="flags"><see cref="EditFlags"/> for program file type.</param>
        protected void SetEditFlags(EditFlags flags)
        {
            if (!this.Exists)
            {
                throw new Exception("Extension does not exist");
            }

            //registryWrapper.Write(info.progId, "EditFlags", (uint)flags);
            registryWrapper.Write(this.progId, "EditFlags", flags);
            //RegistryKey key = Registry.ClassesRoot;
            //RegistryKey lastKey = key;
            //key = key.OpenSubKey(this.progId, true);

            //if (key == null)
            //{
            //    key = lastKey.CreateSubKey(this.progId);
            //}

            ShellNotification.NotifyOfChange();
        }
Ejemplo n.º 9
0
        public static string FlagsToString(EditFlags flags)
        {
            string result = "";

            if ((flags & EditFlags.Unreviewed) == EditFlags.Unreviewed)
            {
                result += "!";
            }
            if ((flags & EditFlags.New) == EditFlags.New)
            {
                result += "Н";
            }
            if ((flags & EditFlags.Minor) == EditFlags.Minor)
            {
                result += "м";
            }
            if ((flags & EditFlags.Bot) == EditFlags.Bot)
            {
                result += "б";
            }
            return(result);
        }
Ejemplo n.º 10
0
        /// <summary>
        ///     Creates actual Programmatic Identifier key in registry that is used by other extensions.
        /// </summary>
        /// <param name="description">Friendly description of file type.</param>
        /// <param name="editFlags"><see cref="EditFlags" /> for program file type.</param>
        /// <param name="verbs">Array of <see cref="ProgramVerb" /> that contains supported verbs.</param>
        /// <returns><see cref="ProgramAssociationInfo" /> instance referring to specified extension.</returns>
        public ProgramAssociationInfo Create(string description, EditFlags editFlags, ProgramVerb[] verbs)
        {
            if (Exists)
            {
                Delete();
            }

            Create();

            if (description != string.Empty)
            {
                Description = description;
            }

            if (editFlags != EditFlags.None)
            {
                EditFlags = editFlags;
            }

            Verbs = verbs;

            return(this);
        }
Ejemplo n.º 11
0
        public override hresult OnEdit(Point3d pnt, EditFlags lFlag)
        {
            Editor ed = HostMgd.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor;

            PromptIntegerOptions opts = new PromptIntegerOptions("Enter Count number: ");

            opts.AllowNegative = false;
            opts.AllowZero     = false;
            PromptIntegerResult pr = ed.GetInteger(opts);

            if (PromptStatus.OK == pr.Status)
            {
                ed.WriteMessage("You entered: " + pr.StringResult);
                Count = pr.Value;
                DbEntity.Erase();
                DbEntity.AddToCurrentDocument();
            }
            else
            {
                ed.WriteMessage("Cancel");
            }

            return(hresult.s_Ok);
        }
Ejemplo n.º 12
0
 public bool Supports(EditFlags flags)
 {
     return((FactoryDynamic.Capabilities & flags) != 0);
 }
Ejemplo n.º 13
0
        void UpdateViews()
        {
            if (InvokeRequired)
            {
                BeginInvoke(new StringParameterDelegate(UpdateViews), new object[] {});
            }
            else
            {
                EditFlags mask = EditFlags.None;
                if (reviewedEditsToolStripMenuItem.Checked)
                {
                    mask |= EditFlags.Unreviewed;
                }
                if (newArticlesToolStripMenuItem.Checked)
                {
                    mask |= EditFlags.New;
                }
                if (minorEditsToolStripMenuItem.Checked)
                {
                    mask |= EditFlags.Minor;
                }
                if (botEditsToolStripMenuItem.Checked)
                {
                    mask |= EditFlags.Bot;
                }

                EditFlags onlyMask = EditFlags.None;
                if (onlyNewToolStripMenuItem.Checked)
                {
                    mask     |= EditFlags.New;
                    onlyMask |= EditFlags.New;
                }
                if (onlyBotEditToolStripMenuItem.Checked)
                {
                    mask     |= EditFlags.Bot;
                    onlyMask |= EditFlags.Bot;
                }
                if (onlyMinToolStripMenuItem.Checked)
                {
                    mask     |= EditFlags.Minor;
                    onlyMask |= EditFlags.Minor;
                }
                if (onlyUnreviewedEditsToolStripMenuItem.Checked)
                {
                    mask     |= EditFlags.Unreviewed;
                    onlyMask |= EditFlags.Unreviewed;
                }
                recentChangesListView.BeginUpdate();
                recentChangesListView.Items.Clear();
                recentChangesListView.Groups.Clear();

                using (SQLiteCommand command = new SQLiteCommand(_connection))
                {
                    SQLiteParameter maskValue = new SQLiteParameter("@mask");
                    maskValue.Value = (int)mask;
                    command.Parameters.Add(maskValue);
                    SQLiteParameter onlyMaskValue = new SQLiteParameter("@onlyMask");
                    onlyMaskValue.Value = (int)onlyMask;
                    command.Parameters.Add(onlyMaskValue);
                    command.CommandText = @"SELECT max(timestamp),
                                                   sum(flags & 4),
                                                   page,
                                                   count(timestamp),
                                                   sum(size),
                                                   group_concat(user),
                                                   max(id),
                                                   min(oldid),
                                                   namespace,
                                                   (namespace || ':' || page) AS name
                                            FROM [edits]
                                            WHERE (flags & @onlyMask) == @onlyMask AND
                                                  (flags | @mask) == @mask
                                            GROUP BY name
                                            ORDER by max(timestamp) DESC";
                    using (SQLiteDataReader reader = command.ExecuteReader())
                    {
                        while (reader.Read())
                        {
                            DateTime      time  = DateTime.Parse(reader[0].ToString());
                            string        day   = time.ToLongDateString();
                            string        t     = time.ToShortTimeString();
                            bool          found = false;
                            ListViewGroup group = null;
                            for (int i = 0; i < recentChangesListView.Groups.Count; ++i)
                            {
                                if (recentChangesListView.Groups[i].Header == day)
                                {
                                    group = recentChangesListView.Groups[i];
                                    found = true;
                                    break;
                                }
                            }
                            if (!found)
                            {
                                group = new ListViewGroup(day);
                                recentChangesListView.Groups.Add(group);
                            }

                            string[] authorsList = reader[5].ToString().Split(new char[] { ',' });
                            string   authors     = string.Join(", ", authorsList.Distinct().ToArray());
                            int      size;
                            int.TryParse(reader[4].ToString(), out size);
                            int flags;
                            int.TryParse(reader[1].ToString(), out flags);
                            int changes;
                            int.TryParse(reader[3].ToString(), out changes);
                            long diff;
                            long.TryParse(reader[6].ToString(), out diff);
                            long oldId;
                            long.TryParse(reader[7].ToString(), out oldId);
                            int nm;
                            int.TryParse(reader[8].ToString(), out nm);
                            PageListViewItem item = new PageListViewItem(t,
                                                                         WikiEdit.FlagsToString((EditFlags)flags),
                                                                         size,
                                                                         authors,
                                                                         changes,
                                                                         diff,
                                                                         oldId,
                                                                         reader[2].ToString(),
                                                                         nm);
                            item.Group = group;
                            recentChangesListView.Items.Add(item);
                        }
                    }
                }
                recentChangesListView.EndUpdate();

                watchListView.BeginUpdate();
                watchListView.Items.Clear();
                watchListView.Groups.Clear();

                using (SQLiteCommand command = new SQLiteCommand(_connection))
                {
                    command.CommandText = @"SELECT max(timestamp), sum(flags & 4), edits.page, count(timestamp), sum(size), group_concat(user), max(edits.id), min(oldid), edits.namespace, (edits.namespace || ':' || edits.page) AS name
                                            FROM [edits], [watched_pages]
                                            WHERE edits.page = watched_pages.page AND
                                                  (edits.namespace=watched_pages.namespace OR
                                                   edits.namespace=watched_pages.namespace + 1)
                                            GROUP BY name
                                            ORDER by max(timestamp) DESC";
                    using (SQLiteDataReader reader = command.ExecuteReader())
                    {
                        while (reader.Read())
                        {
                            DateTime      time  = DateTime.Parse(reader[0].ToString());
                            string        day   = time.ToLongDateString();
                            string        t     = time.ToShortTimeString();
                            bool          found = false;
                            ListViewGroup group = null;
                            for (int i = 0; i < watchListView.Groups.Count; ++i)
                            {
                                if (watchListView.Groups[i].Header == day)
                                {
                                    group = watchListView.Groups[i];
                                    found = true;
                                    break;
                                }
                            }
                            if (!found)
                            {
                                group = new ListViewGroup(day);
                                watchListView.Groups.Add(group);
                            }

                            string[] authorsList = reader[5].ToString().Split(new char[] { ',' });
                            string   authors     = string.Join(", ", authorsList.Distinct().ToArray());
                            int      size;
                            int.TryParse(reader[4].ToString(), out size);
                            int flags;
                            int.TryParse(reader[1].ToString(), out flags);
                            int changes;
                            int.TryParse(reader[3].ToString(), out changes);
                            long diff;
                            long.TryParse(reader[6].ToString(), out diff);
                            long oldId;
                            long.TryParse(reader[7].ToString(), out oldId);
                            int nm;
                            int.TryParse(reader[8].ToString(), out nm);
                            PageListViewItem item = new PageListViewItem(t,
                                                                         WikiEdit.FlagsToString((EditFlags)flags),
                                                                         size,
                                                                         authors,
                                                                         changes,
                                                                         diff,
                                                                         oldId,
                                                                         reader[2].ToString(),
                                                                         nm);
                            item.Group = group;
                            watchListView.Items.Add(item);
                        }
                    }
                }
                watchListView.EndUpdate();
            }
        }
Ejemplo n.º 14
0
 public bool Supports(EditFlags flags)
 {
     return (FactoryDynamic.Capabilities & flags) != 0;
 }
Ejemplo n.º 15
0
        /// <summary>
        ///     Sets a value that determines numerous shell options for extension as well as limitations on how extension
        ///     properties can be edited by programs that honor <see cref="EditFlags" />
        /// </summary>
        /// <param name="flags"><see cref="EditFlags" /> for program file type.</param>
        protected void SetEditFlags(EditFlags flags)
        {
            if (!Exists)
                throw new Exception("Extension does not exist");

            //registryWrapper.Write(info.progId, "EditFlags", (uint)flags);
            _registryWrapper.Write(ProgId, "EditFlags", flags);

            ShellNotification.NotifyOfChange();
        }
Ejemplo n.º 16
0
 /// <summary>
 ///     Creates actual Programmatic Identifier key in registry that is used by other extensions.
 /// </summary>
 /// <param name="description">Friendly description of file type.</param>
 /// <param name="editFlags"><see cref="EditFlags" /> for program file type.</param>
 /// <param name="verb">Single <see cref="ProgramVerb" /> that contains supported verbs.</param>
 /// <returns><see cref="ProgramAssociationInfo" /> instance referring to specified extension.</returns>
 public ProgramAssociationInfo Create(string description, EditFlags editFlags, ProgramVerb verb)
 {
     return(Create(description, editFlags, new[] { verb }));
 }
Ejemplo n.º 17
0
        /// <summary>
        ///     Creates actual Programmatic Identifier key in registry that is used by other extensions.
        /// </summary>
        /// <param name="description">Friendly description of file type.</param>
        /// <param name="editFlags"><see cref="EditFlags" /> for program file type.</param>
        /// <param name="verbs">Array of <see cref="ProgramVerb" /> that contains supported verbs.</param>
        /// <returns><see cref="ProgramAssociationInfo" /> instance referring to specified extension.</returns>
        public ProgramAssociationInfo Create(string description, EditFlags editFlags, ProgramVerb[] verbs)
        {
            if (Exists)
                Delete();

            Create();

            if (description != string.Empty)
                Description = description;

            if (editFlags != EditFlags.None)
                EditFlags = editFlags;

            Verbs = verbs;

            return this;
        }
Ejemplo n.º 18
0
 /// <summary>
 ///     Creates actual Programmatic Identifier key in registry that is used by other extensions.
 /// </summary>
 /// <param name="description">Friendly description of file type.</param>
 /// <param name="editFlags"><see cref="EditFlags" /> for program file type.</param>
 /// <param name="verb">Single <see cref="ProgramVerb" /> that contains supported verbs.</param>
 /// <returns><see cref="ProgramAssociationInfo" /> instance referring to specified extension.</returns>
 public ProgramAssociationInfo Create(string description, EditFlags editFlags, ProgramVerb verb)
 {
     return Create(description, editFlags, new[] {verb});
 }
Ejemplo n.º 19
0
        private void extensionsListBox_SelectedIndexChanged(object sender, EventArgs e)
        {
            string extension = (string)extensionsListBox.SelectedItem;

            FileAssociationInfo fa = new FileAssociationInfo(extension);

            contentTypeTextBox.Text = fa.ContentType;
            contentTypeTextBox.Tag  = contentTypeTextBox.Text;

            programIdTextBox.Text = fa.ProgID;
            programIdTextBox.Tag  = programIdTextBox.Text;

            openWithListBox.DataSource = fa.OpenWithList;

            PerceivedTypeComboBox.DataSource    = Enum.GetNames(typeof(PerceivedTypes));
            PerceivedTypeComboBox.SelectedIndex = (int)fa.PerceivedType;
            PerceivedTypeComboBox.Tag           = PerceivedTypeComboBox.SelectedIndex;

            extensionLabel.Text = fa.Extension;

            if (fa.PersistentHandler != Guid.Empty)
            {
                persistentHandlerTextBox.Text = fa.PersistentHandler.ToString();
                persistentHandlerTextBox.Tag  = fa.PersistentHandler;
            }
            else
            {
                persistentHandlerTextBox.Text = "";
            }

            if (fa.PersistentHandler != Guid.Empty)
            {
                persistentHandlerTextBox.Tag = persistentHandlerTextBox.Text = fa.PersistentHandler.ToString();
            }
            else
            {
                persistentHandlerTextBox.Tag = persistentHandlerTextBox.Text = "";
            }

            ProgramAssociationInfo pa = new ProgramAssociationInfo(fa.ProgID);

            programIdLabel.Text = fa.ProgID;

            if (pa.Exists)
            {
                programIdGroupBox.Enabled = true;

                EditFlags[] editFlags = (EditFlags[])Enum.GetValues(typeof(EditFlags));

                editFlagsListBox.Items.Clear();

                foreach (EditFlags flag in editFlags)
                {
                    editFlagsListBox.Items.Add(flag);
                }

                EditFlags[] flags = (EditFlags[])Enum.GetValues(typeof(EditFlags));

                EditFlags setFlags = pa.EditFlags;
                editFlagsListBox.Tag = setFlags;

                for (int x = 1; x < flags.Length; x++)
                {
                    EditFlags flag = flags[x];

                    if ((setFlags & flag) == flag)
                    {
                        editFlagsListBox.SetItemChecked(x, true);
                    }
                    else
                    {
                        editFlagsListBox.SetItemChecked(x, false);
                    }
                }

                if (setFlags == EditFlags.None)
                {
                    editFlagsListBox.SetItemChecked((int)EditFlags.None, true);
                }
                else
                {
                    editFlagsListBox.SetItemChecked((int)EditFlags.None, false);
                }


                editFlagsListBox.Tag = GetIntArray(editFlagsListBox);

                ProgramVerb[] verbs = pa.Verbs;
                verbsTreeView.Nodes.Clear();
                foreach (ProgramVerb verb in verbs)
                {
                    TreeNode node = new TreeNode(verb.Name);
                    node.Nodes.Add(new TreeNode(verb.Command));
                    node.Nodes[0].Tag = "command";
                    verbsTreeView.Nodes.Add(node);
                }
                verbsTreeView.ExpandAll();

                descriptionTextBox.Text = pa.Description;
                descriptionTextBox.Tag  = descriptionTextBox.Text;


                alwaysShowExtCheckBox.Checked = pa.AlwaysShowExtension;
                alwaysShowExtCheckBox.Tag     = alwaysShowExtCheckBox.Checked;

                if (pa.DefaultIcon != ProgramIcon.None)
                {
                    iconPathTextBox.Text  = pa.DefaultIcon.Path;
                    iconIndexTextBox.Text = pa.DefaultIcon.Index.ToString();
                }
                else
                {
                    iconPathTextBox.Text  = "";
                    iconIndexTextBox.Text = "";
                }
            }
            else
            {
                programIdGroupBox.Enabled = false;

                editFlagsListBox.Items.Clear();
                verbsTreeView.Nodes.Clear();

                descriptionTextBox.Text = "";
                descriptionTextBox.Tag  = "";
            }
        }
Ejemplo n.º 20
0
 public override hresult OnEdit(Point3d pnt, EditFlags lInsertType)
 {
     CallForm();
     return(hresult.s_Ok);
 }
Ejemplo n.º 21
0
 public static string FlagsToString(EditFlags flags)
 {
     string result = "";
     if ((flags & EditFlags.Unreviewed) == EditFlags.Unreviewed)
     {
         result += "!";
     }
     if ((flags & EditFlags.New) == EditFlags.New)
     {
         result += "Н";
     }
     if ((flags & EditFlags.Minor) == EditFlags.Minor)
     {
         result += "м";
     }
     if ((flags & EditFlags.Bot) == EditFlags.Bot)
     {
         result += "б";
     }
     return result;
 }