def SaveDocument(self): filename = self.filename if not filename: if self.saveFileDialog.ShowDialog() != WinForms.DialogResult.OK: return filename = self.saveFileDialog.FileName filename = self.filename = filename.lower() self.Text = 'Python Wordpad - %s' % filename self.richTextBox.Select(0, 0) stream = File.OpenWrite(filename) if filename.endswith('.rtf'): data = self.richTextBox.Rtf else: data = self.richTextBox.Text data = System.Text.Encoding.ASCII.GetBytes(System.String(data)) stream.Write(data, 0, data.Length) stream.Close()
def decode_db(self): """ decrypt sqlite.... AES.ECB with key = a4a11bb9ef4b2f4c """ node = self.root if node is None: return f_dest = File.OpenWrite(self.cache + "/girf_sync_decode.db") data = Encoding.UTF8.GetBytes("SQLite format 3\0") f_dest.Write(data,0,data.Length) nodes = node.Data nodes.Seek(0,SeekOrigin.Begin) bts = Array[Byte](range(16)) rm = RijndaelManaged() rm.Key = Encoding.UTF8.GetBytes("a4a11bb9ef4b2f4c") rm.Mode = CipherMode.ECB rm.Padding = PaddingMode.None tr = rm.CreateDecryptor() stm=CryptoStream(f_dest,tr,CryptoStreamMode.Write) count = 0 nodes.Seek(8,SeekOrigin.Begin) count = nodes.Read(bts,0,8) stm.Write(bts,0,8) nodes.Seek(24,SeekOrigin.Begin) while True: count = nodes.Read(bts,0,bts.Length) if count!=0: stm.Write(bts,0,count) stm.Flush() else: break stm.Close() f_dest.Close()
dialogResult = MessageBox.Show( "The RoadMap files are ready to be exported\n\nDo you want to change the save location?\n\nPath: " + savePath, "OSC RoadMap Export Prompt", MessageBoxButtons.YesNoCancel) if (dialogResult == DialogResult.Yes): SaveFile = FolderBrowserDialog() SaveFile.ShowDialog() savePath = SaveFile.SelectedPath + "\\" + fileDetails elif (dialogResult == DialogResult.No): roadmapTable = Document.Data.Tables['roadmap'] writer = Document.Data.CreateDataWriter( DataWriterTypeIdentifiers.ExcelXlsDataWriter) stream = File.OpenWrite(savePath) allColumnNames = [] allRows = Document.Data.AllRows.GetSelection(roadmapTable).AsIndexSet() for column in roadmapTable.Columns: allColumnNames.Add(column.Name) writer.Write(stream, roadmapTable, allRows, allColumnNames) timeUpdated = datetime.datetime.now().strftime("%m-%d-%Y %H:%M:%S") stream.Close() stream.Dispose() exportMessage = 'The Roadmap files have been successfully exported!\n' + 'Time Saved: ' + timeUpdated + '\nLocation: ' + savePath else:
# parameters should be created # table, DataTable to be exported. # ToolPath, The absolute path of the Ftp tool. from Spotfire.Dxp.Data.Export import DataWriterTypeIdentifiers from System.IO import File from System.Diagnostics import Process writer = Document.Data.CreateDataWriter( DataWriterTypeIdentifiers.SbdfDataWriter) filtering = Document.ActiveFilteringSelectionReference.GetSelection( table).AsIndexSet() stream = File.OpenWrite("D:\\SSOTEMP\\" + SessionID) names = [] for col in table.Columns: names.append(col.Name) writer.Write(stream, table, filtering, names) stream.Close() p = Process() p.StartInfo.FileName = ToolPath p.StartInfo.UseShellExecute = False p.StartInfo.RedirectStandardInput = True p.StartInfo.RedirectStandardOutput = True p.StartInfo.RedirectStandardError = True p.StartInfo.CreateNoWindow = True