コード例 #1
0
        public void Read(BinaryReader nfile)
        {
            int i, j, k;
            long longrecn = intRecordNumber;
            nfile.BaseStream.Position = (longrecn*512);
            intKeysInThisNode = nfile.ReadInt32();
            for (i = 0; i < intGeneralKeysPerNode; i++)
            {
                lower_level[i] = nfile.ReadInt32();
                key_record_number[i] = nfile.ReadInt32();

                if (objKeyType == dBaseType.N)
                {
                    //Key is a double number
                    key_expression[i] = new NodeKey(Convert.ToDouble(nfile.ReadInt64()));
                }
                else
                {
                    key_buffer = nfile.ReadBytes(intKeyExpressionSize);
                    for (k = 0; k < intKeyExpressionSize && key_buffer[k] != 0; k++) ;
                    key_expression[i] = new NodeKey(dBaseConverter.C_ToString(key_buffer));
                }

                j = intKeyExpressionSize%4;
                if (j > 0) j = 4 - j;
                for (k = 0; k < j; k++)
                    nfile.ReadByte();
            } // for i

            if (lower_level[0] > 0) boolBranch = true;
            else boolBranch = false;

            lower_level[i] = nfile.ReadInt32();
        }
コード例 #2
0
        /// <summary>
        /// Read node from the parent MDX Entry
        /// </summary>
        /// <param name="Reader">The BinaryReader that contains the MDXFile Stream</param>
        public void Read(BinaryReader Reader)
        {
            int i, j, k;
            long longrecn = intRecordNumber;
            Reader.BaseStream.Position = (longrecn*512);
            intKeysInThisNode = Reader.ReadInt32();
            prev_page = Reader.ReadInt32();
            boolBranch = prev_page == 0 ? false : true;

            byte[] b = new byte[12];
            for (i = 0; i < intGeneralKeysPerNode; i++)
            {
                key_record_number[i] = Reader.ReadInt32();
                if (objKeyType == dBaseType.F)
                {
                    Reader.Read(b, 0, b.Length);
                    if (i < intKeysInThisNode)
                    {
                        key_expression[i] = new NodeKey(dBaseConverter.F_ToDouble(b));
                    }
                    else
                    {
                        key_expression[i] = new NodeKey(0.0d);
                    }
                }
                else if (objKeyType == dBaseType.N)
                {
                    //Key is a double number
                    key_expression[i] = new NodeKey(Convert.ToDouble(Reader.ReadInt64()));
                }
                else
                {
                    key_buffer = Reader.ReadBytes(intKeyExpressionSize);
                    for (k = 0; k < intKeyExpressionSize && key_buffer[k] != 0; k++) ;
                    key_expression[i] = new NodeKey(dBaseConverter.C_ToString(key_buffer));
                }


                j = intKeyExpressionSize%4;
                if (j > 0) j = 4 - j;
                for (k = 0; k < j; k++)
                    Reader.ReadByte();
            } // for i

            key_record_number[i] = Reader.ReadInt32();

            boolBranch = key_record_number[intKeysInThisNode] > 0 ? true : false;

        }
コード例 #3
0
 private BTree goingUp(NodeKey inKey)
 {
     if (objKey.CompareKey(inKey) <= 0)
     {
         if (objAboveTree == null)
         {
             return(null);
         }
         else
         {
             return(objAboveTree.goingUp(objKey));
         }
     }
     return(this);
 }
コード例 #4
0
 private BTree goingUp(NodeKey inKey)
 {
     if (objKey.CompareKey(inKey) <= 0)
     {
         if (objAboveTree == null)
         {
             return null;
         }
         else
         {
             return objAboveTree.goingUp(objKey);
         }
     }
     return this;
 }
コード例 #5
0
        public DataMatch Match(DataVisitNode node1, DataVisitNode node2)
        {
            DataMatch match;
            var       key = new NodeKey(node1, node2);

            if (matches.TryGetValue(key, out match))
            {
                return(match);
            }


            match = MatchInternal(node1, node2);
            Console.WriteLine("Match {0} : {1} vs {2}", node1, node2, match);
            matches[key] = match;

            return(match);
        }
コード例 #6
0
        public BTree(NodeKey inkey, int inWhere, BTree TopTree)
        {
            objKey   = inkey;
            intWhere = inWhere;

            if (TopTree != null)
            {
                this.objAboveTree = TopTree.findPosition(this.objKey);
                if (this.objAboveTree.Key.CompareKey(inkey) > 0)
                {
                    this.objAboveTree.SetLesser(this);
                }
                else
                {
                    this.objAboveTree.SetGreater(this);
                }
            }
        }
コード例 #7
0
ファイル: Request.cs プロジェクト: crawlab-team/crawlab-grpc
        public override int GetHashCode()
        {
            int hash = 1;

            if (NodeKey.Length != 0)
            {
                hash ^= NodeKey.GetHashCode();
            }
            if (Data.Length != 0)
            {
                hash ^= Data.GetHashCode();
            }
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
コード例 #8
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="nodeKey"></param>
        /// <param name="indentionLevel"></param>
        /// <returns></returns>
        /// <remarks>
        /// </remarks>
        private static string WriteNodeKey(NodeKey nodeKey, int indentionLevel)
        {
            var builder = new StringBuilder();

            try
            {
                if (nodeKey != null)
                {
                    builder.AppendLine(Indent(indentionLevel) + "Key: " + nodeKey.Name);
                    indentionLevel++;
                    if (nodeKey.ChildNodes != null && nodeKey.ChildNodes.Any())
                    {
                        foreach (var child in nodeKey.ChildNodes)
                        {
                            string text = WriteNodeKey(child, indentionLevel);
                            builder.AppendLine(text);
                        }
                    }
                    if (nodeKey.ChildValues != null && nodeKey.ChildValues.Any())
                    {
                        foreach (var value in nodeKey.ChildValues)
                        {
                            string dataName  = "[Undetermined]";
                            string dataValue = "[Undetermined]";
                            try
                            {
                                dataName  = value.Name;
                                dataValue = GetReadableValueOfBytes(value.ValueType, value.Data);
                                builder.AppendFormat(Indent(indentionLevel) + "Item:    {0}  :  {1} \r\n", dataName, Indent(dataValue, indentionLevel));
                            }
                            catch (Exception ex)
                            {
                                builder.AppendLine("<Exception processing key  " + dataName + ", Exception: " + ex.Message + ">");
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                builder.AppendLine("Exception: " + ex.Message);
            }
            return(builder.ToString());
        }
コード例 #9
0
        public static void Main(string[] args)
        {
            RegistryHive hive = new RegistryHive(args [0]);

            string path = "Microsoft|Windows|CurrentVersion|Component Based Servicing|Packages";

            string[] paths = path.Split('|');

            int     i   = 0;
            NodeKey key = hive.RootKey;

            while (true)
            {
                foreach (NodeKey k in key.ChildNodes)
                {
                    if (k.Name == paths [i])
                    {
                        key = k;
                        break;
                    }
                }

                if (i == paths.Length - 1)
                {
                    break;
                }

                i++;
            }

            //using (FileStream stream = File.Open (hive.Filepath, FileMode.Open)) {
            //	key.EditNodeName (stream, "Packages");
            //}

            Console.WriteLine(key.Name);

            foreach (NodeKey k in key.ChildNodes)
            {
                Console.WriteLine(k.Name);
            }

            Console.WriteLine(hive.RootKey.Name);
        }
コード例 #10
0
 /// <summary>
 /// Find te position of a Key within the BinaryTree
 /// </summary>
 /// <param name="KeyToFind">The key to find</param>
 /// <returns>The BinaryTree Node that contains the Key</returns>
 private BTree findPosition(NodeKey KeyToFind)
 {
     if (objKey.CompareKey(KeyToFind) > 0)
     {
         if (objLesserTree == null)
         {
             return this;
         }
         else
         {
             return (objLesserTree.findPosition(KeyToFind));
         }
     }
     else
     {
         if (objGreaterTree == null) return this;
         return (objGreaterTree.findPosition(KeyToFind));
     }
 }
コード例 #11
0
        /// <summary>
        /// Поиск в дереву по значению ключа
        /// </summary>
        public Value Find(Key key)
        {
            Value result = default(Value);

            if (NodeKey.CompareTo(key) == 0)
            {
                result = NodeValue;
            }
            else if (NodeKey.CompareTo(key) > 0 && Left != null)
            {
                result = Left.Find(key);
            }
            else if (NodeKey.CompareTo(key) < 0 && Right != null)
            {
                result = Right.Find(key);
            }

            return(result);
        }
コード例 #12
0
        private void AddChildrenToView(NodeKey key, TreeStore store, TreeIter iter)
        {
            if (key.ChildValues != null)
            {
                foreach (ValueKey val in key.ChildValues)
                {
                    store.AppendValues(iter, val.Name, val);
                }
            }

            if (key.ChildNodes != null)
            {
                foreach (NodeKey node in key.ChildNodes)
                {
                    TreeIter child = store.AppendValues(iter, node.Name, node);
                    AddChildrenToView(node, store, child);
                }
            }
        }
コード例 #13
0
        public BTree(NodeKey inkey, int inWhere, BTree TopTree)
        {
            objKey = inkey;
            intWhere = inWhere;

            if (TopTree != null)
            {
                this.objAboveTree = TopTree.findPosition(this.objKey);
                if (this.objAboveTree.Key.CompareKey(inkey) > 0)
                {
                    this.objAboveTree.SetLesser(this);
                }
                else
                {
                    this.objAboveTree.SetGreater(this);
                }
            }


        }
コード例 #14
0
        /// <summary>
        /// Stops named grid. If <c>cancel</c> flag is set to <c>true</c> then
        /// all jobs currently executing on local node will be interrupted. If
        /// grid name is <c>null</c>, then default no-name Ignite will be stopped.
        /// </summary>
        /// <param name="name">Grid name. If <c>null</c>, then default no-name Ignite will be stopped.</param>
        /// <param name="cancel">If <c>true</c> then all jobs currently executing will be cancelled
        /// by calling <c>ComputeJob.cancel</c>method.</param>
        /// <returns><c>true</c> if named Ignite instance was indeed found and stopped, <c>false</c>
        /// othwerwise (the instance with given <c>name</c> was not found).</returns>
        public static bool Stop(string name, bool cancel)
        {
            lock (SyncRoot)
            {
                NodeKey key = new NodeKey(name);

                Ignite node;

                if (!Nodes.TryGetValue(key, out node))
                {
                    return(false);
                }

                node.Stop(cancel);

                Nodes.Remove(key);

                GC.Collect();

                return(true);
            }
        }
コード例 #15
0
 /// <summary>
 /// Find te position of a Key within the BinaryTree
 /// </summary>
 /// <param name="KeyToFind">The key to find</param>
 /// <returns>The BinaryTree Node that contains the Key</returns>
 private BTree findPosition(NodeKey KeyToFind)
 {
     if (objKey.CompareKey(KeyToFind) > 0)
     {
         if (objLesserTree == null)
         {
             return(this);
         }
         else
         {
             return(objLesserTree.findPosition(KeyToFind));
         }
     }
     else
     {
         if (objGreaterTree == null)
         {
             return(this);
         }
         return(objGreaterTree.findPosition(KeyToFind));
     }
 }
コード例 #16
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (Code != global::Grpc.StreamMessageCode.Ping)
            {
                hash ^= Code.GetHashCode();
            }
            if (NodeKey.Length != 0)
            {
                hash ^= NodeKey.GetHashCode();
            }
            if (Key.Length != 0)
            {
                hash ^= Key.GetHashCode();
            }
            if (From.Length != 0)
            {
                hash ^= From.GetHashCode();
            }
            if (To.Length != 0)
            {
                hash ^= To.GetHashCode();
            }
            if (Data.Length != 0)
            {
                hash ^= Data.GetHashCode();
            }
            if (Error.Length != 0)
            {
                hash ^= Error.GetHashCode();
            }
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
コード例 #17
0
ファイル: Bus.cs プロジェクト: SPERONIS/Communication_Mono
        private void OnBeaconReady(object sender, NetMQBeaconEventArgs e)
        {
            // we got another beacon
            // let's check if we already know about the beacon
            var message = m_beacon.Receive();
            int port    = Convert.ToInt32(message.String);

            NodeKey node = new NodeKey(message.PeerHost, port);

            // check if node already exist
            if (!m_nodes.ContainsKey(node))
            {
                // we have a new node, let's add it and connect to subscriber
                m_nodes.Add(node, DateTime.Now);
                m_publisher.Connect(node.Address);
                m_shim.SendMoreFrame(AddedNodeCommand).SendFrame(node.Address);
            }
            else
            {
                //Console.WriteLine("Node {0} is not a new beacon.", node);
                m_nodes[node] = DateTime.Now;
            }
        }
コード例 #18
0
        public void a_sidechain_node_with_an_account()
        {
            var nodeKey = new NodeKey()
            {
                Chain = Chain.Sidechain, Role = NodeRole.Wallet
            };
            var buildNodeAction = new Action <IFullNodeBuilder>(fullNodeBuilder =>
                                                                fullNodeBuilder
                                                                .UseBlockStore()
                                                                .UsePowConsensus()
                                                                .UseMempool()
                                                                .UseWallet()
                                                                .AddMining()
                                                                .UseApi()
                                                                .AddRPC()
                                                                .MockIBD()
                                                                );

            TestHelper.BuildStartAndRegisterNode(nodeBuilder, buildNodeAction, nodeKey, nodesByKey, sidechainNetwork);
            var node = nodesByKey[nodeKey];

            var account = CreateAndRegisterHdAccount(node, nodeKey);
        }
コード例 #19
0
        public void ActorPermissionDeletingANonExistantPermission()
        {
            var sut   = new PermissionableService(_client);
            var actor = new ActorKey {
                Key = Guid.NewGuid().ToString(), Name = $"{GetMethodName()}_Actor"
            };
            var node = new NodeKey {
                Key = Guid.NewGuid().ToString(), Name = $"{GetMethodName()}_Node"
            };
            var node2 = new NodeKey {
                Key = Guid.NewGuid().ToString(), Name = $"{GetMethodName()}_Node2"
            };
            var thing = new ThingKey {
                Key = Guid.NewGuid().ToString(), Name = $"{GetMethodName()}_Thing"
            };

            sut.MakeMember(actor, node);
            sut.GrantPermission(node2, thing, $"{GetMethodName()}_Action");

            sut.RemoveMember(node, node2);

            Assert.False(sut.CanItAccess(actor, thing, $"{GetMethodName()}_Action"));
        }
コード例 #20
0
        public void ActorPermissionMultiplePath(int depth)
        {
            var s     = GetMethodName();
            var sut   = new PermissionableService(_client);
            var actor = new ActorKey {
                Key = Guid.NewGuid().ToString(), Name = $"{GetMethodName()}_Actor"
            };
            ICanJoinKey next  = actor;
            ICanJoinKey next2 = actor;

            for (int i = 0; i < depth; i++)
            {
                {
                    var node = new NodeKey {
                        Key = Guid.NewGuid().ToString(), Name = $"{GetMethodName()}_Node_Path1_" + depth
                    };
                    sut.MakeMember(next, node);
                    next = node;
                }

                {
                    var node = new NodeKey {
                        Key = Guid.NewGuid().ToString(), Name = $"{GetMethodName()}_Node_Path2_" + depth
                    };
                    sut.MakeMember(next2, node);
                    next2 = node;
                }
            }
            var thing = new ThingKey {
                Key = Guid.NewGuid().ToString(), Name = $"{GetMethodName()}_Thing"
            };

            sut.GrantPermission(next, thing, $"{GetMethodName()}_Action");
            sut.GrantPermission(next2, thing, $"{GetMethodName()}_Action");

            Assert.True(sut.CanItAccess(actor, thing, $"{GetMethodName()}_Action"));
        }
コード例 #21
0
        public void a_mainchain_node_with_funded_account()
        {
            var nodeKey = new NodeKey()
            {
                Chain = Chain.Mainchain, Role = NodeRole.Wallet
            };
            //todo: find out why this is different from the call to "CreateStratisPowMiningNode"
            //var buildNodeAction = new Action<IFullNodeBuilder>(fullNodeBuilder =>
            //    fullNodeBuilder
            //        .UseBlockStore()
            //        .UsePosConsensus()
            //        .UseMempool()
            //        .AddMining()
            //        .UseWallet()
            //        .UseApi()
            //        .AddRPC()
            //        .MockIBD()
            //        .SubstituteDateTimeProviderFor<MiningFeature>()
            //    );
            //TestHelper.BuildStartAndRegisterNode(nodeBuilder, buildNodeAction, nodeKey, nodesByKey, mainchainNetwork, protocolVersion: ProtocolVersion.ALT_PROTOCOL_VERSION);
            //var node = nodesByKey[nodeKey];

            var node = this.nodeBuilder.CreateStratisPowMiningNode();

            nodesByKey.Add(nodeKey, node);
            node.Start();
            node.NotInIBD();

            var account = CreateAndRegisterHdAccount(node, nodeKey);

            sharedSteps.MinePremineBlocks(node, nodeKey.WalletName, NamingConstants.AccountZero, nodeKey.Password);
            sharedSteps.MineBlocks(100, node, NamingConstants.AccountZero, nodeKey.WalletName, nodeKey.Password);

            this.sharedSteps.WaitForNodeToSync(node);
            account.GetSpendableAmount().ConfirmedAmount.Should().Be(moneyFromMining);
        }
コード例 #22
0
        /// <summary>
        /// Builds a NodeKey from this Index
        /// </summary>
        /// <returns>The created NodeKey</returns>
        public NodeKey BuildKey()
        {
            NodeKey dataptr;
            int i;
            Field Field;
            double doubleer = 0.0;
            switch (this.objKeyType)
            {
                case dBaseType.F:
                    foreach (Field f in this.keyControl)
                    {
                        Field = f;
                        if (Field.get() == null || Field.get().Length == 0)
                        {
                        }
                        else if (Field.getType() == dBaseType.D)
                        {
                            doubleer += Util.DoubleDate(Field.get());
                        }
                        else
                        {
                            doubleer += Double.Parse(Field.get());
                        }
                    } /* endfor */
                    dataptr = new NodeKey(new NodeFloat(doubleer));
                    break;
                case dBaseType.N:
                    for (i = 0; i < keyControl.Count; i++)
                    {
                        Field = keyControl[i];
                        if (Field.get() == null || Field.get().Length == 0)
                        {

                        }
                        else if (Field.getType() == dBaseType.D)
                        {
                            doubleer += Util.DoubleDate(Field.get());
                        }
                        else
                        {
                            doubleer += Double.Parse(Field.get());
                        } /* endfor */
                    }
                    dataptr = new NodeKey(doubleer);
                    break;
                default:
                    StringBuilder sb = new StringBuilder();
                    for (i = 0; i < keyControl.Count; i++)
                    {
                        Field = (Field) keyControl[i];

                        sb.Append(Field.get());
                    } /* endfor */
                    dataptr = new NodeKey(sb.ToString());
                    break;
            }
            return dataptr;
        }
コード例 #23
0
 public abstract int add_entry(NodeKey key, int recno);
コード例 #24
0
ファイル: Program.cs プロジェクト: yodiwo/plegma
        void OnPairedCb(NodeKey nodekey, string secret)
        {
            ActiveCfg.NodeKey = nodekey;
            ActiveCfg.NodeSecret = secret;
            YConfig.Save();

            //connect
            Node.Connect();
        }
コード例 #25
0
        /// <summary>
        /// Starts Ignite with given configuration.
        /// </summary>
        /// <returns>Started Ignite.</returns>
        public static unsafe IIgnite Start(IgniteConfiguration cfg)
        {
            IgniteArgumentCheck.NotNull(cfg, "cfg");

            lock (SyncRoot)
            {
                // 0. Init logger
                var log = cfg.Logger ?? new JavaLogger();

                log.Debug("Starting Ignite.NET " + Assembly.GetExecutingAssembly().GetName().Version);

                // 1. Check GC settings.
                CheckServerGc(cfg, log);

                // 2. Create context.
                IgniteUtils.LoadDlls(cfg.JvmDllPath, log);

                var cbs = new UnmanagedCallbacks(log);

                IgniteManager.CreateJvmContext(cfg, cbs, log);
                log.Debug("JVM started.");

                var gridName = cfg.IgniteInstanceName;

                if (cfg.AutoGenerateIgniteInstanceName)
                {
                    gridName = (gridName ?? "ignite-instance-") + Guid.NewGuid();
                }

                // 3. Create startup object which will guide us through the rest of the process.
                _startup = new Startup(cfg, cbs);

                PlatformJniTarget interopProc = null;

                try
                {
                    // 4. Initiate Ignite start.
                    UU.IgnitionStart(cbs.Context, cfg.SpringConfigUrl, gridName, ClientMode, cfg.Logger != null);


                    // 5. At this point start routine is finished. We expect STARTUP object to have all necessary data.
                    var node = _startup.Ignite;
                    interopProc = (PlatformJniTarget)node.InteropProcessor;

                    var javaLogger = log as JavaLogger;
                    if (javaLogger != null)
                    {
                        javaLogger.SetIgnite(node);
                    }

                    // 6. On-start callback (notify lifecycle components).
                    node.OnStart();

                    Nodes[new NodeKey(_startup.Name)] = node;

                    return(node);
                }
                catch (Exception)
                {
                    // 1. Perform keys cleanup.
                    string name = _startup.Name;

                    if (name != null)
                    {
                        NodeKey key = new NodeKey(name);

                        if (Nodes.ContainsKey(key))
                        {
                            Nodes.Remove(key);
                        }
                    }

                    // 2. Stop Ignite node if it was started.
                    if (interopProc != null)
                    {
                        UU.IgnitionStop(interopProc.Target.Context, gridName, true);
                    }

                    // 3. Throw error further (use startup error if exists because it is more precise).
                    if (_startup.Error != null)
                    {
                        // Wrap in a new exception to preserve original stack trace.
                        throw new IgniteException("Failed to start Ignite.NET, check inner exception for details",
                                                  _startup.Error);
                    }

                    throw;
                }
                finally
                {
                    var ignite = _startup.Ignite;

                    _startup = null;

                    if (ignite != null)
                    {
                        ignite.ProcessorReleaseStart();
                    }
                }
            }
        }
コード例 #26
0
ファイル: NodeGraphManager.cs プロジェクト: yodiwo/plegma
 //------------------------------------------------------------------------------------------------------------------------
 private void NodeDiscovery_OnVBMReceived(NodeKey BrotherNode, VirtualBlockEventMsg msg)
 {
     try
     {
         HandleIncomingVirtualBlockEventMsg(msg);
     }
     catch (Exception ex) { DebugEx.Assert(ex); }
 }
コード例 #27
0
ファイル: Bus.cs プロジェクト: sharpe5/netmq
        private void OnBeaconReady(object sender, NetMQBeaconEventArgs e)
        {
            // we got another beacon
            // let's check if we already know about the beacon
            var message = m_beacon.Receive();
            int port;
            int.TryParse(message.String, out port);

            NodeKey node = new NodeKey(message.PeerHost, port);

            // check if node already exist
            if (!m_nodes.ContainsKey(node))
            {
                // we have a new node, let's add it and connect to subscriber
                m_nodes.Add(node, DateTime.Now);
                m_publisher.Connect(node.Address);
                m_shim.SendMoreFrame(AddedNodeCommand).SendFrame(node.Address);
            }
            else
            {
                //Console.WriteLine("Node {0} is not a new beacon.", node);
                m_nodes[node] = DateTime.Now;
            }
        }
コード例 #28
0
 //cb when node is paired
 void OnPaired(NodeKey nodekey, string secret)
 {
     ActiveCfg.NodeKey    = nodekey;
     ActiveCfg.NodeSecret = secret;
     YConfig.Save();
 }
コード例 #29
0
ファイル: Bus.cs プロジェクト: zhouji0212/Samples
 protected bool Equals(NodeKey other)
 {
     return(string.Equals(Name, other.Name) && Port == other.Port);
 }
コード例 #30
0
        public override async Task ProcessAsync(TagHelperContext context, TagHelperOutput output)
        {
            var child = await output.GetChildContentAsync();

            var nodeKey = new NodeKey(ViewContext.ActionDescriptor.RouteValues, ViewContext.HttpContext.Request.Method);
            var node    = ViewContext.ViewData["BreadcrumbNode"] as BreadcrumbNode ?? _breadcrumbManager.GetNode(nodeKey.Value);

            output.TagName = BreadcrumbManager.Options.TagName;
            if (!string.IsNullOrWhiteSpace(BreadcrumbManager.Options.AriaLabel))
            {
                output.Attributes.Add("aria-label", BreadcrumbManager.Options.AriaLabel);
            }

            // Tag Classes
            if (!string.IsNullOrEmpty(BreadcrumbManager.Options.TagClasses))
            {
                output.Attributes.Add("class", BreadcrumbManager.Options.TagClasses);
            }

            output.Content.AppendHtml($"<ol class=\"{BreadcrumbManager.Options.OlClasses}\">");

            var sb = new StringBuilder();

            // Go down the hierarchy
            if (node != null)
            {
                if (node.OverwriteTitleOnExactMatch && node.Title.StartsWith("ViewData."))
                {
                    node.Title = ExtractTitle(node.OriginalTitle);
                }

                sb.Insert(0, GetLi(node, node.GetUrl(_urlHelper), true));

                while (node.Parent != null)
                {
                    node = node.Parent;

                    // Separator
                    if (BreadcrumbManager.Options.HasSeparatorElement)
                    {
                        sb.Insert(0, BreadcrumbManager.Options.SeparatorElement);
                    }

                    sb.Insert(0, GetLi(node, node.GetUrl(_urlHelper), false));
                }
            }

            // If the node was custom and it had no defaultnode
            if (!BreadcrumbManager.Options.DontLookForDefaultNode && node != _breadcrumbManager.DefaultNode)
            {
                // Separator
                if (BreadcrumbManager.Options.HasSeparatorElement)
                {
                    sb.Insert(0, BreadcrumbManager.Options.SeparatorElement);
                }

                sb.Insert(0, GetLi(_breadcrumbManager.DefaultNode,
                                   _breadcrumbManager.DefaultNode.GetUrl(_urlHelper),
                                   false));
            }

            output.Content.AppendHtml(sb.ToString());
            output.Content.AppendHtml(child);
            output.Content.AppendHtml("</ol>");
        }
コード例 #31
0
 public void SetKeyValue(NodeKey key)
 {
     key_expression[intPosition] = key;
 }
コード例 #32
0
ファイル: Thing.cs プロジェクト: sm6uax/plegma
 public Thing(string uid, List <Port> ports, NodeKey nodeKey)
     : this(new ThingKey(nodeKey, uid), ports)
 {
 }
コード例 #33
0
        public override void Render(ref XmlTree tree)
        {
            XmlTreeNode node;

            switch (CurrentNodeType)
            {
            case StoreTreeNodeType.Stores:
                #region Render tree
                Permissions permissions = PermissionService.Instance.GetCurrentLoggedInUserPermissions();

                foreach (Store store in StoreService.Instance.GetAll())
                {
                    if (permissions != null && permissions.HasPermission(StoreSpecificPermissionType.AccessStore, store.Id))
                    {
                        node = CreateNode(GetNodeIdentifier(StoreTreeNodeType.Store, store.Id, store.Id), store.Name, Constants.TreeIcons.Store, "store", true);

                        if (permissions.HasPermission(StoreSpecificPermissionType.AccessSettings, store.Id))
                        {
                            node.Action = "javascript:(function(){" + ClientTools.Scripts.ChangeContentFrameUrl(WebUtils.GetPageUrl(Constants.Pages.EditStore) + "?id=" + store.Id) + "})";
                        }

                        if (permissions.HasPermission(GeneralPermissionType.CreateAndDeleteStore))
                        {
                            node.Menu.Add(ActionDelete.Instance);
                        }
                        tree.Add(node);
                    }
                }
                #endregion
                break;

            case StoreTreeNodeType.Store:
                #region Render tree

                permissions = PermissionService.Instance.GetCurrentLoggedInUserPermissions();

                node = CreateNode(GetNodeIdentifier(StoreTreeNodeType.Orders, CurrentStoreId), CommonTerms.Orders, Constants.TreeIcons.Clipboard, "orders", true /*There is always a default order status*/);
                tree.Add(node);

                if (permissions != null && permissions.HasPermission(StoreSpecificPermissionType.AccessMarketing, CurrentStoreId))
                {
                    node = CreateNode(GetNodeIdentifier(StoreTreeNodeType.Campaigns, CurrentStoreId), CommonTerms.Marketing, Constants.TreeIcons.Target, "campaigns", CampaignService.Instance.GetAll(CurrentStoreId).Any());
                    node.Menu.Add(ActionNew.Instance);
                    node.Menu.Add(new SortCampaignsAction());
                    node.Menu.Add(ContextMenuSeperator.Instance);
                    node.Menu.Add(ActionRefresh.Instance);
                    tree.Add(node);

                    node        = CreateNode(GetNodeIdentifier(StoreTreeNodeType.GiftCards, CurrentStoreId), CommonTerms.GiftCards, Constants.TreeIcons.Certificate, "giftCards");
                    node.Action = "javascript:(function(){" + ClientTools.Scripts.ChangeContentFrameUrl(WebUtils.GetPageUrl(Constants.Pages.GiftCardOverview) + "?storeId=" + CurrentStoreId) + "})";
                    node.Menu.Add(ActionNew.Instance);
                    tree.Add(node);
                }

                if (permissions != null && permissions.HasPermission(StoreSpecificPermissionType.AccessSettings, CurrentStoreId))
                {
                    node        = CreateNode(GetNodeIdentifier(StoreTreeNodeType.Settings, CurrentStoreId), CommonTerms.Settings, Constants.TreeIcons.Toolbox, "settings", true);
                    node.Action = "javascript:(function(){" + ClientTools.Scripts.ChangeContentFrameUrl(WebUtils.GetPageUrl(Constants.Pages.EditStore) + "?id=" + CurrentStoreId) + "})";
                    tree.Add(node);
                }
                #endregion
                break;

            case StoreTreeNodeType.Orders:
                #region Render tree
                foreach (OrderStatus orderStatus in OrderStatusService.Instance.GetAll(CurrentStoreId))
                {
                    node        = CreateNode(GetNodeIdentifier(StoreTreeNodeType.OrderStatus, CurrentStoreId, orderStatus.Id), orderStatus.Name, Constants.TreeIcons.DocumentTask, "order-status");
                    node.Action = "javascript:(function(){" + ClientTools.Scripts.ChangeContentFrameUrl(WebUtils.GetPageUrl(Constants.Pages.SearchOrders) + "?storeId=" + orderStatus.StoreId + "&orderStatusId=" + orderStatus.Id) + "})";
                    tree.Add(node);
                }
                #endregion
                break;

            case StoreTreeNodeType.Campaigns:
                #region Render tree
                foreach (Campaign campaign in CampaignService.Instance.GetAll(CurrentStoreId))
                {
                    node = CreateNode(GetNodeIdentifier(StoreTreeNodeType.Campaign, CurrentStoreId, campaign.Id), campaign.Name, Constants.TreeIcons.TagLabel, "campaign");

                    if (!campaign.IsActive || (campaign.StartDate != null && campaign.StartDate > DateTime.Now) || (campaign.EndDate != null && campaign.EndDate < DateTime.Now))
                    {
                        node.Style.DimNode();
                    }

                    node.Action = "javascript:(function(){" + ClientTools.Scripts.ChangeContentFrameUrl(WebUtils.GetPageUrl(Constants.Pages.EditCampaign) + "?id=" + campaign.Id + "&storeId=" + campaign.StoreId) + "})";
                    node.Menu.Add(ActionDelete.Instance);
                    tree.Add(node);
                }
                #endregion
                break;

            case StoreTreeNodeType.Settings:
                #region Render tree
                node = CreateNode(GetNodeIdentifier(StoreTreeNodeType.SettingsOrderStatuses, CurrentStoreId), CommonTerms.OrderStatuses, Constants.TreeIcons.ClipboardTask, "settings-order-statuses", true);
                node.Menu.Add(ActionNew.Instance);
                node.Menu.Add(new SortOrderStatusesAction());
                node.Menu.Add(ContextMenuSeperator.Instance);
                node.Menu.Add(ActionRefresh.Instance);
                tree.Add(node);


                node = CreateNode(GetNodeIdentifier(StoreTreeNodeType.SettingsShippingMethods, CurrentStoreId), CommonTerms.ShippingMethods, Constants.TreeIcons.TruckBoxLabel, "settings-shipping-methods", ShippingMethodService.Instance.GetAll(CurrentStoreId).Any());
                node.Menu.Add(ActionNew.Instance);
                node.Menu.Add(new SortShippingMethodsAction());
                node.Menu.Add(ContextMenuSeperator.Instance);
                node.Menu.Add(ActionRefresh.Instance);
                tree.Add(node);

                node = CreateNode(GetNodeIdentifier(StoreTreeNodeType.SettingsPaymentMethods, CurrentStoreId), CommonTerms.PaymentMethods, Constants.TreeIcons.CreditCards, "settings-payment-methods", PaymentMethodService.Instance.GetAll(CurrentStoreId).Any());
                node.Menu.Add(ActionNew.Instance);
                node.Menu.Add(new SortPaymentMethodsAction());
                node.Menu.Add(ContextMenuSeperator.Instance);
                node.Menu.Add(ActionRefresh.Instance);
                tree.Add(node);

                node = CreateNode(GetNodeIdentifier(StoreTreeNodeType.SettingsInternationalization, CurrentStoreId), CommonTerms.Internationalization, Constants.TreeIcons.LocaleAlternate, "settings-internationalization", true);
                tree.Add(node);

                node = CreateNode(GetNodeIdentifier(StoreTreeNodeType.SettingsEmailTemplates, CurrentStoreId), CommonTerms.EmailTemplates, Constants.TreeIcons.MailStack, "settings-email-templates", EmailTemplateService.Instance.GetAll(CurrentStoreId).Any());
                node.Menu.Add(ActionNew.Instance);
                node.Menu.Add(new SortEmailTemplatesAction());
                node.Menu.Add(ContextMenuSeperator.Instance);
                node.Menu.Add(ActionRefresh.Instance);
                tree.Add(node);
                #endregion
                break;

            case StoreTreeNodeType.SettingsOrderStatuses:
                #region Render tree
                foreach (OrderStatus orderStatus in OrderStatusService.Instance.GetAll(CurrentStoreId))
                {
                    node        = CreateNode(GetNodeIdentifier(StoreTreeNodeType.SettingsOrderStatus, CurrentStoreId, orderStatus.Id), orderStatus.Name, Constants.TreeIcons.DocumentTask, "settings-order-status");
                    node.Action = "javascript:(function(){" + ClientTools.Scripts.ChangeContentFrameUrl(WebUtils.GetPageUrl(Constants.Pages.EditOrderStatus) + "?id=" + orderStatus.Id + "&storeId=" + orderStatus.StoreId) + "})";
                    node.Menu.Add(ActionDelete.Instance);
                    tree.Add(node);
                }
                #endregion
                break;

            case StoreTreeNodeType.SettingsShippingMethods:
                #region Render tree
                foreach (ShippingMethod shippingMethod in ShippingMethodService.Instance.GetAll(CurrentStoreId))
                {
                    node        = CreateNode(GetNodeIdentifier(StoreTreeNodeType.SettingsShippingMethod, CurrentStoreId, shippingMethod.Id), shippingMethod.Name, Constants.TreeIcons.BoxLabel, "settings-shipping-method");
                    node.Action = "javascript:(function(){" + ClientTools.Scripts.ChangeContentFrameUrl(WebUtils.GetPageUrl(Constants.Pages.EditShippingMethod) + "?id=" + shippingMethod.Id + "&storeId=" + shippingMethod.StoreId) + "})";
                    node.Menu.Add(ActionDelete.Instance);
                    tree.Add(node);
                }
                #endregion
                break;

            case StoreTreeNodeType.SettingsPaymentMethods:
                #region Render tree
                foreach (PaymentMethod paymentMethod in PaymentMethodService.Instance.GetAll(CurrentStoreId))
                {
                    node        = CreateNode(GetNodeIdentifier(StoreTreeNodeType.SettingsPaymentMethod, CurrentStoreId, paymentMethod.Id), paymentMethod.Name, Constants.TreeIcons.CreditCard, "settings-payment-method");
                    node.Action = "javascript:(function(){" + ClientTools.Scripts.ChangeContentFrameUrl(WebUtils.GetPageUrl(Constants.Pages.EditPaymentMethod) + "?id=" + paymentMethod.Id + "&storeId=" + paymentMethod.StoreId) + "})";
                    node.Menu.Add(ActionDelete.Instance);
                    tree.Add(node);
                }
                #endregion
                break;

            case StoreTreeNodeType.SettingsInternationalization:
                #region Render tree
                node = CreateNode(GetNodeIdentifier(StoreTreeNodeType.SettingsCountries, CurrentStoreId), CommonTerms.Countries, Constants.TreeIcons.GlobeModel, "settings-countries", true /*There is always a default country*/);
                node.Menu.Add(ActionNew.Instance);
                node.Menu.Add(new CreateAllCountriesAction());
                node.Menu.Add(new SortCountriesAction());
                node.Menu.Add(ContextMenuSeperator.Instance);
                node.Menu.Add(ActionRefresh.Instance);
                tree.Add(node);

                node = CreateNode(GetNodeIdentifier(StoreTreeNodeType.SettingsCurrencies, CurrentStoreId), CommonTerms.Currencies, Constants.TreeIcons.MoneyCoin, "settings-currencies", true /*There is always a default currency*/);
                node.Menu.Add(ActionNew.Instance);
                node.Menu.Add(new SortCurrenciesAction());
                node.Menu.Add(ContextMenuSeperator.Instance);
                node.Menu.Add(ActionRefresh.Instance);
                tree.Add(node);

                node = CreateNode(GetNodeIdentifier(StoreTreeNodeType.SettingsVatGroups, CurrentStoreId), CommonTerms.VatGroups, Constants.TreeIcons.ZoneMoney, "settings-vat-groups", true /*There is always a default vat group*/);
                node.Menu.Add(ActionNew.Instance);
                node.Menu.Add(new SortVatGroupsAction());
                node.Menu.Add(ContextMenuSeperator.Instance);
                node.Menu.Add(ActionRefresh.Instance);
                tree.Add(node);
                #endregion
                break;

            case StoreTreeNodeType.SettingsCountries:
                #region Render tree
                foreach (Country country in CountryService.Instance.GetAll(CurrentStoreId))
                {
                    node        = CreateNode(GetNodeIdentifier(StoreTreeNodeType.SettingsCountry, CurrentStoreId, country.Id), country.Name, Constants.TreeIcons.Map, "settings-country", CountryRegionService.Instance.GetAll(CurrentStoreId, country.Id).Any());
                    node.Action = "javascript:(function(){" + ClientTools.Scripts.ChangeContentFrameUrl(WebUtils.GetPageUrl(Constants.Pages.EditCountry) + "?id=" + country.Id + "&storeId=" + country.StoreId) + "})";
                    node.Menu.Add(ActionNew.Instance);
                    node.Menu.Add(new SortCountryRegionsAction());
                    node.Menu.Add(ContextMenuSeperator.Instance);
                    node.Menu.Add(ActionDelete.Instance);
                    node.Menu.Add(ContextMenuSeperator.Instance);
                    node.Menu.Add(ActionRefresh.Instance);
                    tree.Add(node);
                }
                #endregion
                break;

            case StoreTreeNodeType.SettingsCountry:
                #region Render tree
                long countryId = long.Parse(NodeKey.Split(new[] { '_' }, StringSplitOptions.RemoveEmptyEntries)[2]);
                foreach (CountryRegion countryRegion in CountryRegionService.Instance.GetAll(CurrentStoreId, countryId))
                {
                    node        = CreateNode(GetNodeIdentifier(StoreTreeNodeType.SettingsCountryRegion, CurrentStoreId, countryRegion.Id), countryRegion.Name, Constants.TreeIcons.Map, "settings-country-region");
                    node.Action = "javascript:(function(){" + ClientTools.Scripts.ChangeContentFrameUrl(WebUtils.GetPageUrl(Constants.Pages.EditCountryRegion) + "?id=" + countryRegion.Id + "&storeId=" + countryRegion.StoreId) + "})";
                    node.Menu.Add(ActionDelete.Instance);
                    tree.Add(node);
                }
                #endregion
                break;

            case StoreTreeNodeType.SettingsCurrencies:
                #region Render tree
                foreach (Currency currency in CurrencyService.Instance.GetAll(CurrentStoreId))
                {
                    node        = CreateNode(GetNodeIdentifier(StoreTreeNodeType.SettingsCurrency, CurrentStoreId, currency.Id), currency.Name, Constants.TreeIcons.Money, "settings-currency");
                    node.Action = "javascript:(function(){" + ClientTools.Scripts.ChangeContentFrameUrl(WebUtils.GetPageUrl(Constants.Pages.EditCurrency) + "?id=" + currency.Id + "&storeId=" + currency.StoreId) + "})";
                    node.Menu.Add(ActionDelete.Instance);
                    tree.Add(node);
                }
                #endregion
                break;

            case StoreTreeNodeType.SettingsVatGroups:
                #region Render tree
                foreach (VatGroup vatGroup in VatGroupService.Instance.GetAll(CurrentStoreId))
                {
                    node        = CreateNode(GetNodeIdentifier(StoreTreeNodeType.SettingsVatGroup, CurrentStoreId, vatGroup.Id), vatGroup.Name, Constants.TreeIcons.Zone, "settings-vat-group");
                    node.Action = "javascript:(function(){" + ClientTools.Scripts.ChangeContentFrameUrl(WebUtils.GetPageUrl(Constants.Pages.EditVatGroup) + "?id=" + vatGroup.Id + "&storeId=" + vatGroup.StoreId) + "})";
                    node.Menu.Add(ActionDelete.Instance);
                    tree.Add(node);
                }
                #endregion
                break;

            case StoreTreeNodeType.SettingsEmailTemplates:
                #region Render tree
                foreach (EmailTemplate emailTemplate in EmailTemplateService.Instance.GetAll(CurrentStoreId))
                {
                    node        = CreateNode(GetNodeIdentifier(StoreTreeNodeType.SettingsEmailTemplate, CurrentStoreId, emailTemplate.Id), emailTemplate.Name, Constants.TreeIcons.Mail, "settings-email-template");
                    node.Action = "javascript:(function(){" + ClientTools.Scripts.ChangeContentFrameUrl(WebUtils.GetPageUrl(Constants.Pages.EditEmailTemplate) + "?id=" + emailTemplate.Id + "&storeId=" + emailTemplate.StoreId) + "})";
                    node.Menu.Add(ActionDelete.Instance);
                    tree.Add(node);
                }
                #endregion
                break;
            }
        }
コード例 #34
0
ファイル: RaspberryNode.cs プロジェクト: yodiwo/plegma
 //cb when node is paired
 void OnPaired(NodeKey nodekey, string secret)
 {
     ActiveCfg.NodeKey = nodekey;
     ActiveCfg.NodeSecret = secret;
     YConfig.Save();
 }
コード例 #35
0
 public void ShouldCreateKeyForNode()
 {
     Assert.AreEqual("p_0", NodeKey.Create("p"));
     Assert.AreEqual("p_1", NodeKey.Create("p", 1));
     Assert.AreEqual("p_0_a_1", NodeKey.Create("a", 1, "p_0"));
 }
コード例 #36
0
        public bool CompareKey(String keyToCompare)
        {
            NodeKey tempKey;

            if (objKeyType == dBaseType.F)
            {
                tempKey = new NodeKey(new NodeFloat(Double.Parse(keyToCompare)));
            }
            else
            {
                if (objKeyType == dBaseType.N)
                {
                    Double d = Double.Parse(keyToCompare);
                    tempKey = new NodeKey(d);
                }
                else
                {
                    tempKey = new NodeKey(keyToCompare);
                }
            }
            return (objActiveKey.CompareKey(tempKey) == 0);

        }
コード例 #37
0
 public override int add_entry(NodeKey key, int recno)
 {
     throw new NotImplementedException();
 }
コード例 #38
0
ファイル: Ignition.cs プロジェクト: pires/ignite
        /// <summary>
        /// Stops named grid. If <c>cancel</c> flag is set to <c>true</c> then
        /// all jobs currently executing on local node will be interrupted. If
        /// grid name is <c>null</c>, then default no-name Ignite will be stopped.
        /// </summary>
        /// <param name="name">Grid name. If <c>null</c>, then default no-name Ignite will be stopped.</param>
        /// <param name="cancel">If <c>true</c> then all jobs currently executing will be cancelled
        /// by calling <c>ComputeJob.cancel</c>method.</param>
        /// <returns><c>true</c> if named Ignite instance was indeed found and stopped, <c>false</c>
        /// othwerwise (the instance with given <c>name</c> was not found).</returns>
        public static bool Stop(string name, bool cancel)
        {
            lock (SyncRoot)
            {
                NodeKey key = new NodeKey(name);

                Ignite node;

                if (!Nodes.TryGetValue(key, out node))
                    return false;

                node.Stop(cancel);

                Nodes.Remove(key);

                GC.Collect();

                return true;
            }
        }
コード例 #39
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        public override int GetHashCode()
        {
            if (NodeKey == Guid.Empty)
            {
                return(base.GetHashCode());
            }
            string stringRepresentation = System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.FullName + "#" + NodeKey.ToString();

            return(stringRepresentation.GetHashCode());
        }
コード例 #40
0
ファイル: Program.cs プロジェクト: yodiwo/plegma
 private void Node_OnPairedCb(NodeKey nodeKey, SecureString nodeSecret)
 {
     ActiveCfg.NodeKey = nodeKey;
     ActiveCfg.NodeSecret = nodeSecret.SecureStringToString();
     YConfig.Save();
 }
コード例 #41
0
 public void SetKeyValue(double key)
 {
     key_expression[intPosition] = new NodeKey(key);
 }
コード例 #42
0
        /// <summary>
        /// Starts Ignite with given configuration.
        /// </summary>
        /// <returns>Started Ignite.</returns>
        public unsafe static IIgnite Start(IgniteConfiguration cfg)
        {
            IgniteArgumentCheck.NotNull(cfg, "cfg");

            // Copy configuration to avoid changes to user-provided instance.
            IgniteConfigurationEx cfgEx = cfg as IgniteConfigurationEx;

            cfg = cfgEx == null ? new IgniteConfiguration(cfg) : new IgniteConfigurationEx(cfgEx);

            // Set default Spring config if needed.
            if (cfg.SpringConfigUrl == null)
                cfg.SpringConfigUrl = DefaultCfg;

            lock (SyncRoot)
            {
                // 1. Check GC settings.
                CheckServerGc(cfg);

                // 2. Create context.
                IgniteUtils.LoadDlls(cfg.JvmDllPath);

                var cbs = new UnmanagedCallbacks();

                void* ctx = IgniteManager.GetContext(cfg, cbs);

                sbyte* cfgPath0 = IgniteUtils.StringToUtf8Unmanaged(cfg.SpringConfigUrl ?? DefaultCfg);

                string gridName = cfgEx != null ? cfgEx.GridName : null;
                sbyte* gridName0 = IgniteUtils.StringToUtf8Unmanaged(gridName);

                // 3. Create startup object which will guide us through the rest of the process.
                _startup = new Startup(cfg, cbs) { Context = ctx };

                IUnmanagedTarget interopProc = null;

                try
                {
                    // 4. Initiate Ignite start.
                    UU.IgnitionStart(cbs.Context, cfg.SpringConfigUrl ?? DefaultCfg,
                        cfgEx != null ? cfgEx.GridName : null, ClientMode);

                    // 5. At this point start routine is finished. We expect STARTUP object to have all necessary data.
                    var node = _startup.Ignite;
                    interopProc = node.InteropProcessor;

                    // 6. On-start callback (notify lifecycle components).
                    node.OnStart();

                    Nodes[new NodeKey(_startup.Name)] = node;

                    return node;
                }
                catch (Exception)
                {
                    // 1. Perform keys cleanup.
                    string name = _startup.Name;

                    if (name != null)
                    {
                        NodeKey key = new NodeKey(name);

                        if (Nodes.ContainsKey(key))
                            Nodes.Remove(key);
                    }

                    // 2. Stop Ignite node if it was started.
                    if (interopProc != null)
                        UU.IgnitionStop(interopProc.Context, gridName, true);

                    // 3. Throw error further (use startup error if exists because it is more precise).
                    if (_startup.Error != null)
                        throw _startup.Error;

                    throw;
                }
                finally
                {
                    _startup = null;

                    Marshal.FreeHGlobal((IntPtr)cfgPath0);

                    if ((IntPtr)gridName0 != IntPtr.Zero)
                        Marshal.FreeHGlobal((IntPtr)gridName0);

                    if (interopProc != null)
                        UU.ProcessorReleaseStart(interopProc);
                }
            }
        }
コード例 #43
0
ファイル: Ignition.cs プロジェクト: pires/ignite
        /// <summary>
        /// Starts Ignite with given configuration.
        /// </summary>
        /// <returns>Started Ignite.</returns>
        public static unsafe IIgnite Start(IgniteConfiguration cfg)
        {
            IgniteArgumentCheck.NotNull(cfg, "cfg");

            lock (SyncRoot)
            {
                // 1. Check GC settings.
                CheckServerGc(cfg);

                // 2. Create context.
                IgniteUtils.LoadDlls(cfg.JvmDllPath);

                var cbs = new UnmanagedCallbacks();

                IgniteManager.CreateJvmContext(cfg, cbs);

                var gridName = cfg.GridName;

                var cfgPath = cfg.SpringConfigUrl == null
                    ? null
                    : Environment.GetEnvironmentVariable(EnvIgniteSpringConfigUrlPrefix) + cfg.SpringConfigUrl;

                // 3. Create startup object which will guide us through the rest of the process.
                _startup = new Startup(cfg, cbs);

                IUnmanagedTarget interopProc = null;

                try
                {
                    // 4. Initiate Ignite start.
                    UU.IgnitionStart(cbs.Context, cfgPath, gridName, ClientMode);

                    // 5. At this point start routine is finished. We expect STARTUP object to have all necessary data.
                    var node = _startup.Ignite;
                    interopProc = node.InteropProcessor;

                    // 6. On-start callback (notify lifecycle components).
                    node.OnStart();

                    Nodes[new NodeKey(_startup.Name)] = node;

                    return node;
                }
                catch (Exception)
                {
                    // 1. Perform keys cleanup.
                    string name = _startup.Name;

                    if (name != null)
                    {
                        NodeKey key = new NodeKey(name);

                        if (Nodes.ContainsKey(key))
                            Nodes.Remove(key);
                    }

                    // 2. Stop Ignite node if it was started.
                    if (interopProc != null)
                        UU.IgnitionStop(interopProc.Context, gridName, true);

                    // 3. Throw error further (use startup error if exists because it is more precise).
                    if (_startup.Error != null)
                        throw _startup.Error;

                    throw;
                }
                finally
                {
                    _startup = null;

                    if (interopProc != null)
                        UU.ProcessorReleaseStart(interopProc);
                }
            }
        }
コード例 #44
0
        /// <summary>
        /// Удаление данных из дерева по ключу
        /// </summary>
        public void Delete(Key key)
        {
            if (NodeKey.CompareTo(key) == 0)
            {
                if (Left == null && Right == null)
                {
                    NodeKey = default(Key);
                }
                else if (Left == null)
                {
                    Copy(Right, this);
                }
                else if (Right == null)
                {
                    Copy(Left, this);
                }
                else
                {
                    if (Right.Left == null)
                    {
                        NodeKey   = Right.NodeKey;
                        NodeValue = Right.NodeValue;
                        Right     = Right.Right;
                    }
                    else
                    {
                        var parent = Right;
                        var node   = parent.Left;

                        while (node.Left != null)
                        {
                            parent = node;
                            node   = parent.Left;
                        }

                        NodeKey   = node.NodeKey;
                        NodeValue = node.NodeValue;
                        if (node.Right == null)
                        {
                            parent.Left = null;
                        }
                        else
                        {
                            parent.Left = node.Right;
                        }
                    }
                }
            }
            else if (NodeKey.CompareTo(key) > 0 && Left != null)
            {
                Left.Delete(key);
                if (Left.NodeKey.CompareTo(default(Key)) == 0)
                {
                    Left = null;
                }
            }
            else if (NodeKey.CompareTo(key) < 0 && Right != null)
            {
                Right.Delete(key);
                if (Right.NodeKey.CompareTo(default(Key)) == 0)
                {
                    Right = null;
                }
            }
        }
コード例 #45
0
ファイル: SkyWriterNode.cs プロジェクト: yodiwo/plegma
 //cb when node is paired
 void OnPaired(NodeKey nodekey, SecureString secret)
 {
     ActiveCfg.NodeKey = nodekey;
     ActiveCfg.NodeSecret = secret.SecureStringToString();
     YConfig.Save();
 }
コード例 #46
0
 //cb when node is paired
 void OnPaired(NodeKey nodekey, SecureString secret)
 {
     ActiveCfg.NodeKey    = nodekey;
     ActiveCfg.NodeSecret = secret.SecureStringToString();
     YConfig.Save();
 }
コード例 #47
0
ファイル: Ignition.cs プロジェクト: mshonichev/ignite
        /// <summary>
        /// Starts Ignite with given configuration.
        /// </summary>
        /// <returns>Started Ignite.</returns>
        public unsafe static IIgnite Start(IgniteConfiguration cfg)
        {
            IgniteArgumentCheck.NotNull(cfg, "cfg");

            // Copy configuration to avoid changes to user-provided instance.
            IgniteConfigurationEx cfgEx = cfg as IgniteConfigurationEx;

            cfg = cfgEx == null ? new IgniteConfiguration(cfg) : new IgniteConfigurationEx(cfgEx);

            // Set default Spring config if needed.
            if (cfg.SpringConfigUrl == null)
            {
                cfg.SpringConfigUrl = DefaultCfg;
            }

            lock (SyncRoot)
            {
                // 1. Check GC settings.
                CheckServerGc(cfg);

                // 2. Create context.
                IgniteUtils.LoadDlls(cfg.JvmDllPath);

                var cbs = new UnmanagedCallbacks();

                IgniteManager.CreateJvmContext(cfg, cbs);

                var gridName = cfgEx != null ? cfgEx.GridName : null;

                var cfgPath = Environment.GetEnvironmentVariable(EnvIgniteSpringConfigUrlPrefix) + cfg.SpringConfigUrl;

                // 3. Create startup object which will guide us through the rest of the process.
                _startup = new Startup(cfg, cbs);

                IUnmanagedTarget interopProc = null;

                try
                {
                    // 4. Initiate Ignite start.
                    UU.IgnitionStart(cbs.Context, cfgPath, gridName, ClientMode);

                    // 5. At this point start routine is finished. We expect STARTUP object to have all necessary data.
                    var node = _startup.Ignite;
                    interopProc = node.InteropProcessor;

                    // 6. On-start callback (notify lifecycle components).
                    node.OnStart();

                    Nodes[new NodeKey(_startup.Name)] = node;

                    return(node);
                }
                catch (Exception)
                {
                    // 1. Perform keys cleanup.
                    string name = _startup.Name;

                    if (name != null)
                    {
                        NodeKey key = new NodeKey(name);

                        if (Nodes.ContainsKey(key))
                        {
                            Nodes.Remove(key);
                        }
                    }

                    // 2. Stop Ignite node if it was started.
                    if (interopProc != null)
                    {
                        UU.IgnitionStop(interopProc.Context, gridName, true);
                    }

                    // 3. Throw error further (use startup error if exists because it is more precise).
                    if (_startup.Error != null)
                    {
                        throw _startup.Error;
                    }

                    throw;
                }
                finally
                {
                    _startup = null;

                    if (interopProc != null)
                    {
                        UU.ProcessorReleaseStart(interopProc);
                    }
                }
            }
        }
コード例 #48
0
ファイル: Bus.cs プロジェクト: vadian/netmq
 protected bool Equals(NodeKey other)
 {
     return string.Equals(Name, other.Name) && Port == other.Port;
 }
コード例 #49
0
ファイル: TimelineDescriptor.cs プロジェクト: sm6uax/plegma
 //------------------------------------------------------------------------------------------------------------------------
 public NodeInfoTimelineInfo(Yodiwo.API.Warlock.NodeDescriptor desc)
 {
     NodeKey = desc.NodeKey;
     Name    = desc.Name;
 }
コード例 #50
0
ファイル: Bus.cs プロジェクト: vadian/netmq
        private void OnBeaconReady(object sender, NetMQBeaconEventArgs e)
        {
            // we got another beacon
            // let's check if we already know about the beacon
            string nodeName;
            int port = Convert.ToInt32(m_beacon.ReceiveString(out nodeName));

            // remove the port from the peer name
            nodeName = nodeName.Replace(":" + m_broadcastPort, "");

            NodeKey node = new NodeKey(nodeName, port);

            // check if node already exist
            if (!m_nodes.ContainsKey(node))
            {
                // we have a new node, let's add it and connect to subscriber
                m_nodes.Add(node, DateTime.Now);
                m_publisher.Connect(node.Address);
                m_shim.SendMoreFrame(AddedNodeCommand).SendFrame(node.Address);
            }
            else
            {
                //Console.WriteLine("Node {0} is not a new beacon.", node);
                m_nodes[node] = DateTime.Now;
            }
        }
コード例 #51
0
 public override int add_entry(NodeKey key, int recno)
 {
     throw new NotImplementedException();
 }
コード例 #52
0
ファイル: Program.cs プロジェクト: sm6uax/plegma
 private void Node_OnPairedCb(NodeKey nodeKey, SecureString nodeSecret)
 {
     ActiveCfg.NodeKey    = nodeKey;
     ActiveCfg.NodeSecret = nodeSecret.SecureStringToString();
     YConfig.Save();
 }