// PRIVATE METHODS //////////////////////////////////////////////////
        #region Methods
        private static Func <IEnumerable <IAttributeInfo>, AttributesInfo> CreateAttributesInfoFactory(Type clrDeclaringType)
        {
            Contract.Requires(clrDeclaringType != null);

            Func <IEnumerable <IAttributeInfo>, AttributesInfo> attributesInfoFactory = (collection) =>
            {
                var attributesInfo = new AttributesInfo(clrDeclaringType, collection.SafeToList());
                return(attributesInfo);
            };

            return(attributesInfoFactory);
        }
Exemple #2
0
        public AttributesList GetUpdatedAttributeList(ObservableCollection <Helpers.Attribute> contactList)
        {
            AttributesList attributeList = new AttributesList();

            Settings.ContactDataContext contactContext = Settings.ContactDataContext.GetInstance();
            foreach (Helpers.Attribute contact in contactList.Where(x => x.IsAltered == true && !string.IsNullOrEmpty(x.AttributeId) && ((!string.IsNullOrEmpty(x.AttributeValue.Trim()) && x.Type == Settings.ContactDataContext.AttributeType.Multiple) || (x.Type == Settings.ContactDataContext.AttributeType.Single))))
            {
                string attributeName = contactContext.ContactValidAttribute.Where(x => x.Value.Equals(contact.AttributeName)).Single().Key;
                if (attributeList.Cast <AttributesHeader>().Where(y => y.AttrName.Equals(attributeName)).ToList().Count == 0)
                // if(!attributeList.Contains(contact.AttributeName))
                {
                    AttributesHeader attributeHeader = new AttributesHeader();
                    //  attributeHeader.AttrName = contact.AttributeName;
                    attributeHeader.AttrName = attributeName;
                    AttributesInfoList attributeInfoList = new AttributesInfoList();
                    List <Pointel.Interactions.Contact.Helpers.Attribute> lst = contactList.Where(x => x.IsAltered == true && !string.IsNullOrEmpty(x.AttributeId) && x.AttributeName.Equals(contact.AttributeName) && !string.IsNullOrEmpty(x.AttributeValue.Trim())).ToList <Pointel.Interactions.Contact.Helpers.Attribute>();
                    int i = 1;
                    foreach (Helpers.Attribute contactGroup in lst)
                    {
                        AttributesInfo attributeInfo = new AttributesInfo();
                        attributeInfo.AttrValue   = contactGroup.AttributeValue;
                        attributeInfo.AttrId      = contactGroup.AttributeId;
                        attributeInfo.Description = contactGroup.Description;
                        if (contactGroup.Type == Settings.ContactDataContext.AttributeType.Single)
                        {
                            attributeInfo.AttrIndex = 0;
                        }
                        else
                        {
                            if (contactGroup.Isprimary)
                            {
                                attributeInfo.AttrIndex = 0;
                            }
                            else
                            {
                                attributeInfo.AttrIndex = i++;
                            }
                        }
                        attributeInfoList.Add(attributeInfo);
                    }
                    attributeHeader.AttributesInfoList = attributeInfoList;
                    attributeList.Add(attributeHeader);
                }
            }
            if (attributeList.Count == 0)
            {
                attributeList = null;
            }
            return(attributeList);
        }
Exemple #3
0
 private void HiddenAttributesMethod()
 {
     foreach (var file in SelectedItemPaths)
     {
         FileAttributes attributes = File.GetAttributes(file);
         if ((attributes & FileAttributes.Hidden) == FileAttributes.Hidden)
         {
             attributes = AttributesInfo.RemoveAttribute(attributes, FileAttributes.Hidden);
             File.SetAttributes(file, attributes);
         }
         else
         {
             File.SetAttributes(file, File.GetAttributes(file) | FileAttributes.Hidden);
         }
     }
 }
Exemple #4
0
 private void ReadOnlyAttributesMethod()
 {
     foreach (string file in SelectedItemPaths)
     {
         FileAttributes attributes = File.GetAttributes(file);
         if ((attributes & FileAttributes.ReadOnly) == FileAttributes.ReadOnly)
         {
             attributes = AttributesInfo.RemoveAttribute(attributes, FileAttributes.ReadOnly);
             File.SetAttributes(file, attributes);
         }
         else
         {
             File.SetAttributes(file, File.GetAttributes(file) | FileAttributes.ReadOnly);
         }
     }
 }
Exemple #5
0
 private void ReadOnlyAttributesMethod()
 {
     foreach (var file in SelectedItemPaths)
     {
         string[]       array      = file.Cast <string>().ToArray();
         FileAttributes attributes = File.GetAttributes(file);
         if ((attributes & FileAttributes.ReadOnly) == FileAttributes.ReadOnly)
         {
             attributes = AttributesInfo.RemoveAttribute(attributes, FileAttributes.ReadOnly);
             File.SetAttributes(file, attributes);
         }
         else
         {
             File.SetAttributes(file, File.GetAttributes(file) | FileAttributes.ReadOnly);
         }
     }
 }
Exemple #6
0
 private void SystemAttributesMethod()
 {
     foreach (var file in SelectedItemPaths)
     {
         FileAttributes attributes = File.GetAttributes(file);
         if ((attributes & FileAttributes.System) == FileAttributes.System)
         {
             attributes = AttributesInfo.RemoveAttribute(attributes, FileAttributes.System);
             File.SetAttributes(file, attributes);
         }
         else
         {
             File.SetAttributes(file, File.GetAttributes(file) | FileAttributes.System);
         }
     }
     StartProcess.StartInfo(AttributesInfo.GetAssembly.AssemblyInformation("directory") + @"\MenuTools.exe", "-refresh");
 }
Exemple #7
0
 private void ReadOnlyAttributesMethod()
 {
     string[] array = SelectedItemPaths.Cast <string>().ToArray();
     foreach (string item in array)
     {
         FileAttributes attributes = File.GetAttributes(item);
         if ((attributes & FileAttributes.ReadOnly) == FileAttributes.ReadOnly)
         {
             attributes = AttributesInfo.RemoveAttribute(attributes, FileAttributes.ReadOnly);
             File.SetAttributes(item, attributes);
         }
         else
         {
             File.SetAttributes(item, File.GetAttributes(item) | FileAttributes.ReadOnly);
         }
     }
 }
Exemple #8
0
 private void SystemAttributesMethod()
 {
     string[] array = SelectedItemPaths.Cast <string>().ToArray();
     foreach (string item in array)
     {
         FileAttributes attributes = File.GetAttributes(item);
         if ((attributes & FileAttributes.System) == FileAttributes.System)
         {
             attributes = AttributesInfo.RemoveAttribute(attributes, FileAttributes.System);
             File.SetAttributes(item, attributes);
         }
         else
         {
             File.SetAttributes(item, File.GetAttributes(item) | FileAttributes.System);
         }
     }
     StartProcess.StartInfo(AttributesInfo.GetAssembly.AssemblyInformation("directory") + @"\xMenuTools.exe", "-refresh");
 }
        // Create the Menu
        protected override ContextMenuStrip CreateMenu()
        {
            CheckUserSettings();

            // Main Menu
            using (Menu = new ContextMenuStrip())
            {
                Menu.Name = "xMenuToolsMenu";

                using (xMenuToolsMenu = new ToolStripMenuItem())
                {
                    xMenuToolsMenu.Name = "xMenuToolsMenu";

                    // CommandLine
                    using (CommandLine = new ToolStripMenuItem())
                    {
                        CommandLine.Text = Resources.CommandLines;
                        CommandLine.Name = "CommandLine";

                        // OpenTerminalAsUser
                        using (OpenTerminalAsUser = new ToolStripMenuItem())
                        {
                            OpenTerminalAsUser.Text = Resources.OpenTerminal;
                            OpenTerminalAsUser.Name = "OpenTerminalAsUser";
                        }
                        // OpenTerminalAsAdmin
                        using (OpenTerminalAsAdmin = new ToolStripMenuItem())
                        {
                            OpenTerminalAsAdmin.Text = Resources.OpenTerminalElevated;
                            OpenTerminalAsAdmin.Name = "OpenTerminalAsAdmin";
                        }

                        // OpenCmdAsUser
                        using (OpenCmdAsUser = new ToolStripMenuItem())
                        {
                            OpenCmdAsUser.Text = Resources.CommandPrompt;
                            OpenCmdAsUser.Name = "OpenCmdAsUser";
                        }
                        // OpenCmdAsAdmin
                        using (OpenCmdAsAdmin = new ToolStripMenuItem())
                        {
                            OpenCmdAsAdmin.Text = Resources.CommandPromptElevated;
                            OpenCmdAsAdmin.Name = "OpenCmdAsAdmin";
                        }

                        // OpenGitAsUser
                        using (OpenGitAsUser = new ToolStripMenuItem())
                        {
                            OpenGitAsUser.Text = Resources.OpenGitAsUser;
                            OpenGitAsUser.Name = "OpenGitAsUser";
                        }
                        // OpenGitAsAdmin
                        using (OpenGitAsAdmin = new ToolStripMenuItem())
                        {
                            OpenGitAsAdmin.Text = Resources.OpenGitAsAdmin;
                            OpenGitAsAdmin.Name = "OpenGitAsAdmin";
                        }

                        // OpenPSAsUser
                        using (OpenPSAsUser = new ToolStripMenuItem())
                        {
                            OpenPSAsUser.Text = Resources.OpenPSAsUser;
                            OpenPSAsUser.Name = "OpenPSAsUser";
                        }
                        // OpenPSAsAdmin
                        using (OpenPSAsAdmin = new ToolStripMenuItem())
                        {
                            OpenPSAsAdmin.Text = Resources.OpenPSAsAdmin;
                            OpenPSAsAdmin.Name = "OpenPSAsAdmin";
                        }
                    }
                    // Attributes
                    using (Attributes = new ToolStripMenuItem())
                    {
                        Attributes.Text = Resources.AttributesText;
                        Attributes.Name = "Attributes";

                        using (AttributesMenu = new ToolStripMenuItem())
                        {
                            AttributesMenu.Text = Resources.AttributesMenu;
                            AttributesMenu.Name = "AttributesMenu";
                        }
                        try
                        {
                            AttributesInfo.GetFileAttributes(FolderPath);
                        }
                        catch (Exception ex)
                        {
                            StartProcess.StartInfo(AttributesInfo.GetAssembly.AssemblyInformation("directory") + @"\xMenuTools.exe", "\"" + ex.Message + Environment.NewLine + ex.StackTrace + Environment.NewLine + ex.Source + Environment.NewLine + ex.GetBaseException() + Environment.NewLine + ex.TargetSite + "\"" + " -catchhandler");
                        }
                        SetInternalAttributes();
                    }
                    // System Folders
                    using (SystemFolders = new ToolStripMenuItem())
                    {
                        SystemFolders.Text = "System Folders";
                        SystemFolders.Name = "SystemFolders";

                        using (AppDataFolder = new ToolStripMenuItem())
                        {
                            AppDataFolder.Text = "AppData Folder";
                            AppDataFolder.Name = "AppDataFolder";
                        }
                        using (ProgramDataFolder = new ToolStripMenuItem())
                        {
                            ProgramDataFolder.Text = "ProgramData Folder";
                            ProgramDataFolder.Name = "ProgramDataFolder";
                        }
                        using (UserStartMenuFolder = new ToolStripMenuItem())
                        {
                            UserStartMenuFolder.Text = "Start Menu Folder";
                            UserStartMenuFolder.Name = "UserStartMenuFolder";
                        }
                        using (AllUsersStartMenuFolder = new ToolStripMenuItem())
                        {
                            AllUsersStartMenuFolder.Text = "All Users Start Menu Folder";
                            AllUsersStartMenuFolder.Name = "AllUsersStartMenuFolder";
                        }
                        using (UserTempFolder = new ToolStripMenuItem())
                        {
                            UserTempFolder.Text = "Temp Folder";
                            UserTempFolder.Name = "UserTempFolder";
                        }
                    }
                    // FindWallpaper
                    using (FindWallpaper = new ToolStripMenuItem())
                    {
                        FindWallpaper.Text = Resources.FindWallpaperText;
                        FindWallpaper.Name = "FindWallpaper";
                    }
                    // Paste Contents
                    using (PasteContents = new ToolStripMenuItem())
                    {
                        PasteContents.Text = "Paste clipboard text to file";
                        PasteContents.Name = "PasteContents";
                    }
                }
            }
            MenuDeveloper();

            return(Menu);
        }
Exemple #10
0
        // Create the Menu
        protected override ContextMenuStrip CreateMenu()
        {
            CheckUserSettings();
            // Main Menu
            using (Menu = new ContextMenuStrip())
            {
                Menu.Name = "MenuToolsDirectory";

                using (MenuToolsMenu = new ToolStripMenuItem())
                {
                    MenuToolsMenu.Name = "MenuToolsMenu";

                    // BlockFirewall
                    using (BlockFirewall = new ToolStripMenuItem())
                    {
                        BlockFirewall.Text = Resources.BlockAllText;
                        BlockFirewall.Name = "BlockFirewall";
                    }
                    // CopyPath
                    using (CopyPath = new ToolStripMenuItem())
                    {
                        CopyPath.Text = Resources.CopyPathText;
                        CopyPath.Name = "CopyPath";
                    }
                    // CopyName
                    using (CopyName = new ToolStripMenuItem())
                    {
                        CopyName.Text = Resources.CopyNameText;
                        CopyName.Name = "CopyName";
                    }
                    // Attributes
                    using (Attributes = new ToolStripMenuItem())
                    {
                        Attributes.Text = Resources.AttributesText;
                        Attributes.Name = "Attributes";

                        // AttributesMenu
                        using (AttributesMenu = new ToolStripMenuItem())
                        {
                            AttributesMenu.Text = Resources.AttributesMenu;
                            AttributesMenu.Name = "AttributesMenu";
                        }
                        // Get : Set Attributes
                        string[] SelectedPath = SelectedItemPaths.Cast <string>().ToArray();
                        if (SelectedPath.Length > 1)
                        {
                            foreach (var item in SelectedPath)
                            {
                                AttributesInfo.GetFileAttributes(item);
                            }
                        }
                        else
                        {
                            AttributesInfo.GetFileAttributes(SelectedPath.ToStringArray(false));
                        }
                        SetFileAttributes();
                    }
                    // SymLink
                    using (SymLink = new ToolStripMenuItem())
                    {
                        SymLink.Text = Resources.CreateSymbolicLink;
                        SymLink.Name = "SymLink";
                    }
                    // TakeOwnership
                    using (TakeOwnership = new ToolStripMenuItem())
                    {
                        TakeOwnership.Text = Resources.TakeOwnershipText;
                        TakeOwnership.Name = "TakeOwnership";
                    }
                }
            }
            MenuDeveloper();

            return(Menu);
        }
Exemple #11
0
        protected override ContextMenuStrip CreateMenu()
        {
            CheckUserSettings();
            // Main Menu
            using (Menu = new ContextMenuStrip())
            {
                Menu.Name = "xMenuToolsFiles";

                using (xMenuToolsMenu = new ToolStripMenuItem())
                {
                    xMenuToolsMenu.Name = "xMenuToolsMenu";

                    // OpenNotepad
                    using (OpenNotepad = new ToolStripMenuItem())
                    {
                        OpenNotepad.Text = Resources.OpenNotepad;
                        OpenNotepad.Name = "OpenNotepad";
                    }
                    // BlockFirewall
                    using (BlockFirewall = new ToolStripMenuItem())
                    {
                        BlockFirewall.Text = Resources.BlockText;
                        BlockFirewall.Name = "BlockFirewall";
                    }
                    // CopyPath
                    using (CopyPath = new ToolStripMenuItem())
                    {
                        CopyPath.Text = Resources.CopyPathText;
                        CopyPath.Name = "CopyPath";
                    }
                    // CopyName
                    using (CopyName = new ToolStripMenuItem())
                    {
                        CopyName.Text = Resources.CopyNameText;
                        CopyName.Name = "CopyName";
                    }
                    // Attributes
                    using (Attributes = new ToolStripMenuItem())
                    {
                        Attributes.Name = "Attributes";

                        Attributes.Text = Resources.AttributesText;
                        // AttributesMenu
                        using (AttributesMenu = new ToolStripMenuItem())
                        {
                            AttributesMenu.Text = Resources.AttributesMenu;
                            AttributesMenu.Name = "AttributesMenu";
                        }
                        // Get : Set Attributes
                        string[] SelectedPath = SelectedItemPaths.Cast <string>().ToArray();
                        if (SelectedPath.Length > 1)
                        {
                            foreach (string item in SelectedPath)
                            {
                                try
                                {
                                    AttributesInfo.GetFileAttributes(item);
                                }
                                catch (Exception ex)
                                {
                                    StartProcess.StartInfo(AttributesInfo.GetAssembly.AssemblyInformation("directory") + @"\xMenuTools.exe", "\"" + ex.Message + Environment.NewLine + ex.StackTrace + Environment.NewLine + ex.Source + Environment.NewLine + ex.GetBaseException() + Environment.NewLine + ex.TargetSite + "\"" + " -catchhandler");
                                }
                            }
                        }
                        else
                        {
                            try
                            {
                                AttributesInfo.GetFileAttributes(SelectedPath.ToStringArray(false));
                            }
                            catch (Exception ex)
                            {
                                StartProcess.StartInfo(AttributesInfo.GetAssembly.AssemblyInformation("directory") + @"\xMenuTools.exe", "\"" + ex.Message + Environment.NewLine + ex.StackTrace + Environment.NewLine + ex.Source + Environment.NewLine + ex.GetBaseException() + Environment.NewLine + ex.TargetSite + "\"" + " -catchhandler");
                            }
                        }
                        SetFileAttributes();
                    }
                    // SymLink
                    using (SymLink = new ToolStripMenuItem())
                    {
                        SymLink.Text = Resources.CreateSymbolicLink;
                        SymLink.Name = "SymLink";
                    }
                    // TakeOwnership
                    using (TakeOwnership = new ToolStripMenuItem())
                    {
                        TakeOwnership.Text = Resources.TakeOwnershipText;
                        TakeOwnership.Name = "TakeOwnership";
                    }
                }
            }
            MenuDeveloper();

            return(Menu);
        }
        // Create the Menu
        protected override ContextMenuStrip CreateMenu()
        {
            CheckUserSettings();

            // Main Menu
            using (Menu = new ContextMenuStrip())
            {
                Menu.Name = "MenuToolsMenu";

                using (MenuToolsMenu = new ToolStripMenuItem())
                {
                    MenuToolsMenu.Name = "MenuToolsMenu";

                    // CommandLine
                    using (CommandLine = new ToolStripMenuItem())
                    {
                        CommandLine.Text = Resources.CommandLines;
                        CommandLine.Name = "CommandLine";

                        // OpenAsUser
                        using (OpenAsUser = new ToolStripMenuItem())
                        {
                            OpenAsUser.Text = Resources.CommandPrompt;
                            OpenAsUser.Name = "OpenAsUser";
                        }
                        // OpenAsAdmin
                        using (OpenAsAdmin = new ToolStripMenuItem())
                        {
                            OpenAsAdmin.Text = Resources.CommandPromptElevated;
                            OpenAsAdmin.Name = "OpenAsAdmin";
                        }

                        // OpenGitAsUser
                        using (OpenGitAsUser = new ToolStripMenuItem())
                        {
                            OpenGitAsUser.Text = Resources.OpenGitAsUser;
                            OpenGitAsUser.Name = "OpenGitAsUser";
                        }
                        // OpenGitAsAdmin
                        using (OpenGitAsAdmin = new ToolStripMenuItem())
                        {
                            OpenGitAsAdmin.Text = Resources.OpenGitAsAdmin;
                            OpenGitAsAdmin.Name = "OpenGitAsAdmin";
                        }

                        // OpenPSAsUser
                        using (OpenPSAsUser = new ToolStripMenuItem())
                        {
                            OpenPSAsUser.Text = Resources.OpenPSAsUser;
                            OpenPSAsUser.Name = "OpenPSAsUser";
                        }
                        // OpenPSAsAdmin
                        using (OpenPSAsAdmin = new ToolStripMenuItem())
                        {
                            OpenPSAsAdmin.Text = Resources.OpenPSAsAdmin;
                            OpenPSAsAdmin.Name = "OpenPSAsAdmin";
                        }
                    }
                    // Attributes
                    using (Attributes = new ToolStripMenuItem())
                    {
                        Attributes.Text = Resources.AttributesText;
                        Attributes.Name = "Attributes";

                        using (AttributesMenu = new ToolStripMenuItem())
                        {
                            AttributesMenu.Text = Resources.AttributesMenu;
                            AttributesMenu.Name = "AttributesMenu";
                        }
                        AttributesInfo.GetFileAttributes(FolderPath);
                        SetInternalAttributes();
                    }
                    // System Folders
                    using (SystemFolders = new ToolStripMenuItem())
                    {
                        SystemFolders.Text = "System Folders";
                        SystemFolders.Name = "SystemFolders";

                        using (AppDataFolder = new ToolStripMenuItem())
                        {
                            AppDataFolder.Text = "AppData Folder";
                            AppDataFolder.Name = "AppDataFolder";
                        }
                        using (ProgramDataFolder = new ToolStripMenuItem())
                        {
                            ProgramDataFolder.Text = "ProgramData Folder";
                            ProgramDataFolder.Name = "ProgramDataFolder";
                        }
                        using (UserStartMenuFolder = new ToolStripMenuItem())
                        {
                            UserStartMenuFolder.Text = "Start Menu Folder";
                            UserStartMenuFolder.Name = "UserStartMenuFolder";
                        }
                        using (AllUsersStartMenuFolder = new ToolStripMenuItem())
                        {
                            AllUsersStartMenuFolder.Text = "All Users Start Menu Folder";
                            AllUsersStartMenuFolder.Name = "AllUsersStartMenuFolder";
                        }
                        using (UserTempFolder = new ToolStripMenuItem())
                        {
                            UserTempFolder.Text = "Temp Folder";
                            UserTempFolder.Name = "UserTempFolder";
                        }
                    }
                    // FindWallpaper
                    using (FindWallpaper = new ToolStripMenuItem())
                    {
                        FindWallpaper.Text = Resources.FindWallpaperText;
                        FindWallpaper.Name = "FindWallpaper";
                    }
                    // Paste Contents
                    using (PasteContents = new ToolStripMenuItem())
                    {
                        PasteContents.Text = "Paste clipboard text to file";
                        PasteContents.Name = "PasteContents";
                    }
                }
            }
            MenuDeveloper();

            return(Menu);
        }