public static void sendDocument(string apiKey, string fileName, string formFieldLayerTemplateKey, string recipient) { FileStream file = getTestPdfFile(fileName); secure.echosign.com.FileInfo[] fileInfos = new secure.echosign.com.FileInfo[1]; fileInfos[0] = new secure.echosign.com.FileInfo(fileName, null, file); SenderInfo senderInfo = null; string[] recipients = new string[1]; recipients[0] = recipient; DocumentCreationInfo documentInfo = new DocumentCreationInfo( recipients, testPrefix + Path.GetFileName(file.Name), testMessage, fileInfos, SignatureType.ESIGN, SignatureFlow.SENDER_SIGNATURE_NOT_REQUIRED ); if (formFieldLayerTemplateKey != null) { secure.echosign.com.FileInfo[] formFieldLayerTemplates = new secure.echosign.com.FileInfo[1]; formFieldLayerTemplates[0] = new secure.echosign.com.FileInfo(formFieldLayerTemplateKey); documentInfo.formFieldLayerTemplates = formFieldLayerTemplates; } DocumentKey[] documentKeys; documentKeys = ES.sendDocument(apiKey, senderInfo, documentInfo); Console.WriteLine("Document key is: " + documentKeys[0].documentKey); }
//SenderNameと一致するsenderを探す //Syphonは"appName:senderName"なので、appNameは判定しない void FindSyphonSender() { var list = SyphonPluginEntry.Plugin_CreateServerList(); var count = SyphonPluginEntry.Plugin_GetServerListCount(list); if (senderInfoList.Count == count) { return; } //senderの数が変わっていれば、更新 senderInfoList = new List <SenderInfo>(); for (var i = 0; i < count; i++) { var pSenderName = SyphonPluginEntry.Plugin_GetNameFromServerList(list, i); var pAppName = SyphonPluginEntry.Plugin_GetAppNameFromServerList(list, i); var senderInfo = new SenderInfo(); senderInfo.senderName = (pSenderName != IntPtr.Zero) ? Marshal.PtrToStringAnsi(pSenderName) : "(no sender name)"; senderInfo.appName = (pAppName != IntPtr.Zero) ? Marshal.PtrToStringAnsi(pAppName) : ""; senderInfo.fullName = String.Format("{0}:{1}", senderInfo.appName, senderInfo.senderName); // print(senderInfo.fullName)); //senderInfoListを更新 senderInfoList.Add(senderInfo); } //comboBox用のsenderNameListを更新 senderNameList = senderInfoList.Select(info => info.fullName).ToList(); _comboBox.list = senderNameList; }
/// <summary> /// Metodo per la creazione delle informazioni sul mittente della spedizione /// </summary> /// <param name="schedaDocumento">Documento da cui estrarre le informazioni</param> /// <param name="infoUtente">Informazioni sull'utente richiedente</param> /// <param name="destinatari">Lista dei destinatari della spedizione</param> /// <returns>Informazioni sul mittente della spedizione</returns> private SenderInfo CreateSendersInfo(SchedaDocumento schedaDocumento, InfoUtente infoUtente, Corrispondente[] destinatari) { // Recupero del codice del mittente String senderCode = InteroperabilitaSemplificataManager.LoadSenderInfoFromUoId(((ProtocolloUscita)schedaDocumento.protocollo).mittente.systemId); // Se il mittente non è interoperante o se non è presente in RC, non si può procedere con la spedizione if (!InteroperabilitaSemplificataManager.IsCorrEnabledToInterop( ((ProtocolloUscita)schedaDocumento.protocollo).mittente.systemId) || RubricaComune.RubricaServices.GetElementoRubricaComune(infoUtente, senderCode, false) == null) { throw new SenderNotInteroperableException(); } SenderInfo senderInfo = new SenderInfo() { AdministrationId = infoUtente.idAmministrazione, //Code = String.Format("{0}-{1}", // ((ProtocolloUscita)schedaDocumento.protocollo).mittente.codiceAmm, // ((ProtocolloUscita)schedaDocumento.protocollo).mittente.descrizione), Code = senderCode, Url = InteroperabilitaSemplificataManager.GetUrl(infoUtente.idAmministrazione), UserId = infoUtente.userId, FileManagerUrl = InteroperabilitaSemplificataManager.GetFileManagerUrl(schedaDocumento.registro.idAmministrazione) }; return(senderInfo); }
//SenderNameと一致するsenderを探す void FindSpoutSender() { var count = SpoutPluginEntry.ScanSharedObjects(); if (senderInfoList.Count == count) { return; } //senderの数が変わっていれば、更新 senderInfoList = new List <SenderInfo>(); for (var i = 0; i < count; i++) { var senderInfo = new SenderInfo(); senderInfo.fullName = SpoutPluginEntry.GetSharedObjectNameString(i); var _nameList = senderInfo.fullName.Split(':'); senderInfo.senderName = _nameList[_nameList.Length - 1].Trim(); // print(senderInfo.fullName)); //senderInfoListを更新 senderInfoList.Add(senderInfo); } //comboBox用のsenderNameListを更新 senderNameList = senderInfoList.Select(info => info.fullName).ToList(); _comboBox.list = senderNameList; }
// Token: 0x06001245 RID: 4677 RVA: 0x00039AC8 File Offset: 0x00037CC8 public override string GetMembershipId(SenderInfo senderInfo) { ExTraceGlobals.PublicPluginAPITracer.TraceDebug((long)this.GetHashCode(), "[PswsAuthorization.GetMembershipId] Enter."); string result; try { string name = senderInfo.Principal.Identity.Name; ExTraceGlobals.PublicPluginAPITracer.TraceDebug <string>((long)this.GetHashCode(), "[PswsAuthorization.GetMembershipId] membershipId = \"{0}\".", name); result = name; } catch (Exception ex) { ExTraceGlobals.PublicPluginAPITracer.TraceError <Exception>((long)this.GetHashCode(), "[PswsAuthorization.GetMembershipId] Exception: {0}", ex); AuthZLogger.SafeAppendGenericError("PswsAuthorization.GetMembershipId", ex, new Func <Exception, bool>(KnownException.IsUnhandledException)); TaskLogger.LogRbacEvent(TaskEventLogConstants.Tuple_PswsPublicAPIFailed, null, new object[] { "PswsAuthorization.GetMembershipId", ex.ToString() }); PswsErrorHandling.SendErrorToClient(PswsErrorCode.MemberShipIdError, ex, null); throw; } finally { ExTraceGlobals.PublicPluginAPITracer.TraceDebug((long)this.GetHashCode(), "[PswsAuthorization.GetMembershipId] Exit."); } return(result); }
public void TestLastName() { SenderInfo senderInfo = new SenderInfo(); senderInfo.LastName = "lastName"; Assert.AreEqual("lastName", senderInfo.LastName); }
public void TestFirstName() { SenderInfo senderInfo = new SenderInfo(); senderInfo.FirstName = "firstName"; Assert.AreEqual("firstName", senderInfo.FirstName); }
public bool IsAuthorized(UserContext userContext, Uri resourceUri) { SenderInfo senderInfo = new SenderInfo(userContext.GetIdentity(), userContext.ClientCertificate, resourceUri); CustomAuthorizationHandler.CustomContext customContext = null; TraceHelper.Current.MethodCall0("CustomAuthorizationHandler", "IsAuthorized"); try { using (OperationTracerWithTimeout operationTracerWithTimeout = new OperationTracerWithTimeout(new Action <string>(TraceHelper.Current.CustomAuthzCallStart), new Action <string>(TraceHelper.Current.CustomAuthzCallEnd), "AuthorizeUser", new Action <string>(TraceHelper.Current.CustomAuthzExceedTimeLimit), 30)) { UserQuota userQuotum = null; WindowsIdentity windowsIdentity = this.customAuthorization.AuthorizeUser(senderInfo, out userQuotum); if (windowsIdentity != null) { if (userQuotum != null) { TraceHelper.Current.UserQuotaInformation(userContext.Name, userQuotum.MaxConcurrentRequests, userQuotum.MaxRequestsPerTimeSlot, userQuotum.TimeSlotSize); customContext = new CustomAuthorizationHandler.CustomContext(windowsIdentity, userQuotum); } else { object[] nullQuota = new object[2]; nullQuota[0] = "CustomAuthorization.AuthorizeUser"; nullQuota[1] = Resources.NullQuota; throw new InvalidOperationException(ExceptionHelpers.GetExceptionMessage(Resources.MethodReturnedInvalidOutput, nullQuota)); } } else { object[] nullWindowsIdentity = new object[2]; nullWindowsIdentity[0] = "CustomAuthorization.AuthorizeUser"; nullWindowsIdentity[1] = Resources.NullWindowsIdentity; throw new InvalidOperationException(ExceptionHelpers.GetExceptionMessage(Resources.MethodReturnedInvalidOutput, nullWindowsIdentity)); } } } catch (Exception exception1) { Exception exception = exception1; if (!exception.IsSevereException()) { exception.Trace(null); } else { throw; } } this.customContextStore.StoreContext(customContext); if (customContext == null || customContext.Identity == null) { TraceHelper.Current.AuthorizeUserRequestFailed(userContext.Name, userContext.AuthenticationType); return(false); } else { TraceHelper.Current.AuthorizeUserRequestSucceeded(userContext.Name); return(true); } }
override public void Execute() { senderEmail = System.Guid.NewGuid().ToString() + "@e-signlive.com"; senderEmail = senderEmail.Replace("-", ""); eslClient.AccountService.InviteUser( AccountMemberBuilder.NewAccountMember(senderEmail) .WithFirstName("firstName") .WithLastName("lastName") .WithCompany("company") .WithTitle("title") .WithLanguage("language") .WithPhoneNumber("phoneNumber") .Build() ); SenderInfo senderInfo = SenderInfoBuilder.NewSenderInfo(senderEmail) .WithName(SENDER_FIRST_NAME, SENDER_SECOND_NAME) .WithTitle(SENDER_TITLE) .WithCompany(SENDER_COMPANY) .Build(); package = PackageBuilder.NewPackageNamed("CustomSenderInfoExample " + DateTime.Now) .WithSenderInfo(senderInfo) .DescribedAs("This is a package created using the e-SignLive SDK") .ExpiresOn(DateTime.Now.AddMonths(1)) .WithEmailMessage("This message should be delivered to all signers") .Build(); packageId = eslClient.CreatePackage(package); }
public void TestCompany() { SenderInfo senderInfo = new SenderInfo(); senderInfo.Company = "company"; Assert.AreEqual("company", senderInfo.Company); }
public CommandArgumentContainer(string commandName, SenderInfo sender, List <string> arguments, List <IBotMediaFile> mediaFiles) { CommandName = commandName; Sender = sender; Arguments = arguments; MediaFiles = mediaFiles; }
public void TestTitle() { SenderInfo senderInfo = new SenderInfo(); senderInfo.Title = "title"; Assert.AreEqual("title", senderInfo.Title); }
public async Task <Result> SendMediaAsync(IBotMediaFile mediaFile, string text, SenderInfo sender) { if (mediaFile is IBotOnlineFile onlineFile) { return(await SendOnlineMediaAsync(onlineFile, text, sender)); } Result result = CheckText(text); if (result.IsFailed) { return(result); } try { await _client.GetGuild((ulong)sender.ChatId) .GetTextChannel((ulong)sender.UserSenderId) .SendFileAsync(mediaFile.Path, text); return(Result.Ok()); } catch (Exception e) { const string message = "Error while sending message"; LoggerHolder.Instance.Error(e, message); return(Result.Fail(e)); } }
public void TestTimezoneId() { SenderInfo senderInfo = new SenderInfo(); senderInfo.TimezoneId = "Canada/Mountain"; Assert.AreEqual("Canada/Mountain", senderInfo.TimezoneId); }
public static PipBuildRequest ToGrpc(this OpenBond.PipBuildRequest message, SenderInfo senderInfo) { var pipBuildRequest = new PipBuildRequest() { Sender = senderInfo, }; foreach (var i in message.Hashes) { var fileArtifactKeyedHash = new FileArtifactKeyedHash() { ContentHash = i.ContentHash.Data.ToByteString(), FileName = i.FileName ?? string.Empty, Length = i.Length, PathString = i.PathString ?? string.Empty, PathValue = i.PathValue, ReparsePointType = (FileArtifactKeyedHash.Types.GrpcReparsePointType)i.ReparsePointType, RewriteCount = i.RewriteCount, }; if (i.ReparsePointTarget != null) { fileArtifactKeyedHash.ReparsePointTarget = i.ReparsePointTarget; } if (i.AssociatedDirectories != null) { foreach (var j in i.AssociatedDirectories) { fileArtifactKeyedHash.AssociatedDirectories.Add(new GrpcDirectoryArtifact() { DirectoryPathValue = j.DirectoryPathValue, DirectorySealId = j.DirectorySealId, IsDirectorySharedOpaque = j.IsDirectorySharedOpaque, }); } } pipBuildRequest.Hashes.Add(fileArtifactKeyedHash); } foreach (var i in message.Pips) { var singlePipBuildRequest = new SinglePipBuildRequest() { ActivityId = i.ActivityId, ExpectedRamUsageMb = i.ExpectedRamUsageMb ?? 0, Fingerprint = i.Fingerprint.Data.ToByteString(), PipIdValue = i.PipIdValue, Priority = i.Priority, SequenceNumber = i.SequenceNumber, Step = i.Step }; pipBuildRequest.Pips.Add(singlePipBuildRequest); } return(pipBuildRequest); }
public void Test_SenderInfo_Validate() { // Arrange var sender = new SenderInfo(); // Act/Assert Assert.Throws <ArgumentException>(() => sender.Validate()); }
public CommandContainer(string commandName, List <string> arguments, List <IBotMediaFile> mediaFiles, SenderInfo senderInfo) { CommandName = commandName; Arguments = arguments; MediaFiles = mediaFiles; SenderInfo = senderInfo; }
override public void Execute() { accountMember1 = AccountMemberBuilder.NewAccountMember(email1) .WithFirstName("firstName1") .WithLastName("lastName1") .WithCompany("company1") .WithTitle("title1") .WithLanguage("language1") .WithPhoneNumber("phoneNumber1") .WithTimezoneId("GMT") .WithStatus(SenderStatus.ACTIVE) .Build(); accountMember2 = AccountMemberBuilder.NewAccountMember(email2) .WithFirstName("firstName2") .WithLastName("lastName2") .WithCompany("company2") .WithTitle("title2") .WithLanguage("language2") .WithPhoneNumber("phoneNumber2") .WithStatus(SenderStatus.ACTIVE) .Build(); accountMember3 = AccountMemberBuilder.NewAccountMember(email3) .WithFirstName("firstName3") .WithLastName("lastName3") .WithCompany("company3") .WithTitle("title3") .WithLanguage("language3") .WithPhoneNumber("phoneNumber3") .WithStatus(SenderStatus.ACTIVE) .Build(); Sender createdSender1 = eslClient.AccountService.InviteUser(accountMember1); Sender createdSender2 = eslClient.AccountService.InviteUser(accountMember2); Sender createdSender3 = eslClient.AccountService.InviteUser(accountMember3); retrievedSender1 = eslClient.AccountService.GetSender(createdSender1.Id); retrievedSender2 = eslClient.AccountService.GetSender(createdSender2.Id); retrievedSender3 = eslClient.AccountService.GetSender(createdSender3.Id); eslClient.AccountService.SendInvite(createdSender1.Id); eslClient.AccountService.DeleteSender(createdSender2.Id); updatedSenderInfo = SenderInfoBuilder.NewSenderInfo(email3) .WithName("updatedFirstName", "updatedLastName") .WithCompany("updatedCompany") .WithTitle("updatedTitle") .WithTimezoneId("Canada/Mountain") .Build(); eslClient.AccountService.UpdateSender(updatedSenderInfo, createdSender3.Id); retrievedUpdatedSender3 = eslClient.AccountService.GetSender(createdSender3.Id); // Get senders in account IDictionary <string, Sender> senders = eslClient.AccountService.GetSenders(Direction.ASCENDING, new PageRequest(1, 100)); }
/// <summary> /// Gets membership id /// </summary> /// <param name="senderInfo">Sender information</param> /// <returns>Collection of management system execution state keys</returns> public override string GetMembershipId(SenderInfo senderInfo) { if ((senderInfo == null) || (senderInfo.Principal == null) || (senderInfo.Principal.Identity == null)) { throw new ArgumentNullException("senderInfo"); } return(RbacSystem.Current.GetMembershipId(new RbacUser.RbacUserInfo(senderInfo.Principal.Identity))); }
private static SenderInfo CreatePartitionSender(double n, StreamOptions x, string id, PartitionSender sender) { var si = new SenderInfo() { PartitionId = id, }; si.Thread = new Thread(() => { Console.WriteLine($"Thread started to send to {id}, sending {n} events..."); var epoch = DateTime.UtcNow; var sessionId = Guid.NewGuid(); var deviceId = Guid.NewGuid(); EventDataBatch batch = null; while (n >= 0) { if (batch == null) { batch = sender.CreateBatch(new BatchOptions()); } var e = GenerateEvent(epoch, si.SendCount, sessionId, deviceId); if (!batch.TryAdd(e)) { // flush sender.SendAsync(batch).Wait(); batch = null; // and go to continue, because we need to resend the event that failed continue; } // looks like that went through, yay epoch = epoch.AddMilliseconds(x.Interval); Thread.Sleep(x.Pause); n--; si.SendCount++; } if (batch != null) { sender.SendAsync(batch).Wait(); } si.Event.Set(); }); si.Thread.Start(); return(si); }
public static void RemoveUnusedStreamInfo(List <string> streamNames) { //Remove any streams that will no longer need to be used - if the "Separate sender streams" item has been toggled, for example var senderKeysToRemove = GSA.SenderInfo.Keys.Where(k => !streamNames.Any(sn => sn.Equals(k, StringComparison.InvariantCultureIgnoreCase))).ToList(); foreach (var k in senderKeysToRemove) { SenderInfo.Remove(k); } }
public SyncWhenStartupStub(string name) { Name = name; _senderInfo = new SenderInfo { SyncInfo = new SyncInfo(), SyncWhenName = Name, SyncWhenType = typeof(ISyncWhenStartup) }; }
public SyncWhenWatchedStub(string name) { _name = name; _senderInfo = new SenderInfo { SyncInfo = new SyncInfo(), SyncWhenName = "TestWhenWatched", SyncWhenType = typeof(ISyncWhenStartup) }; }
/// <summary> /// Close GSA file. /// </summary> public static void Close() { if (!IsInit) { return; } gsaProxy.Close(); SenderInfo.Clear(); ReceiverInfo.Clear(); }
public void Send(IBotApiProvider apiProvider, SenderInfo sender) { if (MediaFile is IBotOnlineFile onlineFile) { apiProvider.SendOnlineMedia(onlineFile, Text, sender); } else { apiProvider.SendMedia(MediaFile, Text, sender); } }
public async Task <Result> SendTextMessageAsync(string text, SenderInfo sender) { Result result = CheckText(text); if (result.IsFailed) { return(result); } return(await SendTextAsync(text, sender)); }
/// <summary> /// Extracts sender and receiver streams associated with the account. /// </summary> /// <param name="emailAddress">User email address</param> /// <param name="serverAddress">Speckle server address</param> public static bool GetSpeckleClients(string emailAddress, string serverAddress) { SenderInfo.Clear(); ReceiverInfo.Clear(); try { string key = emailAddress + "&" + serverAddress.Replace(':', '&'); string res = gsaProxy.GetTopLevelSid(); if (res == "") { return(true); } List <string[]> sids = Regex.Matches(res, @"(?<={).*?(?=})").Cast <Match>() .Select(m => m.Value.Split(new char[] { ':' })) .Where(s => s.Length == 2) .ToList(); string[] senderList = sids.Where(s => s[0] == "SpeckleSender&" + key).FirstOrDefault(); string[] receiverList = sids.Where(s => s[0] == "SpeckleReceiver&" + key).FirstOrDefault(); if (senderList != null && !string.IsNullOrEmpty(senderList[1])) { string[] senders = senderList[1].Split(new char[] { '&' }); for (int i = 0; i < senders.Length; i += 3) { SenderInfo[senders[i]] = new Tuple <string, string>(senders[i + 1], senders[i + 2]); } } if (receiverList != null && !string.IsNullOrEmpty(receiverList[1])) { string[] receivers = receiverList[1].Split(new char[] { '&' }); for (int i = 0; i < receivers.Length; i += 2) { ReceiverInfo.Add(new Tuple <string, string>(receivers[i], receivers[i + 1])); } } return(true); } catch { // If fail to read, clear client SIDs SenderInfo.Clear(); ReceiverInfo.Clear(); return(SetSpeckleClients(emailAddress, serverAddress)); } }
public GrpcMasterClient(LoggingContext loggingContext, string buildId, string ipAddress, int port) { m_loggingContext = loggingContext; m_connectionManager = new ClientConnectionManager(m_loggingContext, ipAddress, port, buildId); m_client = new Master.MasterClient(m_connectionManager.Channel); m_senderInfo = new SenderInfo() { BuildId = buildId, SenderName = DistributionHelpers.MachineName, SenderId = Guid.NewGuid().ToString() }; }
public GrpcWorkerClient(LoggingContext loggingContext, string buildId, string ipAddress, int port) { m_loggingContext = loggingContext; m_connectionManager = new ClientConnectionManager(loggingContext, ipAddress, port); m_client = new Worker.WorkerClient(m_connectionManager.Channel); m_senderInfo = new SenderInfo() { BuildId = buildId, SenderName = MachineName, SenderId = Guid.NewGuid().ToString() }; }
public void SendTestMessage(SenderInfo info, string email) { if (!string.IsNullOrEmpty(email)) { MailMessage mail = new MailMessage(); mail.To.Add(new MailAddress(email)); mail.Subject = $"Wiadomość testowa z {App.Name}"; mail.Body = "Test skrzynki nadawczej pomyślny"; ISender mailSender = new Sender(); mailSender.Send(info, mail); } }
/// <summary> /// Authorize a user. /// </summary> /// <param name="senderInfo">Sender information</param> /// <param name="userQuota">User quota value</param> /// <returns>User context in which to execute PowerShell cmdlet</returns> public override WindowsIdentity AuthorizeUser(SenderInfo senderInfo, out UserQuota userQuota) { var maxConcurrentRequests = ConfigurationManager.AppSettings["MaxConcurrentRequests"]; var maxRequestsPerTimeslot = ConfigurationManager.AppSettings["MaxRequestsPerTimeslot"]; var timeslotSize = ConfigurationManager.AppSettings["TimeslotSize"]; userQuota = new UserQuota( maxConcurrentRequests != null ? int.Parse(maxConcurrentRequests, CultureInfo.CurrentUICulture) : DefaultMaxConcurrentRequests, maxRequestsPerTimeslot != null ? int.Parse(maxRequestsPerTimeslot, CultureInfo.CurrentUICulture) : DefaultMaxRequestsPerTimeslot, timeslotSize != null ? int.Parse(timeslotSize, CultureInfo.CurrentUICulture) : DefaultTimeslotSize); return(WindowsIdentity.GetCurrent()); }
public void DefaultBuildCase() { SenderInfo senderInfo = SenderInfoBuilder.NewSenderInfo("*****@*****.**") .WithName("firstName", "lastName") .WithCompany("company") .WithTitle("title") .Build(); Assert.IsNotNull(senderInfo); Assert.AreEqual("firstName", senderInfo.FirstName); Assert.AreEqual("lastName", senderInfo.LastName); Assert.AreEqual("company", senderInfo.Company); Assert.AreEqual("title", senderInfo.Title); }
internal PackageBuilder (Silanis.ESL.API.Package package) { this.id = new PackageId( package.Id ); this.packageName = package.Name; this.autocomplete = package.Autocomplete; this.description = package.Description; this.expiryDate = package.Due; this.status = ConvertPackageStatus(package.Status); this.emailMessage = package.EmailMessage; this.settings = new DocumentPackageSettingsBuilder(package.Settings).build(); this.senderInfo = new SenderConverter(package.Sender).ToSDKSenderInfo(); this.attributes = new DocumentPackageAttributes(package.Data); foreach ( Silanis.ESL.API.Role role in package.Roles ) { if ( role.Signers.Count == 0 ) { continue; } if (role.Signers[0].Group != null) { WithSigner(SignerBuilder.NewSignerFromGroup(new GroupId(role.Signers[0].Group.Id))); } else { WithSigner(SignerBuilder.NewSignerFromAPISigner(role).Build()); if (role.Type == Silanis.ESL.API.RoleType.SENDER) { Silanis.ESL.API.Signer senderSigner = role.Signers[0]; WithSenderInfo( SenderInfoBuilder.NewSenderInfo(senderSigner.Email) .WithName(senderSigner.FirstName, senderSigner.LastName) .WithCompany(senderSigner.Company) .WithTitle(senderSigner.Title)); } } } foreach ( Silanis.ESL.API.Document apiDocument in package.Documents ) { Document document = DocumentBuilder.NewDocumentFromAPIDocument( apiDocument, package ).Build(); WithDocument( document ); } }
public void Start() { var fsSyncInfo = (FsSyncInfo)SyncInfo; if (fsSyncInfo.ScheduleInterval <= 0) throw new Exception("The timer interval has not been set correctly"); _senderInfo = new SenderInfo { SyncInfo = SyncInfo, SyncWhenName = Name, SyncWhenType = typeof(ISyncWhenScheduled) }; _timer.Interval = fsSyncInfo.ScheduleInterval; _timer.Start(); }
public PackageBuilder WithSenderInfo( SenderInfo senderInfo ) { this.senderInfo = senderInfo; return this; }
private void button4_Click(object sender, EventArgs e) { MessageInfo msg = new MessageInfo(); SenderInfo send = new SenderInfo(); send.MachineCode = "cpu"; send.ProgramName = "��У�������"; send.Version = "5.0.0.6"; OrgInfo org=new OrgInfo(); org.FullName = "����̩�����ʹɷ�����У"; org.NickName = "̩����У"; org.Telephone = "tel"; org.Url = "url"; msg.ObjectType = (typeof(Fm.Driver.StudentInfo)).ToString(); msg.Version = "1.0"; msg.Sender = send; msg.Org = org; msg.Data = "data"; this.textBox1.Text = SerializeHelper.SerializeToXml(msg); }
private void writeToLog(string message, SenderInfo senderInfo, MessageType messageType) { if (bRestrict) return; if (!isInitialized) { writeToLoggerLog("Логгер не проинициализирован"); return; } try { string pathToDir = String.Format(workDirectory + "\\{0}", DateTime.Now.Date.ToShortDateString().Replace(".", "_")); Directory.CreateDirectory(pathToDir); string logFileName = String.Format("\\{0}_a{1}_{2}_ms.log", senderInfo.port.Trim(), senderInfo.addr.Trim(), senderInfo.driverName.Trim()); fs = new FileStream(pathToDir + logFileName, FileMode.Append, FileAccess.Write, FileShare.ReadWrite); string resMsg = String.Format("{1} [{0}]: {2}", messageType.ToString(), DateTime.Now.ToString(), message); sw = new StreamWriter(fs, Encoding.Default); sw.WriteLine(resMsg); sw.Close(); fs.Close(); } catch (Exception lEx) { writeToLoggerLog(lEx.Message); } finally { if (sw != null) { sw.Close(); sw = null; } if (fs != null) { fs.Close(); fs = null; } } }
public void Initialize(string port, string addr, string driverName, string workDirName = "") { if (workDirName != String.Empty) workDirectory = baseDirectory + "\\" + workDirName; else workDirectory = baseDirectory; si = new SenderInfo(port, addr, driverName); Directory.CreateDirectory(workDirectory); isInitialized = true; }
public void Start() { if (string.IsNullOrEmpty(Name)) throw new NullReferenceException("The Name property has not been set correctly"); if (string.IsNullOrEmpty(SyncInfo?.Source) || string.IsNullOrEmpty(SyncInfo.Target)) throw new SyncInfoIsNotCorrectlySet(SyncInfo); _senderInfo = new SenderInfo { SyncInfo = SyncInfo, SyncWhenName = Name, SyncWhenType = typeof(ISyncWhenWatched) }; if (!_isActive) _fileSystemWatcher.Start(SyncInfo.Source); _isActive = true; }
public void UpdateSender(SenderInfo senderInfo, string senderId) { Silanis.ESL.API.Sender apiSender = new SenderConverter(senderInfo).ToAPISender(); apiSender.Id = senderId; apiClient.UpdateSender(apiSender, senderId); }