//-------------------------------------------------------------------- static byte[] fillProcList() { ProcessList.Clear(); foreach (var item in Process.GetProcesses().OrderBy(f => f.ProcessName)) { try { var proc = new ProcItem { Id = item.Id, Name = item.ProcessName }; ProcessList.Add(proc); } catch (Exception) { } } var binFormatter = new BinaryFormatter(); var mStream = new MemoryStream(); binFormatter.Serialize(mStream, ProcessList); return(mStream.ToArray()); }
private void PortalSelect_Load(object sender, EventArgs e) { listBox1.Items.Clear(); List <ProcItem> items = new List <ProcItem>(); tiaThread.RunSync((_) => { foreach (TiaPortalProcess proc in TiaPortal.GetProcesses()) { FileInfo proj = proc.ProjectPath; string path = null; if (proj != null) { path = proj.Name; } if (path == null) { path = "No project loaded"; } ProcItem item = new ProcItem(proc, path); items.Add(item); } return(null); }, null); foreach (ProcItem item in items) { listBox1.Items.Add(item); listBox1.SetSelected(0, true); } connectBtn.Enabled = (listBox1.SelectedItem != null); }
public AutoRetryConsumer(int maxRetryTimes, Func <int, int> retryDelay) { if (maxRetryTimes < 0) { throw new ArgumentOutOfRangeException(nameof(maxRetryTimes)); } _maxRetryTimes = maxRetryTimes; _retryDelay = retryDelay ?? (x => x); OnConsumeInternal += async(sender, item) => { var delay = _retryDelay(item.ErrorTimes); await TaskHelper.Delay(delay); await OnConsume(sender, item.Item).DonotCapture(); }; OnExceptionInternal += (sender, args) => { var item = args.Item; OnException.Invoke(sender, ProcItem.CreateEx(item.Item, args.Exception, args.ErrorTimes)); // 以下是失败后的补救措施 if (item.ErrorTimes++ < _maxRetryTimes) { _items.TryAdd(item); } else { OnDiscard.Invoke(sender, item.Item); } return(Task.CompletedTask); }; }
private async ValueTask Consume(ICollection <ProcItem <T> > items) { try { if (items.IsNullOrEmpty()) { return; } var list = items.Select(m => m.Item).ToArray(); await OnConsume.InvokeAsync(this, list).DonotCapture(); return; } catch (Exception ex) { var list = items.CastTo <IReadOnlyList <ProcItem <T> > >(); OnException.Invoke(this, ProcItem.CreateEx(list, ex, -1)); } var(retry, discard) = items.Partition(m => m.ErrorTimes < _maxRetryTimes); retry.ForEach(m => { m.ErrorTimes++; _items.TryAdd(m); }); var toDiscard = discard.Select(m => m.Item).ToArray(); if (toDiscard.Any()) { OnDiscard.Invoke(this, toDiscard); } }
protected static void CollectAllProcInfo() { Process[] procs = Process.GetProcesses(); for (int i = 0; i < procs.Length; i++) { ProcItem item = new ProcItem(); item.Clear(); item.pid = procs[i].Id; item.ProcName = procs[i].ProcessName; try { using (ManagementObjectSearcher mos = new ManagementObjectSearcher(string.Format("SELECT CommandLine FROM Win32_Process WHERE ProcessId = {0}", procs[i].Id))) { foreach (ManagementObject mo in mos.Get()) { item.commandLine = string.Format("{0}", mo["CommandLine"]); //item.FilePath = string.Format("{0}", mo["PathName"]); //Console.WriteLine(mo["CommandLine"]); } } } catch { item.commandLine = ""; item.FilePath = ""; } m_procInfoCollection.Add(procs[i].Id, item); } }
/// <summary> /// Open document. /// </summary> /// <param name="item"></param> /// <returns></returns> private Document OpenDocument(ProcItem item) { var document = Application.OpenDocument(item.IPath, false); if (document == null) { return(null); } var md_0 = cfg.Translator as Files; if (md_0.PMode == ProcessingMode.SaveAs) { item.FName = md_0.GetFileName(document, null); item.OPath = Path.Combine(GetDirectory(item), item.FName + ".grb"); } if (item.OPath != null && File.Exists(item.OPath)) { document.Close(); document = Application.OpenDocument(item.OPath, false); } if (document != null) { logging.WriteLine(LogLevel.INFO, string.Format(">>> Document [action: 0, path: {0}]", item.IPath)); } return(document); }
/// <summary> /// The extension method to processing Items. /// </summary> /// <param name="document"></param> /// <param name="item"></param> private void ProcessingItems(Document document, ProcItem item) { var tr = cfg.Translator as Translator; if ((item.Flags & 0x4) != 0x4) { ProcessingLinks(document); ProcessingPages(document, item); ProcessingProjections(document, item); ProcessingVariables(document); ProcessingExport(document, item); } foreach (var i in item.Items) { if ((i.Flags & 0x1) != 0x1) { continue; } if ((i.Flags & 0x2) == 0x2) { continue; } var ch_d = Application.OpenDocument(i.IPath, false); if (ch_d == null) { continue; } logging.WriteLine(LogLevel.INFO, string.Format(">>> Document [action: 0, path: {0}]", i.IPath)); if (tr.TMode == TranslatorType.Document) { ProcessingLinks(document, ch_d, i); } ProcessingItems(ch_d, i); // recursive call ProcessingEnd(ch_d, i); i.Flags |= 0x2; } if (item.Links.Count > 0 && (item.Flags & 0x4) != 0x4) { document.BeginChanges("Regenerate Links"); document.Regenerate(new RegenerateOptions { UpdateAllLinks = true }); document.EndChanges(); logging.WriteLine(LogLevel.INFO, string.Format(">>> Document [action: 2, path: {0}, mode: UpdateAllLinks]", item.OPath)); } }
public void SEARCH_BY_LEVEL_TEST() { var symbolsTable = new VectorSymbolTable(); var func = new FunctionItem() { Lexeme = "Func1" }; var proc = new ProcItem() { Lexeme = "Proc1" }; var item1 = new IdentificatorItem() { Lexeme = "x", Type = ItemType.Boolean, Level = 1 }; var item2 = new IdentificatorItem() { Lexeme = "a", Type = ItemType.Integer, Level = 2 }; var item3 = new IdentificatorItem() { Lexeme = "b", Type = ItemType.Integer, Level = 2 }; for (int i = 0; i < 5; i++) { symbolsTable.Insert(new IdentificatorItem() { Lexeme = "Item " + i, Type = ItemType.Boolean }); } symbolsTable.Insert(func); symbolsTable.Insert(item1); symbolsTable.Insert(proc); symbolsTable.Insert(item2); symbolsTable.Insert(item3); var result = symbolsTable.SearchByLevel(item1.Lexeme, 1); Assert.AreEqual(result, item1); result = symbolsTable.SearchByLevel(item2.Lexeme, 1); Assert.IsNull(result); result = symbolsTable.SearchByLevel(item1.Lexeme, 2); Assert.IsNull(result); result = symbolsTable.SearchByLevel(item2.Lexeme, 2); Assert.AreEqual(result, item2); result = symbolsTable.SearchByLevel(item3.Lexeme, 2); Assert.AreEqual(result, item3); }
private void PortalSelect_Load(object sender, EventArgs e) { listBox1.Items.Clear(); foreach (TiaPortalProcess proc in TiaPortal.GetProcesses()) { ProcItem item = new ProcItem(proc); listBox1.Items.Add(item); listBox1.SetSelected(0, true); } connectBtn.Enabled = (listBox1.SelectedItem != null); }
//---------------------------------------------------------------------- void RefreshProcListByCom(string com) { byte[] data = null; switch (com) { case "Connect": data = Encoding.Default.GetBytes("Connect:"); break; case "Kill": data = Encoding.Default.GetBytes($"Kill:{ProcIndex.Id}"); break; case "Run": data = Encoding.Default.GetBytes($"Run:{RunTask}"); break; case "Refresh": data = Encoding.Default.GetBytes("Refresh:"); break; } socket.Send(data); var answer = new byte[8192]; var length = socket.Receive(answer); if (length != 0) { var mStream = new MemoryStream(); var binFormatter = new BinaryFormatter(); mStream.Write(answer, 0, length); mStream.Position = 0; var tempCol = binFormatter.Deserialize(mStream) as List <ProcItem>; Dispatcher.Invoke(() => { ProcessList.Clear(); foreach (var item in tempCol) { var proc = new ProcItem(); proc.Id = item.Id; proc.Name = item.Name; ProcessList.Add(proc); } }); } }
private void Contains(ProcItem item, string path, ref bool result) { if (item.IPath == path) { result = true; return; } foreach (var i in item.Items) { Contains(i, path, ref result); } }
private bool TryGetItem(out ProcItem <T> item) { try { if (_items.TryTake(out item, 30 * 1000, _cts.Token)) { return(true); } } catch (OperationCanceledException) { } item = default; return(false); }
/// <summary> /// Initialize parent if subitem is selected. /// </summary> /// <param name="item"></param> private void InitFlags(ProcItem item) { foreach (var i in item.Items) { if ((i.Flags & 0x1) == 0x1) { if (item.Flags == 0) { item.Flags |= 0x1 | 0x4; } } InitFlags(i); } }
/// <summary> /// Processing file. /// </summary> /// <param name="item">The Processing Item Object.</param> internal void ProcessingFile(ProcItem item) { var tr = cfg.Translator as Translator; Document document = null; switch (tr.PMode) { case ProcessingMode.SaveAs: case ProcessingMode.Export: document = OpenDocument(item); break; case ProcessingMode.Import: int iMode = (cfg.Translator as Translator3D).ImportMode; string prototype = null; using (TFlex.Configuration.Files files = new TFlex.Configuration.Files()) { prototype = iMode == 2 ? files.Prototype3DName : files.Prototype3DAssemblyName; } if ((document = Application.NewDocument(prototype)) != null) { logging.WriteLine(LogLevel.INFO, string.Format(">>> Document [action: 1, path: {0}]", prototype)); } break; } if (document == null) { logging.WriteLine(LogLevel.ERROR, "The document object has a null value"); return; } ProcessingStart(document, item); ProcessingEnd(document, item); if (Directory.GetFiles(item.Directory).Length == 0 && Directory.GetDirectories(item.Directory).Length == 0) { Directory.Delete(item.Directory, false); } }
/// <summary> /// Processing the export. /// </summary> /// <param name="document"></param> /// <param name="item"></param> private void ProcessingExport(Document document, ProcItem item) { var tr = cfg.Translator as Translator; switch (tr.TMode) { case TranslatorType.Acad: tr_1.Export(document, item.Pages, logging); break; case TranslatorType.Bitmap: tr_3.Export(document, item.Pages, logging); break; case TranslatorType.Pdf: tr_9.Export(document, item.Pages, logging); break; } }
/// <summary> /// Get output directory path. /// </summary> /// <param name="item">Parent processing Item.</param> /// <returns>Returns Output Directory Path.</returns> private string GetDirectory(ProcItem item) { var md_0 = cfg.Translator as Links; if (md_0.LinkTemplate.Length > 0) { var link = md_0.GetLink(item); if (link != null) { item.Directory = Path.Combine(cfg.TargetDirectory, link.Replace(item.FName, "")); } } if (Directory.Exists(item.Directory) == false) { Directory.CreateDirectory(item.Directory); } return(item.Directory); }
public void ADD_NEW_ITEMS_TEST() { var collection = new SymbolTableItemCollection(); var internalCollection = GetInternalCollection(collection); var item1 = new FunctionItem { Lexeme = "func" }; var item2 = new ProcItem { Lexeme = "proc" }; collection.Add(item1); collection.Add(item2); Assert.IsTrue(internalCollection.Count == 2); Assert.IsTrue(collection.Count == 2); Assert.AreEqual(internalCollection[0], item1); Assert.AreEqual(internalCollection[1], item2); }
private void AnalyzeProcDcl() { _isAnalyzingFunction = false; NextToken(); if (_token.Symbol != Symbols.SIdentificador) { RaiseUnexpectedTokenError("identificador"); } var item = _symbolTable.Search(_token.Lexeme); if (item != null) { RaiseDoubleError(Symbols.SProcedimento); } _codeGenerator.GenerateLabel(_lastLabel); item = new ProcItem { Lexeme = _token.Lexeme, Level = _level, Label = _codeGenerator.GetStringLabelFor(_lastLabel) }; _symbolTable.Insert(item); _level++; NextToken(); if (_token.Symbol != Symbols.SPontoVirgula) { RaiseMissingSemicolonError(); } AnalyzeBlock(); _symbolTable.CleanUpToLevel(_level); _level--; _codeGenerator.GenerateInstruction(RETURN); }
/// <summary> /// Save source document as copy. /// </summary> /// <param name="document">Source document.</param> /// <param name="item"></param> private void DocumentSaveAs(Document document, ProcItem item) { if ((item.Flags & 0x4) == 0x4) { return; } if (item.OPath != null && File.Exists(item.OPath)) { return; } var md_4 = cfg.Translator as Files; item.FName = md_4.GetFileName(document, null); item.OPath = Path.Combine(GetDirectory(item), item.FName + ".grb"); if (document.SaveAs(item.OPath)) { logging.WriteLine(LogLevel.INFO, string.Format(">>> Document [action: 4, path: {0}]", item.OPath)); } }
/// <summary> /// Initialize the tree Items to parent. /// </summary> /// <param name="cfg"></param> /// <param name="item">Parent Item.</param> /// <param name="items">Selected Items.</param> private void InitItems(Header cfg, ProcItem item, string[] items) { string[] links = Application .GetDocumentExternalFileLinks(item.IPath, true, false, false); foreach (var p in links) { int flags = 0x0; if (items.Contains(p)) { flags |= 0x1; } var subItem = new ProcItem(p) { Flags = flags, Directory = GetDirectory(cfg, p), Parent = item }; item.Items.Add(subItem); InitItems(cfg, subItem, items); } }
/// <summary> /// Initialize the package Items. /// </summary> /// <param name="cfg"></param> /// <param name="items">Selected Items.</param> private void InitPackage(Header cfg, string[] items) { var ext = "*" + (cfg.Translator as Files).IExtension; var opt = SearchOption.AllDirectories; var files = Directory.GetFiles(cfg.InitialCatalog, ext, opt); foreach (var p in files) { if (Contains(p)) { continue; } int flags = 0x0; if (items.Contains(p)) { flags |= 0x1; } var item = new ProcItem(p) { Flags = flags, Directory = GetDirectory(cfg, p) }; if (ext == "*.grb") { InitItems(cfg, item, items); } Items.Add(item); } foreach (var i in Items) { if ((i.Flags & 0x1) == 0x1) { continue; } InitFlags(i); } }
public void CLEAN_UP_TEST() { var symbolsTable = new VectorSymbolTable(); var item1 = new IdentificatorItem() { Lexeme = "a", Type = ItemType.Boolean, Level = 1 }; var item2 = new IdentificatorItem() { Lexeme = "x", Type = ItemType.Integer, Level = 2 }; var item3 = new IdentificatorItem() { Lexeme = "y", Type = ItemType.Integer, Level = 1 }; var func = new FunctionItem() { Lexeme = "func", Type = ItemType.Integer, }; var proc = new ProcItem() { Lexeme = "proc" }; symbolsTable.Insert(func); symbolsTable.Insert(item1); symbolsTable.Insert(item3); symbolsTable.Insert(proc); symbolsTable.Insert(item2); symbolsTable.CleanUpToLevel(2); Assert.IsNull(symbolsTable.Search(item2.Lexeme)); symbolsTable.CleanUpToLevel(1); Assert.IsNull(symbolsTable.Search(item1.Lexeme)); Assert.IsNull(symbolsTable.Search(item3.Lexeme)); }
protected virtual async Task Process() { while (!_items.IsCompleted && !_cts.IsCancellationRequested) { if (!TryGetItem(out var item)) { continue; } try { await OnConsumeInternal.InvokeAsync((TSelf)this, item).DonotCapture(); item.ErrorTimes = 0; } catch (Exception ex) { item.ErrorTimes++; var args = ProcItem.CreateEx(item, ex, item.ErrorTimes); await OnExceptionInternal.InvokeAsync((TSelf)this, args).DonotCapture(); } } _finish.Set(); }
/// <summary> /// The extension method to processing links. /// </summary> /// <param name="parent">Parent document.</param> /// <param name="child">Child document.</param> /// <param name="item">The processing subitem.</param> private void ProcessingLinks(Document parent, Document child, ProcItem item) { if (!(cfg.Modules as Modules).Links) { return; } if ((item.Flags & 0x4) == 0x4) { return; } foreach (var link in parent.FileLinks) { if (link.FullFilePath == item.IPath) { DocumentSaveAs(child, item); parent.BeginChanges("Replace Link"); ReplaceLink(link, item.OPath); parent.EndChanges(); item.Parent.Links.Add(link); break; } } }
/// <summary> /// The processing end method. /// </summary> /// <param name="document"></param> /// <param name="item">The Processing Item.</param> private void ProcessingEnd(Document document, ProcItem item) { if (document.Changed) { if (document.FileName.Contains(cfg.InitialCatalog)) { document.CancelChanges(); logging.WriteLine(LogLevel.INFO, string.Format(">>> Document [action: 5, path: {0}]", item.IPath)); } else { document.Save(); logging.WriteLine(LogLevel.INFO, string.Format(">>> Document [action: 3, path: {0}]", item.IPath)); } } document.Close(); logging.WriteLine(LogLevel.INFO, string.Format(">>> Document [action: 6, path: {0}]", item.IPath)); }
/// <summary> /// The extension method to processing projections. /// </summary> /// <param name="document"></param> /// <param name="item"></param> private void ProcessingProjections(Document document, ProcItem item) { if (!(cfg.Modules as Modules).Projections) { return; } var tr_0 = cfg.Translator as Translator_0; ICollection <Projection> projections = null; if (item.Pages.Count == 0) { projections = document.GetProjections(); } else if (tr_0.PageScale != 99999) { projections = new List <Projection>(); foreach (var i in document.GetProjections()) { if (item.Pages.ContainsKey(i.Page)) { projections.Add(i); } } } if (projections == null) { return; } var len = projections.Count(); if (len > 0) { logging.WriteLine(LogLevel.INFO, string.Format(">>> Processing Projections [quantity: {0}]", len)); } foreach (var i in projections) { uint flags = 0x0; if (tr_0.ProjectionNames.Length > 0) { flags |= 0x1; } if ((flags & 0x1) == 0x1 && tr_0.ProjectionNames.Contains(i.Name)) { flags |= 0x2; } if (tr_0.ExcludeProjection && (flags & 0x2) == 0x2) { continue; } if (i.Scale.Value == Parameter.Default().Value&& tr_0.ProjectionScale == 99999) { continue; } if (i.Scale.Value == (double)tr_0.ProjectionScale) { continue; } double scale = tr_0.ProjectionScale == 99999 ? Parameter.Default().Value : (double)tr_0.ProjectionScale; document.BeginChanges("Changing the projection scale"); i.Scale = new Parameter(scale); if (tr_0.TMode == TranslatorType.Document) { document.Regenerate(new RegenerateOptions { Projections = true }); logging.WriteLine(LogLevel.INFO, "--> Document [action: 2, mode: Projections]"); } document.EndChanges(); logging.WriteLine(LogLevel.INFO, string.Format(CultureInfo.InvariantCulture, "--> Projection [action: 1, id: {0}, name: {1}, scale: {2}]", i.ObjectId, i.Name, scale)); } }
/// <summary> /// The extension method to processing pages. /// </summary> /// <param name="document"></param> /// <param name="item"></param> private void ProcessingPages(Document document, ProcItem item) { if (!(cfg.Modules as Modules).Pages) { return; } var tr_0 = cfg.Translator as Translator_0; int count = 0; Dictionary <PageType, int> types = new Dictionary <PageType, int> { { PageType.Normal, 0 }, { PageType.Workplane, 0 }, { PageType.Auxiliary, 0 }, { PageType.Text, 0 }, { PageType.BillOfMaterials, 0 }, { PageType.Circuit, 0 } }; foreach (var p in document.GetPages()) { uint flags = 0x0; if (!tr_0.PageTypeExists(p)) { continue; } if (tr_0.PageNames.Length > 0) { flags |= 0x1; } if ((flags & 0x1) == 0x1 && tr_0.PageNames.Contains(p.Name)) { flags |= 0x2; } if (tr_0.ExcludePage && (flags & 0x2) == 0x2) { continue; } if ((flags & 0x1) == 0x1 && (flags & 0x2) != 0x2) { continue; } if (tr_0.CheckDrawingTemplate && !tr_0.DrawingTemplateExists(document, p)) { continue; } types[p.PageType]++; item.Pages.Add(p, null); } var len = item.Pages.Count; if (len > 0) { logging.WriteLine(LogLevel.INFO, string.Format(">>> Processing Pages [quantity: {0}]", len)); } int action = 0; for (int i = 0; i < len; i++) { var page = item.Pages.ElementAt(i).Key; if (page.Scale.Value != (double)tr_0.PageScale && tr_0.PageScale != 99999) { action = 1; document.BeginChanges("Changing the page scale"); page.Scale = new Parameter((double)tr_0.PageScale); if (tr_0.TMode == TranslatorType.Document) { document.Regenerate(new RegenerateOptions { Full = true }); logging.WriteLine(LogLevel.INFO, "--> Document [action: 2, mode: Full]"); } document.EndChanges(); } logging.WriteLine(LogLevel.INFO, string.Format(CultureInfo.InvariantCulture, "--> Page [action: {0}, id: {1:X}, name: {2}, scale: {3}, type: {4}]", action, page.ObjectId, page.Name, page.Scale.Value, page.PageType)); if (tr_0.TMode == TranslatorType.Document) { continue; } string suffix = string.Empty; string ext = tr_0.OExtension; item.FName = tr_0.GetFileName(document, page); item.OPath = Path.Combine(GetDirectory(item), item.FName); switch (page.PageType) { case PageType.Normal: suffix = "_T0"; break; case PageType.Workplane: suffix = "_T1"; break; case PageType.Auxiliary: suffix = "_T3"; break; case PageType.Text: suffix = "_T4"; break; case PageType.BillOfMaterials: suffix = "_T5"; break; case PageType.Circuit: suffix = "_T6"; break; } if (types[page.PageType] > 1) { item.OPath += "_" + (count + 1).ToString() + ext; count++; } else if (item.Pages.ContainsValue(item.OPath + ext)) { item.OPath += suffix + ext; } else { item.OPath += ext; } item.Pages[page] = item.OPath; } }
/// <summary> /// The processing start method. /// </summary> /// <param name="document"></param> /// <param name="item">The Processing Item.</param> private void ProcessingStart(Document document, ProcItem item) { var tr = cfg.Translator as Translator; string[] aPath = item.IPath.Split('\\'); switch (tr.TMode) { case TranslatorType.Document: DocumentSaveAs(document, item); ProcessingItems(document, item); break; case TranslatorType.Acad: case TranslatorType.Bitmap: case TranslatorType.Pdf: ProcessingItems(document, item); break; case TranslatorType.Acis: switch (tr.PMode) { case ProcessingMode.Export: item.FName = tr_2.GetFileName(document, null); item.OPath = Path.Combine(item.Directory, item.FName + tr_2.OExtension); tr_2.Export(document, item.OPath, logging); break; case ProcessingMode.Import: if (tr_2.ImportMode > 0) { item.FName = aPath[aPath.Length - 1].Replace(".sat", ".grb"); item.OPath = Path.Combine(item.Directory, item.FName); document.SaveAs(item.OPath); } tr_2.Import(document, item.Directory, item.IPath, logging); logging.WriteLine(LogLevel.INFO, string.Format(">>> Document Saved [path: {0}]", document.FileName)); break; } break; case TranslatorType.Iges: switch (tr.PMode) { case ProcessingMode.Export: item.FName = tr_6.GetFileName(document, null); item.OPath = Path.Combine(item.Directory, item.FName + tr_6.OExtension); tr_6.Export(document, item.OPath, logging); break; case ProcessingMode.Import: if (tr_6.ImportMode > 0) { item.FName = aPath[aPath.Length - 1].Replace(".igs", ".grb"); item.OPath = Path.Combine(item.Directory, item.FName); document.SaveAs(item.OPath); } tr_6.Import(document, item.Directory, item.IPath, logging); logging.WriteLine(LogLevel.INFO, string.Format(">>> Document Saved [path: {0}]", document.FileName)); break; } break; case TranslatorType.Jt: switch (tr.PMode) { case ProcessingMode.Export: item.FName = tr_7.GetFileName(document, null); item.OPath = Path.Combine(item.Directory, item.FName + tr_7.OExtension); tr_7.Export(document, item.OPath, logging); break; case ProcessingMode.Import: if (tr_7.ImportMode > 0) { item.FName = aPath[aPath.Length - 1].Replace(".jt", ".grb"); item.OPath = Path.Combine(item.Directory, item.FName); document.SaveAs(item.OPath); } tr_7.Import(document, item.Directory, item.IPath, logging); logging.WriteLine(LogLevel.INFO, string.Format(">>> Document Saved [path: {0}]", document.FileName)); break; } break; case TranslatorType.Step: switch (tr.PMode) { case ProcessingMode.Export: item.FName = tr_10.GetFileName(document, null); item.OPath = Path.Combine(item.Directory, item.FName + tr_10.OExtension); tr_10.Export(document, item.OPath, logging); break; case ProcessingMode.Import: if (tr_10.ImportMode > 0) { item.FName = aPath[aPath.Length - 1].Replace(".stp", ".grb"); item.OPath = Path.Combine(item.Directory, item.FName); document.SaveAs(item.OPath); } tr_10.Import(document, item.Directory, item.IPath, logging); logging.WriteLine(LogLevel.INFO, string.Format(">>> Document Saved [path: {0}]", document.FileName)); break; } break; } }