Esempio n. 1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="GoldAddin.RenameProvider"/> class.
 /// </summary>
 /// <param name="text">The document text</param>
 /// <param name="documentPosition">Position within the text</param>
 public RenameProvider(string text, int documentPosition)
 {
     textSegmentList = new List<TextSegment> ();
     primarySegment = new TextSegment ();
     symbolType = DefinitionType.None;
     if (!string.IsNullOrEmpty (text))
     {
         findSegmentsForRenaming (text, documentPosition);
     }
 }
Esempio n. 2
0
 static string getDescriptionOfSymbol(DefinitionType symbolType)
 {
     switch (symbolType)
     {
     case DefinitionType.NonTerminal:
         return "Non-Terminal";
     case DefinitionType.SetName:
         return "Character Set";
     case DefinitionType.Terminal:
         return "Terminal";
     default:
         return string.Empty;
     }
 }
 public void AddLink <T>(T entity, DefinitionType definitionType = DefinitionType.Rule) where T : RuleEntity//, new()
 {
     if (entity is CommonRule)
     {
         CommonRuleLinks.Add(new VariableRuleLink <CommonRule>()
         {
             Variable = this,
             Entity   = entity as CommonRule
         });
     }
     else if (entity is Sign)
     {
         SignLinks.Add(new VariableModRuleLink <Sign>()
         {
             Variable       = this,
             Entity         = entity as Sign,
             DefinitionType = definitionType
         });
     }
     else if (entity is MenologyRule)
     {
         MenologyRuleLinks.Add(new VariableModRuleLink <MenologyRule>()
         {
             Variable       = this,
             Entity         = entity as MenologyRule,
             DefinitionType = definitionType
         });
     }
     else if (entity is TriodionRule)
     {
         TriodionRuleLinks.Add(new VariableModRuleLink <TriodionRule>()
         {
             Variable       = this,
             Entity         = entity as TriodionRule,
             DefinitionType = definitionType
         });
     }
     else if (entity is ExplicitAddRule)
     {
         ExplicitAddRuleLinks.Add(new VariableRuleLink <ExplicitAddRule>()
         {
             Variable = this,
             Entity   = entity as ExplicitAddRule
         });
     }
 }
Esempio n. 4
0
        private ProductCatalogGroup CreateCatalogGroup()
        {
            var groupDefinitionType = DefinitionType.SingleOrDefault(x => x.Name == "Product Catalog Groups");
            var groupDefinition     = Definition.SingleOrDefault(x => x.DefinitionType == groupDefinitionType);
            var group = ProductCatalogGroup.SingleOrDefault(c => c.Name == _catalogGroupName) ??
                        new ProductCatalogGroupFactory().NewWithDefaults(_catalogGroupName, groupDefinition.Guid);

            group.ProductReviewsRequireApproval = true;
            group.Deleted = false;
            group.CreateCustomersAsMembers = false;
            group.DomainId = null;
            group.Save();
            group.OrderNumberSerie = GetDefaultOrderNumberSeries();
            group.EmailProfile     = GetDefaultEmailProfile();
            group.Save();
            return(group);
        }
Esempio n. 5
0
        private void addEntryToolStripMenuItem_Click(object sender, EventArgs e)
        {
            FormNewGameBINEntry form = new FormNewGameBINEntry(myBIN);

            if (form.ShowDialog(this) == DialogResult.OK)
            {
                byte[] data = null;

                BINEntry defEntry = myBIN.GetEntryByName(
                    form.Template);

                if (defEntry == null)
                {
                    form.Dispose();
                    form = null;
                    MessageBox.Show(this, "Default entry not found.");
                    return;
                }

                data = defEntry.Data;

                BINEntry entry = myBIN.AddEntry(
                    form.SymbolName, form.Definition, data);

                DefinitionType defType =
                    ContentManager.Instance.Definitions.GetDefinition(
                        form.Definition);

                defType.ReadIn(entry);

                defType.FixLinks(
                    LinkDestination.GameBINEntryID,
                    defEntry.ID,
                    entry.ID);

                defType.Write(entry);

                treeView.SelectedNode = AddEntry(entry);

                data = null;
            }

            form.Dispose();
            form = null;
        }
Esempio n. 6
0
        public static Definition Create(DefinitionType type)
        {
            Definition instance;

            if (_Lookup.TryGetValue(type, out var func) == false)
            {
                instance = null;
            }
            else
            {
                instance = func();
            }
            if (instance == null)
            {
                throw new InvalidOperationException($"failed to create instance for {type}");
            }
            return(instance);
        }
Esempio n. 7
0
        public Definition CampaignItemDefinition(string name, string description)
        {
            var            definitionTypes    = new Repository <DefinitionType>(_sessionProvider);
            DefinitionType definitionType     = definitionTypes.Single(x => x.Name == UCommerce.Definitions.CampaignItem);
            Definition     campaignDefinition = _definitions.Value.SingleOrDefault(x => x.Name == name && x.DefinitionType == definitionType);

            if (campaignDefinition == null)
            {
                campaignDefinition = new Definition
                {
                    Name           = name,
                    Description    = description,
                    DefinitionType = definitionType,
                };
            }
            campaignDefinition.Deleted = false;

            return(campaignDefinition);
        }
Esempio n. 8
0
 void ClassifyDefinitionType(InvocationParameterBindings paramBindings)
 {
     if (paramBindings is RuleInvocationParameterBindings)
     {
         DefType = DefinitionType.Action;
     }
     else if (paramBindings is SequenceInvocationParameterBindings)
     {
         DefType = DefinitionType.Sequence;
     }
     else if (paramBindings is ProcedureInvocationParameterBindings)
     {
         DefType = DefinitionType.Procedure;
     }
     else if (paramBindings is FunctionInvocationParameterBindings)
     {
         DefType = DefinitionType.Function;
     }
 }
Esempio n. 9
0
        // Token: 0x06001139 RID: 4409 RVA: 0x0001BA54 File Offset: 0x00019C54
        public static Coroutine GetMaps(string clientVersion, DefinitionType clientType, Action <List <MapView> > callback, Action <Exception> handler)
        {
            Coroutine result;

            using (MemoryStream memoryStream = new MemoryStream())
            {
                StringProxy.Serialize(memoryStream, clientVersion);
                EnumProxy <DefinitionType> .Serialize(memoryStream, clientType);

                result = MonoInstance.Mono.StartCoroutine(SoapClient.MakeRequest("IApplicationWebServiceContract", "ApplicationWebService", "GetMaps", memoryStream.ToArray(), delegate(byte[] data)
                {
                    if (callback != null)
                    {
                        callback(ListProxy <MapView> .Deserialize(new MemoryStream(data), new ListProxy <MapView> .Deserializer <MapView>(MapViewProxy.Deserialize)));
                    }
                }, handler));
            }
            return(result);
        }
Esempio n. 10
0
        /// <summary>
        /// 动态定义标识符
        /// </summary>
        /// <param name="definitionType"></param>
        /// <param name="content"></param>
        /// <returns></returns>
        public ApplicationLayerProtocol DynamicallyDefineDataIdentifier(DefinitionType definitionType, bool priority, params byte[] content)
        {
            ParaInfo[] paras = new ParaInfo[content.Length + 1];

            paras[0].ByteLen = 1;
            paras[0].Value   = (byte)definitionType;

            for (int i = 0; i < content.Length; i++)
            {
                int index = 1;
                paras[index].ByteLen = 1;
                paras[index].Value   = content[i];
                index++;
            }

            ApplicationLayerProtocol newFrame = new ApplicationLayerProtocol(ApplicationLayerProtocol.RequestID, ServicesID.DynamicallyDefineDataIdentifier, priority, paras);

            return(newFrame);
        }
        public void Deserialize(Stream input, Endian endian)
        {
            this.DefinitionType  = input.ReadValueEnum <DefinitionType>(endian);
            this.Size            = input.ReadValueU32(endian);
            this.Unknown08       = input.ReadValueU32(endian);
            this.TypeHash        = input.ReadValueU32(endian);
            this.Name            = input.ReadString(64, true, Encoding.ASCII);
            this.Unknown50       = input.ReadValueU32(endian);
            this.ElementTypeHash = input.ReadValueU32(endian);
            this.Unknown58       = input.ReadValueU32(endian);

            uint count = input.ReadValueU32(endian);

            this.ValueDefinitions.Clear();
            for (uint i = 0; i < count; i++)
            {
                var definition = new DefinitionValue();
                definition.Deserialize(input, endian);
                this.ValueDefinitions.Add(definition);
            }
        }
Esempio n. 12
0
        private string GetPathForType(DefinitionType type)
        {
            switch (type)
            {
            case DefinitionType.Questline:
                return("questline");

            case DefinitionType.UI:
                return("ui");

            case DefinitionType.Conversation:
                return("conversation");

            case DefinitionType.PlayerSave:
                return("saves");

            default:
                Debug.Error($"Unhandled definition type {type}");
                return(string.Empty);
            }
        }
Esempio n. 13
0
 void ClassifyDefinitionType(Invocation invocation, out DefinitionType DefType)
 {
     if (invocation is RuleInvocation)
     {
         DefType = DefinitionType.Action;
     }
     else if (invocation is SequenceInvocation)
     {
         DefType = DefinitionType.Sequence;
     }
     else if (invocation is ProcedureInvocation)
     {
         DefType = DefinitionType.Procedure;
     }
     else if (invocation is FunctionInvocation)
     {
         DefType = DefinitionType.Function;
     }
     else
     {
         DefType = DefinitionType.Unknown;
     }
 }
Esempio n. 14
0
 public void ClearLinks <T>(T entity, DefinitionType definitionType = DefinitionType.Rule) where T : VersionBase//, new()
 {
     /*if (entity is CommonRule)
      * {
      *  CommonRuleLinks.RemoveAll(c => c.Entity == entity);
      * }
      * else*/if (entity is SignVersion)
     {
         SignLinks.RemoveAll(c => c.Entity == entity && c.DefinitionType == definitionType);
     }
     //else if (entity is MenologyRule)
     //{
     //    MenologyRuleLinks.RemoveAll(c => c.Entity == entity && c.DefinitionType == definitionType);
     //}
     //else if (entity is TriodionRule)
     //{
     //    TriodionRuleLinks.RemoveAll(c => c.Entity == entity && c.DefinitionType == definitionType);
     //}
     //else if (entity is ExplicitAddRule)
     //{
     //    ExplicitAddRuleLinks.RemoveAll(c => c.Entity == entity);
     //}
 }
Esempio n. 15
0
        public FormCutscene(BINEntry cutscene)
        {
            InitializeComponent();

            myCutscene = cutscene;

            Text = "Cutscene: " + myCutscene.Name;

            myDefType = ContentManager.Instance.Definitions.GetDefinition(
                myCutscene.Definition);

            myDefType.ReadIn(myCutscene);

            myMode1 = myDefType.FindControl(0x5A1E6CA9);
            myMode2 = myDefType.FindControl(0xC1CABAFF);
            myMode3 = myDefType.FindControl(0x4FC34512);

            textBox1.Text = GetScript(myMode1);
            textBox2.Text = GetScript(myMode2);
            textBox3.Text = GetScript(myMode3);

            myModified = false;
        }
Esempio n. 16
0
 public void ClearLinks <T>(T entity, DefinitionType definitionType = DefinitionType.Rule) where T : RuleEntity//, new()
 {
     if (entity is CommonRule)
     {
         CommonRuleLinks.RemoveAll(c => c.Entity == entity);
     }
     else if (entity is Sign)
     {
         SignLinks.RemoveAll(c => c.Entity == entity && c.DefinitionType == definitionType);
     }
     else if (entity is MenologyRule)
     {
         MenologyRuleLinks.RemoveAll(c => c.Entity == entity && c.DefinitionType == definitionType);
     }
     else if (entity is TriodionRule)
     {
         TriodionRuleLinks.RemoveAll(c => c.Entity == entity && c.DefinitionType == definitionType);
     }
     else if (entity is ExplicitAddRule)
     {
         ExplicitAddRuleLinks.RemoveAll(c => c.Entity == entity);
     }
 }
Esempio n. 17
0
        private void AssetLink(
            BINEntry entryDst,
            AssetTemplate assetItem, UInt32 assetId)
        {
            DefinitionType def =
                ContentManager.Instance.Definitions.GetDefinition(
                    entryDst.Definition);

            def.ReadIn(entryDst);

            FableMod.ContentManagement.Control c =
                def.FindControl(assetItem.ControlID);

            if (c != null)
            {
                ((Member)c.Members[assetItem.Element]).Value =
                    assetId.ToString();

                def.Write(entryDst);
            }

            def = null;
        }
Esempio n. 18
0
        protected override void ShowSelectedEntry()
        {
            ContentManager mgr = ContentManager.Instance;

            ContentObject obj = mgr.FindEntry(
                LinkDestination.GameBINEntryName,
                Selected.Name);

            if (obj != null)
            {
                // Open the model.

                DefinitionType defType = mgr.Definitions.GetDefinition(
                    Selected.Definition);

                if (defType != null)
                {
                    defType.ReadIn(Selected);

                    FableMod.ContentManagement.Control c =
                        defType.FindControl(0xC8636B2E);

                    if (c != null && c.Members.Count == 5)
                    {
                        Member m = (Member)c.Members[1];

                        mgr.ShowEntry(
                            LinkDestination.ModelID,
                            m.Value,
                            true);
                    }

                    c       = null;
                    defType = null;
                }
            }
        }
Esempio n. 19
0
        public void RefreshDefinitionDisplay()
        {
            m_DefType = ContentManager.Instance.Definitions.GetDefinition(
                m_Entry.Definition);

            if (m_DefType != null)
            {
                try
                {
                    if (m_DefDisplay != null)
                    {
                        // Remove old display.
                        this.spltContainerMain.Panel2.Controls.Remove(m_DefDisplay);
                        this.spltContainerMain.Panel2Collapsed = true;
                        m_DefDisplay.Dispose();
                    }

                    m_DefType.ReadIn(m_Entry);

                    m_DefDisplay = new DefinitionTypeDisplay(m_DefType,
                                                             ContentManager.Instance);

                    this.Size = new System.Drawing.Size(Size.Width, 480);

                    this.spltContainerMain.Panel2.Controls.Add(m_DefDisplay);
                    this.spltContainerMain.Panel2Collapsed = false;

                    m_DefDisplay.Dock = DockStyle.Fill;
                }
                catch (Exception exc)
                {
                    this.Size = new System.Drawing.Size(Size.Width, 120);
                    MessageBox.Show(this, exc.Message, "Error Parsing Entry");
                    //txtDefinitionDisplay.Text = "Error parsing entry." + Environment.NewLine + exc.Message;
                }
            }
        }
Esempio n. 20
0
        /// <summary>
        /// 回傳 類型
        /// </summary>
        /// <param name="itemId"></param>
        /// <returns></returns>
        public ITinAction GetTDAAction(DefinitionType itemId)
        {
            switch (itemId)
            {
            case DefinitionType.TREA_ITEM:
                return(new ItemMaintain());

            case DefinitionType.TREA_EQUIP:
                return(new TreasuryMaintain());

            case DefinitionType.MAIL_CONTENT:
                return(new TreasuryMailContent());

            case DefinitionType.MAIL_TIME:
                return(new TreasuryMailTime());

            case DefinitionType.ITEM_CHARGE_UNIT:
                return(new ItemChargeUnit());

            case DefinitionType.DEP_CHK_ITEM:
                return(new DepChkItem());
            }
            return(null);
        }
Esempio n. 21
0
 /// <summary>
 /// Returns true if this addin effects the definition
 /// of a type.
 /// </summary>
 public bool EffectsDefintion(DefinitionType type)
 {
     return((type & effectedDefintions) == type);
 }
 public static String getTable(DefinitionType definitionType)
 {
     return(definitionTables.ContainsKey(definitionType) ? definitionTables[definitionType] : "");
 }
 public static String GetTypeIdName(DefinitionType definitionType)
 {
     return(definitionType.ToDescriptionString());
 }
Esempio n. 24
0
        public PipelineExecutionResult Execute(InstallationPipelineArgs subject)
        {
            var sharedFieldRepository = ObjectFactory.Instance.Resolve <IRepository <SharedField> >();
            var sharedFieldsToSave    = new List <SharedField>();
            var productDefinitions    = ProductDefinition.All().ToList();
            var categoryDefinitions   = Definition.All().Where(x => x.DefinitionType == DefinitionType.Get(1)).ToList();

            foreach (var productDefinition in productDefinitions)
            {
                sharedFieldsToSave.Add(new SharedField()
                {
                    FieldValue = GetXmlLayoutValueForProduct(),
                    FieldId    = FieldIDs.LayoutField.Guid,
                    ItemId     = productDefinition.Guid.Derived("__Standard Values") // This must be set on the Standard Values item. Not the template item directly.
                });
            }

            foreach (var categoryDefinition in categoryDefinitions)
            {
                sharedFieldsToSave.Add(new SharedField()
                {
                    FieldValue = GetXmlLayoutValueForCategory(),
                    FieldId    = FieldIDs.LayoutField.Guid,
                    ItemId     = categoryDefinition.Guid.Derived("__Standard Values") // This must be set on the Standard Values item. Not the template item directly.
                });
            }

            sharedFieldRepository.Save(sharedFieldsToSave);

            return(PipelineExecutionResult.Success);
        }
Esempio n. 25
0
 public AssemblyDefintion(DefinitionType dt, string value)
 {
     this.Type = dt;
     this.value = value;
 }
Esempio n. 26
0
        protected ItemDefinition(DefinitionType type)
            : base(type)
        {

        }
Esempio n. 27
0
        private async Task DownloadArtifactAsync(
            IExecutionContext executionContext,
            ServerBuildArtifact buildArtifact,
            ArtifactDefinition artifactDefinition,
            string localFolderPath,
            BuildHttpClient buildClient,
            XamlBuildHttpClient xamlBuildClient,
            DefinitionType definitionType,
            int buildId)
        {
            var downloadFolderPath   = Path.Combine(localFolderPath, buildArtifact.Name);
            var buildArtifactDetails = artifactDefinition.Details as BuildArtifactDetails;

            if ((buildArtifact.Resource.Type == null && buildArtifact.Id == 0) || // bug on build API Bug 378900
                string.Equals(buildArtifact.Resource.Type, WellKnownArtifactResourceTypes.FilePath, StringComparison.OrdinalIgnoreCase))
            {
                executionContext.Output("Artifact Type: FileShare");
                string fileShare;
                if (buildArtifact.Id == 0)
                {
                    fileShare = new Uri(buildArtifact.Resource.DownloadUrl).LocalPath;
                }
                else
                {
                    fileShare = new Uri(Path.Combine(buildArtifact.Resource.DownloadUrl, buildArtifact.Name)).LocalPath;
                    if (!Directory.Exists(fileShare))
                    {
                        // download path does not exist, log and fall back
                        executionContext.Output(StringUtil.Loc("RMArtifactNameDirectoryNotFound", fileShare, buildArtifact.Resource.DownloadUrl));
                        fileShare = new Uri(buildArtifact.Resource.DownloadUrl).LocalPath;
                    }
                }

                if (!Directory.Exists(fileShare))
                {
                    // download path does not exist, raise exception
                    throw new ArtifactDownloadException(StringUtil.Loc("RMArtifactDirectoryNotFoundError", fileShare));
                }

                var fileShareArtifact = new FileShareArtifact();
                await fileShareArtifact.DownloadArtifactAsync(executionContext, HostContext, artifactDefinition, fileShare, downloadFolderPath);
            }
            else if (string.Equals(buildArtifact.Resource.Type, WellKnownArtifactResourceTypes.Container, StringComparison.OrdinalIgnoreCase))
            {
                executionContext.Output("Artifact Type: ServerDrop");

                // TODO:Get VssBinFetchclient and get away from zipstream downloader
                Stream contentStream;

                if (definitionType == DefinitionType.Xaml)
                {
                    contentStream = await xamlBuildClient.GetArtifactContentZipAsync(buildArtifactDetails.Project, buildId, buildArtifact.Name);
                }
                else
                {
                    contentStream = await buildClient.GetArtifactContentZipAsync(buildArtifactDetails.Project, buildId, buildArtifact.Name);
                }


                var    zipStreamDownloader = HostContext.GetService <IZipStreamDownloader>();
                string artifactRootFolder  = StringUtil.Format("/{0}", buildArtifact.Name);
                await zipStreamDownloader.DownloadFromStream(contentStream, artifactRootFolder, buildArtifactDetails.RelativePath, downloadFolderPath);
            }
            else
            {
                executionContext.Warning(StringUtil.Loc("RMArtifactTypeNotSupported", buildArtifact.Resource.Type));
            }
        }
Esempio n. 28
0
 static TableLayoutModeHelpWindow getHelpWindowFor(DefinitionType symbolType)
 {
     var helpWindow = new TableLayoutModeHelpWindow ();
     helpWindow.TitleText = "<b>Rename " + getDescriptionOfSymbol(symbolType)+"</b>";
     helpWindow.Items.Add (new KeyValuePair<string, string> ("<b>Key</b>", "<b>Behavior</b>"));
     helpWindow.Items.Add (new KeyValuePair<string, string> ("<b>Enter</b>", "<b>Accept</b> this refactoring"));
     helpWindow.Items.Add (new KeyValuePair<string, string> ("<b>ESC</b>", "<b>Cancel</b> this refactoring"));
     return helpWindow;
 }
Esempio n. 29
0
        private async Task DownloadArtifactAsync(
            IExecutionContext executionContext,
            ServerBuildArtifact buildArtifact,
            ArtifactDefinition artifactDefinition,
            string localFolderPath,
            BuildHttpClient buildClient,
            XamlBuildHttpClient xamlBuildClient,
            DefinitionType definitionType,
            int buildId)
        {
            var downloadFolderPath   = Path.Combine(localFolderPath, buildArtifact.Name);
            var buildArtifactDetails = artifactDefinition.Details as BuildArtifactDetails;

            if ((buildArtifact.Resource.Type == null && buildArtifact.Id == 0) || // bug on build API Bug 378900
                string.Equals(buildArtifact.Resource.Type, WellKnownArtifactResourceTypes.FilePath, StringComparison.OrdinalIgnoreCase))
            {
                executionContext.Output("Artifact Type: FileShare");
                string fileShare;
                if (buildArtifact.Id == 0)
                {
                    fileShare = new Uri(buildArtifact.Resource.DownloadUrl).LocalPath;
                }
                else
                {
                    fileShare = new Uri(Path.Combine(buildArtifact.Resource.DownloadUrl, buildArtifact.Name)).LocalPath;
                    if (!Directory.Exists(fileShare))
                    {
                        // download path does not exist, log and fall back
                        var parenthPath = new Uri(buildArtifact.Resource.DownloadUrl).LocalPath;
                        executionContext.Output(StringUtil.Loc("RMArtifactNameDirectoryNotFound", fileShare, parenthPath));
                        fileShare = parenthPath;
                    }
                }

                if (!Directory.Exists(fileShare))
                {
                    // download path does not exist, raise exception
                    throw new ArtifactDownloadException(StringUtil.Loc("RMArtifactDirectoryNotFoundError", fileShare));
                }

                executionContext.Output(StringUtil.Loc("RMDownloadingArtifactFromFileShare", fileShare));

                var fileShareArtifact = new FileShareArtifact();
                await fileShareArtifact.DownloadArtifactAsync(executionContext, HostContext, artifactDefinition, fileShare, downloadFolderPath);
            }
            else if (buildArtifactDetails != null &&
                     string.Equals(buildArtifact.Resource.Type, WellKnownArtifactResourceTypes.Container, StringComparison.OrdinalIgnoreCase))
            {
                executionContext.Output("Artifact Type: ServerDrop");
                // Get containerId and rootLocation for the artifact #/922702/drop
                string[] parts = buildArtifact.Resource.Data.Split(new[] { '/' }, 3);

                if (parts.Length < 3)
                {
                    throw new ArtifactDownloadException(StringUtil.Loc("RMArtifactContainerDetailsNotFoundError", buildArtifact.Name));
                }

                int    containerId;
                string rootLocation = parts[2];
                if (!int.TryParse(parts[1], out containerId))
                {
                    throw new ArtifactDownloadException(StringUtil.Loc("RMArtifactContainerDetailsInvaidError", buildArtifact.Name));
                }

                IContainerProvider containerProvider =
                    new ContainerProviderFactory(buildArtifactDetails, rootLocation, containerId, executionContext).GetContainerProvider(
                        WellKnownArtifactResourceTypes.Container);

                string rootDestinationDir          = Path.Combine(localFolderPath, rootLocation);
                var    containerFetchEngineOptions = new ContainerFetchEngineOptions
                {
                    ParallelDownloadLimit = 4,
                    CancellationToken     = executionContext.CancellationToken
                };

                using (var engine = new ContainerFetchEngine.ContainerFetchEngine(containerProvider, rootLocation, rootDestinationDir))
                {
                    engine.ContainerFetchEngineOptions = containerFetchEngineOptions;
                    engine.ExecutionLogger             = new ExecutionLogger(executionContext);
                    await engine.FetchAsync();
                }
            }
            else
            {
                executionContext.Warning(StringUtil.Loc("RMArtifactTypeNotSupported", buildArtifact.Resource.Type));
            }
        }
Esempio n. 30
0
        public Task<GetDefinitionResponse> GetDefinition(DefinitionType type, long id, Unknown version = default(Unknown), bool? definitions = null)
        {
            var model = new
            {
                type,
                id,
                version,
                definitions
            };

            return Request<GetDefinitionResponse>(model);
        }
Esempio n. 31
0
 public CWDefinition(DefinitionType definitionType)
 {
     this.type = definitionType;
 }
Esempio n. 32
0
 /// <summary>
 /// Finds definitions of the given type
 /// </summary>
 /// <returns>The definitions of.</returns>
 /// <param name="symbolType">Symbol.</param>
 public IEnumerable<DefinitionNode> FindDefinitionsByType(DefinitionType symbolType)
 {
     return definitions.Where (def => def.Type == symbolType);
 }
Esempio n. 33
0
 private UCommerceDefinition Generate(DefinitionType definitionType)
 {
     return(_definitionFaker
            .RuleFor(x => x.DefinitionTypeId, f => (int)definitionType)
            .Generate());
 }
Esempio n. 34
0
 static CompletionData newCompletionData(string name, DefinitionType symbolType)
 {
     return new CompletionData (name, getIcon (symbolType));
 }
Esempio n. 35
0
        //creates a completions list for the given defintion type - so only symbols
        // that have been defined will appear in the list
        HashSet<CompletionData> createCompletionsForType(DefinitionType type)
        {
            var completionList = new HashSet<CompletionData> ();

            //we want only defined symbols in the completion list
            var definitions = doc.FindDefinitionsByType(type);
            //...and no duplicates of names
            var names = new AnyCaseStringSet ();

            foreach (DefinitionNode def in definitions)
            {
                string name = def.Name;
                if (!names.Contains (name))
                {
                    names.Add (name);
                    var completion = newCompletionData (name, type);
                    completionList.Add (completion);
                }
            }
            return completionList;
        }
Esempio n. 36
0
        private async Task DownloadArtifactAsync(
            IExecutionContext executionContext,
            ServerBuildArtifact buildArtifact,
            ArtifactDefinition artifactDefinition,
            string localFolderPath,
            BuildHttpClient buildClient,
            XamlBuildHttpClient xamlBuildClient,
            DefinitionType definitionType,
            int buildId)
        {
            var downloadFolderPath = Path.Combine(localFolderPath, buildArtifact.Name);
            var buildArtifactDetails = artifactDefinition.Details as BuildArtifactDetails;
            if ((buildArtifact.Resource.Type == null && buildArtifact.Id == 0) // bug on build API Bug 378900
                || string.Equals(buildArtifact.Resource.Type, WellKnownArtifactResourceTypes.FilePath, StringComparison.OrdinalIgnoreCase))
            {
                executionContext.Output("Artifact Type: FileShare");
                string fileShare;
                if (buildArtifact.Id == 0)
                {
                    fileShare = new Uri(buildArtifact.Resource.DownloadUrl).LocalPath;
                }
                else
                {
                    fileShare = new Uri(Path.Combine(buildArtifact.Resource.DownloadUrl, buildArtifact.Name)).LocalPath;
                    if (!Directory.Exists(fileShare))
                    {
                        // download path does not exist, log and fall back
                        var parenthPath = new Uri(buildArtifact.Resource.DownloadUrl).LocalPath;
                        executionContext.Output(StringUtil.Loc("RMArtifactNameDirectoryNotFound", fileShare, parenthPath));
                        fileShare = parenthPath;
                    }
                }

                if (!Directory.Exists(fileShare))
                {
                    // download path does not exist, raise exception
                    throw new ArtifactDownloadException(StringUtil.Loc("RMArtifactDirectoryNotFoundError", fileShare));
                }

                executionContext.Output(StringUtil.Loc("RMDownloadingArtifactFromFileShare", fileShare));

                var fileShareArtifact = new FileShareArtifact();
                await fileShareArtifact.DownloadArtifactAsync(executionContext, HostContext, artifactDefinition, fileShare, downloadFolderPath);
            }
            else if (string.Equals(buildArtifact.Resource.Type, WellKnownArtifactResourceTypes.Container, StringComparison.OrdinalIgnoreCase))
            {
                executionContext.Output("Artifact Type: ServerDrop");

                // TODO:Get VssBinFetchclient and get away from zipstream downloader
                Stream contentStream;
                
                if (definitionType == DefinitionType.Xaml)
                {
                    contentStream = await xamlBuildClient.GetArtifactContentZipAsync(buildArtifactDetails.Project, buildId, buildArtifact.Name);
                }
                else
                {
                    contentStream = await buildClient.GetArtifactContentZipAsync(buildArtifactDetails.Project, buildId, buildArtifact.Name);
                }
                

                var zipStreamDownloader = HostContext.GetService<IZipStreamDownloader>();
                string artifactRootFolder = StringUtil.Format("/{0}", buildArtifact.Name);
                await zipStreamDownloader.DownloadFromStream(contentStream, artifactRootFolder, buildArtifactDetails.RelativePath, downloadFolderPath);
            }
            else
            {
                executionContext.Warning(StringUtil.Loc("RMArtifactTypeNotSupported", buildArtifact.Resource.Type));
            }
        }
Esempio n. 37
0
        public async Task DownloadAsync(IExecutionContext executionContext, ArtifactDefinition artifactDefinition, string localFolderPath)
        {
            ArgUtil.NotNull(artifactDefinition, nameof(artifactDefinition));
            ArgUtil.NotNull(executionContext, nameof(executionContext));
            ArgUtil.NotNullOrEmpty(localFolderPath, nameof(localFolderPath));

            int buildId = Convert.ToInt32(artifactDefinition.Version, CultureInfo.InvariantCulture);

            if (buildId <= 0)
            {
                throw new ArgumentException("artifactDefinition.Version");
            }

            var buildArtifactDetails = artifactDefinition.Details as BuildArtifactDetails;

            if (buildArtifactDetails == null)
            {
                throw new ArgumentException("artifactDefinition.Details");
            }

            // Get the list of available artifacts from build.
            executionContext.Output(StringUtil.Loc("RMPreparingToGetBuildArtifactList"));

            var vssConnection   = new VssConnection(buildArtifactDetails.TfsUrl, buildArtifactDetails.Credentials);
            var buildClient     = vssConnection.GetClient <BuildHttpClient>();
            var xamlBuildClient = vssConnection.GetClient <XamlBuildHttpClient>();
            List <ServerBuildArtifact> buildArtifacts      = null;
            DefinitionType             buildDefinitionType = DefinitionType.Build;

            try
            {
                buildArtifacts = await buildClient.GetArtifactsAsync(buildArtifactDetails.Project, buildId);
            }
            catch (BuildNotFoundException)
            {
                buildArtifacts = await xamlBuildClient.GetArtifactsAsync(buildArtifactDetails.Project, buildId);

                buildDefinitionType = DefinitionType.Xaml;
            }

            // No artifacts found in the build => Fail it.
            if (buildArtifacts == null || !buildArtifacts.Any())
            {
                throw new ArtifactDownloadException(StringUtil.Loc("RMNoBuildArtifactsFound", buildId));
            }

            // DownloadFromStream each of the artifact sequentially.
            // TODO: Should we download them parallely?
            foreach (ServerBuildArtifact buildArtifact in buildArtifacts)
            {
                if (Match(buildArtifact, artifactDefinition))
                {
                    executionContext.Output(StringUtil.Loc("RMPreparingToDownload", buildArtifact.Name));
                    await this.DownloadArtifactAsync(executionContext, buildArtifact, artifactDefinition, localFolderPath, buildClient, xamlBuildClient, buildDefinitionType, buildId);
                }
                else
                {
                    executionContext.Warning(StringUtil.Loc("RMArtifactMatchNotFound", buildArtifact.Name));
                }
            }
        }
 void ClassifyDefinitionType(InvocationParameterBindings paramBindings)
 {
     if(paramBindings is RuleInvocationParameterBindings)
         DefType = DefinitionType.Action;
     else if(paramBindings is SequenceInvocationParameterBindings)
         DefType = DefinitionType.Sequence;
     else if(paramBindings is ProcedureInvocationParameterBindings)
         DefType = DefinitionType.Procedure;
     else if(paramBindings is FunctionInvocationParameterBindings)
         DefType = DefinitionType.Function;
 }
Esempio n. 39
0
 protected DefinitionBase(DefinitionType definitionType)
 {
     this.definitionType = definitionType;
 }
 partial void OnDefinitionTypeIdChanging(DefinitionType value);
Esempio n. 41
0
        void findSegmentsForRenaming(string text, int documentPosition)
        {
            var doc = new GoldParsedDocument ();
            doc.Parse (text);

            //not everything can be renamed
            var token = doc.GetTokenAt (documentPosition);

            if (tokenIsRenameable (token))
            {
                primarySegment = tokenToSegment (token);
                symbolType = TokenUtil.GetDefinitionType(token);

                //get our list of items to rename
                var renameItems = doc.FindUsesOf(token.Text);

                TextSegment segment;
                foreach (Token renameItem in renameItems)
                {
                    segment = tokenToSegment (renameItem);
                    textSegmentList.Add (segment);
                }
            }
        }
Esempio n. 42
0
 protected DefinitionBase(DefinitionType definitionType)
 {
     this.definitionType = definitionType;
 }
Esempio n. 43
0
        public CWDefinition(DefinitionType definitionType)
		{
			this.type = definitionType;
		}
Esempio n. 44
0
        public static oval_results CreateFromDocuments(
            Definitions.oval_definitions definitions, 
            oval_system_characteristics systemcharacteristics,
            oval_variables evaluatedExternalVariables)
        {
            oval_results newResult = new oval_results();
            newResult.generator = DocumentHelpers.GetDefaultGenerator();
            newResult.oval_definitions = definitions;
            newResult.results =  new List<SystemType> { new SystemType() };
            newResult.results[0].oval_system_characteristics = systemcharacteristics;
            newResult.EvaluatedExternalVariables = evaluatedExternalVariables;

            // Generate new Definition Result entries
            foreach (var definition in definitions.definitions)
            {
                if ((definition.criteria == null) || (definition.criteria.Items == null) || (definition.criteria.Items.Count() < 1))
                    continue;
                var newDefinitionResult = new DefinitionType(definition);
                newResult.results[0].definitions.Add(newDefinitionResult);
            }
            // Generate new Test Result entries
            foreach (var test in definitions.tests)
            {
                var newTestResult = new TestType(test);
                newResult.results[0].tests.Add(newTestResult);
            }
            return newResult;
        }
 public static SqlColumn[] getColumns(DefinitionType definitionType)
 {
     return(definitionColumns.ContainsKey(definitionType) ? definitionColumns[definitionType] : new SqlColumn[] { });
 }
Esempio n. 46
0
 static IconId getIcon(DefinitionType symbolType)
 {
     IconId icon;
     bool foundIcon = iconMap.TryGetValue (symbolType, out icon);
     if (!foundIcon)
         icon = IconId.Null;
     return icon;
 }
 private static Reference GenerateType(StdBELista queryInfo, DefinitionType definitionType)
 {
     return(new Reference(TypeParser.String(queryInfo.Valor(GetTypeIdName(definitionType))), TypeParser.String(queryInfo.Valor("Descricao"))));
 }
Esempio n. 48
0
 /// <summary>
 /// Gets the tokens in the document that match the given type
 /// </summary>
 /// <returns>The tokens by type.</returns>
 /// <param name="symbolType">Symbol type.</param>
 public IEnumerable<Token> FindTokensByType(DefinitionType symbolType)
 {
     return tokenList.Where (token => TokenUtil.GetDefinitionType (token) == symbolType);
 }