public string LastGetDate(string day)
        {
            var month = GetMonth(Last.FindElement(By.XPath(".//span[contains(@class, 'ui-datepicker-month')]")).Text);
            var year  = Last.FindElement(By.XPath(".//span[contains(@class, 'ui-datepicker-year')]")).Text;

            return(year + month + day);
        }
 /// <summary>
 /// Check Name equality.
 /// </summary>
 /// <param name="name"></param>
 /// <returns></returns>
 public bool Equals(Name name) => name == null ? false :
 Suffix.Equals(name.Suffix) &&
 (
     ReferenceEquals(this.Suffix, name.Suffix) ||
     Suffix != null &&
     Suffix.Equals(name.Suffix)
 ) &&
 (
     ReferenceEquals(this.First, name.First) ||
     First != null &&
     First.Equals(name.First)
 ) &&
 (
     ReferenceEquals(this.Middle, name.Middle) ||
     Middle != null &&
     Middle.Equals(name.Middle)
 ) &&
 (
     ReferenceEquals(this.Last, name.Last) ||
     Last != null &&
     Last.Equals(name.Last)
 ) &&
 (
     ReferenceEquals(this.Prefix, name.Prefix) ||
     Prefix != null &&
     Prefix.Equals(name.Prefix)
 ) &&
 (
     ReferenceEquals(this.IsOrganization, name.IsOrganization) ||
     IsOrganization.Equals(name.IsOrganization)
 );
Пример #3
0
        public void Replace(DoublyLinkedNode <T> node, T value)
        {
            if (node is null)
            {
                throw new ArgumentNullException(nameof(node));
            }

            PracticeExtensions.ThrowIfNull(value, nameof(value));

            var nodeIsFirst = ReferenceEquals(First, node);
            var nodeIsLast  = ReferenceEquals(Last, node);

            if (nodeIsFirst)
            {
                var newNode = First.Replace(value);
                First = newNode;
            }

            if (nodeIsLast)
            {
                var newNode = Last.Replace(value);
                Last = newNode;
            }

            if (!nodeIsFirst && !nodeIsLast)
            {
                node.Replace(value);
            }
        }
Пример #4
0
 /// <summary>
 /// Gets all decorators of the specified type</summary>
 /// <param name="type">Decorator type</param>
 /// <returns>Enumeration of non-null decorators that are of the specified type. The enumeration may be empty.</returns>
 public IEnumerable <object> GetDecorators(Type type)
 {
     foreach (object obj in Last.AsAll(type))
     {
         yield return(obj);
     }
 }
Пример #5
0
        public TextFormatConverter(
            TextParser parser,
            FormatStore store,
            Injection injection,
            Stream traceStream,
            bool traceShowTokenNum,
            int traceStopOnTokenNum,
            Stream formatConverterTraceStream) :
            base(store, formatConverterTraceStream)
        {
#if DEBUG
            if (traceStream != null)
            {
                trace = new TestHtmlTrace(traceStream, traceShowTokenNum, traceStopOnTokenNum);
            }
#endif
            this.parser = parser;

            this.injection = injection;

            // open the document container
            InitializeDocument();

            // open the first paragraph container
            OpenContainer(FormatContainerType.Block, false);


            Last.SetProperty(PropertyPrecedence.NonStyle, PropertyId.FontSize, new PropertyValue(LengthUnits.Points, 10));
        }
Пример #6
0
        public INSiteMaint()
        {
            if (insetup.Current == null)
            {
                throw new PXSetupNotEnteredException(ErrorMessages.SetupNotEntered, typeof(INSetup), PXMessages.LocalizeNoPrefix(IN.Messages.INSetup));
            }

            if (!PXAccess.FeatureInstalled <FeaturesSet.warehouse>())
            {
                site.Cache.AllowInsert = getDefaultSiteID() == null;
                Next.SetVisible(false);
                Previous.SetVisible(false);
                Last.SetVisible(false);
                First.SetVisible(false);
            }

            PXUIFieldAttribute.SetVisible <INSite.pPVAcctID>(siteaccounts.Cache, null, true);
            PXUIFieldAttribute.SetVisible <INSite.pPVSubID>(siteaccounts.Cache, null, true);

            PXUIFieldAttribute.SetDisplayName <Contact.salutation>(Caches[typeof(Contact)], CR.Messages.Attention);
            PXUIFieldAttribute.SetDisplayName <INSite.overrideInvtAccSub>(siteaccounts.Cache, PXAccess.FeatureInstalled <FeaturesSet.subAccount>() ? Messages.OverrideInventoryAcctSub : Messages.OverrideInventoryAcct);

            PXUIFieldAttribute.SetEnabled <Contact.fullName>(Caches[typeof(Contact)], null);

            action.AddMenuAction(changeID);

            PXImportAttribute importAttribute = location.Attributes.Find(a => a is PXImportAttribute) as PXImportAttribute;

            importAttribute.MappingPropertiesInit += MappingPropertiesInit;
        }
Пример #7
0
        /// <summary>
        /// Is the specified object equivalent to this instance? (All fields identical)
        /// </summary>
        /// <param name="obj">The object to compare.</param>
        /// <returns><see langword="true"/>, if the object is a <see cref="PersonName"/> and ALL fields are identical; otherwise, <see langword="false"/></returns>
        public override bool Equals(object obj)
        {
            if (!(obj is PersonName pn))
            {
                return(false);
            }

            if (First.HasChanges(pn.First))
            {
                return(false);
            }
            if (Last.HasChanges(pn.Last))
            {
                return(false);
            }
            if (Middle.HasChanges(pn.Middle))
            {
                return(false);
            }
            if (Prefix.HasChanges(pn.Prefix))
            {
                return(false);
            }
            if (Suffix.HasChanges(pn.Suffix))
            {
                return(false);
            }
            if (Nickname.HasChanges(pn.Nickname))
            {
                return(false);
            }
            return(true);
        }
Пример #8
0
        private void timer1_Tick(object sender, EventArgs e)
        {
            var Last = -1L;

            this.applicationWebService1.Table1_Last(
                svalue =>
            {
                var value = long.Parse(svalue);

                if (this.last == null)
                {
                    this.last = new Last {
                        value = value
                    };
                    return;
                }

                if (value == this.last.value)
                {
                    return;
                }


                this.last.value = value;

                InitializeContent();
            }
                );
        }
Пример #9
0
        /// <summary>
        /// Removes the node at the end of the <see cref="SinglyLinkedList{T}"/>.
        /// </summary>
        public void RemoveLast()
        {
            if (Count == 0)
            {
                throw new InvalidOperationException("The SinglyLinkedList doesn't contain any elements.");
            }

            if (Count == 1)
            {
                First.Invalidate();
                First = null;
                Last  = null;
                Count--;
                return;
            }

            var curNode = First;

            while (curNode.Next != Last)
            {
                curNode = curNode.Next;
            }

            curNode.Next = null;
            Last.Invalidate();
            Last = curNode;
            Count--;
        }
Пример #10
0
        public XmppHandlerResult ProcessElement(Presence element, XmppSession session, XmppHandlerContext context)
        {
            var result = Component();

            if (!element.HasTo)
            {
                // send to itself available resource
                foreach (var s in context.Sessions.GetSessions(element.From.BareJid).Where(s => s.Available))
                {
                    var p = (Presence)element.Clone();
                    p.To = s.Jid;
                    result.Add(Send(s, p));
                }

                var last = new Last {
                    Value = element.Status, Seconds = UnixDateTime.ToUnix(DateTime.UtcNow)
                };
                context.Storages.Elements.SaveElement(session.Jid, agsXMPP.Uri.IQ_LAST, last);

                // broadcast to subscribers
                foreach (var to in context.Storages.Users.GetSubscribers(session.Jid))
                {
                    foreach (var s in context.Sessions.GetSessions(to.BareJid).Where(s => s.Available))
                    {
                        var p = (Presence)element.Clone();
                        p.To = s.Jid;
                        result.Add(Send(s, p));
                    }
                }

                session.Presence = element;
            }
            return(result);
        }
Пример #11
0
        /// <summary>检查缓存</summary>
        protected virtual void CheckCache()
        {
            var ms = Stream;

            if (ms == null)
            {
                Stream = ms = new MemoryStream();
            }

            // 超过该时间后按废弃数据处理
            var now = DateTime.Now;

            if (ms.Length > ms.Position && Last.AddMilliseconds(Expire) < now && (MaxCache <= 0 || MaxCache <= ms.Length))
            {
                var retain = ms.Length - ms.Position;
                var buf    = ms.ReadBytes(500);
                using var span = Tracer?.NewSpan("net:PacketCodec:DropCache", $"[{retain}]{buf.ToHex()}");
                span?.SetError(new Exception($"数据包编码器放弃数据 retain={retain} MaxCache={MaxCache}"), null);

                if (XTrace.Debug)
                {
                    XTrace.Log.Debug("数据包编码器放弃数据 {0:n0},Last={1},MaxCache={2:n0}", ms.Length, Last, MaxCache);
                }

                ms.SetLength(0);
                ms.Position = 0;
            }
            Last = now;
        }
        private void timer1_Tick(object sender, EventArgs e)
        {
            var Last = -1L;

            this.applicationWebService1.Table1_Last(
                svalue =>
                {
                    var value = long.Parse(svalue);

                    if (this.last == null)
                    {
                        this.last = new Last { value = value };
                        return;
                    }

                    if (value == this.last.value)
                        return;


                    this.last.value = value;

                    InitializeContent();

                }
            );
        }
Пример #13
0
 public override int GetHashCode()
 {
     unchecked
     {
         return(((Name != null ? Name.GetHashCode() : 0) * 397) ^ Last.GetHashCode());
     }
 }
Пример #14
0
        public IEnumerable <Uri> Interpolate()
        {
            if (Next == null || Last == null)
            {
                throw new InvalidOperationException("Next and Last are required to interpolate.");
            }

            var parsedNext = Next.ParseQueryString();

            if (!int.TryParse(parsedNext.Get("page"), out var pageNext) ||
                !int.TryParse(Last.ParseQueryString().Get("page"), out var pageLast))
            {
                throw new InvalidOperationException("Only page based interpolation is supported.");
            }

            if (pageLast < pageNext)
            {
                throw new InvalidOperationException("Impossible state detected.");
            }

            var builder = new UriBuilder(Next);

            for (var i = pageNext; i <= pageLast; ++i)
            {
                parsedNext.Set("page", i.ToString());
                builder.Query = parsedNext.ToString();
                yield return(builder.Uri);
            }
        }
Пример #15
0
        public async Task <CoreNode> CreateNodeAsync(bool start = false)
        {
            var child = Path.Combine(Root, Last.ToString());

            Last++;
            try
            {
                var cfgPath = Path.Combine(child, "data", "bitcoin.conf");
                if (File.Exists(cfgPath))
                {
                    var config      = NodeConfigParameters.Load(cfgPath);
                    var rpcPort     = config["regtest.rpcport"];
                    var rpcUser     = config["regtest.rpcuser"];
                    var rpcPassword = config["regtest.rpcpassword"];
                    var pidFileName = config["regtest.pid"];
                    var credentials = new NetworkCredential(rpcUser, rpcPassword);
                    try
                    {
                        var rpc = new RPCClient(credentials, new Uri("http://127.0.0.1:" + rpcPort + "/"), Network.RegTest);
                        await rpc.StopAsync();

                        var pidFile = Path.Combine(child, "data", "regtest", pidFileName);
                        if (File.Exists(pidFile))
                        {
                            var pid = File.ReadAllText(pidFile);
                            using var process = Process.GetProcessById(int.Parse(pid));
                            process.WaitForExit();
                        }
                        else
                        {
                            var allProcesses      = Process.GetProcesses();
                            var bitcoindProcesses = allProcesses.Where(x => x.ProcessName.Contains("bitcoind"));
                            if (bitcoindProcesses.Count() == 1)
                            {
                                var bitcoind = bitcoindProcesses.First();
                                bitcoind.WaitForExit();
                            }
                        }
                    }
                    catch (Exception)
                    {
                    }
                }
                await IoHelpers.DeleteRecursivelyWithMagicDustAsync(child);
                await TryRemoveWorkingDirectoryAsync();

                Directory.CreateDirectory(WorkingDirectory);
            }
            catch (DirectoryNotFoundException)
            {
            }
            var node = await CoreNode.CreateAsync(child, this);

            Nodes.Add(node);
            if (start)
            {
                await node.StartAsync();
            }
            return(node);
        }
 public bool Equals(IName other)
 {
     return(First.Equals(other.First, StringComparison.CurrentCultureIgnoreCase) &&
            Middle.Equals(other.Middle, StringComparison.CurrentCultureIgnoreCase) &&
            Last.Equals(other.Last, StringComparison.CurrentCultureIgnoreCase) &&
            Gender.Equals(other.Gender));
 }
Пример #17
0
        public INSiteMaint()
        {
            if (!PXAccess.FeatureInstalled <FeaturesSet.warehouse>())
            {
                site.Cache.AllowInsert = getDefaultSiteID() == null;
                Next.SetVisible(false);
                Previous.SetVisible(false);
                Last.SetVisible(false);
                First.SetVisible(false);
            }

            PXUIFieldAttribute.SetVisible <INSite.pPVAcctID>(siteaccounts.Cache, null, true);
            PXUIFieldAttribute.SetVisible <INSite.pPVSubID>(siteaccounts.Cache, null, true);

            PXUIFieldAttribute.SetVisible <INSite.discAcctID>(siteaccounts.Cache, null, false);
            PXUIFieldAttribute.SetVisible <INSite.discSubID>(siteaccounts.Cache, null, false);

            PXUIFieldAttribute.SetVisible <INSite.freightAcctID>(siteaccounts.Cache, null, false);
            PXUIFieldAttribute.SetVisible <INSite.freightSubID>(siteaccounts.Cache, null, false);

            PXUIFieldAttribute.SetVisible <INSite.miscAcctID>(siteaccounts.Cache, null, false);
            PXUIFieldAttribute.SetVisible <INSite.miscSubID>(siteaccounts.Cache, null, false);

            PXUIFieldAttribute.SetDisplayName <Contact.salutation>(Caches[typeof(Contact)], CR.Messages.Attention);
            PXUIFieldAttribute.SetDisplayName <INSite.overrideAccSub>(siteaccounts.Cache, PXAccess.FeatureInstalled <FeaturesSet.subAccount>() ? Messages.OverrideInventoryAcctSub : Messages.OverrideInventoryAcct);

            PXUIFieldAttribute.SetEnabled <Contact.fullName>(Caches[typeof(Contact)], null);

            action.AddMenuAction(changeID);

            PXImportAttribute importAttribute = location.Attributes.Find(a => a is PXImportAttribute) as PXImportAttribute;

            importAttribute.MappingPropertiesInit += MappingPropertiesInit;
        }
Пример #18
0
        internal override IEnumerable <String> ExtractNames()
        {
            if (First != null)
            {
                foreach (var n in First.ExtractNames())
                {
                    yield return(n);
                }
            }

            if (Second != null)
            {
                foreach (var n in Second.ExtractNames())
                {
                    yield return(n);
                }
            }

            if (Last != null)
            {
                foreach (var n in Last.ExtractNames())
                {
                    yield return(n);
                }
            }
        }
Пример #19
0
        public byte[] GetData()
        {
            byte[] returned;

            using (MemoryStream MS = new MemoryStream())
            {
                BinaryWriter writer = new BinaryWriter(MS);

                Header.FileSize = 1 + Header.HeaderSize + Palette.Size + Reserved.Size + Compressed.Size();

                Header.Get(writer);
                Palette.Get(writer);
                WidthTable.Get(writer);
                Unknown.Get(writer);
                Reserved.Get(writer);
                Compressed.Get(writer);
                if (Last != null)
                {
                    Header.LastPosition        = Last.Get(writer);
                    writer.BaseStream.Position = 0;
                    Header.Get(writer);
                }

                returned = MS.ToArray();
            }

            return(returned);
        }
Пример #20
0
        public void RemoveAt(int index)
        {
            if (index < 0 || index >= Length)
            {
                return;
            }

            LLNode <T> node = this[index];

            if (node.PrevNode != null)
            {
                node.PrevNode.NextNode = node.NextNode;
            }
            if (node.NextNode != null)
            {
                node.NextNode.PrevNode = node.PrevNode;
            }

            if (Last.Equals(node))
            {
                Last = node.PrevNode;
            }
            else if (First.Equals(node))
            {
                First = node.NextNode;
            }
            Length--;
        }
        /// <summary>
        /// Gets the hash code
        /// </summary>
        /// <returns>Hash code</returns>
        public override int GetHashCode()
        {
            unchecked // Overflow is fine, just wrap
            {
                var hashCode = 41;
                // Suitable nullity checks etc, of course :)

                hashCode = hashCode * 59 + Total.GetHashCode();

                hashCode = hashCode * 59 + Count.GetHashCode();

                hashCode = hashCode * 59 + Size.GetHashCode();

                hashCode = hashCode * 59 + Current.GetHashCode();
                if (First != null)
                {
                    hashCode = hashCode * 59 + First.GetHashCode();
                }
                if (Last != null)
                {
                    hashCode = hashCode * 59 + Last.GetHashCode();
                }
                if (Prev != null)
                {
                    hashCode = hashCode * 59 + Prev.GetHashCode();
                }
                if (Next != null)
                {
                    hashCode = hashCode * 59 + Next.GetHashCode();
                }
                return(hashCode);
            }
        }
Пример #22
0
        /// <summary>
        /// Removes the node at the end of the <see cref="SinglyLinkedList{T}"/>.
        /// </summary>
        public void RemoveLast()
        {
            if (Count == 0)
            {
                throw new InvalidOperationException();
            }

            if (Count == 1)
            {
                First.Invalidate();
                First = null;
                Last  = null;
                Count--;
                return;
            }

            var curNode = First;

            while (curNode.Next != Last)
            {
                curNode = curNode.Next;
            }

            curNode.Next = null;
            Last.Invalidate();
            Last = curNode;
            Count--;
        }
Пример #23
0
 public override int GetHashCode()
 {
     return(unchecked (
                2 * First.GetHashCode() +
                7 * Last.GetHashCode() +
                11 * Page.GetHashCode()
                ));
 }
Пример #24
0
 public void Print(object obj)
 {
     if (Last.GetType() != typeof(OutputChainBuffer))
     {
         AddBuffer();
     }
     Last.Print(obj);
 }
Пример #25
0
 public int CompareTo(Name other)
 {
     if (!Last.Equals(other.Last))
     {
         return(Last.CompareTo(other.Last));
     }
     return(Rest.CompareTo(other.Rest));
 }
Пример #26
0
 public void Print(string value)
 {
     if (Last.GetType() != typeof(OutputChainBuffer))
     {
         AddBuffer();
     }
     Last.Print(value);
 }
Пример #27
0
 private ImmutableEnumerator(LazyList next, Last last)
 {
     this.next = next;
     this.last = last;
     // Use the default hashCode on the single mutable LazyList
     // instance for this position in the enumerator.
     this.hashCode = next.GetHashCode();
 }
Пример #28
0
        // public double OpenInterest { get; set; }

        /// <summary>
        /// override
        /// </summary>
        /// <returns></returns>
        public override string ToString()
        {
            return(TimeStamp.ToString() + ',' +
                   Open.ToString() + ',' +
                   High.ToString() + ',' +
                   Low.ToString() + ',' +
                   Last.ToString() + ',' +
                   Volume.ToString());
        }
Пример #29
0
        public override void Move(Vector shift)
        {
            isMoving = true;

            First.Move(shift);
            Last.Move(shift);

            isMoving = false;
        }
Пример #30
0
 public new  void PhepQuay(double alpha)
 {
     List.Clear();
     First.PhepQuay(alpha);
     Last.PhepQuay(alpha);
     List.Add(First);
     List.Add(Last);
     this.Draw();
 }
Пример #31
0
 public new  void PhepTyLe(double x)
 {
     List.Clear();
     First.PhepTyLe(x, x);
     Last.PhepTyLe(x, x);
     List.Add(First);
     List.Add(Last);
     this.Draw();
 }
Пример #32
0
 public JsonMtGOX()
 {
     high = new High();
     low = new Low();
     avg = new Avg();
     vwap = new Vwap();
     vol = new Vol();
     lastlocal = new LastLocal();
     lastorig = new LastOrig();
     lastall = new LastAll();
     last = new Last();
     buy = new Buy();
     sell = new Sell();
     rootobject = new RootObject();
     returnObject = new Return();
 }
        private static void GetRepertoires(string specificCharacterSet, out CharacterSetInfo defaultRepertoire, out Dictionary<string, CharacterSetInfo> extensionRepertoires)
        {
            //Most of the time, especially on the same thread, the specific character set will be the same.
            //This simple check avoids having to figure it out over and over again, which gets expensive.
            var last = _last;
            if (last != null && specificCharacterSet == last.SpecificCharacterSet)
            {
                defaultRepertoire = last.DefaultRepertoire;
                extensionRepertoires = last.ExtensionRepertoires;
                return;
            }

            // TODO:
            // Specific Character Set may have up to n values if 
            // Code Extensions are used. We accomodate for that here
            // by parsing out all the different possible defined terms.
            // At this point, however, we're not going to handle escaping
            // between character sets from different code pages within
            // a single string. For example, DICOM implies that you should
            // be able to have JIS-encoded Japanese, ISO European characters,
            // Thai characters and Korean characters on the same line, using
            // Code Extensions (escape sequences). (Chinese is not included
            // since the only support for Chinese is through GB18030 and
            // UTF-8, both of which do not support Code Extensions.)
            string[] specificCharacterSetValues = specificCharacterSet.Split('\\');
            defaultRepertoire = null;

            // set the default repertoire from Value 1 
            if (specificCharacterSetValues.GetUpperBound(0) >= 0)
            {
                if (!CharacterSetDatabase.TryGetValue(specificCharacterSetValues[0], out defaultRepertoire))
                    // we put in the default repertoire. Technically, it may
                    // not be ISO 2022 IR 6, but ISO_IR 6, but the information
                    // we want to use is the same
                    defaultRepertoire = CharacterSetDatabase["ISO 2022 IR 6"];
            }

            // Here we are accounting for cases where the same character sets are repeated, so
            // we need to select out the unique ones.  It should never really happen, but it 
            // does happen with a particular dataset when querying JDicom.
            List<string> uniqueExtensionRepertoireDefinedTerms = new List<string>();
            for (int i = 1; i < specificCharacterSetValues.Length; ++i)
            {
                string value = specificCharacterSetValues[i];
                if (value != defaultRepertoire.DefinedTerm && !uniqueExtensionRepertoireDefinedTerms.Contains(value))
                    uniqueExtensionRepertoireDefinedTerms.Add(value);
            }

            // parse out the extension repertoires
            extensionRepertoires = new Dictionary<string, CharacterSetInfo>();
            foreach (string value in uniqueExtensionRepertoireDefinedTerms)
            {
                if (CharacterSetDatabase.ContainsKey(value) && !extensionRepertoires.ContainsKey(value))
                {
                    // special robustness handling of GB18030 and UTF-8
                    if ("GB18030" == value || "ISO_IR 192" == value)
                    {
                        // these two character sets can't use code extensions, so there should really only be 1
                        // character set in the repertoire
                        extensionRepertoires.Clear();
                        extensionRepertoires.Add(value, CharacterSetDatabase[value]);
                        break;
                    }

                    extensionRepertoires.Add(value, CharacterSetDatabase[value]);
                }
                else if (!extensionRepertoires.ContainsKey("ISO 2022 IR 6"))
                {
                    // we put in the default repertoire. Technically, it may
                    // not be ISO 2022 IR 6, but ISO_IR 6, but the information
                    // we want to use is the same
                    extensionRepertoires.Add(value, CharacterSetDatabase["ISO 2022 IR 6"]);
                }
            }

            _last = new Last(specificCharacterSet, defaultRepertoire, extensionRepertoires);
        }