private static void AddDocument(string[] attributes, string cmd) { Document textDocument; switch (cmd) { case "AddTextDocument": textDocument = new TextDocument(); break; case "AddPDFDocument": textDocument = new PDFDocument(); break; case "AddWordDocument": textDocument = new WordDocument(); break; case "AddExcelDocument": textDocument = new ExcelDocument(); break; case "AddAudioDocument": textDocument = new AudioDocument(); break; case "AddVideoDocument": textDocument = new VideoDocument(); break; default: textDocument = new TextDocument(); break; } if (attributes.Length > 0) { IList<KeyValuePair<string, object>> attrbList = new List<KeyValuePair<string, object>>(); foreach (var attribute in attributes) { string[] attrPair = attribute.Split(new char[] { '=' }, StringSplitOptions.RemoveEmptyEntries); attrbList.Add(new KeyValuePair<string, object>(attrPair[0], attrPair[1] as object)); } textDocument.SaveAllProperties(attrbList); allDocuments.Add(textDocument); Console.WriteLine("Document added: {0}", textDocument.Name); } else { Console.WriteLine("Document has no name"); } }
private static void AddAudioDocument(string[] attributes) { AudioDocument doc = new AudioDocument(); foreach (string properties in attributes) { string[] prop = properties.Split('='); doc.LoadProperty(prop[0], prop[1]); } if (doc.Name != null) { allDocuments.Add(doc); Console.WriteLine("Document added: {0}", doc.Name); } else { Console.WriteLine("Document has no name"); } }
private static void AddAudioDocument(string[] attributes) { var doc = new AudioDocument(); foreach (var atr in attributes) { string[] splittedProp = atr.Split('='); doc.LoadProperty(splittedProp[0], splittedProp[1]); } if (doc.Name == null) { Console.WriteLine("Document has no name"); } else { Console.WriteLine("Document added: {0}", doc.Name); allDocuments.Add(doc); } }
private static void AddAudioDocument(string[] attributes) { AudioDocument document = new AudioDocument(); AddDocument(document, attributes); }
private static void AddDocument(string[] attributes, string type) { string name = string.Empty; List<KeyValuePair<string, object>> documentAttributes = new List<KeyValuePair<string, object>>(); foreach (var item in attributes) { string[] splitAttributes = item.Split('='); if (splitAttributes[0] == "name") { name = splitAttributes[1]; } else { documentAttributes.Add(new KeyValuePair<string, object>(splitAttributes[0], splitAttributes[1])); } } Document currentDocument = null; if (name != string.Empty) { switch (type) { case "txt": currentDocument = new TextDocument(name); break; case "pdf": currentDocument = new PDFDocument(name); break; case "doc": currentDocument = new WordDocument(name); break; case "xls": currentDocument = new ExcelDocument(name); break; case "audio": currentDocument = new AudioDocument(name); break; case "video": currentDocument = new VideoDocument(name); break; } Console.WriteLine("Document added: {0}", name); currentDocument.SaveAllProperties(documentAttributes); DocumentSystem.Add(currentDocument); } else { Console.WriteLine("Document has no name"); } }
private static void AddAudioDocument(string[] attributes) { Document doc = new AudioDocument(); CreateDocument(attributes, doc); }
private static void AddAudioDocument(string[] attributes) { AudioDocument doc = new AudioDocument(); AddDocument(attributes, doc); }
private static void AddAudioDocument(string[] attributes) { IDocument doc = new AudioDocument(); addDocument(doc, attributes); }
private static void AddAudioDocument(string[] attributes) { IDocument doc = new AudioDocument(""); AddDocument(attributes, doc); }
private static void AddAudioDocument(string[] attributes) { AudioDocument audioDocument = new AudioDocument(); AddDocument(attributes, audioDocument); }