Exemple #1
0
        /* ----------------------------------------------------------------- */
        ///
        /// OnRefresh
        ///
        /// <summary>
        /// Refreshes the archived item information.
        /// </summary>
        ///
        /* ----------------------------------------------------------------- */
        protected override void OnRefresh()
        {
            Crc            = _core.Get <uint>(Index, ItemPropId.Crc);
            Encrypted      = _core.Get <bool>(Index, ItemPropId.Encrypted);
            Exists         = true;
            IsDirectory    = _core.Get <bool>(Index, ItemPropId.IsDirectory);
            Attributes     = (System.IO.FileAttributes)_core.Get <uint>(Index, ItemPropId.Attributes);
            Length         = (long)_core.Get <ulong>(Index, ItemPropId.Size);
            CreationTime   = _core.Get <DateTime>(Index, ItemPropId.CreationTime);
            LastWriteTime  = _core.Get <DateTime>(Index, ItemPropId.LastWriteTime);
            LastAccessTime = _core.Get <DateTime>(Index, ItemPropId.LastAccessTime);

            var fi = _path.Value.HasValue() ? Io.Get(_path.Value) : default;

            FullName      = _path.Value;
            Name          = fi?.Name ?? string.Empty;
            BaseName      = fi?.BaseName ?? string.Empty;
            Extension     = fi?.Extension ?? string.Empty;
            DirectoryName = fi?.DirectoryName ?? string.Empty;

            if (FullName != RawName)
            {
                GetType().LogDebug($"Raw:{RawName.Quote()}", $"Cvt:{FullName.Quote()}");
            }
        }
 public string GetNameFor(Property property)
 {
     return(RawName
            .Replace("#entity.Name#", property.Entity.Name)
            .Replace("#property.Name#", property.Name)
            .Replace("#property.Type#", property.Type));
 }
        public override int GetHashCode()
        {
            var code = 0;

            code ^= OriginModel.GetHashCode();
            code ^= RawName.GetHashCode();
            return(InputModels.Aggregate(code, (current, inputModel) => current ^ inputModel.GetHashCode()));
        }
Exemple #4
0
 public ScrapedStructMember(string declaration)
 {
     Public     = true;
     RawName    = declaration.Split("var ")[1].Split(':')[0].Trim();
     CSharpName = RawName.ToUpper()[0] + RawName.Substring(1);
     Type       = ScrapedType.ScrapeType(declaration.Split(':')[1].Trim().Split(' ')[0]);
     ReadOnly   = declaration.Contains("{ get }");
 }
        public override int GetHashCode()
        {
            var code = 0;

            code ^= OriginModel.GetHashCode();
            code ^= RawName.GetHashCode();
            code ^= InputVisualizationType.GetHashCode();
            code ^= InputDataType.GetHashCode();
            return(code);
        }
Exemple #6
0
 public ScrapedEnumMember(string declaration)
 {
     if (declaration.Contains("static var "))
     {
         RawName    = declaration.Split("static var ")[1].Split(':')[0].Trim();
         CSharpName = RawName.ToUpper()[0] + RawName.Substring(1);
     }
     else if (declaration.Contains("case "))
     {
         RawName    = declaration.Split("case ")[1].Trim();
         CSharpName = RawName.ToUpper()[0] + RawName.Substring(1);
     }
 }
 private void Initialize()
 {
     if (VeiledAttributeType == VeiledAttributeTypes.UNKNOWN && RawName != null)
     {
         // FIXME: create grammer
         var index = RawName.IndexOf(InMemoryVeilId);
         if (index >= 0)
         {
             IsVeiled            = true;
             VeiledAttributeType = RawName.Substring(index)?.IndexOf(InMemorySuffixId) >= 0 ?
                                   VeiledAttributeTypes.SUFFIX : VeiledAttributeTypes.PREFIX;
         }
     }
 }
 public string GetNameFor(Entity entity)
 {
     return(RawName.Replace("#entity.Name#", entity.Name));
 }
        /// <inheritdoc />
        public XmlSummaryDescriptor(string name, ReferenceType field, Dictionary <string, string> values)
        {
            if (name.IsEmpty())
            {
                throw new ArgumentNullException(nameof(name));
            }

            RawName   = XmlDocumentationReader.RemoveMethodArgs.Match(name).Value;
            Values    = values ?? throw new ArgumentNullException(nameof(values));
            FieldType = field;

            var split = RawName.Split('.').ToList();

            switch (field)
            {
            case ReferenceType.Type:
                Name = split.Last();
                DeclaringTypeName = split.Last();
                Namespace         = split.JoinString('.', split.Count - 1);
                break;

            case ReferenceType.Property:
                Name = split.Last();
                DeclaringTypeName = split[split.Count - 2];
                Namespace         = split.JoinString('.', split.Count - 2);
                break;

            case ReferenceType.Method:
                Name = split.Last();
                DeclaringTypeName = split[split.Count - 2];
                Namespace         = split.JoinString('.', split.Count - 2);
                break;

            case ReferenceType.Namespace:
                Name      = split.JoinString('.');
                Namespace = Name;
                break;

            case ReferenceType.Field:
                Name = split.Last();
                DeclaringTypeName = split[split.Count - 2];
                Namespace         = split.JoinString('.', split.Count - 2);
                break;

            case ReferenceType.Event:
                Name = split.Last();
                DeclaringTypeName = split[split.Count - 2];
                Namespace         = split.JoinString('.', split.Count - 2);
                break;

            case ReferenceType.Error:
                Name = split.JoinString('.');
                break;

            case ReferenceType.Undefined:
            default:
                throw new ArgumentOutOfRangeException(nameof(field), field, null);
            }

            // FIELDS
            Summary     = values.ContainsKey("summary") ? Trim(Values["summary"]) : string.Empty;
            Remarks     = values.ContainsKey("remarks") ? Trim(Values["remarks"]) : string.Empty;
            IsInherited = values.ContainsKey("inheritdoc");
        }
Exemple #10
0
 public override int GetHashCode()
 {
     return(RawName.GetHashCode());
 }
Exemple #11
0
 public override string ToString()
 {
     return($"{RawName.Split("/").Last()}: {RawValue}");
 }
Exemple #12
0
        public ScrapedMethod(ScrapedMember baseValues, HtmlNode node) : base(baseValues)
        {
            Description = node.SelectSingleNode("./div[@class='abstract']/p").RealInnerText();
            Deprecated  = Description.ToLower().Contains("deprecat");
            IsOptional  = Declaration.Contains("optional ");
            RawName     = Declaration.Split('(')[0].Split("func ").Last().Trim().Trim('`').Trim();
            CSharpName  = RawName.ToUpper()[0] + RawName.Substring(1);

            if (new[] { "object", "string", "delegate", "int", "uint", "float", "class", "this", "new", "event" }.Contains(CSharpName))
            {
                CSharpName = "@" + CSharpName;
            }

            if (Declaration.ToLower().Contains("init("))
            {
                CSharpName = "init";
            }


            var parameters = Declaration.Substring(Declaration.IndexOf('(') + 1);

            parameters = parameters.Substring(0, parameters.LastIndexOf(')'));

            var separatedParameters = ScrapedParameter.ScrapeParameters(parameters);

            Parameters = new List <ScrapedParameter>();
            foreach (var param in separatedParameters)
            {
                Parameters.Add(new ScrapedParameter(param));
            }

            var parameterTableRows = node.SelectNodes("./div[@class='parameters']/table/tbody/tr");

            if (parameterTableRows != null)
            {
                foreach (var row in parameterTableRows)
                {
                    var name       = row.SelectNodes("./td").First().RealInnerText().Trim();
                    var definition = row.SelectNodes("./td").Last().RealInnerText().Trim();
                    if (name != definition)
                    {
                        var matchingParameter = Parameters.FirstOrDefault(param => param.InternalName == name);
                        if (matchingParameter != null)
                        {
                            matchingParameter.Description = definition;
                        }
                    }
                }
            }

            var returns = node.SelectSingleNode("./result-description/p");

            if (returns != null)
            {
                ReturnDescription = returns.RealInnerText().Trim();
            }
            else
            {
                ReturnDescription = null;
            }

            if (Declaration.ToLower().Contains("allocwithzone"))
            {
                var m = 1;
            }

            if (Declaration.Contains("->"))
            {
                var returnType = Declaration.Split("->").Last();
                if (!returnType.EndsWith(")"))
                {
                    ReturnType = ScrapedType.ScrapeType(returnType);
                }
            }
            if (ReturnType == null || ReturnType.CSharpType.Trim() == "")
            {
                ReturnType = ScrapedType.ScrapeType("void");
            }

            var objCDeclaration =
                node.SelectSingleNode("./div[@class='declaration']/div[@class='Objective-C']/p[@class='para']").RealInnerText().Trim();

            if (objCDeclaration.StartsWith("-") || !Declaration.Contains("class "))
            {
                Static = false;
            }
            else
            {
                Static = true;
            }
            Public = true;
        }