Esempio n. 1
0
 internal static void FillCommonData(ShellFolder shell, MetaData data)
 {
     if (shell.IsFileSystemObject)
     {
         data.Add(new MetaEntry { Name = FileMetaData.ModifiedDate.Name, Value = shell.Properties.GetProperty(SystemProperties.System.DateModified).ValueAsObject });
         data.Add(new MetaEntry { Name = FileMetaData.Type.Name, Value = shell.Properties.GetProperty(SystemProperties.System.ItemTypeText).ValueAsObject });
     }
 }
Esempio n. 2
0
 internal static void FillCommonData(ShellFolder shell, MetaData data)
 {
     if (shell.IsFileSystemObject)
     {
         data.Add(new MetaEntry {
             Name = FileMetaData.ModifiedDate.Name, Value = shell.Properties.GetProperty(SystemProperties.System.DateModified).ValueAsObject
         });
         data.Add(new MetaEntry {
             Name = FileMetaData.Type.Name, Value = shell.Properties.GetProperty(SystemProperties.System.ItemTypeText).ValueAsObject
         });
     }
 }
Esempio n. 3
0
        private static SampleClassWithObjectLinks CreateObjectWithLinkObjectsToTransform()
        {
            var o = new SampleClassWithObjectLinks
            {
                Id        = 1,
                SomeValue = "Somevalue text test string"
            };
            var meta1 = new MetaData();

            meta1.Add("meta1", "data1");
            var meta2 = new MetaData();

            meta2.Add("meta2", "data2");

            o.GetLinks().Add("link1", new LinkObject {
                Link = new SimpleLink {
                    Href = "url1"
                }, Meta = meta1
            });
            o.GetLinks().Add("link2", new LinkObject {
                Link = new SimpleLink {
                    Href = "url2"
                }, Meta = meta2
            });
            return(o);
        }
 public override void Flatten()
 {
     MetaData.Add("ProductId", Id);
     MetaData.Add("ProductName", Name);
     MetaData.Add("ProductQuantity", Quantity);
     MetaData.Add("ProductCode", ProductCodeId);
     MetaData.Add("ProductCost", ProductCost);
 }
Esempio n. 5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Relation"/> class.
 /// </summary>
 /// <param name="type">The type.</param>
 /// <param name="metaData">The meta data.</param>
 /// <remarks></remarks>
 protected Relation(AbstractRelationType type, params RelationMetaDatum[] metaData)
     : this(type)
 {
     foreach (var relationMetaDatum in metaData)
     {
         MetaData.Add(relationMetaDatum);
     }
 }
        /// <summary>
        /// </summary>
        /// <param name="key"></param>
        /// <param name="defaultValue"></param>
        /// <returns></returns>
        public string GetMetadata(string key, string defaultValue = "")
        {
            if (!MetaData.ContainsKey(key))
            {
                MetaData.Add(key, defaultValue);
            }

            return(MetaData[key]);
        }
        private static MetaData GetSaveMetaData(CampaignSaveMetaDataArgs data)
        {
            MetaData          metaData = new MetaData();
            List <ModuleInfo> modules  = MBSaveLoad.GetModules(data.ModuleNames);

            metaData["Modules"] = string.Join(";", modules.Select <ModuleInfo, string>((Func <ModuleInfo, string>)(q => q.Name)));
            foreach (ModuleInfo moduleInfo in modules)
            {
                metaData["Module_" + moduleInfo.Name] = moduleInfo.Version.ToString();
            }
            metaData.Add("ApplicationVersion", ApplicationVersion.FromParametersFile(ApplicationVersionGameType.Singleplayer).ToString());
            metaData.Add("CreationTime", DateTime.Now.ToString());
            foreach (KeyValuePair <string, string> keyValuePair in data.OtherData)
            {
                metaData.Add(keyValuePair.Key, keyValuePair.Value);
            }
            return(metaData);
        }
Esempio n. 8
0
 public ValueVM(IItemProvider provider, ContainerVM parent, string name, RegistryValueKind kind, object value) :
     base(provider, parent, string.IsNullOrEmpty(name) ? "(Default)" : name, false)
 {
     MetaData.Add(new MetaEntry {
         Name = RegistryMetaData.Type.Name, Value = kind
     });
     MetaData.Add(new MetaEntry {
         Name = RegistryMetaData.Data.Name, Value = value
     });
 }
Esempio n. 9
0
        public void MetaData_add_items_ok()
        {
            // Arrange

            // Act
            var sut = new MetaData();

            sut.Add("key", "value");

            // Assert
            Assert.Equal("value", sut["key"]);
        }
Esempio n. 10
0
        public void AddMetaData(string key, string value)
        {
            if (true == MetaData.ContainsKey(key))
            {
                throw new ArgumentException(
                          "A duplicate key was attempted to be adding to the metadata. " +
                          "I believe this needs to be unique, so I developed the library as such " +
                          "but I've never actually asked VoiceLabs if it's required and just assumed.",
                          "key");
            }

            MetaData.Add(key, new AnalyticsSlot(key, value));
        }
 public override void AddMetaData(string metaValue)
 {
     lock (_MutexObj)
     {
         if (MetaData.ContainsKey(MetaTag))
         {
             MetaData[MetaTag] = metaValue;
         }
         else
         {
             MetaData.Add(MetaTag, metaValue);
         }
     }
 }
 public override bool SetPropertyData(string key, string data)
 {
     lock (_MutexObj)
     {
         if (MetaData.ContainsKey(key))
         {
             MetaData[key] = data;
         }
         else
         {
             MetaData.Add(key, data);
         }
     }
     return(true);
 }
Esempio n. 13
0
        public void Save(int version, MetaData metaData, GameData gameData)
        {
            MemoryStream memoryStream = new MemoryStream();

            metaData.Add("Version", version.ToString());
            metaData.Serialize((Stream)memoryStream);
            using (DeflateStream deflateStream = new DeflateStream((Stream)memoryStream, CompressionLevel.Fastest, true))
                new BinaryFormatter().Serialize((Stream)deflateStream, (object)gameData);
            ArraySegment <byte> buffer;

            if (memoryStream.TryGetBuffer(out buffer))
            {
                Utilities.SaveFile(this._fileName, buffer.Array);
            }
            memoryStream.Close();
        }
Esempio n. 14
0
 /// <summary>
 /// </summary>
 /// <param name="key"></param>
 /// <param name="value"></param>
 public void SetMetadata(string key, string value)
 {
     if (!MetaData.ContainsKey(key))
     {
         MetaData.Add(key, value);
     }
     else
     {
         if (value == "")
         {
             MetaData.Remove(key);
         }
         else
         {
             MetaData[key] = value;
         }
     }
 }
Esempio n. 15
0
        public Node(IList <int> input)
        {
            var childCount    = input[0];
            var metadataCount = input[1];

            for (var i = 0; i < childCount; i++)
            {
                var newChild = new Node(input.Skip(Size).ToList());
                Children.Add(newChild);
                Size += newChild.Size;
            }

            for (var i = 0; i < metadataCount; i++)
            {
                MetaData.Add(input.Skip(Size).First());
                Size++;
            }
        }
        public override bool SetSourceData(byte[] data, string documentId, bool overwrite)
        {
            lock (_MutexObj)
            {
                FileData = data == null ? null : Convert.ToBase64String(data);
                FileId   = documentId;

                if (MetaData.ContainsKey(DocumentReplace))
                {
                    MetaData[DocumentReplace] = overwrite.ToString();
                }
                else
                {
                    MetaData.Add(DocumentReplace, overwrite.ToString());
                }
            }
            return(true);
        }
Esempio n. 17
0
        public void ReadFile(string filename)
        {
            // Get each line of file as an entry in array lines.
            string[] lines = File.ReadAllLines(Utils.GetLevelFilePath(filename));

            // Iterate over lines and add data till the corresponding field
            // Adds tiles to MapData
            for (var i = 0; i < 24; i++)
            {
                foreach (var j in lines[i])
                {
                    MapData.Add(j);
                }
            }


            foreach (var i in lines)
            {
                if (i.StartsWith("Platforms"))
                {
                    var platforms = i.Split(':')[1].Split(',');
                    foreach (var j in platforms)
                    {
                        var elm      = lines.Where(el => el.StartsWith(j.Trim() + ") "));
                        var charKey  = elm.First().Split(' ', ')')[0].ToCharArray()[0];
                        var strValue = elm.First().Split(' ')[1];
                        MetaData.Add(charKey, strValue);
                    }
                }

                if (i.Contains(")"))
                {
                    char   charKey  = i.Split(')')[0][0];
                    string strValue = i.Split(')')[1].Trim();
                    LegendData.Add(charKey, strValue);
                }

                if (i.StartsWith("Customer"))
                {
                    var customers = i.Split(':')[1].Split(' ');
                    CustomerData.Add(customers);
                }
            }
        }
Esempio n. 18
0
        public LogEntry(string msbuildEventType, JObject content)
        {
            if (string.IsNullOrWhiteSpace(msbuildEventType))
            {
                throw new ArgumentNullException("msbuildEventType");
            }

            if (content == null)
            {
                throw new ArgumentNullException("content");
            }

            switch (msbuildEventType)
            {
            case "ErrorRaised":
                Type = "ERROR";
                break;

            case "WarningRaised":
                Type = "WARN";
                break;

            default:
                Type = "INFO";
                break;
            }

            Description = (string)content["Message"];
            DateTime    = (DateTime)content["Timestamp"];
            Thread      = ((int)content["ThreadId"]).ToString();
            Source      = (string)content["SenderName"];
            System      = msbuildEventType;

            if (Description.ToUpper().Contains("EXCEPTION"))
            {
                MetaData.Add("Exception", true);
            }

            MetaData = new Dictionary <string, object> {
                { "Original", content }
            };
        }
        public void TopLevelDocument_add_link_objects_ok()
        {
            // Arrange
            const string testString = "Test String";
            var          meta       = new MetaData();

            meta.Add("about", "this");
            var link       = new SimpleLink();
            var linkObject = new LinkObject {
                Link = link, Meta = meta
            };

            // Act
            var sut = new TopLevelDocument <string>(testString);

            sut.Links.Add("link2", linkObject);

            // Assert
            Assert.Same(linkObject, sut.Links["link2"]);
        }
Esempio n. 20
0
        public void LinkData_add_link_object_items_ok()
        {
            // Arrange
            var itemMeta = new MetaData();

            itemMeta.Add("about", "this");

            // Act
            var sut = new LinkData();

            sut.Add("linkname", new LinkObject {
                Link = new SimpleLink {
                    Href = "url"
                }, Meta = itemMeta
            });

            // Arrange
            var matchingItem = (ILinkObject)sut["linkname"];

            Assert.Equal("url", matchingItem.Link.Href);
            Assert.Equal("this", matchingItem.Meta["about"]);
        }
Esempio n. 21
0
        internal void AddMetadata(string key, byte[] value)
        {
            var valueAsString = value == null ? null : System.Text.Encoding.UTF8.GetString(value);

            MetaData.Add(key, valueAsString);
        }
 public override void Flatten()
 {
     MetaData.Add("Id", Id);
     MetaData.Add("Name", Name);
 }
Esempio n. 23
0
        void Parse(XDocument xDocument)
        {
            var adlibXml   = xDocument.Element("adlibXML");
            var recordList = adlibXml.Element("recordList");
            var record     = recordList.Element("record");

            Priref = int.Parse(record.Attribute("priref").Value);
            var titlegroup = record.Element("Title");
            var title      = titlegroup.Element("title")?.Value;
            var article    = titlegroup.Element("title.article")?.Value;

            Title = string.IsNullOrWhiteSpace(article) ? title : $"{article} {title}";

            foreach (var titleDate in record.Elements("Title_date"))
            {
                var titleDateType = titleDate.Element("title_date.type");
                if (titleDateType != null)
                {
                    foreach (var value in titleDateType.Elements("value"))
                    {
                        var lang = value.Attribute("lang")?.Value;
                        var type = value?.Value;
                        if (lang == "neutral" && type == "03_R")
                        {
                            Date = titleDate.Element("title_date_start")?.Value;
                            MetaData.Add(new MetadataClass {
                                Label = "Date", Value = Date
                            });
                            break;
                        }
                    }
                }
            }

            var description = record.Element("Description");

            if (description != null)
            {
                Description = description.Element("description")?.Value;
            }

            var credits = record.Elements("credits");

            foreach (var credit in credits)
            {
                var creditType = credit.Element("credit.type")?.Value;
                if (creditType == "Director")
                {
                    Director = credit.Element("credit.name")?.Value;
                    MetaData.Add(new MetadataClass {
                        Label = "Director", Value = Director
                    });
                    break;
                }
            }

            foreach (var contentGenre in record.Elements("Content_genre"))
            {
                var genre = contentGenre.Element("content.genre")?.Value;
                if (!string.IsNullOrWhiteSpace(genre))
                {
                    MetaData.Add(new MetadataClass {
                        Label = "Genre", Value = genre
                    });
                }
            }

            foreach (var contentGenre in record.Elements("Content_subject"))
            {
                var subject = contentGenre.Element("content.subject")?.Value;
                if (!string.IsNullOrWhiteSpace(subject))
                {
                    MetaData.Add(new MetadataClass {
                        Label = "Subject", Value = subject
                    });
                }
            }
        }
Esempio n. 24
0
        private async Task<MetaData> ReadMetaDataAsync()
        {
            var metaData = new MetaData();

            FrameReader reader = Reader;

            //get flags
            var flags = (MetadataFlags)await reader.ReadIntAsync().AutoConfigureAwait();

            //get column count
            int colCount = await reader.ReadIntAsync().AutoConfigureAwait();

            //get paging state if present
            if(flags.HasFlag(MetadataFlags.HasMorePages))
                metaData.PagingState = await reader.ReadBytesAsync().AutoConfigureAwait();

            //stop processing if no metadata flag is set
            if(flags.HasFlag(MetadataFlags.NoMetaData))
                return metaData;

            //get the global keyspace,table if present
            bool globalTablesSpec = flags.HasFlag(MetadataFlags.GlobalTablesSpec);
            string keyspace = null;
            string table = null;
            if(globalTablesSpec)
            {
                keyspace = await reader.ReadStringAsync().AutoConfigureAwait();
                table = await reader.ReadStringAsync().AutoConfigureAwait();
            }

            //go and start processing all the columns
            for(int colIdx = 0; colIdx < colCount; colIdx++)
            {
                //read name
                string colKeyspace = globalTablesSpec ? keyspace : await reader.ReadStringAsync().AutoConfigureAwait();
                string colTable = globalTablesSpec ? table : await reader.ReadStringAsync().AutoConfigureAwait();
                string colName = await reader.ReadStringAsync().AutoConfigureAwait();

                //read type
                CqlType type = await ReadCqlType(reader).AutoConfigureAwait();

                //add to the MetaData
                metaData.Add(new Column(colIdx, colKeyspace, colTable, colName, type));
            }

            return metaData;
        }
 public override void Flatten()
 {
     MetaData.Add("ProductCodeId", ProductCodeId);
     MetaData.Add("ProductCodeName", ProductCodeName);
 }
 public override void Flatten()
 {
     MetaData.Add("Id", Country.Id);
     MetaData.Add("Name", Country.Name);
 }
Esempio n. 27
0
 internal void AddMetadata(string key, string value)
 {
     MetaData.Add(key, System.Text.Encoding.UTF8.GetBytes(value));
 }
Esempio n. 28
0
 internal void AddMetadata(string key, byte[] value)
 {
     MetaData.Add(key, value);
 }
Esempio n. 29
0
        public void AddMetaData(Analysis analysis)
        {
            Analysis tempAnalysis = new Analysis(analysis);

            MetaData.Add(tempAnalysis);
        }
Esempio n. 30
0
 public void AddMetaData(MovieMetaDataInstance metaDataInstance)
 {
     metaDataInstance.Id = NextId();
     MetaData.Add(metaDataInstance);
 }
 public OrganisationLogoFilePath(Guid organisationId, string fileName)
     : base(new OrganisationLogoDirectoryPath(organisationId))
 {
     MetaData.Add(METADATA_FILENAME, fileName);
     MetaData.Add("LogoType", "default");
 }
Esempio n. 32
0
 public CommissionStatementFilePath(Guid organisationId, Guid commissionStatementId, string fileName)
     : base(new CommissionStatementDirectoryPath(organisationId, commissionStatementId))
 {
     MetaData.Add(METADATA_FILENAME, fileName);
 }