public void ReplaceSysAttrAll(string name, string oldValue, string newValue) { string[] files = System.IO.Directory.GetFiles(m_dataDir); foreach (string dataFile in files) { OSBLEFile of = GetFile(dataFile); if (of.ContainsSysAttr(name, oldValue)) { of.SetSysAttr(name, newValue); of.SaveAttrs(); } } }
private FileCollection GetFilesWithAttribute(string attrClass, string attrName, string attrValue) { if (!System.IO.Directory.Exists(DataFilesPath)) { return(new AttributableFileCollection(DataFilesPath, AttrFilesPath, new List <string>())); } // Compare everything in lower case except the value attrClass = attrClass.ToLower(); attrName = attrName.ToLower(); string[] dataFiles = System.IO.Directory.GetFiles(DataFilesPath); List <string> files = new List <string>(); foreach (string file in dataFiles) { // Get the name for the attribute file string attrFileName = AttributableFileCollection.GetAttrFileName(AttrFilesPath, file); if (string.IsNullOrEmpty(attrFileName) || !System.IO.File.Exists(attrFileName)) { continue; } OSBLEFile af = OSBLEFile.CreateFromExisting(file, attrFileName); if ("systemattributes" == attrClass) { if (!af.ContainsSysAttr(attrName, attrValue)) { continue; } } else { if (!af.ContainsUserAttr(attrName, attrValue)) { continue; } } files.Add(file); } return(new AttributableFileCollection(DataFilesPath, AttrFilesPath, files)); }