def alternateLoadMasterPluginIndex(): import System, System.Windows.Forms from System.IO import Path, File, StreamReader from System import Environment p = [] r = StreamReader(file) while 1: t = r.ReadLine() if t == None: break p.append(t) r.Close()
class SharedParametersFileClass(): def __init__(self, filePath, uidoc): self.filePath = filePath self.uidoc = uidoc try: self.filereader = StreamReader( filePath ) self.uidoc.Application.Application.OpenSharedParameterFile() except: Alert( 'Check Your Shared Parameters File Path', title="Error", header="Invalid Shared Parameters File", exit=True ) self.temp = os.environ['USERPROFILE'] + "\\AppData\\Local\\temp.txt" def __enter__(self): self.file = StreamWriter( self.temp ) while self.filereader.Peek() > -1: line = self.filereader.ReadLine() if line.startswith(('*', '#', 'META')): self.file.WriteLine( line ) self.file.Close() self.uidoc.Application.Application.SharedParametersFilename = self.temp self.fileDefinition = self.uidoc.Application.Application.OpenSharedParameterFile() self.groupDefinition = self.fileDefinition.Groups.Create('temp_group') return self def __exit__(self, type, value, traceback): Delete( self.temp ) self.uidoc.Application.Application.SharedParametersFilename = self.filePath def copyExternalDefinition(self, guid, definition): xDefOptions = ExternalDefinitionCreationOptions(definition.Name, definition.ParameterType) xDefOptions.Description = '' xDefOptions.GUID = guid return self.groupDefinition.Definitions.Create( xDefOptions )
strInput = StringBuilder() #Setup/start process p = Process() p.StartInfo.FileName = "cmd.exe" p.StartInfo.CreateNoWindow = True p.StartInfo.UseShellExecute = False p.StartInfo.RedirectStandardOutput = True p.StartInfo.RedirectStandardInput = True p.StartInfo.RedirectStandardError = True p.OutputDataReceived += DataReceivedEventHandler(CmdOutputDataHandler) p.ErrorDataReceived += DataReceivedEventHandler(CmdOutputDataHandler) p.Start() wtr.WriteLine("SPID: %s\nCPID: %s" % (Process.GetCurrentProcess().Id, p.Id)) p.BeginErrorReadLine() p.BeginOutputReadLine() while (not p.HasExited): try: strInput.Append.Overloads[str](rdr.ReadLine()) if strInput.ToString().ToLower() == "exit": p.Kill() Process.GetCurrentProcess().Kill() else: p.StandardInput.WriteLine(strInput) strInput.Remove(0, strInput.Length) except: break
#Because the submodule Enyim.Caching is setup to be delay signed when the private key isn't #present, you'll need to modify the project or disable assembly verification #to be able to use a local build. The simplest solution is to disable delay signing #after updating your submodule. This IronPyton script is a QUICK and DIRTY solution to do that. #Again, this script is only useful for local development when working with the source from System.IO import StreamReader, StreamWriter from System.Text import StringBuilder path = r"lib/EnyimMemcached/build/CommonProperties.targets" sr = StreamReader(path) sb = StringBuilder() line = sr.ReadLine() while not line is None: #I'm sure this could all be done in a couple of lines with a nice multi-line Regex #All this does is comment out property groups that attempt to set signing if line.Trim().StartsWith("<PropertyGroup") and line.Contains("PrivateKey"): sb.AppendFormat("<!--{0}\r\n", line) while line is not None and line.Trim() != "</PropertyGroup>": sb.AppendLine(line) line = sr.ReadLine() else: sb.AppendFormat("{0}-->\r\n", line) else: sb.AppendLine(line) line = sr.ReadLine()