Exemplo n.º 1
0
        CompileAgainstPublicly <DependentModule>(
            CModule affectedSource,
            params CModule[] additionalSources) where DependentModule : CModule, new()
        {
            var dependent = Bam.Core.Graph.Instance.FindReferencedModule <DependentModule>();

            if (null == dependent)
            {
                return;
            }
            this.DependsOn(dependent);
            var sources = new CModule[additionalSources.Length + 1];

            sources[0] = affectedSource;
            if (additionalSources.Length > 0)
            {
                additionalSources.CopyTo(sources, 1);
            }
            foreach (var source in sources)
            {
                if (null == source)
                {
                    continue;
                }
                source.UsePublicPatches(dependent);
            }
            this.UsePublicPatches(dependent);
        }
Exemplo n.º 2
0
        private void btnReadData_Click(object sender, EventArgs e)
        {
            try
            {
                btnReadData.Enabled = false;

                if (!checkSystem())
                {
                    return;
                }

                labDCV.Text          = "---";
                labDCI.Text          = "---";
                labTemp.Text         = "---";
                labMStatus.Text      = "---";
                labMStatus.ForeColor = Color.Black;

                int addr = System.Convert.ToInt16(txtAddr.Text);

                CModule module = null;

                string er = string.Empty;

                if (!comMon.ReadModuleData(addr, out module, out er))
                {
                    showInfo("读取当前地址[" + addr.ToString("D2") + "]数据失败:" + er, true);

                    return;
                }

                labDCV.Text     = module.Volt.ToString();
                labDCI.Text     = module.Current.ToString();
                labTemp.Text    = module.Temp.ToString();
                labMStatus.Text = module.Status + "|" + module.Alarm;

                if (module.Status == "正常" && module.Alarm == "正常")
                {
                    labMStatus.ForeColor = Color.Blue;
                }
                else
                {
                    labMStatus.ForeColor = Color.Red;
                }

                showInfo("读取当前地址[" + addr.ToString("D2") + "]数据");
            }
            catch (Exception ex)
            {
                labStatus.Text      = ex.ToString();
                labStatus.ForeColor = Color.Red;
            }
            finally
            {
                btnReadData.Enabled = true;
            }
        }
Exemplo n.º 3
0
    public void AddModule(string name, CModule module)
    {
        modules.Add(module);
        module.Init();

        if (module.needUpdate && !updateModules.Contains(module))
        {
            updateModules.Add(module);
        }
    }
Exemplo n.º 4
0
        /// <summary>
        /// Populate business objects from the data reader
        /// </summary>
        /// <param name="dataReader">data reader</param>
        /// <returns>list of CModule</returns>
        internal List <CModule> PopulateObjectsFromReader(IDataReader dataReader)
        {
            List <CModule> list = new List <CModule>();

            while (dataReader.Read())
            {
                CModule businessObject = new CModule();
                PopulateBusinessObjectFromReader(businessObject, dataReader);
                list.Add(businessObject);
            }
            return(list);
        }
Exemplo n.º 5
0
        CompileAgainstPublicly <DependentModule>(
            CModule affectedSource,
            params CModule[] additionalSources) where DependentModule : CModule, new()
        {
            this.CompileAgainst <DependentModule>(affectedSource, additionalSources);
            var dependent = Bam.Core.Graph.Instance.FindReferencedModule <DependentModule>();

            if (null == dependent)
            {
                return;
            }
            this.UsePublicPatches(dependent);
        }
Exemplo n.º 6
0
        /// <summary>
        /// Populate business object from data reader
        /// </summary>
        /// <param name="businessObject">business object</param>
        /// <param name="dataReader">data reader</param>
        internal void PopulateBusinessObjectFromReader(CModule businessObject, IDataReader dataReader)
        {
            businessObject.Cod_module = dataReader.GetString(dataReader.GetOrdinal(CModule.CModuleFields.Cod_module.ToString()));

            if (!dataReader.IsDBNull(dataReader.GetOrdinal(CModule.CModuleFields.Nom_module.ToString())))
            {
                businessObject.Nom_module = dataReader.GetString(dataReader.GetOrdinal(CModule.CModuleFields.Nom_module.ToString()));
            }

            if (!dataReader.IsDBNull(dataReader.GetOrdinal(CModule.CModuleFields.Description.ToString())))
            {
                businessObject.Description = dataReader.GetString(dataReader.GetOrdinal(CModule.CModuleFields.Description.ToString()));
            }
        }
Exemplo n.º 7
0
        private void OnScan()
        {
            try
            {
                string er = string.Empty;

                for (int i = _startAddr; i <= _endAddr; i++)
                {
                    if (_scanStopFlag)
                    {
                        return;
                    }

                    System.Threading.Thread.Sleep(_delayMs);

                    bool result = true;

                    string status = string.Empty;

                    CModule module = null;

                    if (!comMon.ReadModuleData(i, out module, out er))
                    {
                        System.Threading.Thread.Sleep(50);

                        if (!comMon.ReadModuleData(i, out module, out er))
                        {
                            result = false;
                        }
                    }

                    if (result)
                    {
                        status = module.Status + "|" + module.Alarm;
                    }

                    ShowID(i, status, result);

                    _rowNum++;
                }
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                ShowEnd();
            }
        }
Exemplo n.º 8
0
        CompilePubliclyAndLinkAgainst <DependentModule>(
            CModule affectedSource,
            params CModule[] additionalSources) where DependentModule : CModule, new()
        {
            var dependent = Bam.Core.Graph.Instance.FindReferencedModule <DependentModule>();

            if (null == dependent)
            {
                return;
            }
            if (dependent is C.DynamicLibrary || dependent is C.Cxx.DynamicLibrary)
            {
                this.forwardedDeps.AddUnique(dependent);
            }
            this.CompileAndLinkAgainst <DependentModule>(affectedSource, additionalSources);
            this.UsePublicPatches(dependent);
        }
Exemplo n.º 9
0
        /// <summary>
        /// Select by primary key
        /// </summary>
        /// <param name="keys">primary keys</param>
        /// <returns>CModule business object</returns>
        public CModule SelectByPrimaryKey(CModuleKeys keys)
        {
            NpgsqlCommand sqlCommand = new NpgsqlCommand();

            sqlCommand.CommandText = "public.sp_module_SelectByPrimaryKey";
            sqlCommand.CommandType = CommandType.StoredProcedure;

            // Use connection object of base class
            sqlCommand.Connection = MainConnection;

            try
            {
                sqlCommand.Parameters.Add(new NpgsqlParameter("p_cod_module", NpgsqlDbType.Varchar, 4, "", ParameterDirection.Input, false, 0, 0, DataRowVersion.Proposed, keys.Cod_module));


                MainConnection.Open();

                NpgsqlDataReader dataReader = sqlCommand.ExecuteReader();

                if (dataReader.Read())
                {
                    CModule businessObject = new CModule();

                    PopulateBusinessObjectFromReader(businessObject, dataReader);

                    return(businessObject);
                }
                else
                {
                    return(null);
                }
            }
            catch (Exception ex)
            {
                throw new Exception("CModule::SelectByPrimaryKey::Error occured.", ex);
            }
            finally
            {
                MainConnection.Close();
                sqlCommand.Dispose();
            }
        }
Exemplo n.º 10
0
        CompileAgainst <DependentModule>(
            CModule affectedSource,
            params CModule[] additionalSources) where DependentModule : CModule, new()
        {
            var dependent = Bam.Core.Graph.Instance.FindReferencedModule <DependentModule>();

            if (null == dependent)
            {
                return;
            }
            var sources = new CModule[additionalSources.Length + 1];

            sources[0] = affectedSource;
            if (additionalSources.Length > 0)
            {
                additionalSources.CopyTo(sources, 1);
            }
            foreach (var source in sources)
            {
                if (null == source)
                {
                    continue;
                }
                source.UsePublicPatches(dependent);
            }
            if (dependent is HeaderLibrary)
            {
                this.Requires(dependent);
            }
            // this delays the dependency until a link
            // (and recursively checks the dependent for more forwarded dependencies)
            // because there is no explicit DependsOn call, perform a cyclic dependency check here too
            if (dependent is IForwardedLibraries)
            {
                if ((dependent as IForwardedLibraries).ForwardedLibraries.Contains(this))
                {
                    throw new Bam.Core.Exception("Cyclic dependency found between {0} and {1}", this.ToString(), dependent.ToString());
                }
            }
            this.forwardedDeps.AddUnique(dependent);
        }
Exemplo n.º 11
0
        /// <summary>
        /// update row in the table
        /// </summary>
        /// <param name="businessObject">business object</param>
        /// <returns>true for successfully updated</returns>
        public bool Update(CModule businessObject)
        {
            NpgsqlCommand sqlCommand = new NpgsqlCommand();

            sqlCommand.CommandText = "public.sp_module_Update";
            sqlCommand.CommandType = CommandType.StoredProcedure;

            // Use connection object of base class
            sqlCommand.Connection = MainConnection;

            try
            {
                sqlCommand.Parameters.AddWithValue("p_cod_module", businessObject.Cod_module);
                sqlCommand.Parameters["p_cod_module"].NpgsqlDbType = NpgsqlDbType.Varchar;
                sqlCommand.Parameters.AddWithValue("p_nom_module", businessObject.Nom_module);
                sqlCommand.Parameters["p_nom_module"].NpgsqlDbType = NpgsqlDbType.Varchar;
                sqlCommand.Parameters.AddWithValue("p_description", businessObject.Description);
                sqlCommand.Parameters["p_description"].NpgsqlDbType = NpgsqlDbType.Varchar;


                MainConnection.Open();

                if (Convert.ToInt32(sqlCommand.ExecuteScalar()) > 0)
                {
                    return(true);
                }
                return(false);
            }
            catch (Exception ex)
            {
                throw new Exception("CModule::Update::Error occured.", ex);
            }
            finally
            {
                MainConnection.Close();
                sqlCommand.Dispose();
            }
        }
Exemplo n.º 12
0
        /// <summary>
        /// insert new row in the table
        /// </summary>
        /// <param name="businessObject">business object</param>
        /// <returns>true of successfully insert</returns>
        public bool Insert(CModule businessObject)
        {
            NpgsqlCommand sqlCommand = new NpgsqlCommand();

            sqlCommand.CommandText = "public.sp_module_Insert";
            sqlCommand.CommandType = CommandType.StoredProcedure;

            // Use connection object of base class
            sqlCommand.Connection = MainConnection;

            try
            {
                sqlCommand.Parameters.AddWithValue("p_cod_module", businessObject.Cod_module);
                sqlCommand.Parameters["p_cod_module"].NpgsqlDbType = NpgsqlDbType.Varchar;
                sqlCommand.Parameters.AddWithValue("p_nom_module", businessObject.Nom_module);
                sqlCommand.Parameters["p_nom_module"].NpgsqlDbType = NpgsqlDbType.Varchar;
                sqlCommand.Parameters.AddWithValue("p_description", businessObject.Description);
                sqlCommand.Parameters["p_description"].NpgsqlDbType = NpgsqlDbType.Varchar;


                MainConnection.Open();

                sqlCommand.ExecuteNonQuery();

                return(true);
            }
            catch (Exception ex)
            {
                throw new Exception("CModule::Insert::Error occured.", ex);
            }
            finally
            {
                MainConnection.Close();
                sqlCommand.Dispose();
            }
        }
Exemplo n.º 13
0
 public abstract void ProcessLibraryDependency(
     CModule executable,
     CModule library);
Exemplo n.º 14
0
 public abstract void ProcessLibraryDependency(
     CModule executable,
     CModule library);
Exemplo n.º 15
0
        public string GetModule(string InputValue)
        {
            IList <CModule> list = new CModuleDao().GetModuleByUser(InputValue);

            return(CModule.ToCSV <CModule>(list));
        }
Exemplo n.º 16
0
        /// <summary>
        /// Load preferences object
        /// </summary>
        private void LoadPrefs(UserPrefs p)
        {
            SetProject(p.LanguageCode, p.Project, p.CustomProject);

            FindAndReplace.Clear();
            chkFindandReplace.Checked      = p.FindAndReplace.Enabled;
            FindAndReplace.IgnoreLinks     = p.FindAndReplace.IgnoreSomeText;
            FindAndReplace.IgnoreMore      = p.FindAndReplace.IgnoreMoreText;
            FindAndReplace.AppendToSummary = p.FindAndReplace.AppendSummary;
            FindAndReplace.AfterOtherFixes = p.FindAndReplace.AfterOtherFixes;
            FindAndReplace.AddNew(p.FindAndReplace.Replacements);

            RplcSpecial.Clear();
            RplcSpecial.AddNewRule(p.FindAndReplace.AdvancedReps);

            SubstTemplates.Clear();
            SubstTemplates.TemplateList      = p.FindAndReplace.SubstTemplates;
            SubstTemplates.ExpandRecursively = p.FindAndReplace.ExpandRecursively;
            SubstTemplates.IgnoreUnformatted = p.FindAndReplace.IgnoreUnformatted;
            SubstTemplates.IncludeComments   = p.FindAndReplace.IncludeComments;

            FindAndReplace.MakeList();

            listMaker.SourceText     = p.List.ListSource;
            listMaker.SelectedSource = p.List.SourceIndex;

            SaveArticleList = p.General.SaveArticleList;

            IgnoreNoBots = p.General.IgnoreNoBots;

            listMaker.Add(p.List.ArticleList);

            chkGeneralFixes.Checked   = p.Editprefs.GeneralFixes;
            chkAutoTagger.Checked     = p.Editprefs.Tagger;
            chkUnicodifyWhole.Checked = p.Editprefs.Unicodify;

            cmboCategorise.SelectedIndex = p.Editprefs.Recategorisation;
            txtNewCategory.Text          = p.Editprefs.NewCategory;
            txtNewCategory2.Text         = p.Editprefs.NewCategory2;

            cmboImages.SelectedIndex = p.Editprefs.ReImage;
            txtImageReplace.Text     = p.Editprefs.ImageFind;
            txtImageWith.Text        = p.Editprefs.Replace;

            chkSkipNoCatChange.Checked = p.Editprefs.SkipIfNoCatChange;
            chkRemoveSortKey.Checked   = p.Editprefs.RemoveSortKey;
            chkSkipNoImgChange.Checked = p.Editprefs.SkipIfNoImgChange;

            chkAppend.Checked     = p.Editprefs.AppendText;
            rdoAppend.Checked     = p.Editprefs.Append;
            rdoPrepend.Checked    = !p.Editprefs.Append;
            txtAppendMessage.Text = p.Editprefs.Text;
            udNewlineChars.Value  = p.Editprefs.Newlines;

            nudBotSpeed.Value      = p.Editprefs.AutoDelay;
            chkSuppressTag.Checked = p.Editprefs.SupressTag;

            chkRegExTypo.Checked = p.Editprefs.RegexTypoFix;

            radSkipNonExistent.Checked       = p.SkipOptions.SkipNonexistent;
            radSkipExistent.Checked          = p.SkipOptions.Skipexistent;
            chkSkipNoChanges.Checked         = p.SkipOptions.SkipWhenNoChanges;
            chkSkipSpamFilter.Checked        = p.SkipOptions.SkipSpamFilterBlocked;
            chkSkipIfInuse.Checked           = p.SkipOptions.SkipInuse;
            chkSkipWhitespace.Checked        = p.SkipOptions.SkipWhenOnlyWhitespaceChanged;
            chkSkipCasing.Checked            = p.SkipOptions.SkipOnlyCasingChanged;
            chkSkipGeneralFixes.Checked      = p.SkipOptions.SkipOnlyGeneralFixChanges;
            chkSkipMinorGeneralFixes.Checked = p.SkipOptions.SkipOnlyMinorGeneralFixChanges;
            chkSkipIfRedirect.Checked        = p.SkipOptions.SkipIfRedirect;
            chkSkipIfNoAlerts.Checked        = p.SkipOptions.SkipIfNoAlerts;

            chkSkipIfContains.Checked    = p.SkipOptions.SkipDoes;
            chkSkipIfNotContains.Checked = p.SkipOptions.SkipDoesNot;

            txtSkipIfContains.Text    = p.SkipOptions.SkipDoesText;
            txtSkipIfNotContains.Text = p.SkipOptions.SkipDoesNotText;

            chkSkipIsRegex.Checked       = p.SkipOptions.Regex;
            chkSkipCaseSensitive.Checked = p.SkipOptions.CaseSensitive;

            chkSkipWhenNoFAR.Checked     = p.SkipOptions.SkipNoFindAndReplace;
            chkSkipIfNoRegexTypo.Checked = p.SkipOptions.SkipNoRegexTypoFix;
            Skip.SelectedItems           = p.SkipOptions.GeneralSkipList;
            chkSkipNoDab.Checked         = p.SkipOptions.SkipNoDisambiguation;
            chkSkipNoPageLinks.Checked   = p.SkipOptions.SkipNoLinksOnPage;

            cmboEditSummary.Items.Clear();

            if (p.General.Summaries.Count == 0)
            {
                LoadDefaultEditSummaries();
            }
            else
            {
                foreach (string s in p.General.Summaries)
                {
                    cmboEditSummary.Items.Add(s);
                }
            }

            chkLock.Checked    = p.General.LockSummary;
            EditToolBarVisible = p.General.EditToolbarEnabled;

            cmboEditSummary.Text = p.General.SelectedSummary;

            if (chkLock.Checked)
            {
                lblSummary.Text = p.General.SelectedSummary;
            }

            PasteMore1.Text  = p.General.PasteMore[0];
            PasteMore2.Text  = p.General.PasteMore[1];
            PasteMore3.Text  = p.General.PasteMore[2];
            PasteMore4.Text  = p.General.PasteMore[3];
            PasteMore5.Text  = p.General.PasteMore[4];
            PasteMore6.Text  = p.General.PasteMore[5];
            PasteMore7.Text  = p.General.PasteMore[6];
            PasteMore8.Text  = p.General.PasteMore[7];
            PasteMore9.Text  = p.General.PasteMore[8];
            PasteMore10.Text = p.General.PasteMore[9];

            txtFind.Text                 = p.General.FindText;
            chkFindRegex.Checked         = p.General.FindRegex;
            chkFindCaseSensitive.Checked = p.General.FindCaseSensitive;

            wordWrapToolStripMenuItem1.Checked = p.General.WordWrap;
            EnableToolBar = p.General.ToolBarEnabled;
            bypassRedirectsToolStripMenuItem.Checked            = p.General.BypassRedirect;
            autoSaveSettingsToolStripMenuItem.Checked           = p.General.AutoSaveSettings;
            preParseModeToolStripMenuItem.Checked               = p.General.PreParseMode;
            noSectionEditSummaryToolStripMenuItem.Checked       = p.General.noSectionEditSummary;
            restrictDefaultsortChangesToolStripMenuItem.Checked = p.General.restrictDefaultsortAddition;
            noMOSComplianceFixesToolStripMenuItem.Checked       = p.General.noMOSComplianceFixes;
            syntaxHighlightEditBoxToolStripMenuItem.Checked     = p.General.syntaxHighlightEditBox;
            automaticallyDoAnythingToolStripMenuItem.Checked    = !p.General.NoAutoChanges;
            toolStripComboOnLoad.SelectedIndex = p.General.OnLoadAction;
            chkMinor.Checked = p.General.Minor;
            addAllToWatchlistToolStripMenuItem.Checked  = p.General.Watch;
            dontAddToWatchlistToolStripMenuItem.Checked = p.General.DoNotWatch;
            ShowMovingAverageTimer = p.General.TimerEnabled;

            sortAlphabeticallyToolStripMenuItem.Checked          = p.General.SortListAlphabetically;
            displayfalsePositivesButtonToolStripMenuItem.Checked = p.General.AddIgnoredToLog;

            AutoSaveEditBoxEnabled = p.General.AutoSaveEdit.Enabled;
            AutoSaveEditBoxPeriod  = p.General.AutoSaveEdit.SavePeriod;
            AutoSaveEditBoxFile    = p.General.AutoSaveEdit.SaveFile;

            SuppressUsingAWB           = p.General.SuppressUsingAWB;
            AddUsingAWBOnArticleAction = p.General.AddUsingAWBToActionSummaries;

            filterOutNonMainSpaceToolStripMenuItem.Checked = p.General.filterNonMainSpace;
            removeDuplicatesToolStripMenuItem.Checked      = p.General.AutoFilterDuplicates;

            alphaSortInterwikiLinksToolStripMenuItem.Checked    = p.General.SortInterWikiOrder;
            replaceReferenceTagsToolStripMenuItem.Checked       = p.General.ReplaceReferenceTags;
            focusAtEndOfEditTextBoxToolStripMenuItem.Checked    = p.General.FocusAtEndOfEditBox;
            scrollToUnbalancedBracketsToolStripMenuItem.Checked = p.General.scrollToUnbalancedBrackets;

            txtEdit.Font = new System.Drawing.Font(p.General.TextBoxFont, p.General.TextBoxSize);

            LowThreadPriority = p.General.LowThreadPriority;
            Flash             = p.General.Flash;
            Beep = p.General.Beep;

            Minimize = p.General.Minimize;
            TimeOut  = p.General.TimeOutLimit;
            webBrowserEdit.TimeoutLimit = int.Parse(TimeOut.ToString());

            chkEnableDab.Checked = p.Disambiguation.Enabled;
            txtDabLink.Text      = p.Disambiguation.Link;
            txtDabVariants.Lines = p.Disambiguation.Variants;
            udContextChars.Value = p.Disambiguation.ContextChars;

            listMaker.SpecialFilterSettings = p.Special;

            loggingSettings1.SerialisableSettings = p.Logging;

            CModule.ModuleEnabled = p.Module.Enabled;
            CModule.Language      = p.Module.Language;
            CModule.Code          = p.Module.Code.Replace("\n", "\r\n");
            if (CModule.ModuleEnabled)
            {
                CModule.MakeModule();
            }
            else
            {
                CModule.SetModuleNotBuilt();
            }

            ExtProgram.Settings = p.ExternalProgram;

            foreach (PluginPrefs pp in p.Plugin)
            {
                if (Plugin.Items.ContainsKey(pp.Name))
                {
                    Plugin.Items[pp.Name].LoadSettings(pp.PluginSettings);
                }
            }
        }
Exemplo n.º 17
0
        private LayoutModel ProcessStaticLayout(string ID, LayoutModel layout)
        {
            var itemCtrl = _menu.GetControl.SingleOrDefault(o => o.Code.ToLower() == layout.TypeView.ToLower());

            if (itemCtrl == null)
            {
                itemCtrl = new CModule()
                {
                    Code       = "Static",
                    FullName   = "",
                    Name       = "No Exist",
                    Properties = null
                };
            }
            var properties = itemCtrl.Properties;

            layout.LayoutName += "(" + itemCtrl.Name + ")";
            layout.CModule     = itemCtrl.FullName;
            var detailsTemplate             = _templateDetailsService.GetItemStaticByID(ID, layout.PartialID);
            List <ProperyCModule> properyCs = new List <ProperyCModule>();

            if (detailsTemplate != null)
            {
                layout.TypeView    = detailsTemplate.TypeView;
                layout.PartialView = detailsTemplate.PartialView;
                var property = _propertyService.Find(true, o => o.TemplateDetailID == detailsTemplate.ID)?.ToList();

                if (property != null && properties != null)
                {
                    string _continue = "";
                    for (int x = 0; x < properties.Count; x++)
                    {
                        var            itemPro  = properties[x];
                        ProperyCModule properyC = new ProperyCModule()
                        {
                            Key   = itemPro.Key,
                            Name  = itemPro.Name,
                            Type  = itemPro.Type,
                            Value = itemPro.Value
                        };
                        foreach (var itemzPRo in property)
                        {
                            if (_continue != "" && _continue == itemzPRo.Name)
                            {
                                continue;
                            }
                            if (itemPro.Key == itemzPRo.Name)
                            {
                                properyC.Value = itemzPRo.Value;
                                _continue      = itemzPRo.Name;
                                break;
                            }
                        }
                        properyCs.Add(properyC);
                    }
                    layout.Properties = properyCs;
                }
                else
                {
                    layout.Properties = properties;
                }
            }
            else
            {
                layout.Properties = properties;
            }
            return(layout);
        }
Exemplo n.º 18
0
        private LayoutModel ProccessDynamicLayout(SysTemplateDetailEntity dItem)
        {
            LayoutModel dLI = new LayoutModel
            {
                LayoutName    = dItem.LayoutName,
                CModule       = dItem.CModule,
                PartialID     = dItem.PartialID,
                ParrentLayout = dItem.ParentID,
                IsDynamic     = true,
                IsBody        = dItem.IsBody,
                PartialView   = dItem.PartialView,
                TypeView      = dItem.TypeView,
                Order         = dItem.Order
            };

            if (!dItem.IsBody)
            {
                var itemCtrl = _menu.GetControl.SingleOrDefault(o => o.FullName.ToLower() == dItem.CModule.ToLower());
                if (itemCtrl == null)
                {
                    itemCtrl = new CModule()
                    {
                        Code       = "Static",
                        FullName   = "",
                        Name       = "No Exist",
                        Properties = null
                    };
                }
                var properties = itemCtrl.Properties;
                var property   = _propertyService.Find(true, o => o.TemplateDetailID == dItem.ID)?.ToList();
                if (property != null && properties != null)
                {
                    List <ProperyCModule> properyCs = new List <ProperyCModule>();
                    string _continue = "";
                    for (int z = 0; z < properties.Count; z++)
                    {
                        var            itemPro  = properties[z];
                        ProperyCModule properyC = new ProperyCModule()
                        {
                            Key   = itemPro.Key,
                            Name  = itemPro.Name,
                            Type  = itemPro.Type,
                            Value = itemPro.Value
                        };
                        foreach (var itemzPRo in property)
                        {
                            if (_continue != "" && _continue == itemzPRo.Name)
                            {
                                continue;
                            }
                            if (itemPro.Key == itemzPRo.Name)
                            {
                                properyC.Value = itemzPRo.Value;
                                _continue      = itemzPRo.Name;
                                break;
                            }
                        }
                        properyCs.Add(properyC);
                    }
                    dLI.Properties = properyCs;
                }
            }
            return(dLI);
        }
Exemplo n.º 19
0
        /// <summary>
        /// Load preferences object
        /// </summary>
        private void LoadPrefs(UserPrefs p)
        {
            chkRegExTypo.Checked = false;
            SetProject(p.LanguageCode, p.Project, p.CustomProject, p.Protocol);
            chkRegExTypo.Checked  = p.Editprefs.RegexTypoFix;
            Variables.LoginDomain = p.LoginDomain;

            FindAndReplace.Clear();
            chkFindandReplace.Checked      = p.FindAndReplace.Enabled;
            FindAndReplace.IgnoreLinks     = p.FindAndReplace.IgnoreSomeText;
            FindAndReplace.IgnoreMore      = p.FindAndReplace.IgnoreMoreText;
            FindAndReplace.AppendToSummary = p.FindAndReplace.AppendSummary;
            FindAndReplace.AddNew(p.FindAndReplace.Replacements);

            RplcSpecial.Clear();
            RplcSpecial.AddNewRule(p.FindAndReplace.AdvancedReps);

            SubstTemplates.Clear();
            SubstTemplates.TemplateList      = p.FindAndReplace.SubstTemplates;
            SubstTemplates.ExpandRecursively = p.FindAndReplace.ExpandRecursively;
            SubstTemplates.IgnoreUnformatted = p.FindAndReplace.IgnoreUnformatted;
            SubstTemplates.IncludeComments   = p.FindAndReplace.IncludeComments;

            FindAndReplace.MakeList();

            listMaker.SourceText       = p.List.ListSource;
            listMaker.SelectedProvider = p.List.SelectedProvider;

            _saveArticleList = p.General.SaveArticleList;

            IgnoreNoBots = p.General.IgnoreNoBots;
            ClearPageListOnProjectChange = p.General.ClearPageListOnProjectChange;

            chkGeneralFixes.Checked   = p.Editprefs.GeneralFixes;
            chkAutoTagger.Checked     = p.Editprefs.Tagger;
            chkUnicodifyWhole.Checked = p.Editprefs.Unicodify;

            cmboCategorise.SelectedIndex = p.Editprefs.Recategorisation;
            txtNewCategory.Text          = p.Editprefs.NewCategory;
            txtNewCategory2.Text         = p.Editprefs.NewCategory2;

            cmboImages.SelectedIndex = p.Editprefs.ReImage;
            txtImageReplace.Text     = p.Editprefs.ImageFind;
            txtImageWith.Text        = p.Editprefs.Replace;

            chkSkipNoCatChange.Checked = p.Editprefs.SkipIfNoCatChange;
            chkRemoveSortKey.Checked   = p.Editprefs.RemoveSortKey;
            chkSkipNoImgChange.Checked = p.Editprefs.SkipIfNoImgChange;

            chkAppend.Checked             = p.Editprefs.AppendText;
            chkAppendMetaDataSort.Checked = p.Editprefs.AppendTextMetaDataSort;
            rdoAppend.Checked             = p.Editprefs.Append;
            rdoPrepend.Checked            = !p.Editprefs.Append;
            txtAppendMessage.Text         = p.Editprefs.Text;
            udNewlineChars.Value          = p.Editprefs.Newlines;

            nudBotSpeed.Value      = p.Editprefs.AutoDelay;
            botEditsStop.Value     = p.Editprefs.BotMaxEdits;
            chkSuppressTag.Checked = p.Editprefs.SupressTag;

            radSkipNonExistent.Checked       = p.SkipOptions.SkipNonexistent;
            radSkipExistent.Checked          = p.SkipOptions.Skipexistent;
            radSkipNone.Checked              = p.SkipOptions.SkipDontCare;
            chkSkipNoChanges.Checked         = p.SkipOptions.SkipWhenNoChanges;
            chkSkipSpamFilter.Checked        = p.SkipOptions.SkipSpamFilterBlocked;
            chkSkipIfInuse.Checked           = p.SkipOptions.SkipInuse;
            chkSkipWhitespace.Checked        = p.SkipOptions.SkipWhenOnlyWhitespaceChanged;
            chkSkipCasing.Checked            = p.SkipOptions.SkipOnlyCasingChanged;
            chkSkipGeneralFixes.Checked      = p.SkipOptions.SkipOnlyGeneralFixChanges;
            chkSkipMinorGeneralFixes.Checked = p.SkipOptions.SkipOnlyMinorGeneralFixChanges;
            chkSkipCosmetic.Checked          = p.SkipOptions.SkipOnlyCosmetic;
            chkSkipIfRedirect.Checked        = p.SkipOptions.SkipIfRedirect;
            chkSkipIfNoAlerts.Checked        = p.SkipOptions.SkipIfNoAlerts;

            skipIfContains.CheckEnabled    = p.SkipOptions.SkipDoes;
            skipIfContains.CheckText       = p.SkipOptions.SkipDoesText;
            skipIfContains.IsRegex         = p.SkipOptions.SkipDoesRegex;
            skipIfContains.IsCaseSensitive = p.SkipOptions.SkipDoesCaseSensitive;
            skipIfContains.After           = p.SkipOptions.SkipDoesAfterProcessing;

            skipIfNotContains.CheckEnabled    = p.SkipOptions.SkipDoesNot;
            skipIfNotContains.CheckText       = p.SkipOptions.SkipDoesNotText;
            skipIfNotContains.IsRegex         = p.SkipOptions.SkipDoesNotRegex;
            skipIfNotContains.IsCaseSensitive = p.SkipOptions.SkipDoesNotCaseSensitive;
            skipIfNotContains.After           = p.SkipOptions.SkipDoesNotAfterProcessing;

            chkSkipWhenNoFAR.Checked     = p.SkipOptions.SkipNoFindAndReplace;
            chkSkipOnlyMinorFaR.Checked  = p.SkipOptions.SkipMinorFindAndReplace;
            chkSkipIfNoRegexTypo.Checked = p.SkipOptions.SkipNoRegexTypoFix;
            Skip.SelectedItems           = p.SkipOptions.GeneralSkipList;
            chkSkipNoDab.Checked         = p.SkipOptions.SkipNoDisambiguation;
            chkSkipNoPageLinks.Checked   = p.SkipOptions.SkipNoLinksOnPage;

            cmboEditSummary.Items.Clear();

            if (p.General.Summaries.Count == 0)
            {
                LoadDefaultEditSummaries();
            }
            else
            {
                foreach (string s in p.General.Summaries)
                {
                    cmboEditSummary.Items.Add(s);
                }
            }

            chkLock.Checked    = p.General.LockSummary;
            EditToolBarVisible = p.General.EditToolbarEnabled;

            cmboEditSummary.Text = p.General.SelectedSummary;

            if (chkLock.Checked)
            {
                lblSummary.Text = p.General.SelectedSummary;
            }

            for (int i = 0; i < 10; ++i)
            {
                SetPasteMoreText(i, p.General.PasteMore[i]);
            }

            txtFind.Text                 = p.General.FindText;
            chkFindRegex.Checked         = p.General.FindRegex;
            chkFindCaseSensitive.Checked = p.General.FindCaseSensitive;

            wordWrapToolStripMenuItem1.Checked = p.General.WordWrap;
            EnableToolBar = p.General.ToolBarEnabled;
            followRedirectsToolStripMenuItem.Checked            = p.General.BypassRedirect;
            autoSaveSettingsToolStripMenuItem.Checked           = p.General.AutoSaveSettings;
            preParseModeToolStripMenuItem.Checked               = p.General.PreParseMode;
            noSectionEditSummaryToolStripMenuItem.Checked       = p.General.noSectionEditSummary;
            restrictDefaultsortChangesToolStripMenuItem.Checked = p.General.restrictDefaultsortAddition;
            restrictOrphanTaggingToolStripMenuItem.Checked      = p.General.restrictOrphanTagging;
            noMOSComplianceFixesToolStripMenuItem.Checked       = p.General.noMOSComplianceFixes;
            syntaxHighlightEditBoxToolStripMenuItem.Checked     = p.General.syntaxHighlightEditBox;
            highlightAllFindToolStripMenuItem.Checked           = p.General.highlightAllFind;
            automaticallyDoAnythingToolStripMenuItem.Checked    = !p.General.NoAutoChanges;
            actionOnLoad                 = p.General.OnLoadAction;
            doDiffInBotMode              = p.General.DiffInBotMode;
            chkMinor.Checked             = p.General.Minor;
            addToWatchList.SelectedIndex = p.General.AddToWatchlist;
            ShowMovingAverageTimer       = p.General.TimerEnabled;
            alertPreferences             = p.General.AlertPreferences;

            sortAlphabeticallyToolStripMenuItem.Checked          = listMaker.AutoAlpha = p.General.SortListAlphabetically;
            displayfalsePositivesButtonToolStripMenuItem.Checked = p.General.AddIgnoredToLog;

            _autoSaveEditBoxEnabled = p.General.AutoSaveEdit.Enabled;
            AutoSaveEditBoxPeriod   = p.General.AutoSaveEdit.SavePeriod;
            _autoSaveEditBoxFile    = p.General.AutoSaveEdit.SaveFile;

            _suppressUsingAWB = p.General.SuppressUsingAWB;
            Article.AddUsingAWBOnArticleAction = p.General.AddUsingAWBToActionSummaries;

            filterOutNonMainSpaceToolStripMenuItem.Checked = p.General.filterNonMainSpace;
            removeDuplicatesToolStripMenuItem.Checked      = listMaker.FilterDuplicates = p.General.AutoFilterDuplicates;

            alphaSortInterwikiLinksToolStripMenuItem.Checked = p.General.SortInterWikiOrder;
            replaceReferenceTagsToolStripMenuItem.Checked    = p.General.ReplaceReferenceTags;
            focusAtEndOfEditTextBoxToolStripMenuItem.Checked = p.General.FocusAtEndOfEditBox;
            scrollToAlertsToolStripMenuItem.Checked          = p.General.scrollToUnbalancedBrackets;

            txtEdit.Font = new System.Drawing.Font(p.General.TextBoxFont, p.General.TextBoxSize);

            loggingEnabled = p.General.LoggingEnabled;

            LowThreadPriority = p.General.LowThreadPriority;
            _flash            = p.General.Flash;
            _beep             = p.General.Beep;

            _minimize = p.General.Minimize;

            chkEnableDab.Checked = p.Disambiguation.Enabled;
            txtDabLink.Text      = p.Disambiguation.Link;
            txtDabVariants.Lines = p.Disambiguation.Variants;
            udContextChars.Value = p.Disambiguation.ContextChars;

            listMaker.SpecialFilterSettings = p.Special;
            // ensure listmaker is only populated once listmaker filter settings (remove non-mainpace etc.) have been loaded
            listMaker.Add(p.List.ArticleList);

            CModule.Language = p.Module.Language;
            CModule.Code     = p.Module.Code.Replace("\n", "\r\n");
            // Don't enable custom module until code loaded, prevents phantom compile error
            CModule.ModuleEnabled = p.Module.Enabled;
            if (!CModule.ModuleEnabled)
            {
                CModule.SetModuleNotBuilt();
            }

            ExtProgram.Settings = p.ExternalProgram;

            _listComparerUseCurrentArticleList = p.Tool.ListComparerUseCurrentArticleList;
            _listSplitterUseCurrentArticleList = p.Tool.ListSplitterUseCurrentArticleList;
            _dbScannerUseCurrentArticleList    = p.Tool.DatabaseScannerUseCurrentArticleList;

            foreach (PluginPrefs pp in p.Plugin)
            {
                IAWBPlugin plugin;
                if (Plugin.AWBPlugins.TryGetValue(pp.Name, out plugin))
                {
                    plugin.LoadSettings(pp.PluginSettings);
                }
            }
        }
Exemplo n.º 20
0
 public abstract Bam.Core.TokenizedString GetLibraryPath(
     CModule library);