public static string GetHash(string sourcePath) { var data = MeshTopoShapeInterpreter.FileToData(sourcePath); var encoding = Convert.ToBase64String(data); return(encoding.GetHashCode().ToString()); }
private static void UnpackFile(string path, string compressionExtension) { var dataString = File.ReadAllBytes(path + compressionExtension); var fileData = MeshTopoShapeInterpreter.Unpack(dataString); File.WriteAllBytes(path, fileData); File.Delete(path + compressionExtension); }
public static int Compress(string sourcePath, string destinationPath) { var filedata = MeshTopoShapeInterpreter.FileToData(sourcePath); var compressedData = MeshTopoShapeInterpreter.Pack(filedata); var str = Convert.ToBase64String(compressedData); UpdateLogic.MakeSureThatDestinationDirectoriesExist(destinationPath, UpdateLogic.CurrentPath); File.WriteAllBytes(destinationPath, compressedData); return(str.GetHashCode()); }
private static string GetLengthFromFile(string sourcePath) { string length; try { length = MeshTopoShapeInterpreter.FileToData(sourcePath).Length.ToString(); } catch { return("0"); } return(length); }
public static void SaveToStep(string fileName, Document document) { var shapes = new List <TopoDSShape>(); foreach (var node in document.Root.Children.Values) { var interpreter = node.Get <NamedShapeInterpreter>(); if (interpreter == null) { continue; } var shape = interpreter.Shape; var hidden = node.Set <DrawingAttributesInterpreter>().Visibility == ObjectVisibility.Hidden; if (!hidden) { shapes.Add(shape); } } MeshTopoShapeInterpreter.SaveShapeToStep(shapes, fileName); }
public override void OnActivate() { base.OnActivate(); _fileDialog = new SaveFileDialog { Filter = @"*.step|*.step" }; var result = _fileDialog.ShowDialog(); if (result == DialogResult.Cancel) { BackToNeutralModifier(); return; } var entities = Inputs[InputNames.SelectionContainerPipe].GetData(NotificationNames.GetEntities).Get <List <SceneSelectedEntity> >(); var nodes = entities; var selectedNodes = new List <TopoDSShape>(); foreach (var entity in nodes) { var shapeInterpreter = entity.Node.Get <TopoDsShapeInterpreter>(); if (shapeInterpreter != null) { selectedNodes.Add(shapeInterpreter.Shape); } } NodeBuilderUtils.IdentifySelectedObjectLabel(Document.Root); if (selectedNodes.Count != 0) { MeshTopoShapeInterpreter.SaveShapeToStep(selectedNodes, _fileDialog.FileName); } else { SaveCommonCodes.SaveToStep(_fileDialog.FileName, Document); } BackToNeutralModifier(); }
public static string GetSize(string sourcePath) { var data = MeshTopoShapeInterpreter.FileToData(sourcePath); return(data.Length.ToString()); }