/// <summary>
 /// Register the module.
 /// </summary>
 /// <param name="moduleType"></param>
 /// <param name="id"></param>
 public void Register(Type moduleType, int id)
 {
     var mod = new ModuleItem(){ ModuleType = moduleType, Id = id };
     _mappingsTypes[moduleType] = mod;
     _mappingsShortNames[mod.ModuleType.Name] = mod;
     _mappingsShortNames[mod.ModuleType.Name.ToLower()] = mod;
     _mappingsIds[id] = mod;
     _mappingsFullNames[mod.ModuleType.FullName] = mod;
 }
Example #2
0
 private void provider_DictionaryRemoved(ModuleItem item)
 {
     this.BeginInvoke(new MethodInvoker(() =>
     {
         listModules.Items[item.BaseAddress.ToString()].Remove();
     }));
 }
Example #3
0
        private void provider_DictionaryAdded(ModuleItem item)
        {
            HighlightedListViewItem litem = new HighlightedListViewItem(_highlightingContext,
                item.RunId > 0 && _runCount > 0);

            litem.Name = item.BaseAddress.ToString();
            litem.Text = item.Name;
            litem.SubItems.Add(new ListViewItem.ListViewSubItem(litem, Utils.FormatAddress(item.BaseAddress)));
            litem.SubItems.Add(new ListViewItem.ListViewSubItem(litem, Utils.FormatSize(item.Size)));
            litem.SubItems.Add(new ListViewItem.ListViewSubItem(litem, item.FileDescription));
            litem.ToolTipText = item.FileName;
            litem.Tag = item;
            litem.NormalColor = this.GetModuleColor(item);

            if (item.FileName.Equals(_mainModule, StringComparison.InvariantCultureIgnoreCase))
                litem.Font = new System.Drawing.Font(litem.Font, System.Drawing.FontStyle.Bold);

            lock (_needsAdd)
                _needsAdd.Add(litem);
        }
Example #4
0
 private Color GetModuleColor(ModuleItem item)
 {
     if (Properties.Settings.Default.UseColorDotNetProcesses &&
         (item.Flags & LdrpDataTableEntryFlags.CorImage) != 0
         )
         return Properties.Settings.Default.ColorDotNetProcesses;
     else if (Properties.Settings.Default.UseColorRelocatedDlls &&
         (item.Flags & LdrpDataTableEntryFlags.ImageNotAtBase) != 0
         )
         return Properties.Settings.Default.ColorRelocatedDlls;
     else
         return SystemColors.Window;
 }
        private void LoadModule(MemoryObject mo)
        {
            var dict = Dump.GetDictionary(mo);
            ModuleItem item = new ModuleItem();

            item.BaseAddress = Dump.ParseUInt64(dict["BaseAddress"]);
            item.Size = Dump.ParseInt32(dict["Size"]);
            item.Flags = (LdrpDataTableEntryFlags)Dump.ParseInt32(dict["Flags"]);
            item.Name = dict["Name"];
            item.FileName = dict["FileName"];

            if (dict.ContainsKey("FileDescription"))
            {
                item.FileDescription = dict["FileDescription"];
                item.FileCompanyName = dict["FileCompanyName"];
                item.FileVersion = dict["FileVersion"];
            }

            listModules.AddItem(item);
        }
Example #6
0
 public void AddItem(ModuleItem item)
 {
     provider_DictionaryAdded(item);
 }
Example #7
0
 public static void ResetSelectedItem()
 {
     ActiveModule = null;
     isDragging   = false;
 }
Example #8
0
            private VideoConsummation GetVideoConsummation(ObjectId userId, List <ActionItem> actions, ModuleItem module)
            {
                var userActions = actions.Where(x => x.UserId == userId && ObjectId.Parse(x.ModuleId) == module.ModuleId).OrderBy(x => x.CreatedAt);
                var first       = userActions.FirstOrDefault();
                var last        = userActions.LastOrDefault();

                if (first == null || last == null)
                {
                    return(new VideoConsummation());
                }
                return(new VideoConsummation
                {
                    Started = first.CreatedAt,
                    Finished = last.CreatedAt
                });
            }
        private Color GetModuleColor(ModuleItem item)
        {
            if (Settings.Instance.UseColorDotNetProcesses &&
                (item.Flags & LdrpDataTableEntryFlags.CorImage) != 0
                )
                return Settings.Instance.ColorDotNetProcesses;
            if (Settings.Instance.UseColorRelocatedDlls &&
                (item.Flags & LdrpDataTableEntryFlags.ImageNotAtBase) != 0
                )
                return Settings.Instance.ColorRelocatedDlls;

            return SystemColors.Window;
        }
Example #10
0
        public void UpdateView(ModuleItem moduleItem, List <List <int> > level2PowerByTier, TankPartItem tank, TankPartItem weapon)
        {
            IEnumerator enumerator = this.upgrade.GetEnumerator();

            try
            {
                while (enumerator.MoveNext())
                {
                    Transform current = (Transform)enumerator.Current;
                    Destroy(current.gameObject);
                }
            }
            finally
            {
                IDisposable disposable = enumerator as IDisposable;
                if (disposable != null)
                {
                    disposable.Dispose();
                }
            }
            if (moduleItem == null)
            {
                this.moduleName.text = null;
            }
            else
            {
                long level    = moduleItem.Level;
                int  maxLevel = moduleItem.MaxLevel;
                this.moduleName.text = (moduleItem.UserItem != null) ? $"{moduleItem.Name} <color=#838383FF>({this.localizeLVL.Value} {(moduleItem.Level + 1L)})" : $"{moduleItem.Name}";
                this.ShowDamageBonus(moduleItem, (long)maxLevel, level, level2PowerByTier, tank, weapon);
                for (int i = 0; i < moduleItem.properties.Count; i++)
                {
                    GameObject obj2 = Instantiate <GameObject>(this.property, this.upgrade);
                    obj2.SetActive(true);
                    ModulePropertyView   component = obj2.GetComponent <ModulePropertyView>();
                    ModuleVisualProperty property  = moduleItem.properties[i];
                    component.SpriteUid    = property.SpriteUID;
                    component.PropertyName = property.Name;
                    component.Units        = property.Unit;
                    component.Format       = property.Format;
                    if (property.MaxAndMin)
                    {
                        if (moduleItem.UserItem == null)
                        {
                            component.CurrentParamString = property.MaxAndMinString[(int)((IntPtr)level)];
                        }
                        else if (level == maxLevel)
                        {
                            component.CurrentParamString = property.MaxAndMinString[(int)((IntPtr)level)];
                        }
                        else
                        {
                            component.CurrentParamString = property.MaxAndMinString[(int)((IntPtr)level)];
                            component.NextParamString    = property.MaxAndMinString[(int)((IntPtr)(level + 1L))];
                        }
                    }
                    else if (moduleItem.UserItem == null)
                    {
                        component.CurrentParam = property.CalculateModuleEffectPropertyValue(0, maxLevel);
                        component.MaxParam     = property.CalculateModuleEffectPropertyValue(maxLevel, maxLevel);
                    }
                    else if (level == maxLevel)
                    {
                        float num6 = property.CalculateModuleEffectPropertyValue(maxLevel, maxLevel);
                        component.CurrentParam = num6;
                        component.MaxParam     = num6;
                    }
                    else
                    {
                        float num7 = property.CalculateModuleEffectPropertyValue(maxLevel, maxLevel);
                        component.CurrentParam = (level == -1L) ? 0f : property.CalculateModuleEffectPropertyValue((int)level, maxLevel);
                        component.NextParam    = property.CalculateModuleEffectPropertyValue(((int)level) + 1, maxLevel);
                        component.MaxParam     = num7;
                    }
                    component.ProgressBar = moduleItem.properties[i].ProgressBar;
                }
            }
            this.ShowButton(moduleItem);
        }
Example #11
0
        //
        // GET: /Module/

        public JsonResult AddModule(string title, string moduleType, string paneLocation, string viewPermission, string pageId, string ModuleId)
        {
            // All new modules go to the end of the content pane
            var m = new ModuleItem();

            m.Title       = title;
            m.ModuleDefID = Int32.Parse(moduleType);
            m.Order       = 999;

            // save to database
            var mod   = new ModulesDB();
            var modId = Int32.Parse(ModuleId);

            m.ID = mod.AddModule(
                Int32.Parse(pageId),
                m.Order,
                paneLocation,
                m.Title,
                m.ModuleDefID,
                0,
                PortalSecurity.GetEditPermissions(modId),
                viewPermission,
                PortalSecurity.GetAddPermissions(modId),
                PortalSecurity.GetDeletePermissions(modId),
                PortalSecurity.GetPropertiesPermissions(modId),
                PortalSecurity.GetMoveModulePermissions(modId),
                PortalSecurity.GetDeleteModulePermissions(modId),
                false,
                PortalSecurity.GetPublishPermissions(modId),
                false,
                false,
                false);

            // End Change [email protected]

            //// reload the portalSettings from the database

            //this.Context.Items["PortalSettings"] = new PortalSettings(this.PageID, this.PortalSettings.PortalAlias);
            //this.PortalSettings = (PortalSettings)this.Context.Items["PortalSettings"];

            // reorder the modules in the content pane
            //var modules = GetModules("ContentPane", Int32.Parse(pageId), Int32.Parse(portalId));
            //this.OrderModules(modules);

            //// resave the order
            //foreach (ModuleItem item in modules) {
            //    mod.UpdateModuleOrder(item.ID, item.Order, "ContentPane");
            //}

            //// Redirect to the same page to pick up changes
            ////this.Response.Redirect(this.AppendModuleID(this.Request.RawUrl, m.ID));
            var list = GetModules(paneLocation, Int32.Parse(pageId));

            StringBuilder ls = new StringBuilder();

            foreach (ModuleItem md in list)
            {
                ls.AppendFormat("<option value=\"{0}\">{1}</option>", md.ID, md.Title);
            }

            return(Json(new { value = ls.ToString() }));
        }
 public JsonResult Clone(int id, int parentId)
 {
     try
     {
         if ((UserProfile.isCurrentUserAdmin) || UserProfile.CurrentUser.HasPermission(AccessPermissions.PAGE_CREATION))
         {
             var      generalModuleDef = Guid.Parse("F9F9C3A4-6E16-43B4-B540-984DDB5F1CD2");
             object[] queryargs        = { generalModuleDef, PortalSettings.PortalID };
             int      moduleDefinition;
             try
             {
                 moduleDefinition =
                     new rb_ModuleDefinitions().All(where : "GeneralModDefID = @0 and PortalID = @1", args: queryargs).Single().ModuleDefID;
             }
             catch
             {
                 // Shortcut module doesn't exist in current Portal
                 var modules = new ModulesDB();
                 modules.UpdateModuleDefinitions(
                     generalModuleDef,
                     PortalSettings.PortalID,
                     true);
                 moduleDefinition =
                     new rb_ModuleSettings().All(where : "GeneralModDefID = @0 and PortalID = @1", args: queryargs).Single().ModuleDefID;
             }
             var db = new PagesDB();
             PortalPages = db.GetPagesFlat(PortalSettings.PortalID);
             var t = new PageItem
             {
                 Name  = General.GetString("TAB_NAME", "New Page Name"),
                 ID    = -1,
                 Order = 990000
             };
             PortalPages.Add(t);
             var tabs = new PagesDB();
             t.ID = tabs.AddPage(PortalSettings.PortalID, t.Name, t.Order);
             db.UpdatePageParent(t.ID, parentId, PortalSettings.PortalID);
             OrderPages();
             //JsonResult treeData = GetTreeData();
             // Coping Modules
             var pagesModules = new rb_Modules().All(where : "TabID = @0", args: id);
             foreach (var module in pagesModules)
             {
                 var m = new ModuleItem();
                 m.Title       = module.ModuleTitle;
                 m.ModuleDefID = moduleDefinition;
                 m.Order       = module.ModuleOrder;
                 // save to database
                 var mod = new ModulesDB();
                 m.ID = mod.AddModule(
                     t.ID,
                     m.Order,
                     module.PaneName,
                     module.ModuleTitle,
                     m.ModuleDefID,
                     0,
                     module.AuthorizedEditRoles,
                     module.AuthorizedViewRoles,
                     module.AuthorizedAddRoles,
                     module.AuthorizedDeleteRoles,
                     module.AuthorizedPropertiesRoles,
                     module.AuthorizedMoveModuleRoles,
                     module.AuthorizedDeleteModuleRoles,
                     false,
                     PortalSecurity.GetDeleteModulePermissions(module.ModuleID),
                     false,
                     false,
                     false);
                 var settings = new rb_ModuleSettings();
                 settings.Insert(new { ModuleID = m.ID, SettingName = "LinkedModule", SettingValue = module.ModuleID });
             }
             return(Json(new { pageId = t.ID }));
         }
         else
         {
             string errorMessage = General.GetString("ACCESS_DENIED", "You don't have permissin to clone this page", this);
             return(Json(new { error = true, errorMess = errorMessage }));
         }
     }
     catch (Exception e)
     {
         ErrorHandler.Publish(LogLevel.Error, e);
         Response.StatusCode = 500;
         return(Json(""));
     }
 }
Example #13
0
        private void LoadModules()
        {
            Dictionary <string, StackPanel> TabSections = new Dictionary <string, StackPanel>();
            Button SelectButton = null;

            //bool DemoUser = true;
            //if (SettingManager.Instance.LoginDataSet.Tables["i9SysPersonnel"].Rows[0]["DemoUser"].ToString() == "0")
            //{
            //    DemoUser = false;
            //}


            Dictionary <string, string> xxSecurityGroupModule = new Dictionary <string, string>();

            foreach (DataRow dr in SettingManager.Instance.LoginDataSet.Tables["xxSecurityGroupModule"].Rows)
            {
                if (xxSecurityGroupModule.ContainsKey(dr["ModuleName"].ToString()) == false)
                {
                    xxSecurityGroupModule.Add(dr["ModuleName"].ToString().ToUpper(), dr["ModuleName"].ToString().ToUpper());
                }
            }

            for (int i = 0; i < ModuleManager.Instance.Modules.Length - 1; i++)
            {
                try
                {
                    ModuleItem mod = ModuleManager.Instance.Modules[i];

                    if (mod.ModuleName.ToUpper() == "CRIME WATCH")
                    {
                        Console.Write("ddddd");
                    }

                    //If User has securoity rights to see the module then display the module
                    if (xxSecurityGroupModule.ContainsKey(mod.ModuleName.ToUpper()))
                    {
                        StackPanel lStackPanel = new StackPanel();

                        //ModuleItem mod = ModuleManager.Instance.Modules[i];
                        if (mod.DesktopEnabled)
                        {
                            if (TabSections.ContainsKey(mod.Section))
                            {
                                lStackPanel = TabSections[mod.Section];
                            }
                            else
                            {
                                Expander e = new Expander();
                                e.Header     = mod.Section;
                                e.IsExpanded = true;
                                NavigationStackPanel.Children.Add(e);

                                lStackPanel      = new StackPanel();
                                lStackPanel.Name = mod.Section + "StackPanel";
                                e.Content        = lStackPanel;

                                TabSections.Add(mod.Section, lStackPanel);
                            }

                            TextBlock butonTextBlock = new TextBlock();
                            butonTextBlock.TextWrapping = TextWrapping.WrapWithOverflow;
                            butonTextBlock.Text         = mod.ModuleName;
                            //butonTextBlock.TextAlignment = TextAlignment.Center;

                            //Create Image button
                            Image       ButtonImage = new Image();
                            BitmapImage logo        = new BitmapImage();
                            logo.BeginInit();
                            //http://stackoverflow.com/questions/350027/setting-wpf-image-source-in-code
                            logo.UriSource = new Uri("pack://application:,,,/Invert911.InvertCommon;component/Images/form_blue.png");
                            logo.EndInit();
                            ButtonImage.Source = logo;
                            ButtonImage.Height = 12;
                            ButtonImage.Width  = 12;
                            ButtonImage.Margin = new Thickness(0, 0, 5, 0);

                            //Add Grid to button content and set the image and text inside the grid
                            var oGrid = new Grid();
                            oGrid.Background = new SolidColorBrush(Colors.Transparent);
                            oGrid.ColumnDefinitions.Add(new ColumnDefinition());
                            oGrid.ColumnDefinitions.Add(new ColumnDefinition());

                            oGrid.Children.Add(ButtonImage);
                            Grid.SetColumn(ButtonImage, 0);
                            Grid.SetRow(ButtonImage, 0);

                            oGrid.Children.Add(butonTextBlock);
                            Grid.SetColumn(butonTextBlock, 1);
                            Grid.SetRow(butonTextBlock, 0);

                            Button b = new Button();
                            b.Content = oGrid;
                            b.Height  = 35;
                            b.HorizontalContentAlignment = System.Windows.HorizontalAlignment.Left;
                            b.Tag = mod.ModuleKey;

                            if (mod.ModuleName.Contains("Dynamic"))
                            {
                                SelectButton = b;
                            }
                            else
                            {
                                if (SelectButton == null)
                                {
                                    SelectButton = b;
                                }
                            }

                            lStackPanel.Children.Add(b);
                            b.Margin = new Thickness(4, 4, 4, 4);

                            if (mod.ModuleName == "Exit")
                            {
                                b.Click += new RoutedEventHandler(ExitButton_Click);
                            }
                            else if (mod.ModuleName == "Keyboard")
                            {
                                b.Click += new RoutedEventHandler(KeyboardButton_Click);
                            }
                            else if (mod.ModuleName == "Clipboard")
                            {
                                b.Click += new RoutedEventHandler(ClipboardButton_Click);
                            }
                            else
                            {
                                b.Click += new RoutedEventHandler(MenuButton_Click);
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
                    LogManager.Instance.LogMessage("Error loading module", ex);
                }
            }

            //Raise the click event on the selected button.
            if (SelectButton != null)
            {
                SelectButton.RaiseEvent(new RoutedEventArgs(Button.ClickEvent));
            }
            ;

            //MainFrameNavigateTo("MainPage");
        }
Example #14
0
            private ConceptPerformance GetConceptPerformance(ObjectId userId, List <QuestionItem> questions, List <UserAnswer> userAnswers, ModuleItem module)
            {
                var allQuestionsIds = userAnswers.Select(x => x.QuestionId);
                var allConcepts     = new List <Concept>();

                foreach (List <Concept> concepts in questions.Where(x => allQuestionsIds.Contains(x.QuestionId)).Select(x => x.Concepts))
                {
                    allConcepts.AddRange(concepts);
                }
                var allConceptsCount = allConcepts.Distinct().Count();

                var userCorrectAnswersQuestionsIds = userAnswers.Where(x => x.CorrectAnswer).Select(x => x.QuestionId);
                var userConcepts = new List <Concept>();

                foreach (List <Concept> concepts in questions.Where(x => userCorrectAnswersQuestionsIds.Contains(x.QuestionId)).Select(x => x.Concepts))
                {
                    userConcepts.AddRange(concepts);
                }
                var userConceptsCount = userConcepts.Distinct().Count();

                return(new ConceptPerformance
                {
                    AcquiredConcepts = userConceptsCount,
                    ModuleConcepts = allConceptsCount,
                    Effectiveness = userConceptsCount == 0 || allConceptsCount == 0 ? 0 :
                                    ((decimal)userConceptsCount / (decimal)allConceptsCount) * 100
                });
            }
Example #15
0
        /// <summary>
        /// Find module id defined by the guid in a tab in the portal
        /// </summary>
        /// <param name="portalId">
        /// The portal ID.
        /// </param>
        /// <param name="guid">
        /// The module GUID.
        /// </param>
        /// <returns>
        /// A list of module items.
        /// </returns>
        public List<ModuleItem> FindModuleItemsByGuid(int portalId, Guid guid)
        {
            // Create Instance of Connection and Command Object
            using (var connection = Config.SqlConnectionString)
            using (var command = new SqlCommand("rb_FindModulesByGuid", connection)) {
                // Mark the Command as a SPROC
                command.CommandType = CommandType.StoredProcedure;

                // Add Parameters to SPROC
                var parameterFriendlyName = new SqlParameter(StringsGuid, SqlDbType.UniqueIdentifier) { Value = guid };
                command.Parameters.Add(parameterFriendlyName);
                var parameterPortalId = new SqlParameter(StringsPortalId, SqlDbType.Int, 4) { Value = portalId };
                command.Parameters.Add(parameterPortalId);

                // Open the database connection and execute the command
                connection.Open();
                var modList = new List<ModuleItem>();

                using (var result = command.ExecuteReader(CommandBehavior.CloseConnection)) {
                    while (result.Read()) {
                        var m = new ModuleItem { ID = (int)result["ModuleId"] };
                        modList.Add(m);
                    }
                }

                return modList;
            }
        }
Example #16
0
 public static void SetSelectedItem(ModuleItem obj)
 {
     ActiveModule = obj;
     isDragging   = true;
 }
 private string GetDefinitionPath(ModuleItem item)
 {
     return(GetDefinitionPath(p => p.ValidFor(item.Module.ModuleType), item.ClassCode, item.ClassName));
 }