Exemplo n.º 1
0
 public bool Run(IModule caller, string macroName, string jsonParameters, LogbookLevel level, Action <float> progressUpdate, ref string returnValue)
 {
     lock (this)
     {
         try
         {
             EnsureWriteAvailable(caller);
             // clear out all of the old input before starting
             using var writer = new BinaryWriter(_emmePipe, Encoding.Unicode, true);
             writer.Write(SignalStartModuleBinaryParameters);
             writer.Write(macroName.Length);
             writer.Write(macroName.ToCharArray());
             if (jsonParameters == null)
             {
                 writer.Write((int)0);
             }
             else
             {
                 writer.Write(jsonParameters.Length);
                 writer.Write(jsonParameters.ToCharArray());
             }
             var logbookLevel = level switch
             {
                 LogbookLevel.Standard => LogbookStandard,
                 LogbookLevel.Debug => LogbookDebug,
                 LogbookLevel.None => LogbookNone,
                 _ => LogbookStandard
             };
             writer.Write(logbookLevel.Length);
             writer.Write(logbookLevel);
             writer.Flush();
             // make sure the tool exists before continuing
             if (!WaitForEmmeResponce(caller, ref returnValue, progressUpdate))
             {
                 // if the tool does not exist, we have failed!
                 return(false);
             }
         }
         catch (IOException e)
         {
             throw new XTMFRuntimeException(caller, "I/O Connection with EMME while sending data, with:\r\n" + e.Message);
         }
         return(WaitForEmmeResponce(caller, ref returnValue, progressUpdate));
     }
 }
Exemplo n.º 2
0
 public bool Run(IModule caller, string macroName, string jsonParameters, LogbookLevel level, ref string returnValue)
 {
     return(Run(caller, macroName, jsonParameters, level, null, ref returnValue));
 }
Exemplo n.º 3
0
        public bool Run(IModule caller, string macroName, string jsonParameters, LogbookLevel level)
        {
            string unused = null;

            return(Run(caller, macroName, jsonParameters, level, null, ref unused));
        }