protected virtual IDTSPath100 ProcessBinding(SsisEmitterContext context, Binding binding) { if (binding != null) { try { IDTSPath100 path = Dataflow.MainPipe.PathCollection.New(); object index = binding.ParentOutputName ?? 0; path.AttachPathAndPropagateNotifications( Dataflow.MainPipe.ComponentMetaDataCollection[binding.ParentTransformName].OutputCollection[index], Component.InputCollection[binding.TargetInputName]); // Shove in annotation for the path reference! :) context.Package.DtsPackage.ExtendedProperties.Add(Dataflow.DtsTaskHost.ID + "-" + path.ID, "dts-designer-1.0", Properties.Resources.DTSDesignerPathAnnotation); ProcessBindingMappings(context, binding as MappedBinding, path); return(path); } catch (System.Runtime.InteropServices.COMException e) { MessageEngine.Trace(_astTransformationNode, Severity.Error, "V0210", GetScrubbedErrorDescription(e.ErrorCode)); throw; } } return(null); }
protected virtual IDTSPath100 ProcessAutoLexicalBinding(SsisEmitterContext context) { // TODO: Add handling for the exception below try { int lastObject = Dataflow.MainPipe.ComponentMetaDataCollection.GetObjectIndexByID(Dataflow.MainPipe.ComponentMetaDataCollection[Name].ID) - 1; if (lastObject >= 0) { IDTSPath100 path = Dataflow.MainPipe.PathCollection.New(); path.AttachPathAndPropagateNotifications(Dataflow.MainPipe.ComponentMetaDataCollection[lastObject].OutputCollection[0], Component.InputCollection[0]); // Shove in annotation for the path reference! :) context.Package.DtsPackage.ExtendedProperties.Add(Dataflow.DtsTaskHost.ID + "-" + path.ID, "dts-designer-1.0", Properties.Resources.DTSDesignerPathAnnotation); return(path); } } catch (Exception e) { MessageEngine.Trace(this._astTransformationNode, Severity.Error, "TF101", "Error binding AST Data Flow Transformation. This is probably due to having two Transformations with the same name. Please contact support.\n{0}", e.ToString()); } return(null); }
public static async Task <string> HttpGet(string url) { var result = ""; try { using (HttpClient client = new HttpClient()) { client.DefaultRequestHeaders.Clear(); client.DefaultRequestHeaders.Add("Authorization", "Basic aGVsbGRlbW9uczpfUEBzc3cwcmRz"); using (HttpResponseMessage response = await client.GetAsync(url)) using (HttpContent content = response.Content) { result = MessageEngine.GetHTTPStatusCodes(response.StatusCode.ToString(), ConfigEngine.Language); if (string.IsNullOrEmpty(result)) { result = await content.ReadAsStringAsync(); } } } } catch (Exception ex) { if (ex.InnerException.Message.ToLower().Contains("unable to connect to the remote server")) { logger.Error(ex); } logger.Error(ex); result = MessageEngine.GetHTTPStatusCodes("InternalServerError", ConfigEngine.Language); } return(result); }
public SSIS2008EmitterPhase(string WorkflowUniqueName) { this._workflowUniqueName = WorkflowUniqueName; _guid = Guid.NewGuid(); _message = MessageEngine.Create(String.Format(System.Globalization.CultureInfo.InvariantCulture, "SSISFactory: {0}", _guid.ToString())); _pluginLoader = new PluginLoader <ISSISEmitter, PhysicalIRMappingAttribute>(null, 1, 1); }
public static void ValidateScdTable(AstTableNode table) { // TODO: Can we use identity or primary (or just primary) // TODO: Need to add check - For implicit invocation, the destination can not be an OLEDB destination. A compile-time error will be emitted if so. bool hasIdentity = table.Keys.Any(item => item is AstTableIdentityNode); bool hasPrimaryKey = table.Keys.Any(item => item is AstTablePrimaryKeyNode); if (!(hasIdentity ^ hasPrimaryKey)) { MessageEngine.Trace(table, Severity.Error, "V0133", "To support Scd Columns, table {0} must provide either identity or primary key", table.Name); } // TODO: Should we be overwriting these? And do we need to recheck the table for Scd columns after rewriting? foreach (var keyColumn in table.PreferredKey.Columns) { keyColumn.Column.ScdType = ScdType.Key; } foreach (AstTableColumnBaseNode column in table.Columns) { if (column.IsAssignable && column.ScdType == ScdType.Update && !column.IsNullable && String.IsNullOrEmpty(column.Default)) { MessageEngine.Trace(table, Severity.Error, "V0134", "Non-nullable ScdType.Update columns in table {0} with Error or Historical columns must have default values. Provide a default value for column {1}", table.Name, column.Name); } } }
public static void ValidateEtlFragment(AstEtlFragmentNode etlFragment) { var graph = new TransformationGraph(etlFragment.Transformations); AstTransformationNode root = null; foreach (var rootNode in graph.RootNodes) { if (!(rootNode.Item is AstSourceTransformationNode)) { if (root != null) { MessageEngine.Trace(etlFragment, Severity.Error, "V0120", "Etl Fragments cannot have more than one root node with InputPaths"); } root = rootNode.Item; } } AstTransformationNode leaf = null; foreach (var leafNode in graph.LeafNodes) { if (!(leafNode.Item is AstDestinationNode)) { if (leaf != null) { MessageEngine.Trace(etlFragment, Severity.Error, "V0121", "Etl Fragments cannot have more than one leaf node with OutputPaths"); } leaf = leafNode.Item; } } }
public static void ValidateLateArrivingTable(AstTableNode table) { bool hasIdentity = table.Keys.Any(item => item is AstTableIdentityNode); bool hasPrimaryKey = table.Keys.Any(item => item is AstTablePrimaryKeyNode); if (!hasIdentity ^ hasPrimaryKey) { MessageEngine.Trace(table, Severity.Error, "V0130", "To support Late Arriving, table {0} must provide either identity or primary key", table.Name); } bool foundEligibleKey = false; foreach (AstTableKeyBaseNode key in table.Keys) { if (key.Columns.Any(keyColumn => !keyColumn.Column.IsComputed)) { if (foundEligibleKey) { MessageEngine.Trace(table, Severity.Error, "V0131", "There can be at most one (primary, identity, unique) key that is based on non-computed columns for Late Arriving Table {0}", table.Name); } foundEligibleKey = true; } } foreach (AstTableColumnBaseNode column in table.Columns) { if (!column.IsNullable && String.IsNullOrEmpty(column.Default)) { MessageEngine.Trace(table, Severity.Error, "V0132", "Late Arriving Table {0} must have default values for all columns that are non-nullable.", table.Name); } } }
public static void ValidateEtlFragmentReference(AstEtlFragmentReferenceNode fragmentReference) { if (fragmentReference.Inputs.Count != fragmentReference.EtlFragment.Inputs.Count) { MessageEngine.Trace(fragmentReference, Severity.Error, "V0124", "The fragment reference input mapping count does not match the exposed input count of the fragment."); } if (fragmentReference.Outputs.Count != fragmentReference.EtlFragment.Outputs.Count) { MessageEngine.Trace(fragmentReference, Severity.Error, "V0125", "The fragment reference output mapping count does not match the exposed output count of the fragment."); } foreach (var input in fragmentReference.Inputs) { if (!fragmentReference.EtlFragment.Inputs.Any(decl => decl.PathColumnName.Equals(input.DestinationPathColumnName))) { MessageEngine.Trace(fragmentReference, Severity.Error, "V0126", "The fragment reference input column mapping with source {0} did not match the exposed input columns in the fragment.", input.SourcePathColumnName); } } foreach (var output in fragmentReference.Outputs) { if (!fragmentReference.EtlFragment.Outputs.Any(decl => decl.PathColumnName.Equals(output.SourcePathColumnName))) { MessageEngine.Trace(fragmentReference, Severity.Error, "V0127", "A fragment reference output column mapping with destination {0} did not match the exposed output columns in the fragment.", output.DestinationPathColumnName); } } }
public static void ValidateLateArrivingLookup(AstLateArrivingLookupNode lookup) { if (!lookup.Table.LateArriving) { MessageEngine.Trace(lookup, Severity.Error, "V0128", "Table {0} is not designated for Late Arriving Lookup. Set LateArriving = true.", lookup.Table.Name); } AstTableKeyBaseNode eligibleKey = null; foreach (AstTableKeyBaseNode key in lookup.Table.Keys) { if (key.Columns.Any(keyColumn => !keyColumn.Column.IsComputed)) { eligibleKey = key; break; // Safe to do since we already verified single eligble key in the table processing pass } } if (eligibleKey == null) { MessageEngine.Trace(lookup, Severity.Error, "V0129", "Late Arriving Table {0} must specify an eligible key.", lookup.Table.Name); } // TODO: Finish checking this logic foreach (AstTableKeyColumnNode eligibleKeyColumn in eligibleKey.Columns) { if (!lookup.Inputs.Any(io => io.RemoteColumnName == eligibleKeyColumn.Column.Name)) { MessageEngine.Trace(lookup, Severity.Error, "V0123", "Late Arriving Lookup {0} must specify inputs for every column of constraint: {1}", lookup.Name, eligibleKey.Name); } } }
public void ValidateXDocuments() { foreach (BimlFile bimlFile in BimlFiles) { _currentBimlFile = bimlFile; if (bimlFile.XDocument == null) { try { XDocument.Load(new StringReader(bimlFile.Text), LoadOptions.SetLineInfo | LoadOptions.PreserveWhitespace); } catch (XmlException e) { MessageEngine.Trace(bimlFile.FilePath, e.LineNumber, e.LinePosition, Severity.Error, "V0150", e, e.Message); } } else { bimlFile.XDocument.Validate(SchemaSet, ValidationEventHandler, false); } } IsValidated = true; Id = Guid.NewGuid(); }
public override void Emit(SsisEmitterContext context) { context.Package.DtsPackage.EnableConfigurations = true; string packageRoot = String.IsNullOrEmpty(PackageConfigurationPath) ? Settings.Default.DetegoPackageConfigurationRoot : PackageConfigurationPath; string configFilePath = StringManipulation.CleanPath(packageRoot + Path.DirectorySeparatorChar + Name + "." + Resources.ExtensionDtsConfigurationFile); MessageEngine.Trace(Severity.Debug, "Adding Configuration File {0}", configFilePath); if (!context.Package.DtsPackage.Configurations.Contains(Name)) { DTS.Configuration config = context.Package.DtsPackage.Configurations.Add(); config.ConfigurationType = DTS.DTSConfigurationType.ConfigFile; config.Name = Name; config.Description = Name; config.ConfigurationString = configFilePath; context.Package.DtsPackage.ImportConfigurationFile(configFilePath); } }
public void ProcessFile(object fileObject, Func <bool> isCanceled) { if (fileObject == null) { throw new ArgumentNullException("fileObject"); } var file = fileObject as ApkFile; if (file == null) { throw new Exception(string.Format("{0} can not handle object of type {1}", GetType().Name, fileObject.GetType().Name)); } if (!FolderUtility.Empty(file.ResourceFolder)) { return; } MessageEngine.AddInformation(this, string.Format("Extracting content png files from {0}", file.Name)); using (var zf = new ZipFile(file.FileSystemPath)) { zf.Extract( zf.Entries.Where( x => x.Name.EndsWith(".PNG", StringComparison.OrdinalIgnoreCase) && !x.Name.EndsWith(".9.PNG", StringComparison.OrdinalIgnoreCase)), file.ResourceFolder, true); } }
public void ProcessFile(object fileObject, Func <bool> isCanceled) { if (fileObject == null) { throw new ArgumentNullException("fileObject"); } var file = fileObject as ApkFile; if (file == null) { throw new Exception(string.Format("{0} can not handle object of type {1}", GetType().Name, fileObject.GetType().Name)); } if (FolderUtility.Empty(file.ResourceFolder)) { return; } MessageEngine.AddInformation(this, string.Format("Updating {0} with optimized png files", file.Name)); using (var zf = new AndroidArchive(file.FileSystemPath)) { foreach (string pngFile in file.GetPngFilesToOptimize()) { zf.Add(pngFile, FolderUtility.GetRelativePath(file.ResourceFolder, pngFile), CompressionType.Store); } } }
public static void LowerPackage(AstNode astNode, LoweringContext context) { var astPackage = astNode as AstTask.AstPackageNode; if (astPackage != null) { if (astPackage.Emit) { var p = new Package(astPackage); context.ParentObject.Children.Add(p); context = new TaskLoweringContext(p); LowerConnection(astPackage.LogConnection, context); LowerChildren(astPackage, context); LowerEventHandlers(astPackage, p, context); } else { MessageEngine.Trace( astPackage, Severity.Debug, "D_S008", "Skipped Lowering of Package {0} because Emit was {1}", astPackage.Name, astPackage.Emit); } } }
public static async Task <string> HttpPost(string url, string json_data) { var result = ""; try { using (HttpClient client = new HttpClient()) { client.DefaultRequestHeaders.Clear(); client.DefaultRequestHeaders.Add("Authorization", "Basic aGVsbGRlbW9uczpfUEBzc3cwcmRz"); using (HttpResponseMessage response = await client.PostAsync(url, new StringContent(json_data, Encoding.UTF8, "application/json"))) using (HttpContent content = response.Content) { result = await content.ReadAsStringAsync(); } } } catch (Exception ex) { logger.Error(ex); result = MessageEngine.GetHTTPStatusCodes("InternalServerError", ConfigEngine.Language); } return(result); }
public override void Emit(SsisEmitterContext context) { try { _forLoop = (DTS.ForLoop)context.ParentContainer.AppendExecutable(Moniker); context.ParentContainer.ProcessTaskBinding(this); _forLoop.Name = Name; _forLoop.TransactionOption = (DTSTransactionOption)Enum.Parse(typeof(DTSTransactionOption), TransactionMode); _forLoop.AssignExpression = _countingExpression; _forLoop.EvalExpression = _loopTestExpression; _forLoop.InitExpression = _initializerExpression; base.Emit(context); } catch (DtsException e) { if (e.ErrorCode == -1073659647) { MessageEngine.Trace(AstNamedNode, Severity.Error, "V1050", "Attempted to reuse the name '{0}' within an SSIS package, which is illegal. Use a unique name.", Name); } else { throw; } } }
private void ValidationEventHandler(object sender, ValidationEventArgs e) { var xmlLineInfo = sender as IXmlLineInfo; string line = "?"; string offset = "?"; if (xmlLineInfo != null) { line = xmlLineInfo.LineNumber.ToString(CultureInfo.InvariantCulture); offset = xmlLineInfo.LinePosition.ToString(CultureInfo.InvariantCulture); } string fileName = _currentBimlFile.Name; switch (e.Severity) { case XmlSeverityType.Error: MessageEngine.Trace(Severity.Error, "{0}({1},{2}): error V0102: {3}", fileName, line, offset, e.Message); break; case XmlSeverityType.Warning: MessageEngine.Trace(Severity.Warning, "{0}({1},{2}): warning V0102: {3}", fileName, line, offset, e.Message); break; } }
private void MenuMainFileSaveSelectedAsClick(object sender, EventArgs e) { try { Cursor = Cursors.WaitCursor; var selectedFile = solutionExplorer.SelectedFiles.FirstOrDefault(); if (selectedFile == null) { return; } SaveFileDialog ofd = FileUtility.CreateSaveFileDlg(selectedFile.FileSystemPath, "All files (*.*)|*.*"); if (ofd.ShowDialog(this) == DialogResult.OK) { selectedFile.SaveAs(ofd.FileName); } } catch (Exception ex) { MessageEngine.ShowError(ex); } finally { Cursor = Cursors.Default; } }
public override void Emit(SsisEmitterContext context) { DtsContainer.IsolationLevel = ContainerIsolationLevel; DtsContainer.DelayValidation = DelayValidation; context = new SsisEmitterContext(context.Package, this, context.ProjectManager); foreach (PhysicalObject po in this.Children) { try { po.Initialize(context); po.Emit(context); } catch (DTS.DtsException e) { if (e.ErrorCode == -1073659647) { MessageEngine.Trace(AstNamedNode, Severity.Error, "V1050", "Attempted to reuse the name '{0}' within an SSIS package, which is illegal. Use a unique name.\nContainer: {1}\nTask: {0}", po.Name, this.Name); } else { throw; } } } }
private void OnLoaded() { if (InvokeRequired) { BeginInvoke(new Action(OnLoaded)); return; } try { Cursor = Cursors.WaitCursor; var extension = (Path.GetExtension(_fileSystemPath) ?? "").ToUpperInvariant(); if (extension == ".RSSLN") { OpenSolution(_fileSystemPath); } else if (extension == ".RSPROJ") { bool solutionFound = false; var fi = new FileInfo(_fileSystemPath); var paths = new List <string>(); paths.Add(fi.Directory.FullName); if (fi.Directory.Parent != null) { paths.Add(fi.Directory.Parent.FullName); } foreach (var path in paths) { foreach (var solution in Directory.GetFiles(path, "*.rssln")) { if (CrcsSolution.SolutionContainsProject(solution, _fileSystemPath)) { OpenSolution(solution); solutionFound = true; } } } if (!solutionFound) { var file = _fileSystemPath.Substring(0, _fileSystemPath.Length - 6) + "rssln"; _solution = CrcsSolution.CreateSolution(file); _solution.AddProject(CrcsProject.OpenProject(_fileSystemPath, _solution)); solutionExplorer.SetSolution(_solution); solutionExplorer.Refresh(); } } else { OpenFile(_fileSystemPath); } } catch (Exception ex) { MessageEngine.ShowError(ex); } finally { Cursor = Cursors.Default; } }
public ItkDispatcherController(MessageEngine itkDispatcher, IItkDispatchResponseBuilder itkDispatchResponseBuilder, IMessageService messageService, IPatientReferenceService patientReferenceService, ILog logger) { _itkDispatcher = itkDispatcher; _itkDispatchResponseBuilder = itkDispatchResponseBuilder; _messageService = messageService; _patientReferenceService = patientReferenceService; _logger = logger; }
public SsisProject(string projectPath) { MessageEngine.Trace(Severity.Debug, "Project Manager: Created Project {0}", projectPath); _packages = new Collection <Package>(); _miscFiles = new Collection <string>(); _projectXmlDocument = new XmlDocument(); _projectPath = projectPath; }
public IIR Execute(IIR predecessorIR) { var xmlIR = predecessorIR as XmlIR; if (xmlIR == null) { MessageEngine.Trace(Severity.Error, Resources.ErrorPhaseWorkflowIncorrectInputIRType, predecessorIR.GetType().ToString(), Name); } var xsltFileList = new List <string>(); string xsltFolderPath = PathManager.GetToolSubpath(Settings.Default.SubPathXsltTransformFolder); foreach (string xsltFile in _xsltFiles.Split(';')) { if (!String.IsNullOrEmpty(xsltFile)) { xsltFileList.Add(Path.Combine(xsltFolderPath, xsltFile)); } } var settings = new XsltSettings(true, false); var output = new XmlIR(); // REVIEW: The approach I take here is to pipeline XSLT transforms using a MemoryStream. This isn't great. // In the next .NET Fx, they are expecting to fix XslCompiledTransform so it can pipeline more resonably. This should be changed at that time. foreach (BimlFile bimlFile in xmlIR.BimlFiles) { XDocument document = bimlFile.XDocument; var intermediateXmlDocument = new XmlDocument(); intermediateXmlDocument.Load(document.CreateReader()); if (!String.IsNullOrEmpty(xmlIR.TemplatePath)) { foreach (string s in xsltFileList) { var xslt = new XslCompiledTransform(); var args = new XsltArgumentList(); args.AddParam("TemplatePath", String.Empty, xmlIR.TemplatePath); xslt.Load(s, settings, new XmlUrlResolver()); var intermediateMemoryStream = new MemoryStream(); xslt.Transform(intermediateXmlDocument, args, intermediateMemoryStream); intermediateMemoryStream.Position = 0; intermediateXmlDocument = new XmlDocument(); intermediateXmlDocument.Load(intermediateMemoryStream); } } output.AddXml(bimlFile.FilePath, intermediateXmlDocument, bimlFile.EmitType, true); } output.SchemaSet = xmlIR.SchemaSet; output.DefaultXmlNamespace = xmlIR.DefaultXmlNamespace; return(output); }
public int LoadSampleMessage( int?folderId, uint?userFolderId, int?mailboxId, bool unread, Stream emlStream, bool add2Index = false) { var folder = folderId.HasValue ? (FolderType)folderId.Value : FolderType.Inbox; if (!MailFolder.IsIdOk(folder)) { throw new ArgumentException(@"Invalid folder id", "folderId"); } if (!mailboxId.HasValue) { throw new ArgumentException(@"Invalid mailbox id", "mailboxId"); } var accounts = _engineFactory.AccountEngine.GetAccountInfoList().ToAccountData().ToList(); var account = mailboxId.HasValue ? accounts.FirstOrDefault(a => a.MailboxId == mailboxId) : accounts.FirstOrDefault(a => a.IsDefault) ?? accounts.FirstOrDefault(); if (account == null) { throw new ArgumentException("Mailbox not found"); } var mbox = _engineFactory.MailboxEngine.GetMailboxData( new СoncreteUserMailboxExp(account.MailboxId, TenantId, Username)); if (mbox == null) { throw new ArgumentException("no such mailbox"); } var mimeMessage = MailClient.ParseMimeMessage(emlStream); var message = MessageEngine.Save(mbox, mimeMessage, SAMPLE_UIDL, new MailFolder(folder, ""), userFolderId, unread, Log); if (message == null) { return(-1); } if (!add2Index) { return(message.Id); } _engineFactory.IndexEngine.Add(message.ToMailWrapper(mbox.TenantId, new Guid(mbox.UserId))); return(message.Id); }
public static CrcsSolution CreateSolution(string fileSystemPath) { var solution = new CrcsSolution(fileSystemPath); MessageEngine.AddDebug(solution, "Solution created: " + fileSystemPath); solution.Properties.UpdateZipName = solution.FileNameWithoutExtension; solution._initialized = true; return(solution); }
public PhaseWorkflow(string Name) { this._Name = Name; this._PhaseWorkflow = new List <PhaseExecutionHost>(); this._PhaseExecutionHostsByWorkflowUniqueName = new Dictionary <string, PhaseExecutionHost>(); this._PhaseExecutionStatusByWorkflowUniqueName = new Dictionary <string, bool>(); this.Message = MessageEngine.Create(String.Format("__PHASE WORKFLOW: {0}", Name)); }
protected XmlIR(XmlIR xmlIR) { this._isValidated = xmlIR._isValidated; this._documents = xmlIR._documents; this._xmlSchemaSet = xmlIR._xmlSchemaSet; this._id = xmlIR._id; this._message = xmlIR._message; this._documentsLoaded = xmlIR._documentsLoaded; }
protected override void OnClosed(EventArgs e) { _settings.Bounds = WindowState == FormWindowState.Normal ? Bounds : RestoreBounds; _settings.WindowState = WindowState; CrcsSettings.SaveSettingsFile(_settings); Settings.Default.Save(); base.OnClosed(e); MessageEngine.DetachConsumer(outputWindow); }
public SsisPipelineTask(PipelineTask objETL, SSISEmitterContext context) : base(objETL, context) { _logicalETL = objETL; _guid = Guid.NewGuid(); // TODO: Do this for everything _message = MessageEngine.Create(String.Format(System.Globalization.CultureInfo.InvariantCulture, "__SSIS2008Emitter:SSISDataFlow {0}", _guid.ToString())); _componentList = new List <SsisComponent>(); }
public static IEnumerable <AstPackageNode> ProcessTableStaticSource(AstTableNode astTableNode) { var packageList = new List <AstPackageNode>(); foreach (var source in astTableNode.Sources) { var staticSource = source as AstTableStaticSourceNode; if (staticSource != null && staticSource.Rows.Count > 0) { var table = staticSource.ParentItem as AstTableNode; if (table != null && staticSource.EmitMergePackage) { if (table.PreferredKey == null) { MessageEngine.Trace(table, Severity.Error, "L0110", "Table {0} does not contain a primary key and therefore cannot use Static Source Merging. Add a primary key or set EmitMergePackage to false.", table.Name); } var package = new AstPackageNode(table.ParentItem) { Emit = table.Emit, Log = false, Name = staticSource.Name, PackageFolderSubpath = table.Name, PackageType = GetPackageType(table) }; // Staging Container var staging = new AstStagingContainerTaskNode(package) { Log = false, Name = Utility.NameCleanerAndUniqifier(source.Name + "_Stg"), }; var stagingCloneTable = new AstTableCloneNode(staging) { Name = String.Format(CultureInfo.InvariantCulture, "__{0}_Static", table.Name), Connection = table.Connection, Table = table }; staging.Tables.Add(stagingCloneTable); CloneTableLowerer.LowerCloneTable(stagingCloneTable); staging.Tasks.Add(CreateInsertExecuteSql(staticSource, staging, stagingCloneTable)); staging.Tasks.Add(CreateMergeTask(table, staging, stagingCloneTable)); package.Tasks.Add(staging); packageList.Add(package); staticSource.LoweredPackage = package; } } } return(packageList); }
// Unity // -------------------------------------------------------------------------- private void Awake () { if( instance == null ) { instance = this; } else if( instance != this ) { Destroy(gameObject); } DontDestroyOnLoad(gameObject); // Find the correct camera size depending on the size of the screen // ------------------------------------------------------------------------ Vector2 targetViewport = new Vector2(320, 480); float percentageX = Screen.width/targetViewport.x; float percentageY = Screen.height/targetViewport.y; float targetSize = 0.0f; if( percentageX > percentageY ) { targetSize = percentageY; } else { targetSize = percentageX; } int floored = Mathf.FloorToInt(targetSize); if(floored < 1) { floored = 1; } // Set the camera size and position and find the maxDimension of the map // ------------------------------------------------------------------------ Camera.main.orthographicSize = ((Screen.height/2)/floored)/size; maxDimension = new Vector2(((2f * Camera.main.orthographicSize) * Camera.main.aspect), (2f * Camera.main.orthographicSize)); maxDimension.x = Mathf.Ceil(maxDimension.x); maxDimension.y = Mathf.Ceil(maxDimension.y); Camera.main.transform.position = new Vector3( (maxDimension.x/2)-0.5f, (maxDimension.y/2)-0.5f, -10 ); // Load externals data from XML // ------------------------------------------------------------------------ TableMaster.Instance().Load("loots"); EnemyMaster.Instance().Load("enemies"); ItemMaster.Instance().Load("items"); // Gentleman, starts your engine // ------------------------------------------------------------------------ mapEngine = GetComponent<MapEngine>(); turnEngine = GetComponent<TurnEngine>(); popupEngine = GetComponent<PopupEngine>(); messageEngine = GetComponent<MessageEngine>(); }