/// <summary> Add a single descriptive element, by term </summary>
        /// <param name="Term"> Normalized term for this metadata element, as employed by the SobekCM system </param>
        /// <param name="Value"> String version of this single value for a metadata term/type </param>
        public void Add_Description(string Term, ReadOnlyCollection <string> Value)
        {
            // If the value is NULL or empty, do nothing
            if ((Value == null) || (Value.Count == 0))
            {
                return;
            }

            // Was a value, so look to add it
            BriefItem_DescriptiveTerm currentList;

            if (descriptionTermLookup.TryGetValue(Term, out currentList))
            {
                foreach (string thisValue in Value)
                {
                    currentList.Add_Value(thisValue);
                }
            }
            else
            {
                BriefItem_DescriptiveTerm newElement = new BriefItem_DescriptiveTerm(Term);
                foreach (string thisValue in Value)
                {
                    newElement.Add_Value(thisValue);
                }
                Description.Add(newElement);
                descriptionTermLookup.Add(Term, newElement);
            }
        }
Example #2
0
 /// <summary>
 /// Adds the title text.
 /// </summary>
 /// <param name="key">The key to consider.</param>
 /// <param name="text">The text to consider.</param>
 public void AddDescriptionText(string key, string text)
 {
     if (Description == null)
     {
         Description = new DictionaryDataItem();
     }
     Description.Add(key, text);
 }
 /// <summary> Add a fully built descriptive element, by term </summary>
 /// <param name="TermObject"> Fully built descriptive term element, as employed by the SobekCM system </param>
 public void Add_Description(BriefItem_DescriptiveTerm TermObject)
 {
     // Was a value, so look to add it
     if (!descriptionTermLookup.ContainsKey(TermObject.Term))
     {
         descriptionTermLookup.Add(TermObject.Term, TermObject);
         Description.Add(TermObject);
     }
 }
Example #4
0
 public InternalParamLimit_Limit() : base()
 {
     base.StrategyType = "Limit-Limit";
     Description.Add("EnterDistance", "Расcтояние входа в позицию: [Шаг в %]-[Шаг в пунктах]-[Использовать шаг в %]");
     Description.Add("CloseDistance", "Расcтояние закрытия позиции: [Шаг в %]-[Шаг в пунктах]-[Использовать шаг в %]");
     Description.Add("IsLong", "Делать покупку [true/false]");
     Description.Add("IsShort", "Делать продажу [true/false]");
     Description.Add("StopDistance", "Расcтояние ограничения убытка по стопу: [Шаг в %]-[Шаг в пунктах]-[Использовать шаг в %]");
 }
Example #5
0
        } = new Dictionary <int, string>();                                                                 //step, params in json

        public InternalStrategyParamGrid() : base()
        {
            base.StrategyType = "Grid";
            Description.Add("IsDirectionLong", "Открывать позицию на Long (true/false)");
            Description.Add("StepRepresentEnter", "Шаг входа в позицию для сетки: [Шаг в %]-[Шаг в пунктах]-[Использовать шаг в %]");
            Description.Add("StepRepresentClose", "Шаг закрытия позиции для сетки: [Шаг в %]-[Шаг в пунктах]-[Использовать шаг в %]");
            Description.Add("GridFactor", "Множитель сетки");
            Description.Add("MaxStepsNumber", "Максимальное количество шагов");
            Description.Add("AdditionalTrading[step]", "Параметры дополнительной торговли для шага [step]");
        }
Example #6
0
        public List <string> LLStrategiesStates   = new List <string>();         //for load, in json, for CurrentStep

        public InternalStrategyStateGrid() : base()
        {
            Description.Add("CurrentStep", "Текущий шаг");
            Description.Add("EnterPositionPrice", "Цена входа в позицию");
            Description.Add("EnterPositionSum", "Сума на вход в позицию");
            Description.Add("ClosePositionPrice", "Цена закрытия позиции");
            Description.Add("ClosePositionSum", "Сума на выход из позиции");
            Description.Add("ZeroPoint", "Точка нуля [sum1]*[sum2]");
            Description.Add("LLStrategies", "Состояния дополнительной торговли на текущем шаге");
        }
Example #7
0
        public InternalStateLimit_Limit() : base()
        {
            Description.Add("PosDirection", "Текущая позиция: 1 - Long; 0 - None; -1 - Short");
            Description.Add("EnterLongPrice", "Цена входа в Long");
            Description.Add("EnterShortPrice", "Цена входа в Short");

            Description.Add("ClosePositionPrice", "Цена закрытия позиции");
            Description.Add("ClosePositionSum", "Сума закрытия позиции");
            Description.Add("StopPositionPrice", "Цена закрытия позиции по стоп-ордеру");
        }
 public InternalStrategyParamMA() : base()
 {
     base.StrategyType = "CrossMA";
     Description.Add("ShortPeriod", "Период Short EMA");
     Description.Add("LongPeriod", "Период Long EMA");
     Description.Add("DiffPerc", "Необходимая разница между линиями EMA для сигнала в %");
     Description.Add("SetTrailingStopOrder", "Ставить ли TrailingStop");
     Description.Add("DistanceTrailingStopInLong", "Расстояние в % для TrailingStop продажи");
     Description.Add("DistanceTrailingStopInShort", "Расстояние в % для TrailingStop покупки");
     Description.Add("OneByCandle", "Одна сделка на свечу");
 }
Example #9
0
 private void MakeValid()
 {
     if (Description.Count == 0)
     {
         Description.Add("ViewDefinition [CoordinationView]");
     }
     if (string.IsNullOrWhiteSpace(ImplementationLevel))
     {
         ImplementationLevel = "2;1";
     }
 }
 public InternalStrategyStateMA() : base()
 {
     Description.Add("ExecuteCandleTime", "Время свечи где была посленяя сделка.");
     Description.Add("LastMALong", "Последнее значение MA Long");
     Description.Add("LastMAShort", "Последнее значение MA Short");
     Description.Add("PrevMALong", "Предыдущее значение MA Long");
     Description.Add("PrevMAShort", "Предыдущее значение MA Short");
     Description.Add("PrevCross", "Направление последнего пересечения: -1, 0, 1");
     Description.Add("PosDirection", "Направление позиции: -1 - Short, 0 - None, 1 - Long.");
     Description.Add("FuturePos", "Требуемая позиция на следующем сигнале: -1, 0, 1");
     Description.Add("FutureStop", "Делать остановку на следующем сигнале.");
 }
Example #11
0
 /// <summary>
 /// Constructor.
 /// </summary>
 public FunctionDocumentation(List <string> comments)
 {
     foreach (string comment in comments)
     {
         var matches = rgx.Matches(comment);
         if (matches.Count > 0)
         {
             Params.Add((matches[0].Groups[1].Value, matches[0].Groups[3].Value));
         }
         else
         {
             Description.Add(comment);
         }
     }
 }
Example #12
0
 public bool Parse(JToken tkn)
 {
     if (tkn == null)
     {
         return(false);
     }
     try
     {
         var o = tkn as JObject;
         if (o == null)
         {
             return(false);
         }
         if (o["name"] != null)
         {
             Name = o["name"].ToString();
         }
         if (o["address"] != null)
         {
             Address = o["address"].ToString().ToInt(-1);
         }
         if (o["description"] != null)
         {
             var ar = o["description"] as JArray;
             if (ar != null)
             {
                 foreach (var e in ar)
                 {
                     if (e == null)
                     {
                         continue;
                     }
                     if (e.Type != JTokenType.String)
                     {
                         continue;
                     }
                     Description.Add(e.ToString());
                 }
             }
         }
         return(true);
     }
     catch (Exception ex)
     {
         Trace.WriteLine(ex.Message);
         return(false);
     }
 }
Example #13
0
        /// <summary>
        /// returns a list of the next likely events
        /// </summary>
        /// <param name="Description">description of each event</param>
        /// <param name="Probability">probability of each event</param>
        /// <param name="TimeToEventSec">number of seconds before each event is likely to occur</param>
        public void PredictNextEvents(
            ref List <string> Description,
            ref List <float> Probability,
            ref List <float> TimeToEventSec)
        {
            if (Description == null)
            {
                Description = new List <string>();
            }
            if (Probability == null)
            {
                Probability = new List <float>();
            }
            if (TimeToEventSec == null)
            {
                TimeToEventSec = new List <float>();
            }
            Description.Clear();
            Probability.Clear();
            TimeToEventSec.Clear();

            if (prev_node != null)
            {
                ulong total_hits = 0;
                for (int i = 0; i < prev_node.Links.Count; i++)
                {
                    UsageLink lnk = (UsageLink)prev_node.Links[i];
                    UsageNode n   = (UsageNode)lnk.From;
                    total_hits += n.Hits;
                }
                for (int i = 0; i < prev_node.Links.Count; i++)
                {
                    UsageLink lnk = (UsageLink)prev_node.Links[i];
                    UsageNode n   = (UsageNode)lnk.From;
                    Description.Add(n.Name);
                    Probability.Add((float)((double)n.Hits / (double)total_hits));

                    double   av_duration_mS = lnk.GetAverageDuration();
                    TimeSpan diff           = DateTime.Now.Subtract(prev_node_time);
                    float    diff_sec       = (float)(diff.TotalMilliseconds - av_duration_mS) / 1000.0f;
                    if (diff_sec < 0)
                    {
                        diff_sec = 0;
                    }
                    TimeToEventSec.Add(diff_sec);
                }
            }
        }
Example #14
0
        public void SetDescription(Language lang, string value)
        {
            if (Description == null)
            {
                Description = new List <Text>();
            }

            var existing = Description.FirstOrDefault(a => a.Language == lang);

            if (existing == null)
            {
                existing = new Text {
                    Language = lang
                };
                Description.Add(existing);
            }

            existing.Value = value;
        }
        /// <summary> Add a single descriptive element, by term </summary>
        /// <param name="Term"> Normalized term for this metadata element, as employed by the SobekCM system </param>
        /// <param name="Value"> String version of this single value for a metadata term/type </param>
        public BriefItem_DescTermValue Add_Description(string Term, string Value)
        {
            // If the value is NULL or empty, do nothing
            if (String.IsNullOrWhiteSpace(Value))
            {
                return(null);
            }

            // Was a value, so look to add it
            BriefItem_DescriptiveTerm currentList;

            if (descriptionTermLookup.TryGetValue(Term, out currentList))
            {
                return(currentList.Add_Value(Value));
            }
            else
            {
                BriefItem_DescriptiveTerm newElement = new BriefItem_DescriptiveTerm(Term);
                descriptionTermLookup.Add(Term, newElement);
                Description.Add(newElement);
                return(newElement.Add_Value(Value));
            }
        }
Example #16
0
        internal void InitializeFromImpl()
        {
            if (CreateDXGIFactory2(true, out IDXGIFactory4 tempDXGIFactory4).Failure)
            {
                throw new InvalidOperationException("Cannot create IDXGIFactory4");
            }


            NativeFactory = tempDXGIFactory4;


            NativeFactory.EnumAdapters1(1, out var adapter);

            AdapterDescription1 desc = adapter.Description1;



            Adapters.Add(adapter);
            Description.Add(adapter.Description.Description);
            VendorId.Add(adapter.Description.DeviceId);


            Adapter = Adapters[0]; // TODO:
        }
Example #17
0
        private void LoadEpubMetaDataFromOpfFile(string opfFilePath)
        {
            ZipEntry zipEntry = _EpubFile.GetEntry(opfFilePath);

            if (zipEntry == null)
            {
                throw new Exception("Invalid epub file.");
            }

            XElement contentOpf;

            using (Stream zipStream = _EpubFile.GetInputStream(zipEntry))
            {
                using (MemoryStream memoryStream = new MemoryStream())
                {
                    byte[] buffer = new byte[4096]; // 4K is optimum
                    StreamUtils.Copy(zipStream, memoryStream, buffer);
                    memoryStream.Position = 0;
                    contentOpf            = XElement.Load(memoryStream);
                }
            }

            XNamespace xNamespace = contentOpf.Attribute("xmlns") != null
                ? contentOpf.Attribute("xmlns").Value
                : XNamespace.None;

            string uniqueIdentifier = contentOpf.Attribute("unique-identifier").Value;

            UUID = contentOpf.Elements(xNamespace + "metadata").Elements()
                   .FirstOrDefault(e =>
                                   e.Name.LocalName == "identifier" &&
                                   e.HasAttributes &&
                                   e.Attribute("id") != null &&
                                   e.Attribute("id").Value == uniqueIdentifier
                                   ).Value;
            foreach (
                var metadataElement in
                contentOpf.Element(xNamespace + "metadata").Elements().Where(e => e.Value.Trim() != string.Empty))
            {
                switch (metadataElement.Name.LocalName)
                {
                case "title":
                    Title.Add(metadataElement.Value);
                    break;

                case "creator":
                    Creator.Add(metadataElement.Value);
                    break;

                case "date":
                    var attribute = metadataElement.Attributes().FirstOrDefault(a => a.Name.LocalName == "event");
                    if (attribute != null)
                    {
                        Date.Add(new DateData(attribute.Value, metadataElement.Value));
                    }
                    break;

                case "publisher":
                    Publisher.Add(metadataElement.Value);
                    break;

                case "subject":
                    Subject.Add(metadataElement.Value);
                    break;

                case "source":
                    Source.Add(metadataElement.Value);
                    break;

                case "rights":
                    Rights.Add(metadataElement.Value);
                    break;

                case "description":
                    Description.Add(metadataElement.Value);
                    break;

                case "contributor":
                    Contributer.Add(metadataElement.Value);
                    break;

                case "type":
                    Type.Add(metadataElement.Value);
                    break;

                case "format":
                    Format.Add(metadataElement.Value);
                    break;

                case "identifier":
                    ID.Add(metadataElement.Value);
                    break;

                case "language":
                    Language.Add(metadataElement.Value);
                    break;

                case "relation":
                    Relation.Add(metadataElement.Value);
                    break;

                case "coverage":
                    Coverage.Add(metadataElement.Value);
                    break;
                }
            }

            LoadManifestSectionFromOpfFile(contentOpf, xNamespace);
        }
Example #18
0
        private void LoadEpubMetaDataFromOpfFile(string opfFilePath)
        {
            ZipEntry zipEntry = _EpubFile.Entries.FirstOrDefault(e => e.FileName.Equals(opfFilePath, StringComparison.InvariantCultureIgnoreCase));

            if (zipEntry == null)
            {
                throw new Exception("Invalid epub file.");
            }

            XElement contentOpf;

            using (MemoryStream memoryStream = new MemoryStream())
            {
                zipEntry.Extract(memoryStream);
                // Fix buggy "<?xml verison="1.1"?>
                // See http://stackoverflow.com/questions/912440/xdocument-cant-load-xml-with-version-1-1-in-c-sharp-linq
                byte[] b = memoryStream.ToArray();
                for (int i = 0; i < 50; i++)
                {
                    // Check for version="1.1" and replace if found
                    if (b[i] == 0x76 && b[i + 1] == 0x65 && b[i + 2] == 0x72 && b[i + 3] == 0x73 && b[i + 4] == 0x69 && b[i + 5] == 0x6F && b[i + 6] == 0x6E &&
                        b[i + 7] == 0x3D && b[i + 8] == 0x22 && b[i + 9] == 0x31 && b[i + 10] == 0x2E && b[i + 11] == 0x31)
                    {
                        b[i + 11] = 0x30;
                    }
                }
                using (MemoryStream fixedStream = new MemoryStream(b))
                {
                    contentOpf = XElement.Load(fixedStream);
                }
                b = null;
            }

            XNamespace xNamespace = contentOpf.Attribute("xmlns") != null?contentOpf.Attribute("xmlns").Value : XNamespace.None;

            string uniqueIdentifier = contentOpf.Attribute("unique-identifier").Value;

            try { UUID = contentOpf.Elements(xNamespace + "metadata").Elements().FirstOrDefault(e => e.Name.LocalName == "identifier" && e.Attributes("id").FirstOrDefault() != null && e.Attribute("id").Value == uniqueIdentifier).Value; }
            catch { }
            foreach (var metadataElement in contentOpf.Elements(xNamespace + "metadata").Elements().Where(e => e.Value.Trim() != string.Empty))
            {
                switch (metadataElement.Name.LocalName)
                {
                case "title": Title.Add(metadataElement.Value); break;

                case "creator": Creator.Add(metadataElement.Value); break;

                case "date":
                    var attribute = metadataElement.Attributes().FirstOrDefault(a => a.Name.LocalName == "event");
                    if (attribute != null)
                    {
                        Date.Add(new DateData(attribute.Value, metadataElement.Value));
                    }
                    break;

                case "publisher": Publisher.Add(metadataElement.Value); break;

                case "subject": Subject.Add(metadataElement.Value); break;

                case "source": Source.Add(metadataElement.Value); break;

                case "rights": Rights.Add(metadataElement.Value); break;

                case "description": Description.Add(metadataElement.Value); break;

                case "contributor": Contributer.Add(metadataElement.Value); break;

                case "type": Type.Add(metadataElement.Value); break;

                case "format": Format.Add(metadataElement.Value); break;

                case "identifier": ID.Add(metadataElement.Value); break;

                case "language": Language.Add(metadataElement.Value); break;

                case "relation": Relation.Add(metadataElement.Value); break;

                case "coverage": Coverage.Add(metadataElement.Value); break;
                }
            }

            LoadManifestSectionFromOpfFile(contentOpf, xNamespace);
        }
Example #19
0
 public FileDescription(string implementationLevel)
 {
     ImplementationLevel = implementationLevel;
     Description.Add("ViewDefinition [CoordinationView]");
 }
Example #20
0
        private void LoadEpubMetaDataFromOpfFile(string opfFilePath)
        {
            ZipEntry zipEntry = _EpubFile.Entries.FirstOrDefault(e => e.FileName.Equals(opfFilePath, StringComparison.InvariantCultureIgnoreCase));

            if (zipEntry == null)
            {
                throw new Exception("Invalid epub file.");
            }

            XElement contentOpf;

            using (MemoryStream memoryStream = new MemoryStream()) {
                zipEntry.Extract(memoryStream);
                memoryStream.Position = 0;
                contentOpf            = XElement.Load(memoryStream);
            }

            XNamespace xNamespace = contentOpf.Attribute("xmlns") != null?contentOpf.Attribute("xmlns").Value : XNamespace.None;

            string uniqueIdentifier = contentOpf.Attribute("unique-identifier").Value;

            try
            {
                UUID = contentOpf.Elements(xNamespace + "metadata").Elements().FirstOrDefault(e => e.Name.LocalName == "identifier" && e.Attribute("id").Value == uniqueIdentifier).Value;
            }
            catch { }
            foreach (var metadataElement in contentOpf.Elements(xNamespace + "metadata").Elements().Where(e => e.Value.Trim() != string.Empty))
            {
                switch (metadataElement.Name.LocalName)
                {
                case "title": Title.Add(metadataElement.Value); break;

                case "creator": Creator.Add(metadataElement.Value); break;

                case "date":
                    var attribute = metadataElement.Attributes().FirstOrDefault(a => a.Name.LocalName == "event");
                    if (attribute != null)
                    {
                        Date.Add(new DateData(attribute.Value, metadataElement.Value));
                    }
                    break;

                case "publisher": Publisher.Add(metadataElement.Value); break;

                case "subject": Subject.Add(metadataElement.Value); break;

                case "source": Source.Add(metadataElement.Value); break;

                case "rights": Rights.Add(metadataElement.Value); break;

                case "description": Description.Add(metadataElement.Value); break;

                case "contributor": Contributer.Add(metadataElement.Value); break;

                case "type": Type.Add(metadataElement.Value); break;

                case "format": Format.Add(metadataElement.Value); break;

                case "identifier": ID.Add(metadataElement.Value); break;

                case "language": Language.Add(metadataElement.Value); break;

                case "relation": Relation.Add(metadataElement.Value); break;

                case "coverage": Coverage.Add(metadataElement.Value); break;
                }
            }

            LoadManifestSectionFromOpfFile(contentOpf, xNamespace);
        }
Example #21
0
 public void AddText_NameDescription(MisIdiomas i, string n, string d)
 {
     Name.Add(n, i);
     Description.Add(d, i);
 }