public static bool CreateDirectory(string strPath) { string fullName = Directory.GetParent(strPath).FullName; if (!Directory.Exists(fullName) && !Util_Helper.CreateDirectory(fullName)) { return(false); } try { Directory.CreateDirectory(strPath); } catch { return(false); } return(true); }
public static bool RunDialogLocalToLocal(List <string> lstFileNames, string strDestinationDirectory, bool checkOverwrite) { bool result = false; int num = 0; num = frmHandleDownload.HowManyFilesAreAlreadyExistsInFolder(lstFileNames, strDestinationDirectory); bool flag = (byte)((!checkOverwrite) ? 1 : 0) != 0; DialogResult dialogResult = DialogResult.Yes; for (int i = 0; i < lstFileNames.Count; i++) { string text = lstFileNames[i]; string text2 = strDestinationDirectory + "\\" + Path.GetFileName(text); if (File.Exists(text2)) { if (!flag) { num--; dialogResult = frmHandleDownload.RunDialogWebToLocal(text, num, out flag); } switch (dialogResult) { case DialogResult.Cancel: return(result); case DialogResult.No: continue; } } if (!Directory.Exists(strDestinationDirectory)) { Util_Helper.CreateDirectory(strDestinationDirectory); } File.Copy(text, text2, true); result = true; } return(result); }
public static void GetImagesFromDocument(Document familyDoc, string targetDirectory) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Expected O, but got Unknown //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) if (!Directory.Exists(targetDirectory)) { Util_Helper.CreateDirectory(targetDirectory); } ImageExportOptions val = new ImageExportOptions(); val.set_ExportRange(2); val.set_FilePath(targetDirectory); val.set_HLRandWFViewsFileType(2); val.set_ImageResolution(0); val.set_ShadowViewsFileType(2); val.set_ZoomType(0); val.set_PixelSize(512); val.set_FitDirection(0); FilteredElementCollector val2 = new FilteredElementCollector(familyDoc); IList <Element> list = val2.OfClass(typeof(View)).ToElements(); IList <ElementId> list2 = new List <ElementId>(); foreach (Element item in list) { View val3 = item as View; if ((int)val3 != 0 && !val3.get_IsTemplate() && val3.get_CanBePrinted()) { list2.Add(val3.get_Id()); } } val.SetViewsAndSheets(list2); if (Directory.Exists(targetDirectory)) { string[] files = Directory.GetFiles(targetDirectory, "*.jpg"); foreach (string path in files) { File.Delete(path); } } if (ImageExportOptions.IsValidFileName(targetDirectory) && list2.Count > 0) { try { familyDoc.ExportImage(val); } catch (Exception ex) { throw ex; } } }