public static ISinapseDocument Open(string fullName) { ISinapseDocument document = null; // First we check if file exists, if (System.IO.File.Exists(fullName)) { // Determine the type of the document being open Type type = DocumentManager.GetType(Utils.GetExtension(fullName, true)); // Create the method info for the static method SerializableObject<T>.Open MethodInfo methodOpen = type.GetMethod("Open", BindingFlags.Static | BindingFlags.Public); // Call the Open method passing the FullPath as its first parameter document = (ISinapseDocument)methodOpen.Invoke(null, new object[] { fullName }); } else { throw new FileNotFoundException("The file could not be found", fullName); } return(document); }
private void initialize(string filePath, Workplace workplace) { Type type = DocumentManager.GetType(Utils.GetExtension(filePath, true)); initialize(filePath, workplace, type); }