コード例 #1
0
 public void Collect(IEnumerable<Mono.Cecil.TypeDefinition> tds, TypeCollection typeCollection, ConfigBase config)
 {
     foreach (var item in tds)
     {
         Collect(item, typeCollection, config);
     }
 }
コード例 #2
0
        public ITypeWriter PickTypeWriter(Mono.Cecil.TypeDefinition td, int indentCount, TypeCollection typeCollection, ConfigBase config)
        {
            if (td.IsEnum)
            {
                return new EnumWriter(td, indentCount, typeCollection, config);
            }

            if (td.IsInterface)
            {
                return new InterfaceWriter(td, indentCount, typeCollection, config);
            }

            if (td.IsClass)
            {
                
                if (td.BaseType.FullName == "System.MulticastDelegate" ||
                    td.BaseType.FullName == "System.Delegate")
                {
                    return new DelegateWriter(td, indentCount, typeCollection, config);
                }

                return new ClassWriter(td, indentCount, typeCollection, config);
            }

            throw new NotImplementedException("Could not get a type to generate for:" + td.FullName);
        }
コード例 #3
0
        public void Collect(Mono.Cecil.TypeDefinition td, TypeCollection typeCollection, ConfigBase config)
        {
            if (td.ShouldIgnoreType())
            {
                return;
            }

            // don't duplicate types
            if (typeCollection.Contains(td.FullName))
            {
                return;
            }

            StringBuilder sb = new StringBuilder();
            var indentCount = 0;
            ITypeWriter typeWriter = typeSelector.PickTypeWriter(td, indentCount, typeCollection, config);

            td.Interfaces.Each(item =>
            {
                var foundType = typeCollection.LookupType(item);

                if (foundType == null)
                {
                    //TODO: This reporting a missing type is too early in the process.
                    // typeNotFoundErrorHandler.Handle(item);
                    return;
                }

                var itemWriter = typeSelector.PickTypeWriter(foundType, indentCount, typeCollection, config);
                typeCollection.Add(foundType.Namespace, foundType.Name, itemWriter);

            });

            typeCollection.Add(td.Namespace, td.Name, typeWriter);
        }
コード例 #4
0
 public TypeWriterBase(TypeDefinition typeDefinition, int indentCount, TypeCollection typeCollection, ConfigBase config)
 {
     this.TypeDefinition = typeDefinition;
     this.IndentCount = indentCount;
     this.TypeCollection = typeCollection;
     this.Config = config;
 }
コード例 #5
0
ファイル: ConfigPanelBase.cs プロジェクト: MuteG/DevTools
 private void SetConfig(ConfigBase config)
 {
     this.config = config;
     if (config != null)
     {
         ShowConfig(config);
     }
 }
コード例 #6
0
        public ConfigurationObjectControlPanel(ConfigBase config, string frame)
            : this()
        {
            mConfig = config;

            foreach (var parameter in mConfig.Parameters.Where(p => p.Section == frame)) {
                LoadParameter(parameter);
            }
        }
コード例 #7
0
        public ConfigurationObjectControlPanel(ConfigBase config)
            : this()
        {
            mConfig = config;

            foreach (var parameter in mConfig.Parameters.OrderBy(p => p.Section)) {
                LoadParameter(parameter);
            }
        }
コード例 #8
0
        public ConfigurationObjectControlPanel(ConfigBase config, string[] frames)
            : this()
        {
            mConfig = config;

            foreach (var parameter in mConfig.Parameters.Where(p => !frames.Contains(p.Section))) {
                LoadParameter(parameter);
            }
        }
コード例 #9
0
 public OutParameterReturnTypeWriter(ConfigBase config, int indentCount, Mono.Cecil.TypeDefinition TypeDefinition, string methodName, TypeReference retrunTypeReference, List<ParameterDefinition> outTypes)
 {
     this.config = config;
     this.IndentCount = indentCount;
     this.TypeDefinition = TypeDefinition;
     this.MethodName = methodName;
     this.ReturnTypeReference = retrunTypeReference;
     this.OutTypes = outTypes;
 }
コード例 #10
0
        public ITypeWriter PickTypeWriter(Mono.Cecil.TypeDefinition td, int indentCount, TypeCollection typeCollection, ConfigBase config)
        {
            var castedConfig = (DotNetConfig)config;
            if (td.IsEnum)
            {
                return new EnumWriter(td, indentCount, typeCollection, config);
            }

            if (td.IsInterface)
            {
                return new InterfaceWriter(td, indentCount, typeCollection, castedConfig);
            }

            if (td.IsClass)
            {
                return new ClassWriter(td, indentCount, typeCollection, castedConfig);
            }

            throw new NotImplementedException("Could not get a type to generate for:" + td.FullName);
        }
コード例 #11
0
ファイル: ConfigPanelBase.cs プロジェクト: MuteG/DevTools
 protected virtual void ShowConfig(ConfigBase config)
 {
 }
コード例 #12
0
ファイル: DetailPage.cs プロジェクト: a592955699/Sniffer
 public DetailPage(PageBase parent, ConfigBase config)
     : base(parent, config)
 {
 }
コード例 #13
0
 protected void AddChildNode(ConfigBase childObj)
 {
     _childNodes.Add(new ConfigurationNode(childObj, this));
 }
コード例 #14
0
ファイル: ConfigSystem.cs プロジェクト: pointcache/URSA
 public static void RegisterConfig(ConfigBase cfg)
 {
     m_configs.Add(cfg.GetType(), cfg);
 }
コード例 #15
0
ファイル: ExplorerBuilder.cs プロジェクト: zuoyangithub/scada
 /// <summary>
 /// Fills the channel table nodes, creating child nodes.
 /// </summary>
 public void FillChannelTableNodes(TreeNode inCnlTableNode, TreeNode ctrlCnlTableNode, ConfigBase configBase)
 {
     try
     {
         treeView.BeginUpdate();
         inCnlTableNode.Nodes.Clear();
         ctrlCnlTableNode.Nodes.Clear();
         FillCnlTableNodes(inCnlTableNode, ctrlCnlTableNode, configBase);
     }
     finally
     {
         treeView.EndUpdate();
     }
 }
コード例 #16
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ServiceBusManager" /> class.
 /// </summary>
 /// <param name="connectionString">The connection string.</param>
 /// <param name="entityConfig">The entity configuration.</param>
 internal ServiceBusManager(string connectionString, ConfigBase entityConfig)
 {
     ConnectionString = connectionString;
     _entityConfig    = entityConfig;
 }
コード例 #17
0
ファイル: Program.cs プロジェクト: sumitkm/ToTypeScriptD
        static void Main(string[] args)
        {
            ConfigBase config = null;

            var options = new Options();

            string verbInvoked = null;

            if (CommandLine.Parser.Default.ParseArgumentsStrict(args, options, (verb, subOptions) =>
            {
                verb = (verb ?? "").ToLowerInvariant();
                verbInvoked = verb;
                if (verb == Options.DotNetCommandName)
                {
                    var dotNetSubOptions = subOptions as DotNetSubOptions;
                    if (dotNetSubOptions != null)
                    {
                        config = new ToTypeScriptD.Core.DotNet.DotNetConfig
                        {
                            AssemblyPaths = dotNetSubOptions.Files,
                            CamelBackCase = dotNetSubOptions.CamelBackCase,
                            IncludeSpecialTypes = dotNetSubOptions.IncludeSpecialTypeDefinitions,
                            IndentationType = dotNetSubOptions.IndentationType,
                            RegexFilter = dotNetSubOptions.RegexFilter,
                            TypeNotFoundErrorHandler = new ConsoleErrorTypeNotFoundErrorHandler(),
                        };
                    }
                }
                else if (verb == Options.WinmdCommandName)
                {
                    var winmdSubOptions = subOptions as WinmdSubOptions;
                    if (winmdSubOptions != null)
                    {
                        config = new ToTypeScriptD.Core.WinMD.WinmdConfig
                        {
                            AssemblyPaths = winmdSubOptions.Files,
                            IncludeSpecialTypes = winmdSubOptions.IncludeSpecialTypeDefinitions,
                            IndentationType = winmdSubOptions.IndentationType,
                            RegexFilter = winmdSubOptions.RegexFilter,
                            TypeNotFoundErrorHandler = new ConsoleErrorTypeNotFoundErrorHandler(),
                        };
                    }
                }
            }))
            {
                bool skipPrintingHelp = false;

                try
                {
                    skipPrintingHelp = ToTypeScriptD.Render.AllAssemblies(config, Console.Out);
                }
                catch (Exception ex)
                {
                    if (ex is System.IO.DirectoryNotFoundException || ex is System.IO.FileNotFoundException)
                    {
                        skipPrintingHelp = true;
                        Console.Error.WriteLine("Error: " + ex.Message);
                    }
                    else
                    {
                        throw;
                    }
                }

                if (!skipPrintingHelp)
                {
                    Console.WriteLine(options.GetUsage(verbInvoked));
                    Environment.ExitCode = 1;
                }
            }
        }
コード例 #18
0
        public void Collect(Mono.Cecil.TypeDefinition td, TypeCollection typeCollection, ConfigBase config)
        {
            if (td.ShouldIgnoreType())
            {
                return;
            }

            // don't duplicate types
            if (typeCollection.Contains(td.FullName))
            {
                return;
            }

            StringBuilder sb          = new StringBuilder();
            var           indentCount = 0;
            ITypeWriter   typeWriter  = typeSelector.PickTypeWriter(td, indentCount, typeCollection, config);

            td.Interfaces.Each(item =>
            {
                var foundType = typeCollection.LookupType(item);

                if (foundType == null)
                {
                    //TODO: This reporting a missing type is too early in the process.
                    // typeNotFoundErrorHandler.Handle(item);
                    return;
                }

                var itemWriter = typeSelector.PickTypeWriter(foundType, indentCount, typeCollection, config);
                typeCollection.Add(foundType.Namespace, foundType.Name, itemWriter);
            });

            typeCollection.Add(td.Namespace, td.Name, typeWriter);
        }
コード例 #19
0
 public void Init()
 {
     OUTPUT_PATH = ConfigBase.Load <FrameworkRuntimeConfig>().ILRConfig.AdaptorPath;
 }
コード例 #20
0
 public void Collect(IEnumerable <Mono.Cecil.TypeDefinition> tds, TypeCollection typeCollection, ConfigBase config)
 {
     foreach (var item in tds)
     {
         Collect(item, typeCollection, config);
     }
 }
コード例 #21
0
 /// <summary>
 /// Unregisters the specified <paramref name="config"/>.
 /// </summary>
 /// <param name="config">The configuration item to unregister.</param>
 public void UnregisterConfiguration(ConfigBase config)
 {
     lock (_syncObj)
         _configs.Remove(config);
 }
コード例 #22
0
ファイル: ConfigSystem.cs プロジェクト: pointcache/URSA
 public static void UnregisterConfig(ConfigBase cfg)
 {
     m_configs.Remove(cfg.GetType());
 }
コード例 #23
0
 private void UpdateConfigItem(ConfigBase sender, string senderLocation)
 {
   // Setting is on the visible page
   if (senderLocation.StartsWith(GetSectionPath(_treeSections.SelectedNode), true, new System.Globalization.CultureInfo("en")))
   {
     ((SectionDetails)_treeSections.SelectedNode.Tag).Designed = false;
     DrawSettings();
   }
   // Setting is on a different page
   else
   {
     ((SectionDetails) GetTreeNode(senderLocation).Tag).Designed = false;
   }
 }
コード例 #24
0
        protected override IEnumerable <ResultPack> EvaluateArticleResults(TargetItem evalTarget, ConfigBase evalConfig, ISourceValues evalValues, Period evalPeriod, IPeriodProfile evalProfile, IEnumerable <ResultPair> evalResults)
        {
            if (InternalEvaluate == null)
            {
                return(EvaluateUtils.DecoratedError(ARTICLE_DESCRIPTION_ERROR_FORMAT, EXCEPTION_RESULT_NONE_TEXT));
            }
            var sourceBuilder = new EvaluateSource.SourceBuilder(evalValues);
            var resultBuilder = new EvaluateSource.ResultBuilder(evalTarget, evalResults);

            var bundleValues = PrepareConceptValues <EvaluateSource>(sourceBuilder, resultBuilder);

            if (bundleValues.IsFailure)
            {
                return(EvaluateUtils.DecoratedError(ARTICLE_DESCRIPTION_ERROR_FORMAT, bundleValues.Error));
            }
            return(InternalEvaluate(evalConfig, evalPeriod, evalProfile, bundleValues));
        }
コード例 #25
0
ファイル: Program.cs プロジェクト: jozefRudy/BBdownloader
        static void Main(string[] args)
        {
            Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US");

            Stopwatch stopwatch = new Stopwatch();

            DateTime startDate;
            var      endDate = DateTime.Today.GetBusinessDay(-1);

            var options = new CommandLineOptions();

            if (!Parser.Default.ParseArguments(args, options))
            {
                Environment.Exit(Parser.DefaultExitCodeFail);
            }

            DateTime.TryParse(String.Join(".", options.startDate), out startDate);

            var logging = new Logging(options.LogFile);

            Trace.WriteLine(options.ToString());

            var config = new ConfigBase();

            config.Load(options.Settings);

            if (!options.NoDownload)
            {
                IDataSource dataSource = new Bloomberg();
                dataSource.Connect();

                HashSet <string> shareNames = new HashSet <string>();

                // get specifications
                var sheet = new Sheet();
                sheet.Download(new string[] { config.GetValue("sheetCode"), config.GetValue("shareNames") });
                var shareIDs = sheet.toShares();
                shareNames.UnionWith(
                    dataSource.GetFields(shareIDs.ToList(), "ID_BB_GLOBAL")
                    );

                sheet.Download(new string[] { config.GetValue("sheetCode"), config.GetValue("indices") });
                var indexNames = sheet.toShares();

                sheet.Download(new string[] { config.GetValue("sheetCode"), config.GetValue("fields") });
                var fields = new List <Field>();
                sheet.toFields <Field>(fields);

                //download index compositions
                if (indexNames != null && indexNames.Count() > 0)
                {
                    //obtain components of indices
                    var names = dataSource.DownloadMultipleComponents(indexNames.ToList(), "INDX_MEMBERS");

                    //convert tickers -> BB IDs
                    shareNames.UnionWith(dataSource.GetFields(names, "ID_BB_GLOBAL"));
                }

                LocalDisk disk = new LocalDisk();
                disk.SetPath(options.Dir);

                //delete data for shares-reload and shares-delete
                {
                    sheet.Download(new string[] { config.GetValue("sheetCode"), config.GetValue("shares-reload") });
                    var sharesReload = dataSource.GetFields(sheet.toShares().ToList(), "ID_BB_GLOBAL");

                    sheet.Download(new string[] { config.GetValue("sheetCode"), config.GetValue("shares-delete") });
                    var sharesDelete = dataSource.GetFields(sheet.toShares().ToList(), "ID_BB_GLOBAL");

                    foreach (var item in sharesDelete.Concat(sharesReload))
                    {
                        disk.DeleteDirectory(item.StripOfIllegalCharacters());
                    }

                    //delete shares-delete names from list of downloadable shares
                    foreach (var item in sharesDelete)
                    {
                        if (shareNames.Contains(item))
                        {
                            shareNames.Remove(item);
                        }
                    }
                }

                shareNames = new HashSet <string>(shareNames.Where(item => item.Contains("BBG") & !item.Contains(" ")));

                //roundtrip to tickers and back to bb_ids - as some bb_ids represent the same share
                var ticker      = dataSource.GetFields(shareNames.ToList(), "EQY_FUND_TICKER");
                var asset_class = dataSource.GetFields(shareNames.ToList(), "BPIPE_REFERENCE_SECURITY_CL_RT");
                var tickers     = ticker.Zip(asset_class, (first, last) => first + " " + last);
                HashSet <string> unique_tickers = new HashSet <string>(tickers);
                shareNames = new HashSet <string>(dataSource.GetFields(unique_tickers.ToList(), "ID_BB_GLOBAL").ToList());

                //download and save data
                stopwatch.Start();
                {
                    var shares = new SharesBatch(shareNames.ToList(), fields, dataSource, disk, startDate, endDate);
                    shares.PerformOperations();

                    Trace.Write("Processing Individual: ");
                    foreach (var shareName in shareNames)
                    {
                        Share share = new Share(name: shareName, fields: fields, dataSource: dataSource, fileAccess: disk, startDate: startDate, endDate: endDate);
                        share.DoWork();
                    }
                }
                dataSource.Disconnect();

                //download fieldInfo
                {
                    if (shareNames.Count() > 0)
                    {
                        dataSource.Connect(dataType: "//blp/apiflds");
                        disk.SetPath(options.FieldInfoDir);
                        Share share = new Share(name: shareNames.First(), fields: fields, dataSource: dataSource, fileAccess: disk, startDate: startDate, endDate: endDate);
                        share.DoWorkFieldInfo();
                        dataSource.Disconnect();
                    }
                }
                stopwatch.Stop();
                Trace.WriteLine("Time spent downloading from BB: " + stopwatch.Elapsed.ToString());
            }


            //upload data via SQL connection
            if (!options.NoUpload)
            {
                stopwatch.Restart();
                {
                    LocalDisk disk = new LocalDisk();
                    disk.SetPath(options.Dir);

                    var database = new MySQL(config.GetValue("sqlIP"), config.GetValue("sqlUser"), config.GetValue("sqlPass"), config.GetValue("sqlDB"), disk);
                    database.DoWork();
                }

                {
                    LocalDisk disk = new LocalDisk();
                    disk.SetPath(options.FieldInfoDir);

                    var database = new MySQL(config.GetValue("sqlIP"), config.GetValue("sqlUser"), config.GetValue("sqlPass"), config.GetValue("sqlDB"), disk);
                    database.DoWorkFieldInfo();
                }
                stopwatch.Stop();
                Trace.WriteLine("Time spent uploading: " + stopwatch.Elapsed.ToString());
                logging.Close();
            }
        }
コード例 #26
0
 public SportsDataContext(ConfigBase config) : base(config.RedisConnection, new CosmosProvider(config.CosmosConnection, config.CosmosKey, "main"))
 {
 }
コード例 #27
0
 /// <summary>
 /// Performs the code generation.
 /// </summary>
 /// <param name="templateContents">The template <c>handlebars.js</c> contents.</param>
 /// <param name="config">The root <see cref="ConfigBase"/>.</param>
 /// <param name="codeGenerated">The action that is invoked when a output has been successfully generated.</param>
 public override void Generate(string templateContents, ConfigBase config, Action <CodeGeneratorEventArgs> codeGenerated) => Generate(templateContents, (TRootConfig)config, codeGenerated);
コード例 #28
0
 public DelegateWriter(Mono.Cecil.TypeDefinition typeDefinition, int indentCount, TypeCollection typeCollection, ConfigBase config)
     : base(typeDefinition, indentCount, typeCollection, config)
 {
 }
コード例 #29
0
ファイル: ExplorerBuilder.cs プロジェクト: zuoyangithub/scada
        /// <summary>
        /// Fills the channel table nodes.
        /// </summary>
        private void FillCnlTableNodes(TreeNode inCnlTableNode, TreeNode ctrlCnlTableNode, ConfigBase configBase)
        {
            foreach (KP kp in configBase.KPTable.EnumerateItems())
            {
                string nodeText = string.Format(AppPhrases.TableByDeviceNode, kp.KPNum, kp.Name);

                TreeNode inCnlsByDeviceNode = TreeViewUtils.CreateNode(nodeText, "table.png");
                inCnlsByDeviceNode.ContextMenuStrip = contextMenus.CnlTableMenu;
                inCnlsByDeviceNode.Tag = CreateBaseTableTag(configBase.InCnlTable, CreateFilterByDevice(kp));
                inCnlTableNode.Nodes.Add(inCnlsByDeviceNode);

                TreeNode ctrlCnlsByDeviceNode = TreeViewUtils.CreateNode(nodeText, "table.png");
                ctrlCnlsByDeviceNode.ContextMenuStrip = contextMenus.CnlTableMenu;
                ctrlCnlsByDeviceNode.Tag = CreateBaseTableTag(configBase.CtrlCnlTable, CreateFilterByDevice(kp));
                ctrlCnlTableNode.Nodes.Add(ctrlCnlsByDeviceNode);
            }

            TreeNode inCnlsEmptyDeviceNode = TreeViewUtils.CreateNode(AppPhrases.EmptyDeviceNode, "table.png");

            inCnlsEmptyDeviceNode.ContextMenuStrip = contextMenus.CnlTableMenu;
            inCnlsEmptyDeviceNode.Tag = CreateBaseTableTag(configBase.InCnlTable, CreateFilterByDevice(null));
            inCnlTableNode.Nodes.Add(inCnlsEmptyDeviceNode);

            TreeNode ctrlCnlsEmptyDeviceNode = TreeViewUtils.CreateNode(AppPhrases.EmptyDeviceNode, "table.png");

            ctrlCnlsEmptyDeviceNode.ContextMenuStrip = contextMenus.CnlTableMenu;
            ctrlCnlsEmptyDeviceNode.Tag = CreateBaseTableTag(configBase.CtrlCnlTable, CreateFilterByDevice(null));
            ctrlCnlTableNode.Nodes.Add(ctrlCnlsEmptyDeviceNode);
        }
コード例 #30
0
ファイル: ColumnBuilder.cs プロジェクト: wuchang/scada-v6
        /// <summary>
        /// Creates columns for the specified table
        /// </summary>
        public static DataGridViewColumn[] CreateColumns(ConfigBase configBase, Type itemType)
        {
            if (configBase == null)
            {
                throw new ArgumentNullException(nameof(configBase));
            }

            if (itemType == typeof(Archive))
            {
                return(CreateArchiveTableColumns());
            }
            else if (itemType == typeof(CmdType))
            {
                return(CreateCmdTypeTableColumns());
            }
            else if (itemType == typeof(CnlStatus))
            {
                return(CreateCnlStatusTableColumns());
            }
            else if (itemType == typeof(CnlType))
            {
                return(CreateCnlTypeTableColumns());
            }
            else if (itemType == typeof(CommLine))
            {
                return(CreateCommLineTableColumns());
            }
            else if (itemType == typeof(DataType))
            {
                return(CreateDataTypeTableColumns());
            }
            else if (itemType == typeof(Device))
            {
                return(CreateDeviceTableColumns(configBase));
            }
            else if (itemType == typeof(DevType))
            {
                return(CreateDevTypeTableColumns());
            }
            else if (itemType == typeof(Format))
            {
                return(CreateFormatTableColumns());
            }
            else if (itemType == typeof(InCnl))
            {
                return(CreateInCnlTableColumns(configBase));
            }
            else if (itemType == typeof(Lim))
            {
                return(CreateLimTableColumns());
            }
            else if (itemType == typeof(Obj))
            {
                return(CreateObjTableColumns(configBase));
            }
            else if (itemType == typeof(ObjRight))
            {
                return(CreateObjRightTableColumns(configBase));
            }
            else if (itemType == typeof(OutCnl))
            {
                return(CreateOutCnlTableColumns(configBase));
            }
            else if (itemType == typeof(Quantity))
            {
                return(CreateQuantityTableColumns());
            }
            else if (itemType == typeof(Role))
            {
                return(CreateRoleTableColumns());
            }
            else if (itemType == typeof(RoleRef))
            {
                return(CreateRoleRefTableColumns(configBase));
            }
            else if (itemType == typeof(Script))
            {
                return(CreateScriptTableColumns());
            }
            else if (itemType == typeof(Unit))
            {
                return(CreateUnitTableColumns());
            }
            else if (itemType == typeof(User))
            {
                return(CreateUserTableColumns(configBase));
            }
            else if (itemType == typeof(Data.Entities.View))
            {
                return(CreateViewTableColumns(configBase));
            }
            else if (itemType == typeof(ViewType))
            {
                return(CreateViewTypeTableColumns());
            }
            else
            {
                return(Array.Empty <DataGridViewColumn>());
            }
        }
コード例 #31
0
        private readonly ConfigBase configBase; // the reference to the configuration database


        /// <summary>
        /// Initializes a new instance of the class.
        /// </summary>
        /// <remarks>The configuration database is required for creating combo box columns.</remarks>
        public ColumnBuilder(ConfigBase configBase)
        {
            this.configBase = configBase ?? throw new ArgumentNullException(nameof(configBase));
        }
コード例 #32
0
        private bool IsCertificateAuthentication(OperationContext operationContext)
        {
            if (!ConfigBase <MRSConfigSchema> .GetConfig <bool>("ProxyServiceCertificateEndpointEnabled"))
            {
                return(false);
            }
            ServiceSecurityContext serviceSecurityContext = operationContext.ServiceSecurityContext;

            if (serviceSecurityContext == null || serviceSecurityContext.AuthorizationContext == null || serviceSecurityContext.AuthorizationContext.ClaimSets == null || serviceSecurityContext.AuthorizationContext.ClaimSets.Count != 1)
            {
                return(false);
            }
            X509CertificateClaimSet x509CertificateClaimSet = serviceSecurityContext.AuthorizationContext.ClaimSets[0] as X509CertificateClaimSet;

            return(x509CertificateClaimSet != null && !(x509CertificateClaimSet.X509Certificate.Subject != ConfigBase <MRSConfigSchema> .GetConfig <string>("ProxyClientCertificateSubject")));
        }
コード例 #33
0
        protected void LoadChildren()
        {
            lock (_syncObj)
            {
                if (_childrenLoaded)
                {
                    return;
                }
                ILogger        logger        = ServiceRegistration.Get <ILogger>();
                IPluginManager pluginManager = ServiceRegistration.Get <IPluginManager>();
                string         itemLocation  = Constants.PLUGINTREE_BASELOCATION + Location;
                // We'll use a FixedItemStateTracker in the hope that the configuration will be disposed
                // after usage. The alternative would be to use a plugin item state tracker which is able to
                // remove a config element usage. But this would mean to also expose a listener registration
                // to the outside. I think this is not worth the labor.
                _childPluginItemStateTracker = new FixedItemStateTracker(string.Format("ConfigurationManager: ConfigurationNode '{0}'", itemLocation));
                ICollection <PluginItemMetadata> items = pluginManager.GetAllPluginItemMetadata(itemLocation);
                ISet <string> childSet = new HashSet <string>();
                foreach (PluginItemMetadata itemMetadata in items)
                {
                    try
                    {
                        ConfigBaseMetadata metadata = pluginManager.RequestPluginItem <ConfigBaseMetadata>(itemMetadata.RegistrationLocation, itemMetadata.Id, _childPluginItemStateTracker);
                        ConfigBase         childObj = Instantiate(metadata, itemMetadata.PluginRuntime);
                        if (childObj == null)
                        {
                            continue;
                        }
                        AddChildNode(childObj);
                        childSet.Add(metadata.Id);
                    }
                    catch (PluginInvalidStateException e)
                    {
                        logger.Warn("Cannot add configuration node for {0}", e, itemMetadata);
                    }
                }
                ICollection <string> childLocations = pluginManager.GetAvailableChildLocations(itemLocation);
                foreach (string childLocation in childLocations)
                {
                    string childId = RegistryHelper.GetLastPathSegment(childLocation);
                    if (childSet.Contains(childId))
                    {
                        continue;
                    }
                    logger.Warn("Configuration: Configuration section '{0}' was found in the tree but not explicitly registered as section (config items in this section are registered by those plugins: {1})",
                                childLocation, StringUtils.Join(", ", FindPluginRegistrations(childLocation)));
                    ConfigSectionMetadata dummyMetadata = new ConfigSectionMetadata(childLocation, Constants.INVALID_SECTION_TEXT, null, null, null, null);
                    ConfigSection         dummySection  = new ConfigSection();
                    dummySection.SetMetadata(dummyMetadata);
                    AddChildNode(dummySection);
                }
                _childrenLoaded = true;
            }

            // Attach listeners after all children have been loaded
            // so that searching for child locations works correctly.
            foreach (var node in _childNodes)
            {
                AttachListenToLocations(node.ConfigObj);
            }
        }
コード例 #34
0
 public ConfigJsObject(IronJS.Environment env, ConfigBase config, CommonObject prototype)
     : base(env, prototype)
 {
     configBase = config;
 }
コード例 #35
0
 /// <summary>
 /// [Internal Constructor] Initializes a new instance of the ConfigurationNode class.
 /// </summary>
 /// <param name="configObj">Setting to link to the node.</param>
 /// <param name="parent">Parent node of the node.</param>
 public ConfigurationNode(ConfigBase configObj, ConfigurationNode parent)
 {
     _configObj  = configObj;
     _parent     = parent;
     _childNodes = new List <ConfigurationNode>();
 }
コード例 #36
0
 private void ReserveLocalForestResources(ReservationContext reservation, TransactionalRequestJob requestJob)
 {
     MoveJob.ReserveLocalForestResources(reservation, CommonUtils.ComputeWlmWorkloadType(this.Priority, this.isInteractive, ConfigBase <MRSConfigSchema> .GetConfig <WorkloadType>("WlmWorkloadType")), this.RequestType, this.Flags, this.ArchiveGuid, this.ExchangeGuid, this.SourceExchangeGuid, this.TargetExchangeGuid, this.PartitionHint, requestJob.SourceDatabase, requestJob.SourceArchiveDatabase, requestJob.TargetDatabase, requestJob.TargetArchiveDatabase, this.SourceDatabaseGuid, this.SourceArchiveDatabaseGuid, this.TargetDatabaseGuid, this.TargetArchiveDatabaseGuid);
 }
コード例 #37
0
 public static bool IsInteractive(MRSRequestType requestType, RequestWorkloadType workloadType)
 {
     return(ConfigBase <MRSConfigSchema> .GetConfig <bool>("AllAggregationSyncJobsInteractive") && requestType == MRSRequestType.Sync && workloadType == RequestWorkloadType.SyncAggregation);
 }
コード例 #38
0
ファイル: HandlebarsHelpers.cs プロジェクト: ostat/Beef
        /// <summary>
        /// Registers all of the required Handlebars helpers.
        /// </summary>
        public static void RegisterHelpers()
        {
            if (_areRegistered)
            {
                return;
            }

            _areRegistered = true;

            // Will check that the first argument equals at least one of the subsequent arguments.
            Handlebars.RegisterHelper("ifeq", (writer, context, parameters, args) =>
            {
                if (IfEq(args))
                {
                    context.Template(writer, parameters);
                }
                else
                {
                    context.Inverse(writer, parameters);
                }
            });

            // Will check that the first argument does not equal any of the subsequent arguments.
            Handlebars.RegisterHelper("ifne", (writer, context, parameters, args) =>
            {
                if (IfEq(args))
                {
                    context.Inverse(writer, parameters);
                }
                else
                {
                    context.Template(writer, parameters);
                }
            });

            // Will check that the first argument is less than or equal to the subsequent arguments.
            Handlebars.RegisterHelper("ifle", (writer, context, parameters, args) =>
            {
                if (IfLe(args))
                {
                    context.Template(writer, parameters);
                }
                else
                {
                    context.Inverse(writer, parameters);
                }
            });

            // Will check that the first argument is greater than or equal to the subsequent arguments.
            Handlebars.RegisterHelper("ifge", (writer, context, parameters, args) =>
            {
                if (IfGe(args))
                {
                    context.Template(writer, parameters);
                }
                else
                {
                    context.Inverse(writer, parameters);
                }
            });

            // Will check that all of the arguments have a non-<c>null</c> value.
            Handlebars.RegisterHelper("ifval", (writer, context, parameters, args) =>
            {
                foreach (var arg in args)
                {
                    if (arg == null)
                    {
                        context.Inverse(writer, parameters);
                        return;
                    }
                }

                context.Template(writer, parameters);
            });

            // Will check that all of the arguments have a <c>null</c> value.
            Handlebars.RegisterHelper("ifnull", (writer, context, parameters, args) =>
            {
                foreach (var arg in args)
                {
                    if (arg != null)
                    {
                        context.Inverse(writer, parameters);
                        return;
                    }
                }

                context.Template(writer, parameters);
            });

            // Will check that any of the arguments have a <c>true</c> value where bool; otherwise, non-null.
            Handlebars.RegisterHelper("ifor", (writer, context, parameters, args) =>
            {
                foreach (var arg in args)
                {
                    if (arg is bool opt)
                    {
                        if (opt)
                        {
                            context.Template(writer, parameters);
                            return;
                        }
                    }
                    else if (arg != null)
                    {
                        var opt2 = arg as bool?;
                        if (opt2 != null && !opt2.Value)
                        {
                            continue;
                        }

                        context.Template(writer, parameters);
                        return;
                    }
                }

                context.Inverse(writer, parameters);
            });

            // Converts a value to lowercase.
            Handlebars.RegisterHelper("lower", (writer, context, parameters) => writer.WriteSafeString(parameters.FirstOrDefault()?.ToString()?.ToLowerInvariant() ?? ""));

            // NOTE: Any ending in 'x' are to explicitly ignore special names!!!

            // Converts a value to camelcase.
            Handlebars.RegisterHelper("camel", (writer, context, parameters) => writer.WriteSafeString(StringConversion.ToCamelCase(parameters.FirstOrDefault()?.ToString()) ?? ""));
            Handlebars.RegisterHelper("camelx", (writer, context, parameters) => writer.WriteSafeString(StringConversion.ToCamelCase(parameters.FirstOrDefault()?.ToString(), true) ?? ""));

            // Converts a value to pascalcase.
            Handlebars.RegisterHelper("pascal", (writer, context, parameters) => writer.WriteSafeString(StringConversion.ToPascalCase(parameters.FirstOrDefault()?.ToString()) ?? ""));
            Handlebars.RegisterHelper("pascalx", (writer, context, parameters) => writer.WriteSafeString(StringConversion.ToPascalCase(parameters.FirstOrDefault()?.ToString(), true) ?? ""));

            // Converts a value to private case.
            Handlebars.RegisterHelper("private", (writer, context, parameters) => writer.WriteSafeString(StringConversion.ToPrivateCase(parameters.FirstOrDefault()?.ToString()) ?? ""));
            Handlebars.RegisterHelper("privatex", (writer, context, parameters) => writer.WriteSafeString(StringConversion.ToPrivateCase(parameters.FirstOrDefault()?.ToString(), true) ?? ""));

            Handlebars.RegisterHelper("sentence", (writer, context, parameters) => writer.WriteSafeString(StringConversion.ToSentenceCase(parameters.FirstOrDefault()?.ToString()) ?? ""));
            Handlebars.RegisterHelper("sentencex", (writer, context, parameters) => writer.WriteSafeString(StringConversion.ToSentenceCase(parameters.FirstOrDefault()?.ToString(), true) ?? ""));

            // Converts a value to the c# '<see cref="value"/>' comments equivalent.
            Handlebars.RegisterHelper("seecomments", (writer, context, parameters) => writer.WriteSafeString(ConfigBase.ToSeeComments(parameters.FirstOrDefault()?.ToString())));

            // Inserts indent spaces based on the passed index value.
            Handlebars.RegisterHelper("indent", (writer, context, parameters) => writer.WriteSafeString(new string(' ', 4 * (int)(parameters.FirstOrDefault() ?? 0))));

            // Adds a value to a value.
            Handlebars.RegisterHelper("add", (writer, context, parameters) =>
            {
                int sum = 0;
                foreach (var p in parameters)
                {
                    if (p is int pi)
                    {
                        sum += pi;
                    }
                    else if (p is string ps)
                    {
                        sum += int.Parse(ps, NumberStyles.Integer, CultureInfo.InvariantCulture);
                    }
                    else
                    {
                        writer.WriteSafeString("!!! add with invalid integer !!!");
                    }
                }

                writer.WriteSafeString(sum);
            });
        }
コード例 #39
0
ファイル: Program.cs プロジェクト: jozefRudy/BBdownloader
        static void Main(string[] args)
        {
            Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US");

            Stopwatch stopwatch = new Stopwatch();

            DateTime startDate;
            var endDate = DateTime.Today.GetBusinessDay(-1);

            var options = new CommandLineOptions();

            if (!Parser.Default.ParseArguments(args, options))
                Environment.Exit(Parser.DefaultExitCodeFail);

            DateTime.TryParse(String.Join(".", options.startDate), out startDate);

            var logging = new Logging(options.LogFile);
            Trace.WriteLine(options.ToString());

            var config = new ConfigBase();
            config.Load(options.Settings);

            if (!options.NoDownload)
            {
                IDataSource dataSource = new Bloomberg();
                dataSource.Connect();

                HashSet<string> shareNames = new HashSet<string>();

                // get specifications
                var sheet = new Sheet();
                sheet.Download(new string[] { config.GetValue("sheetCode"), config.GetValue("shareNames") });
                var shareIDs = sheet.toShares();
                shareNames.UnionWith(
                    dataSource.GetTickers(shareIDs.ToList())
                    );

                sheet.Download(new string[] { config.GetValue("sheetCode"), config.GetValue("indices") });
                var indexNames = sheet.toShares();

                sheet.Download(new string[] { config.GetValue("sheetCode"), config.GetValue("fields") });
                var fields = new List<Field>();
                sheet.toFields<Field>(fields);

                //download index compositions
                if (indexNames != null && indexNames.Count() > 0)
                {
                    //obtain components of indices
                    var names = dataSource.DownloadMultipleComponents(indexNames.ToList(), "INDX_MEMBERS");

                    //convert tickers -> BB IDs
                    shareNames.UnionWith(dataSource.GetTickers(names));

                }

                LocalDisk disk = new LocalDisk();
                disk.SetPath(options.Dir);

                //delete data for shares-reload and shares-delete
                {
                    sheet.Download(new string[] { config.GetValue("sheetCode"), config.GetValue("shares-reload") });
                    var sharesReload = dataSource.GetTickers(sheet.toShares().ToList());

                    sheet.Download(new string[] { config.GetValue("sheetCode"), config.GetValue("shares-delete") });
                    var sharesDelete = dataSource.GetTickers(sheet.toShares().ToList());

                    foreach (var item in sharesDelete.Concat(sharesReload))
                        disk.DeleteDirectory(item.StripOfIllegalCharacters());

                    //delete shares-delete names from list of downloadable shares
                    foreach (var item in sharesDelete)
                    {
                        if (shareNames.Contains(item))
                            shareNames.Remove(item);
                    }
                }

                //download and save data
                stopwatch.Start();
                {
                    var shares = new SharesBatch(shareNames.ToList(), fields, dataSource, disk, startDate, endDate);
                    shares.PerformOperations();

                    Trace.Write("Processing Individual: ");
                    foreach (var shareName in shareNames)
                    {
                        Share share = new Share(name: shareName, fields: fields, dataSource: dataSource, fileAccess: disk, startDate: startDate, endDate: endDate);
                        share.DoWork();
                    }
                }
                dataSource.Disconnect();

                //download fieldInfo
                {
                    if (shareNames.Count() > 0)
                    {
                        dataSource.Connect(dataType: "//blp/apiflds");
                        disk.SetPath(options.FieldInfoDir);
                        Share share = new Share(name: shareNames.First(), fields: fields, dataSource: dataSource, fileAccess: disk, startDate: startDate, endDate: endDate);
                        share.DoWorkFieldInfo();
                        dataSource.Disconnect();
                    }
                }
                stopwatch.Stop();
                Trace.WriteLine("Time spent downloading from BB: " + stopwatch.Elapsed.ToString());
            }

            //upload data via SQL connection
            if (!options.NoUpload)
            {
                stopwatch.Restart();
                {
                    LocalDisk disk = new LocalDisk();
                    disk.SetPath(options.Dir);

                    var database = new MySQL(config.GetValue("sqlIP"), config.GetValue("sqlUser"), config.GetValue("sqlPass"), config.GetValue("sqlDB"), disk);
                    database.DoWork();
                }

                {
                    LocalDisk disk = new LocalDisk();
                    disk.SetPath(options.FieldInfoDir);

                    var database = new MySQL(config.GetValue("sqlIP"), config.GetValue("sqlUser"), config.GetValue("sqlPass"), config.GetValue("sqlDB"), disk);
                    database.DoWorkFieldInfo();
                }
                stopwatch.Stop();
                Trace.WriteLine("Time spent uploading: " + stopwatch.Elapsed.ToString());
                logging.Close();

                {
                    Console.WriteLine("Executing long job, you can force exit program, it will continue executing on server");
                    LocalDisk disk = new LocalDisk();
                    disk.SetPath(options.Dir);
                    var database = new MySQL(config.GetValue("sqlIP"), config.GetValue("sqlUser"), config.GetValue("sqlPass"), config.GetValue("sqlDB"), disk);
                    database.executeScript();
                }
            }
        }
コード例 #40
0
ファイル: SmartConfigPanel.cs プロジェクト: MuteG/DevTools
 protected override void SaveConfig(ConfigBase config)
 {
     throw new NotImplementedException();
 }
コード例 #41
0
 public DelegateWriter(Mono.Cecil.TypeDefinition typeDefinition, int indentCount, TypeCollection typeCollection, ConfigBase config)
     : base(typeDefinition, indentCount, typeCollection, config)
 {
 }
コード例 #42
0
ファイル: ConfigPanelBase.cs プロジェクト: MuteG/DevTools
 protected virtual void SaveConfig(ConfigBase config)
 {
 }
コード例 #43
0
 public ConfigJsObject(IronJS.Environment env, ConfigBase config, CommonObject prototype)
     : base(env, prototype)
 {
     configBase = config;
 }
コード例 #44
0
 public void UnregisterConfiguration(ConfigBase configItem)
 {
     _configItems.Remove(configItem);
 }
コード例 #45
0
 public override void add(ConfigBase config)
 {
     configs.Add(config as TileMixConfig);
 }
コード例 #46
0
        public ITypeWriter PickTypeWriter(Mono.Cecil.TypeDefinition td, int indentCount, TypeCollection typeCollection, ConfigBase config)
        {
            if (td.IsEnum)
            {
                return(new EnumWriter(td, indentCount, typeCollection, config));
            }

            if (td.IsInterface)
            {
                return(new InterfaceWriter(td, indentCount, typeCollection, config));
            }

            if (td.IsClass)
            {
                if (td.BaseType.FullName == "System.MulticastDelegate" ||
                    td.BaseType.FullName == "System.Delegate")
                {
                    return(new DelegateWriter(td, indentCount, typeCollection, config));
                }

                return(new ClassWriter(td, indentCount, typeCollection, config));
            }

            throw new NotImplementedException("Could not get a type to generate for:" + td.FullName);
        }
コード例 #47
0
 /// <summary>
 /// Initializes a new instance of the <see cref="CodeGenException"/> class for a specified <paramref name="config"/>.
 /// </summary>
 /// <param name="config">The <see cref="ConfigBase"/> that the excpetion is related to.</param>
 /// <param name="propertyName">The corresponding property name that is in error.</param>
 /// <param name="message">The message that describes the error.</param>
 public CodeGenException(ConfigBase config, string propertyName, string message) : base($"{Check.NotNull(config, nameof(config)).BuildFullyQualifiedName(propertyName)}: {message}")
 {
 }
コード例 #48
0
ファイル: EnumWriter.cs プロジェクト: sumitkm/ToTypeScriptD
 public EnumWriter(TypeDefinition typeDefinition, int indentCount, TypeCollection typeCollection, ConfigBase config)
 {
     this.config = config;
     this.TypeDefinition = typeDefinition;
     this.IndentCount = indentCount;
 }
コード例 #49
0
ファイル: SmartConfigPanel.cs プロジェクト: MuteG/DevTools
 protected override void ShowConfig(ConfigBase config)
 {
     //TODO : 根据config自动生成配置界面
 }
コード例 #50
0
ファイル: AspNetHandler.cs プロジェクト: kevinswiber/NRack
        public void ProcessRequest(HttpContext context)
        {
            if (_config == null)
            {
                _config = ConfigResolver.GetRackConfigInstance();
                _getBuilderInContext = () => new Builder(_config.ExecuteStart);
            }

            var rawEnvironment = context.Request.ServerVariables;
            Dictionary<string, dynamic> environment =
                rawEnvironment.AllKeys.ToDictionary(key => key, key => (object)rawEnvironment[key]);

            environment["SCRIPT_NAME"] = string.Empty;

            //if ((string)environment["SCRIPT_NAME"] == string.Empty)
            //{
            //    environment["SCRIPT_NAME"] = "/";
            //}

            var rackEnvs = new Dictionary<string, dynamic>
                               {
                                   {"rack.version", RackVersion.Version},
                                   {"rack.input", context.Request.InputStream},
                                   {"rack.errors", Console.OpenStandardError()},
                                   {"rack.multithread", true},
                                   {"rack.multiprocess", false},
                                   {"rack.run_once", false},
                                   {"rack.url_scheme", context.Request.IsSecureConnection ? "https" : "http"}

                               };

            environment = environment.Union(rackEnvs).ToDictionary(key => key.Key, val => val.Value);

            //if (!environment.ContainsKey("SCRIPT_NAME"))
            //{
            //    environment["SCRIPT_NAME"] = string.Empty;
            //}

            var builder = _getBuilderInContext();
            var responseArray = builder.Call(environment);

            var response = AspNetResponse.Create(responseArray);

            context.Response.StatusCode = response.StatusCode;

            //context.Response.Headers.Add(response.Headers);
            if (response.Headers != null)
            {
                foreach (var key in response.Headers.AllKeys)
                {
                    context.Response.AddHeader(key, response.Headers[key]);
                }
            }

            response.Body.Each((Action<dynamic>)(body =>
                {
                    if (body is string)
                    {
                        context.Response.Write(body);
                    }
                    else if (body is byte[])
                    {
                        context.Response.BinaryWrite(body);
                    }
                }));

            var methodInfos = (IEnumerable<MethodInfo>)response.Body.GetType().GetMethods();

            var closeMethods = Enumerable.Where(methodInfos, method => method.Name == "Close");

            foreach (var method in closeMethods)
            {
                if (method.GetParameters().Length == 0 && method.ReturnType.Equals(typeof(void)))
                {
                    method.Invoke(response.Body, null);
                    break;
                }
            }
        }