static void Main(string[] args) { //Helper.CheckDirectories(); var CurrentDomain = AppDomain.CurrentDomain.BaseDirectory; var GetDirectoryName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); Console.WriteLine("AppDomain.CurrentDomain.BaseDirectory: {0}", CurrentDomain); Console.WriteLine("Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location): {0}", GetDirectoryName); ManualResetEvent manualResetEvent = new ManualResetEvent(true); manualResetEvent.WaitOne(); ConsoleWriteLine.WriteInConsole(null, null, null, "Project started", ConsoleColor.White); Process.GetCurrentProcess().PriorityClass = ProcessPriorityClass.RealTime; Process.GetCurrentProcess().PriorityBoostEnabled = true; Helper_WINWORD.Clear(); Helper_EXCEL.Clear(); ClearNormal(); ProgressOfUpdateAtStructAttribute Standart = (ProgressOfUpdateAtStructAttribute)ParentMethods.GetStandart().Clone_Full(); ValueForClient.DeserializeConfig(new TimeSpan(0, 5, 0)); // Deserialization data'es if (ValueForClient.ReadyStructure.ProgressOfUpdate is null ? true : ValueForClient.ReadyStructure.ProgressOfUpdate.List_ProgressOfUpdateAtStructAttribute.Count != 1) { Progress = Standart; ValueForClient.ReadyStructure.ProgressOfUpdate = new ProgressOfUpdate() { List_ProgressOfUpdateAtStructAttribute = new List <ProgressOfUpdateAtStructAttribute>() { Progress } }; }
static MethodsCall() { Helper_WINWORD.Clear(); Helper_EXCEL.Clear(); AppDomain.CurrentDomain.ProcessExit += delegate(object sender, EventArgs e) { Helper_WINWORD.Clear(); Helper_EXCEL.Clear(); }; }
public static Tuple <DataTable, string> Read(string Path, string LetterStart, string LetterEnd, Dictionary <string, string> PathsAndFields, int startRow, out Exception Exception, [Optional] int RecurseTry) { DataTable dataTable = new DataTable(); string ExceptionMessage = ""; lock (Helper_EXCEL.LockObject_ForCreateProcessKill) { Application MyAppField = Helper_EXCEL.GetApp(out int idIndexField, true); Workbook MyBookField = Helper_EXCEL.GetWorkbook(MyAppField, Path, out Exception, 0); if (!(MyBookField is null)) { MyAppField.Visible = false; Sheets MySheetFields = MyBookField.Sheets; Worksheet MySheetField_Start = default(Worksheet); int lastRowFields_Start = default(int); List <Tuple <string, string> > FieldInExcel_Start = new List <Tuple <string, string> >(); int index_Start = default(int); bool FieldsIsFound = false; List <Worksheet> worksheets = new List <Worksheet>(); foreach (Worksheet MySheetField in MySheetFields) { worksheets.Add(MySheetField); } foreach (Worksheet MySheetField in worksheets) { int lastRowFields = MySheetField.Cells.SpecialCells(XlCellType.xlCellTypeLastCell).Row; for (int i = 1; i <= startRow; i++) { List <Tuple <string, string> > FieldInExcel = new List <Tuple <string, string> >(); Array a = (Array)MySheetField.get_Range(LetterStart + "" + i + "", LetterEnd + "" + i + "").Cells.Value; int NumbInEngAlp = EngAlp.ToUpper().IndexOf(LetterStart + "".ToUpper()); foreach (var aa in a) { string Field = (NumbInEngAlp > 25 ? EngAlp[0] + "" : EngAlp[NumbInEngAlp] + "") + (NumbInEngAlp > 25 ? EngAlp[NumbInEngAlp - 26] + "" : ""); FieldInExcel.Add(new Tuple <string, string>(Field + "" + i + "", aa + "")); NumbInEngAlp++; } bool IsExist = false; if (PathsAndFields is null ? false : PathsAndFields.Count > 0) // Совпадение по хэдэру { foreach (var entry in PathsAndFields) { foreach (var v in FieldInExcel) { if (v.Item1 == entry.Key) { if (entry.Value is null ? false : v.Item2 is null ? false : entry.Value.Contains(v.Item2) || v.Item2.Contains(entry.Value)) { IsExist = true; } else { IsExist = false; break; } } } } }