protected void AddThreeAttributes() { //extList.Add("a"); extList.Add(attr1); //extList.Add("b"); //extList.Add("c"); extList.Add(attr2); extList.Add(attr3); //extList.Add("d"); }
public void PopulateITHeadMasters(List <ITHeadMaster> headList, List <ITSubHeadMaster> subHeadList, int?itreturnId) { this.ITHeadMasterList = new Dictionary <string, ITHeadMaster>(); foreach (var item in headList) { item.SubHeadList = subHeadList.Where(sh => sh.ITHeadId == item.Id) .ToList <ITSubHeadMaster>(); if (!this.ITHeadMasterList.ContainsKey(item.PropertyName)) { this.ITHeadMasterList.Add(item.PropertyName, item); } foreach (var subItem in item.SubHeadList) { ExtensionList.Add(new ITReturnDetailsExtension { ITSubHeadId = subItem.Id, SubHeadMasterObject = subItem, HeadMasterObject = item, ITReturnDetailsId = itreturnId.HasValue ? itreturnId.Value : 0, IsAllowance = subItem.IsAllowance.HasValue ? subItem.IsAllowance.Value : false }); } } }
private void OnAddExtension() { if (!string.IsNullOrEmpty(ComboBoxText) && !ExtensionList.Contains(ComboBoxText)) { ExtensionList.Add(ComboBoxText); } }
/////////////////////////////////////////////////////////////////////// /// <summary>Removes all Google Base attributes.</summary> /////////////////////////////////////////////////////////////////////// public void Clear() { ExtensionList toRemove = ExtensionList.NotVersionAware(); foreach (GBaseAttribute attribute in this) { toRemove.Add(attribute); } RemoveAll(toRemove); }
public void ItemTypeDefinitionTest() { AttributeId[] ids = { new AttributeId("x", GBaseAttributeType.Int) }; ExtensionList extList = ExtensionList.NotVersionAware(); //extList.Add("garbage"); //extList.Add(12); ItemTypeDefinition defs = new ItemTypeDefinition(extList); Assert.IsNull(defs.ItemType); Assert.IsNotNull(defs.Attributes); Assert.AreEqual(0, defs.Attributes.Count); extList.Add(new MetadataItemType("hello")); Assert.AreEqual("hello", defs.ItemType); extList.Add(new ItemTypeAttributes(new List <AttributeId>(ids))); Assert.AreEqual(1, defs.Attributes.Count); Assert.AreEqual("x", defs.Attributes[0].Name); }
protected ExtensionList FilterFileType(ExtensionList filetypes) { ExtensionList ext = new ExtensionList(); foreach (string s in filetypes) { if (ForumAllowedFileTypes.Contains(s)) { ext.Add(s); } } return(ext); }
private ExtensionList GetAttributeList(string name) { ExtensionList retval = ExtensionList.NotVersionAware(); foreach (GBaseAttribute attribute in this) { if (name == attribute.Name) { retval.Add(attribute); } } return(retval); }
private ExtensionList GetAttributeList(string name, GBaseAttributeType type) { ExtensionList retval = ExtensionList.NotVersionAware(); foreach (GBaseAttribute attribute in this) { if (HasNameAndType(attribute, name, type)) { retval.Add(attribute); } } return(retval); }
private static bool AddExtensionToResult(byte[] buffer, ref int currentLen, Int16 extLen, ConnectionEnd end, ExtensionList knownExtensions, ExtensionType type, ref ExtensionList result) { foreach (var extension in knownExtensions) { if (extension.Type == type) { result.Add(extension.Parse(buffer, ref currentLen, extLen, end)); return true; } } return false; }
private ExtensionList FormExtsList(IEnumerable <ExtensionType> extensions) { if (extensions != null) { var result = new ExtensionList(); foreach (var ext in extensions) { switch (ext) { case ExtensionType.Renegotiation: result.Add(new RenegotiationExtension(this.Entity)); break; case ExtensionType.ALPN: result.Add(new ALPNExtension(this.Entity, KnownProtocols)); break; } } return(result); } return(null); }
/// <summary> /// Apply fluent settings to ExtensionList /// </summary> /// <param name="extensions"></param> public void MapTo(ExtensionList extensions) { var ext = this._typeExtension; TypeExtension oldExt; if (extensions.TryGetValue(ext.Name, out oldExt)) { FluentMapHelper.MergeExtensions(ext, ref oldExt); } else { extensions.Add(ext); } this.EachChilds(m => m.MapTo(extensions)); }
public static void MergeExtensions(ExtensionList fromExt, ref ExtensionList toExt) { foreach (var kv in fromExt) { TypeExtension toType; if (toExt.TryGetValue(kv.Key, out toType)) { MergeExtensions(kv.Value, ref toType); } else { toExt.Add(kv.Key, kv.Value); } } }
//Scan Method private void Scan() { //Enable Analyze Button this.Button_Analyze.Enabled = true; //Clear Global Files List GlobalFilesList.Clear(); //Set Flag RecursiveFlag = false; //Init Labels this.Label_Selection_Extensions.Text = "Extensions "; this.Label_Selection_Files.Text = "Files "; //Scanning this.Label_Folder_Files.Text = "Files Scanning..."; this.Label_Extensions.Text = "Extensions Scanning..."; this.Label_Folders.Text = "Folders 1"; this.Label_Mode.Text = "Mode: Scan"; //Clear CheckList this.Checklist_Types.Items.Clear(); ExtensionList.Clear(); //Scan string[] Files = Directory.GetFiles(SelectedFolderPath); //Unique Extensions Added to Extenstion List try { foreach (string File in Files) { GlobalFilesList.Add(File); string FileExtension = Path.GetExtension(File); if (ExtensionList.Contains(FileExtension) == false) { ExtensionList.Add(FileExtension); } } } catch { } //Add to CheckList foreach (string Extension in ExtensionList) { this.Checklist_Types.Items.Add(Extension); } //Set Folder Information Label_Folder_Files.Text = "Files " + (Files.Count()).ToString(); Label_Extensions.Text = "Extensions " + (ExtensionList.Count()).ToString(); if (RecursiveFlag == false) { this.Label_Mode.Text = "Mode Non Recursive"; } else { this.Label_Mode.Text = "Mode Recursive"; } //Enable Remove Button this.Label_Remove.Enabled = true; //Init Mode this.Label_Mode.Text = "Mode "; }
/////////////////////////////////////////////////////////////////////// /// <summary>Adds an attribute at the end of the list. /// The might exist attributes with the same name, type and even /// value. This method will not remove them.</summary> /////////////////////////////////////////////////////////////////////// public GBaseAttribute Add(GBaseAttribute value) { extensionElements.Add(value); return(value); }
protected override SwitchStatus OnSwitch(string switchSymbol, string switchValue) { SwitchStatus ss = SwitchStatus.NoError; switch (switchSymbol) { case k_HELP_QUESTION: case k_HELP_SHORT: case k_HELP: ss = SwitchStatus.ShowUsage; break; case k_GUIDS_SHORT: case k_GUIDS: GenerateGuids = true; break; case k_GENERATE_ROOT: case k_GENERATE_ROOT_SHORT: GenerateRootDir = true; break; case k_MULTIPLE_SHORT: case k_MULTIPLE: MultipleFilesPerComponent = true; break; case k_NORECURSE_SHORT: case k_NORECURSE: NoDirectoryRecursion = true; break; case k_UPDATE_SHORT: case k_UPDATE: Update = true; break; case k_WIN64: Win64 = true; break; case k_ALIAS_SHORT: case k_ALIAS: if (false == String.IsNullOrEmpty(Alias)) { errorMessage = Constants.AliasMultipleSwitches; ss = SwitchStatus.Error; } else { // If the alias does not end with a \, add one to help // the user out. if (false == switchValue.EndsWith("\\", StringComparison.OrdinalIgnoreCase)) { switchValue += "\\"; } Alias = switchValue; } break; case k_DIRREF_SHORT: case k_DIRREF: if (!String.IsNullOrEmpty(DirectoryRef)) { errorMessage = Constants.DirectoryRefMultipleSwitches; ss = SwitchStatus.Error; } else { DirectoryRef = switchValue; } break; case k_COMPONENT_GROUP: case k_COMPONENT_GROUP_SHORT: if (!String.IsNullOrEmpty(ComponentGroup)) { errorMessage = Constants.CompGroupMultipleSwitches; ss = SwitchStatus.Error; } else { ComponentGroup = switchValue; } break; case k_DISKID: if (!String.IsNullOrEmpty(DiskId)) { errorMessage = Constants.DiskIdMultipleSwitches; ss = SwitchStatus.Error; } else { DiskId = switchValue; } break; case k_DIR_SHORT: case k_DIR: if (false == String.IsNullOrEmpty(StartDirectory)) { errorMessage = Constants.DirectoryMultipleSwitches; ss = SwitchStatus.Error; } else if (true == String.IsNullOrEmpty(switchValue)) { errorMessage = Constants.DirectoryCannotBeEmpty; ss = SwitchStatus.Error; } else { // If the directory does not end with a \, add one. if (false == switchValue.EndsWith("\\", StringComparison.OrdinalIgnoreCase)) { switchValue += "\\"; } StartDirectory = switchValue; } break; case k_CUSTOM_SHORT: case k_CUSTOM: if (false == String.IsNullOrEmpty(CustomValue)) { errorMessage = Constants.UniqueMultipleSwitches; ss = SwitchStatus.Error; } else if (true == String.IsNullOrEmpty(switchValue)) { errorMessage = Constants.UniqueCannotBeEmpty; ss = SwitchStatus.Error; } else if (switchValue.Length >= 65) { errorMessage = Constants.UniqueTooLong; ss = SwitchStatus.Error; } else { CustomValue = switchValue; } break; case k_EXT_SHORT: case k_EXT: if (true == String.IsNullOrEmpty(switchValue)) { errorMessage = Constants.ExtensionCannotBeEmpty; ss = SwitchStatus.Error; } else { // Does it start with a period? If not, add one to help // the user out. if ('.' != switchValue[0]) { switchValue = "." + switchValue; } // You can have as many -ext switches as you want. ExtensionList.Add(switchValue.ToUpperInvariant(), true); } break; case k_INC_SHORT: case k_INC: if (true == seenIncrementSwitch) { errorMessage = Constants.IncrementMultipleSwitches; ss = SwitchStatus.Error; } else { Int32 level = 0; if (false == Int32.TryParse(switchValue, out level)) { errorMessage = Constants.IncrementNoParse; ss = SwitchStatus.Error; } else if (level <= 0) { errorMessage = Constants.IncrementNotZero; ss = SwitchStatus.Error; } else { IncrementValue = level; seenIncrementSwitch = true; } } break; case k_DIREXCLUDE_SHORT: case k_DIREXCLUDE: DirectoryExcludeList.Add(switchValue); break; default: { errorMessage = Constants.UnknownCommandLineOption; ss = SwitchStatus.Error; } break; } return(ss); }
public void YouTubeInsertTest() { Tracing.TraceMsg("Entering YouTubeInsertTest"); YouTubeService service = new YouTubeService("NETUnittests", this.ytDevKey); if (!string.IsNullOrEmpty(this.ytUser)) { service.Credentials = new GDataCredentials(this.ytUser, this.ytPwd); } GDataRequestFactory factory = service.RequestFactory as GDataRequestFactory; factory.Timeout = 1000000; YouTubeEntry entry = new YouTubeEntry(); entry.MediaSource = new MediaFileSource(Path.Combine(this.resourcePath, "test_movie.mov"), "video/quicktime"); entry.Media = new YouTube.MediaGroup(); entry.Media.Description = new MediaDescription("This is a test with and & in it"); entry.Media.Title = new MediaTitle("Sample upload"); entry.Media.Keywords = new MediaKeywords("math"); // entry.Media.Categories MediaCategory category = new MediaCategory("Nonprofit"); category.Attributes["scheme"] = YouTubeService.DefaultCategory; entry.Media.Categories.Add(category); YouTubeEntry newEntry = service.Upload(this.ytUser, entry); Assert.AreEqual(newEntry.Media.Description.Value, entry.Media.Description.Value, "Description should be equal"); Assert.AreEqual(newEntry.Media.Keywords.Value, entry.Media.Keywords.Value, "Keywords should be equal"); // now change the entry newEntry.Title.Text = "This test upload will soon be deleted"; YouTubeEntry anotherEntry = newEntry.Update() as YouTubeEntry; // bugbug in YouTube server. Returns empty category that the service DOES not like on reuse. so remove ExtensionList a = ExtensionList.NotVersionAware(); foreach (MediaCategory m in anotherEntry.Media.Categories) { if (String.IsNullOrEmpty(m.Value)) { a.Add(m); } } foreach (MediaCategory m in a) { anotherEntry.Media.Categories.Remove(m); } Assert.AreEqual(newEntry.Media.Description.Value, anotherEntry.Media.Description.Value, "Description should be equal"); Assert.AreEqual(newEntry.Media.Keywords.Value, anotherEntry.Media.Keywords.Value, "Keywords should be equal"); // now update the video anotherEntry.MediaSource = new MediaFileSource(Path.Combine(this.resourcePath, "test.mp4"), "video/mp4"); anotherEntry.Update(); // now delete the guy again newEntry.Delete(); }
/// <summary> /// all extension elements that match a namespace/localname /// given will be removed and the new one will be inserted /// </summary> /// <param name="localName">the local name to find</param> /// <param name="ns">the namespace to match, if null, ns is ignored</param> /// <param name="obj">the new element to put in</param> public void ReplaceExtension(string localName, string ns, IExtensionElementFactory obj) { DeleteExtensions(localName, ns); ExtensionElements.Add(obj); }
private ExtensionList FormExtsList(IEnumerable<ExtensionType> extensions) { if (extensions != null) { var result = new ExtensionList(); foreach (var ext in extensions) { switch (ext) { case ExtensionType.Renegotiation: result.Add(new RenegotiationExtension(this.Entity)); break; case ExtensionType.ALPN: result.Add(new ALPNExtension(this.Entity, KnownProtocols)); break; } } return result; } return null; }