// If your activity returns a value, derive from CodeActivity<TResult> // and return the value from the Execute method. protected override void Execute(CodeActivityContext context) { PropertyDescriptorCollection propertyDescriptorCol = context.DataContext.GetProperties(); foreach (PropertyDescriptor pd in propertyDescriptorCol) { if (string.Equals(pd.Name, Singleton <Constants> .UniqueInstance.FileVariableName)) { try { NetworkCredential networkCredential = new NetworkCredential(Singleton <Constants> .UniqueInstance.UserName, Singleton <Constants> .UniqueInstance.PassWord, Singleton <Constants> .UniqueInstance.Domain); string sharePath = string.Format(@"\\{0}\c$", Singleton <Constants> .UniqueInstance.MachineName); //Singleton<Constants>.UniqueInstance.GacEssentialsPath.Substring(0, Singleton<Constants>.UniqueInstance.GacEssentialsPath.IndexOf(@"c$\Windows") + @"c$\Windows".Length); using (NetworkConnection nc = new NetworkConnection(sharePath, networkCredential)) { FileItem[] fileItems = (FileItem[])pd.GetValue(context.DataContext); foreach (FileItem fileItem in fileItems) { ReplaceFileHelper.ReplaceFile(fileItem); } } } catch (Exception e) { string msg = string.Format("exception encounterred: {0} when executing replacefilesactivity", e); Singleton <ReportMediator> .UniqueInstance.ReportStatus(msg, LogLevel.Warning); } } } // Obtain the runtime value of the Text input argument string text = context.GetValue(this.Text); }
// If your activity returns a value, derive from CodeActivity<TResult> // and return the value from the Execute method. protected override void Execute(CodeActivityContext context) { PropertyDescriptorCollection propertyDescriptorCol = context.DataContext.GetProperties(); foreach (PropertyDescriptor pd in propertyDescriptorCol) { if (string.Equals(pd.Name, Singleton <Constants> .UniqueInstance.FileVariableName)) { FileItem[] files = (FileItem[])pd.GetValue(context.DataContext); foreach (FileItem file in files) { ReplaceFileHelper.TakeOwnership(file); } } } // Obtain the runtime value of the Text input argument string text = context.GetValue(this.Text); }