Exemplo n.º 1
0
        internal string AddSpecReference(
            ISymbol symbol,
            IReadOnlyList<string> typeGenericParameters,
            IReadOnlyList<string> methodGenericParameters,
            Dictionary<string, ReferenceItem> references,
            SymbolVisitorAdapter adapter)
        {
            var id = SpecIdHelper.GetSpecId(symbol, typeGenericParameters, methodGenericParameters);
            ReferenceItem reference = new ReferenceItem();
            reference.Parts = new SortedList<SyntaxLanguage, List<LinkItem>>();
            GenerateReferenceInternal(symbol, reference, adapter);
            reference.IsDefinition = symbol.IsDefinition;

            if (!symbol.IsDefinition)
            {
                var def = symbol.OriginalDefinition;
                var typeParameters = def.Accept(TypeGenericParameterNameVisitor.Instance);
                reference.Definition = AddSpecReference(def, typeParameters, null, references, adapter);
            }

            reference.Parent = GetReferenceParent(symbol, typeGenericParameters, methodGenericParameters, references, adapter);

            if (!references.ContainsKey(id))
            {
                references[id] = reference;
            }
            else
            {
                references[id].Merge(reference);
            }

            return id;
        }
 internal override void GenerateReferenceInternal(ISymbol symbol, ReferenceItem reference, SymbolVisitorAdapter adapter)
 {
     foreach (var generator in _generators)
     {
         generator.GenerateReferenceInternal(symbol, reference, adapter);
     }
 }
Exemplo n.º 3
0
 public CSReferenceItemVisitor(ReferenceItem referenceItem) : base(referenceItem)
 {
     if (!referenceItem.Parts.ContainsKey(SyntaxLanguage.CSharp))
     {
         referenceItem.Parts.Add(SyntaxLanguage.CSharp, new List<LinkItem>());
     }
 }
Exemplo n.º 4
0
        internal string AddReference(string id, Dictionary<string, ReferenceItem> references)
        {
            ReferenceItem reference;
            if (!references.TryGetValue(id, out reference))
            {
                // Add id to reference dictionary
                references[id] = new ReferenceItem();
            }

            return id;
        }
Exemplo n.º 5
0
        public override DataItem CreateData(UndoRedoManager undoRedo)
        {
            var item = new ReferenceItem(this, undoRedo);

            if (Definitions.Count == 1 && !IsNullable)
            {
                item.ChosenDefinition = Definitions.Values.First();
                item.Create();
            }

            foreach (var att in Attributes)
            {
                var attItem = att.CreateData(undoRedo);
                item.Attributes.Add(attItem);
            }

            return(item);
        }
Exemplo n.º 6
0
        public override DataItem LoadData(XElement element, UndoRedoManager undoRedo)
        {
            var key = element.Attribute(MetaNS + "RefKey")?.Value?.ToString();

            if (key == null)
            {
                key = element.Attribute("RefKey")?.Value?.ToString();
            }

            ReferenceItem item = null;

            if (key != null && Definitions.ContainsKey(key))
            {
                var def = Definitions[key];

                item = new ReferenceItem(this, undoRedo);
                item.ChosenDefinition = def;

                var loaded = def.LoadData(element, undoRedo);
                item.WrappedItem = loaded;
            }
            else
            {
                item = CreateData(undoRedo) as ReferenceItem;
            }

            foreach (var att in Attributes)
            {
                var      el      = element.Attribute(att.Name);
                DataItem attItem = null;

                if (el != null)
                {
                    attItem = att.LoadData(new XElement(el.Name, el.Value.ToString()), undoRedo);
                }
                else
                {
                    attItem = att.CreateData(undoRedo);
                }
                item.Attributes.Add(attItem);
            }

            return(item);
        }
Exemplo n.º 7
0
        private static string GetName(ReferenceItem reference, SyntaxLanguage language, Converter <LinkItem, string> getName)
        {
            var list = reference.Parts.GetLanguageProperty(language);

            if (list == null)
            {
                return(null);
            }
            if (list.Count == 0)
            {
                Debug.Fail("Unexpected reference.");
                return(null);
            }
            if (list.Count == 1)
            {
                return(getName(list[0]));
            }
            return(string.Concat(list.ConvertAll(item => getName(item)).ToArray()));
        }
Exemplo n.º 8
0
        internal string AddReference(ISymbol symbol, Dictionary<string, ReferenceItem> references, SymbolVisitorAdapter adapter)
        {
            var id = VisitorHelper.GetId(symbol);

            ReferenceItem reference = new ReferenceItem();
            reference.Parts = new SortedList<SyntaxLanguage, List<LinkItem>>();
            reference.IsDefinition = symbol.IsDefinition;
            GenerateReferenceInternal(symbol, reference, adapter);

            if (!references.ContainsKey(id))
            {
                references[id] = reference;
            }
            else
            {
                references[id].Merge(reference);
            }

            return id;
        }
Exemplo n.º 9
0
        public async Task <JsonResult> CreatorUpdateReferenceItem([FromForm] IFormCollection itemData)
        {
            StringValues itemInfo;
            StringValues langLabelInfo;

            itemData.TryGetValue("item", out itemInfo);
            itemData.TryGetValue("langLabel", out langLabelInfo);

            ReferenceItem         item       = JsonConvert.DeserializeObject <ReferenceItem>(itemInfo);
            List <ReferenceLabel> langLabels = JsonConvert.DeserializeObject <List <ReferenceLabel> >(langLabelInfo);

            int res = await this._referenceRepository.CreatorUpdateItem(item, langLabels);

            ApiResult result = new ApiResult()
            {
                Success = true, Msg = "OK", Type = "200"
            };

            return(Json(result));
        }
Exemplo n.º 10
0
    void UndestandingProgram(List <Item> _functs, List <BasicSlot> _slots, int _level)
    {
        if (_level > deepRecursion)
        {
            Debug.LogError("Error");            //"StackOverflow so many calls"
            return;
        }
        for (int i = 0; i < _functs.Count; i++)
        {
            slots.Add(_slots[i]);
            if (_functs[i].type == TypeItem.Reference)
            {
                ReferenceItem    refItem    = _functs[i] as ReferenceItem;
                List <Item>      innerItems = refItem.container.GetItems();
                List <BasicSlot> innerSlots = refItem.container.GetSlots();

                UndestandingProgram(innerItems, innerSlots, _level + 1);
            }
            items.Add(_functs[i]);
        }
    }
Exemplo n.º 11
0
        public override void Init(object initData)
        {
            base.Init(initData);
            string id = (string)initData;

            if (!string.IsNullOrEmpty(id))
            {
                Data = customSyncEngine.Realm.All <Employee>().Where(w => w.Id == id).FirstOrDefault();
            }
            if (Data == null)
            {
                Title         = $"Add {nameof(Employee)}";
                IsNewData     = true;
                Data          = new Employee();
                Data.Birthday = DateTime.Now;
            }
            else
            {
                Title = $"Edit {nameof(Employee)}";
            }
            DateTimeBirthday = Data.Birthday.LocalDateTime;

            //Prepare the navigation property for binding
            if (Data.Department == null)
            {
                SelectedDepartmentItem = DepartmentItems.Where(w => w.Id == Guid.Empty.ToString()).First();
            }
            else
            {
                ReferenceItem referenceItem = DepartmentItems.Where(w => w.Id == Data.Department.Id).FirstOrDefault();
                if (referenceItem == null)
                {
                    SelectedDepartmentItem = DepartmentItems.Where(w => w.Id == Guid.Empty.ToString()).First();
                }
                else
                {
                    SelectedDepartmentItem = referenceItem;
                }
            }
        }
Exemplo n.º 12
0
        internal string AddOverloadReference(ISymbol symbol, Dictionary<string, ReferenceItem> references, SymbolVisitorAdapter adapter)
        {
            string uidBody = VisitorHelper.GetOverloadIdBody(symbol);

            ReferenceItem reference = new ReferenceItem();
            reference.Parts = new SortedList<SyntaxLanguage, List<LinkItem>>();
            reference.IsDefinition = true;
            reference.CommentId = "Overload:" + uidBody;
            GenerateReferenceInternal(symbol, reference, adapter, true);

            var uid = uidBody + "*";
            if (!references.ContainsKey(uid))
            {
                references[uid] = reference;
            }
            else
            {
                references[uid].Merge(reference);
            }

            return uid;
        }
Exemplo n.º 13
0
        private void AddRow(object sender, EventArgs e)
        {
            var dt    = ReferenceData.Roles();
            var items = new List <ReferenceItem>();

            if (dt != null)
            {
                foreach (DataRow dr in dt.Rows)
                {
                    var item = new ReferenceItem
                    {
                        Id          = dr["RoleId"].ToString(),
                        Code        = dr["Code"].ToString(),
                        Description = dr["Description"].ToString(),
                    };
                    items.Add(item);
                }
            }
            var result = Finder.SearchMultiple(items);

            if (result != null)
            {
                foreach (var item in result)
                {
                    if (!dgItems.IsExist(dtlRoleId.Index, item.Id))
                    {
                        dgItems.Rows.Add(1);
                        var row = dgItems.Rows.Count - 1;
                        dgItems[dtlId.Index, row].Value              = "0";
                        dgItems[dtlRoleId.Index, row].Value          = item.Id;
                        dgItems[dtlRoleCode.Index, row].Value        = item.Code;
                        dgItems[dtlRoleDescription.Index, row].Value = item.Description;
                    }
                }
            }
        }
Exemplo n.º 14
0
        public void SelectItem()
        {
            var menu = new SelectionMenu();

            menu.AddItem(new SelectionMenuItem(string.Empty, "[None]", () =>
            {
                ReferenceItem.SetInput(null);
            }));
            menu.ConvertAndAdd(ReferenceItem.GetAllowed().OfType <IItem>(), _ =>
            {
                var item = _ as IValueItem;
                if (item == null)
                {
                    return;
                }
                if (IsInput)
                {
                    ReferenceItem.SetInput(item);
                }
                else
                {
                    ReferenceItem.SetOutput(item);
                }
            });

            InvertApplication.SignalEvent <IShowSelectionMenu>(_ => _.ShowSelectionMenu(menu));

//            InvertGraphEditor.WindowManager.InitItemWindow(ReferenceItem.GetAllowed().ToArray(), _ =>
//            {
//                InvertApplication.Execute(new LambdaCommand("Set Item", () =>
//                {
//
//
//                }));
//            });
        }
Exemplo n.º 15
0
 static public ReferenceItem Run()
 {
     using var form = new SelectReferenceForm();
     while (true)
     {
         try
         {
             if (form.ShowDialog() != DialogResult.OK)
             {
                 return(null);
             }
             LastReference = new ReferenceItem(form.EditReference.Text);
             if (LastReference is null)
             {
                 return(null);
             }
             if (LastReference.Book is null)
             {
                 throw new KeyNotFoundException(nameof(LastReference.Book));
             }
             if (LastReference.Chapter is null)
             {
                 LastReference = new ReferenceItem(LastReference.Book.Number, 1, 1);
             }
             if (LastReference.Verse is null)
             {
                 LastReference = new ReferenceItem(LastReference.Book.Number, LastReference.Chapter.Number, 1);
             }
             return(LastReference);
         }
         catch
         {
             DisplayManager.ShowError(AppTranslations.BadReference.GetLang(form.EditReference.Text));
         }
     }
 }
Exemplo n.º 16
0
        /// <summary>
        /// Adds a reference from a file path.
        /// </summary>
        /// <param name="path">Path to file</param>
        /// <param name="assemblyName">Name of assembly file</param>
        public void AddReference(string path, string assemblyName)
        {
            ReferenceItem refItem = new ReferenceItem(path, assemblyName);

            _references.Add(refItem);
        }
Exemplo n.º 17
0
        private bool OnExecuteSingle(BuildContext context)
        {
            BuildLogger logger = context.Logger;

            ReferenceGroupContext groupContext =
                context.GroupContexts[_group.Id] as ReferenceGroupContext;

            if (groupContext == null)
            {
                throw new BuildException(
                          "The group context is not provided, and it is required by the build system.");
            }

            ReferenceContent content = _group.Content;

            if (content == null)
            {
                if (logger != null)
                {
                    logger.WriteLine("StepReferenceInit: There is no content associated with the reference group.",
                                     BuildLoggerLevel.Error);
                }

                return(false);
            }

            BuildFrameworkType frameworkType = content.FrameworkType;

            if (frameworkType == BuildFrameworkType.Null ||
                frameworkType == BuildFrameworkType.None)
            {
                if (logger != null)
                {
                    logger.WriteLine("StepReferenceInit: There is no valid framework type specified for this reference group.",
                                     BuildLoggerLevel.Error);
                }

                return(false);
            }

            BuildFramework framework = BuildFrameworks.GetFramework(frameworkType);

            if (framework == null)
            {
                if (logger != null)
                {
                    logger.WriteLine("StepReferenceInit: The specified framework type for this reference group is not installed.",
                                     BuildLoggerLevel.Error);
                }

                return(false);
            }

            string workingDir = context.WorkingDirectory;

            groupContext.Framework = framework;

            string commentDir  = groupContext.CommentFolder;
            string assemblyDir = groupContext.AssemblyFolder;

            if (String.IsNullOrEmpty(commentDir))
            {
                commentDir = "Comments";
            }
            if (!Path.IsPathRooted(commentDir))
            {
                commentDir = Path.Combine(workingDir, commentDir);
            }
            if (!Directory.Exists(commentDir))
            {
                Directory.CreateDirectory(commentDir);
            }

            if (String.IsNullOrEmpty(assemblyDir))
            {
                assemblyDir = "Assemblies";
            }
            if (!Path.IsPathRooted(assemblyDir))
            {
                assemblyDir = Path.Combine(workingDir, assemblyDir);
            }
            if (!Directory.Exists(assemblyDir))
            {
                Directory.CreateDirectory(assemblyDir);
            }

            string dependencyDir = groupContext.DependencyFolder;

            if (String.IsNullOrEmpty(dependencyDir))
            {
                dependencyDir = "Dependencies";
            }
            if (!Path.IsPathRooted(dependencyDir))
            {
                dependencyDir = Path.Combine(workingDir, dependencyDir);
            }
            if (!Directory.Exists(dependencyDir))
            {
                Directory.CreateDirectory(dependencyDir);
            }

            groupContext.CommentDir    = commentDir;
            groupContext.AssemblyDir   = assemblyDir;
            groupContext.DependencyDir = dependencyDir;

            // Copy the comments to the expected directory...
            int           itemCount    = content.Count;
            List <string> commentFiles = new List <string>(itemCount);

            CommentContent commentContent = content.Comments;

            if (commentContent != null && !commentContent.IsEmpty)
            {
                string commentFile = Path.Combine(commentDir,
                                                  groupContext["$CommentsFile"]);

                // If there is a valid file or there is an attached file...
                BuildFilePath filePath = commentContent.ContentFile;
                if (filePath != null && filePath.Exists)
                {
                    if (commentContent.IsLoaded)
                    {
                        commentContent.Save();
                    }

                    File.Copy(filePath.Path, commentFile);
                }
                else
                {
                    commentContent.SaveCopyAs(commentFile);
                }
                File.SetAttributes(commentFile, FileAttributes.Normal);

                commentFiles.Add(commentFile);
            }

            for (int i = 0; i < itemCount; i++)
            {
                ReferenceItem item = content[i];
                if (item == null || item.IsEmpty)
                {
                    continue;
                }

                string commentsFile = item.Comments;
                if (!String.IsNullOrEmpty(commentsFile))
                {
                    string fileName = Path.GetFileName(commentsFile);
                    fileName = Path.Combine(commentDir, fileName);
                    if (commentsFile.Length != fileName.Length ||
                        String.Equals(commentsFile, fileName,
                                      StringComparison.OrdinalIgnoreCase) == false)
                    {
                        File.Copy(commentsFile, fileName, true);
                        File.SetAttributes(fileName, FileAttributes.Normal);

                        commentFiles.Add(fileName);
                    }
                }

                string assemblyFile = item.Assembly;
                if (!String.IsNullOrEmpty(assemblyFile))
                {
                    string fileName = Path.GetFileName(assemblyFile);
                    fileName = Path.Combine(assemblyDir, fileName);
                    if (assemblyFile.Length != fileName.Length ||
                        String.Equals(assemblyFile, fileName,
                                      StringComparison.OrdinalIgnoreCase) == false)
                    {
                        File.Copy(assemblyFile, fileName, true);
                        File.SetAttributes(fileName, FileAttributes.Normal);
                    }
                }
            }

            // Finally, store the list of extracted comment file to its context...
            groupContext.CommentFiles = commentFiles;

            // 1. Copy the dependencies to the expected directory...
            ReferenceProjectVisitor dependencyResolver =
                new ReferenceProjectVisitor();

            dependencyResolver.Initialize(context);
            dependencyResolver.Visit(_group);
            dependencyResolver.Uninitialize();

            return(true);
        }
Exemplo n.º 18
0
        public List <FundResponse.UploadReportData> UploadFundResponse(User user, string zipPath, bool runScenario)
        {
            List <FundResponse.UploadReportData> report = new List <FundResponse.UploadReportData>();
            string zipDirectoryName = Path.Combine(ConfiguraionProvider.FileStorageFolder, Path.GetFileNameWithoutExtension(zipPath));

            ZipHelper.UnZipFiles(zipPath, zipDirectoryName);
            FundResponseCreateDataBuilder builder = new FundResponseCreateDataBuilder();
            var      responsesToCreate            = GetResponsesFromArchive(builder, zipDirectoryName);
            var      responsesByclientVisitId     = GroupByClientVisitId(report, responsesToCreate);
            DateTime date = DateTime.Now;

            foreach (var pack in responsesByclientVisitId)
            {
                long        clientVisitId = pack.Key;
                ClientVisit clientVisit   = ClientDao.Instance.ClientVisit_Get(clientVisitId);
                if (clientVisit == null)
                {
                    foreach (var response in pack.Value)
                    {
                        report.Add(new FundResponse.UploadReportData()
                        {
                            Recid            = response.Recid,
                            ClientVisitId    = clientVisitId,
                            ResponseTypeName = response.GetResponseTypeName(),
                            UploadResult     = "Не найдена соответствующая заявка"
                        });
                    }
                    continue;
                }
                ClientVisit   lastClientVisitInGroup = ClientDao.Instance.ClientVisit_GetLastClientVisitInGroup(clientVisit.VisitGroupId);
                ReferenceItem lastCurrentStatus      = clientVisit.Status;
                DateTime      lastClientStatusDate   = clientVisit.StatusDate;
                long?         lastClientVisitId      = null;
                if (lastClientVisitInGroup.Status.Id == ClientVisitStatuses.FundError.Id ||
                    lastClientVisitInGroup.Status.Id == ClientVisitStatuses.AnswerPending.Id ||
                    lastClientVisitInGroup.Status.Id == ClientVisitStatuses.Processed.Id)
                {
                    clientBusinessLogic.ClientVisit_SetStatus(user, lastClientVisitInGroup.Id, ClientVisitStatuses.Reconciliation.Id, true);
                    lastCurrentStatus    = ClientVisitStatuses.Reconciliation;
                    lastClientStatusDate = date;
                }
                if (lastClientVisitInGroup.Status.Id == ClientVisitStatuses.SubmitPending.Id)
                {
                    ClientVisit.SaveData newClientVisitData = new ClientVisit.SaveData(lastClientVisitInGroup);
                    newClientVisitData.Status     = ClientVisitStatuses.Reconciliation.Id;
                    lastCurrentStatus             = ClientVisitStatuses.Reconciliation;
                    newClientVisitData.StatusDate = date;
                    lastClientStatusDate          = date;
                    newClientVisitData.IsActual   = true;
                    var saveResult = clientBusinessLogic.ClientVisit_Save(user, newClientVisitData, date);
                    lastClientVisitId = saveResult.ClientVisitID;
                }
                foreach (var response in pack.Value)
                {
                    FundProcessingDao.Instance.FundResponse_Create(response, date);
                    report.Add(AddReportItem(clientVisit, response, lastClientVisitId, lastCurrentStatus, lastClientStatusDate));
                }
                if (runScenario)
                {
                    clientVisit = ClientDao.Instance.ClientVisit_GetLastClientVisitInGroup(clientVisit.VisitGroupId);
                    ScenarioResolver     resolver         = new ScenarioResolver(clientVisit, pack.Value.OfType <ReconciliationFundResponse.CreateData>().ToList());
                    ReferenceItem        resolvedScenario = resolver.GetResolvedScenario();
                    ClientVisit.SaveData data             = ClientVisit.SaveData.BuildSaveData(clientVisit);
                    if (resolvedScenario != null)
                    {
                        data.ScenarioId = resolvedScenario.Id;
                        data.FundResponseApplyingMessage = string.Format("Сценарий изменён с {0} на {1}",
                                                                         clientVisit.Scenario != null ? clientVisit.Scenario.Code : string.Empty, resolvedScenario.Code);
                        data.IsReadyToFundSubmitRequest = true;
                        ClientVisitOldDataBuilder oldDataBuilder = new ClientVisitOldDataBuilder(data,
                                                                                                 pack.Value.OfType <IReconciliationFundResponse>().ToList());
                        ClientVisit firstClientVisit             = clientBusinessLogic.ClientVisit_GetFirstClientVisitInGroup(clientVisit.VisitGroupId);
                        ClientVisitNewDataBuilder newDataBuilder = new ClientVisitNewDataBuilder(data, firstClientVisit,
                                                                                                 pack.Value.OfType <IReconciliationFundResponse>().ToList());
                        data = oldDataBuilder.Process();
                        data = newDataBuilder.Process();
                    }
                    clientBusinessLogic.ClientVisit_Save(user, data);
                }
            }
            return(report);
        }
Exemplo n.º 19
0
        private static void TestSilverlightWPF(BuildDocumenter documenter,
                                               TestOptions options, ReferenceEngineSettings engineSettings)
        {
            if (tocType == CustomTocType.ReferenceRoot)
            {
                return;
            }

            // Decide which Caliburn Micro library to include: Silverlight or WPF
            bool useSilverlight = true;

            string libraryDir = Path.Combine(sampleDir, @"SampleLibrary\");

            if (useSilverlight)
            {
                string outputDir = Path.Combine(libraryDir, @"Libraries\Caliburn.Micro\Silverlight\");
                //string projectDoc = Path.Combine(outputDir, "Project.xml");

                ReferenceGroup apiGroup = new ReferenceGroup(
                    "Test Silverlight 4", Guid.NewGuid().ToString());
                apiGroup.RunningHeaderText = "Sandcastle Helpers: Test Silverlight 4.0";
                //apiGroup.RootTopicId = "d36e744f-c053-4e94-9ac9-b1ee054d8de1";
                apiGroup.SyntaxType        |= BuildSyntaxType.Xaml;
                apiGroup.EnableXmlnsForXaml = true;

                if (engineSettings.RootNamespaceContainer)
                {
                    apiGroup.RootNamespaceTitle = "Caliburn Micro for Silverlight 4.0 v1.0 RTW";
                }

                ReferenceContent apiContent = apiGroup.Content;
                apiContent.FrameworkType = BuildFrameworkType.Silverlight40;

                //apiGroup.AddItem(projectDoc, null);
                //apiContent.AddItem(Path.Combine(outputDir, "Caliburn.Micro.xml"),
                //    Path.Combine(outputDir, "Caliburn.Micro.dll"));
                ReferenceItem refItem = new ReferenceItem(
                    Path.Combine(outputDir, "Caliburn.Micro.xml"),
                    Path.Combine(outputDir, "Caliburn.Micro.dll"));
                //refItem.XamlSyntax = true;
                apiContent.Add(refItem);

                //apiContent.AddDependency(Path.Combine(outputDir, "System.Windows.Interactivity.dll"));

                documenter.AddGroup(apiGroup);
            }
            else
            {
                string outputDir = Path.Combine(libraryDir, @"Libraries\Caliburn.Micro\WPF\");
                //string projectDoc = Path.Combine(outputDir, "Project.xml");

                ReferenceGroup apiGroup = new ReferenceGroup(
                    "Test WPF .NET 4", Guid.NewGuid().ToString());
                apiGroup.RunningHeaderText = "Sandcastle Helpers: Test .NET Framework 4.0";
                //apiGroup.RootTopicId = "d36e744f-c053-4e94-9ac9-b1ee054d8de1";
                apiGroup.SyntaxType        |= BuildSyntaxType.Xaml;
                apiGroup.EnableXmlnsForXaml = true;

                if (engineSettings.RootNamespaceContainer)
                {
                    apiGroup.RootNamespaceTitle = "Caliburn Micro for WPF 4.0 v1.0 RTW";
                }

                ReferenceContent apiContent = apiGroup.Content;
                apiContent.FrameworkType = BuildFrameworkType.Framework40;

                //apiGroup.AddItem(projectDoc, null);
                //apiContent.AddItem(Path.Combine(outputDir, "Caliburn.Micro.xml"),
                //    Path.Combine(outputDir, "Caliburn.Micro.dll"));
                ReferenceItem refItem = new ReferenceItem(
                    Path.Combine(outputDir, "Caliburn.Micro.xml"),
                    Path.Combine(outputDir, "Caliburn.Micro.dll"));
                //refItem.XamlSyntax = true;
                apiContent.Add(refItem);

                //apiContent.AddDependency(Path.Combine(outputDir, "System.Windows.Interactivity.dll"));

                documenter.AddGroup(apiGroup);
            }
        }
Exemplo n.º 20
0
 internal abstract void GenerateReferenceInternal(ISymbol symbol, ReferenceItem reference, SymbolVisitorAdapter adapter);
Exemplo n.º 21
0
    public void OnUnZipComplete()
    {
        if (processingTask != null)
        {
            if (processingTask.type == TaskType.Model)
            {
                ModelItem Model = DlcMng.Ins.GetModelMeta(processingTask.index);
                if (Model != null)
                {
                    string[] files = System.IO.Directory.GetFiles(Model.LocalPath.Substring(0, Model.LocalPath.Length - 4), "*.*", System.IO.SearchOption.AllDirectories);
                    if (Model.resPath == null)
                    {
                        Model.resPath = new List <string>();
                    }
                    if (Model.resCrc == null)
                    {
                        Model.resCrc = new List <string>();
                    }
                    Model.resPath.Clear();
                    Model.resCrc.Clear();
                    for (int i = 0; i < files.Length; i++)
                    {
                        Model.resPath.Add(files[i].Replace("\\", "/"));
                        Model.resCrc.Add(Utility.getFileHash(files[i]));
                    }
                    Model.Installed = true;
                    GameStateMgr.Ins.gameStatus.RegisterModel(Model);
                }
            }
            else if (processingTask.type == TaskType.Chapter)
            {
                Chapter Chapter = DlcMng.Ins.GetChapterMeta(processingTask.index);
                if (Chapter != null)
                {
                    string[] files = System.IO.Directory.GetFiles(Chapter.LocalPath.Substring(0, Chapter.LocalPath.Length - 4), "*.*", System.IO.SearchOption.AllDirectories);
                    if (Chapter.resPath == null)
                    {
                        Chapter.resPath = new List <string>();
                    }
                    if (Chapter.resCrc == null)
                    {
                        Chapter.resCrc = new List <string>();
                    }
                    if (Chapter.Res == null)
                    {
                        Chapter.Res = new List <ReferenceItem>();
                    }
                    Chapter.resPath.Clear();
                    Chapter.resCrc.Clear();
                    Chapter.Res.Clear();
                    for (int i = 0; i < files.Length; i++)
                    {
                        //Debug.Log(files[i]);
                        System.IO.FileInfo fi       = new System.IO.FileInfo(files[i]);
                        ReferenceItem      template = new ReferenceItem();
                        template.Name = fi.Name.Substring(0, fi.Name.Length - fi.Extension.Length);
                        template.Path = files[i].Replace("\\", "/");

                        if (fi.Extension.ToLower() == ".txt")
                        {
                            if (fi.FullName.Contains("npc/") || fi.FullName.Contains("npc\\"))
                            {
                                template.Type = FileExt.Txt;
                            }
                        }
                        else if (fi.Extension.ToLower() == ".pos")    //动画分段配置
                        {
                            template.Type = FileExt.Pos;
                        }
                        else if (fi.Extension.ToLower() == ".des")    //关卡配置
                        {
                            template.Type = FileExt.Des;
                        }
                        else if (fi.Extension.ToLower() == ".skc")    //角色皮肤
                        {
                            template.Type = FileExt.Skc;
                        }
                        else if (fi.Extension.ToLower() == ".bnc")    //角色骨架
                        {
                            template.Type = FileExt.Bnc;
                        }
                        else if (fi.Extension.ToLower() == ".png")    //贴图
                        {
                            template.Type = FileExt.Png;
                        }
                        else if (fi.Extension.ToLower() == ".jpg")    //贴图
                        {
                            template.Type = FileExt.Jpeg;
                        }
                        else if (fi.Extension.ToLower() == ".amb")    //动画
                        {
                            template.Type = FileExt.Amb;
                        }
                        else if (fi.Extension.ToLower() == ".wp")    //路点
                        {
                            template.Type = FileExt.WayPoint;
                        }
                        else if (fi.Extension.ToLower() == ".gmc")    //模型
                        {
                            template.Type = FileExt.Gmc;
                        }
                        else if (fi.Extension.ToLower() == ".fmc")    //动画
                        {
                            template.Type = FileExt.Fmc;
                        }
                        else if (fi.Extension.ToLower() == ".gmb")    //模型
                        {
                            template.Type = FileExt.Gmc;
                        }
                        else if (fi.Extension.ToLower() == ".ef")    //特效
                        {
                            template.Type = FileExt.Sfx;
                        }
                        else if (fi.Extension.ToLower() == ".dll")    //特效
                        {
                            template.Type = FileExt.Dll;
                        }
                        else if (fi.Extension.ToLower() == ".json")    //特效
                        {
                            template.Type = FileExt.Json;
                        }
                        else if (fi.Extension.ToLower() == ".mp3")
                        {
                            template.Type = FileExt.MP3;
                        }
                        Chapter.Res.Add(template);
                        Chapter.resPath.Add(files[i].Replace("\\", "/"));
                        Chapter.resCrc.Add(Utility.getFileHash(files[i]));
                    }
                    Chapter.Installed = true;
                    GameStateMgr.Ins.gameStatus.RegisterDlc(Chapter);
                }
            }
            GameStateMgr.Ins.SaveState();
            processingTask.state = TaskStatus.Installed;
            //刷新一下各个任务的状态.
            if (DlcManagerDialogState.Exist)
            {
                DlcManagerDialogState.Instance.OnRefresh(processingTask.index, processingTask.type);
            }

            if (client != null)
            {
                client.Dispose();
                client = null;
            }
            if (processingTask != null)
            {
                RemoveTask(processingTask.type, processingTask.index);
            }
            processingTask = null;
            processing     = false;
        }
    }
Exemplo n.º 22
0
 protected ReferenceItemVisitor(ReferenceItem referenceItem)
 {
     ReferenceItem = referenceItem;
 }
Exemplo n.º 23
0
 private static string GetName(ReferenceItem reference, SyntaxLanguage language, Converter<LinkItem, string> getName)
 {
     var list = reference.Parts.GetLanguageProperty(language);
     if (list == null)
     {
         return null;
     }
     if (list.Count == 0)
     {
         Debug.Fail("Unexpected reference.");
         return null;
     }
     if (list.Count == 1)
     {
         return getName(list[0]);
     }
     return string.Concat(list.ConvertAll(item => getName(item)).ToArray());
 }
Exemplo n.º 24
0
        public async Task <IHttpActionResult> PostReferencesAsync(string portalUri, string pageUri, [FromBody] IEnumerable <ReferenceItemDto> model, CancellationToken cancellationToken)
        {
            if (model == null || !ModelState.IsValid)
            {
                return(BadRequest());
            }
            var portal = await _portalManager.FindByUriAsync(portalUri, cancellationToken);

            await ApiSecurity.AuthorizeAsync(portal, AccessPermission.CanEdit, cancellationToken);

            var page = await _portalManager.GetPageByUriAsync(portal, pageUri, cancellationToken);

            if (page == null)
            {
                return(NotFound());
            }
            var validationResult = await _portalManager.SetPageReferencesAsync(portal, page, model.Select(r => ReferenceItem.Create(r.Type, r.Uri)), cancellationToken);

            if (!validationResult.Succeeded)
            {
                return(this.ValidationContent(validationResult));
            }
            return(Ok(ModelMapper.ToPageDto(page)));
        }
Exemplo n.º 25
0
 public VBReferenceItemVisitor(ReferenceItem referenceItem, bool asOverload) : base(referenceItem)
 {
     _asOverload = asOverload;
     if (!referenceItem.Parts.ContainsKey(SyntaxLanguage.VB))
     {
         referenceItem.Parts.Add(SyntaxLanguage.VB, new List<LinkItem>());
     }
 }
Exemplo n.º 26
0
 private ImportVerseForm(ReferenceItem reference) : this()
 {
     Text     += $" - {reference}";
     Reference = reference;
 }
Exemplo n.º 27
0
 internal override sealed void GenerateReferenceInternal(ISymbol symbol, ReferenceItem reference, SymbolVisitorAdapter adapter)
 {
     GenerateReference(symbol, reference, adapter);
 }
Exemplo n.º 28
0
 protected abstract void GenerateReference(ISymbol symbol, ReferenceItem reference, SymbolVisitorAdapter adapter);
Exemplo n.º 29
0
 protected override void GenerateReference(ISymbol symbol, ReferenceItem reference, SymbolVisitorAdapter adapter)
 {
     symbol.Accept(new VBReferenceItemVisitor(reference));
 }
Exemplo n.º 30
0
 private static bool? GetIsExternal(ReferenceItem reference)
 {
     if (reference.IsDefinition != true)
     {
         return null;
     }
     foreach (var list in reference.Parts.Values)
     {
         foreach (var item in list)
         {
             if (item.IsExternalPath)
             {
                 return true;
             }
         }
     }
     return false;
 }
Exemplo n.º 31
0
 public void Remove(ReferenceItem reference)
 {
     Items.Remove(reference);
     Save();
 }
Exemplo n.º 32
0
 protected override void GenerateReference(ISymbol symbol, ReferenceItem reference, SymbolVisitorAdapter adapter, bool asOverload)
 {
     symbol.Accept(new CSReferenceItemVisitor(reference, asOverload));
 }
Exemplo n.º 33
0
 /// <summary>
 /// Exits the element.
 /// </summary>
 /// <param name="item">The item.</param>
 public void ExitElement(ReferenceItem item)
 {
 }
Exemplo n.º 34
0
        private void makeControls(ReferenceItem referenceItem)
        {
            if (!referenceItem.HasParameters)
            {
                return;
            }
            Panel panel = new Panel();
            panel.Style.Add("border", "none");
            panel.Style.Add("margin-bottom", "10px");

            Literal literal = new Literal();
            literal.Text = string.Format("<strong>{0}</strong><br/>", referenceItem.Name);
            panel.ID = Control.GetUniqueID(string.Concat("params_", referenceItem.GetType().Name.ToLower(), "_", referenceItem.Name.ToLower(), "_"));
            panel.Controls.Add(literal);
            foreach (var pi in referenceItem.Parameters)
            {
                Inline i = new Inline();
                Label l = new Label();

                l.Header = pi.Title + ":";
                l.Style.Add("font-weight", "bold");
                l.Style.Add("margin-right", "10px");
                l.Style.Add("margin-left", "20px");
                l.Style.Add("width", "100px");
                l.Style.Add("text-align", "right");
                l.Style.Add("float", "left");

                Control input = pi.MakeControl();
                l.For = input.ID;

                i.Style.Add("display", "block");
                i.Style.Add("margin-top", "5px");
                i.Value = input.ID;
                i.ID = Control.GetUniqueID("params_" + pi.Name + "_");
                i.Controls.Add(l);
                i.Controls.Add(input);
                Literal lit = new Literal();
                lit.Text = "<br/>";
                i.Controls.Add(lit);
                panel.Controls.Add(i);
            }
            ConfigSection.Controls.Add(panel);
        }
Exemplo n.º 35
0
 static ClientVisitScenaries()
 {
     PolicyExtradition = new ReferenceItem()
     {
         Id = 2, Code = "POK", Name = "Выдача ЕНП на руки"
     };
     ReregistrationRegionalOldPolicyWithoutFIO = new ReferenceItem()
     {
         Id = 3, Code = "PT", Name = "Замена старого регионального полиса без изменения Ф,И,О, ДУЛ"
     };
     ReregistrationRegionalOldPolicyWithFIO = new ReferenceItem()
     {
         Id = 4, Code = "PRT", Name = "Изгот.ЕНП по старому регион.полису с изменением Ф,И,О, ДУЛ"
     };
     NewUnifiedPolicyNumberByOldPolicy = new ReferenceItem()
     {
         Id = 5, Code = "PR", Name = "замена старого полиса на новый с изменением реквизитов застрахованного"
     };
     ChangeDocument = new ReferenceItem()
     {
         Id = 10, Code = "CD", Name = "Изменение ДУЛ, добавление СНИЛС"
     };
     ReregistrationMoscowENPWithoutFIO = new ReferenceItem()
     {
         Id = 15, Code = "CI", Name = "Перерегистрация московского ЕНП без изменения Ф,И,О, ДУЛ"
     };
     ReregistrationRegionalENPWithoutFIO = new ReferenceItem()
     {
         Id = 17, Code = "CT", Name = "Перерегистрация регионального ЕНП без изменения Ф,И,О, ДУЛ"
     };
     LostENPWithoutFIO = new ReferenceItem()
     {
         Id = 6, Code = "DP", Name = "Изгот.ЕНП при порче,утрате ЕНП без изм.Ф,И,О,ДУЛ при наличии ЕНП или КМС своей СМО"
     };
     FirstRequestENP = new ReferenceItem()
     {
         Id = 13, Code = "NB", Name = "Первичное изготовление ЕНП"
     };
     RequestENPSameSMOChangeFIO = new ReferenceItem()
     {
         Id = 14, Code = "CR", Name = "Переизготовление ЕНП своей СМО с изменением Ф,И,О, ДУЛ"
     };
     ReregistrationMoscowENPWithFIO = new ReferenceItem()
     {
         Id = 16, Code = "RI", Name = "Перерегистрация московского ЕНП с изменением Ф,И,О, ДУЛ"
     };
     ReregistrationRegionalENPWithFIO = new ReferenceItem()
     {
         Id = 18, Code = "RT", Name = "Перерегистрация регионального ЕНП с изменением Ф,И,О, ДУЛ"
     };
     NewUnifiedPolicyNumberByKMS = new ReferenceItem()
     {
         Id = 9, Code = "CP", Name = "Изготовление ЕНП по своей КМС без изменения Ф,И,О, ДУЛ"
     };
     NewUnifiedPolicyNumberByKMSOtherSMO = new ReferenceItem()
     {
         Id = 7, Code = "PI", Name = "Изготовление ЕНП по КМС другой СМО без изменения Ф,И,О, ДУЛ"
     };
     NewUnifiedPolicyNumberByKMSOtherSMOWithFIO = new ReferenceItem()
     {
         Id = 8, Code = "PRI", Name = "Изготовление ЕНП по КМС другой СМО с изменением Ф,И,О, ДУЛ"
     };
     PolicyMerge = new ReferenceItem()
     {
         Id = 12, Code = "MP", Name = "Объединение двух полисов"
     };
     PolicySeparation = new ReferenceItem()
     {
         Id = 19, Code = "RD", Name = "Разъединение двух полисов"
     };
     RemoveFromRegister = new ReferenceItem()
     {
         Id = 20, Code = "CLR", Name = "Снятие с учета ЕНП или КМС своей СМО"
     };
     ChangeSexOrBirthdaySMO = new ReferenceItem()
     {
         Id = 11, Code = "CPV", Name = "Изменение пола, даты рожд. в ЕНП или КМС своей СМО - промежуточное действие"
     };
     PolicyRecovery = new ReferenceItem()
     {
         Id = 1, Code = "AD", Name = "Восстановление КМС или ЕНП своей СМО в РС ЕРЗЛ по положит.ответу св.5"
     };
 }
 public override string ToString() => $"Item: {ReferenceItem.GetType().Name}";
Exemplo n.º 37
0
        private static void TestRedirection(BuildDocumenter documenter,
                                            TestOptions options, ReferenceEngineSettings engineSettings)
        {
            if (tocType == CustomTocType.ReferenceRoot)
            {
                return;
            }

            string libraryDir = Path.Combine(sampleDir, @"SampleLibrary\Libraries\");

            string outputDir  = Path.Combine(libraryDir, @"Redirects\");
            string projectDoc = Path.Combine(outputDir, "Project.xml");

            ReferenceGroup apiGroup = new ReferenceGroup(
                "Testing Redirection", Guid.NewGuid().ToString());

            apiGroup.RunningHeaderText = "Sandcastle Helpers: Testing Assembly Redirection";

            apiGroup.SyntaxType        |= BuildSyntaxType.Xaml;
            apiGroup.EnableXmlnsForXaml = true;
            apiGroup.VersionType        = ReferenceVersionType.Assembly;

            if (engineSettings.RootNamespaceContainer)
            {
                apiGroup.RootNamespaceTitle = "Testing Assembly Redirection";
            }

            ReferenceContent apiContent = apiGroup.Content;

            apiContent.FrameworkType = BuildFrameworkType.Framework40;

            apiContent.AddItem(projectDoc, null);
            ReferenceItem refItem = new ReferenceItem(
                Path.Combine(outputDir, "Tests.Drawings.xml"),
                Path.Combine(outputDir, "Tests.Drawings.dll"));

            //refItem.XamlSyntax = true;
            apiContent.Add(refItem);

            //apiContent.AddDependency(Path.Combine(outputDir, "Tests.Shapes.dll"));
            //apiContent.AddDependency(Path.Combine(outputDir, "Tests.Geometries.dll"));

            documenter.AddGroup(apiGroup);

            // Testing embedded documents...
            //apiGroup = new ReferenceGroup(
            //    "Testing Embeddeding", Guid.NewGuid().ToString());
            //apiGroup.ExcludeToc = true; //NOTE!!!
            //apiGroup.RunningHeaderText = "Sandcastle Helpers: Testing Assembly Redirection";

            //apiGroup.SyntaxType |= BuildSyntaxType.Xaml;
            //apiGroup.EnableXmlnsForXaml = true;
            //apiGroup.VersionType = ReferenceVersionType.Assembly;

            //if (engineSettings.RootNamespaceContainer)
            //{
            //    apiGroup.RootNamespaceTitle = "Testing Assembly Redirection";
            //}

            //apiContent = apiGroup.Content;
            //apiContent.FrameworkType = BuildFrameworkType.Framework40;
            //apiContent.AddItem(projectDoc, null);

            //apiContent.AddItem(projectDoc, null);
            //refItem = new ReferenceItem(
            //    Path.Combine(outputDir, "Tests.Shapes.xml"),
            //    Path.Combine(outputDir, "Tests.Shapes.dll"));
            //refItem.XamlSyntax = true;
            //apiContent.Add(refItem);

            //refItem = new ReferenceItem(
            //    Path.Combine(outputDir, "Tests.Geometries.xml"),
            //    Path.Combine(outputDir, "Tests.Geometries.dll"));
            //refItem.XamlSyntax = true;
            //apiContent.Add(refItem);

            //documenter.AddGroup(apiGroup);

            ReferenceLinkSource linkSource = new ReferenceLinkSource();

            refItem = new ReferenceItem(projectDoc, null);
            //refItem.XamlSyntax = true;
            linkSource.Add(refItem);

            refItem = new ReferenceItem(
                Path.Combine(outputDir, "Tests.Shapes.xml"),
                Path.Combine(outputDir, "Tests.Shapes.dll"));
            //refItem.XamlSyntax = true;
            linkSource.Add(refItem);

            refItem = new ReferenceItem(
                Path.Combine(outputDir, "Tests.Geometries.xml"),
                Path.Combine(outputDir, "Tests.Geometries.dll"));
            //refItem.XamlSyntax = true;
            linkSource.Add(refItem);

            engineSettings.AddLinkSource(linkSource);
        }
Exemplo n.º 38
0
    private void UpdateBookmarks()
    {
        try
        {
            if (Settings.AutoSortBookmarks)
            {
                BookmarkItems.Sort();
            }
            while (ActionBookmarks.DropDownItems.Count > BookmarkMenuIndex)
            {
                ActionBookmarks.DropDownItems.RemoveAt(BookmarkMenuIndex);
            }
            var bookmarkMaster = new ReferenceItem(Settings.BookmarkMasterBook,
                                                   Settings.BookmarkMasterChapter,
                                                   Settings.BookmarkMasterVerse);
            void bookmarkClicked(object sender, MouseEventArgs e)
            {
                if (e.Button != MouseButtons.Right)
                {
                    return;
                }
                var menuitem = (ToolStripMenuItem)sender;

                if (!DisplayManager.QueryYesNo(SysTranslations.AskToDeleteBookmark.GetLang((ReferenceItem)menuitem.Tag)))
                {
                    return;
                }
                if (menuitem == ActionGoToBookmarkMain)
                {
                    Settings.BookmarkMasterBook    = 1;
                    Settings.BookmarkMasterChapter = 1;
                    Settings.BookmarkMasterVerse   = 1;
                    UpdateBookmarks();
                }
                else
                {
                    BookmarkItems.Remove((ReferenceItem)menuitem.Tag);
                    UpdateBookmarks();
                }
            }
            ActionGoToBookmarkMain.Text     = bookmarkMaster.ToStringBasedOnPrefs();
            ActionGoToBookmarkMain.Tag      = bookmarkMaster;
            ActionGoToBookmarkMain.MouseUp += bookmarkClicked;
            if (bookmarkMaster.CompareTo(CurrentReference) == 0)
            {
                ActionGoToBookmarkMain.Font = new Font(ActionGoToBookmarkMain.Font, FontStyle.Bold);
            }
            else
            {
                ActionGoToBookmarkMain.Font = new Font(ActionGoToBookmarkMain.Font, FontStyle.Regular);
            }
            if (BookmarkItems.Count > 0)
            {
                foreach (var reference in BookmarkItems)
                {
                    var item = (ToolStripMenuItem)ActionBookmarks.DropDownItems.Add(reference.ToStringBasedOnPrefs());
                    item.Tag          = reference;
                    item.Click       += GoToBookmark;
                    item.MouseUp     += bookmarkClicked;
                    item.ImageScaling = ToolStripItemImageScaling.None;
                    item.Image        = ActionGoToBookmarks.Image;
                    if (reference.CompareTo(CurrentReference) == 0)
                    {
                        item.Font = new Font(item.Font, FontStyle.Bold);
                    }
                }
            }
            ActionClearBookmarks.Enabled = BookmarkItems.Count > 0 && ActionBookmarks.DropDownItems.Count > BookmarkMenuIndex;
            ActionSortBookmarks.Enabled  = BookmarkItems.Count > 0 && !Settings.AutoSortBookmarks;
            SeparatorBookmarks.Visible   = BookmarkItems.Count > 0;
        }
        catch (Exception ex)
        {
            ex.Manage();
        }
    }
 public void Revert()
 {
     ReferenceItem.SetItem(OldItem);
     TrackingItemCache.Instance.SetCacheObject(ReferenceItem, OldItem);
 }
Exemplo n.º 40
0
        private bool OnExecuteMultiple(BuildContext context)
        {
            ReferenceGroupContext groupContext =
                context.GroupContexts[_group.Id] as ReferenceGroupContext;

            if (groupContext == null)
            {
                throw new BuildException(
                          "The group context is not provided, and it is required by the build system.");
            }

            BuildLogger logger = context.Logger;

            for (int v = 0; v < _listVersions.Count; v++)
            {
                ReferenceVersions versions = _listVersions[v];

                for (int j = 0; j < versions.Count; j++)
                {
                    ReferenceVersionSource source = versions[j];

                    ReferenceGroupContext versionsContext =
                        groupContext.Contexts[source.SourceId];

                    string workingDir = versionsContext["$WorkingDir"];

                    ReferenceContent content = source.Content;
                    if (content == null)
                    {
                        if (logger != null)
                        {
                            logger.WriteLine("StepReferenceInit: There is no content associated with the reference group.",
                                             BuildLoggerLevel.Error);
                        }

                        return(false);
                    }

                    BuildFrameworkType frameworkType = content.FrameworkType;
                    if (frameworkType == BuildFrameworkType.Null ||
                        frameworkType == BuildFrameworkType.None)
                    {
                        if (logger != null)
                        {
                            logger.WriteLine("StepReferenceInit: There is no valid framework type specified for this reference group.",
                                             BuildLoggerLevel.Error);
                        }

                        return(false);
                    }

                    BuildFramework framework = BuildFrameworks.GetFramework(frameworkType);
                    if (framework == null)
                    {
                        if (logger != null)
                        {
                            logger.WriteLine("StepReferenceInit: The specified framework type for this reference group is not installed.",
                                             BuildLoggerLevel.Error);
                        }

                        return(false);
                    }

                    versionsContext.Framework = framework;

                    string commentDir  = versionsContext.CommentFolder;
                    string assemblyDir = versionsContext.AssemblyFolder;
                    if (String.IsNullOrEmpty(commentDir))
                    {
                        commentDir = "Comments";
                    }
                    if (!Path.IsPathRooted(commentDir))
                    {
                        commentDir = Path.Combine(workingDir, commentDir);
                    }
                    if (!Directory.Exists(commentDir))
                    {
                        Directory.CreateDirectory(commentDir);
                    }

                    if (String.IsNullOrEmpty(assemblyDir))
                    {
                        assemblyDir = "Assemblies";
                    }
                    if (!Path.IsPathRooted(assemblyDir))
                    {
                        assemblyDir = Path.Combine(workingDir, assemblyDir);
                    }
                    if (!Directory.Exists(assemblyDir))
                    {
                        Directory.CreateDirectory(assemblyDir);
                    }

                    string dependencyDir = versionsContext.DependencyFolder;
                    if (String.IsNullOrEmpty(dependencyDir))
                    {
                        dependencyDir = "Dependencies";
                    }
                    if (!Path.IsPathRooted(dependencyDir))
                    {
                        dependencyDir = Path.Combine(workingDir, dependencyDir);
                    }
                    if (!Directory.Exists(dependencyDir))
                    {
                        Directory.CreateDirectory(dependencyDir);
                    }

                    versionsContext.CommentDir    = commentDir;
                    versionsContext.AssemblyDir   = assemblyDir;
                    versionsContext.DependencyDir = dependencyDir;

                    // Copy the comments to the expected directory...
                    int           itemCount    = content.Count;
                    List <string> commentFiles = new List <string>(itemCount);

                    for (int i = 0; i < itemCount; i++)
                    {
                        ReferenceItem item = content[i];
                        if (item == null || item.IsEmpty)
                        {
                            continue;
                        }

                        string commentsFile = item.Comments;
                        if (!String.IsNullOrEmpty(commentsFile))
                        {
                            string fileName = Path.GetFileName(commentsFile);
                            fileName = Path.Combine(commentDir, fileName);
                            if (commentsFile.Length != fileName.Length ||
                                String.Equals(commentsFile, fileName,
                                              StringComparison.OrdinalIgnoreCase) == false)
                            {
                                File.Copy(commentsFile, fileName, true);
                                File.SetAttributes(fileName, FileAttributes.Normal);

                                commentFiles.Add(fileName);
                            }
                        }

                        string assemblyFile = item.Assembly;
                        if (!String.IsNullOrEmpty(assemblyFile))
                        {
                            string fileName = Path.GetFileName(assemblyFile);
                            fileName = Path.Combine(assemblyDir, fileName);
                            if (assemblyFile.Length != fileName.Length ||
                                String.Equals(assemblyFile, fileName,
                                              StringComparison.OrdinalIgnoreCase) == false)
                            {
                                File.Copy(assemblyFile, fileName, true);
                                File.SetAttributes(fileName, FileAttributes.Normal);
                            }
                        }
                    }

                    //TODO--PAUL: Should the project/namespace summary be included?

                    // Finally, store the list of extracted comment file to its context...
                    versionsContext.CommentFiles = commentFiles;

                    // 1. Copy the dependencies to the expected directory...
                    ReferenceProjectVisitor dependencyResolver =
                        new ReferenceProjectVisitor(source.SourceId, content);
                    dependencyResolver.Initialize(context);
                    dependencyResolver.Visit(_group);
                    dependencyResolver.Uninitialize();
                }
            }

            return(true);
        }
Exemplo n.º 41
0
 public Dependency(ReferenceItem r)
 {
     _name    = r.Name;
     _version = r.Version;
 }
Exemplo n.º 42
0
 int IEqualityComparer <ReferenceItem> .GetHashCode(ReferenceItem obj)
 => StringComparer.Ordinal.GetHashCode(obj?.Word?.Translation ?? string.Empty);
Exemplo n.º 43
0
        private bool MakeControls(ReferenceItem referenceItem)
        {
            if (!referenceItem.HasParameters)
            {
                return false;
            }

            var panel = new Panel();
            panel.Style.Add("border", "none");
            panel.Style.Add("margin-bottom", "10px");

            var literal = new Literal
                {
                    Text =
                        string.Format("<div style=\"margin-left:10px;margin-top:4px;font-weight:bold\">{0}</div><br/>",
                                      referenceItem.PrettyName)
                };
            panel.ID =
                Control.GetUniqueID(
                    string.Concat("params_", referenceItem.GetType().Name.ToLower(), "_", referenceItem.Name.ToLower(),
                                  "_"));
            panel.Controls.Add(literal);
            foreach (var pi in referenceItem.Parameters)
            {
                var i = new Inline();
                var l = new Label {Header = pi.Title + ":"};

                l.Style.Add("font-weight", "bold");
                l.Style.Add("padding-top", "5px");
                l.Style.Add("margin-right", "10px");
                l.Style.Add("margin-left", "20px");
                l.Style.Add("width", "100px");
                l.Style.Add("text-align", "right");
                l.Style.Add("float", "left");

                var input = pi.MakeControl();
                l.For = input.ID;

                i.Style.Add("display", "block");
                i.Style.Add("margin-top", "5px");
                i.Value = input.ID;
                i.ID = Control.GetUniqueID("params_" + pi.Name + "_");
                i.Controls.Add(l);
                i.Controls.Add(input);
                var lit = new Literal {Text = "<br/>"};
                i.Controls.Add(lit);
                panel.Controls.Add(i);
            }
            ConfigSection.Controls.Add(panel);
            return true;
        }
Exemplo n.º 44
0
 public static ReferenceItemDto ToDto(this ReferenceItem obj)
 {
     return(new () { Rid = obj.Rid, Name = obj.Name });
 }
Exemplo n.º 45
0
 private static List<SpecViewModel> GetSpec(ReferenceItem reference, SyntaxLanguage language)
 {
     var list = reference.Parts.GetLanguageProperty(language);
     if (list == null || list.Count <= 1)
     {
         return null;
     }
     return list.ConvertAll(SpecViewModel.FromModel);
 }
Exemplo n.º 46
0
        public override void Process(IList <SearchSource> item)
        {
            Recorder.Trace(4L, TraceType.InfoTrace, "CompleteSourceLookup.Process Item:", item);
            Guid guid = new Guid("aca47e7e-5bb8-43ed-976a-f3158f6d4df7");
            List <PreviewItem>       list  = new List <PreviewItem>();
            List <MailboxStatistics> list2 = new List <MailboxStatistics>();
            SearchMailboxesInputs    searchMailboxesInputs = base.Context.TaskContext as SearchMailboxesInputs;
            Uri     baseUri = new Uri("http://local/");
            StoreId value   = new VersionedId(new byte[]
            {
                3,
                1,
                2,
                3,
                3,
                1,
                2,
                3,
                byte.MaxValue
            });
            UniqueItemHash itemHash   = new UniqueItemHash(string.Empty, string.Empty, null, false);
            PagingInfo     pagingInfo = ((SearchMailboxesInputs)base.Executor.Context.Input).PagingInfo;
            ReferenceItem  sortValue  = new ReferenceItem(pagingInfo.SortBy, ExDateTime.Now, 0L);
            Dictionary <PropertyDefinition, object> properties = new Dictionary <PropertyDefinition, object>
            {
                {
                    ItemSchema.Id,
                    value
                }
            };

            foreach (SearchSource searchSource in item)
            {
                if (searchSource.MailboxInfo != null && (searchSource.MailboxInfo.MailboxGuid != Guid.Empty || searchSource.MailboxInfo.IsRemoteMailbox))
                {
                    Dictionary <string, string> dictionary = new Dictionary <string, string>();
                    if (searchSource.MailboxInfo != null && searchSource.MailboxInfo.MailboxGuid != Guid.Empty)
                    {
                        Dictionary <string, string> dictionary2 = dictionary;
                        string key = "Name";
                        string value2;
                        if ((value2 = searchSource.OriginalReferenceId) == null)
                        {
                            value2 = (searchSource.MailboxInfo.DisplayName ?? string.Empty);
                        }
                        dictionary2[key]   = value2;
                        dictionary["Smtp"] = (searchSource.MailboxInfo.PrimarySmtpAddress.ToString() ?? string.Empty);
                        dictionary["DN"]   = (searchSource.MailboxInfo.LegacyExchangeDN ?? string.Empty);
                    }
                    if (searchMailboxesInputs != null)
                    {
                        dictionary["Lang"]   = (searchMailboxesInputs.Language ?? string.Empty);
                        dictionary["Config"] = (searchMailboxesInputs.SearchConfigurationId ?? string.Empty);
                    }
                    Uri owaLink = LinkUtils.AppendQueryString(baseUri, dictionary);
                    Recorder.Trace(4L, TraceType.InfoTrace, new object[]
                    {
                        "CompleteSourceLookup.Process Found:",
                        searchSource.ReferenceId,
                        "MailboxInfo:",
                        searchSource.MailboxInfo
                    });
                    list.Add(new PreviewItem(properties, (searchSource.MailboxInfo.MailboxGuid != Guid.Empty) ? searchSource.MailboxInfo.MailboxGuid : guid, owaLink, sortValue, itemHash)
                    {
                        MailboxInfo = searchSource.MailboxInfo
                    });
                    list2.Add(new MailboxStatistics(searchSource.MailboxInfo, 0UL, new ByteQuantifiedSize(0UL)));
                }
            }
            SortedResultPage resultPage   = new SortedResultPage(list.ToArray(), pagingInfo);
            ISearchResult    searchResult = new ResultAggregator(resultPage, null, 0UL, new ByteQuantifiedSize(0UL), null, null, list2);

            base.Executor.EnqueueNext(new SearchMailboxesResults(item)
            {
                SearchResult = searchResult
            });
        }
Exemplo n.º 47
0
 private static string GetHref(ReferenceItem reference)
 {
     foreach (var list in reference.Parts.Values)
     {
         foreach (var item in list)
         {
             if (item.Href != null)
             {
                 return item.Href;
             }
         }
     }
     return null;
 }
Exemplo n.º 48
0
 internal abstract void GenerateReferenceInternal(ISymbol symbol, ReferenceItem reference, SymbolVisitorAdapter adapter, bool asOverload = false);
Exemplo n.º 49
0
        public void Update(ProjectConfiguration projConfig, Project proj, MonoDevelopWorkspace.ProjectDataMap projectMap,
                           ImmutableArray <ProjectFile> files,
                           ImmutableArray <FilePath> analyzers,
                           ImmutableArray <MonoDevelopMetadataReference> metadataReferences,
                           ImmutableArray <Microsoft.CodeAnalysis.ProjectReference> projectReferences)
        {
            if (!loaded)
            {
                return;
            }

            var paths   = new string [files.Length];
            var actions = new string [files.Length];

            for (int i = 0; i < files.Length; ++i)
            {
                paths [i]   = files [i].FilePath;
                actions [i] = files [i].BuildAction;
            }

            var projectRefs = new ReferenceItem [projectReferences.Length];

            for (int i = 0; i < projectReferences.Length; ++i)
            {
                var pr        = projectReferences [i];
                var mdProject = projectMap.GetMonoProject(pr.ProjectId);
                projectRefs [i] = new ReferenceItem {
                    FilePath = mdProject.FileName,
                    Aliases  = pr.Aliases.ToArray(),
                };
            }

            var item = new ProjectCache {
                Format             = format,
                Analyzers          = analyzers.Select(x => (string)x).ToArray(),
                Files              = paths,
                BuildActions       = actions,
                MetadataReferences = metadataReferences.Select(x => {
                    var ri = new ReferenceItem {
                        FilePath = x.FilePath,
                        Aliases  = x.Properties.Aliases.ToArray(),
                    };
                    return(ri);
                }).ToArray(),
                ProjectReferences = projectRefs,
            };

            var cacheFile = GetProjectCacheFile(proj, projConfig.Id);

            FileLock fileLock = AcquireWriteLock(cacheFile);

            try {
                lock (fileLock) {
                    var serializer = new JsonSerializer();
                    using (var fs = File.Open(cacheFile, FileMode.Create))
                        using (var sw = new StreamWriter(fs)) {
                            serializer.Serialize(sw, item);
                        }
                }
            } finally {
                ReleaseWriteLock(cacheFile, fileLock);
            }
        }
Exemplo n.º 50
0
        internal string AddSpecReference(
            ISymbol symbol,
            IReadOnlyList<string> typeGenericParameters,
            IReadOnlyList<string> methodGenericParameters,
            Dictionary<string, ReferenceItem> references,
            SymbolVisitorAdapter adapter)
        {
            var rawId = VisitorHelper.GetId(symbol);
            var id = SpecIdHelper.GetSpecId(symbol, typeGenericParameters, methodGenericParameters);
            if (string.IsNullOrEmpty(id))
            {
                throw new InvalidDataException($"Fail to parse id for symbol {symbol.MetadataName} in namespace {symbol.ContainingSymbol?.MetadataName}.");
            }
            ReferenceItem reference = new ReferenceItem();
            reference.Parts = new SortedList<SyntaxLanguage, List<LinkItem>>();
            GenerateReferenceInternal(symbol, reference, adapter);
            var originalSymbol = symbol;
            var reducedFrom = (symbol as IMethodSymbol)?.ReducedFrom;
            if (reducedFrom != null)
            {
                originalSymbol = reducedFrom;
            }
            reference.IsDefinition = (originalSymbol == symbol) && (id == rawId) && (symbol.IsDefinition || VisitorHelper.GetId(symbol.OriginalDefinition) == rawId);

            if (!reference.IsDefinition.Value && rawId != null)
            {
                reference.Definition = AddReference(originalSymbol.OriginalDefinition, references, adapter);
            }

            reference.Parent = GetReferenceParent(originalSymbol, typeGenericParameters, methodGenericParameters, references, adapter);
            reference.CommentId = VisitorHelper.GetCommentId(originalSymbol);

            if (!references.ContainsKey(id))
            {
                references[id] = reference;
            }
            else
            {
                references[id].Merge(reference);
            }

            return id;
        }
Exemplo n.º 51
0
        private IEnumerable<string> GetReferenceKeys(ReferenceItem reference)
        {
            if (reference.Definition != null)
            {
                yield return reference.Definition;
            }

            if (reference.Parent != null)
            {
                yield return reference.Parent;
            }
        }
 public void Apply()
 {
     ReferenceItem.SetItem(NewItem);
     TrackingItemCache.Instance.SetCacheObject(ReferenceItem, NewItem);
 }